Fixed SmokeLauncherMag rearming on level 0 when empty

This commit is contained in:
jonpas 2015-08-18 02:57:39 +02:00
parent c8c6488125
commit 33e92f8ca0
2 changed files with 4 additions and 4 deletions

View File

@ -17,8 +17,7 @@
*/
#include "script_component.hpp"
private ["_ammo", "_tmpCal", "_cal"];
params ["_target", "_unit", "_vehicle"];
params ["_target", "_unit", "_vehicle"]; // _target is for future possible finite ammo, _unit placeholder
[
10,

View File

@ -32,14 +32,15 @@ if !(local _vehicle) exitWith {
_maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
_currentRounds = _vehicle magazineTurretAmmo [_magazine, _turretPath];
//diag_log format ["Target: %1\nTurretPath: %2\nNumMagazines: %3\nMaxMagazines %4\nNumRounds: %5\nMaxRounds: %6\nMagazine: %7", _vehicle, _turretPath, _currentMagazines, _maxMagazines, _currentRounds, _maxRounds, _magazine];
TRACE_7("Rearmed Turret",_vehicle,_turretPath,_currentMagazines,_maxMagazines,_currentRounds,_maxRounds,_magazine);
if (_currentMagazines < _maxMagazines) then {
_vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath];
for "_idx" from 1 to (_maxMagazines - _currentMagazines) do {
_vehicle addMagazineTurret [_magazine, _turretPath];
};
} else {
if (_currentRounds > 0) then {
if (_currentRounds > 0 || {_magazine == "SmokeLauncherMag"}) then { // When SmokeLauncherMag is empty removeMagazineTurret has no effect
_vehicle setMagazineTurretAmmo [_magazine, _maxRounds, _turretPath];
} else {
_vehicle removeMagazineTurret [_magazine, _turretPath];