From 9f2f660b89aec6c342cb429643deba54b7d6dce3 Mon Sep 17 00:00:00 2001 From: Niko Lehtovirta Date: Fri, 10 Apr 2015 16:23:27 +0300 Subject: [PATCH] fixed PFH to use EFUNC(common,waitAndExecute) --- addons/respawn/functions/fnc_module.sqf | 33 +++++++++-------- .../respawn/functions/fnc_moveRallypoint.sqf | 36 ++++++++++--------- addons/respawn/functions/fnc_removeBody.sqf | 19 +++++----- 3 files changed, 45 insertions(+), 43 deletions(-) diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf index 391209009f..57ebb91615 100644 --- a/addons/respawn/functions/fnc_module.sqf +++ b/addons/respawn/functions/fnc_module.sqf @@ -32,24 +32,23 @@ GVAR(Module) = true; if (isServer) then { if (GVAR(RemoveDeadBodiesDisconnected)) then { - _fnc_deleteDisconnected = { - [ - { - _unit = (_this select 0) select 0; + addMissionEventHandler ["HandleDisconnect", + { + [ + { + _unit = _this select 0; - if (!alive _unit) then { - deleteVehicle _unit; - - [_this select 0] call CBA_fnc_removePerFrameHandler; - }; - }, - 4, - [_this] - ] call CBA_fnc_addPerFrameHandler - false - }; - - addMissionEventHandler ["HandleDisconnect", _fnc_deleteDisconnected]; + if (!alive _unit) then { + deleteVehicle _unit; + }; + }, + _this, + 4, + 1 + ] call EFUNC(common,waitAndExecute); + false + } + ]; }; }; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index 28dcc54326..96672fecd6 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -37,23 +37,25 @@ if (count _position == 0) then {_position = getPosATL _unit}; _position set [2, 0]; -[localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); +[ + { + _rallypoint = _this select 0; + _unit = _this select 1; + _position = _this select 2; + _rallypoint = _this select 3; -[{ - _args = _this select 0; - _rallypoint = _args select 0; - _unit = _args select 1; - _position = _args select 2; - _rallypoint = _args select 3; + _rallypoint setPosATL _position; + _unit reveal _rallypoint; - _rallypoint setPosATL _position; - _unit reveal _rallypoint; + /* + _marker = format ["AGM_RallyPoint_%1", _side]; + _marker setMarkerPos _position; + _marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber]; + */ - /* - _marker = format ["AGM_RallyPoint_%1", _side]; - _marker setMarkerPos _position; - _marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber]; - */ - - [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); -}, 5, [_rallypoint, _unit, _position, _rallypoint]] + [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); + }, + [_rallypoint, _unit, _position, _rallypoint], + 5, + 1 +] call EFUNC(common,waitAndExecute); diff --git a/addons/respawn/functions/fnc_removeBody.sqf b/addons/respawn/functions/fnc_removeBody.sqf index a17193aa1a..4b7deaa6ce 100644 --- a/addons/respawn/functions/fnc_removeBody.sqf +++ b/addons/respawn/functions/fnc_removeBody.sqf @@ -29,12 +29,13 @@ if (_forceRemove) then { _bodyRemoveTimer = 2; }; -[{ - - _unit = (_this select 1) select 0; - // hideBody takes ~20s till body is fully underground - // a better hideBody would make this more aesthetic - deleteVehicle _unit; -}, -_bodyRemoveTime, -[_body]] call CBA_fnc_addPerFrameHandler \ No newline at end of file +[ + { + // hideBody takes ~20s till body is fully underground + // a better hideBody would make this more aesthetic + deleteVehicle _this; + }, + _body, + _bodyRemoveTimer, + 1 +] call EFUNC(common,waitAndExecute);