DayZ 1.24
Loading...
Searching...
No Matches
ModifierBase.c
Go to the documentation of this file.
7
8
9class ModifierBase
10{
11 int m_ID = 0;
12 ModifiersManager m_Manager;//the manager instance
13 string m_System = "Modifiers";
14 float m_ActivatedTime;//overall time this modifier was active
15 bool m_TrackActivatedTime;//should this modifier track overall time it was active ?
16 bool m_IsPersistent;//is this modifier saved to the DB ?
25 int m_TickType = (eModifiersTickType.TICK | eModifiersTickType.ACTIVATE_CHECK | eModifiersTickType.DEACTIVATE_CHECK);//some modifiers do not need to check activate condition, as they get activated by request
27 bool m_IsLocked = false;
29 eModifierSyncIDs m_SyncID;//max 32 synced modifiers supported, 0 == no sync
30 PluginPlayerStatus m_ModulePlayerStatus;
31
33 {
34 Class.CastTo(m_ModulePlayerStatus, GetPlugin(PluginPlayerStatus));
35 }
36
43
44 void Init() {}
45
46
48 {
49 return m_Player;
50 }
51
53 {
54 return m_IsPersistent;
55 }
56
58 {
59 m_Manager.m_ParamList.Insert(object);
60 }
61
62
64 {
66 }
67
68 string GetDebugText()
69 {
70 return "";
71 }
72
74 {
75 return "";
76 }
77
79 {
80 m_TickType = (m_TickType & ~eModifiersTickType.ACTIVATE_CHECK);
81 }
82
84 {
85 m_TickType = (m_TickType & ~eModifiersTickType.DEACTIVATE_CHECK);
86 }
87
88 void Tick(float delta_time)
89 {
90
92 Activate();
93
94 if (m_IsActive)
95 {
98 {
99 if (m_TickType & eModifiersTickType.DEACTIVATE_CHECK && DeactivateCondition(m_Player) && !IsLocked())
100 Deactivate();
101 else//if(m_TickType & eModifiersTickType.TICK)
102 {
105 }
107 }
108 }
109 else if (m_TickType & eModifiersTickType.ACTIVATE_CHECK)
110 {
113 {
115 {
116 if (!IsLocked())
117 ActivateRequest(EActivationType.TRIGGER_EVENT_ON_ACTIVATION);
118 }
120 }
121 }
122 }
123
124 bool IsActive()
125 {
126 return m_IsActive;
127 }
128
129 void SetLock(bool state)
130 {
132 }
133
134 bool IsLocked()
135 {
136 return m_IsLocked;
137 }
138
140 {
142 }
143
145 {
146 return m_ActivatedTime;
147 }
148
150 {
152 }
153
155 {
156 return m_ID;
157 }
158
159 string GetName()
160 {
161 string name = ClassName();
162 int index_start = name.Length() - 4;
163 int index_end = name.Length();
164 name = name.SubstringInverted(name, index_start, index_end);
165 return name;
166 }
167
169 {
170 return false;
171 }
172
174 {
175 return false;
176 }
177
180 {
181
182 }
183
186 {
187
188 }
189
191 {
192
193 }
194
195 void Activate()
196 {
197 m_IsActive = true;
198 m_Player.m_SyncedModifiers = (m_Player.m_SyncedModifiers | m_SyncID);
199 if (m_ActivationType == EActivationType.TRIGGER_EVENT_ON_ACTIVATION) OnActivate(m_Player);
200 else if (m_ActivationType == EActivationType.TRIGGER_EVENT_ON_CONNECT) OnReconnect(m_Player);
201 m_Player.SetSynchDirty();
202 }
203
209
210 void Deactivate(bool trigger = true)
211 {
212 if (!m_IsActive)
213 return;
214 m_Player.m_SyncedModifiers = (m_Player.m_SyncedModifiers & ~m_SyncID);
215 m_ShouldBeActive = false;
216 m_IsActive = false;
217 m_ActivatedTime = 0;
218 if (trigger)
220 }
221
222
226
227
228 private void OnTick(PlayerBase player, float deltaT)
229 {
230
231 }
232}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
DayZPlayer m_Player
Definition Hand_Events.c:42
bool m_TrackActivatedTime
void DisableDeactivateCheck()
void SetAttachedTime(float time)
void ModifierBase()
ModifiersManager m_Manager
float m_AccumulatedTimeInactive
void InitBase(PlayerBase player, ModifiersManager manager)
float m_AccumulatedTimeActive
void SetLock(bool state)
bool IsTrackAttachedTime()
eModifiersTickType
Definition ModifierBase.c:2
@ ACTIVATE_CHECK
Definition ModifierBase.c:4
@ TICK
Definition ModifierBase.c:3
@ DEACTIVATE_CHECK
Definition ModifierBase.c:5
float GetAttachedTime()
bool m_ShouldBeActive
void DisableActivateCheck()
bool m_IsLocked
void ResetLastTickTime()
float m_ActivatedTime
float m_LastTickedActive
bool m_IsActive
float m_LastTickedInactive
bool IsLocked()
int m_TickType
eModifierSyncIDs m_SyncID
float m_TickIntervalActive
float m_TickIntervalInactive
PlayerBase GetPlayer()
void ActivateRequest(EActivationType trigger)
EActivationType m_ActivationType
string m_System
int GetModifierID()
bool IsActive()
void Deactivate(bool trigger=true)
void OnStoreSave(ParamsWriteContext ctx)
void MakeParamObjectPersistent(Param object)
bool IsPersistent()
bool m_IsPersistent
void Activate()
PluginPlayerStatus m_ModulePlayerStatus
eModifierSyncIDs
EActivationType
void ModifiersManager(PlayerBase player)
PluginBase GetPlugin(typename plugin_type)
void Tick()
Super root of all classes in Enforce script.
Definition EnScript.c:11
override void OnReconnect(PlayerBase player)
override bool DeactivateCondition(PlayerBase player)
override string GetDebugText()
override string GetDebugTextSimple()
override void Init()
override bool ActivateCondition(PlayerBase player)
override void OnTick(PlayerBase player, float deltaT)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native owned string GetName()
void OnDeactivate()
called when command ends
Definition human.c:1170
class HumanMovementState OnActivate()
HumanCommandScript fully scriptable command.
Definition human.c:1167