Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkNotorietyComponent.c
Go to the documentation of this file.
2{
3}
4
5class SCR_ScenarioFrameworkNotorietyComponent : SCR_BaseGameModeComponent
6{
7 [Attribute(desc: "Starting notoriety value", params: "0 inf 0.01")]
8 protected float m_fNotoriety;
9
10 [Attribute(defvalue: "1", desc: "Time between updates", params: "1 inf")]
11 protected float m_fUpdateDelay;
12
13 [Attribute(defvalue: "1", desc: "Base Notoriety Loss with each update", params: "0 inf 0.01")]
14 protected float m_fBaseNotorietyLoss;
15
16 [Attribute(desc: "Alert Levels")]
17 protected ref array<ref SCR_ScenarioFrameworkNotorietyLevel> m_aNotorietyLevels;
18
19 [Attribute(defvalue: "1", desc: "Alert Enabled")]
20 bool m_bAlertEnabled;
21
22 protected SCR_ScenarioFrameworkNotorietyLevel m_CurrentAlertState;
23
24 //------------------------------------------------------------------------------------------------
25 static SCR_ScenarioFrameworkNotorietyComponent GetInstance()
26 {
27 BaseGameMode gamemode = GetGame().GetGameMode();
28 if (!gamemode)
29 return null;
30
31 return SCR_ScenarioFrameworkNotorietyComponent.Cast(gamemode.FindComponent(SCR_ScenarioFrameworkNotorietyComponent));
32 }
33
34 //------------------------------------------------------------------------------------------------
36 {
37 return m_fNotoriety;
38 }
39
40 //------------------------------------------------------------------------------------------------
41 void AddNotoriety(float value)
42 {
43 m_fNotoriety += value;
44 }
45
46 //------------------------------------------------------------------------------------------------
48 {
49 if (!m_bAlertEnabled)
50 {
51 m_CurrentAlertState = null;
52 return;
53 }
54
55 if (!m_aNotorietyLevels)
56 return;
57
58 if (m_CurrentAlertState)
59 m_fNotoriety -= m_fBaseNotorietyLoss * m_CurrentAlertState.m_fDeteriorationMultiplier;
60 else if (m_fNotoriety > 0)
61 m_fNotoriety -= m_fBaseNotorietyLoss;
62
64
65 for (int i, count = m_aNotorietyLevels.Count(); i < count; i++)
66 {
67 if (m_aNotorietyLevels[i] && m_fNotoriety >= m_aNotorietyLevels[i].m_iAlertMeterThreshold)
68 {
69 newAlertState = m_aNotorietyLevels[i];
70 continue;
71 }
72
73 break;
74 }
75
76 if (newAlertState == m_CurrentAlertState)
77 return;
78
79 if ((!newAlertState || (m_CurrentAlertState && newAlertState.m_iAlertMeterThreshold < m_CurrentAlertState.m_iAlertMeterThreshold)) && m_CurrentAlertState.m_aActionsDecrease)
80 {
81 foreach (SCR_ScenarioFrameworkActionBase action : m_CurrentAlertState.m_aActionsDecrease)
82 {
83 action.OnActivate(null);
84 }
85 }
86
87 if (newAlertState && newAlertState.m_aActions)
88 {
89 foreach (SCR_ScenarioFrameworkActionBase action : newAlertState.m_aActions)
90 {
91 action.OnActivate(null);
92 }
93 }
94
95 m_CurrentAlertState = newAlertState;
96 }
97
98 //------------------------------------------------------------------------------------------------
99 array<ref SCR_ScenarioFrameworkActionBase> GetAllStateActions()
100 {
101 array<ref SCR_ScenarioFrameworkActionBase> m_aSubActions = {};
102
103 foreach (SCR_ScenarioFrameworkNotorietyLevel alertState : m_aNotorietyLevels)
104 {
105 if (alertState.m_aActions)
106 {
107 foreach (SCR_ScenarioFrameworkActionBase action : alertState.m_aActions)
108 {
109 m_aSubActions.Insert(action);
110 }
111 }
112
113 if (alertState.m_aActions)
114 {
115 foreach (SCR_ScenarioFrameworkActionBase action : alertState.m_aActionsDecrease)
116 {
117 m_aSubActions.Insert(action);
118 }
119 }
120 }
121
122 return m_aSubActions;
123 }
124
125 //------------------------------------------------------------------------------------------------
126 override protected void OnPostInit(IEntity owner)
127 {
128 if (!GetGame().InPlayMode())
129 return;
130
131 SetEventMask(owner, EntityEvent.INIT);
132 }
133
134 //------------------------------------------------------------------------------------------------
135 override protected void EOnInit(IEntity owner)
136 {
139 }
140}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void AddNotoriety(float value)
array< ref SCR_ScenarioFrameworkActionBase > GetAllStateActions()
static ScriptCallQueue GetCallQueuePausable()
override void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14