mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
c44a1e7ea7
* 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 * Update initSettings.inc.sqf * Update events-framework.md * Update addons/cookoff/functions/fnc_cookOffEffect.sqf * Restructured, redid API events * Fix effect for JIP, minor optimisations * Removed `cbaSettings_settingChanged` * Renamed variables, tweaked string table entries * Update fire damage #9991 * Capitalize comments again * Fix cookoff for very short durations and fix effect removal being too quick
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: tcvm
|
|
* Checks hitpoint damage and determines if a vehicle should cookoff.
|
|
*
|
|
* Arguments:
|
|
* 0: The vehicle <OBJECT>
|
|
* 1: Chance of detonation <NUMBER>
|
|
* 2: Vehicle ammo array <ARRAY>
|
|
* 3: How much explosive ammo is inside vehicle <NUMBER>
|
|
* 4: How much non-explosive ammo inside vehicle <NUMBER>
|
|
* 5: Person who instigated damage <OBJECT> (default: objNull)
|
|
*
|
|
* Return Value:
|
|
* Detonated <BOOL>
|
|
*
|
|
* Example:
|
|
* [tank2, 0.5] call ace_vehicle_damage_fnc_handleDetonation;
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_chanceOfDetonate", "_vehicleAmmo", "_explosiveAmmoCount", "_nonExplosiveAmmoCount", ["_injurer", objNull]];
|
|
|
|
private _isKnockedOut = _explosiveAmmoCount > 0;
|
|
|
|
// Ignore if the vehicle is already detonating ammo
|
|
if (_vehicle getVariable [QEGVAR(cookoff,isAmmoDetonating), false]) exitWith {_isKnockedOut};
|
|
|
|
if (_chanceOfDetonate >= random 1) exitWith {
|
|
[_vehicle, _injurer, _vehicleAmmo] call FUNC(detonate);
|
|
LOG_2("Detonating [%1] with a chance-to-detonate [%2]",_vehicle,_chanceOfDetonate);
|
|
_isKnockedOut
|
|
};
|
|
|
|
LOG_2("[%1] No Detonation - Chance of detonation [%2]",_vehicle,_chanceOfDetonate);
|
|
false
|