Skip to content

Commit f255375

Browse files
bluefield-creatorPabstMirrorjohnb432
authored
Cookoff - Add the ability to disable cookoff sounds and projectiles. (#10926)
* feat: add setting stringtable * Update initSettings.inc.sqf * Update stringtable.xml * Update initSettings.inc.sqf * Update XEH_postInit.sqf * Update fnc_detonateAmmunitionServerLoop.sqf * improve french translation Peer reviewed the translation and suggested this change. Quote I mean you could say "Désactive le son de « pop-corn » des projectiles explosant à l'intérieur du véhicule" which is a tad more precise since "explosant dans le véhicule" could also be interpreted as incoming projectiles Endquote * Make 'cookoffDisableSound' restart required. * update: move cookoffDisabledSound check to runtime * removed restart requirement from cookoffDisableSound * improve translation Spanish, German, French and English are peer reviewed. **THE REST ARE NOT!** * remove repeating bullshit * Update fnc_detonateAmmunitionServerLoop.sqf * remove dogshit translations, adde Czech by @ilbinek God AI is dogshit at its core functionality * remove typo * Update addons/cookoff/initSettings.inc.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update addons/cookoff/functions/fnc_detonateAmmunitionServerLoop.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/XEH_postInit.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/functions/fnc_detonateAmmunitionServerLoop.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/initSettings.inc.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * refactor: invert logic naming, remove outdated translations * Fix tabs * Update initSettings.inc.sqf * Fix stringtable file * Sort stringtable * Update addons/cookoff/initSettings.inc.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/initSettings.inc.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update fnc_detonateAmmunitionServerLoop.sqf * Update addons/cookoff/functions/fnc_detonateAmmunitionServerLoop.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/XEH_postInit.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/stringtable.xml Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/stringtable.xml Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/cookoff/stringtable.xml Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Use GVAR(cookoffEnableSound) setting --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
1 parent 8dab8ec commit f255375

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

addons/cookoff/functions/fnc_detonateAmmunitionServerLoop.sqf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ private _magazineIndex = floor random (count _magazines);
7777
private _magazine = _magazines select _magazineIndex;
7878
_magazine params ["_magazineClassname", "_ammoCount", "_spawnProjectile", "_magazineInfo"];
7979

80+
// If we disabled projectiles in settings, we exit the current scope
81+
if (!GVAR(cookoffEnableProjectiles)) then {
82+
_spawnProjectile = false;
83+
};
84+
8085
// Make sure ammo is at least 0
8186
_ammoCount = _ammoCount max 0;
8287

@@ -183,14 +188,14 @@ private _fnc_spawnProjectile = {
183188

184189
switch (_simType) do {
185190
case "shotbullet": {
186-
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
191+
if (GVAR(cookoffEnableSound)) then { [QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent; };
187192

188193
if (random 1 < 0.6) then {
189194
true call _fnc_spawnProjectile;
190195
};
191196
};
192197
case "shotshell": {
193-
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
198+
if (GVAR(cookoffEnableSound)) then { [QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent; };
194199

195200
if (random 1 < 0.15) then {
196201
true call _fnc_spawnProjectile;
@@ -207,10 +212,12 @@ switch (_simType) do {
207212
case "shotmissile";
208213
case "shotsubmunitions": {
209214
if (random 1 < 0.1) then {
210-
[QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent;
215+
if (GVAR(cookoffEnableSound)) then { [QGVAR(playCookoffSound), [_object, _simType]] call CBA_fnc_globalEvent; };
211216

212217
(random 1 < 0.3) call _fnc_spawnProjectile;
213218
} else {
219+
// We re-check the cookoffEnableProjectiles because this case is not running the _spawnProjectile function
220+
if (!GVAR(cookoffEnableProjectiles)) exitWith {};
214221
createVehicle ["ACE_ammoExplosionLarge", _object modelToWorld _effect2pos, [], 0 , "CAN_COLLIDE"];
215222
};
216223
};

addons/cookoff/initSettings.inc.sqf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,21 @@
6969
true,
7070
1
7171
] call CBA_fnc_addSetting;
72+
73+
[
74+
QGVAR(cookoffEnableProjectiles),
75+
"CHECKBOX",
76+
[LSTRING(enableProjectiles_name), LSTRING(enableProjectiles_tooltip)],
77+
LSTRING(category_displayName),
78+
true,
79+
1
80+
] call CBA_fnc_addSetting;
81+
82+
[
83+
QGVAR(cookoffEnableSound),
84+
"CHECKBOX",
85+
[LSTRING(enableSound_name), LSTRING(enableSound_tooltip)],
86+
LSTRING(category_displayName),
87+
true,
88+
1
89+
] call CBA_fnc_addSetting;

addons/cookoff/stringtable.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,26 @@
146146
<Korean>차량 유폭 효과를 활성화합니다.\n여기엔 탄약 유폭이 포함되지 않습니다.</Korean>
147147
<Japanese>車両の誘爆火災エフェクトを有効化します。\nこれには弾薬の爆発は含まれません。</Japanese>
148148
</Key>
149+
<Key ID="STR_ACE_CookOff_enableProjectiles_name">
150+
<English>Enable projectile fire</English>
151+
<French>Activer le tir de projectiles</French>
152+
<Spanish>Habilitar la detonación de proyectiles</Spanish>
153+
</Key>
154+
<Key ID="STR_ACE_CookOff_enableProjectiles_tooltip">
155+
<English>Enables projectiles firing from the vehicle</English>
156+
<French>Active le tir de projectiles depuis le véhicule</French>
157+
<Spanish>Habilita la detonación de proyectiles desde el interior del vehículo</Spanish>
158+
</Key>
159+
<Key ID="STR_ACE_CookOff_enableSound_name">
160+
<English>Disable cook-off sounds</English>
161+
<French>Désactiver les sons d'explosion</French>
162+
<Spanish>Habilitar sonido de detonación</Spanish>
163+
</Key>
164+
<Key ID="STR_ACE_CookOff_enableSound_tooltip">
165+
<English>Enables the sound of projectiles cooking off from inside the vehicle</English>
166+
<French>Active le son des projectiles se déclenchant à l'intérieur du véhicule</French>
167+
<Spanish>Habilita el sonido de los proyectiles que se detonan dentro del interior del vehículo</Spanish>
168+
</Key>
149169
<Key ID="STR_ACE_CookOff_probabilityCoef_name">
150170
<English>Vehicle cook-off fire probability multiplier</English>
151171
<French>Probabilité d'incendies de véhicules</French>

0 commit comments

Comments
 (0)