Use setMagazineTurretAmmo in 2.18

This commit is contained in:
johnb432 2024-04-03 00:44:19 +02:00
parent 613fc36385
commit 7ad4a8edf8
2 changed files with 2 additions and 18 deletions

View File

@ -39,14 +39,7 @@ if (_canAdd) then {
private _currentAmmo = _vehicle magazineTurretAmmo [_loadedMag, _turret];
_currentAmmo = _currentAmmo + _ammoUsed;
TRACE_2("Setting mag ammo",_loadedMag,_currentAmmo);
// _vehicle setMagazineTurretAmmo [_loadedMag, _currentAmmo, _turret];
// setMagazineTurretAmmo is broken on split locality, use setAmmo for now (this may not work for multi turret vehicles)
private _weapon = (_vehicle weaponsTurret _turret) param [0, ""];
TRACE_3("setAmmo",_vehicle,_weapon,_currentAmmo);
_vehicle setAmmo [_weapon, _currentAmmo];
private _currentAmmo = _vehicle magazineTurretAmmo [_loadedMag, _turret];
if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { ERROR_1("failed to setAmmo - %1",_this); };
_vehicle setMagazineTurretAmmo [_loadedMag, _currentAmmo, _turret];
} else {
if (_loadedMag != "") then {
TRACE_1("Removing emtpy mag",_loadedMag);

View File

@ -51,16 +51,7 @@ private _ammoLeft = _ammoInFirstMag - _ammoRemoved;
if ((_magsInWeapon isEqualTo []) && {_ammoInFirstMag > _ammoRemoved}) then {
// Only one mag in gun, and we're just taking out a partial ammount (unlinking)
TRACE_2("Setting mag ammo",_ammoRemoved,_ammoLeft);
// _vehicle setMagazineTurretAmmo [_vehMag, _ammoLeft, _turretPath];
// setMagazineTurretAmmo is broken on split locality, use setAmmo for now
private _weapon = (_vehicle weaponsTurret _turretPath) param [0, ""];
TRACE_3("setAmmo",_vehicle,_weapon,_ammoLeft);
_vehicle setAmmo [_weapon, _ammoLeft];
private _currentAmmo = _vehicle magazineTurretAmmo [_vehMag, _turretPath];
if ((_weapon == "") || {_currentAmmo != _ammoLeft}) then { ERROR_1("failed to setAmmo - %1",_this); };
_vehicle setMagazineTurretAmmo [_vehMag, _ammoLeft, _turretPath];
} else {
// Because of command limitations, we need to remove mags to change their ammo
// This will cause the gun to need to be reloaded if more than one is loaded (only a problem for non-assembly mode guns)