mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Replace ace_common_fnc_execRemoteFunc with events
This commit is contained in:
parent
391191241b
commit
d902d1182a
@ -163,9 +163,17 @@ if (isServer) then {
|
|||||||
["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
|
["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler);
|
||||||
["setVanillaHitPointDamage", {(_this select 0) setHitPointDamage (_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 {
|
if (isServer) then {
|
||||||
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
|
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
|
||||||
["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ if (!isServer) then {
|
|||||||
_error = _error + "Newer version; ";
|
_error = _error + "Newer version; ";
|
||||||
};
|
};
|
||||||
|
|
||||||
//[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
//[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
|
||||||
|
|
||||||
ACE_LOGERROR(_error);
|
ACE_LOGERROR(_error);
|
||||||
|
|
||||||
if (_mode < 2) then {
|
if (_mode < 2) then {
|
||||||
|
@ -20,7 +20,7 @@ if (!isNil "_info") then {
|
|||||||
_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
_info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
||||||
|
|
||||||
private _replyParams = [_info, _accepted];
|
private _replyParams = [_info, _accepted];
|
||||||
[_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc);
|
[QGVAR(requestCallback), _caller, _replyParams] call FUNC(objectEvent);
|
||||||
_unit setVariable [_id, nil];
|
_unit setVariable [_id, nil];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
|||||||
|
|
||||||
if (isPlayer _target) then {
|
if (isPlayer _target) then {
|
||||||
// Pass request on to target locality for player accept/decline.
|
// 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 {
|
} else {
|
||||||
// accept it, since it's an AI.
|
// accept it, since it's an AI.
|
||||||
[_caller, _target, true] call compile _callBack;
|
[_caller, _target, true] call compile _callBack;
|
||||||
|
@ -20,5 +20,5 @@ params [["_msg", "", [""]]];
|
|||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
diag_log text _msg;
|
diag_log text _msg;
|
||||||
} else {
|
} else {
|
||||||
[_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc);
|
[QGVAR(serverLog), _this] call FUNC(serverEvent);
|
||||||
};
|
};
|
||||||
|
@ -100,7 +100,7 @@ if (!isServer) then {
|
|||||||
_error = _error call _fnc_cutComma;
|
_error = _error call _fnc_cutComma;
|
||||||
|
|
||||||
diag_log text _error;
|
diag_log text _error;
|
||||||
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
_missingAddonServer = false;
|
_missingAddonServer = false;
|
||||||
@ -117,7 +117,7 @@ if (!isServer) then {
|
|||||||
_error = _error call _fnc_cutComma;
|
_error = _error call _fnc_cutComma;
|
||||||
|
|
||||||
diag_log text _error;
|
diag_log text _error;
|
||||||
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
_oldVersionClient = false;
|
_oldVersionClient = false;
|
||||||
@ -134,7 +134,7 @@ if (!isServer) then {
|
|||||||
_error = _error call _fnc_cutComma;
|
_error = _error call _fnc_cutComma;
|
||||||
|
|
||||||
diag_log text _error;
|
diag_log text _error;
|
||||||
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
_oldVersionServer = false;
|
_oldVersionServer = false;
|
||||||
@ -151,7 +151,7 @@ if (!isServer) then {
|
|||||||
_error = _error call _fnc_cutComma;
|
_error = _error call _fnc_cutComma;
|
||||||
|
|
||||||
diag_log text _error;
|
diag_log text _error;
|
||||||
[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
|
[QGVAR(systemChatGlobal), _error] call FUNC(globalEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer];
|
ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer];
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
//Event for setting explosive placement angle/pitch:
|
//Event for setting explosive placement angle/pitch:
|
||||||
[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler);
|
[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:
|
//When getting knocked out in medical, trigger deadman explosives:
|
||||||
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
|
//Event is global, only run on server (ref: ace_medical_fnc_setUnconscious)
|
||||||
|
@ -44,7 +44,7 @@ if (STANCE _unit == "Prone") then {
|
|||||||
if (ACE_player != _unit) then {
|
if (ACE_player != _unit) then {
|
||||||
// If the unit is a player, call the function on the player.
|
// If the unit is a player, call the function on the player.
|
||||||
if (isPlayer _unit) then {
|
if (isPlayer _unit) then {
|
||||||
[[_unit, _target], QFUNC(startDefuse), _unit] call EFUNC(common,execRemoteFnc);
|
[QGVAR(startDefuse), _unit, [_unit, _target]] call EFUNC(common,objectEvent);
|
||||||
} else {
|
} else {
|
||||||
_unit playActionNow _actionToPlay;
|
_unit playActionNow _actionToPlay;
|
||||||
_unit disableAI "MOVE";
|
_unit disableAI "MOVE";
|
||||||
|
@ -5,3 +5,5 @@
|
|||||||
|
|
||||||
// wheels
|
// wheels
|
||||||
["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler);
|
["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
[QGVAR(useItem), EFUNC(common,useItem)] call EFUNC(common,addEventHandler);
|
||||||
|
@ -20,7 +20,7 @@ params ["_unit", "_item"];
|
|||||||
TRACE_2("params",_unit,_item);
|
TRACE_2("params",_unit,_item);
|
||||||
|
|
||||||
if ([_unit, _item] call EFUNC(common,hasItem)) exitWith {
|
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];
|
[true, _unit];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,3 +3,5 @@
|
|||||||
|
|
||||||
["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler);
|
["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler);
|
||||||
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers
|
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers
|
||||||
|
|
||||||
|
[QGVAR(showFriendlyFireMessageEvent), DFUNC(showFriendlyFireMessage)] call EFUNC(common,addEventHandler);
|
||||||
|
@ -25,5 +25,5 @@ if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {
|
if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then {
|
||||||
[_this, QUOTE(DFUNC(showFriendlyFireMessage)), 2] call EFUNC(common,execRemoteFnc);
|
[QGVAR(showFriendlyFireMessageEvent), _this] call EFUNC(common,objectEvent);
|
||||||
};
|
};
|
||||||
|
@ -27,3 +27,5 @@ if (isServer) then {
|
|||||||
[false] call FUNC(setSpectator);
|
[false] call FUNC(setSpectator);
|
||||||
};
|
};
|
||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
[QGVAR(stageSpectator), FUNC(stageSpectator)] call EFUNC(common,addEventHandler);
|
||||||
|
@ -23,7 +23,7 @@ private ["_vision","_pos"];
|
|||||||
|
|
||||||
// When all are dead with respawn type "None" the mission should end
|
// When all are dead with respawn type "None" the mission should end
|
||||||
if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith {
|
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
|
// Some environment information can be used for the initial camera attributes
|
||||||
|
@ -27,7 +27,7 @@ params [["_unit",player,[objNull]], ["_set",true,[true]]];
|
|||||||
if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {};
|
if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {};
|
||||||
|
|
||||||
if !(local _unit) 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
|
// Prevent unit falling into water
|
||||||
|
@ -27,3 +27,11 @@ if (missionNamespace getVariable [QGVAR(EnableSwitchUnits), false]) then {
|
|||||||
};
|
};
|
||||||
}] call EFUNC(common,addEventhandler);
|
}] 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);
|
||||||
|
};
|
||||||
|
@ -40,14 +40,7 @@ if (_leave) exitWith {
|
|||||||
// should switch locality
|
// should switch locality
|
||||||
// This doesn't work anymore, because one's now able to switch to units from a different side
|
// This doesn't work anymore, because one's now able to switch to units from a different side
|
||||||
//[_unit] joinSilent group player;
|
//[_unit] joinSilent group player;
|
||||||
[
|
[QGVAR(switchLocality), [_unit, player]] call EFUNC(common,serverEvent);
|
||||||
[_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);
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
params ["_args", "_pfhId"];
|
params ["_args", "_pfhId"];
|
||||||
@ -79,12 +72,7 @@ if (_leave) exitWith {
|
|||||||
// set owner back to original owner
|
// set owner back to original owner
|
||||||
private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1];
|
private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1];
|
||||||
if (_oldOwner > -1) then {
|
if (_oldOwner > -1) then {
|
||||||
[
|
["setOwner", [_oldUnit, _oldOwner]] call EFUNC(common,serverEvent);
|
||||||
[_oldUnit, _oldOwner],
|
|
||||||
QUOTE({
|
|
||||||
(_this select 0) setOwner (_this select 1)
|
|
||||||
}), 1
|
|
||||||
] call EFUNC(common,execRemoteFnc);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured);
|
[localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured);
|
||||||
|
Loading…
Reference in New Issue
Block a user