Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIGroupSetMovementSpeed.c
Go to the documentation of this file.
1
4{
5 // Inputs
6 protected static const string SPEED_PORT = "Speed";
7
8 protected AIGroupMovementComponent m_MovementComponent;
9 protected SCR_AIGroupSettingsComponent m_SettingsComp;
10
11 [Attribute(EMovementType.IDLE.ToString(), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EMovementType))]
13
14 //------------------------------------------------------------------------------------------------
15 override void OnInit(AIAgent owner)
16 {
17 super.OnInit(owner);
18
19 m_SettingsComp = SCR_AIGroupSettingsComponent.Cast(owner.FindComponent(SCR_AIGroupSettingsComponent));
20 m_MovementComponent = AIGroupMovementComponent.Cast(owner.FindComponent(AIGroupMovementComponent));
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
25 {
27 return ENodeResult.FAIL;
28
29 EMovementType speed;
30
31 if(!GetVariableIn(SPEED_PORT, speed))
32 speed = m_eSpeed;
33
34 // Check if speed is restricted by settings
38
39 if (setting)
40 speed = setting.GetSpeed(speed);
41
42 m_MovementComponent.SetGroupCharactersWantedMovementType(speed);
43
44 return ENodeResult.SUCCESS;
45 }
46
47 //------------------------------------------------------------------------------------------------
48 static override bool VisibleInPalette() {return true;}
49
50 //------------------------------------------------------------------------------------------------
51 protected static ref TStringArray s_aVarsIn = {
53 };
54 override array<string> GetVariablesIn()
55 {
56 return s_aVarsIn;
57 }
58
59 //------------------------------------------------------------------------------------------------
60 override string GetNodeMiddleText()
61 {
62 string s;
63 s = s + string.Format("Speed: %1\n", typename.EnumToString(EMovementType, m_eSpeed));
64 return s;
65 }
66
67 //------------------------------------------------------------------------------------------------
68 override static string GetOnHoverDescription()
69 {
70 return "Sets movement speed of character. Also checks restrictions from settings.";
71 }
72};
proto bool GetVariableIn(string name, out void val)
static override string GetOnHoverDescription()
SCR_AIGroupSettingsComponent m_SettingsComp
override array< string > GetVariablesIn()
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
AIGroupMovementComponent m_MovementComponent
override void OnInit(AIAgent owner)
ENodeResult
Definition ENodeResult.c:13
EMovementType
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385