DayZ 1.24
Loading...
Searching...
No Matches
PlayerSoundEventHandler.c
Go to the documentation of this file.
38
40{
42 const int SOUND_EVENTS_MAX = EPlayerSoundEventID.ENUM_COUNT;
47
48
50 {
52
53 if (!m_UpdateTimer && !m_Player.IsControlledPlayer())
54 {
55 m_UpdateTimer = new Timer();
56 m_UpdateTimer.Run(1, this, "OnTick", null, true);//ticking for remotes, the controlled player is ticking on command handler at higher intervals
57 }
58
61 RegisterState(new FatigueSoundEvent());
69 RegisterState(new DamageHeavySoundEvent());
75 RegisterState(new MeleeAttackHeavyEvent());
81 RegisterState(new HotSoundEvent());
84 RegisterState(new StaminaLowFilterLower());
86 RegisterState(new DrowningEvent2());
89
90
91 }
92
94 {
95 int index = state.GetSoundEventID();
97 m_ConfigIDToScriptIDmapping.Insert(state.GetSoundVoiceAnimEventClassID(), index);
98 }
99
100
101 void OnTick(float delta_time)
102 {
103 if (m_CurrentState)
104 {
105 if (m_CurrentState.IsFinished())
107 else
109 }
110 }
111
116
118 {
119 return m_AvailableStates[id].GetSoundEventType();
120 }
121
123 {
124 if (m_CurrentState)
125 return m_CurrentState.GetSoundEventID();
126 return -1;
127 }
128
130 {
131 if (m_CurrentState)
132 return m_CurrentState.GetSoundEventType();
133 return -1;
134 }
135
136 override bool PlayRequestEx(EPlayerSoundEventID id, bool sent_from_server = false, int param = 0)
137 {
139 Error("EPlayerSoundEventID out of bounds");
140
142 if (sent_from_server && (param & EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER) && m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
143 return false;
144
145 if (!requested_state.CanPlay(m_Player))
146 return false;
147
148 if (m_CurrentState)
149 {
150 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
151 m_CurrentState.Stop();
152 else
153 {
154 int current_type = m_CurrentState.GetSoundEventType();
155 //int requested_type = requested_state.GetSoundEventType();
156
157 if ((requested_state.GetPriorityOverTypes() & current_type) == 0)
158 return false;
159 if (!requested_state.HasPriorityOverCurrent(m_Player, id, current_type))
160 return false;
161
162 m_CurrentState.Stop();
163 }
164 }
165 m_CurrentState = PlayerSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
167 if (m_CurrentState.Play())
168 m_CurrentState.OnPlay(m_Player);
169 return true;
170 }
171
172
173 override bool PlayRequest(EPlayerSoundEventID id, bool sent_from_server = false)
174 {
176 }
177
178}
class DamageSoundEvents extends PlayerSoundEventBase DamageLightSoundEvent()
class DrowningSoundEventBase extends PlayerSoundEventBase DrowningEvent1()
DayZPlayer m_Player
Definition Hand_Events.c:42
class HeatComfortEventsBase extends PlayerSoundEventBase FreezingSoundEvent()
class ExhaustedBreathSoundEvent extends HoldBreathSoundEventBase ReleaseBreathSoundEvent()
void ExhaustedBreathSoundEvent()
class HoldBreathSoundEventBase extends PlayerSoundEventBase HoldBreathSoundEvent()
ref InfectedSoundEventBase m_CurrentState
static ref InfectedSoundEventBase m_AvailableStates[SOUND_EVENTS_MAX]
override int GetCurrentStateEventID()
enum EInfectedSoundEventID SOUND_EVENTS_MAX
override int GetCurrentStateEventType()
class InjuryMediumSoundEvent extends InjurySoundEvents InjuryHeavySoundEvent()
class InjurySoundEvents extends PlayerSoundEventBase InjuryLightSoundEvent()
void InjuryMediumSoundEvent()
class JumpEventsBase extends PlayerSoundEventBase JumpSoundEvent()
Definition JumpEvents.c:33
class MeleeAttackSoundEvents extends PlayerSoundEventBase MeleeAttackLightEvent()
Definition MeleeAttack.c:31
class PickupHeavySoundEvent extends PlayerSoundEventBase ThirstSoundEvent()
Definition MiscEvents.c:14
void PickupHeavySoundEvent()
Definition MiscEvents.c:15
void OnTick(PlayerBase player, float deltaT)
EPlayerSoundEventType
override bool PlayRequestEx(EPlayerSoundEventID id, bool sent_from_server=false, int param=0)
void RegisterState(PlayerSoundEventBase state)
static ref map< int, int > m_ConfigIDToScriptIDmapping
void PlayerSoundEventHandler(PlayerBase player)
@ EXHAUSTED_BREATH
@ STAMINA_UP_LIGHT
@ MELEE_ATTACK_LIGHT
@ STAMINA_LOW_FILTER_LOWER
@ STAMINA_NORMAL_DUMMY
@ STAMINA_LOW_FILTER_UPPER
@ STAMINA_DOWN_LIGHT
@ STAMINA_DOWN_HEAVY
@ STAMINA_LOW_FILTER_MID
@ STAMINA_UP_HEAVY
int ConvertAnimIDtoEventID(int anim_id)
ref Timer m_UpdateTimer
Definition RadialMenu.c:20
EAnimPlayState PlayRequest()
int GetSoundEventType()
class StaminaDownHeavy extends StaminaSoundEventBase StaminaUpHeavy()
class StaminaUpLight extends StaminaSoundEventBase StaminaUpEnd()
void StaminaDownHeavy()
class StaminaSoundEventBase extends PlayerSoundEventBase StaminaDownLight()
void StaminaNormalDummy()
void StaminaUpLight()
void StaminaLowFilterUpper()
class StaminaLowFilterUpper extends StaminaLowFilterBase StaminaLowFilterMid()
class SymptomSoundEventBase extends PlayerSoundEventBase CoughSoundEvent()
void LaugherSoundEvent()
class LaugherSoundEvent extends SymptomSoundEventBase SneezeSoundEvent()
DayZPlayerInstanceType
defined in C++
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90