mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
80b2fa9a05
* Cook-off improvements * More changes * Update fnc_getVehicleAmmo.sqf * Better engine fire placement * Update fnc_detonateAmmunition.sqf * Update XEH_postInit.sqf * Update fnc_getVehicleAmmo.sqf * Update events-framework.md * Various improvements * Separate effect handling * Tweaks * Update XEH_postInit.sqf * Prevent double ammo detonation * Fixed objects not being able to cook-off again * Added incendiary rounds as source of box cookoff * Converted enable setting to bool * Fixed brackets * Update fnc_cookOff.sqf * Update CfgEden.hpp * Removed GVAR(enable), added GVAR(enableFire) back * Vehicle damage fixes * Made hitpoint hash common * Update fnc_addEventHandler.sqf * Update fnc_medicalDamage.sqf * Update fnc_handleBail.sqf * Changed API * Remove `CBA_fnc_getConfigEntry` as much as possible, as it's 2x slower * More cleanup * More cleanup * Fix merging issues, remove turret tossing * Update translations * More cleanup * Reverted some logic back to original, minor tweaks & fixes * Fix undefined variable * Cleanup * Fixed bad logic * Update addons/vehicle_damage/script_macros.hpp Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/functions/fnc_handleDamage.sqf * Update addons/vehicle_damage/stringtable.xml Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/stringtable.xml Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/vehicle_damage/XEH_postInit.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
66 lines
2.3 KiB
Plaintext
66 lines
2.3 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
// Init eject from destroyed vehicles
|
|
// See https://github.com/acemod/ACE3/pull/6330
|
|
// Still valid for Arma 2.16
|
|
{
|
|
[_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;
|
|
|
|
["CBA_settingsInitialized", {
|
|
TRACE_1("settings init",GVAR(enabled));
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
[QGVAR(medicalDamage), LINKFUNC(medicalDamage)] call CBA_fnc_addEventHandler;
|
|
|
|
if (isServer) then {
|
|
// To set source and instigator, setDamage must be executed on the server
|
|
[QGVAR(setDamage), {(_this select 0) setDamage (_this select 1)}] call CBA_fnc_addEventHandler;
|
|
};
|
|
|
|
[QGVAR(bailOut), {
|
|
params ["_vehicle", "_unit"];
|
|
|
|
TRACE_2("bailOut",_vehicle,_unit);
|
|
|
|
// Ignore players and the dead
|
|
if (_unit call EFUNC(common,isPlayer) || {!(_unit call EFUNC(common,isAwake))}) exitWith {};
|
|
|
|
unassignVehicle _unit;
|
|
_unit leaveVehicle _vehicle;
|
|
doGetOut _unit;
|
|
|
|
private _angle = floor (random 360);
|
|
private _dist = 30 + (random 10);
|
|
private _escape = _vehicle getPos [_dist, _angle];
|
|
|
|
_unit doMove _escape;
|
|
_unit setSpeedMode "FULL";
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
GVAR(vehicleClassesHitPointHash) = createHashMap;
|
|
|
|
["Tank", "Init", LINKFUNC(addEventHandler), true, [], true] call CBA_fnc_addClassEventHandler;
|
|
|
|
// Wheeled_APC_F inherits from Car
|
|
[["Wheeled_Apc_F", "Car"] select GVAR(enableCarDamage), "Init", LINKFUNC(addEventHandler), true, [], true] call CBA_fnc_addClassEventHandler;
|
|
|
|
// Blow off turret effect
|
|
// TODO: Add blowing-off-turret effect to vehicles that cook-off but aren't destroyed (no catastrophic explosion)
|
|
// The problem is that vehicles are repairable if they haven't been destroyed. So if the turret is gone and vehicle is repaired, how do we handle that?
|
|
["Tank", "Killed", {
|
|
if (_this select 3 && random 1 < 0.15) then {
|
|
(_this select 0) call FUNC(blowOffTurret);
|
|
};
|
|
}] call CBA_fnc_addClassEventHandler;
|
|
}] call CBA_fnc_addEventHandler;
|