Cookoff - Randomized the delay from start of cookoff and ammunition detonation (#9002)

* Cookoff - Added a random delay between a vehicle being killed and when the ammo starts to cookoff

* Cookoff - Tweaked min ammo start delay to 1 second

* minor syntax and macro cleanup
This commit is contained in:
JonBons 2022-08-20 14:36:37 -07:00 committed by GitHub
parent 2a4355dfb9
commit f846b9ab82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -53,6 +53,8 @@
) then { ) then {
if (GVAR(ammoCookoffDuration) == 0) exitWith {}; if (GVAR(ammoCookoffDuration) == 0) exitWith {};
([_vehicle] call FUNC(getVehicleAmmo)) params ["_mags", "_total"]; ([_vehicle] call FUNC(getVehicleAmmo)) params ["_mags", "_total"];
[_vehicle, _mags, _total] call FUNC(detonateAmmunition);
private _delay = (random MAX_AMMO_DETONATION_START_DELAY) max MIN_AMMO_DETONATION_START_DELAY;
[FUNC(detonateAmmunition), [_vehicle, _mags, _total], _delay] call CBA_fnc_waitAndExecute;
}; };
}, nil, ["Man","StaticWeapon"]] call CBA_fnc_addClassEventHandler; }, nil, ["Man","StaticWeapon"]] call CBA_fnc_addClassEventHandler;

View File

@ -29,6 +29,9 @@
#define MAX_TIME_BETWEEN_AMMO_DET 25 #define MAX_TIME_BETWEEN_AMMO_DET 25
#define MAX_COOKOFF_INTENSITY 10 #define MAX_COOKOFF_INTENSITY 10
#define MIN_AMMO_DETONATION_START_DELAY 1 // Min time to wait before a vehicle's ammo starts to cookoff
#define MAX_AMMO_DETONATION_START_DELAY 6 // Max time to wait before a vehicle's ammo starts to cookoff
// Delay between flame effect for players in a cooking off vehicle // Delay between flame effect for players in a cooking off vehicle
#define FLAME_EFFECT_DELAY 0.4 #define FLAME_EFFECT_DELAY 0.4