Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIGetCombatComponentWeaponProperties.c
Go to the documentation of this file.
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
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 {
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
48
49 return ENodeResult.SUCCESS;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 static override bool VisibleInPalette()
54 {
55 return true;
56 }
57
63
64 //------------------------------------------------------------------------------------------------
66 {
67 return s_aVarsOut;
68 }
69}
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
proto external Managed FindComponent(typename typeName)
proto void SetVariableOut(string name, void val)
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
ENodeResult
Definition ENodeResult.c:13
array< string > TStringArray
Definition Types.c:385