Replace ace_common_fnc_execRemoteFunc with events

This commit is contained in:
jonpas 2016-05-21 19:59:44 +02:00
parent 391191241b
commit d902d1182a
17 changed files with 39 additions and 27 deletions

View File

@ -163,9 +163,17 @@ if (isServer) then {
["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
["setVanillaHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler);
// Request framework
[QGVAR(requestCallback), FUNC(requestCallback)] call FUNC(addEventHandler);
[QGVAR(receiveRequest), FUNC(receiveRequest)] call FUNC(addEventHandler);
[QGVAR(systemChatGlobal), {systemChat _this}] call FUNC(addEventHandler);
if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
["setOwner", {(_this select 0) setOwner (_this select 1)}] call FUNC(addEventHandler);
[QGVAR(serverLog), FUNC(serverLog)] call FUNC(addEventHandler);
};

View File

@ -61,7 +61,8 @@ if (!isServer) then {
_error = _error + "Newer version; ";
};
//[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
//[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
ACE_LOGERROR(_error);
if (_mode < 2) then {

View File

@ -20,7 +20,7 @@ if (!isNil "_info") then {
_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
private _replyParams = [_info, _accepted];
[_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc);
[QGVAR(requestCallback), _caller, _replyParams] call FUNC(objectEvent);
_unit setVariable [_id, nil];
};

View File

@ -20,7 +20,7 @@ params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
if (isPlayer _target) then {
// Pass request on to target locality for player accept/decline.
[[_caller, _target, _requestID, _requestMessage, _callBack], QFUNC(receiveRequest), _target, false] call FUNC(execRemoteFnc);
[QGVAR(receiveRequest), _target, [_caller, _target, _requestID, _requestMessage, _callBack]] call FUNC(objectEvent);
} else {
// accept it, since it's an AI.
[_caller, _target, true] call compile _callBack;

View File

@ -20,5 +20,5 @@ params [["_msg", "", [""]]];
if (isServer) then {
diag_log text _msg;
} else {
[_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc);
[QGVAR(serverLog), _this] call FUNC(serverEvent);
};

View File

@ -100,7 +100,7 @@ if (!isServer) then {
_error = _error call _fnc_cutComma;
diag_log text _error;
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
};
_missingAddonServer = false;
@ -117,7 +117,7 @@ if (!isServer) then {
_error = _error call _fnc_cutComma;
diag_log text _error;
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
};
_oldVersionClient = false;
@ -134,7 +134,7 @@ if (!isServer) then {
_error = _error call _fnc_cutComma;
diag_log text _error;
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
};
_oldVersionServer = false;
@ -151,7 +151,7 @@ if (!isServer) then {
_error = _error call _fnc_cutComma;
diag_log text _error;
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
};
ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer];

View File

@ -17,6 +17,7 @@
//Event for setting explosive placement angle/pitch:
[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler);
[QGVAR(startDefuse), FUNC(startDefuse)] call EFUNC(common,addEventHandler);
//When getting knocked out in medical, trigger deadman explosives:
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)

View File

@ -44,7 +44,7 @@ if (STANCE _unit == "Prone") then {
if (ACE_player != _unit) then {
// If the unit is a player, call the function on the player.
if (isPlayer _unit) then {
[[_unit, _target], QFUNC(startDefuse), _unit] call EFUNC(common,execRemoteFnc);
[QGVAR(startDefuse), _unit, [_unit, _target]] call EFUNC(common,objectEvent);
} else {
_unit playActionNow _actionToPlay;
_unit disableAI "MOVE";

View File

@ -5,3 +5,5 @@
// wheels
["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler);
[QGVAR(useItem), EFUNC(common,useItem)] call EFUNC(common,addEventHandler);

View File

@ -20,7 +20,7 @@ params ["_unit", "_item"];
TRACE_2("params",_unit,_item);
if ([_unit, _item] call EFUNC(common,hasItem)) exitWith {
[[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
[QGVAR(useItem), _unit, [_unit, _item]] call EFUNC(common,objectEvent);
[true, _unit];
};

View File

@ -3,3 +3,5 @@
["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler);
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers
[QGVAR(showFriendlyFireMessageEvent), DFUNC(showFriendlyFireMessage)] call EFUNC(common,addEventHandler);

View File

@ -25,5 +25,5 @@ if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then {
};
if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {
[_this, QUOTE(DFUNC(showFriendlyFireMessage)), 2] call EFUNC(common,execRemoteFnc);
[QGVAR(showFriendlyFireMessageEvent), _this] call EFUNC(common,objectEvent);
};

View File

@ -27,3 +27,5 @@ if (isServer) then {
[false] call FUNC(setSpectator);
};
}] call EFUNC(common,addEventHandler);
[QGVAR(stageSpectator), FUNC(stageSpectator)] call EFUNC(common,addEventHandler);

View File

@ -23,7 +23,7 @@ private ["_vision","_pos"];
// When all are dead with respawn type "None" the mission should end
if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith {
[["endDeath",false],"BIS_fnc_endMission"] call EFUNC(common,execRemoteFnc);
["BIS_fnc_endMission", ["endDeath", false]] call EFUNC(common,globalEvent);
};
// Some environment information can be used for the initial camera attributes

View File

@ -27,7 +27,7 @@ params [["_unit",player,[objNull]], ["_set",true,[true]]];
if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {};
if !(local _unit) exitWith {
[[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc);
[QGVAR(stageSpectator), _unit, [_unit, _set]] call EFUNC(common,objectEvent);
};
// Prevent unit falling into water

View File

@ -27,3 +27,11 @@ if (missionNamespace getVariable [QGVAR(EnableSwitchUnits), false]) then {
};
}] call EFUNC(common,addEventhandler);
};
if (isServer) then {
[QGVAR(switchLocality), {
params ["_unit", "_player"];
_unit setVariable [QGVAR(OriginalOwner), owner _unit, true];
_unit setOwner (owner _player);
}] call EFUNC(common,addEventHandler);
};

View File

@ -40,14 +40,7 @@ if (_leave) exitWith {
// should switch locality
// This doesn't work anymore, because one's now able to switch to units from a different side
//[_unit] joinSilent group player;
[
[_unit, player],
QUOTE({
(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)];
(_this select 0) setOwner owner (_this select 1)
}),
1
] call EFUNC(common,execRemoteFnc);
[QGVAR(switchLocality), [_unit, player]] call EFUNC(common,serverEvent);
[{
params ["_args", "_pfhId"];
@ -79,12 +72,7 @@ if (_leave) exitWith {
// set owner back to original owner
private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1];
if (_oldOwner > -1) then {
[
[_oldUnit, _oldOwner],
QUOTE({
(_this select 0) setOwner (_this select 1)
}), 1
] call EFUNC(common,execRemoteFnc);
["setOwner", [_oldUnit, _oldOwner]] call EFUNC(common,serverEvent);
};
[localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured);