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_AIGetCombatComponentWeaponProperties.c
Go to the documentation of this file.
1
class
SCR_AIGetCombatComponentWeaponProperties
:
AITaskScripted
2
{
3
// Output ports
4
protected
static
const
string
PORT_MIN_DISTANCE
=
"MinDistance"
;
5
protected
static
const
string
PORT_MAX_DISTANCE
=
"MaxDistance"
;
6
protected
static
const
string
PORT_DIRECT_DAMAGE
=
"IsDirectDamage"
;
7
8
protected
SCR_AICombatComponent
m_CombatComponent
;
9
10
//------------------------------------------------------------------------------------------------
11
override
void
OnInit
(AIAgent owner)
12
{
13
IEntity
controlledEnt = owner.GetControlledEntity();
14
m_CombatComponent
= SCR_AICombatComponent.Cast(controlledEnt.
FindComponent
(SCR_AICombatComponent));
15
16
if
(!
m_CombatComponent
)
17
{
18
NodeError
(
this
, owner,
"SCR_AIGetCombatComponentWeaponProperties didn't find necessary components!"
);
19
}
20
}
21
22
//------------------------------------------------------------------------------------------------
23
/*
24
It's not very nice that we are moving weapon properties data all the way through weapon selection, combat component, and then this node.
25
Ideally we should be able to get all this from weapon, muzzle and magazine directly.
26
But ATM this is not possible, therefore it's done this way so that the values are consistent with what weapon selector is using
27
to evaluate weapons and targets.
28
*/
29
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
30
{
31
if
(!
m_CombatComponent
)
32
return
ENodeResult
.FAIL;
33
34
BaseWeaponComponent
weaponComp;
35
BaseMagazineComponent
magazineComp;
36
int
muzzleId;
37
38
m_CombatComponent
.GetSelectedWeaponAndMagazine(weaponComp, muzzleId, magazineComp);
39
40
float
minDistance;
41
float
maxDistance;
42
bool
directDamage;
43
m_CombatComponent
.GetSelectedWeaponProperties(minDistance, maxDistance, directDamage);
44
45
SetVariableOut
(
PORT_DIRECT_DAMAGE
, directDamage);
46
SetVariableOut
(
PORT_MIN_DISTANCE
, minDistance);
47
SetVariableOut
(
PORT_MAX_DISTANCE
, maxDistance);
48
49
return
ENodeResult
.SUCCESS;
50
}
51
52
//------------------------------------------------------------------------------------------------
53
static
override
bool
VisibleInPalette
()
54
{
55
return
true
;
56
}
57
58
protected
static
ref
TStringArray
s_aVarsOut
= {
59
PORT_MIN_DISTANCE
,
60
PORT_MAX_DISTANCE
,
61
PORT_DIRECT_DAMAGE
62
};
63
64
//------------------------------------------------------------------------------------------------
65
override
TStringArray
GetVariablesOut
()
66
{
67
return
s_aVarsOut
;
68
}
69
}
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)
SCR_AIGetCombatComponentWeaponProperties
Definition
SCR_AIGetCombatComponentWeaponProperties.c:2
SCR_AIGetCombatComponentWeaponProperties::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIGetCombatComponentWeaponProperties.c:53
SCR_AIGetCombatComponentWeaponProperties::GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIGetCombatComponentWeaponProperties.c:65
SCR_AIGetCombatComponentWeaponProperties::m_CombatComponent
SCR_AICombatComponent m_CombatComponent
Definition
SCR_AIGetCombatComponentWeaponProperties.c:8
SCR_AIGetCombatComponentWeaponProperties::OnInit
override void OnInit(AIAgent owner)
Definition
SCR_AIGetCombatComponentWeaponProperties.c:11
SCR_AIGetCombatComponentWeaponProperties::PORT_MIN_DISTANCE
static const string PORT_MIN_DISTANCE
Definition
SCR_AIGetCombatComponentWeaponProperties.c:4
SCR_AIGetCombatComponentWeaponProperties::PORT_MAX_DISTANCE
static const string PORT_MAX_DISTANCE
Definition
SCR_AIGetCombatComponentWeaponProperties.c:5
SCR_AIGetCombatComponentWeaponProperties::PORT_DIRECT_DAMAGE
static const string PORT_DIRECT_DAMAGE
Definition
SCR_AIGetCombatComponentWeaponProperties.c:6
SCR_AIGetCombatComponentWeaponProperties::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AIGetCombatComponentWeaponProperties.c:29
SCR_AIGetCombatComponentWeaponProperties::s_aVarsOut
static ref TStringArray s_aVarsOut
Definition
SCR_AIGetCombatComponentWeaponProperties.c:58
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Weapons
SCR_AIGetCombatComponentWeaponProperties.c
Generated by
1.17.0