DayZ 1.29
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 (g_Game.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
163 {
164 return string.Empty;
165 }
166
167 override void InitItemSounds()
168 {
169 super.InitItemSounds();
170
172
173 if (GetArmSoundset() != string.Empty)
174 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_ARM, GetArmSoundset());
175
176 if (GetDisarmSoundset() != string.Empty)
177 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_DISARM, GetDisarmSoundset());
178
179 if (GetDisarmSoundsetUnpaired() != string.Empty)
180 handler.AddSound(SoundConstants.ITEM_EXPLOSIVE_DISARM_UNPAIRED, GetDisarmSoundsetUnpaired());
181 }
182
183 protected void CreateLight()
184 {
186 }
187
188 protected void DestroyParticle(Particle p)
189 {
190 #ifndef SERVER
191 if (p != null)
192 {
193 p.Stop();
194 }
195 #endif
196 }
197
198 protected void InitiateExplosion()
199 {
200 int count = m_AmmoTypes.Count();
201 for (int i = 0; i < count; i++)
202 {
203 Explode(DamageType.EXPLOSION, m_AmmoTypes[i]);
204 }
205
206 OnExplode();
207 }
208
209 protected void OnExplode()
210 {
211 if (g_Game.IsServer())
212 {
213 m_DeleteTimer.Run(0.25, this, "DeleteSafe");
214 }
215 }
216
217 override void SetActions()
218 {
219 super.SetActions();
220
223 }
224
225 override bool IsInventoryVisible()
226 {
227 if (!super.IsInventoryVisible())
228 {
229 return false;
230 }
231
232 return GetAnimationPhase("Visibility") == 0;
233 }
234
235 override bool IsTakeable()
236 {
237 return super.IsTakeable() && GetAnimationPhase("Visibility") == 0;
238 }
239
241 {
242 return false;
243 }
244
245 void Arm()
246 {
247 SetArmed(true);
248
249 OnArmed();
250 }
251
252 void OnArmed();
253
255 {
256 return true;
257 }
258
259 void Disarm(bool pWithTool = false)
260 {
261 SetArmed(false);
262
263 OnDisarmed(pWithTool);
264 }
265
267 void OnDisarmed(bool pWithTool);
268
270 {
271 return false;
272 }
273
274 bool GetArmed()
275 {
276 return m_Armed;
277 }
278
279 protected void SetArmed(bool state)
280 {
281 m_Armed = state;
282 SetSynchDirty();
283 }
284
285 override bool CanPutInCargo(EntityAI parent)
286 {
287 if (!super.CanPutInCargo(parent))
288 {
289 return false;
290 }
291
292 return IsTakeable();
293 }
294
295 override bool CanPutIntoHands(EntityAI parent)
296 {
297 if (!super.CanPutIntoHands(parent))
298 {
299 return false;
300 }
301
302 return IsTakeable();
303 }
304
305 override bool CanRemoveFromHands(EntityAI parent)
306 {
307 return IsTakeable();
308 }
309
311 {
312 return m_Defused;
313 }
314
315 protected void SetDefused(bool state)
316 {
317 m_Defused = state;
318 SetSynchDirty();
319 }
320
321 void SetAmmoType(string pAmmoType)
322 {
323 SetAmmoTypes({pAmmoType});
324 }
325
327 {
328 m_AmmoTypes.Clear();
329 m_AmmoTypes = pAmmoTypes;
330 }
331
332 void SetParticleExplosion(int particle)
333 {
334 m_ParticleExplosionId = particle;
335 }
336
339 {
340 m_ParticlePosition = local_pos;
341
342 if (GetHierarchyParent())
343 {
344 m_ParticlePosition = GetHierarchyParent().WorldToModel(GetPosition());
345 }
346 }
347
349 {
350 m_ParticleOrientation = local_ori;
351
352 if (GetHierarchyParent())
353 {
354 m_ParticleOrientation = GetHierarchyParent().WorldToModel(GetOrientation());
355 }
356 }
357
359 {
360 super.OnStoreSave(ctx);
361
362 ctx.Write(m_Armed);
363 }
364
365 override bool OnStoreLoad(ParamsReadContext ctx, int version)
366 {
367 if (!super.OnStoreLoad(ctx, version))
368 return false;
369
370 if (version > 129)
371 {
372 bool armed = false;
373 if (!ctx.Read(armed))
374 {
375 return false;
376 }
377
378 SetArmed(armed);
379 }
380
381 return true;
382 }
383
385 void UpdateLED(int pState);
387 {
388 return false;
389 }
390
393
396
397 void Init()
398 {
399 #ifndef SERVER
401 {
403 }
404
406 {
407 map<string, int> extraSurfaceeffect = new map<string, int>();
408 m_TypeToSurfaceParticleIDMap.Insert(GetName(), extraSurfaceeffect);
410 }
411 #endif
412 }
413
414 static void Cleanup()
415 {
417 {
419 }
420 }
421
423 {
424 //Here add in override call AddExplosionEffectForSurface for specific explosion on surface
425 }
426
427 void AddExplosionEffectForSurface(string surface, int effectID)
428 {
429 map<string, int> extraSurfaceeffect;
430 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceeffect);
431 extraSurfaceeffect.Insert(surface, effectID);
432 }
433
434 int GetParticleExplosionID(string surface)
435 {
436 map<string, int> extraSurfaceeffect;
437 m_TypeToSurfaceParticleIDMap.Find(GetName(), extraSurfaceeffect);
438
439 int particleID;
440 if (extraSurfaceeffect.Find(surface, particleID))
441 return particleID;
443 }
444}
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:61
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3942
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:209
bool IsTimerDetonable()
Определения ExplosivesBase.c:240
override void OnCEUpdate()
Определения ExplosivesBase.c:110
void AddExplosionEffectForSurface(string surface, int effectID)
Определения ExplosivesBase.c:427
void SetArmed(bool state)
Определения ExplosivesBase.c:279
void InitiateExplosion()
Определения ExplosivesBase.c:198
void OnBeforeDisarm()
void InitSpecificsExplosionEffectForSurface()
Определения ExplosivesBase.c:422
void DestroyParticle(Particle p)
Определения ExplosivesBase.c:188
ref array< string > m_AmmoTypes
Определения ExplosivesBase.c:26
override void EEKilled(Object killer)
Определения ExplosivesBase.c:100
override bool CanPutInCargo(EntityAI parent)
Определения ExplosivesBase.c:285
ref Timer m_DeleteTimer
Определения ExplosivesBase.c:28
Particle m_ParticleExplosion
particle
Определения ExplosivesBase.c:34
void SetDefused(bool state)
Определения ExplosivesBase.c:315
bool GetArmed()
Определения ExplosivesBase.c:274
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:326
override bool IsExplosive()
Определения ExplosivesBase.c:59
void SetParticleExplosion(int particle)
Определения ExplosivesBase.c:332
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:338
void UnlockTriggerSlots()
bool GetDefused()
Определения ExplosivesBase.c:310
void OnDisarmed(bool pWithTool)
void LockExplosivesSlots()
bool m_Defused
Определения ExplosivesBase.c:25
bool m_Armed
Определения ExplosivesBase.c:24
void CreateLight()
Определения ExplosivesBase.c:183
override bool CanPutIntoHands(EntityAI parent)
Определения ExplosivesBase.c:295
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:235
void Arm()
Определения ExplosivesBase.c:245
int m_ParticleExplosionId
Определения ExplosivesBase.c:36
vector m_ParticleOrientation
Определения ExplosivesBase.c:38
void SetAmmoType(string pAmmoType)
Определения ExplosivesBase.c:321
bool CanBeDisarmed()
Определения ExplosivesBase.c:269
bool HasLockedTriggerSlots()
Определения ExplosivesBase.c:386
string GetDisarmSoundsetUnpaired()
Определения ExplosivesBase.c:162
void SetParticleOrientation(vector local_ori)
Определения ExplosivesBase.c:348
override bool CanRemoveFromHands(EntityAI parent)
Определения ExplosivesBase.c:305
void ExplosivesBase()
Определения ExplosivesBase.c:42
void LockTriggerSlots()
override void InitItemSounds()
Определения ExplosivesBase.c:167
bool CanBeArmed()
Определения ExplosivesBase.c:254
vector m_ParticlePosition
Определения ExplosivesBase.c:37
int GetParticleExplosionID(string surface)
Определения ExplosivesBase.c:434
Empty
Определения Hand_States.c:14
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9329
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
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
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:39
const float EXPLOSIVE_REMOTE_ACTIVATION
Определения ActionConstants.c:118
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения CachedEquipmentStorage.c:4
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
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
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