Skip to content

Commit

Permalink
Implement new cook off SFX (#5179)
Browse files Browse the repository at this point in the history
* Implement new cook off SFX with variants
* Add hybrid V to authors
  • Loading branch information
kymckay authored Jun 2, 2017
1 parent 5b9c70a commit ae69118
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 11 deletions.
3 changes: 2 additions & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ACE3 CONTRIBUTOR LIST
# ACE3 CONTRIBUTOR LIST
# If you contributed, but are not listed here, contact me:
# koffeinflummi@gmail.com
#
Expand Down Expand Up @@ -84,6 +84,7 @@ Harakhti <shadowdragonphd@gmail.com>
havena <silveredenis@gmail.com>
Hawkins
Head <brobergsebastian@gmail.com>
Hybrid V
Karneck <dschultz26@hotmail.com>
Kavinsky <nmunozfernandez@gmail.com>
Kllrt <kllrtik@gmail.com>
Expand Down
8 changes: 6 additions & 2 deletions addons/cookoff/CfgSFX.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
class CfgSFX {
class GVAR(CookOff) {
name = QGVAR(cookoff);
sounds[] = {QGVAR(cookoff)};
GVAR(cookoff)[] = {PATHTOF(sounds\cookoff.wss),6,1.8,400,1,0,0,0};
// Index 4 is percentage chance to play, in theory high pressure is way more likely
variant0[] = {PATHTOF(sounds\cookoff_low_pressure.ogg),6,1,400,0.1,0,0,0};
variant1[] = {PATHTOF(sounds\cookoff_mid_pressure.ogg),6,1,400,0.25,0,0,0};
variant2[] = {PATHTOF(sounds\cookoff_high_pressure.ogg),6,1,400,0.65,0,0,0};
sounds[] = {"variant0","variant1","variant2"};
titles[] = {};
empty[] = {"",0,0,0,0,0,0,0};
};
};
12 changes: 7 additions & 5 deletions addons/cookoff/functions/fnc_cookOff.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ if (local _vehicle) then {
} forEach _positions;

if (isServer) then {
// TODO - Players in the vehicle hear no sound (even after exiting the vehicle)
private _sound = createSoundSource [QGVAR(Sound), position _vehicle, [], 0];

_effects pushBack _sound;
Expand All @@ -107,11 +108,12 @@ if (local _vehicle) then {
DEC(_counter);

if (_counter > 0) then {
[_fnc_FlameEffect, [_vehicle, _fnc_FlameEffect, _counter], 0.4] call CBA_fnc_waitAndExecute
[_fnc_FlameEffect, [_vehicle, _fnc_FlameEffect, _counter], FLAME_EFFECT_DELAY] call CBA_fnc_waitAndExecute
};
};

[_vehicle, _fnc_FlameEffect, 12] call _fnc_FlameEffect; // recursive function
// Recursive function, occurs for duration of cookoff
[_vehicle, _fnc_FlameEffect, ceil(COOKOFF_TIME/FLAME_EFFECT_DELAY)] call _fnc_FlameEffect;

private _randomPosition = _vehicle getPos [100, random 360];

Expand All @@ -132,6 +134,6 @@ if (local _vehicle) then {
if (local _vehicle) then {
_vehicle setDamage 1;
};
}, [_vehicle, _effects], 14] call CBA_fnc_waitAndExecute;
}, [_vehicle, _effects, _positions], 10.5] call CBA_fnc_waitAndExecute;
}, _vehicle, 3] call CBA_fnc_waitAndExecute;
}, [_vehicle, _effects], COOKOFF_TIME] call CBA_fnc_waitAndExecute; // TODO: Randomise cook off time with locality in mind
}, [_vehicle, _effects, _positions], SMOKE_TIME] call CBA_fnc_waitAndExecute;
}, _vehicle, IGNITE_TIME] call CBA_fnc_waitAndExecute;
6 changes: 3 additions & 3 deletions addons/cookoff/functions/fnc_cookOffBox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ if (local _box) then {
if (local _box) then {
_box setDamage 1;
};
}, [_box, _effects], 82.5] call CBA_fnc_waitAndExecute; // Give signifcant time for ammo cookoff to occur (perhaps keep the box alive until all cooked off?)
}, [_box, _effects], 10.5] call CBA_fnc_waitAndExecute;
}, _box, 3] call CBA_fnc_waitAndExecute;
}, [_box, _effects], COOKOFF_TIME_BOX] call CBA_fnc_waitAndExecute; // TODO: Change so that box is alive until no ammo left, with locality in mind
}, [_box, _effects], SMOKE_TIME] call CBA_fnc_waitAndExecute;
}, _box, IGNITE_TIME] call CBA_fnc_waitAndExecute;
10 changes: 10 additions & 0 deletions addons/cookoff/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@
#include "\z\ace\addons\main\script_macros.hpp"

#define IS_EXPLOSIVE_AMMO(ammo) (getNumber (ammo call CBA_fnc_getObjectConfig >> "explosive") > 0.5)

// Stages of cookoff in order (in seconds)
// Should be no un-synced randomness in these as the effects must be ran on each client
#define IGNITE_TIME 3
#define SMOKE_TIME 10.5
#define COOKOFF_TIME 14 // Cook off time should be 20s at most due to length of sound files
#define COOKOFF_TIME_BOX 82.5 // Cook off time for boxes should be significant to allow time for ammo to burn

// Delay between flame effect for players in a cooking off vehicle
#define FLAME_EFFECT_DELAY 0.4
Binary file removed addons/cookoff/sounds/cookoff.wss
Binary file not shown.
Binary file added addons/cookoff/sounds/cookoff_high_pressure.ogg
Binary file not shown.
Binary file added addons/cookoff/sounds/cookoff_low_pressure.ogg
Binary file not shown.
Binary file added addons/cookoff/sounds/cookoff_mid_pressure.ogg
Binary file not shown.

0 comments on commit ae69118

Please sign in to comment.