Skip to content

Commit

Permalink
Don't run if position selection is cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
ampersand38 committed Jun 26, 2020
1 parent 854d0fe commit b38addb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
36 changes: 19 additions & 17 deletions addons/modules/functions/fnc_moduleFireGL.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,26 @@ if (_glMuzzles isEqualTo []) exitWith {
// Get target position
[_unit, {
params ["_successful", "_unit", "_mousePosASL"];
private _weapons = weapons _unit;
private _glMuzzles = [];
{
private _weapon = _x;
if _successful then {
private _weapons = weapons _unit;
private _glMuzzles = [];
{
private _muzzle = _x;
if (configName inheritsFrom (configFile >> "CfgWeapons" >> _weapon >> _muzzle) isEqualTo "UGL_F") then {
_glMuzzles pushBack [_weapon, _muzzle];
};
} forEach getArray(configFile >> "cfgWeapons" >> _weapon >> "muzzles");
} forEach _weapons;
private _weapon = _x;
{
private _muzzle = _x;
if (configName inheritsFrom (configFile >> "CfgWeapons" >> _weapon >> _muzzle) isEqualTo "UGL_F") then {
_glMuzzles pushBack [_weapon, _muzzle];
};
} forEach getArray(configFile >> "cfgWeapons" >> _weapon >> "muzzles");
} forEach _weapons;

if (_glMuzzles isEqualTo []) exitWith {
[objNull, format ["Unit has no GL: %1", _unit]] call bis_fnc_showCuratorFeedbackMessage;
};
if (_glMuzzles isEqualTo []) exitWith {
[objNull, format ["Unit has no GL: %1", _unit]] call bis_fnc_showCuratorFeedbackMessage;
};

private _magazine = "1Rnd_HE_Grenade_shell";
private _muzzle = _glMuzzles # 0 # 1;
private _firemode = "Single";
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call zen_modules_fnc_projectiles_zeus;
private _magazine = "1Rnd_HE_Grenade_shell";
private _muzzle = _glMuzzles # 0 # 1;
private _firemode = "Single";
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call zen_modules_fnc_projectiles_zeus;
};
}, [], LSTRING(ModuleFireGL)] call EFUNC(common,selectPosition);
12 changes: 7 additions & 5 deletions addons/modules/functions/fnc_moduleFireLauncher.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ if (_launcher isEqualTo "") exitWith {
// Get target position
[_unit, {
params ["_successful", "_unit", "_mousePosASL"];
private _weapon = secondaryWeapon _unit;
if _successful then {
private _weapon = secondaryWeapon _unit;

private _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "Magazines") # 0;
private _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "Magazines") # 0;

private _muzzle = _weapon;
private _firemode = "Single";
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call zen_modules_fnc_projectiles_zeus;
private _muzzle = _weapon;
private _firemode = "Single";
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call zen_modules_fnc_projectiles_zeus;
};
}, [], LSTRING(ModuleFireLauncher)] call EFUNC(common,selectPosition);
10 changes: 6 additions & 4 deletions addons/modules/functions/fnc_moduleThrowSelect.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ private _action = [];
// Get target position
[_unit, {
params ["_successful", "_unit", "_mousePosASL", "_arguments"];
_arguments params ["_magazine"];
private _muzzle = configName (("_magazine in (getArray (_x >> 'magazines'))" configClasses (configFile >> "CfgWeapons" >> "Throw")) # 0);
private _firemode = _muzzle;
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call FUNC(projectiles_zeus);
if _successful then {
_arguments params ["_magazine"];
private _muzzle = configName (("_magazine in (getArray (_x >> 'magazines'))" configClasses (configFile >> "CfgWeapons" >> "Throw")) # 0);
private _firemode = _muzzle;
[_unit, _magazine, _muzzle, _firemode, _mousePosASL] call FUNC(projectiles_zeus);
};
}, [_magazine], LSTRING(ModuleThrowSelect)] call EFUNC(common,selectPosition);

},
Expand Down

0 comments on commit b38addb

Please sign in to comment.