Added PlayerJIP event, handled full requests on JIP.

This commit is contained in:
jaynus 2015-04-17 18:23:26 -07:00
parent 2be38c493c
commit 8fa0c91632
3 changed files with 50 additions and 2 deletions

View File

@ -107,7 +107,6 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
// PFH to raise varios events
[{
// "playerInventoryChanged" event
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
@ -190,6 +189,32 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
}] call FUNC(addCanInteractWithCondition);
// Synced ACE events
// Handle JIP scenario
if(!isServer) then{
["PlayerJip", {
diag_log text format["[ACE] - JIP event synchronization initialized"];
["SEH_all", [player]] call FUNC(serverEvent);
}] call FUNC(addEventHandler);
} else {
["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
};
["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
[FUNC(syncedEventPFH), 0.5, []] call cba_fnc_addPerFrameHandler;
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it
if(isNull player) then {
// We are jipping! Get ready and wait, and throw the event
[{
PARAMS_2(_args,_handle);
if(!isNull player) then {
["PlayerJip", [player] ] call FUNC(localEvent);
[_handle] call cba_fnc_removePerFrameHandler;
};
}, 0, []] call cba_fnc_addPerFrameHandler;
};

View File

@ -0,0 +1,23 @@
/*
* Author: jaynus
*
*
* Argument:
*
* Return value:
* Boolean of success
*/
#define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_1(_client);
{
private["_eventName", "_eventEntry", "_eventLog"];
_eventName = _x;
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
_eventLog = _eventEntry select 1;
["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
} forEach (GVAR(syncedEvents) select 0);
true

View File

@ -7,7 +7,7 @@
* Return value:
* Boolean of success
*/
#define DEBUG_MODE_FULL
#define DEBUG_MODE_FULL
#include "script_component.hpp"
//SEH_s