DayZ 1.30
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
40 [Obsolete("1.30: Handled in AmmoTypes instead")]
42 [Obsolete("1.30: Handled in AmmoTypes instead")]
44
46 {
47 m_DeleteTimer = new Timer();
49
51 SetParticlePosition(WorldToModel(GetPosition()));
53
54 RegisterNetSyncVariableBool("m_Armed");
55 RegisterNetSyncVariableBool("m_Defused");
56
57 Init();
58 }
59
60
61 override bool IsExplosive()
62 {
63 return true;
64 }
65
66 override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
67 {
68 super.OnExplosionEffects(source, directHit, componentIndex, surface, pos, surfNormal, energyFactor, explosionFactor, isWater, ammoType);
70 }
71
72 override void EEKilled(Object killer)
73 {
74 super.EEKilled(killer);
75
78
79 UnpairRemote();
80 }
81
82 override void OnCEIterate(float currentTime, float elapsedTime)
83 {
84 super.OnCEIterate(currentTime, elapsedTime);
85
86 if (!IsRuined() && GetArmed() && GetPairDevice())
87 {
89 {
91
92 return;
93 }
94 }
95
97 }
98
99 override void UnpairRemote()
100 {
102 {
103 if (GetPairDevice())
104 {
105 GetPairDevice().UnpairRemote();
106 }
108 }
109
110 }
111
112 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
113 {
114 super.OnPlacementComplete(player, position, orientation);
115
116 if (g_Game.IsServer())
117 {
118 SetOrientation(orientation);
120 PlaceOnSurface();
121 }
122 }
123
125 {
126 return string.Empty;
127 }
128
130 {
131 return string.Empty;
132 }
133
135 {
136 return string.Empty;
137 }
138
139 override void InitItemSounds()
140 {
141 super.InitItemSounds();
142
144
145 if (GetArmSoundset() != string.Empty)
146 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_ARM, GetArmSoundset());
147
148 if (GetDisarmSoundset() != string.Empty)
149 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_DISARM, GetDisarmSoundset());
150
151 if (GetDisarmSoundsetUnpaired() != string.Empty)
152 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_DISARM_UNPAIRED, GetDisarmSoundsetUnpaired());
153 }
154
155 protected void CreateLight()
156 {
158 }
159
160 protected void DestroyParticle(Particle p)
161 {
162 #ifndef SERVER
163 #ifndef NO_GUI
164 if (p != null)
165 {
166 p.Stop();
167 }
168 #endif
169 #endif
170 }
171
172 protected void InitiateExplosion()
173 {
174 int count = m_AmmoTypes.Count();
175 for (int i = 0; i < count; i++)
176 {
177 Explode(DamageType.EXPLOSION, m_AmmoTypes[i]);
178 }
179
180 OnExplode();
181 }
182
183 protected void OnExplode()
184 {
185 if (g_Game.IsServer())
186 {
187 m_DeleteTimer.Run(0.25, this, "DeleteSafe");
188 }
189 }
190
191 override void SetActions()
192 {
193 super.SetActions();
194
197 }
198
199 override bool IsInventoryVisible()
200 {
201 if (!super.IsInventoryVisible())
202 {
203 return false;
204 }
205
206 return GetAnimationPhase("Visibility") == 0;
207 }
208
209 override bool IsTakeable()
210 {
211 return super.IsTakeable() && GetAnimationPhase("Visibility") == 0;
212 }
213
215 {
216 return false;
217 }
218
219 void Arm()
220 {
221 SetArmed(true);
222
223 OnArmed();
224 }
225
226 void OnArmed();
227
229 {
230 return true;
231 }
232
233 void Disarm(bool pWithTool = false)
234 {
235 SetArmed(false);
236
237 OnDisarmed(pWithTool);
238 }
239
241 void OnDisarmed(bool pWithTool);
242
244 {
245 return false;
246 }
247
248 bool GetArmed()
249 {
250 return m_Armed;
251 }
252
253 protected void SetArmed(bool state)
254 {
255 m_Armed = state;
256 SetSynchDirty();
257 }
258
259 override bool CanPutInCargo(EntityAI parent)
260 {
261 if (!super.CanPutInCargo(parent))
262 {
263 return false;
264 }
265
266 return IsTakeable();
267 }
268
269 override bool CanPutIntoHands(EntityAI parent)
270 {
271 if (!super.CanPutIntoHands(parent))
272 {
273 return false;
274 }
275
276 return IsTakeable();
277 }
278
279 override bool CanRemoveFromHands(EntityAI parent)
280 {
281 return IsTakeable();
282 }
283
285 {
286 return m_Defused;
287 }
288
289 protected void SetDefused(bool state)
290 {
291 m_Defused = state;
292 SetSynchDirty();
293 }
294
295 void SetAmmoType(string pAmmoType)
296 {
297 SetAmmoTypes({pAmmoType});
298 }
299
301 {
302 m_AmmoTypes.Clear();
303 m_AmmoTypes = pAmmoTypes;
304 }
305
306 [Obsolete("1.30: Handled in AmmoTypes instead")]
307 void SetParticleExplosion(int particle)
308 {
309 m_ParticleExplosionId = particle;
310 }
311
314 {
315 m_ParticlePosition = local_pos;
316
317 if (GetHierarchyParent())
318 {
319 m_ParticlePosition = GetHierarchyParent().WorldToModel(GetPosition());
320 }
321 }
322
324 {
325 m_ParticleOrientation = local_ori;
326
327 if (GetHierarchyParent())
328 {
329 m_ParticleOrientation = GetHierarchyParent().WorldToModel(GetOrientation());
330 }
331 }
332
334 {
335 super.OnStoreSave(ctx);
336
337 ctx.Write(m_Armed);
338 }
339
340 override bool OnStoreLoad(ParamsReadContext ctx, int version)
341 {
342 if (!super.OnStoreLoad(ctx, version))
343 return false;
344
345 if (version > 129)
346 {
347 bool armed = false;
348 if (!ctx.Read(armed))
349 {
350 return false;
351 }
352
353 SetArmed(armed);
354 }
355
356 return true;
357 }
358
360 void UpdateLED(int pState);
362 {
363 return false;
364 }
365
368
371
372 void Init()
373 {
374 }
375
376 static void Cleanup()
377 {
378 }
379
380 [Obsolete("1.30: Handled in AmmoTypes instead")]
382 {
383 //Here add in override call AddExplosionEffectForSurface for specific explosion on surface
384 }
385
386 [Obsolete("1.30: Handled in AmmoTypes instead")]
388 {
389 ExplosionEffectsData explosionEffectData;
390 if (!m_SurfaceToExplosionEffectsData.Find(data.m_Surface, explosionEffectData))
392 }
393
394 [Obsolete("1.30: Handled in AmmoTypes instead")]
395 int GetParticleExplosionID(string surface)
396 {
397 int particleID;
398
399 // kept for backward compatibility - looked up first
400 map<string, int> extraSurfaceEffect;
401 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceEffect);
402
403 if (extraSurfaceEffect)
404 {
405 if (extraSurfaceEffect.Find(surface, particleID))
406 return particleID;
407 }
408
409 ExplosionEffectsData explosionEffectData;
410 if (m_SurfaceToExplosionEffectsData.Find(surface, explosionEffectData))
411 {
412 if (explosionEffectData)
413 return explosionEffectData.m_ParticleId;
414 }
415
417 }
418
419 [Obsolete("1.30: Handled in AmmoTypes instead")]
420 string GetExplosionSoundSetName(string surface)
421 {
422 ExplosionEffectsData explosionEffectData;
423 if (m_SurfaceToExplosionEffectsData.Find(surface, explosionEffectData))
424 {
425 if (explosionEffectData)
426 return explosionEffectData.m_SoundSetName;
427 }
428
429 return "";
430 }
431
432 [Obsolete("1.30: Handled in AmmoTypes instead")]
433 void AddExplosionEffectForSurface(string surface, int effectID)
434 {
435 map<string, int> extraSurfaceEffect;
436 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceEffect);
437 extraSurfaceEffect.Insert(surface, effectID);
438 }
439}
440
441//[Obsolete("1.30: Handled in AmmoTypes instead")]
443{
444 string m_Surface;
447
448 void ExplosionEffectsData(string surface, int particleId, string soundSetName = "")
449 {
450 m_Surface = surface;
451 m_ParticleId = particleId;
452 m_SoundSetName = soundSetName;
453 }
454}
override void InitItemSounds()
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
static void Cleanup()
Определения AmmoTypes.c:134
class ExplosiveEffectData m_TypeToSurfaceParticleIDMap
vector GetOrientation()
Определения AreaDamageManager.c:306
void Disarm()
Определения ClockBase.c:199
bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения CodeLockComponent.c:264
void OnStoreSave(ParamsWriteContext ctx)
Определения CodeLockComponent.c:257
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:4074
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
string ammoType
Определения DustKickupEffects.c:24
vector position
Определения DustKickupEffects.c:20
vector orientation
Определения DustKickupEffects.c:21
void UnlockExplosivesSlots()
string GetDisarmSoundset()
Определения ExplosivesBase.c:129
ExplosiveLight DEFAULT_AMMO_TYPE
void OnExplode()
Определения ExplosivesBase.c:183
override void OnCEIterate(float currentTime, float elapsedTime)
Определения ExplosivesBase.c:82
bool IsTimerDetonable()
Определения ExplosivesBase.c:214
void SetArmed(bool state)
Определения ExplosivesBase.c:253
void InitiateExplosion()
Определения ExplosivesBase.c:172
void OnBeforeDisarm()
void InitSpecificsExplosionEffectForSurface()
Определения ExplosivesBase.c:381
void DestroyParticle(Particle p)
Определения ExplosivesBase.c:160
ref array< string > m_AmmoTypes
Определения ExplosivesBase.c:26
override void EEKilled(Object killer)
Определения ExplosivesBase.c:72
override bool CanPutInCargo(EntityAI parent)
Определения ExplosivesBase.c:259
ref Timer m_DeleteTimer
Определения ExplosivesBase.c:28
Particle m_ParticleExplosion
particle
Определения ExplosivesBase.c:34
void SetDefused(bool state)
Определения ExplosivesBase.c:289
bool GetArmed()
Определения ExplosivesBase.c:248
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения ExplosivesBase.c:112
void SetAmmoTypes(array< string > pAmmoTypes)
Определения ExplosivesBase.c:300
override bool IsExplosive()
Определения ExplosivesBase.c:61
void SetParticleExplosion(int particle)
Определения ExplosivesBase.c:307
void SetParticlePosition(vector local_pos)
set position for smoke particle - needs to be in Local Space
Определения ExplosivesBase.c:313
void UnlockTriggerSlots()
bool GetDefused()
Определения ExplosivesBase.c:284
void OnDisarmed(bool pWithTool)
ref map< string, ref ExplosionEffectsData > m_SurfaceToExplosionEffectsData
Определения ExplosivesBase.c:43
void LockExplosivesSlots()
bool m_Defused
Определения ExplosivesBase.c:25
bool m_Armed
Определения ExplosivesBase.c:24
void CreateLight()
Определения ExplosivesBase.c:155
override bool CanPutIntoHands(EntityAI parent)
Определения ExplosivesBase.c:269
ref array< ParticleSource > m_ParticleExplosionArr
Определения ExplosivesBase.c:35
const string ANIM_PHASE_VISIBILITY
Определения ExplosivesBase.c:22
override void UnpairRemote()
Определения ExplosivesBase.c:99
string GetArmSoundset()
Определения ExplosivesBase.c:124
string GetExplosionSoundSetName(string surface)
Определения ExplosivesBase.c:420
void OnArmed()
override bool IsTakeable()
Определения ExplosivesBase.c:209
void Arm()
Определения ExplosivesBase.c:219
int m_ParticleExplosionId
Определения ExplosivesBase.c:36
vector m_ParticleOrientation
Определения ExplosivesBase.c:38
void SetAmmoType(string pAmmoType)
Определения ExplosivesBase.c:295
bool CanBeDisarmed()
Определения ExplosivesBase.c:243
bool HasLockedTriggerSlots()
Определения ExplosivesBase.c:361
string GetDisarmSoundsetUnpaired()
Определения ExplosivesBase.c:134
void SetParticleOrientation(vector local_ori)
Определения ExplosivesBase.c:323
void AddExplosionEffectForSurface(ExplosionEffectsData data)
Определения ExplosivesBase.c:387
override bool CanRemoveFromHands(EntityAI parent)
Определения ExplosivesBase.c:279
void ExplosivesBase()
Определения ExplosivesBase.c:45
void LockTriggerSlots()
bool CanBeArmed()
Определения ExplosivesBase.c:228
vector m_ParticlePosition
Определения ExplosivesBase.c:37
int GetParticleExplosionID(string surface)
Определения ExplosivesBase.c:395
Empty
Определения Hand_States.c:14
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:4407
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
class Land_Buoy extends House m_Light
void UpdateLED(string selection, string color)
Определения Land_Underground_Panel.c:333
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
ERemoteDetonatorLEDState
Определения RemoteDetonator.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
string m_Surface
Определения ExplosivesBase.c:444
void ExplosionEffectsData(string surface, int particleId, string soundSetName="")
Определения ExplosivesBase.c:448
string m_SoundSetName
Определения ExplosivesBase.c:446
int m_ParticleId
Определения ExplosivesBase.c:445
static float m_DefaultBrightness
Определения ExplosivesBase.c:3
void ExplosiveLight()
Определения ExplosivesBase.c:6
static float m_DefaultRadius
Определения ExplosivesBase.c:4
Определения ExplosivesBase.c:2
Определения 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
proto bool Write(void value_out)
proto bool Read(void value_in)
Определения DayZPlayerImplement.c:39
const float EXPLOSIVE_REMOTE_ACTIVATION
Определения ActionConstants.c:121
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
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:123
Определения EnConvert.c:119
Keffiyeh_LightBlue SetActions
Определения consumables.c:149
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
proto native void SetPosition(vector position)
Set the world position of the Effect.
Определения Effect.c:463
void Obsolete(string msg="")
Определения EnScript.c:371
static proto float SqrFloat(float f)
Returns squared value.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
static const string Empty
Определения EnString.c:7
proto native owned string GetName()
Test name getter. Strictly for UI porposes!
Определения SyncedValue.c:119