DayZ 1.24
Loading...
Searching...
No Matches
BrokenLegs.c
Go to the documentation of this file.
2{
3 private const float HEALTHY_LEG = 100; //Health at which legs are no longer considered broken
4 private int currentState = -1; //Current broken leg state used upon reconnect
5 private const float TIME_TO_UPDATE = 0.5;
6 private float elapsedTime = TIME_TO_UPDATE + 1;
7
8#ifdef DEVELOPER
9 ref static Timer timer;
10#endif
11
12 override void Init()
13 {
15 m_ID = eModifiers.MDF_BROKEN_LEGS;
18 m_ActivationType = EActivationType.TRIGGER_EVENT_ON_ACTIVATION;
19 m_IsPersistent = true;
20 }
21
23 {
24 //Print("------------> OnActivate - BrokenLegsMdfr");
25 player.SetBrokenLegs(-eBrokenLegs.BROKEN_LEGS);//note the negative sign
26 player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_FRACTURE);
27 }
28
30 {
31 //Print("------------> OnReconnect - BrokenLegsMdfr");
32 player.SetBrokenLegs(player.GetBrokenLegs());
33 player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_FRACTURE);
34 }
35
36
38 {
39 player.UpdateBrokenLegs(eBrokenLegs.NO_BROKEN_LEGS);
40 if (player.IsWearingSplint())
41 {
42 MiscGameplayFunctions.RemoveSplint(player); //Remove splint when leg is healed
43 }
44
45 player.SetBrokenLegs(eBrokenLegs.NO_BROKEN_LEGS);
46 player.GetNotifiersManager().DeactivateByType(eNotifiers.NTF_FRACTURE);
47 }
48
50 {
51 if (player.GetHealth("RightLeg", "Health") >= HEALTHY_LEG && player.GetHealth("LeftLeg", "Health") >= HEALTHY_LEG)
52
53 return true;
54 else
55 return false;
56 }
57
58 override void OnTick(PlayerBase player, float deltaT)
59 {
60 player.UpdateBrokenLegs(/*legacy param - value not used*/0);
61 }
62
63
64#ifdef DEVELOPER
65 static void DelayedRequest(PlayerBase player, bool state)
66 {
68 if (state)
69 timer.Run(10, player.GetModifiersManager().GetModifier(eModifiers.MDF_BROKEN_LEGS), "Delayed", new Param1<bool>(state));
70 else
71 BrokenLegsMdfr.Cast(player.GetModifiersManager().GetModifier(eModifiers.MDF_BROKEN_LEGS)).Delayed(false);
72 }
73
74 void Delayed(bool state)
75 {
76 m_Player.GetModifiersManager().ActivateModifier(eModifiers.MDF_BROKEN_LEGS);
77 }
78#endif
79};
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:49
DayZPlayer m_Player
Definition Hand_Events.c:42
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
EActivationType m_ActivationType
bool m_IsPersistent
EActivationType
const int DEFAULT_TICK_TIME_INACTIVE
eNotifiers
override void OnTick(PlayerBase player, float deltaT)
Definition BrokenLegs.c:58
float elapsedTime
Definition BrokenLegs.c:6
override void OnActivate(PlayerBase player)
Definition BrokenLegs.c:22
override void OnDeactivate(PlayerBase player)
Definition BrokenLegs.c:37
override void Init()
Definition BrokenLegs.c:12
override bool DeactivateCondition(PlayerBase player)
Definition BrokenLegs.c:49
const float TIME_TO_UPDATE
Definition BrokenLegs.c:5
override void OnReconnect(PlayerBase player)
Definition BrokenLegs.c:29
const float HEALTHY_LEG
Definition BrokenLegs.c:3
eModifiers
Definition eModifiers.c:2
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8