diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf index 6d03c1eda3..391209009f 100644 --- a/addons/respawn/functions/fnc_module.sqf +++ b/addons/respawn/functions/fnc_module.sqf @@ -33,15 +33,19 @@ GVAR(Module) = true; if (isServer) then { if (GVAR(RemoveDeadBodiesDisconnected)) then { _fnc_deleteDisconnected = { - _this spawn { - _unit = _this select 0; + [ + { + _unit = (_this select 0) select 0; - sleep 4; - - if (!alive _unit) then { + if (!alive _unit) then { deleteVehicle _unit; - }; - }; + + [_this select 0] call CBA_fnc_removePerFrameHandler; + }; + }, + 4, + [_this] + ] call CBA_fnc_addPerFrameHandler false }; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index dcd4810844..28dcc54326 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -1,54 +1,59 @@ /* Name: ACE_Respawn_fnc_moveRallypoint - + Author(s): commy2 - + Description: Moves a rallypoint to the player's location - + Parameters: 0: OBJECT - unit 1: OBJECT - side - + Returns: VOID */ #include "script_component.hpp" -_this spawn { - _unit = _this select 0; - _side = _this select 1; +_unit = _this select 0; +_side = _this select 1; - // rallypoint names are defined in CfgVehicles.hpp +// rallypoint names are defined in CfgVehicles.hpp - _rallypoint = [ - objNull, - missionNamespace getVariable ["ACE_Rallypoint_West", objNull], - missionNamespace getVariable ["ACE_RallypointExit_East", objNull], - missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] - ] select ([west, east, independent] find _side) + 1; +_rallypoint = [ + objNull, + missionNamespace getVariable ["ACE_Rallypoint_West", objNull], + missionNamespace getVariable ["ACE_RallypointExit_East", objNull], + missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] +] select ([west, east, independent] find _side) + 1; - if (isNull _rallypoint) exitWith {}; +if (isNull _rallypoint) exitWith {}; - _position = getPosATL _unit; - _position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; - if (count _position == 0) then {_position = getPosATL _unit}; +_position = getPosATL _unit; +_position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; +if (count _position == 0) then {_position = getPosATL _unit}; - _position set [2, 0]; +_position set [2, 0]; - [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); +[localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); - sleep 5; - _rallypoint setPosATL _position; - _unit reveal _rallypoint; +[{ + _args = _this select 0; + _rallypoint = _args select 0; + _unit = _args select 1; + _position = _args select 2; + _rallypoint = _args select 3; - /* - _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]; - */ + _rallypoint setPosATL _position; + _unit reveal _rallypoint; - [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); -}; + /* + _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]] diff --git a/addons/respawn/functions/fnc_removeBody.sqf b/addons/respawn/functions/fnc_removeBody.sqf index 5c3ed14988..a17193aa1a 100644 --- a/addons/respawn/functions/fnc_removeBody.sqf +++ b/addons/respawn/functions/fnc_removeBody.sqf @@ -1,22 +1,22 @@ /* Name: ACE_Respawn_fnc_removeBody - + Author(s): bux578 - + Description: removes a given body - + Parameters: 0: OBJECT - body 1: BOOLEAN - forceRemove // not used atm - + Returns: VOID */ #include "script_component.hpp" - + private ["_body", "_forceRemove", "_bodyRemoveTimer"]; _body = _this select 0; @@ -29,9 +29,12 @@ if (_forceRemove) then { _bodyRemoveTimer = 2; }; -[_body, _bodyRemoveTimer] spawn { - sleep (_this select 1); - // hideBody takes ~20s till body is fully underground - // a better hideBody would make this more aesthetic - deleteVehicle (_this select 0); -}; +[{ + + _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