Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AISetGroupFromation.c
Go to the documentation of this file.
2{
3 protected AIGroupMovementComponent m_MovementComponent;
5 protected SCR_AIGroupSettingsComponent m_SettingsComponent;
6
7
8 [Attribute(SCR_EAIGroupFormation.Wedge.ToString(), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_EAIGroupFormation))]
9 protected SCR_EAIGroupFormation m_eFormation;
10
11 //---------------------------------------------------------------------------------
12 override void OnInit(AIAgent owner)
13 {
14 m_MovementComponent = AIGroupMovementComponent.Cast(owner.FindComponent(AIGroupMovementComponent));
16 m_SettingsComponent = SCR_AIGroupSettingsComponent.Cast(owner.FindComponent(SCR_AIGroupSettingsComponent));
17 }
18
19 //---------------------------------------------------------------------------------
20 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
21 {
22 // Bail if it totally makes no sense
24 return ENodeResult.FAIL;
25
26 SCR_EAIGroupFormation formation = m_eFormation;
27
28 // Check if formation is set via settings
29 SCR_AIGroupFormationSettingBase formationSetting;
32
33 // Set formation in formation component
35 {
36 SCR_EAIGroupFormation formationForFormComponent = formation;
37
38 // Override from settings?
39 if (formationSetting)
40 formationForFormComponent = formationSetting.GetFormation(0, formation);
41
42 string formationName = typename.EnumToString(SCR_EAIGroupFormation, formationForFormComponent);
43 m_FormationComponent.SetFormation(formationName);
44 }
45
46 // Set formation for all move handlers in movement component
48 {
49 int handlerId = 0;
50 while (m_MovementComponent.GetMoveHandlerAgentCount(handlerId) != -1)
51 {
52 SCR_EAIGroupFormation formationForMoveHandler = formation;
53
54 // Override from settings?
55 if (formationSetting)
56 formationForMoveHandler = formationSetting.GetFormation(handlerId, formation);
57
58 string formationName = typename.EnumToString(SCR_EAIGroupFormation, formationForMoveHandler);
59 m_MovementComponent.SetFormationDefinition(handlerId, formationName);
60 handlerId++;
61 }
62 }
63
64 return ENodeResult.SUCCESS;
65 }
66
67 //---------------------------------------------------------------------------------
68 override static bool VisibleInPalette() { return true; }
69
70 //---------------------------------------------------------------------------------
71 override static string GetOnHoverDescription() { return "Sets formation of group. Also checks formation in settings component."; }
72}
static override string GetOnHoverDescription()
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
SCR_AIGroupSettingsComponent m_SettingsComponent
SCR_EAIGroupFormation m_eFormation
override void OnInit(AIAgent owner)
AIFormationComponent m_FormationComponent
static override bool VisibleInPalette()
AIGroupMovementComponent m_MovementComponent
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute