Use turret events, fixed invalid param

This commit is contained in:
johnb432 2024-08-10 15:31:08 +02:00
parent 71dcfb512c
commit 9a52511222
3 changed files with 6 additions and 6 deletions

View File

@ -57,17 +57,17 @@ private _eventParams = [_vehicle, _turretPath, objNull, _carryMag, _ammo, _gunne
if (_instantReload) exitWith {
TRACE_1("calling addTurretMag event: instant AI reload",_this);
[QGVAR(addTurretMag), _eventParams] call CBA_fnc_globalEvent;
[QGVAR(addTurretMag), _eventParams, _vehicle, _turretPath] call CBA_fnc_turretEvent;
};
private _timeToLoad = GET_NUMBER(configOf _vehicle >> QUOTE(ADDON) >> "ammoLoadTime",1);
TRACE_1("Reloading in progress",_timeToLoad);
[{
params ["_vehicle", "", "", "", "", "_gunner"];
params ["_vehicle", "_turretPath", "", "", "", "_gunner"];
if !(alive _vehicle && {alive _gunner}) exitWith {TRACE_2("invalid state",alive _vehicle,alive _gunner);};
// Reload the static weapon
TRACE_1("calling addTurretMag event: AI reload",_this);
[QGVAR(addTurretMag), _this] call CBA_fnc_globalEvent;
[QGVAR(addTurretMag), _this, _vehicle, _turretPath] call CBA_fnc_turretEvent;
}, _eventParams, _timeToLoad] call CBA_fnc_waitAndExecute;

View File

@ -30,7 +30,7 @@ private _statement = {
{
(_this select 0) params ["_target", "_turretPath", "", "_carryMag", "_vehMag"];
TRACE_5("unload progressBar finish",_target,_turretPath,_carryMag,_vehMag,_player);
[QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player]] call CBA_fnc_globalEvent;
[QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player], _target, _turretPath] call CBA_fnc_turretEvent;
},
{TRACE_1("unload progressBar fail",_this);},
format [LLSTRING(actionUnload), getText (configFile >> "CfgMagazines" >> _carryMag >> "displayName")],

View File

@ -50,8 +50,8 @@ private _onFinish = {
};
TRACE_1("calling addTurretMag event",_args);
[QGVAR(addTurretMag), _args] call CBA_fnc_globalEvent;
}, [_magSource, _unit, [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend]]] call CBA_fnc_execNextFrame;
[QGVAR(addTurretMag), _args, _args select 0, _args select 1] call CBA_fnc_turretEvent;
}, [_magSource, _unit, [_vehicle, _turret, _magSource, _carryMag, _ammo]]] call CBA_fnc_execNextFrame;
};
[