DayZ 1.24
Loading...
Searching...
No Matches
Plastic_Explosive Class Reference
Inheritance diagram for Plastic_Explosive:
[legend]
Collaboration diagram for Plastic_Explosive:
[legend]

Protected Member Functions

void Plastic_Explosive ()
 
override void EOnInit (IEntity other, int extra)
 
override void EEKilled (Object killer)
 special behaviour - do not call super from ExplosivesBase
 
override bool HasLockedTriggerSlots ()
 
override void LockTriggerSlots ()
 
override void UnlockTriggerSlots ()
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override void OnVariablesSynchronized ()
 
override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
 
override bool CanReceiveAttachment (EntityAI attachment, int slotId)
 
override bool CanDisplayAttachmentSlot (int slot_id)
 
override bool IsTakeable ()
 
override bool IsDeployable ()
 
override void SetActions ()
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override bool EEOnDamageCalculated (TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
 
override void EEHealthLevelChanged (int oldLevel, int newLevel, string zone)
 
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour ()
 
override void PairRemote (notnull EntityAI trigger)
 
override EntityAI GetPairDevice ()
 
override bool CanBeArmed ()
 
override bool CanBeDisarmed ()
 
override void OnActivatedByItem (notnull ItemBase item)
 
override void OnDisarmed (bool pWithTool)
 
override void EEItemAttached (EntityAI item, string slot_name)
 
override void EEItemDetached (EntityAI item, string slot_name)
 
override void UpdateLED (int pState)
 
void OnTriggerAttached (EntityAI entity)
 
void OnTriggerDetached (EntityAI entity)
 
void UpdateVisuals (EntityAI entity)
 
override string GetDeploySoundset ()
 
override string GetLoopDeploySoundset ()
 
bool UsesGlobalDeploy ()
 

Protected Attributes

const string SLOT_TRIGGER = "TriggerRemoteDetonator_Receiver"
 
const string ANIM_PHASE_TRIGGER_REMOTE = "TriggerRemote"
 
bool m_UsedAsCharge
 
ref RemotelyActivatedItemBehaviour m_RAIB
 

Detailed Description

Definition at line 1 of file Plastic_Explosive.c.

Constructor & Destructor Documentation

◆ Plastic_Explosive()

void Plastic_Explosive::Plastic_Explosive ( )
inlineprotected

Definition at line 10 of file Plastic_Explosive.c.

11 {
13
14 SetAmmoType("Plastic_Explosive_Ammo");
16
17 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdLow");
18 RegisterNetSyncVariableInt("m_RAIB.m_PairDeviceNetIdHigh");
19 }
void SetParticleExplosion(int particle)
void SetAmmoType(string pAmmoType)
static const int PLASTIC_EXPLOSION
ref RemotelyActivatedItemBehaviour m_RAIB

References m_RAIB, ParticleList::PLASTIC_EXPLOSION, SetAmmoType(), and SetParticleExplosion().

Member Function Documentation

◆ CanBeArmed()

override bool Plastic_Explosive::CanBeArmed ( )
inlineprotected

Definition at line 207 of file Plastic_Explosive.c.

208 {
209 if (!super.CanBeArmed())
210 return false;
211
212 return HasLockedTriggerSlots() && !GetArmed();
213 }
bool GetArmed()
override bool HasLockedTriggerSlots()

References GetArmed(), and HasLockedTriggerSlots().

◆ CanBeDisarmed()

override bool Plastic_Explosive::CanBeDisarmed ( )
inlineprotected

Definition at line 215 of file Plastic_Explosive.c.

216 {
217 return GetArmed();
218 }

References GetArmed().

◆ CanDisplayAttachmentSlot()

override bool Plastic_Explosive::CanDisplayAttachmentSlot ( int slot_id)
inlineprotected

Definition at line 108 of file Plastic_Explosive.c.

109 {
111
112 switch (slotName)
113 {
114 case SLOT_TRIGGER:
115 return FindAttachmentBySlotName(slotName) != null;
116 break;
117 }
118
119 return true;
120 }
PlayerSpawnPreset slotName
provides access to slot configuration
static proto native owned string GetSlotName(int id)
converts slot_id to string
const string SLOT_TRIGGER

References InventorySlots::GetSlotName(), SLOT_TRIGGER, and slotName.

◆ CanReceiveAttachment()

override bool Plastic_Explosive::CanReceiveAttachment ( EntityAI attachment,
int slotId )
inlineprotected

Definition at line 94 of file Plastic_Explosive.c.

95 {
97 GetInventory().GetCurrentInventoryLocation(il);
98 if (il.GetType() == InventoryLocationType.HANDS)
99 return false;
100
101 ClockBase timer = ClockBase.Cast(attachment);
102 if (timer && !timer.IsAlarmOn())
103 return false;
104
105 return !GetArmed();
106 }
InventoryLocationType
types of Inventory Location
InventoryLocation.

References GetArmed().

◆ EEHealthLevelChanged()

override void Plastic_Explosive::EEHealthLevelChanged ( int oldLevel,
int newLevel,
string zone )
inlineprotected

Definition at line 167 of file Plastic_Explosive.c.

168 {
169 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
170
171 if (GetGame().IsServer())
172 {
174 {
175 for (int attachmentIdx = 0; attachmentIdx < GetInventory().AttachmentCount(); attachmentIdx++)
176 {
177 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(attachmentIdx));
178 if (attachment)
179 {
180 attachment.UnlockFromParent();
181 attachment.SetHealth("", "", 0.0);
182 }
183 }
184
185 SetArmed(false);
186 SetTakeable(true);
187 }
188 }
189 }
void SetArmed(bool state)
override void SetTakeable(bool pState)
Definition ItemBase.c:8905
proto native CGame GetGame()
const int STATE_RUINED
Definition constants.c:757

References GetGame(), SetArmed(), SetTakeable(), and GameConstants::STATE_RUINED.

◆ EEItemAttached()

override void Plastic_Explosive::EEItemAttached ( EntityAI item,
string slot_name )
inlineprotected

Definition at line 275 of file Plastic_Explosive.c.

276 {
277 super.EEItemAttached(item, slot_name);
278
279 if (slot_name == SLOT_TRIGGER)
281 }
void OnTriggerAttached(EntityAI entity)

References OnTriggerAttached(), and SLOT_TRIGGER.

◆ EEItemDetached()

override void Plastic_Explosive::EEItemDetached ( EntityAI item,
string slot_name )
inlineprotected

Definition at line 283 of file Plastic_Explosive.c.

284 {
285 super.EEItemDetached(item, slot_name);
286
287 if (slot_name == SLOT_TRIGGER)
289 }
void OnTriggerDetached(EntityAI entity)

References OnTriggerDetached(), and SLOT_TRIGGER.

◆ EEItemLocationChanged()

override void Plastic_Explosive::EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
inlineprotected

Definition at line 86 of file Plastic_Explosive.c.

87 {
88 super.EEItemLocationChanged(oldLoc, newLoc);
89
90 if (m_RAIB)
91 m_RAIB.Pair();
92 }

References m_RAIB.

◆ EEKilled()

override void Plastic_Explosive::EEKilled ( Object killer)
inlineprotected

special behaviour - do not call super from ExplosivesBase

Definition at line 28 of file Plastic_Explosive.c.

29 {
30 //analytics (behaviour from EntityAI)
31 GetGame().GetAnalyticsServer().OnEntityKilled(killer, this);
32 }

References GetGame().

◆ EEOnDamageCalculated()

override bool Plastic_Explosive::EEOnDamageCalculated ( TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo,
vector modelPos,
float speedCoef )
inlineprotected

ignores explosion damage from other Plastic_Explosive that are used as charge(like 2 PE fired via IED)

Definition at line 158 of file Plastic_Explosive.c.

159 {
161 if (damageType == DamageType.EXPLOSION)
162 return !m_UsedAsCharge;
163
164 return true;
165 }
DamageType
exposed from C++ (do not change)

References m_UsedAsCharge.

◆ EOnInit()

override void Plastic_Explosive::EOnInit ( IEntity other,
int extra )
inlineprotected

Definition at line 21 of file Plastic_Explosive.c.

22 {
23 if (!g_Game.IsMultiplayer())
25 }
DayZGame g_Game
Definition DayZGame.c:3528
override void LockTriggerSlots()

References g_Game, and LockTriggerSlots().

◆ GetDeploySoundset()

override string Plastic_Explosive::GetDeploySoundset ( )
inlineprotected

Definition at line 327 of file Plastic_Explosive.c.

328 {
329 return "placeImprovisedExplosive_SoundSet";
330 }

◆ GetLoopDeploySoundset()

override string Plastic_Explosive::GetLoopDeploySoundset ( )
inlineprotected

Definition at line 332 of file Plastic_Explosive.c.

333 {
334 return "improvisedexplosive_deploy_SoundSet";
335 }

◆ GetPairDevice()

override EntityAI Plastic_Explosive::GetPairDevice ( )
inlineprotected

Definition at line 202 of file Plastic_Explosive.c.

203 {
204 return m_RAIB.GetPairDevice();
205 }

References m_RAIB.

Referenced by OnActivatedByItem().

◆ GetRemotelyActivatedItemBehaviour()

override RemotelyActivatedItemBehaviour Plastic_Explosive::GetRemotelyActivatedItemBehaviour ( )
inlineprotected

Definition at line 191 of file Plastic_Explosive.c.

192 {
193 return m_RAIB;
194 }

References m_RAIB.

◆ HasLockedTriggerSlots()

override bool Plastic_Explosive::HasLockedTriggerSlots ( )
inlineprotected

Definition at line 34 of file Plastic_Explosive.c.

35 {
36 return GetInventory().GetSlotLock(InventorySlots.GetSlotIdFromString(SLOT_TRIGGER));
37 }
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

References InventorySlots::GetSlotIdFromString(), and SLOT_TRIGGER.

Referenced by CanBeArmed().

◆ IsDeployable()

override bool Plastic_Explosive::IsDeployable ( )
inlineprotected

Definition at line 127 of file Plastic_Explosive.c.

128 {
129 return !GetArmed();
130 }

References GetArmed().

◆ IsTakeable()

override bool Plastic_Explosive::IsTakeable ( )
inlineprotected

Definition at line 122 of file Plastic_Explosive.c.

123 {
124 return !GetArmed() && super.IsTakeable();
125 }

References GetArmed().

◆ LockTriggerSlots()

override void Plastic_Explosive::LockTriggerSlots ( )
inlineprotected

Definition at line 39 of file Plastic_Explosive.c.

40 {
41 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(SLOT_TRIGGER), true);
42 }

References InventorySlots::GetSlotIdFromString(), and SLOT_TRIGGER.

Referenced by EOnInit(), OnDisarmed(), and OnStoreSave().

◆ OnActivatedByItem()

override void Plastic_Explosive::OnActivatedByItem ( notnull ItemBase item)
inlineprotected

Definition at line 220 of file Plastic_Explosive.c.

221 {
222 if (GetGame().IsServer())
223 {
224 if (GetHealthLevel("") == GameConstants.STATE_RUINED)
225 return;
226
227 if (item == this)
228 {
229 SetHealth("", "", 0.0);
231 return;
232 }
233
234 if (m_RAIB.IsPaired() && GetArmed())
235 {
236 if (GetPairDevice() == item)
237 {
238 SetHealth("", "", 0.0);
240 }
241 }
242 }
243 }
void InitiateExplosion()
override EntityAI GetPairDevice()

References GetArmed(), GetGame(), GetPairDevice(), InitiateExplosion(), m_RAIB, and GameConstants::STATE_RUINED.

◆ OnDisarmed()

override void Plastic_Explosive::OnDisarmed ( bool pWithTool)
inlineprotected

Definition at line 245 of file Plastic_Explosive.c.

246 {
247 super.OnDisarmed(pWithTool);
248
249 UnpairRemote();
251
252 for (int att = 0; att < GetInventory().AttachmentCount(); att++)
253 {
254 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(att));
255 if (attachment)
256 {
257 attachment.UnlockFromParent();
258 if (attachment.IsInherited(RemoteDetonator))
259 {
260 if (pWithTool)
261 {
262 GetInventory().DropEntity(InventoryMode.SERVER, this, attachment);
263 attachment.SetHealth("", "", 0.0);
264 }
265 else
266 attachment.Delete();
267 }
268 }
269 }
270
272 SetTakeable(true);
273 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22
void UpdateVisuals()
override void UnpairRemote()

References LockTriggerSlots(), SetTakeable(), UnpairRemote(), and UpdateVisuals().

◆ OnStoreLoad()

override bool Plastic_Explosive::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 49 of file Plastic_Explosive.c.

50 {
51 if (!super.OnStoreLoad(ctx, version))
52 return false;
53
54 if (version <= 134) // up to 1.21
55 {
57 bool locked = GetInventory().GetSlotLock(slotId);
58 while (locked)
59 {
60 GetInventory().SetSlotLock(slotId, false);
61 locked = GetInventory().GetSlotLock(slotId);
62 }
63 }
64
65 return true;
66 }

References InventorySlots::GetSlotIdFromString(), and SLOT_TRIGGER.

◆ OnStoreSave()

override void Plastic_Explosive::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 68 of file Plastic_Explosive.c.

69 {
70 super.OnStoreSave(ctx);
71
73 }

References LockTriggerSlots().

◆ OnTriggerAttached()

void Plastic_Explosive::OnTriggerAttached ( EntityAI entity)
inlineprotected

Definition at line 298 of file Plastic_Explosive.c.

299 {
300 Arm();
303
304 for (int att = 0; att < GetInventory().AttachmentCount(); att++)
305 {
306 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(att));
307 if (attachment)
308 attachment.LockToParent();
309 }
310 }
void Arm()
ERemoteDetonatorLEDState
override void UpdateLED(int pState)

References Arm(), UpdateLED(), and UpdateVisuals().

Referenced by EEItemAttached().

◆ OnTriggerDetached()

void Plastic_Explosive::OnTriggerDetached ( EntityAI entity)
inlineprotected

Definition at line 312 of file Plastic_Explosive.c.

References UpdateLED(), and UpdateVisuals().

Referenced by EEItemDetached().

◆ OnVariablesSynchronized()

override void Plastic_Explosive::OnVariablesSynchronized ( )
inlineprotected

Definition at line 75 of file Plastic_Explosive.c.

76 {
77 super.OnVariablesSynchronized();
78
79 if (m_RAIB)
80 m_RAIB.OnVariableSynchronized();
81
83 UpdateVisuals(GetInventory().FindAttachment(slotId));
84 }

References InventorySlots::GetSlotIdFromString(), m_RAIB, SLOT_TRIGGER, and UpdateVisuals().

◆ OnWasAttached()

override void Plastic_Explosive::OnWasAttached ( EntityAI parent,
int slot_id )
inlineprotected

Definition at line 140 of file Plastic_Explosive.c.

141 {
142 super.OnWasAttached(parent, slot_id);
143
144 m_UsedAsCharge = false;
145
146 if (parent && parent.IsInherited(ExplosivesBase))
147 m_UsedAsCharge = true;
148 }

References m_UsedAsCharge.

◆ OnWasDetached()

override void Plastic_Explosive::OnWasDetached ( EntityAI parent,
int slot_id )
inlineprotected

Definition at line 150 of file Plastic_Explosive.c.

151 {
152 super.OnWasDetached(parent, slot_id);
153
154 if (parent && !parent.IsInherited(ExplosivesBase))
155 m_UsedAsCharge = false;
156 }

References m_UsedAsCharge.

◆ PairRemote()

override void Plastic_Explosive::PairRemote ( notnull EntityAI trigger)
inlineprotected

Definition at line 196 of file Plastic_Explosive.c.

197 {
198 m_RAIB.Pair(trigger);
199 }

References m_RAIB.

◆ SetActions()

override void Plastic_Explosive::SetActions ( )
inlineprotected

Definition at line 132 of file Plastic_Explosive.c.

133 {
134 super.SetActions();
135
137 AddAction(ActionDeployObject);
138 }
void AddAction(typename actionName)

References AddAction().

◆ UnlockTriggerSlots()

override void Plastic_Explosive::UnlockTriggerSlots ( )
inlineprotected

Definition at line 44 of file Plastic_Explosive.c.

45 {
46 GetInventory().SetSlotLock(InventorySlots.GetSlotIdFromString(SLOT_TRIGGER), false);
47 }

References InventorySlots::GetSlotIdFromString(), and SLOT_TRIGGER.

◆ UpdateLED()

override void Plastic_Explosive::UpdateLED ( int pState)
inlineprotected

Definition at line 291 of file Plastic_Explosive.c.

292 {
294 if (receiver)
295 receiver.UpdateLED(pState, true);
296 }
RemoteDetonatorTrigger RemoteDetonator RemoteDetonatorReceiver()

References RemoteDetonatorReceiver(), and SLOT_TRIGGER.

Referenced by OnTriggerAttached(), and OnTriggerDetached().

◆ UpdateVisuals()

void Plastic_Explosive::UpdateVisuals ( EntityAI entity)
inlineprotected

Definition at line 318 of file Plastic_Explosive.c.

319 {
320 if (entity)
321 SetAnimationPhase(ANIM_PHASE_TRIGGER_REMOTE, 0.0);
322 else
323 SetAnimationPhase(ANIM_PHASE_TRIGGER_REMOTE, 1.0);
324 }
const string ANIM_PHASE_TRIGGER_REMOTE

References ANIM_PHASE_TRIGGER_REMOTE.

◆ UsesGlobalDeploy()

bool Plastic_Explosive::UsesGlobalDeploy ( )
inlineprotected

Definition at line 337 of file Plastic_Explosive.c.

338 {
339 return true;
340 }

Member Data Documentation

◆ ANIM_PHASE_TRIGGER_REMOTE

const string Plastic_Explosive::ANIM_PHASE_TRIGGER_REMOTE = "TriggerRemote"
protected

Definition at line 4 of file Plastic_Explosive.c.

Referenced by UpdateVisuals().

◆ m_RAIB

◆ m_UsedAsCharge

bool Plastic_Explosive::m_UsedAsCharge
protected

Definition at line 6 of file Plastic_Explosive.c.

Referenced by EEOnDamageCalculated(), OnWasAttached(), and OnWasDetached().

◆ SLOT_TRIGGER

const string Plastic_Explosive::SLOT_TRIGGER = "TriggerRemoteDetonator_Receiver"
protected

The documentation for this class was generated from the following file: