DayZ 1.24
Loading...
Searching...
No Matches
Drowning.c
Go to the documentation of this file.
2{
3 const int TICK_FREQUENCY = 1;
4 static const float STAMINA_RECOVERY_MULTIPLIER = 0;
5
6 override void Init()
7 {
9 m_ID = eModifiers.MDF_DROWNING;
12 m_SyncID = eModifierSyncIDs.MODIFIER_SYNC_DROWNING;
13 }
14
16 {
17 return player.GetDrowningWaterLevelCheck();
18 }
19
21 {
22 return CheckIsDrowning(player);
23 }
24
26 {
27 return !CheckIsDrowning(player);
28 }
29
30 override void OnTick(PlayerBase player, float deltaT)
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 }
39
41 {
43 }
44
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 }
52
53
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 }
64
66 {
67 player.SetDrowning(false);
68 player.GetStaminaHandler().DeactivateRecoveryModifier(EStaminaMultiplierTypes.DROWNING);
69 }
70};
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
DayZPlayer m_Player
Definition Hand_Events.c:42
bool m_TrackActivatedTime
eModifierSyncIDs m_SyncID
float m_TickIntervalActive
float m_TickIntervalInactive
eModifierSyncIDs
const int DEFAULT_TICK_TIME_INACTIVE
EStaminaMultiplierTypes
static float GetShockDepletionSpeed()
static float GetHealthDepletionSpeed()
void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client=false, int param=0)
override void Init()
Definition Drowning.c:6
void PlayDrowningSound(int index)
Definition Drowning.c:54
static const float STAMINA_RECOVERY_MULTIPLIER
Definition Drowning.c:4
override bool DeactivateCondition(PlayerBase player)
Definition Drowning.c:25
bool CheckIsDrowning(PlayerBase player)
Definition Drowning.c:15
override void OnReconnect(PlayerBase player)
Definition Drowning.c:40
override void OnTick(PlayerBase player, float deltaT)
Definition Drowning.c:30
override bool ActivateCondition(PlayerBase player)
Definition Drowning.c:20
const int TICK_FREQUENCY
Definition Drowning.c:3
override void OnDeactivate(PlayerBase player)
Definition Drowning.c:65
override void OnActivate(PlayerBase player)
Definition Drowning.c:45
eModifiers
Definition eModifiers.c:2
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
class HumanMovementState OnActivate()
HumanCommandScript fully scriptable command.
Definition human.c:1167