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

Private Member Functions

override void Init ()
 
bool CheckIsDrowning (PlayerBase player)
 
override bool ActivateCondition (PlayerBase player)
 
override bool DeactivateCondition (PlayerBase player)
 
override void OnTick (PlayerBase player, float deltaT)
 
override void OnReconnect (PlayerBase player)
 
override void OnActivate (PlayerBase player)
 
void PlayDrowningSound (int index)
 
override void OnDeactivate (PlayerBase player)
 

Private Attributes

const int TICK_FREQUENCY = 1
 

Static Private Attributes

static const float STAMINA_RECOVERY_MULTIPLIER = 0
 

Detailed Description

Definition at line 1 of file Drowning.c.

Member Function Documentation

◆ ActivateCondition()

override bool DrowningMdfr::ActivateCondition ( PlayerBase player)
inlineprivate

Definition at line 20 of file Drowning.c.

21 {
22 return CheckIsDrowning(player);
23 }
bool CheckIsDrowning(PlayerBase player)
Definition Drowning.c:15

References CheckIsDrowning().

◆ CheckIsDrowning()

bool DrowningMdfr::CheckIsDrowning ( PlayerBase player)
inlineprivate

Definition at line 15 of file Drowning.c.

16 {
17 return player.GetDrowningWaterLevelCheck();
18 }

Referenced by ActivateCondition(), and DeactivateCondition().

◆ DeactivateCondition()

override bool DrowningMdfr::DeactivateCondition ( PlayerBase player)
inlineprivate

Definition at line 25 of file Drowning.c.

26 {
27 return !CheckIsDrowning(player);
28 }

References CheckIsDrowning().

◆ Init()

override void DrowningMdfr::Init ( )
inlineprivate

Definition at line 6 of file Drowning.c.

7 {
9 m_ID = eModifiers.MDF_DROWNING;
12 m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_DROWNING;
13 }
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
eModifierSyncIDs m_SyncID
float m_TickIntervalActive
float m_TickIntervalInactive
eModifierSyncIDs
const int DEFAULT_TICK_TIME_INACTIVE
const int TICK_FREQUENCY
Definition Drowning.c:3
eModifiers
Definition eModifiers.c:2

References DEFAULT_TICK_TIME_INACTIVE, m_ID, m_SyncID, m_TickIntervalActive, m_TickIntervalInactive, m_TrackActivatedTime, and TICK_FREQUENCY.

◆ OnActivate()

override void DrowningMdfr::OnActivate ( PlayerBase player)
inlineprivate

Definition at line 45 of file Drowning.c.

46 {
47 player.SetDrowning(true);
48 player.GetStaminaHandler().ActivateRecoveryModifier(EStaminaMultiplierTypes.DROWNING);
49 player.RequestSoundEventEx(EPlayerSoundEventID.DROWNING_BREATH, false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
50 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(PlayDrowningSound, 3000, false, 1);
51 }
EStaminaMultiplierTypes
void PlayDrowningSound(int index)
Definition Drowning.c:54
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, GetGame(), and PlayDrowningSound().

◆ OnDeactivate()

override void DrowningMdfr::OnDeactivate ( PlayerBase player)
inlineprivate

Definition at line 65 of file Drowning.c.

66 {
67 player.SetDrowning(false);
68 player.GetStaminaHandler().DeactivateRecoveryModifier(EStaminaMultiplierTypes.DROWNING);
69 }

◆ OnReconnect()

override void DrowningMdfr::OnReconnect ( PlayerBase player)
inlineprivate

Definition at line 40 of file Drowning.c.

41 {
43 }
class HumanMovementState OnActivate()
HumanCommandScript fully scriptable command.
Definition human.c:1167

References OnActivate().

◆ OnTick()

override void DrowningMdfr::OnTick ( PlayerBase player,
float deltaT )
inlineprivate

Definition at line 30 of file Drowning.c.

31 {
32 if (player.GetStaminaHandler().GetStamina() <= 0)
33 {
35 player.AddHealth("", "Shock", deltaT * -CfgGameplayHandler.GetShockDepletionSpeed());
36 player.RequestSoundEventEx(EPlayerSoundEventID.DROWNING_PAIN, false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
37 }
38 }
static float GetShockDepletionSpeed()
static float GetHealthDepletionSpeed()

References CfgGameplayHandler::GetHealthDepletionSpeed(), and CfgGameplayHandler::GetShockDepletionSpeed().

◆ PlayDrowningSound()

void DrowningMdfr::PlayDrowningSound ( int index)
inlineprivate

Definition at line 54 of file Drowning.c.

55 {
56 if (m_Player.m_IsDrowning)//check if we are still drowning after the delay
57 {
58 if (index == 0)
59 m_Player.RequestSoundEventEx(EPlayerSoundEventID.EXHAUSTED_BREATH, false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
60 else if (index == 1)
61 m_Player.RequestSoundEventEx(EPlayerSoundEventID.DROWNING_BREATH, false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
62 }
63 }
DayZPlayer m_Player
Definition Hand_Events.c:42
void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client=false, int param=0)

References m_Player, and DayZPlayer::RequestSoundEventEx().

Referenced by OnActivate().

Member Data Documentation

◆ STAMINA_RECOVERY_MULTIPLIER

const float DrowningMdfr::STAMINA_RECOVERY_MULTIPLIER = 0
staticprivate

Definition at line 4 of file Drowning.c.

Referenced by StaminaHandler::Init().

◆ TICK_FREQUENCY

const int DrowningMdfr::TICK_FREQUENCY = 1
private

Definition at line 3 of file Drowning.c.

Referenced by Init().


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