Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionEventOnProjectileShot.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "Entity to watch for firing.")]
5 ref SCR_ScenarioFrameworkGet m_Getter;
6
7 [Attribute(defvalue: SCR_EScenarioFrameworkLogicOperators.AND.ToString(), UIWidgets.ComboBox, "Which Boolean Logic will be used for Activation Conditions", "", enums: SCR_EScenarioFrameworkLogicOperatorHelper.GetParamInfo(), category: "Activation")]
8 SCR_EScenarioFrameworkLogicOperators m_eActivationConditionLogic;
9
10 [Attribute(desc: "Conditions to evaluate on projectile fired")]
11 ref array<ref SCR_ScenarioFrameworkOnProjectileShotConditionBase> m_aProjectileConditions;
12
13 [Attribute(desc: "Actions to be executed if conditions' evaluation is successful.")]
14 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
15
16 protected CharacterWeaponManagerComponent characterWeaponManager;
17
18 //------------------------------------------------------------------------------------------------
19 override void OnActivate(IEntity object)
20 {
21 if (!CanActivate())
22 return;
23
24 IEntity entity;
25 if (!ValidateInputEntity(object, m_Getter, entity))
26 return;
27
28 EventHandlerManagerComponent eventHandler = EventHandlerManagerComponent.Cast(entity.FindComponent(EventHandlerManagerComponent));
29 if (!eventHandler)
30 return;
31
32 eventHandler.RegisterScriptHandler("OnProjectileShot", entity, OnWeaponFired);
33 }
34
35 //------------------------------------------------------------------------------------------------
36 protected void OnWeaponFired(int playerID, BaseWeaponComponent weapon, IEntity entity)
37 {
38 if (!EvaluateConditions(playerID, weapon, entity))
39 return;
40
41 foreach (SCR_ScenarioFrameworkActionBase actions : m_aActions)
42 {
43 actions.OnActivate(entity);
44 }
45 }
46
47 //------------------------------------------------------------------------------------------------
48 bool EvaluateConditions(int playerID, BaseWeaponComponent weapon, IEntity entity)
49 {
50 switch (m_eActivationConditionLogic)
51 {
53 return EvaluateConditionsAND(playerID, weapon, entity);
54
56 return EvaluateConditionsOR(playerID, weapon, entity);
57
59 return EvaluateConditionsNAND(playerID, weapon, entity);
60
62 return EvaluateConditionsXOR(playerID, weapon, entity);
63 }
64
65 return false;
66 }
67
68 //------------------------------------------------------------------------------------------------
69 bool EvaluateConditionsAND(int playerID, BaseWeaponComponent weapon, IEntity entity)
70 {
71 if (m_aProjectileConditions.IsEmpty())
72 return true;
73
74 foreach (SCR_ScenarioFrameworkOnProjectileShotConditionBase action : m_aProjectileConditions)
75 {
76 if (!action.Init(playerID, weapon, entity))
77 return false;
78 }
79
80 return true;
81 }
82
83 //------------------------------------------------------------------------------------------------
84 bool EvaluateConditionsOR(int playerID, BaseWeaponComponent weapon, IEntity entity)
85 {
86 foreach (SCR_ScenarioFrameworkOnProjectileShotConditionBase action : m_aProjectileConditions)
87 {
88 if (action.Init(playerID, weapon, entity))
89 return true;
90 }
91
92 return false;
93 }
94
95 //------------------------------------------------------------------------------------------------
96 bool EvaluateConditionsNAND(int playerID, BaseWeaponComponent weapon, IEntity entity)
97 {
98 return !EvaluateConditionsAND(playerID, weapon, entity);
99 }
100
101 //------------------------------------------------------------------------------------------------
102 bool EvaluateConditionsXOR(int playerID, BaseWeaponComponent weapon, IEntity entity)
103 {
104 bool priorSuccess = false;
105 foreach (SCR_ScenarioFrameworkOnProjectileShotConditionBase action : m_aProjectileConditions)
106 {
107 bool success = action.Init(playerID, weapon, entity);
108 if (priorSuccess && success)
109 return false;
110
111 priorSuccess |= success;
112 }
113 return priorSuccess;
114 }
115
116 //------------------------------------------------------------------------------------------------
117 override array<ref SCR_ScenarioFrameworkActionBase> GetSubActions()
118 {
119 return m_aActions;
120 }
121}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
void OnWeaponFired(int playerID, BaseWeaponComponent weapon, IEntity entity)
override array< ref SCR_ScenarioFrameworkActionBase > GetSubActions()
bool EvaluateConditionsOR(int playerID, BaseWeaponComponent weapon, IEntity entity)
bool EvaluateConditions(int playerID, BaseWeaponComponent weapon, IEntity entity)
bool EvaluateConditionsNAND(int playerID, BaseWeaponComponent weapon, IEntity entity)
bool EvaluateConditionsXOR(int playerID, BaseWeaponComponent weapon, IEntity entity)
bool EvaluateConditionsAND(int playerID, BaseWeaponComponent weapon, IEntity entity)
SCR_FieldOfViewSettings Attribute