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>
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: tcvm, johnb43
|
|
* Checks hitpoint damage and determines if a vehicle should detonate its ammo.
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Chance of detonation <NUMBER>
|
|
* 2: If the vehicle should be knocked out <BOOL>
|
|
* 3: If the crew should be injured <BOOL>
|
|
* 4: Source of damage <OBJECT>
|
|
* 5: Person who caused damage <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [cursorObject, 0.5, true, player, player] call ace_vehicle_damage_fnc_handleDetonation
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_chanceToDetonate", "_knockOut", "_injureCrew", "_source", "_instigator"];
|
|
|
|
// Ignore if the vehicle is already detonating ammo
|
|
if (_vehicle getVariable [QEGVAR(cookoff,isAmmoDetonating), false]) exitWith {
|
|
TRACE_2("already detonating",_vehicle,_chanceToDetonate);
|
|
|
|
if (_knockOut) then {
|
|
[_vehicle, _source, _instigator] call FUNC(knockOut);
|
|
};
|
|
|
|
_knockOut // return
|
|
};
|
|
|
|
// Failure to detonate
|
|
if (_chanceToDetonate == 0 || {_chanceToDetonate < random 1}) exitWith {
|
|
TRACE_2("no detonation",_vehicle,_chanceToDetonate);
|
|
|
|
false // return
|
|
};
|
|
|
|
// Vehicle will be detonated
|
|
if (_injureCrew) then {
|
|
{
|
|
[QGVAR(medicalDamage), [_x, _source, _instigator], _x] call CBA_fnc_targetEvent;
|
|
} forEach (crew _vehicle);
|
|
};
|
|
|
|
TRACE_2("detonation",_vehicle,_chanceToDetonate);
|
|
|
|
// Detonate the vehicle
|
|
[QEGVAR(cookoff,detonateAmmunitionServer), [_vehicle, false, _source, _instigator]] call CBA_fnc_serverEvent;
|
|
|
|
if (_knockOut) then {
|
|
[_vehicle, _source, _instigator] call FUNC(knockOut);
|
|
};
|
|
|
|
_knockOut // return
|