Cookoff - Add ability to disable fire jet effect in configs (#8953)

* Cookoff: Add ability to disable fire jet effect for vehicles it doesn't make sense on

* Cookoff: Fixed pressure jet sound playing when both jet and ring effects are disabled
This commit is contained in:
JonBons 2022-07-01 11:20:31 -05:00 committed by GitHub
parent 57893f311d
commit 654e4c1b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -49,6 +49,9 @@ 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; private _delay = 0;
if (_smokeDelayEnabled) then { if (_smokeDelayEnabled) then {
_delay = SMOKE_TIME + random SMOKE_TIME; _delay = SMOKE_TIME + random SMOKE_TIME;
@ -56,13 +59,13 @@ if (_smokeDelayEnabled) then {
[QGVAR(smoke), [_vehicle, _positions]] call CBA_fnc_globalEvent; [QGVAR(smoke), [_vehicle, _positions]] call CBA_fnc_globalEvent;
[{ [{
params ["_vehicle", "_positions", "_intensity", "_ammoDetonationChance", "_detonateAfterCookoff", "_instigator", "_fireSource", "_canRing"]; params ["_vehicle", "_positions", "_intensity", "_ammoDetonationChance", "_detonateAfterCookoff", "_instigator", "_fireSource", "_canRing", "_canJet"];
_vehicle setVariable [QGVAR(intensity), _intensity]; _vehicle setVariable [QGVAR(intensity), _intensity];
private _smokeEffects = _vehicle getVariable [QGVAR(effects), []]; private _smokeEffects = _vehicle getVariable [QGVAR(effects), []];
[{ [{
params ["_args", "_pfh"]; params ["_args", "_pfh"];
_args params ["_vehicle", "_positions", "_ammoDetonationChance", "_detonateAfterCookoff", "_instigator", "_fireSource", "_canRing", "_smokeEffects"]; _args params ["_vehicle", "_positions", "_ammoDetonationChance", "_detonateAfterCookoff", "_instigator", "_fireSource", "_canRing", "_canJet", "_smokeEffects"];
private _intensity = _vehicle getVariable [QGVAR(intensity), 0]; private _intensity = _vehicle getVariable [QGVAR(intensity), 0];
if (isNull _vehicle || {_intensity <= 1}) exitWith { if (isNull _vehicle || {_intensity <= 1}) exitWith {
[QGVAR(cleanupEffects), [_vehicle, _smokeEffects]] call CBA_fnc_globalEvent; [QGVAR(cleanupEffects), [_vehicle, _smokeEffects]] call CBA_fnc_globalEvent;
@ -96,7 +99,7 @@ if (_smokeDelayEnabled) then {
_fireSource = selectRandom _positions; _fireSource = selectRandom _positions;
}; };
[QGVAR(cookOffEffect), [_vehicle, true, _ring, _time, _fireSource, _intensity]] call CBA_fnc_globalEvent; [QGVAR(cookOffEffect), [_vehicle, _canJet, _ring, _time, _fireSource, _intensity]] call CBA_fnc_globalEvent;
_intensity = _intensity - (0.5 max random 1); _intensity = _intensity - (0.5 max random 1);
_vehicle setVariable [QGVAR(intensity), _intensity]; _vehicle setVariable [QGVAR(intensity), _intensity];
@ -122,5 +125,5 @@ if (_smokeDelayEnabled) then {
_vehicle setVariable [QGVAR(nextExplosiveDetonation), random 60]; _vehicle setVariable [QGVAR(nextExplosiveDetonation), random 60];
}; };
}; };
}, 0.25, [_vehicle, _positions, _ammoDetonationChance, _detonateAfterCookoff, _instigator, _fireSource, _canRing, _smokeEffects]] call CBA_fnc_addPerFrameHandler }, 0.25, [_vehicle, _positions, _ammoDetonationChance, _detonateAfterCookoff, _instigator, _fireSource, _canRing, _canJet, _smokeEffects]] call CBA_fnc_addPerFrameHandler
}, [_vehicle, _positions, _intensity, _ammoDetonationChance, _detonateAfterCookoff, _instigator, _fireSource, _canRing], _delay] call CBA_fnc_waitAndExecute; }, [_vehicle, _positions, _intensity, _ammoDetonationChance, _detonateAfterCookoff, _instigator, _fireSource, _canRing, _canJet], _delay] call CBA_fnc_waitAndExecute;

View File

@ -32,8 +32,10 @@ private _sound = objNull;
if (isServer) then { if (isServer) then {
// ironically biggest performance hit is this. Creating a new sound source takes up aprox 400 milliseconds. // ironically biggest performance hit is this. Creating a new sound source takes up aprox 400 milliseconds.
// I dont think there is an alternative that takes into effect distance and whatever, but if you find one please fix! // I dont think there is an alternative that takes into effect distance and whatever, but if you find one please fix!
if (_jet || _ring) then {
private _soundName = selectRandomWeighted [QGVAR(Sound_low), 0.1, QGVAR(Sound_mid), 0.25, QGVAR(Sound_high), 0.65]; private _soundName = selectRandomWeighted [QGVAR(Sound_low), 0.1, QGVAR(Sound_mid), 0.25, QGVAR(Sound_high), 0.65];
_sound = createSoundSource [_soundName, position _obj, [], 0]; _sound = createSoundSource [_soundName, position _obj, [], 0];
};
if (_ring) then { if (_ring) then {
private _intensity = 6; private _intensity = 6;