mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
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
This commit is contained in:
parent
e8fcbcdf4b
commit
392a0770b3
@ -6,3 +6,4 @@ PREP(cookOffBox);
|
||||
PREP(blowOffTurret);
|
||||
PREP(detonateAmmunition);
|
||||
PREP(getVehicleAmmo);
|
||||
PREP(handleDamageEjectIfDestroyed);
|
||||
|
@ -102,3 +102,13 @@ if (isServer) then {
|
||||
} forEach allCurators;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
// init eject from destroyed vehicle
|
||||
{
|
||||
[_x, "init", {
|
||||
params ["_vehicle"];
|
||||
if (!alive _vehicle) exitWith {};
|
||||
TRACE_2("ejectIfDestroyed init",_vehicle,typeOf _vehicle);
|
||||
_vehicle addEventHandler ["HandleDamage", {call FUNC(handleDamageEjectIfDestroyed)}];
|
||||
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
} forEach EJECT_IF_DESTROYED_VEHICLES;
|
||||
|
@ -0,0 +1,33 @@
|
||||
#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];
|
@ -27,3 +27,5 @@
|
||||
|
||||
// Delay between flame effect for players in a cooking off vehicle
|
||||
#define FLAME_EFFECT_DELAY 0.4
|
||||
|
||||
#define EJECT_IF_DESTROYED_VEHICLES ["Boat_Transport_02_base_F", "Rubber_duck_base_F"]
|
||||
|
Loading…
Reference in New Issue
Block a user