Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionAI.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Target SlotAI for AI Action - if left empty, it will attempt to retrieve it from the Slot it is attached to. Additionally you can use Get Array Of LayerBases and this action will be executed on all of them.")];
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(desc: "AI actions that will be executed on target AI")];
8 ref array<ref SCR_ScenarioFrameworkAIAction> m_aAIActions;
9
10 //------------------------------------------------------------------------------------------------
11 override void OnActivate(IEntity object)
12 {
13 if (!CanActivate())
14 return;
15
16 if (!m_Getter)
17 {
18 ProcessEntity(object, object);
19 }
20 else
21 {
22 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
23 if (!entityWrapper)
24 {
25 SCR_ScenarioFrameworkParam<array<IEntity>> entityArrayWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
26 if (!entityArrayWrapper)
27 {
28 Print(string.Format("ScenarioFramework Action: Issue with Getter detected for Action %1.", this), LogLevel.ERROR);
29 return;
30 }
31
32 array<IEntity> entities = {};
33 entities = entityArrayWrapper.GetValue();
34
35 if (entities.IsEmpty())
36 {
37 Print(string.Format("ScenarioFramework Action: Array Getter for %1 has no elements to work with.", this), LogLevel.ERROR);
38 return;
39 }
40
41 foreach (IEntity entity : entities)
42 {
43 ProcessEntity(object, entity);
44 }
45
46 return;
47 }
48
49 IEntity entity = entityWrapper.GetValue();
50 if (!entity)
51 {
52 Print(string.Format("ScenarioFramework Action: Entity not found for Action %1.", this), LogLevel.ERROR);
53 return;
54 }
55
56 ProcessEntity(object, entity);
57 }
58 }
59
60 //------------------------------------------------------------------------------------------------
61 void ProcessEntity(IEntity object, IEntity entity)
62 {
63 if (!entity)
64 {
65 Print(string.Format("ScenarioFramework Action: Entity not found for Action %1.", this), LogLevel.ERROR);
66 return;
67 }
68
70 SCR_ScenarioFrameworkSlotTaskAI slotTaskAI = SCR_ScenarioFrameworkSlotTaskAI.Cast(entity.FindComponent(SCR_ScenarioFrameworkSlotTaskAI));
71 if (!slotAI && !slotTaskAI)
72 {
73 Print(string.Format("ScenarioFramework Action: SlotAI not found for Action %1.", this), LogLevel.ERROR);
74 return;
75 }
76
77 SCR_AIGroup targetAIGroup;
78 if (slotAI)
79 targetAIGroup = slotAI.m_AIGroup;
80 else if (slotTaskAI)
81 targetAIGroup = slotTaskAI.m_AIGroup;
82
83 if (!targetAIGroup)
84 {
85 Print(string.Format("ScenarioFramework Action: AI Group not found for Action %1.", this), LogLevel.ERROR);
86 return;
87 }
88
89 foreach (SCR_ScenarioFrameworkAIAction AIAction : m_aAIActions)
90 {
91 AIAction.Init(targetAIGroup, object);
92 }
93 }
94
95 //------------------------------------------------------------------------------------------------
96 array<ref SCR_ScenarioFrameworkAIAction> GetSubActionsAI()
97 {
98 return m_aAIActions;
99 }
100}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute