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_AIEvaluateSuppressionWeapon.c
Go to the documentation of this file.
1
4
class
SCR_AIEvaluateSuppressionWeapon
:
AITaskScripted
5
{
6
// Input ports
7
protected
static
const
string
PORT_DISTANCE
=
"Distance"
;
8
9
// Output ports
10
protected
static
const
string
PORT_WEAPON_COMPONENT
=
"WeaponComponent"
;
11
protected
static
const
string
PORT_MAGAZINE_COMPONENT
=
"MagazineComponent"
;
12
protected
static
const
string
PORT_MUZZLE_ID
=
"MuzzleId"
;
13
14
protected
SCR_AICombatComponent
m_CombatComponent
;
15
16
//--------------------------------------------------------------------------------------------
17
override
void
OnInit
(AIAgent owner)
18
{
19
IEntity
controlledEnt = owner.GetControlledEntity();
20
m_CombatComponent
= SCR_AICombatComponent.Cast(controlledEnt.
FindComponent
(SCR_AICombatComponent));
21
22
if
(!
m_CombatComponent
)
23
{
24
NodeError
(
this
, owner,
"SCR_AIEvaluateExpectedWeapon didn't find necessary components!"
);
25
}
26
}
27
28
//--------------------------------------------------------------------------------------------
29
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
30
{
31
if
(!
m_CombatComponent
)
32
return
ENodeResult
.FAIL;
33
34
float
distanceToTgt = 100.0;
35
GetVariableIn
(
PORT_DISTANCE
, distanceToTgt);
36
37
BaseWeaponComponent
weaponComp;
38
BaseMagazineComponent
magazineComp;
39
int
muzzleId;
40
41
m_CombatComponent
.EvaluateSuppressionWeapon(
EAIUnitType
.UnitType_Infantry, distanceToTgt, weaponComp, muzzleId, magazineComp);
42
43
if
(!weaponComp)
44
return
ENodeResult
.FAIL;
45
46
SetVariableOut
(
PORT_WEAPON_COMPONENT
, weaponComp);
47
SetVariableOut
(
PORT_MAGAZINE_COMPONENT
, magazineComp);
48
SetVariableOut
(
PORT_MUZZLE_ID
, muzzleId);
49
50
return
ENodeResult
.SUCCESS;
51
}
52
53
//--------------------------------------------------------------------------------------------
54
static
override
bool
VisibleInPalette
() {
return
true
; }
55
56
protected
static
ref
TStringArray
s_aVarsOut
= {
57
PORT_WEAPON_COMPONENT
,
58
PORT_MUZZLE_ID
,
59
PORT_MAGAZINE_COMPONENT
60
};
61
override
TStringArray
GetVariablesOut
() {
return
s_aVarsOut
; }
62
63
protected
static
ref
TStringArray
s_aVarsIn
= {
64
PORT_DISTANCE
65
};
66
override
TStringArray
GetVariablesIn
() {
return
s_aVarsIn
; }
67
}
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition
NodeError.c:3
AITaskScripted
Definition
AITaskScripted.c:13
BaseMagazineComponent
Definition
BaseMagazineComponent.c:13
BaseWeaponComponent
Definition
BaseWeaponComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
Node::SetVariableOut
proto void SetVariableOut(string name, void val)
Node::GetVariableIn
proto bool GetVariableIn(string name, out void val)
SCR_AIEvaluateSuppressionWeapon
Definition
SCR_AIEvaluateSuppressionWeapon.c:5
SCR_AIEvaluateSuppressionWeapon::OnInit
override void OnInit(AIAgent owner)
Definition
SCR_AIEvaluateSuppressionWeapon.c:17
SCR_AIEvaluateSuppressionWeapon::PORT_MAGAZINE_COMPONENT
static const string PORT_MAGAZINE_COMPONENT
Definition
SCR_AIEvaluateSuppressionWeapon.c:11
SCR_AIEvaluateSuppressionWeapon::PORT_WEAPON_COMPONENT
static const string PORT_WEAPON_COMPONENT
Definition
SCR_AIEvaluateSuppressionWeapon.c:10
SCR_AIEvaluateSuppressionWeapon::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIEvaluateSuppressionWeapon.c:54
SCR_AIEvaluateSuppressionWeapon::s_aVarsIn
static ref TStringArray s_aVarsIn
Definition
SCR_AIEvaluateSuppressionWeapon.c:63
SCR_AIEvaluateSuppressionWeapon::s_aVarsOut
static ref TStringArray s_aVarsOut
Definition
SCR_AIEvaluateSuppressionWeapon.c:56
SCR_AIEvaluateSuppressionWeapon::PORT_MUZZLE_ID
static const string PORT_MUZZLE_ID
Definition
SCR_AIEvaluateSuppressionWeapon.c:12
SCR_AIEvaluateSuppressionWeapon::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AIEvaluateSuppressionWeapon.c:29
SCR_AIEvaluateSuppressionWeapon::m_CombatComponent
SCR_AICombatComponent m_CombatComponent
Definition
SCR_AIEvaluateSuppressionWeapon.c:14
SCR_AIEvaluateSuppressionWeapon::GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIEvaluateSuppressionWeapon.c:61
SCR_AIEvaluateSuppressionWeapon::GetVariablesIn
override TStringArray GetVariablesIn()
Definition
SCR_AIEvaluateSuppressionWeapon.c:66
SCR_AIEvaluateSuppressionWeapon::PORT_DISTANCE
static const string PORT_DISTANCE
Definition
SCR_AIEvaluateSuppressionWeapon.c:7
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
EAIUnitType
EAIUnitType
Definition
EAIUnitType.c:13
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Weapons
SCR_AIEvaluateSuppressionWeapon.c
Generated by
1.17.0