Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AISwitchMuzzle.c
Go to the documentation of this file.
1
class
SCR_AISwitchMuzzle
:
SCR_AIWeaponHandlingBase
2
{
3
protected
static
const
string
PORT_MUZZLE_ID
=
"MuzzleId"
;
4
5
//--------------------------------------------------------------------------------------------
6
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
7
{
8
if
(!
m_WeaponMgrComp
|| !
m_ControlComp
|| !
m_InventoryMgr
)
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
}
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
Node::GetVariableIn
proto bool GetVariableIn(string name, out void val)
SCR_AISwitchMuzzle
Definition
SCR_AISwitchMuzzle.c:2
SCR_AISwitchMuzzle::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AISwitchMuzzle.c:6
SCR_AISwitchMuzzle::s_aVarsIn
static ref TStringArray s_aVarsIn
Definition
SCR_AISwitchMuzzle.c:44
SCR_AISwitchMuzzle::GetVariablesIn
override TStringArray GetVariablesIn()
Definition
SCR_AISwitchMuzzle.c:45
SCR_AISwitchMuzzle::PORT_MUZZLE_ID
static const string PORT_MUZZLE_ID
Definition
SCR_AISwitchMuzzle.c:3
SCR_AISwitchMuzzle::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AISwitchMuzzle.c:47
SCR_AIWeaponHandlingBase
Base class for nodes which handle magazine switching.
Definition
SCR_AIWeaponHandlingBase.c:3
SCR_AIWeaponHandlingBase::m_CompartmentAccessComp
CompartmentAccessComponent m_CompartmentAccessComp
Definition
SCR_AIWeaponHandlingBase.c:7
SCR_AIWeaponHandlingBase::m_WeaponMgrComp
BaseWeaponManagerComponent m_WeaponMgrComp
Definition
SCR_AIWeaponHandlingBase.c:5
SCR_AIWeaponHandlingBase::m_ControlComp
CharacterControllerComponent m_ControlComp
Definition
SCR_AIWeaponHandlingBase.c:4
SCR_AIWeaponHandlingBase::m_InventoryMgr
SCR_InventoryStorageManagerComponent m_InventoryMgr
Definition
SCR_AIWeaponHandlingBase.c:6
SCR_AIWeaponHandling
Definition
SCR_AIUtils.c:299
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Weapons
SCR_AISwitchMuzzle.c
Generated by
1.17.0