ACE3/addons/cookoff/XEH_postInit.sqf

60 lines
2.1 KiB
Plaintext
Raw Normal View History

2016-07-14 14:16:53 +00:00
#include "script_component.hpp"
[QGVAR(engineFire), FUNC(engineFire)] call CBA_fnc_addEventHandler;
[QGVAR(cookOff), FUNC(cookOff)] call CBA_fnc_addEventHandler;
GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
2016-07-14 14:16:53 +00:00
// cookoff and burning engine
["Tank", "init", {
params ["_vehicle"];
private _typeOf = typeOf _vehicle;
if (isNil {GVAR(cacheTankDuplicates) getVariable _typeOf}) then {
private _hitpoints = (getAllHitPointsDamage _vehicle param [0, []]) apply {toLower _x};
private _duplicateHitpoints = [];
{
if ((_x != "") && {_x in (_hitpoints select [0,_forEachIndex])}) then {
_duplicateHitpoints pushBack _forEachIndex;
};
} forEach _hitpoints;
TRACE_2("dupes",_typeOf,_duplicateHitpoints);
GVAR(cacheTankDuplicates) setVariable [_typeOf, _duplicateHitpoints];
};
_vehicle addEventHandler ["HandleDamage", {
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
["tank", _this] call FUNC(handleDamage);
};
2016-07-14 14:16:53 +00:00
}];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
["Wheeled_APC_F", "init", {
(_this select 0) addEventHandler ["HandleDamage", {
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
["tank", _this] call FUNC(handleDamage);
};
2016-07-14 14:16:53 +00:00
}];
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
["Car", "init", {
(_this select 0) addEventHandler ["HandleDamage", {
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
["car", _this] call FUNC(handleDamage);
};
2016-07-14 14:16:53 +00:00
}];
}, nil, ["Wheeled_APC_F"], true] call CBA_fnc_addClassEventHandler;
// secondary explosions
["AllVehicles", "killed", {
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
(_this select 0) call FUNC(secondaryExplosions);
};
}, nil, ["Man"]] call CBA_fnc_addClassEventHandler;
2016-07-14 14:16:53 +00:00
// blow off turret effect
["Tank", "killed", {
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
(_this select 0) call FUNC(blowOffTurret);
};
}] call CBA_fnc_addClassEventHandler;