mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
JIP Sync events complete.
This commit is contained in:
parent
da09b74fe4
commit
93d03b404f
@ -65,9 +65,31 @@ if (_currentVersion != _previousVersion) then {
|
|||||||
|
|
||||||
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
||||||
|
|
||||||
|
// ACE events
|
||||||
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||||
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/***************************************************************/
|
||||||
|
/***************************************************************/
|
||||||
|
/***************************************************************/
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
// everything that only player controlled machines need, goes below this
|
// everything that only player controlled machines need, goes below this
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
@ -87,7 +109,7 @@ enableCamShake true;
|
|||||||
// Set the name for the current player
|
// Set the name for the current player
|
||||||
["playerChanged", {
|
["playerChanged", {
|
||||||
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
||||||
diag_log text format["PLAYER CHANGED!", _this];
|
|
||||||
if (alive _newPlayer) then {
|
if (alive _newPlayer) then {
|
||||||
[_newPlayer] call FUNC(setName)
|
[_newPlayer] call FUNC(setName)
|
||||||
};
|
};
|
||||||
@ -188,30 +210,15 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
|||||||
{!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}}
|
{!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}}
|
||||||
}] call FUNC(addCanInteractWithCondition);
|
}] call FUNC(addCanInteractWithCondition);
|
||||||
|
|
||||||
// Synced ACE events
|
// Lastly, do JIP 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
|
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it
|
||||||
if(!isServer && {isNull player}) then {
|
if(isMultiplayer && { time > 0 || isNull player } ) then {
|
||||||
// We are jipping! Get ready and wait, and throw the event
|
// We are jipping! Get ready and wait, and throw the event
|
||||||
[{
|
[{
|
||||||
PARAMS_2(_args,_handle);
|
diag_log text format["JIP Detected, waiting"];
|
||||||
|
if(!(isNull player)) then {
|
||||||
if(!isNull player) then {
|
|
||||||
["PlayerJip", [player] ] call FUNC(localEvent);
|
["PlayerJip", [player] ] call FUNC(localEvent);
|
||||||
[_handle] call cba_fnc_removePerFrameHandler;
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
@ -273,10 +273,13 @@ PREP(hashListPush);
|
|||||||
PREP(syncedEventPFH);
|
PREP(syncedEventPFH);
|
||||||
PREP(addSyncedEventHandler);
|
PREP(addSyncedEventHandler);
|
||||||
PREP(removeSyncedEventHandler);
|
PREP(removeSyncedEventHandler);
|
||||||
|
PREP(requestSyncedEvent);
|
||||||
PREP(syncedEvent);
|
PREP(syncedEvent);
|
||||||
|
|
||||||
PREP(_handleSyncedEvent);
|
PREP(_handleSyncedEvent);
|
||||||
PREP(_handleRequestSyncedEvent);
|
PREP(_handleRequestSyncedEvent);
|
||||||
PREP(requestSyncedEvent);
|
PREP(_handleRequestAllSyncedEvents);
|
||||||
|
|
||||||
GVAR(syncedEvents) = HASH_CREATE;
|
GVAR(syncedEvents) = HASH_CREATE;
|
||||||
|
|
||||||
// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
|
// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
*
|
||||||
|
* Handles a server-side request for synchronization ALL events on JIP to a client.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
|
* 0: client (object)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_1(_client);
|
PARAMS_1(_client);
|
||||||
|
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
|
*
|
||||||
|
* Receives either requests for synchronization from clients, or the synchronization data from the server.
|
||||||
*
|
*
|
||||||
*
|
* Arguments [Client] :
|
||||||
* Argument:
|
* 0: eventName (String)
|
||||||
|
* 1: eventLog (Array)
|
||||||
|
*
|
||||||
|
* Arguments [Server] :
|
||||||
|
* 0: eventName (String)
|
||||||
|
* 1: client (Object)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
//SEH_s
|
//SEH_s
|
||||||
@ -32,6 +39,7 @@ if(isServer) then {
|
|||||||
_eventArgs = _x select 1;
|
_eventArgs = _x select 1;
|
||||||
[_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent);
|
[_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent);
|
||||||
} forEach _eventLog;
|
} forEach _eventLog;
|
||||||
|
diag_log text format["[ACE] + [%1] synchronized", _eventName];
|
||||||
};
|
};
|
||||||
|
|
||||||
true
|
true
|
@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
|
*
|
||||||
|
* Handles synced events being received. Server will log them, and server/client will execute them.
|
||||||
*
|
*
|
||||||
* Call and propegate a synced event
|
* Arguments [Client] :
|
||||||
*
|
* 0: eventName (String)
|
||||||
* Argument:
|
* 1: arguments (Array)
|
||||||
* 0: Name (String)
|
* 2: ttl (Scalar)
|
||||||
* 1: Arguments (Array)
|
|
||||||
* 2: TTL (Number or Code) [Optional]
|
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_3(_name,_args,_ttl);
|
PARAMS_3(_name,_args,_ttl);
|
||||||
private["_internalData", "_eventLog", "_eventCode"];
|
private["_internalData", "_eventLog", "_eventCode"];
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_2(_name,_handler);
|
PARAMS_2(_name,_handler);
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Author: jaynus
|
* Author: jaynus
|
||||||
*
|
*
|
||||||
|
* Send a request to synchronize an event name from the client->server. Execute on client only.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
|
* 0: eventName (String)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_1(_eventName);
|
PARAMS_1(_eventName);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Return value:
|
* Return value:
|
||||||
* Boolean of success
|
* Boolean of success
|
||||||
*/
|
*/
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
PARAMS_2(_name,_args);
|
PARAMS_2(_name,_args);
|
||||||
private["_ttl", "_eventData", "_internalData", "_eventLog"];
|
private["_ttl", "_eventData", "_internalData", "_eventLog"];
|
||||||
|
Loading…
Reference in New Issue
Block a user