Skip to content

Commit

Permalink
Cookoff - Limit maximum cook intensity/duration (#8648)
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 authored Nov 11, 2021
1 parent 604f169 commit f75bfd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions addons/cookoff/functions/fnc_cookOff.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand All @@ -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])};

Expand Down
1 change: 1 addition & 0 deletions addons/cookoff/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f75bfd4

Please sign in to comment.