DayZ 1.24
Loading...
Searching...
No Matches
BarbedWireTrigger Class Reference

DEPRECATED UNUSED prototype for damage by BarbedWire, do not use as example. More...

Inheritance diagram for BarbedWireTrigger:
[legend]
Collaboration diagram for BarbedWireTrigger:
[legend]

Private Member Functions

override void OnEnter (Object obj)
 
void SetParentObject (ItemBase wire)
 
void SoundElectricShock ()
 
void SoundCollision ()
 
- Private Member Functions inherited from Trigger
override void OnEnter (Object obj)
 
override void OnLeave (Object obj)
 
void UpdateInsiders (int timeout)
 
void SetParentObject (Hologram projection)
 
void SetParentOwner (PlayerBase player)
 
void OnEnterBeginEvent (TriggerInsider insider)
 
void OnLeaveBeginEvent (TriggerInsider insider)
 
void OnEnter (Object obj)
 
void OnLeave (Object obj)
 
bool CanAddObjectAsInsider (Object object)
 Condition whether an Object can be added as TriggerInsider (checked before calling AddInsider)
 
bool ShouldRemoveInsider (TriggerInsider insider)
 Condition whether a TriggerInsider should still be updated or not (checked in update loop and before adding)
 
bool ShouldRemoveInsiderNoLeave (TriggerInsider insider)
 Condition whether a TriggerInsider should still be updated or not, skips OnLeaveEvent (checked in update loop and before adding)
 
TriggerInsider CreateInsider (Object obj)
 Used for easily overriding TriggerInsider creation without rewriting AddInsider.
 
void AddInsider (Object obj)
 Adding of new TriggerInsider.
 
void RemoveInsider (TriggerInsider insider, int index=-1)
 Removing of TriggerInsider.
 
void RemoveInsiderByObject (Object object)
 Removing of TriggerInsider through Object.
 
void UpdateInsiders (int timeout)
 Update the current TriggerInsider inside the Trigger, timeout paramter is deprecated.
 
override void OnRPC (PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
 

Private Attributes

ItemBase m_ParentBarbedWire
 
- Private Attributes inherited from Trigger
int m_TriggerUpdateMs
 
Hologram m_ParentObj
 
PlayerBase m_Player
 

Static Private Attributes

static const int SOUNDS_COLLISION_COUNT = 4
 
static const int SOUNDS_SHOCK_COUNT = 4
 
static const string m_SoundsCollision [SOUNDS_COLLISION_COUNT] = {"barbedFenceCollision1", "barbedFenceCollision2", "barbedFenceCollision3", "barbedFenceCollision4"}
 
static const string m_SoundsShock [SOUNDS_SHOCK_COUNT] = {"electricFenceShock1", "electricFenceShock2", "electricFenceShock3", "electricFenceShock4"}
 

Detailed Description

DEPRECATED UNUSED prototype for damage by BarbedWire, do not use as example.

Definition at line 2 of file BarbedWireTrigger.c.

Member Function Documentation

◆ OnEnter()

override void BarbedWireTrigger::OnEnter ( Object obj)
inlineprivate

Definition at line 11 of file BarbedWireTrigger.c.

12 {
13 if (g_Game.IsServer())
14 {
16 {
17 if (obj.IsInherited(PlayerBase))
18 {
19 // When a player touches the barbed wire
20 string cfg = "CfgVehicles BarbedWire barbedWireShockEnergyConsumption";
21 float needed_energy = GetGame().ConfigGetFloat(cfg);
22 bool energy_consumed = m_ParentBarbedWire.GetCompEM().ConsumeEnergy(needed_energy);
23 PlayerBase player = PlayerBase.Cast(obj);
24
26 {
27 // TO DO:
28 // -Do electrical damage.
29 // -Cause bleeding?
30 // -Do some damage!
31
32 player.MessageImportant("*SCRATCH and ELECTROCUTION*");
33
34 // Play sound
37 }
38 else
39 {
40 // TO DO:
41 // -Cause bleeding?
42 // -Do some damage!
43
44 player.MessageImportant("*SCRATCH*");
45
46 // Play sound
48 }
49 }
50 else
51 {
52 // When an AI Agent touches the barbed wire
53 if (obj.IsInherited(ManBase))
54 {
55 ManBase AI_unit = ManBase.Cast(obj);
56 AI_unit.SetHealth("", "", 0);
57 }
58 }
59 }
60 }
61 }
DayZGame g_Game
Definition DayZGame.c:3528
proto native CGame GetGame()

References g_Game, GetGame(), m_ParentBarbedWire, SoundCollision(), and SoundElectricShock().

◆ SetParentObject()

void BarbedWireTrigger::SetParentObject ( ItemBase wire)
inlineprivate

Definition at line 64 of file BarbedWireTrigger.c.

65 {
66 if (g_Game.IsServer())
68 }

References g_Game, and m_ParentBarbedWire.

◆ SoundCollision()

void BarbedWireTrigger::SoundCollision ( )
inlineprivate

Definition at line 79 of file BarbedWireTrigger.c.

80 {
84 }
void PlaySound()
static const int SOUNDS_COLLISION_COUNT
static const string m_SoundsCollision[SOUNDS_COLLISION_COUNT]
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

References m_SoundsCollision, PlaySound(), Math::RandomInt(), and SOUNDS_COLLISION_COUNT.

Referenced by OnEnter().

◆ SoundElectricShock()

void BarbedWireTrigger::SoundElectricShock ( )
inlineprivate

Definition at line 71 of file BarbedWireTrigger.c.

72 {
76 }
static const int SOUNDS_SHOCK_COUNT
static const string m_SoundsShock[SOUNDS_SHOCK_COUNT]

References m_SoundsShock, PlaySound(), Math::RandomInt(), and SOUNDS_SHOCK_COUNT.

Referenced by OnEnter().

Member Data Documentation

◆ m_ParentBarbedWire

ItemBase BarbedWireTrigger::m_ParentBarbedWire
private

Definition at line 4 of file BarbedWireTrigger.c.

Referenced by OnEnter(), and SetParentObject().

◆ m_SoundsCollision

const string BarbedWireTrigger::m_SoundsCollision[SOUNDS_COLLISION_COUNT] = {"barbedFenceCollision1", "barbedFenceCollision2", "barbedFenceCollision3", "barbedFenceCollision4"}
staticprivate

Definition at line 7 of file BarbedWireTrigger.c.

7{"barbedFenceCollision1", "barbedFenceCollision2", "barbedFenceCollision3", "barbedFenceCollision4"};

Referenced by SoundCollision().

◆ m_SoundsShock

const string BarbedWireTrigger::m_SoundsShock[SOUNDS_SHOCK_COUNT] = {"electricFenceShock1", "electricFenceShock2", "electricFenceShock3", "electricFenceShock4"}
staticprivate

Definition at line 8 of file BarbedWireTrigger.c.

8{"electricFenceShock1", "electricFenceShock2", "electricFenceShock3", "electricFenceShock4"};

Referenced by SoundElectricShock().

◆ SOUNDS_COLLISION_COUNT

const int BarbedWireTrigger::SOUNDS_COLLISION_COUNT = 4
staticprivate

Definition at line 5 of file BarbedWireTrigger.c.

Referenced by SoundCollision().

◆ SOUNDS_SHOCK_COUNT

const int BarbedWireTrigger::SOUNDS_SHOCK_COUNT = 4
staticprivate

Definition at line 6 of file BarbedWireTrigger.c.

Referenced by SoundElectricShock().


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