Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
shock.c
Go to the documentation of this file.
2{
3 private const float UNCONSCIOUS_LIMIT = 50;
4 private const float SHOCK_INCREMENT_PER_SEC = 1;
5
6 override void Init()
7 {
8 m_ID = eModifiers.MDF_SHOCK;
11 //DisableActivateCheck();
13 }
14
15 override bool ActivateCondition(PlayerBase player)
16 {
17 return true;
18 }
19
20 override bool DeactivateCondition(PlayerBase player)
21 {
22 return false;
23 }
24
25 override void OnActivate(PlayerBase player)
26 {
27 }
28
29 override void OnDeactivate(PlayerBase player)
30 {
31 }
32
33 float GetRefillSpeed(PlayerBase player)
34 {
35 if ( player.m_IsDrowning )
36 {
37 return 0;
38 }
39 if ( player.IsUnconscious() )
40 {
41 if ( player.GetHealth("GlobalHealth", "Blood") <= PlayerConstants.SL_BLOOD_CRITICAL )
42 {
43 return CfgGameplayHandler.GetShockRefillSpeedUnconscious() * player.m_UnconRefillModifier * PlayerConstants.SHOCK_REFILL_UNCON_CRITICAL_BLOOD_MLTP;
44 }
45 else
46 {
47 return CfgGameplayHandler.GetShockRefillSpeedUnconscious() * player.m_UnconRefillModifier;
48 }
49 }
50 if (player.GetBrokenLegs() != eBrokenLegs.BROKEN_LEGS || (player.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || player.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE))
51 {
52 return CfgGameplayHandler.GetShockRefillSpeedConscious();
53 }
54 if ( player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS && (player.IsSwimming() || player.IsClimbingLadder()) )
55 {
56 return CfgGameplayHandler.GetShockRefillSpeedUnconscious();
57 }
58 return 0; //Block shock regen when standing with broken legs
59 }
60
61 override void OnTick(PlayerBase player, float deltaT)
62 {
63 //Print("m_UnconRefillModifier" + player.m_UnconRefillModifier);
64 if ( GetGame().GetTime() > player.m_LastShockHitTime + PlayerConstants.SHOCK_REFILL_COOLDOWN_AFTER_HIT && player.GetPulseType() == EPulseType.REGULAR)
65 {
66 if (!player.IsUnconscious())
67 player.m_UnconRefillModifier = 1;//reset this UnconRefillModifier some time after the player has been hit(we want the UnconRefillModifier to only apply to uncon induced by a projectile)
68
69 if (player.GetHealth01("","Shock") == 1)//no need to continue if the shock is full
70 return;
71
72 if ( !CfgGameplayHandler.GetAllowRefillSpeedModifier() )
73 player.m_UnconRefillModifier = 1;
74
75 player.AddHealth("","Shock", deltaT * GetRefillSpeed(player) );
76 }
77 }
78
79 override void OnReconnect(PlayerBase player)
80 {
81
82 }
83};
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
eBrokenLegs
Definition ebrokenlegs.c:2
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition effect.c:51
eModifiers
Definition emodifiers.c:2
EPulseType
Definition epulsetype.c:2
proto native CGame GetGame()
void DisableDeactivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
float GetTime()
void OnActivate()