Fixed mortar double loading (#6240)

* block double loading

* prevent double loading

* block double loading

* use nil

* use nil

* fix some wrong variables

* not needed here

* unload only one person

* prevent duping

* wrong makro

* wrong makro

* wrong macros

* wrong macros
This commit is contained in:
shukari 2018-05-30 23:45:31 +02:00 committed by PabstMirror
parent 9acce30dd3
commit bdc58441f4
4 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,7 @@
params ["_static","_unit",["_magazineClassOptional","",[""]]];
if !(alive _static && GVAR(useAmmoHandling)) exitWith {false};
if (_static getVariable [QGVAR(inUse), false]) exitWith {false};
private _canLoadMagazine = false;
private _hasCompatibleMagazine = false;
@ -45,7 +46,7 @@ if (count (_static magazinesTurret [0]) > 0) then {
_count = _currentMagazine select 2;
};
//If the static weapon doesn't have a magzine or a magazine with no bullets, the player has a compatible magazine and the static weapon has a barrel then you can load a magazine
if ((count (_static magazinesTurret [0]) == 0 || _count == 0 ) && _hasCompatibleMagazine) then {
if ((count (_static magazinesTurret [0]) == 0 || _count == 0) && _hasCompatibleMagazine) then {
_canLoadMagazine = true;
};
_canLoadMagazine

View File

@ -19,6 +19,8 @@
params ["_static","_unit"];
if !(alive _static && GVAR(useAmmoHandling) && _static getVariable [QGVAR(initialized),false]) exitWith {false};
if (_static getVariable [QGVAR(inUse), false]) exitWith {false};
private _canUnloadMagazine = false;
private _ammoCount = ((magazinesAllTurrets _static) select 1) select 2;

View File

@ -20,9 +20,11 @@
params ["_static","_unit","_timeToLoad",["_magazineClassOptional","",[""]]];
_static setVariable [QGVAR(inUse), true, true];
// Move player into animation if player is standing
if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then {
[_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation);
};
[_timeToLoad, [_static,_unit,_magazineClassOptional], {(_this select 0) call FUNC(loadMagazine)}, {}, localize LSTRING(loadingMortar)] call EFUNC(common,progressBar);
[_timeToLoad, [_static,_unit,_magazineClassOptional], {(_this select 0) call FUNC(loadMagazine); ((_this select 0) select 0) setVariable [QGVAR(inUse), nil, true]}, {((_this select 0) select 0) setVariable [QGVAR(inUse), nil, true]}, localize LSTRING(loadingMortar)] call EFUNC(common,progressBar);

View File

@ -20,9 +20,11 @@
params ["_static","_unit","_timeToUnload"];
_static setVariable [QGVAR(inUse), true, true];
//Move player into animation if player is standing
if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then {
[_unit, "AmovPercMstpSrasWrflDnon_diary", 1] call EFUNC(common,doAnimation);
};
[_timeToUnload, [_static,_unit], {(_this select 0) call FUNC(unloadMagazine)}, {}, localize LSTRING(unloadingMortar)] call EFUNC(common,progressBar);
[_timeToUnload, [_static,_unit], {(_this select 0) call FUNC(unloadMagazine); ((_this select 0) select 0) setVariable [QGVAR(inUse), nil, true]}, {((_this select 0) select 0) setVariable [QGVAR(inUse), nil, true]}, localize LSTRING(unloadingMortar)] call EFUNC(common,progressBar);