Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionOnUserActionEvent.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Target entity that has the UserAction on it (Optional if action is attached on Slot that spawns target entity)")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(desc: "ID corresponding to the action attached on ActionsManagerComponent on target entity")]
8 int m_iActionID;
9
10 [Attribute(desc: "Only listen to changes when UserAction is activated by specific Entity (Optional - leave it empty to trigger by anyone)")]
11 ref SCR_ScenarioFrameworkGet m_GetterUser;
12
13 [Attribute(defvalue: EUserActionEvent.PerformAction.ToString(), UIWidgets.ComboBox, "On which user action event this ScenarioFramework action will be triggered", "", ParamEnumArray.FromEnum(EUserActionEvent))]
14 EUserActionEvent m_eUserActionEvent;
15
16 [Attribute(desc: "Which actions will be executed once user action is used")]
17 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
18
19 IEntity m_ActionHolder;
20 ref array<IEntity> m_aUserEntities;
21
22 //------------------------------------------------------------------------------------------------
23 void OnInvoked(IEntity user, ScriptedUserAction action, EUserActionEvent e)
24 {
25 if (e != m_eUserActionEvent)
26 return;
27
28 if (m_aUserEntities && !m_aUserEntities.IsEmpty() && !m_aUserEntities.Contains(user))
29 return;
30
31 foreach (SCR_ScenarioFrameworkActionBase actions : m_aActions)
32 {
33 actions.OnActivate(m_Entity);
34 }
35
36 BaseActionsManagerComponent actionsManager = action.GetActionsManager();
37 if (actionsManager)
38 actionsManager.RemoveUserActionEventListener(action, OnInvoked);
39 }
40
41 //------------------------------------------------------------------------------------------------
42 override void OnActivate(IEntity object)
43 {
44 if (!CanActivate())
45 return;
46
47 IEntity entity;
48 if (!ValidateInputEntity(object, m_Getter, entity))
49 return;
50
52 if (!actionsManager)
53 return;
54
55 BaseUserAction userAction = actionsManager.FindAction(m_iActionID);
56 if (!userAction)
57 return;
58
59 ScriptedUserAction scriptedUserAction = ScriptedUserAction.Cast(userAction);
60 if (!scriptedUserAction)
61 return;
62
63 if (m_GetterUser)
64 {
65 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_GetterUser.Get());
66 if (entityWrapper)
67 {
68 m_aUserEntities = {};
69 entity = entityWrapper.GetValue();
70 if (entity)
71 m_aUserEntities.Insert(entity);
72 }
73 else
74 {
75 SCR_ScenarioFrameworkParam<array<IEntity>> arrayOfEntitiesWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_GetterUser.Get());
76 if (arrayOfEntitiesWrapper)
77 {
78 m_aUserEntities = {};
79 m_aUserEntities.InsertAll(arrayOfEntitiesWrapper.GetValue());
80 }
81 }
82 }
83
84 m_ActionHolder = entity;
85 actionsManager.AddUserActionEventListener(scriptedUserAction, OnInvoked);
86 }
87
88 //------------------------------------------------------------------------------------------------
89 override array<ref SCR_ScenarioFrameworkActionBase> GetSubActions()
90 {
91 return m_aActions;
92 }
93}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external ActionsManagerComponent GetActionsManager()
proto external Managed FindComponent(typename typeName)
SCR_FieldOfViewSettings Attribute
EUserActionEvent