DayZ 1.24
Loading...
Searching...
No Matches
SmokeGrenadeBase.c File Reference

Go to the source code of this file.

Enumerations

enum  ESmokeGrenadeState { NO_SMOKE , LOOP = 2 , END = 3 , COUNT = 4 }
 

Functions

void SetParticleSmokeCurrent (int particle)
 
void SetParticleSmokeStart (int particle)
 
void SetParticleSmokeLoop (int particle)
 
void SetParticleSmokeEnd (int particle)
 
void SetSoundSmokeStart (string sound)
 
void SetSoundSmokeLoop (string sound)
 
void SetSoundSmokeEnd (string sound)
 
void PlaySmokeParticle ()
 
void SoundSmokeStart ()
 
void SoundSmokeLoop ()
 
void SoundSmokeEnd ()
 
void SoundSmokeStop ()
 
void DestroySmokeGrenade ()
 
void RefreshParticlesAndSounds ()
 
override void Unpin ()
 
override void OnActivateFinished ()
 
override void OnWorkStart ()
 
override void OnWork (float consumed_energy)
 
override void OnWorkStop ()
 
override bool CanPutInCargo (EntityAI parent)
 
override void OnActivatedByItem (notnull ItemBase item)
 Called when this item is activated by other.
 
override void SetActions ()
 
override void OnVariablesSynchronized ()
 
override void OnExplosionEffects (Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
 
ESmokeGrenadeState GetSmokeGrenadeState ()
 
override void EEDelete (EntityAI parent)
 
void SetSmokeGrenadeState (ESmokeGrenadeState state)
 
void SmokeGrenadeBase ()
 
void ~SmokeGrenadeBase ()
 

Variables

enum ESmokeGrenadeState m_TimerSmokeStart
 
ref Timer m_TimerSmokeLoop
 
ref Timer m_TimerSmokeEnd
 
ref Timer m_TimerDefer
 
ESmokeGrenadeState m_SmokeGrenadeState
 
ESmokeGrenadeState m_LastSmokeGrenadeState
 
Particle m_ParticleSmoke
 particle
 
int m_ParticleSmokeCurrentId
 
int m_ParticleSmokeStartId
 
int m_ParticleSmokeLoopId
 
int m_ParticleSmokeEndId
 
vector m_ParticleSmokePosition
 
EffectSound m_SoundSmoke
 sounds
 
string m_SoundSmokeStartId
 
string m_SoundSmokeLoopId
 
string m_SoundSmokeEndId
 
ref NoiseParams m_NoisePar
 Noise.
 

Enumeration Type Documentation

◆ ESmokeGrenadeState

Enumerator
NO_SMOKE 
LOOP 
END 
COUNT 

Definition at line 1 of file SmokeGrenadeBase.c.

2{
3 NO_SMOKE = 0
4 START = 1,
5 LOOP = 2,
6 END = 3,
8 COUNT = 4
9}
@ COUNT
@ NO_SMOKE
@ LOOP
@ END

Function Documentation

◆ CanPutInCargo()

override bool CanPutInCargo ( EntityAI parent)
protected

Definition at line 208 of file SmokeGrenadeBase.c.

209 {
210 return !GetCompEM().IsWorking();
211 }

◆ DestroySmokeGrenade()

void DestroySmokeGrenade ( )
protected

Definition at line 100 of file SmokeGrenadeBase.c.

101 {
103
104 if (GetGame().IsServer())
105 SetHealth("", "", 0);
106 }
void SetSmokeGrenadeState(ESmokeGrenadeState state)
ESmokeGrenadeState
proto native CGame GetGame()

References GetGame(), and SetSmokeGrenadeState().

◆ EEDelete()

override void EEDelete ( EntityAI parent)
protected

Definition at line 239 of file SmokeGrenadeBase.c.

240 {
241 super.EEDelete(parent);
242
245 }
void DestroyParticle(Particle p)
void SoundSmokeStop()
Particle m_ParticleSmoke
particle

References DestroyParticle(), m_ParticleSmoke, and SoundSmokeStop().

◆ GetSmokeGrenadeState()

ESmokeGrenadeState GetSmokeGrenadeState ( )
protected

Definition at line 234 of file SmokeGrenadeBase.c.

235 {
236 return m_SmokeGrenadeState;
237 }
ESmokeGrenadeState m_SmokeGrenadeState

References m_SmokeGrenadeState.

Referenced by RefreshParticlesAndSounds().

◆ OnActivatedByItem()

override void OnActivatedByItem ( notnull ItemBase item)
protected

Called when this item is activated by other.

Definition at line 213 of file SmokeGrenadeBase.c.

214 {
215 GetCompEM().SwitchOn();
216 }

◆ OnActivateFinished()

override void OnActivateFinished ( )
protected

Definition at line 164 of file SmokeGrenadeBase.c.

165 {
166 if (GetCompEM() && GetCompEM().CanWork())
167 GetCompEM().SwitchOn();
168 }

◆ OnExplosionEffects()

override void OnExplosionEffects ( Object source,
Object directHit,
int componentIndex,
string surface,
vector pos,
vector surfNormal,
float energyFactor,
float explosionFactor,
bool isWater,
string ammoType )
protected

Definition at line 232 of file SmokeGrenadeBase.c.

232{}

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
protected

Definition at line 225 of file SmokeGrenadeBase.c.

226 {
227 super.OnVariablesSynchronized();
228
230 }
void RefreshParticlesAndSounds()

References RefreshParticlesAndSounds().

◆ OnWork()

override void OnWork ( float consumed_energy)
protected

Definition at line 189 of file SmokeGrenadeBase.c.

190 {
191 if (GetGame().IsServer())
192 {
193 NoiseSystem noise = GetGame().GetNoiseSystem();
194 if (noise)
195 noise.AddNoisePos(this, GetPosition(), m_NoisePar);
196 }
197 }
ref NoiseParams m_NoisePar
Noise.
class JsonUndergroundAreaTriggerData GetPosition

References GetGame(), GetPosition, and m_NoisePar.

◆ OnWorkStart()

override void OnWorkStart ( )
protected

Definition at line 171 of file SmokeGrenadeBase.c.

172 {
174
175 if (GetGame().IsServer())
176 {
177 m_NoisePar = new NoiseParams();
178 m_NoisePar.LoadFromPath("cfgVehicles " + GetType() + " NoiseSmokeGrenade");
179 NoiseSystem noise = GetGame().GetNoiseSystem();
180 if (noise)
181 noise.AddNoisePos(this, GetPosition(), m_NoisePar);
182 }
183
185 m_TimerSmokeLoop.Run(5.0, this, "SetSmokeGrenadeState", par);
186 }
eBleedingSourceType GetType()
class NoiseSystem NoiseParams()
Definition Noise.c:15
ref Timer m_TimerSmokeLoop

References GetGame(), GetPosition, GetType(), m_NoisePar, m_TimerSmokeLoop, NoiseParams(), and SetSmokeGrenadeState().

◆ OnWorkStop()

override void OnWorkStop ( )
protected

defer timer

Definition at line 200 of file SmokeGrenadeBase.c.

201 {
203
205 m_TimerDefer.Run(5.0, this, "DestroySmokeGrenade");
206 }
ref Timer m_TimerDefer

References m_TimerDefer, and SetSmokeGrenadeState().

◆ PlaySmokeParticle()

void PlaySmokeParticle ( )
protected

Definition at line 74 of file SmokeGrenadeBase.c.

75 {
77 }
vector m_ParticlePosition
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
int m_ParticleSmokeCurrentId
static const vector Zero
Definition EnConvert.c:110

References m_ParticlePosition, m_ParticleSmoke, m_ParticleSmokeCurrentId, ParticleManager(), and vector::Zero.

Referenced by RefreshParticlesAndSounds().

◆ RefreshParticlesAndSounds()

void RefreshParticlesAndSounds ( )
protected

Definition at line 108 of file SmokeGrenadeBase.c.

109 {
111
113 {
114 if (state == ESmokeGrenadeState.START)
115 {
116 //Print("RefreshAudioVisual:: START");
119
123 }
124 else if (state == ESmokeGrenadeState.LOOP)
125 {
126 //Print("RefreshAudioVisual:: LOOP");
129
133 }
134 else if (state == ESmokeGrenadeState.END)
135 {
136 //Print("RefreshAudioVisual:: END");
139
143 }
144 else if (state == ESmokeGrenadeState.NO_SMOKE)
145 {
146 //Print("RefreshAudioVisual:: NO_SMOKE");
148
150 }
151
153 }
154 }
void SoundSmokeLoop()
int m_ParticleSmokeStartId
ESmokeGrenadeState m_LastSmokeGrenadeState
int m_ParticleSmokeEndId
void SoundSmokeStart()
void PlaySmokeParticle()
ESmokeGrenadeState GetSmokeGrenadeState()
int m_ParticleSmokeLoopId
void SoundSmokeEnd()
void SetParticleSmokeCurrent(int particle)

References DestroyParticle(), GetSmokeGrenadeState(), m_LastSmokeGrenadeState, m_ParticleSmoke, m_ParticleSmokeEndId, m_ParticleSmokeLoopId, m_ParticleSmokeStartId, PlaySmokeParticle(), SetParticleSmokeCurrent(), SoundSmokeEnd(), SoundSmokeLoop(), SoundSmokeStart(), and SoundSmokeStop().

Referenced by OnVariablesSynchronized().

◆ SetActions()

override void SetActions ( )
protected

Definition at line 218 of file SmokeGrenadeBase.c.

219 {
220 super.SetActions();
221
222 RemoveAction(ActionPin);
223 }
void RemoveAction(typename actionName)

References RemoveAction().

◆ SetParticleSmokeCurrent()

void SetParticleSmokeCurrent ( int particle)
protected

Definition at line 39 of file SmokeGrenadeBase.c.

References m_ParticleSmokeCurrentId.

Referenced by RefreshParticlesAndSounds().

◆ SetParticleSmokeEnd()

◆ SetParticleSmokeLoop()

◆ SetParticleSmokeStart()

◆ SetSmokeGrenadeState()

void SetSmokeGrenadeState ( ESmokeGrenadeState state)
protected

Definition at line 247 of file SmokeGrenadeBase.c.

248 {
249 //Print("Setting SGS to: " + typename.EnumToString(ESmokeGrenadeState, state));
250
251 if (GetGame().IsServer())
252 {
254 {
256
257 //synchronize
258 SetSynchDirty();
259 }
260 }
261 }

References GetGame(), and m_SmokeGrenadeState.

Referenced by DestroySmokeGrenade(), OnWorkStart(), and OnWorkStop().

◆ SetSoundSmokeEnd()

void SetSoundSmokeEnd ( string sound)
protected

◆ SetSoundSmokeLoop()

void SetSoundSmokeLoop ( string sound)
protected

◆ SetSoundSmokeStart()

void SetSoundSmokeStart ( string sound)
protected

◆ SmokeGrenadeBase()

void SmokeGrenadeBase ( )
protected

no effect on base

no effect on base

no effect on base

Definition at line 263 of file SmokeGrenadeBase.c.

264 {
266
268 m_TimerDefer = new Timer;
269
270 SetAmmoType("");
271 SetPinnable(false);
272 SetGrenadeType(EGrenadeType.CHEMICAL);
276
277 RegisterNetSyncVariableInt("m_SmokeGrenadeState", ESmokeGrenadeState.NO_SMOKE, ESmokeGrenadeState.COUNT);
278 }
void SetAmmoType(string pAmmoType)
EGrenadeType
Definition Grenade_Base.c:2
void SetParticleSmokeLoop(int particle)
void SetParticleSmokeEnd(int particle)
void SetParticleSmokeStart(int particle)
static const int INVALID

References ParticleList::INVALID, m_SmokeGrenadeState, m_TimerDefer, m_TimerSmokeLoop, SetAmmoType(), SetParticleSmokeEnd(), SetParticleSmokeLoop(), and SetParticleSmokeStart().

◆ SoundSmokeEnd()

void SoundSmokeEnd ( )
protected

Definition at line 89 of file SmokeGrenadeBase.c.

90 {
91 PlaySoundSetLoop(m_SoundSmoke, m_SoundSmokeEndId, 1.0, 1.0);
92 }
EffectSound m_SoundSmoke
sounds

References m_SoundSmoke, and m_SoundSmokeEndId.

Referenced by RefreshParticlesAndSounds().

◆ SoundSmokeLoop()

void SoundSmokeLoop ( )
protected

Definition at line 84 of file SmokeGrenadeBase.c.

85 {
86 PlaySoundSetLoop(m_SoundSmoke, m_SoundSmokeLoopId, 0.3, 1.0);
87 }

References m_SoundSmoke, and m_SoundSmokeLoopId.

Referenced by RefreshParticlesAndSounds().

◆ SoundSmokeStart()

void SoundSmokeStart ( )
protected

Definition at line 79 of file SmokeGrenadeBase.c.

80 {
81 PlaySoundSetLoop(m_SoundSmoke, m_SoundSmokeStartId, 0.3, 1.0);
82 }

References m_SoundSmoke, and m_SoundSmokeStartId.

Referenced by RefreshParticlesAndSounds().

◆ SoundSmokeStop()

void SoundSmokeStop ( )
protected

Definition at line 95 of file SmokeGrenadeBase.c.

96 {
97 StopSoundSet(m_SoundSmoke);
98 }

References m_SoundSmoke.

Referenced by EEDelete(), and RefreshParticlesAndSounds().

◆ Unpin()

override void Unpin ( )
protected

Definition at line 156 of file SmokeGrenadeBase.c.

157 {
158 super.Unpin();
159
160 Activate();
161
162 }
void Activate()

References Activate().

◆ ~SmokeGrenadeBase()

void ~SmokeGrenadeBase ( )
protected

Variable Documentation

◆ m_LastSmokeGrenadeState

ESmokeGrenadeState m_LastSmokeGrenadeState
protected

Definition at line 20 of file SmokeGrenadeBase.c.

Referenced by RefreshParticlesAndSounds().

◆ m_NoisePar

ref NoiseParams m_NoisePar
protected

Noise.

Definition at line 37 of file SmokeGrenadeBase.c.

◆ m_ParticleSmoke

Particle m_ParticleSmoke
protected

◆ m_ParticleSmokeCurrentId

int m_ParticleSmokeCurrentId
protected

Definition at line 24 of file SmokeGrenadeBase.c.

Referenced by PlaySmokeParticle(), and SetParticleSmokeCurrent().

◆ m_ParticleSmokeEndId

int m_ParticleSmokeEndId
protected

Definition at line 27 of file SmokeGrenadeBase.c.

Referenced by RefreshParticlesAndSounds(), and SetParticleSmokeEnd().

◆ m_ParticleSmokeLoopId

int m_ParticleSmokeLoopId
protected

Definition at line 26 of file SmokeGrenadeBase.c.

Referenced by RefreshParticlesAndSounds(), and SetParticleSmokeLoop().

◆ m_ParticleSmokePosition

vector m_ParticleSmokePosition
protected

Definition at line 28 of file SmokeGrenadeBase.c.

◆ m_ParticleSmokeStartId

int m_ParticleSmokeStartId
protected

Definition at line 25 of file SmokeGrenadeBase.c.

Referenced by RefreshParticlesAndSounds(), and SetParticleSmokeStart().

◆ m_SmokeGrenadeState

ESmokeGrenadeState m_SmokeGrenadeState
protected

Definition at line 19 of file SmokeGrenadeBase.c.

Referenced by GetSmokeGrenadeState(), SetSmokeGrenadeState(), and SmokeGrenadeBase().

◆ m_SoundSmoke

EffectSound m_SoundSmoke
protected

sounds

Definition at line 31 of file SmokeGrenadeBase.c.

Referenced by SoundSmokeEnd(), SoundSmokeLoop(), SoundSmokeStart(), and SoundSmokeStop().

◆ m_SoundSmokeEndId

string m_SoundSmokeEndId
protected

Definition at line 34 of file SmokeGrenadeBase.c.

Referenced by SetSoundSmokeEnd(), and SoundSmokeEnd().

◆ m_SoundSmokeLoopId

string m_SoundSmokeLoopId
protected

Definition at line 33 of file SmokeGrenadeBase.c.

Referenced by SetSoundSmokeLoop(), and SoundSmokeLoop().

◆ m_SoundSmokeStartId

string m_SoundSmokeStartId
protected

Definition at line 32 of file SmokeGrenadeBase.c.

Referenced by SetSoundSmokeStart(), and SoundSmokeStart().

◆ m_TimerDefer

ref Timer m_TimerDefer
protected

Definition at line 17 of file SmokeGrenadeBase.c.

Referenced by OnWorkStop(), and SmokeGrenadeBase().

◆ m_TimerSmokeEnd

ref Timer m_TimerSmokeEnd
protected

Definition at line 15 of file SmokeGrenadeBase.c.

◆ m_TimerSmokeLoop

ref Timer m_TimerSmokeLoop
protected

Definition at line 14 of file SmokeGrenadeBase.c.

Referenced by OnWorkStart(), and SmokeGrenadeBase().

◆ m_TimerSmokeStart

enum ESmokeGrenadeState m_TimerSmokeStart