DayZ 1.24
Loading...
Searching...
No Matches
DestructionEffectBase.c
Go to the documentation of this file.
2{
4
6
9
12
15
18
22
25 string m_AmmoType;
26
27
38
39 private void Init();
40
42 {
44 }
45
46 private void DealExplosionDamage()
47 {
48 DamageSystem.ExplosionDamage(m_Entity, null, m_AmmoType, m_Entity.GetPosition(), m_DamageType);
49 }
50
52 {
54 Init();
55
56 if (GetGame().IsServer())
57 {
58 entity.SetTakeable(m_EntityIsTakeable);
59
60 if (oldLevel != -1 || entity.m_Initialized)
61 {
63 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ReplaceEntityServer, m_ReplaceDelay, false);
67 }
69 }
70#ifndef SERVER//client OR single
71 {
72 if (oldLevel != -1 || entity.m_Initialized)//one time
73 {
75
76 if (m_POneTime)
77 m_POneTime.SetOwner(this);
78
80
81 m_Entity.PlaySoundSet(m_SOneTime, m_SoundSetOneTime, 0, 0);
82 m_Entity.PlaySoundSetLoop(m_SPersistent, m_SoundSetPersistent, 0, 0);
83 }
84 else//Persistent
85 {
87 m_Entity.PlaySoundSetLoop(m_SPersistent, m_SoundSetPersistent, 0, 0);
88 }
89
91
92 if (m_PPersistent)
94 }
95#endif
96 }
97
98 private void ReplaceEntityServer()
99 {
101 dead_entity.SetOrientation(m_Entity.GetOrientation());
103 dead_entity.SetHealth(m_Entity.GetHealth());
104 m_Entity.Delete();
105 }
106
108 {
109 if (!m_Entity)
110 {
111 ErrorEx("Missing entity - something went wrong");
112 return null;
113 }
114 if (particleType)
115 {
116 ParticleSource p = ParticleManager.GetInstance().PlayInWorld(particleType, m_Entity.GetPosition());
117 if (attach && p)
118 {
119 p.AddAsChild(m_Entity);//Note: it's also possible to directly play on object: Particle.PlayOnObject
120 }
121 return p;
122 }
123 return null;
124 }
125
126 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
127 // !!!!!!!!!! Override methods bellow !!!!!!!!!!!!!
128 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
129
130 // ! Client Event called the moment the entity is destroyed, best for explosion and other one-time effects
132
133 // ! Server Event called the moment the entity is destroyed
135
136 // ! Client Event called at the same moment as the one-time event, but also when the entity is loaded/spawned on client, typically as the player connects to the server or moves close enough so that previously non-existent client entity is now spawned in
138
139 // ! Server Event called at the same moment as the one time event, but also when the entity is loaded/spawned on Server, typically as the server is starting up
141
142 // !Relayed from entity when explosion happens
144
145}
146
const int ECE_OBJECT_SWAP
const int RF_ORIGINAL
DamageType
exposed from C++ (do not change)
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
void OnHealthLevelChanged(notnull EntityAI entity, int oldLevel, int newLevel, string zone)
void OnEntityDestroyedPersistentClient(EntityAI entity, string zone)
ParticleSource PlayParticle(int particleType, bool attach=false)
void OnEntityDestroyedOneTimeServer(EntityAI entity, int oldLevel, string zone)
void OnEntityDestroyedOneTimeClient(EntityAI entity, int oldLevel, string zone)
void OnEntityDestroyedPersistentServer(EntityAI entity, string zone)
void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:262
Entity which has the particle instance as an ObjectComponent.
proto native void SetOwner(Class owner)
Set the owner of this ParticleSource.
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
proto native CGame GetGame()
enum ShapeType ErrorEx
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8