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 <pabstmirror@gmail.com>
This commit is contained in:
JonBons 2023-08-23 12:37:17 -05:00 committed by GitHub
parent 8e25472d5b
commit 2709490efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -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;

View File

@ -9,7 +9,8 @@
* 2: Intensity of cookoff <NUMBER>
* 3: Person who instigated cookoff <OBJECT> (default: objNull)
* 4: Part of vehicle which got hit <STRING> (default: "")
* 5: Whether or not the vehicle can spawn ring-fire effect <BOO> (default: false)
* 5: Whether or not the vehicle can spawn ring-fire effect <BOOL> (default: false)
* 6: Can Jet <BOOL> (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);