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

Private Member Functions

override void Init ()
 
override bool ActivateCondition (PlayerBase player)
 
override bool DeactivateCondition (PlayerBase player)
 
override void OnTick (PlayerBase player, float deltaT)
 
void HandleSounds (PlayerBase player, float deltaT, MaskBase mask)
 
override void OnReconnect (PlayerBase player)
 
override void OnActivate (PlayerBase player)
 
override void OnDeactivate (PlayerBase player)
 

Private Attributes

const float IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.3
 
const float OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.03
 
const float STAMINA_RECOVERY_MODIFIER = 0.5
 
const float STAMINA_DEPLETION_MODIFIER = 1.25
 
const float LOW_FILTER_SOUND_EVENT_MIN = 3
 
const float LOW_FILTER_SOUND_EVENT_MAX = 9
 
const float LOW_FILTER_SOUND_THRESHOLD = 0.2
 
float m_SoundTimeAccu1
 
float m_NextSoundEventTime
 

Detailed Description

Definition at line 1 of file Mask.c.

Member Function Documentation

◆ ActivateCondition()

override bool MaskMdfr::ActivateCondition ( PlayerBase player)
inlineprivate

Definition at line 25 of file Mask.c.

26 {
27 return MaskBase.Cast(player.GetInventory().FindAttachment(InventorySlots.MASK)) != null;
28 }
provides access to slot configuration

Referenced by DeactivateCondition().

◆ DeactivateCondition()

override bool MaskMdfr::DeactivateCondition ( PlayerBase player)
inlineprivate

Definition at line 30 of file Mask.c.

31 {
33 }
override bool ActivateCondition(PlayerBase player)
Definition Mask.c:25

References ActivateCondition().

◆ HandleSounds()

void MaskMdfr::HandleSounds ( PlayerBase player,
float deltaT,
MaskBase mask )
inlineprivate

Definition at line 66 of file Mask.c.

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 }
const float LOW_FILTER_SOUND_EVENT_MAX
Definition Mask.c:10
const float LOW_FILTER_SOUND_THRESHOLD
Definition Mask.c:12
float m_SoundTimeAccu1
Definition Mask.c:14
const float LOW_FILTER_SOUND_EVENT_MIN
Definition Mask.c:9
float m_NextSoundEventTime
Definition Mask.c:15
Definition EnMath.c:7
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,...

References Math::InverseLerp(), Math::Lerp(), LOW_FILTER_SOUND_EVENT_MAX, LOW_FILTER_SOUND_EVENT_MIN, LOW_FILTER_SOUND_THRESHOLD, m_NextSoundEventTime, and m_SoundTimeAccu1.

Referenced by OnTick().

◆ Init()

override void MaskMdfr::Init ( )
inlineprivate

Definition at line 17 of file Mask.c.

18 {
20 m_ID = eModifiers.MDF_MASK;
23 }
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_ACTIVE_SHORT
eModifiers
Definition eModifiers.c:2

References DEFAULT_TICK_TIME_ACTIVE_SHORT, DEFAULT_TICK_TIME_INACTIVE, m_ID, m_TickIntervalActive, m_TickIntervalInactive, and m_TrackActivatedTime.

◆ OnActivate()

override void MaskMdfr::OnActivate ( PlayerBase player)
inlineprivate

Definition at line 99 of file Mask.c.

100 {
101 //m_NextSoundEventTime = Math.RandomFloat(LOW_FILTER_SOUND_EVENT_MIN, LOW_FILTER_SOUND_EVENT_MAX);
102 }

◆ OnDeactivate()

override void MaskMdfr::OnDeactivate ( PlayerBase player)
inlineprivate

Definition at line 104 of file Mask.c.

105 {
106 StaminaSoundHandlerServer.Cast(player.GetPlayerSoundManagerServer().GetHandler(eSoundHandlers.STAMINA)).SetStaminaZoneOffset(0);
107 player.GetStaminaHandler().DeactivateRecoveryModifier(EStaminaMultiplierTypes.MASK);
108 player.GetStaminaHandler().DeactivateDepletionModifier(EStaminaMultiplierTypes.MASK);
109 }
eSoundHandlers
EStaminaMultiplierTypes

◆ OnReconnect()

override void MaskMdfr::OnReconnect ( PlayerBase player)
inlineprivate

Definition at line 94 of file Mask.c.

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

References OnActivate().

◆ OnTick()

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

Definition at line 35 of file Mask.c.

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 }
ModifiersManager m_Manager
void HandleSounds(PlayerBase player, float deltaT, MaskBase mask)
Definition Mask.c:66
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

References HandleSounds(), IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC, m_Manager, and OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC.

Member Data Documentation

◆ IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC

const float MaskMdfr::IN_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.3
private

Definition at line 3 of file Mask.c.

Referenced by OnTick().

◆ LOW_FILTER_SOUND_EVENT_MAX

const float MaskMdfr::LOW_FILTER_SOUND_EVENT_MAX = 9
private

Definition at line 10 of file Mask.c.

Referenced by HandleSounds().

◆ LOW_FILTER_SOUND_EVENT_MIN

const float MaskMdfr::LOW_FILTER_SOUND_EVENT_MIN = 3
private

Definition at line 9 of file Mask.c.

Referenced by HandleSounds().

◆ LOW_FILTER_SOUND_THRESHOLD

const float MaskMdfr::LOW_FILTER_SOUND_THRESHOLD = 0.2
private

Definition at line 12 of file Mask.c.

Referenced by HandleSounds().

◆ m_NextSoundEventTime

float MaskMdfr::m_NextSoundEventTime
private

Definition at line 15 of file Mask.c.

Referenced by HandleSounds().

◆ m_SoundTimeAccu1

float MaskMdfr::m_SoundTimeAccu1
private

Definition at line 14 of file Mask.c.

Referenced by HandleSounds().

◆ OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC

const float MaskMdfr::OUT_AREA_CONSUME_FILTER_QUANTITY_PER_SEC = 0.03
private

Definition at line 4 of file Mask.c.

Referenced by OnTick().

◆ STAMINA_DEPLETION_MODIFIER

const float MaskMdfr::STAMINA_DEPLETION_MODIFIER = 1.25
private

Definition at line 7 of file Mask.c.

Referenced by StaminaHandler::Init().

◆ STAMINA_RECOVERY_MODIFIER

const float MaskMdfr::STAMINA_RECOVERY_MODIFIER = 0.5
private

Definition at line 6 of file Mask.c.

Referenced by StaminaHandler::Init().


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