DayZ 1.24
Loading...
Searching...
No Matches
Mask.c
Go to the documentation of this file.
2{
5
6 const float STAMINA_RECOVERY_MODIFIER = 0.5;
7 const float STAMINA_DEPLETION_MODIFIER = 1.25;
8
11
12 const float LOW_FILTER_SOUND_THRESHOLD = 0.2;//[0..1] , what's the filter quantity between 0 and 1 at which low filter sounds begin playing ?
13
16
24
26 {
27 return MaskBase.Cast(player.GetInventory().FindAttachment(InventorySlots.MASK)) != null;
28 }
29
31 {
33 }
34
35 override void OnTick(PlayerBase player, float deltaT)
36 {
37 MaskBase mask = MaskBase.Cast(player.GetInventory().FindAttachment(InventorySlots.MASK));
38
40
41 bool inside_area = m_Manager.IsModifierActive(eModifiers.MDF_AREAEXPOSURE);
42
43 if (inside_area)
45
46 if (mask && !mask.IsDamageDestroyed())
47 {
48 bool consuming_filter = mask.ConsumeQuantity(consume_quantity * deltaT, player);
49 StaminaSoundHandlerServer.Cast(player.GetPlayerSoundManagerServer().GetHandler(eSoundHandlers.STAMINA)).SetStaminaZoneOffset(1);
50
51 if (mask.HasValidFilter())
52 {
53 player.GetStaminaHandler().ActivateRecoveryModifier(EStaminaMultiplierTypes.MASK);
54 player.GetStaminaHandler().ActivateDepletionModifier(EStaminaMultiplierTypes.MASK);
55
56 }
57 else
58 {
59 player.GetStaminaHandler().DeactivateRecoveryModifier(EStaminaMultiplierTypes.MASK);
60 player.GetStaminaHandler().DeactivateDepletionModifier(EStaminaMultiplierTypes.MASK);
61 }
63 }
64 }
65
67 {
68 float filter_quantity_01 = mask.GetFilterQuantity01();
69
70 if (mask.CanHaveExternalFilter() && !mask.IsExternalFilterAttached())
71 return;
72
74 return;
75
76 float low_quantity_norm = Math.InverseLerp(0, LOW_FILTER_SOUND_THRESHOLD, filter_quantity_01);//should give us 0..1 based on normalized quantity between 0 and LOW_FILTER_SOUND_THRESHOLD
77
80 {
82
83 EPlayerSoundEventID event_type = EPlayerSoundEventID.STAMINA_LOW_FILTER_UPPER;
84 //under 50% of low filter quantity (not overall filter quantity!!)
85 if (low_quantity_norm < 0.5)
86 event_type = EPlayerSoundEventID.STAMINA_LOW_FILTER_MID;
87 if (low_quantity_norm < 0.25)
88 event_type = EPlayerSoundEventID.STAMINA_LOW_FILTER_LOWER;
89 player.RequestSoundEventEx(event_type, false, EPlayerSoundEventParam.HIGHEST_PRIORITY);
91 }
92 }
93
95 {
97 }
98
100 {
101 //m_NextSoundEventTime = Math.RandomFloat(LOW_FILTER_SOUND_EVENT_MIN, LOW_FILTER_SOUND_EVENT_MAX);
102 }
103
105 {
106 StaminaSoundHandlerServer.Cast(player.GetPlayerSoundManagerServer().GetHandler(eSoundHandlers.STAMINA)).SetStaminaZoneOffset(0);
107 player.GetStaminaHandler().DeactivateRecoveryModifier(EStaminaMultiplierTypes.MASK);
108 player.GetStaminaHandler().DeactivateDepletionModifier(EStaminaMultiplierTypes.MASK);
109 }
110
111
112};
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
ModifiersManager m_Manager
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
eSoundHandlers
EStaminaMultiplierTypes
provides access to slot configuration
Definition Mask.c:2
const float STAMINA_RECOVERY_MODIFIER
Definition Mask.c:6
override void Init()
Definition Mask.c:17
const float LOW_FILTER_SOUND_EVENT_MAX
Definition Mask.c:10
const float LOW_FILTER_SOUND_THRESHOLD
Definition Mask.c:12
override bool ActivateCondition(PlayerBase player)
Definition Mask.c:25
void HandleSounds(PlayerBase player, float deltaT, MaskBase mask)
Definition Mask.c:66
float m_SoundTimeAccu1
Definition Mask.c:14
override void OnTick(PlayerBase player, float deltaT)
Definition Mask.c:35
override void OnDeactivate(PlayerBase player)
Definition Mask.c:104
override bool DeactivateCondition(PlayerBase player)
Definition Mask.c:30
const float OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC
Definition Mask.c:4
const float IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC
Definition Mask.c:3
override void OnActivate(PlayerBase player)
Definition Mask.c:99
const float LOW_FILTER_SOUND_EVENT_MIN
Definition Mask.c:9
override void OnReconnect(PlayerBase player)
Definition Mask.c:94
float m_NextSoundEventTime
Definition Mask.c:15
const float STAMINA_DEPLETION_MODIFIER
Definition Mask.c:7
Definition EnMath.c:7
eModifiers
Definition eModifiers.c:2
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
class HumanMovementState OnActivate()
HumanCommandScript fully scriptable command.
Definition human.c:1167