mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
b489750d5b
* Optimizations with private, params, and isEqualType * Fixed tab being used instead of space * Fixed tabs inserted by notepad++ * More usage of new private syntax and params - changed a few checks for an array being empty to `_arr isEqualTo []` rather than `count _arr == 0` - added more uses of `private` on the same line as the variable is declared - added more uses of params to assign variables passed as parameters - removed unnecessary parentheses - removed several unnecessary variable declarations with private array syntax * clean up and formatting
38 lines
894 B
Plaintext
38 lines
894 B
Plaintext
/*
|
|
* Author: PabstMirror
|
|
* Handles when vehicle or man is killed.
|
|
* Note: Runs where unit is local.
|
|
*
|
|
* Arguments:
|
|
* 0: DeadVehicle <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob1] call ACE_attach_fnc_handleKilled
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
params ["_deadUnit"];
|
|
TRACE_1("params",_deadUnit);
|
|
|
|
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
|
|
|
|
if (_attachedList isEqualTo []) exitWith {};
|
|
|
|
{
|
|
_x params ["_xObject"];
|
|
TRACE_2("detaching",_xObject,_deadUnit);
|
|
detach _xObject;
|
|
//If it's a vehicle, also delete the attached
|
|
if (!(_deadUnit isKindOf "CAManBase")) then {
|
|
_xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]);
|
|
[{deleteVehicle (_this select 0)}, [_xObject], 2] call CBA_fnc_waitAndExecute;
|
|
};
|
|
} forEach _attachedList;
|
|
|
|
_deadUnit setVariable [QGVAR(attached), nil, true];
|