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_AIDecoHasMagazineCount.c
Go to the documentation of this file.
1
enum
EVariableTestType
2
{
3
EqualsValue
,
4
BiggerThanValue
,
5
SmallerThanValue
,
6
WasChanged
7
};
8
9
class
SCR_AIDecoHasMagazineCount
:
DecoratorScripted
10
{
11
static
const
string
PORT_MAGAZINE_COUNT =
"MagazineCountOut"
;
12
13
[
Attribute
(
"0"
,
UIWidgets
.ComboBox,
"Test Type"
,
""
, ParamEnumArray.FromEnum(
EVariableTestType
) )]
14
protected
EVariableTestType
m_TestType
;
15
[
Attribute
(
"0"
,
UIWidgets
.EditBox,
"Test Value"
)]
16
protected
int
m_iNumberOfMagazines
;
17
18
protected
SCR_InventoryStorageManagerComponent
m_inventoryManager
;
19
protected
BaseWeaponComponent
m_weapon
;
20
protected
int
prevAmmo
;
21
22
IEntity
m_entity
;
23
24
protected
static
ref
TStringArray
s_aVarsOut
= {
25
PORT_MAGAZINE_COUNT
26
};
27
override
TStringArray
GetVariablesOut
()
28
{
29
return
s_aVarsOut
;
30
}
31
32
override
void
OnInit
(AIAgent owner)
33
{
34
m_entity
= owner.GetControlledEntity();
35
}
36
37
protected
override
bool
TestFunction
(AIAgent owner)
38
{
39
if
(
m_entity
&& !
m_weapon
)
40
{
41
m_inventoryManager
= SCR_InventoryStorageManagerComponent.Cast(
m_entity
.FindComponent(SCR_InventoryStorageManagerComponent));
42
BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(
m_entity
.FindComponent(BaseWeaponManagerComponent));
43
if
(weaponManager)
44
m_weapon
= weaponManager.GetCurrent();
45
}
46
47
if
(!
m_inventoryManager
|| !
m_weapon
)
48
return
false
;
49
int
ammo =
m_inventoryManager
.GetMagazineCountByWeapon(
m_weapon
);
50
bool
result =
false
;
51
switch
(
m_TestType
)
52
{
53
case
EVariableTestType
.EqualsValue:
54
{
55
result = ammo ==
m_iNumberOfMagazines
;
56
break
;
57
}
58
case
EVariableTestType
.BiggerThanValue:
59
{
60
result = ammo >
m_iNumberOfMagazines
;
61
break
;
62
}
63
case
EVariableTestType
.SmallerThanValue:
64
{
65
result = ammo <
m_iNumberOfMagazines
;
66
break
;
67
}
68
case
EVariableTestType
.WasChanged:
69
{
70
result = ammo !=
prevAmmo
;
71
prevAmmo
= ammo;
72
break
;
73
}
74
}
75
SetVariableOut
(PORT_MAGAZINE_COUNT, ammo);
76
return
result;
77
}
78
79
protected
static
override
bool
VisibleInPalette
()
80
{
81
return
true
;
82
}
83
84
override
protected
string
GetNodeMiddleText
()
85
{
86
return
"Checks: "
+
typename
.EnumToString(
EVariableTestType
,
m_TestType
) +
" with value: "
+
m_iNumberOfMagazines
.ToString();
87
}
88
89
protected
static
override
string
GetOnHoverDescription
()
90
{
91
return
"Decorator that tests if entity has a weapon specified in attribute either as weapon type or as magazine well, in that case it returns the weapon type of the weapon"
;
92
}
93
};
EVariableTestType
EVariableTestType
Definition
SCR_AIDecoHasMagazineCount.c:2
BiggerThanValue
@ BiggerThanValue
Definition
SCR_AIDecoHasMagazineCount.c:4
EqualsValue
@ EqualsValue
Definition
SCR_AIDecoHasMagazineCount.c:3
WasChanged
@ WasChanged
Definition
SCR_AIDecoHasMagazineCount.c:6
SmallerThanValue
@ SmallerThanValue
Definition
SCR_AIDecoHasMagazineCount.c:5
BaseWeaponComponent
Definition
BaseWeaponComponent.c:13
DecoratorScripted
Definition
DecoratorScripted.c:13
IEntity
Definition
IEntity.c:13
Node::SetVariableOut
proto void SetVariableOut(string name, void val)
SCR_AIDecoHasMagazineCount
Definition
SCR_AIDecoHasMagazineCount.c:10
SCR_AIDecoHasMagazineCount::m_weapon
BaseWeaponComponent m_weapon
Definition
SCR_AIDecoHasMagazineCount.c:19
SCR_AIDecoHasMagazineCount::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIDecoHasMagazineCount.c:79
SCR_AIDecoHasMagazineCount::m_inventoryManager
SCR_InventoryStorageManagerComponent m_inventoryManager
Definition
SCR_AIDecoHasMagazineCount.c:18
SCR_AIDecoHasMagazineCount::GetOnHoverDescription
static override string GetOnHoverDescription()
Definition
SCR_AIDecoHasMagazineCount.c:89
SCR_AIDecoHasMagazineCount::prevAmmo
int prevAmmo
Definition
SCR_AIDecoHasMagazineCount.c:20
SCR_AIDecoHasMagazineCount::m_iNumberOfMagazines
int m_iNumberOfMagazines
Definition
SCR_AIDecoHasMagazineCount.c:16
SCR_AIDecoHasMagazineCount::s_aVarsOut
static ref TStringArray s_aVarsOut
Definition
SCR_AIDecoHasMagazineCount.c:24
SCR_AIDecoHasMagazineCount::m_TestType
EVariableTestType m_TestType
Definition
SCR_AIDecoHasMagazineCount.c:14
SCR_AIDecoHasMagazineCount::m_entity
IEntity m_entity
Definition
SCR_AIDecoHasMagazineCount.c:22
SCR_AIDecoHasMagazineCount::GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIDecoHasMagazineCount.c:27
SCR_AIDecoHasMagazineCount::GetNodeMiddleText
string GetNodeMiddleText()
Definition
SCR_AIDecoHasMagazineCount.c:84
SCR_AIDecoHasMagazineCount::TestFunction
override bool TestFunction(AIAgent owner)
Definition
SCR_AIDecoHasMagazineCount.c:37
SCR_AIDecoHasMagazineCount::OnInit
override void OnInit(AIAgent owner)
Definition
SCR_AIDecoHasMagazineCount.c:32
UIWidgets
Definition
attributes.c:40
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Inventory
SCR_AIDecoHasMagazineCount.c
Generated by
1.17.0