ACE3/addons/cookoff/functions/fnc_handleDamageEjectIfDestroyed.sqf
Dystopian 392a0770b3 Add destroyed boat ejecting (#6330)
* Add destroyed boat ejecting

* Delete EH global cleanup

* Add check explosiveness

* Optimize EH

* Move EH to function, remove config values

* Move code to cookoff

* Use macro for explosiveness

* Fix include
2019-12-16 16:29:33 -06:00

34 lines
645 B
Plaintext

#include "script_component.hpp"
/*
* Author: Dystopian
* Ejects crew from destroyed vehicle.
* Should be called from HandleDamage EH.
*
* Arguments:
* HandleDamage EH <ARRAY>
*
* Return Value:
* None
*
* Example:
* _this call ace_cookoff_fnc_handleDamageEjectIfDestroyed
*
* Public: No
*/
params ["_vehicle", "", "", "", "_ammo"];
if (alive _vehicle) exitWith {};
TRACE_2("ejectIfDestroyed HDEH",typeOf _vehicle,_this);
if (!IS_EXPLOSIVE_AMMO(_ammo)) then {
{
if (alive _x) then {
moveOut _x;
};
} forEach crew _vehicle;
};
_vehicle removeEventHandler ["HandleDamage", _thisEventHandler];