Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AISwitchMuzzle.c
Go to the documentation of this file.
2{
3 protected static const string PORT_MUZZLE_ID = "MuzzleId";
4
5 //--------------------------------------------------------------------------------------------
6 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
7 {
9 return ENodeResult.FAIL;
10
11 int newMuzzleId = -1;
12 GetVariableIn(PORT_MUZZLE_ID, newMuzzleId);
13 if (newMuzzleId == -1)
14 {
15 #ifdef AI_DEBUG
16 AddDebugMessage("Skipped muzzle switch, no muzzle was provided");
17 #endif
18 return ENodeResult.SUCCESS;
19 }
20
21 BaseCompartmentSlot compartmentSlot = m_CompartmentAccessComp.GetCompartment();
22
23 // Return success if done
24 // Ignore if we are in compartment. There are no turret weapons where we can choose a muzzle.
25 // And there is no API to switch muzzle in a turret anyway.
26 int currentMuzzleId = SCR_AIWeaponHandling.GetCurrentMuzzleId(m_WeaponMgrComp);
27 if (currentMuzzleId == newMuzzleId || compartmentSlot)
28 {
29 #ifdef AI_DEBUG
30 AddDebugMessage("Muzzle switch completed");
31 #endif
32 return ENodeResult.SUCCESS;
33 }
34
35 #ifdef AI_DEBUG
36 AddDebugMessage(string.Format("Start Muzzle Switch: %1", newMuzzleId));
37 #endif
38 SCR_AIWeaponHandling.StartMuzzleSwitch(m_ControlComp, newMuzzleId);
39
40 return ENodeResult.RUNNING;
41 }
42
43 //--------------------------------------------------------------------------------------------
44 protected static ref TStringArray s_aVarsIn = {PORT_MUZZLE_ID};
45 override TStringArray GetVariablesIn() { return s_aVarsIn; }
46
47 static override bool VisibleInPalette() { return true; }
48}
proto bool GetVariableIn(string name, out void val)
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
static ref TStringArray s_aVarsIn
override TStringArray GetVariablesIn()
static const string PORT_MUZZLE_ID
static override bool VisibleInPalette()
Base class for nodes which handle magazine switching.
CompartmentAccessComponent m_CompartmentAccessComp
BaseWeaponManagerComponent m_WeaponMgrComp
CharacterControllerComponent m_ControlComp
SCR_InventoryStorageManagerComponent m_InventoryMgr
ENodeResult
Definition ENodeResult.c:13
array< string > TStringArray
Definition Types.c:385