From 2709490efd70b5c81ea13f6ab59d2683d69276dd Mon Sep 17 00:00:00 2001 From: JonBons Date: Wed, 23 Aug 2023 12:37:17 -0500 Subject: [PATCH] Cookoff - Move canHaveFireJet logic into vehicle_damage (#9060) * Moved ace_cookoff_canHaveFireJet config logic into vehicle_damage as a param passed into cookoff to improve modularity * Use original arg order --------- Co-authored-by: PabstMirror --- addons/cookoff/functions/fnc_cookOff.sqf | 8 +++----- .../vehicle_damage/functions/fnc_handleCookoff.sqf | 12 +++++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/cookoff/functions/fnc_cookOff.sqf b/addons/cookoff/functions/fnc_cookOff.sqf index 930595449e..79644a273e 100644 --- a/addons/cookoff/functions/fnc_cookOff.sqf +++ b/addons/cookoff/functions/fnc_cookOff.sqf @@ -16,7 +16,7 @@ * Public: No */ -params ["_vehicle", "_intensity", ["_instigator", objNull], ["_smokeDelayEnabled", true], ["_ammoDetonationChance", 0], ["_detonateAfterCookoff", false], ["_fireSource", ""], ["_canRing", true], ["_maxIntensity", MAX_COOKOFF_INTENSITY, [0]]]; +params ["_vehicle", "_intensity", ["_instigator", objNull], ["_smokeDelayEnabled", true], ["_ammoDetonationChance", 0], ["_detonateAfterCookoff", false], ["_fireSource", ""], ["_canRing", true], ["_maxIntensity", MAX_COOKOFF_INTENSITY, [0]], ["_canJet", true, [true]]]; if (GVAR(enable) == 0) exitWith {}; if !(GVAR(enableFire)) exitWith {}; @@ -25,7 +25,8 @@ if (_vehicle getVariable [QGVAR(enable), GVAR(enable)] in [0, false]) exitWith { if (_vehicle getVariable [QGVAR(enable), GVAR(enable)] isEqualTo 1 && {fullCrew [_vehicle, "", false] findIf {isPlayer (_x select 0)} == -1}) exitWith {}; -TRACE_9("cooking off",_vehicle,_intensity,_instigator,_smokeDelayEnabled,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing,_maxIntensity); +TRACE_2("cooking off",_vehicle,_intensity); +TRACE_8("",_instigator,_smokeDelayEnabled,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing,_maxIntensity,_canJet); if (_vehicle getVariable [QGVAR(isCookingOff), false]) exitWith {}; _vehicle setVariable [QGVAR(isCookingOff), true, true]; @@ -51,9 +52,6 @@ if (_positions isEqualTo []) then { }; }; -// default fire jet to enabled when not set in configs -private _canJet = ([_config >> QGVAR(canHaveFireJet), "number", 1] call CBA_fnc_getConfigEntry) == 1; - private _delay = 0; if (_smokeDelayEnabled) then { _delay = SMOKE_TIME + random SMOKE_TIME; diff --git a/addons/vehicle_damage/functions/fnc_handleCookoff.sqf b/addons/vehicle_damage/functions/fnc_handleCookoff.sqf index 53a2c7b491..5a907f4162 100644 --- a/addons/vehicle_damage/functions/fnc_handleCookoff.sqf +++ b/addons/vehicle_damage/functions/fnc_handleCookoff.sqf @@ -9,7 +9,8 @@ * 2: Intensity of cookoff * 3: Person who instigated cookoff (default: objNull) * 4: Part of vehicle which got hit (default: "") - * 5: Whether or not the vehicle can spawn ring-fire effect (default: false) + * 5: Whether or not the vehicle can spawn ring-fire effect (default: false) + * 6: Can Jet (default: true) * * Return Value: * If cooked off @@ -20,7 +21,7 @@ * Public: No */ -params ["_vehicle", "_chanceOfFire", "_intensity", ["_injurer", objNull], ["_hitPart", ""], ["_canRing", false]]; +params ["_vehicle", "_chanceOfFire", "_intensity", ["_injurer", objNull], ["_hitPart", ""], ["_canRing", false], ["_canJet", true]]; private _alreadyCookingOff = _vehicle getVariable [QGVAR(cookingOff), false]; @@ -31,6 +32,10 @@ if (!_alreadyCookingOff && { _chanceOfFire >= random 1 }) exitWith { _canRing = ([_configOf >> QGVAR(canHaveFireRing), "number", 0] call CBA_fnc_getConfigEntry) == 1; }; + if (_canJet) then { + _canJet = ([_configOf >> QEGVAR(cookoff,canHaveFireJet), "number", 1] call CBA_fnc_getConfigEntry) == 1; + }; + private _delayWithSmoke = _chanceOfFire < random 1; private _detonateAfterCookoff = (_fireDetonateChance / 4) > random 1; @@ -39,7 +44,8 @@ if (!_alreadyCookingOff && { _chanceOfFire >= random 1 }) exitWith { _source = ["hit_engine_point", "HitPoints"]; }; - [QEGVAR(cookOff,cookOff), [_vehicle, _intensity, _injurer, _delayWithSmoke, _fireDetonateChance, _detonateAfterCookoff, _source, _canRing]] call CBA_fnc_localEvent; + // sending nil for _maxIntensity (9th param) to use default value in ace_cookoff_fnc_cookOff + [QEGVAR(cookOff,cookOff), [_vehicle, _intensity, _injurer, _delayWithSmoke, _fireDetonateChance, _detonateAfterCookoff, _source, _canRing, nil, _canJet]] call CBA_fnc_localEvent; _vehicle setVariable [QGVAR(cookingOff), true]; LOG_4("Cooking-off [%1] with a chance-of-fire [%2] - Delayed Smoke | Detonate after cookoff [%3 | %4]",_vehicle,_chanceOfFire,_delayWithSmoke,_detonateAfterCookoff); [_vehicle] spawn FUNC(abandon);