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

Go to the source code of this file.

Classes

class  ExplosiveLight
 

Functions

void ExplosivesBase ()
 
override bool IsExplosive ()
 
override void OnExplosionEffects (Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
 
override void EEDelete (EntityAI parent)
 
override void EEKilled (Object killer)
 
override void OnCEUpdate ()
 
override void UnpairRemote ()
 
override void OnPlacementComplete (Man player, vector position="0 0 0", vector orientation="0 0 0")
 
void CreateLight ()
 
void DestroyParticle (Particle p)
 
void InitiateExplosion ()
 
void OnExplode ()
 
override void SetActions ()
 
override bool IsInventoryVisible ()
 
override bool IsTakeable ()
 
bool IsTimerDetonable ()
 
void Arm ()
 
void OnArmed ()
 
bool CanBeArmed ()
 
void Disarm (bool pWithTool=false)
 
void OnBeforeDisarm ()
 
void OnDisarmed (bool pWithTool)
 
bool CanBeDisarmed ()
 
bool GetArmed ()
 
void SetArmed (bool state)
 
override bool CanPutInCargo (EntityAI parent)
 
override bool CanPutIntoHands (EntityAI parent)
 
override bool CanRemoveFromHands (EntityAI parent)
 
bool GetDefused ()
 
void SetDefused (bool state)
 
void SetAmmoType (string pAmmoType)
 
void SetAmmoTypes (array< string > pAmmoTypes)
 
void SetParticleExplosion (int particle)
 
void SetParticlePosition (vector local_pos)
 set position for smoke particle - needs to be in Local Space
 
void SetParticleOrientation (vector local_ori)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
void UpdateLED (int pState)
 HELPERS.
 
bool HasLockedTriggerSlots ()
 
void LockTriggerSlots ()
 
void UnlockTriggerSlots ()
 
void LockExplosivesSlots ()
 
void UnlockExplosivesSlots ()
 

Variables

ExplosiveLight DEFAULT_AMMO_TYPE = "Explosion_NonLethal"
 
const string ANIM_PHASE_VISIBILITY = "Visibility"
 
bool m_Armed
 
bool m_Defused
 
ref array< stringm_AmmoTypes
 
ref Timer m_DeleteTimer
 
ExplosiveLight m_Light
 light
 
Particle m_ParticleExplosion
 particle
 
ref array< ParticleSourcem_ParticleExplosionArr = {}
 
int m_ParticleExplosionId
 
vector m_ParticlePosition
 
vector m_ParticleOrientation
 

Function Documentation

◆ Arm()

◆ CanBeArmed()

bool CanBeArmed ( )
protected

Definition at line 202 of file ExplosivesBase.c.

203 {
204 return true;
205 }

◆ CanBeDisarmed()

bool CanBeDisarmed ( )
protected

Definition at line 217 of file ExplosivesBase.c.

218 {
219 return false;
220 }

◆ CanPutInCargo()

override bool CanPutInCargo ( EntityAI parent)
protected

Definition at line 233 of file ExplosivesBase.c.

234 {
235 if (!super.CanPutInCargo(parent))
236 return false;
237
238 return IsTakeable();
239 }
override bool IsTakeable()

References IsTakeable().

◆ CanPutIntoHands()

override bool CanPutIntoHands ( EntityAI parent)
protected

Definition at line 241 of file ExplosivesBase.c.

242 {
243 if (!super.CanPutIntoHands(parent))
244 return false;
245
246 return IsTakeable();
247 }

References IsTakeable().

◆ CanRemoveFromHands()

override bool CanRemoveFromHands ( EntityAI parent)
protected

Definition at line 249 of file ExplosivesBase.c.

250 {
251 return IsTakeable();
252 }

References IsTakeable().

◆ CreateLight()

void CreateLight ( )
protected

Definition at line 139 of file ExplosivesBase.c.

140 {
142 }
ExplosiveLight m_Light
light
class JsonUndergroundAreaTriggerData GetPosition

References GetPosition, and m_Light.

Referenced by EntityLightSource::CreateLightAtObjMemoryPoint(), and OnExplosionEffects().

◆ DestroyParticle()

void DestroyParticle ( Particle p)
protected

Definition at line 144 of file ExplosivesBase.c.

145 {
146#ifndef SERVER
147 if (p != null)
148 p.Stop();
149#endif
150 }

Referenced by EEDelete(), and RefreshParticlesAndSounds().

◆ Disarm()

void Disarm ( bool pWithTool = false)
protected

Definition at line 207 of file ExplosivesBase.c.

208 {
209 SetArmed(false);
210
212 }
void OnDisarmed(bool pWithTool)

References OnDisarmed(), and SetArmed().

◆ EEDelete()

override void EEDelete ( EntityAI parent)
protected

Definition at line 78 of file ExplosivesBase.c.

79 {
80 super.EEDelete(parent);
81
83 {
86 }
87 }
void DestroyParticle(Particle p)
Particle m_ParticleExplosion
particle
ref array< ParticleSource > m_ParticleExplosionArr
Entity which has the particle instance as an ObjectComponent.

References DestroyParticle(), m_ParticleExplosion, and m_ParticleExplosionArr.

◆ EEKilled()

override void EEKilled ( Object killer)
protected

should be called only here to avoid multiple explosion calculations, call SetHealth("","",0.0) instead

Definition at line 89 of file ExplosivesBase.c.

90 {
91 super.EEKilled(killer);
92
95
97 }
void InitiateExplosion()
override void UnpairRemote()

References InitiateExplosion(), and UnpairRemote().

◆ ExplosivesBase()

void ExplosivesBase ( )
protected

no effect

Definition at line 40 of file ExplosivesBase.c.

41 {
42 m_DeleteTimer = new Timer();
44
47 SetParticlePosition(WorldToModel(GetPosition()));
49
50 RegisterNetSyncVariableBool("m_Armed");
51 RegisterNetSyncVariableBool("m_Defused");
52 }
ExplosiveLight DEFAULT_AMMO_TYPE
ref array< string > m_AmmoTypes
ref Timer m_DeleteTimer
void SetParticleExplosion(int particle)
void SetParticlePosition(vector local_pos)
set position for smoke particle - needs to be in Local Space
void SetAmmoType(string pAmmoType)
void SetParticleOrientation(vector local_ori)
static const int INVALID
static const vector Zero
Definition EnConvert.c:110

References DEFAULT_AMMO_TYPE, GetPosition, ParticleList::INVALID, m_AmmoTypes, m_DeleteTimer, SetAmmoType(), SetParticleExplosion(), SetParticleOrientation(), SetParticlePosition(), and vector::Zero.

◆ GetArmed()

◆ GetDefused()

bool GetDefused ( )
protected

Definition at line 254 of file ExplosivesBase.c.

255 {
256 return m_Defused;
257 }
bool m_Defused

References m_Defused.

Referenced by ClaymoreMine::InitiateExplosion(), and ClaymoreMine::UpdateVisuals().

◆ HasLockedTriggerSlots()

bool HasLockedTriggerSlots ( )
protected

Definition at line 324 of file ExplosivesBase.c.

325 {
326 return false;
327 }

◆ InitiateExplosion()

void InitiateExplosion ( )
protected

Definition at line 152 of file ExplosivesBase.c.

153 {
154 int count = m_AmmoTypes.Count();
155 for (int i = 0; i < count; i++)
156 Explode(DamageType.EXPLOSION, m_AmmoTypes[i]);
157
158 OnExplode();
159 }
DamageType
exposed from C++ (do not change)
void OnExplode()
override void Explode(int damageType, string ammoType="")

References Explode(), m_AmmoTypes, and OnExplode().

Referenced by EEKilled(), and Plastic_Explosive::OnActivatedByItem().

◆ IsExplosive()

override bool IsExplosive ( )
protected

Definition at line 55 of file ExplosivesBase.c.

56 {
57 return true;
58 }

◆ IsInventoryVisible()

override bool IsInventoryVisible ( )
protected

Definition at line 175 of file ExplosivesBase.c.

176 {
177 if (!super.IsInventoryVisible())
178 return false;
179
180 return GetAnimationPhase("Visibility") == 0;
181 }

◆ IsTakeable()

override bool IsTakeable ( )
protected

Definition at line 183 of file ExplosivesBase.c.

184 {
185 return super.IsTakeable() && GetAnimationPhase("Visibility") == 0;
186 }

Referenced by CanPutInCargo(), CanPutIntoHands(), and CanRemoveFromHands().

◆ IsTimerDetonable()

bool IsTimerDetonable ( )
protected

Definition at line 188 of file ExplosivesBase.c.

189 {
190 return false;
191 }

◆ LockExplosivesSlots()

void LockExplosivesSlots ( )
protected

◆ LockTriggerSlots()

void LockTriggerSlots ( )
protected

◆ OnArmed()

void OnArmed ( )
protected

Referenced by Arm().

◆ OnBeforeDisarm()

void OnBeforeDisarm ( )
protected

◆ OnCEUpdate()

override void OnCEUpdate ( )
protected

Definition at line 99 of file ExplosivesBase.c.

100 {
101 super.OnCEUpdate();
102
103 if (!IsRuined() && GetArmed() && GetPairDevice())
104 {
106 {
108
109 return;
110 }
111 }
112
114 }
void UpdateLED(int pState)
HELPERS.
bool GetArmed()
ERemoteDetonatorLEDState
Definition EnMath.c:7
const float EXPLOSIVE_REMOTE_ACTIVATION
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto float SqrFloat(float f)
Returns squared value.

References vector::DistanceSq(), UAMaxDistances::EXPLOSIVE_REMOTE_ACTIVATION, GetArmed(), GetPosition, Math::SqrFloat(), and UpdateLED().

◆ OnDisarmed()

void OnDisarmed ( bool pWithTool)
protected

Referenced by Disarm().

◆ OnExplode()

void OnExplode ( )
protected

Definition at line 161 of file ExplosivesBase.c.

162 {
163 if (GetGame().IsServer())
164 m_DeleteTimer.Run(0.25, this, "DeleteSafe");
165 }
proto native CGame GetGame()

References GetGame(), and m_DeleteTimer.

Referenced by InitiateExplosion(), and Grenade_Base::InitiateExplosion().

◆ 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 60 of file ExplosivesBase.c.

61 {
63
65 {
66 EntityAI parent = this;
67 if (GetHierarchyParent())
68 parent = GetHierarchyParent();
69
73 }
74
76 }
void CreateLight()
int m_ParticleExplosionId
vector m_ParticleOrientation
vector m_ParticlePosition
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)

References CreateLight(), ParticleList::INVALID, m_ParticleExplosion, m_ParticleExplosionArr, m_ParticleExplosionId, m_ParticleOrientation, m_ParticlePosition, and ParticleManager().

◆ OnPlacementComplete()

override void OnPlacementComplete ( Man player,
vector position = "0 0 0",
vector orientation = "0 0 0" )
protected

Definition at line 127 of file ExplosivesBase.c.

128 {
129 super.OnPlacementComplete(player, position, orientation);
130
131 if (GetGame().IsServer())
132 {
133 SetOrientation(orientation);
135 PlaceOnSurface();
136 }
137 }
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition Effect.c:420

References GetGame(), and SetPosition().

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext ctx,
int version )
protected

Definition at line 305 of file ExplosivesBase.c.

306 {
307 if (!super.OnStoreLoad(ctx, version))
308 return false;
309
310 if (version > 129)
311 {
312 bool armed = false;
313 if (!ctx.Read(armed))
314 return false;
315
317 }
318
319 return true;
320 }

References SetArmed().

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext ctx)
protected

Definition at line 298 of file ExplosivesBase.c.

299 {
300 super.OnStoreSave(ctx);
301
302 ctx.Write(m_Armed);
303 }

References m_Armed.

◆ SetActions()

override void SetActions ( )
protected

Definition at line 167 of file ExplosivesBase.c.

168 {
169 super.SetActions();
170
171 AddAction(ActionAttach);
173 }
void ActionDetach()
void AddAction(typename actionName)

References ActionDetach(), and AddAction().

◆ SetAmmoType()

◆ SetAmmoTypes()

void SetAmmoTypes ( array< string > pAmmoTypes)
protected

Definition at line 270 of file ExplosivesBase.c.

271 {
272 m_AmmoTypes.Clear();
274 }

References m_AmmoTypes.

Referenced by ClaymoreMine::ClaymoreMine(), and SetAmmoType().

◆ SetArmed()

void SetArmed ( bool state)
protected

Definition at line 227 of file ExplosivesBase.c.

228 {
229 m_Armed = state;
230 SetSynchDirty();
231 }

References m_Armed.

Referenced by Arm(), Disarm(), ImprovisedExplosive::EEHealthLevelChanged(), Plastic_Explosive::EEHealthLevelChanged(), and OnStoreLoad().

◆ SetDefused()

void SetDefused ( bool state)
protected

Definition at line 259 of file ExplosivesBase.c.

260 {
262 SetSynchDirty();
263 }

References m_Defused.

Referenced by ClaymoreMine::OnDisarmed().

◆ SetParticleExplosion()

◆ SetParticleOrientation()

void SetParticleOrientation ( vector local_ori)
protected

Definition at line 290 of file ExplosivesBase.c.

291 {
293
294 if (GetHierarchyParent())
295 m_ParticleOrientation = GetHierarchyParent().WorldToModel(GetOrientation());
296 }
vector GetOrientation()

References GetOrientation(), and m_ParticleOrientation.

Referenced by ClaymoreMine::ClaymoreMine(), and ExplosivesBase().

◆ SetParticlePosition()

void SetParticlePosition ( vector local_pos)
protected

set position for smoke particle - needs to be in Local Space

Definition at line 282 of file ExplosivesBase.c.

283 {
285
286 if (GetHierarchyParent())
287 m_ParticlePosition = GetHierarchyParent().WorldToModel(GetPosition());
288 }

References GetPosition, and m_ParticlePosition.

Referenced by ExplosivesBase(), and SmokeGrenadeBase::RDG2SmokeGrenade_ColorBase().

◆ UnlockExplosivesSlots()

void UnlockExplosivesSlots ( )
protected

◆ UnlockTriggerSlots()

void UnlockTriggerSlots ( )
protected

◆ UnpairRemote()

override void UnpairRemote ( )
protected

Definition at line 116 of file ExplosivesBase.c.

117 {
119 {
120 if (GetPairDevice())
121 GetPairDevice().UnpairRemote();
123 }
124
125 }
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()

References GetRemotelyActivatedItemBehaviour().

Referenced by EEKilled(), ClaymoreMine::OnDisarmed(), ImprovisedExplosive::OnDisarmed(), and Plastic_Explosive::OnDisarmed().

◆ UpdateLED()

void UpdateLED ( int pState)
protected

HELPERS.

Variable Documentation

◆ ANIM_PHASE_VISIBILITY

const string ANIM_PHASE_VISIBILITY = "Visibility"
protected

Definition at line 22 of file ExplosivesBase.c.

Referenced by ImprovisedExplosive::OnActivatedByItem().

◆ DEFAULT_AMMO_TYPE

ExplosiveLight DEFAULT_AMMO_TYPE = "Explosion_NonLethal"

Referenced by ExplosivesBase().

◆ m_AmmoTypes

ref array<string> m_AmmoTypes
protected

◆ m_Armed

bool m_Armed
protected

Definition at line 24 of file ExplosivesBase.c.

Referenced by GetArmed(), OnStoreSave(), and SetArmed().

◆ m_Defused

bool m_Defused
protected

Definition at line 25 of file ExplosivesBase.c.

Referenced by GetDefused(), and SetDefused().

◆ m_DeleteTimer

ref Timer m_DeleteTimer
protected

◆ m_Light

◆ m_ParticleExplosion

Particle m_ParticleExplosion
protected

particle

Definition at line 34 of file ExplosivesBase.c.

Referenced by EEDelete(), OnExplode(), and OnExplosionEffects().

◆ m_ParticleExplosionArr

ref array<ParticleSource> m_ParticleExplosionArr = {}
protected

Definition at line 35 of file ExplosivesBase.c.

35{};

Referenced by EEDelete(), and OnExplosionEffects().

◆ m_ParticleExplosionId

int m_ParticleExplosionId
protected

Definition at line 36 of file ExplosivesBase.c.

Referenced by OnExplosionEffects(), and SetParticleExplosion().

◆ m_ParticleOrientation

vector m_ParticleOrientation
protected

Definition at line 38 of file ExplosivesBase.c.

Referenced by OnExplosionEffects(), and SetParticleOrientation().

◆ m_ParticlePosition

vector m_ParticlePosition
protected

Definition at line 37 of file ExplosivesBase.c.

Referenced by OnExplosionEffects(), PlaySmokeParticle(), and SetParticlePosition().