From f75bfd4cef3617c9de45b274e82a9841ed293f9f Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 11 Nov 2021 12:43:41 +0100 Subject: [PATCH] Cookoff - Limit maximum cook intensity/duration (#8648) --- addons/cookoff/functions/fnc_cookOff.sqf | 7 +++++-- addons/cookoff/script_component.hpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/cookoff/functions/fnc_cookOff.sqf b/addons/cookoff/functions/fnc_cookOff.sqf index 7b8168d7f4..4fb1d751ff 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]]; +params ["_vehicle", "_intensity", ["_instigator", objNull], ["_smokeDelayEnabled", true], ["_ammoDetonationChance", 0], ["_detonateAfterCookoff", false], ["_fireSource", ""], ["_canRing", true], ["_maxIntensity", MAX_COOKOFF_INTENSITY, [0]]]; if (GVAR(enable) == 0) exitWith {}; if !(GVAR(enableFire)) exitWith {}; @@ -25,11 +25,14 @@ 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_8("cooking off",_vehicle,_intensity,_instigator,_smokeDelayEnabled,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing); +TRACE_9("cooking off",_vehicle,_intensity,_instigator,_smokeDelayEnabled,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing,_maxIntensity); if (_vehicle getVariable [QGVAR(isCookingOff), false]) exitWith {}; _vehicle setVariable [QGVAR(isCookingOff), true, true]; +// limit maximum value of intensity to prevent very long cook-off times +_intensity = _intensity min _maxIntensity; + private _config = _vehicle call CBA_fnc_getObjectConfig; private _positions = getArray (_config >> QGVAR(cookoffSelections)) select {!((_vehicle selectionPosition _x) isEqualTo [0,0,0])}; diff --git a/addons/cookoff/script_component.hpp b/addons/cookoff/script_component.hpp index 1bf61761b4..ef4a6085dd 100644 --- a/addons/cookoff/script_component.hpp +++ b/addons/cookoff/script_component.hpp @@ -27,6 +27,7 @@ #define MIN_TIME_BETWEEN_FLAMES 5 #define MAX_TIME_BETWEEN_FLAMES 15 #define MAX_TIME_BETWEEN_AMMO_DET 25 +#define MAX_COOKOFF_INTENSITY 10 // Delay between flame effect for players in a cooking off vehicle #define FLAME_EFFECT_DELAY 0.4