5 bool m_EntityIsTakeable;
10 int m_ParticleOneTime;
11 int m_ParticlePersistent;
16 string m_SoundSetOneTime;
17 string m_SoundSetPersistent;
19 bool m_KeepHealthOnReplace;
20 string m_ReplaceWithEntity;
23 bool m_HasExplosionDamage;
45 bool HasExplosionDamage()
50 private void DealExplosionDamage()
55 void OnHealthLevelChanged(notnull
EntityAI entity,
int oldLevel,
int newLevel,
string zone)
62 entity.SetTakeable(m_EntityIsTakeable);
64 if (oldLevel != -1 || entity.m_Initialized)
66 if (m_ReplaceWithEntity)
70 if (HasExplosionDamage())
72 DealExplosionDamage();
74 OnEntityDestroyedOneTimeServer(entity, oldLevel, zone);
76 OnEntityDestroyedPersistentServer(entity, zone);
80 if (oldLevel != -1 || entity.m_Initialized)
82 m_POneTime = PlayParticle(m_ParticleOneTime);
86 m_POneTime.SetOwner(
this);
89 OnEntityDestroyedOneTimeClient(entity, oldLevel, zone);
91 m_Entity.PlaySoundSet(m_SOneTime, m_SoundSetOneTime, 0, 0 );
92 m_Entity.PlaySoundSetLoop(m_SPersistent, m_SoundSetPersistent, 0, 0 );
96 OnEntityDestroyedPersistentClient(entity, zone);
97 m_Entity.PlaySoundSetLoop(m_SPersistent, m_SoundSetPersistent, 0, 0 );
100 m_PPersistent = PlayParticle(m_ParticlePersistent,
true);
104 m_PPersistent.SetOwner(
this);
110 private void ReplaceEntityServer()
113 dead_entity.SetOrientation(
m_Entity.GetOrientation());
114 if (m_KeepHealthOnReplace)
116 dead_entity.SetHealth(
m_Entity.GetHealth());
121 private ParticleSource PlayParticle(
int particleType,
bool attach =
false)
125 ErrorEx(
"Missing entity - something went wrong");
145 void OnEntityDestroyedOneTimeClient(
EntityAI entity,
int oldLevel,
string zone);
148 void OnEntityDestroyedOneTimeServer(
EntityAI entity,
int oldLevel,
string zone);
151 void OnEntityDestroyedPersistentClient(
EntityAI entity,
string zone);
154 void OnEntityDestroyedPersistentServer(
EntityAI entity,
string zone);
157 void OnExplosionEffects(
Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
float energyFactor,
float explosionFactor,
bool isWater,
string ammoType);
Entity which has the particle instance as an ObjectComponent.
override void AddAsChild(Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_to_world=false)
Attaches this particle onto some object. If null value is provided then the particle will be detached...
static override Particle PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)