DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ExplosivesBase.c
См. документацию.
2{
3 protected static float m_DefaultBrightness = 10;
4 protected static float m_DefaultRadius = 30;
5
7 {
8 SetVisibleDuringDaylight(false);
9 SetRadiusTo(m_DefaultRadius);
10 SetBrightnessTo(m_DefaultBrightness);
11 SetFlareVisible(false);
12 SetAmbientColor(1.0, 1.0, 0.3);
13 SetDiffuseColor(1.0, 1.0, 0.3);
14 SetLifetime(0.15);
15 SetDisableShadowsWithinRadius(-1);
16 }
17}
18
20{
21 protected const string DEFAULT_AMMO_TYPE = "Explosion_NonLethal";
22 protected const string ANIM_PHASE_VISIBILITY = "Visibility";
23
24 protected bool m_Armed;
25 protected bool m_Defused;
27
28 protected ref Timer m_DeleteTimer;
29
32
36 protected int m_ParticleExplosionId;
39
41
43 {
44 m_DeleteTimer = new Timer();
46
49 SetParticlePosition(WorldToModel(GetPosition()));
51
52 RegisterNetSyncVariableBool("m_Armed");
53 RegisterNetSyncVariableBool("m_Defused");
54
55 Init();
56 }
57
58
59 override bool IsExplosive()
60 {
61 return true;
62 }
63
64 override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
65 {
66 super.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
67
69 {
70 EntityAI parent = this;
71 if (GetHierarchyParent())
72 {
73 parent = GetHierarchyParent();
74 }
75
76 //SEffectManager.CreateParticleServer(pos, new TreeEffecterParameters("TreeEffecter", 1.0, 10 * explosionFactor));
77 int particleID = GetParticleExplosionID(surface);
78
79 ParticleSource p = ParticleManager.GetInstance().PlayOnObject(particleID, parent, m_ParticlePosition, m_ParticleOrientation);
80 m_ParticleExplosionArr.Insert(p);
82 }
83
85 }
86
87 override void EEDelete(EntityAI parent)
88 {
89 super.EEDelete(parent);
90
92 {
94 {
96 }
97 }
98 }
99
100 override void EEKilled(Object killer)
101 {
102 super.EEKilled(killer);
103
106
107 UnpairRemote();
108 }
109
110 override void OnCEUpdate()
111 {
112 super.OnCEUpdate();
113
114 if (!IsRuined() && GetArmed() && GetPairDevice())
115 {
117 {
119
120 return;
121 }
122 }
123
125 }
126
127 override void UnpairRemote()
128 {
130 {
131 if (GetPairDevice())
132 {
133 GetPairDevice().UnpairRemote();
134 }
136 }
137
138 }
139
140 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
141 {
142 super.OnPlacementComplete(player, position, orientation);
143
144 if (GetGame().IsServer())
145 {
146 SetOrientation(orientation);
147 SetPosition(position);
148 PlaceOnSurface();
149 }
150 }
151
153 {
154 return string.Empty;
155 }
156
158 {
159 return string.Empty;
160 }
161
162 override void InitItemSounds()
163 {
164 super.InitItemSounds();
165
167
168 if (GetArmSoundset() != string.Empty)
169 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_ARM, GetArmSoundset());
170
171 if (GetDisarmSoundset() != string.Empty)
172 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_DISARM, GetDisarmSoundset());
173 }
174
175 protected void CreateLight()
176 {
178 }
179
180 protected void DestroyParticle(Particle p)
181 {
182 #ifndef SERVER
183 if (p != null)
184 {
185 p.Stop();
186 }
187 #endif
188 }
189
190 protected void InitiateExplosion()
191 {
192 int count = m_AmmoTypes.Count();
193 for (int i = 0; i < count; i++)
194 {
195 Explode(DamageType.EXPLOSION, m_AmmoTypes[i]);
196 }
197
198 OnExplode();
199 }
200
201 protected void OnExplode()
202 {
203 if (GetGame().IsServer())
204 {
205 m_DeleteTimer.Run(0.25, this, "DeleteSafe");
206 }
207 }
208
209 override void SetActions()
210 {
211 super.SetActions();
212
215 }
216
217 override bool IsInventoryVisible()
218 {
219 if (!super.IsInventoryVisible())
220 {
221 return false;
222 }
223
224 return GetAnimationPhase("Visibility") == 0;
225 }
226
227 override bool IsTakeable()
228 {
229 return super.IsTakeable() && GetAnimationPhase("Visibility") == 0;
230 }
231
233 {
234 return false;
235 }
236
237 void Arm()
238 {
239 SetArmed(true);
240
241 OnArmed();
242 }
243
244 void OnArmed();
245
247 {
248 return true;
249 }
250
251 void Disarm(bool pWithTool = false)
252 {
253 SetArmed(false);
254
255 OnDisarmed(pWithTool);
256 }
257
259 void OnDisarmed(bool pWithTool);
260
262 {
263 return false;
264 }
265
266 bool GetArmed()
267 {
268 return m_Armed;
269 }
270
271 protected void SetArmed(bool state)
272 {
273 m_Armed = state;
274 SetSynchDirty();
275 }
276
277 override bool CanPutInCargo(EntityAI parent)
278 {
279 if (!super.CanPutInCargo(parent))
280 {
281 return false;
282 }
283
284 return IsTakeable();
285 }
286
287 override bool CanPutIntoHands(EntityAI parent)
288 {
289 if (!super.CanPutIntoHands(parent))
290 {
291 return false;
292 }
293
294 return IsTakeable();
295 }
296
297 override bool CanRemoveFromHands(EntityAI parent)
298 {
299 return IsTakeable();
300 }
301
303 {
304 return m_Defused;
305 }
306
307 protected void SetDefused(bool state)
308 {
309 m_Defused = state;
310 SetSynchDirty();
311 }
312
313 void SetAmmoType(string pAmmoType)
314 {
315 SetAmmoTypes({pAmmoType});
316 }
317
319 {
320 m_AmmoTypes.Clear();
321 m_AmmoTypes = pAmmoTypes;
322 }
323
324 void SetParticleExplosion(int particle)
325 {
326 m_ParticleExplosionId = particle;
327 }
328
331 {
332 m_ParticlePosition = local_pos;
333
334 if (GetHierarchyParent())
335 {
336 m_ParticlePosition = GetHierarchyParent().WorldToModel(GetPosition());
337 }
338 }
339
341 {
342 m_ParticleOrientation = local_ori;
343
344 if (GetHierarchyParent())
345 {
346 m_ParticleOrientation = GetHierarchyParent().WorldToModel(GetOrientation());
347 }
348 }
349
351 {
352 super.OnStoreSave(ctx);
353
354 ctx.Write(m_Armed);
355 }
356
357 override bool OnStoreLoad(ParamsReadContext ctx, int version)
358 {
359 if (!super.OnStoreLoad(ctx, version))
360 return false;
361
362 if (version > 129)
363 {
364 bool armed = false;
365 if (!ctx.Read(armed))
366 {
367 return false;
368 }
369
370 SetArmed(armed);
371 }
372
373 return true;
374 }
375
377 void UpdateLED(int pState);
379 {
380 return false;
381 }
382
385
388
389 void Init()
390 {
391 #ifndef SERVER
393 {
395 }
396
398 {
399 map<string, int> extraSurfaceeffect = new map<string, int>();
400 m_TypeToSurfaceParticleIDMap.Insert(GetName(), extraSurfaceeffect);
402 }
403 #endif
404 }
405
406 static void Cleanup()
407 {
409 {
411 }
412 }
413
415 {
416 //Here add in override call AddExplosionEffectForSurface for specific explosion on surface
417 }
418
419 void AddExplosionEffectForSurface(string surface, int effectID)
420 {
421 map<string, int> extraSurfaceeffect;
422 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceeffect);
423 extraSurfaceeffect.Insert(surface, effectID);
424 }
425
426 int GetParticleExplosionID(string surface)
427 {
428 map<string, int> extraSurfaceeffect;
429 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceeffect);
430
431 int particleID;
432 if (extraSurfaceeffect.Find(surface, particleID))
433 return particleID;
435 }
436}
AttachActionData ActionData ActionAttach()
Определения ActionAttach.c:9
void ActionDetach()
Определения ActionDetach.c:10
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
class PASBroadcaster extends AdvancedCommunication IsInventoryVisible
Определения AdvancedCommunication.c:135
void SetActions()
Определения AdvancedCommunication.c:213
vector GetOrientation()
Определения AreaDamageManager.c:306
void Disarm()
Определения ClockBase.c:199
override void EEDelete(EntityAI parent)
Определения ContaminatedArea.c:57
map
Определения ControlsXboxNew.c:4
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
override Widget Init()
Определения DayZGame.c:127
override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
Определения DestructionEffects.c:208
void UnlockExplosivesSlots()
string GetDisarmSoundset()
Определения ExplosivesBase.c:157
ExplosiveLight DEFAULT_AMMO_TYPE
void OnExplode()
Определения ExplosivesBase.c:201
bool IsTimerDetonable()
Определения ExplosivesBase.c:232
override void OnCEUpdate()
Определения ExplosivesBase.c:110
void AddExplosionEffectForSurface(string surface, int effectID)
Определения ExplosivesBase.c:419
void SetArmed(bool state)
Определения ExplosivesBase.c:271
void InitiateExplosion()
Определения ExplosivesBase.c:190
void OnBeforeDisarm()
void InitSpecificsExplosionEffectForSurface()
Определения ExplosivesBase.c:414
void DestroyParticle(Particle p)
Определения ExplosivesBase.c:180
ref array< string > m_AmmoTypes
Определения ExplosivesBase.c:26
override void EEKilled(Object killer)
Определения ExplosivesBase.c:100
override bool CanPutInCargo(EntityAI parent)
Определения ExplosivesBase.c:277
ref Timer m_DeleteTimer
Определения ExplosivesBase.c:28
Particle m_ParticleExplosion
particle
Определения ExplosivesBase.c:34
void SetDefused(bool state)
Определения ExplosivesBase.c:307
bool GetArmed()
Определения ExplosivesBase.c:266
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения ExplosivesBase.c:140
void SetAmmoTypes(array< string > pAmmoTypes)
Определения ExplosivesBase.c:318
override bool IsExplosive()
Определения ExplosivesBase.c:59
void SetParticleExplosion(int particle)
Определения ExplosivesBase.c:324
ref map< string, ref map< string, int > > m_TypeToSurfaceParticleIDMap
Определения ExplosivesBase.c:40
void SetParticlePosition(vector local_pos)
set position for smoke particle - needs to be in Local Space
Определения ExplosivesBase.c:330
void UnlockTriggerSlots()
bool GetDefused()
Определения ExplosivesBase.c:302
void OnDisarmed(bool pWithTool)
void LockExplosivesSlots()
bool m_Defused
Определения ExplosivesBase.c:25
bool m_Armed
Определения ExplosivesBase.c:24
void CreateLight()
Определения ExplosivesBase.c:175
override bool CanPutIntoHands(EntityAI parent)
Определения ExplosivesBase.c:287
ref array< ParticleSource > m_ParticleExplosionArr
Определения ExplosivesBase.c:35
const string ANIM_PHASE_VISIBILITY
Определения ExplosivesBase.c:22
override void UnpairRemote()
Определения ExplosivesBase.c:127
string GetArmSoundset()
Определения ExplosivesBase.c:152
void OnArmed()
override bool IsTakeable()
Определения ExplosivesBase.c:227
void Arm()
Определения ExplosivesBase.c:237
int m_ParticleExplosionId
Определения ExplosivesBase.c:36
vector m_ParticleOrientation
Определения ExplosivesBase.c:38
void SetAmmoType(string pAmmoType)
Определения ExplosivesBase.c:313
bool CanBeDisarmed()
Определения ExplosivesBase.c:261
bool HasLockedTriggerSlots()
Определения ExplosivesBase.c:378
void SetParticleOrientation(vector local_ori)
Определения ExplosivesBase.c:340
override bool CanRemoveFromHands(EntityAI parent)
Определения ExplosivesBase.c:297
void ExplosivesBase()
Определения ExplosivesBase.c:42
void LockTriggerSlots()
override void InitItemSounds()
Определения ExplosivesBase.c:162
bool CanBeArmed()
Определения ExplosivesBase.c:246
vector m_ParticlePosition
Определения ExplosivesBase.c:37
int GetParticleExplosionID(string surface)
Определения ExplosivesBase.c:426
Empty
Определения Hand_States.c:14
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
class Land_Buoy extends House m_Light
void UpdateLED(string selection, string color)
Определения Land_Underground_Panel.c:331
void OnStoreSave(ParamsWriteContext ctx)
Определения ModifiersManager.c:229
bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения ModifiersManager.c:265
void Cleanup()
Определения PPEManager.c:70
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
ERemoteDetonatorLEDState
Определения RemoteDetonator.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
Определения Building.c:6
static float m_DefaultBrightness
Определения ExplosivesBase.c:3
void ExplosiveLight()
Определения ExplosivesBase.c:6
static float m_DefaultRadius
Определения ExplosivesBase.c:4
Определения ExplosivesBase.c:2
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения ObjectTyped.c:2
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
Legacy way of using particles in the game.
Определения Particle.c:7
static const int INVALID
Определения ParticleList.c:20
Определения ParticleList.c:12
Entity which has the particle instance as an ObjectComponent.
Определения ParticleSource.c:124
proto bool Write(void value_out)
proto bool Read(void value_in)
Определения DayZPlayerImplement.c:63
const float EXPLOSIVE_REMOTE_ACTIVATION
Определения ActionConstants.c:118
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
proto native void SetPosition(vector position)
Set the world position of the Effect.
Определения Effect.c:438
static proto float SqrFloat(float f)
Returns squared value.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static const string Empty
Определения EnString.c:7
proto native owned string GetName()
Test name getter. Strictly for UI porposes!
Определения SyncedValue.c:119