Skip to content

Commit

Permalink
fixed infinite shooting
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntematonjr committed Feb 22, 2021
1 parent 997059d commit 06e2c85
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 5 deletions.
50 changes: 50 additions & 0 deletions addons/firesupport/Stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -987,5 +987,55 @@
<German>Create marker to map.</German>
</Key>
</Container>
<Container name="notifications">
<Key ID="STR_tun_firesupport_NoGunSelected">
<Original>No gun selected</Original>
<English>No gun selected</English>
<Czech>No gun selected</Czech>
<French>No gun selected</French>
<Spanish>No gun selected</Spanish>
<Italian>No gun selected</Italian>
<Polish>No gun selected</Polish>
<Portuguese>No gun selected</Portuguese>
<Russian>No gun selected</Russian>
<German>No gun selected</German>
</Key>
<Key ID="STR_tun_firesupport_NoAmmoSelected">
<Original>No ammo selected</Original>
<English>No ammo selected</English>
<Czech>No ammo selected</Czech>
<French>No ammo selected</French>
<Spanish>No ammo selected</Spanish>
<Italian>No ammo selected</Italian>
<Polish>No ammo selected</Polish>
<Portuguese>No ammo selected</Portuguese>
<Russian>No ammo selected</Russian>
<German>No ammo selected</German>
</Key>
<Key ID="STR_tun_firesupport_AlreadyFiring">
<Original>Gun is bussy</Original>
<English>Gun is bussy</English>
<Czech>Gun is bussy</Czech>
<French>Gun is bussy</French>
<Spanish>Gun is bussy</Spanish>
<Italian>Gun is bussy</Italian>
<Polish>Gun is bussy</Polish>
<Portuguese>Gun is bussy</Portuguese>
<Russian>Gun is bussy</Russian>
<German>Gun is bussy</German>
</Key>
<Key ID="STR_tun_firesupport_NoShells">
<Original>Shell count is 0</Original>
<English>Shell count is 0</English>
<Czech>Shell count is 0</Czech>
<French>Shell count is 0</French>
<Spanish>Shell count is 0</Spanish>
<Italian>Shell count is 0</Italian>
<Polish>Shell count is 0</Polish>
<Portuguese>Shell count is 0</Portuguese>
<Russian>Shell count is 0</Russian>
<German>Shell count is 0</German>
</Key>
</Container>
</Package>
</Project>
26 changes: 23 additions & 3 deletions addons/firesupport/functions/fnc_fire.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@

if ( (ctrlText STATUS_IDC) in ["CANT FIRE", "Out of Range", "Out of Ammo", "Busy"] ) exitWith {
hintSilent (ctrlText STATUS_IDC);
playSound "zoom_fail";
playSound "3DEN_notificationWarning";
};

private _index = lbCurSel ARTY_LIST_IDC;
//No gun selected
if (_index == -1) exitWith {
playSound "3DEN_notificationWarning";
hintSilent localize "STR_tun_firesupport_NoGunSelected";
};

private _variables = switch (playerSide) do {
Expand All @@ -48,11 +55,23 @@ private _variables = switch (playerSide) do {
};
};

private _index = lbCurSel ARTY_LIST_IDC;
private _gun_module = _variables select _index;
//Gun is firing
if (_gun_module getVariable [QGVAR(is_firing), false]) exitWith {
playSound "3DEN_notificationWarning";
hintSilent localize "STR_tun_firesupport_AlreadyFiring";
};

private _ammoIndex = lbCurSel AMMO_TYPE_IDC;
//No ammo selected
if (_ammoIndex == -1) exitWith {
playSound "3DEN_notificationWarning";
hintSilent localize "STR_tun_firesupport_NoAmmoSelected";
};

private _easting = ctrlText EASTING_IDC;
private _northing = ctrlText NORTHING_IDC;
private _type = lbData [AMMO_TYPE_IDC, lbCurSel AMMO_TYPE_IDC];
private _type = lbData [AMMO_TYPE_IDC, _ammoIndex];
private _count = parseNumber ctrlText COUNT_IDC;
private _range = parseNumber ctrlText RANGE_IDC;
private _delay = parseNumber ctrlText DELAY_IDC;
Expand All @@ -62,6 +81,7 @@ private _firing_style = lbText [FIRING_TYPE_IDC,lbCurSel FIRING_TYPE_IDC];

if ( _count <= 0 ) exitWith {
playSound "3DEN_notificationWarning";
hintSilent localize "STR_tun_firesupport_NoShells";
};

_gun_module setVariable [QGVAR(is_firing), true];
Expand Down
4 changes: 2 additions & 2 deletions addons/firesupport/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#define MAJOR 1
#define MINOR 0
#define PATCHLVL 0
#define BUILD 08022021
#define PATCHLVL 1
#define BUILD 22022021

#define VERSION MAJOR.MINOR.PATCHLVL.BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
Expand Down

0 comments on commit 06e2c85

Please sign in to comment.