Minor improvements

This commit is contained in:
johnb432 2024-07-02 17:06:33 +02:00
parent e2a9917c53
commit dfc018a031
3 changed files with 9 additions and 5 deletions

View File

@ -39,11 +39,12 @@ if (_object getVariable [QGVAR(isAmmoDetonating), false]) exitWith {};
_object setVariable [QGVAR(isAmmoDetonating), true, true];
_object setVariable [QGVAR(cookoffMagazines), _object call FUNC(getVehicleAmmo)];
// Make sure that virtual magazines have been reset
_object setVariable [QGVAR(virtualMagazines), nil];
// Save the vehicle's ammo, so it won't be removed during cook-off
if (!GVAR(removeAmmoDuringCookoff)) then {
_object setVariable [QGVAR(cookoffMagazines), _object call FUNC(getVehicleAmmo)];
_object setVariable [QGVAR(cookoffMagazines), [_object, true] call FUNC(getVehicleAmmo)];
};
[LINKFUNC(detonateAmmunitionServerLoop), [_object, _destroyWhenFinished, _source, _instigator], _initialDelay] call CBA_fnc_waitAndExecute;

View File

@ -27,7 +27,7 @@ private _objectAmmo = _object getVariable QGVAR(cookoffMagazines);
private _removeAmmoDuringCookoff = isNil "_objectAmmo";
if (_removeAmmoDuringCookoff) then {
_objectAmmo = _object call FUNC(getVehicleAmmo);
_objectAmmo = [_object, true] call FUNC(getVehicleAmmo);
};
_objectAmmo params ["_magazines", "_totalAmmo"];

View File

@ -5,6 +5,7 @@
*
* Arguments:
* 0: Object <OBJECT>
* 1: If the virtual magazine count should be set <BOOL> (default: false)
*
* Return Value:
* 0: Ammo array <ARRAY>
@ -20,7 +21,7 @@
* Public: No
*/
params ["_object"];
params ["_object", ["_setVirtualAmmoCount", false]];
TRACE_1("getVehicleAmmo",_object);
private _ammoToDetonate = [];
@ -80,7 +81,9 @@ if (isNil "_virtualAmmo") then {
_totalAmmo = _totalAmmo + 10;
};
if (_setVirtualAmmoCount) then {
_object setVariable [QGVAR(virtualMagazines), _virtualAmmo];
};
} else {
{
_totalAmmo = _totalAmmo + (_x select 1);