2022-03-07 18:29:19 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
2023-06-19 13:31:17 +00:00
|
|
|
* Author: Grim
|
2022-03-07 18:29:19 +00:00
|
|
|
* Handles AI GetIn on an empty weapon
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* GetIn EH
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2023-07-01 15:39:42 +00:00
|
|
|
params ["_staticWeapon", "_role", "_gunner", "_turret"];
|
2022-03-07 18:29:19 +00:00
|
|
|
TRACE_3("getInEH:",_staticWeapon,_role,_gunner);
|
|
|
|
|
|
|
|
if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {};
|
|
|
|
if (someAmmo _staticWeapon) exitWith {};
|
|
|
|
|
2023-07-01 17:33:42 +00:00
|
|
|
// turret can be empty when AI is forcefully moved to the vehicle
|
|
|
|
if (_turret isEqualTo []) then {
|
|
|
|
_turret = (assignedVehicleRole _gunner) select 1;
|
|
|
|
};
|
2022-03-07 18:29:19 +00:00
|
|
|
|
2023-07-01 15:39:42 +00:00
|
|
|
// this doesn't handle multi-weapon turrets, need a "turretWeapon" event or a PFH to do that
|
|
|
|
private _weapon = (_staticWeapon weaponsTurret _turret) select 0;
|
2023-07-01 17:33:42 +00:00
|
|
|
TRACE_4("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon,_turret,_weapon);
|
2023-07-01 15:39:42 +00:00
|
|
|
|
2023-07-01 17:33:42 +00:00
|
|
|
[_staticWeapon, _gunner, _weapon] call FUNC(ai_reload);
|