DayZ 1.24
Loading...
Searching...
No Matches
EffectTrigger.c
Go to the documentation of this file.
1// Base class for "Effect triggers"
2// Registers in TriggerEffectManager and handles parameter setting through cfgEffectArea.json file
4{
5 int m_AroundPartId; // The main particles spawned around player when in trigger
6 int m_TinyPartId; // The smaller particles spawned around player when in trigger
7 int m_PPERequester; // The Post Processing used when player is in trigger
14
16 {
17 RegisterNetSyncVariableInt("m_AroundPartId");
18 RegisterNetSyncVariableInt("m_TinyPartId");
19 RegisterNetSyncVariableInt("m_PPERequester");
20 RegisterNetSyncVariableInt("m_EffectsPriority");
21
24 }
25
26 // ----------------------------------------------
27 // CUSTOM EVENTS
28 // ----------------------------------------------
29
38
40 {
41 return m_EffectArea;
42 }
43
49
51 {
52 return m_EffectsPriority;
53 }
54
56 {
57 return "";
58 }
59
61 {
63 {
64 if (enable)
66 else
67 player.SetContaminatedEffectEx(false, m_PPERequester);
68 }
69 }
70
71
72 // ----------------------------------------------
73 // TRIGGER EVENTS
74 // ----------------------------------------------
75
76 override void EOnFrame(IEntity other, float timeSlice)
77 {
79 }
80
81 override bool CanAddObjectAsInsider(Object object)
82 {
83#ifdef SERVER
85 if (creature)
86 return !creature.ResistContaminatedEffect();
87 else
88 {
89 PlayerBase player = PlayerBase.Cast(object);
90 return player != null;
91 }
92#else
93 PlayerBase player = PlayerBase.Cast(object);
94 return (player && player.IsControlledPlayer());
95#endif
96 }
97
98 override protected void OnStayClientEvent(TriggerInsider insider, float deltaTime)
99 {
100 super.OnStayClientEvent(insider, deltaTime);
101 PlayerBase player = PlayerBase.Cast(insider.GetObject());
102 if (player)
104 }
105
106 override void OnEnterServerEvent(TriggerInsider insider)
107 {
108 super.OnEnterServerEvent(insider);
109
110 // We don't need to test the trigger count as Modifiers handle such cases already
111 if (insider)
112 {
114
115 if (playerInsider)
116
118
119 }
120
121 }
122
123 override void OnEnterClientEvent(TriggerInsider insider)
124 {
125 super.OnEnterClientEvent(insider);
126
127 if (insider)
128 {
130
131 // We will only handle the controlled player, as effects are only relevant to this player instance
132 if (playerInsider && playerInsider.IsControlledPlayer())
133 {
134 //SetupClientEffects(true, playerInsider);
135 // We then handle the update of player trigger state in manager
137 }
138 }
139 }
140
141
142 override void OnLeaveServerEvent(TriggerInsider insider)
143 {
144 super.OnLeaveServerEvent(insider);
145
146 if (insider)
147 {
149
150 if (playerInsider)
152 }
153 }
154
155
156 override void OnLeaveClientEvent(TriggerInsider insider)
157 {
158 super.OnLeaveClientEvent(insider);
159
160 if (insider)
161 {
162 // Make sure you pass the set variable for PPE effect
163 // It will not remove the correct one if START and STOP don't point to the same Requester
165
166 // We will only handle the controlled player, as effects are only relevant to this player instance
167 if (playerInsider && playerInsider.IsControlledPlayer())
168 {
169 // We first handle the update of player trigger state in manager
171 //SetupClientEffects(false, playerInsider);
172 }
173 }
174 }
175
176 // We remove from trigger update DEAD or RESISTANT entities to limit the amount of entities to update
177 override bool ShouldRemoveInsider(TriggerInsider insider)
178 {
179 return !insider.GetObject().IsAlive();
180 }
181
182 // Used to apply the desired effect to all entities present in one trigger of the specified type
183 // NOTE : This is really not optimal, if you want to add new trigger types, you will have to test for them...
184 static void TriggerEffect(EntityAI insider, typename triggerType) {}
185}
Trigger with cylinder shape.
do not process rotations !
Definition DayZAnimal.c:573
float m_TimeAccuStay
void SetLocalEffects(int aroundPartId, int tinyPartId, int ppeRequesterIdx)
EffectArea GetEffectArea()
void EffectTrigger()
static void TriggerEffect(EntityAI insider, typename triggerType)
override void EOnFrame(IEntity other, float timeSlice)
override string GetAmbientSoundsetName()
void Init(EffectArea area, int priority)
override bool CanAddObjectAsInsider(Object object)
int GetEffectsPriority()
override bool ShouldRemoveInsider(TriggerInsider insider)
EffectArea m_EffectArea
void SetupClientEffects(bool enable, notnull PlayerBase player)
string GetAmbientSoundsetName()
override void OnLeaveServerEvent(TriggerInsider insider)
TriggerEffectManager m_Manager
override void OnEnterClientEvent(TriggerInsider insider)
override void OnLeaveClientEvent(TriggerInsider insider)
override void OnEnterServerEvent(TriggerInsider insider)
void OnStayClientEvent(TriggerInsider insider, float deltaTime)
void RegisterTriggerType(EffectTrigger effectTrigger)
bool IsPlayerInTriggerType(notnull PlayerBase player, notnull EffectTrigger trigger)
void OnPlayerExit(notnull PlayerBase player, notnull EffectTrigger trigger)
static TriggerEffectManager GetInstance()
void OnPlayerEnter(notnull PlayerBase player, notnull EffectTrigger trigger)
The object which is in a trigger and its metadata.
Definition Trigger.c:3
Object GetObject()
Definition Trigger.c:28