Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
playersoundeventbase.c
Go to the documentation of this file.
1
enum
EPlayerSoundEventType
2
{
3
GENERAL
= 0x00000001,
4
MELEE
= 0x00000002,
5
STAMINA
= 0x00000004,
6
DAMAGE
= 0x00000008,
7
DUMMY
= 0x00000010,
8
INJURY
= 0x00000020,
9
DROWNING
= 0x00000040,
10
//HEAT_COMFORT = 0x00000080,
11
}
12
13
enum
EPlayerSoundEventParam
14
{
15
SKIP_CONTROLLED_PLAYER
= 0x00000001,
16
HIGHEST_PRIORITY
= 0x00000002,
17
STOP_PLAYBACK
= 0x00000004,
18
/*
19
STAMINA = 0x00000004,
20
DAMAGE = 0x00000008,
21
DUMMY = 0x00000010,
22
INJURY = 0x00000020,
23
HEAT_COMFORT = 0x00000040,
24
*/
25
26
// ONLY COUNT BELLOW
27
ENUM_COUNT
,
28
29
}
30
31
class
PlayerSoundEventBase
extends
SoundEventBase
32
{
33
PlayerBase
m_Player
;
34
float
m_DummySoundLength
;
35
float
m_DummyStartTime
;
36
bool
m_IsDummyType
;
37
bool
m_ProcessPlaybackEvent
;
38
float
m_PlayTime
;
39
40
ref
HumanMovementState
m_Hms
=
new
HumanMovementState
();
41
EPlayerSoundEventType
m_HasPriorityOverTypes
;
42
43
bool
IsDummy
()
44
{
45
return
m_IsDummyType
;
46
}
47
48
EPlayerSoundEventType
GetPriorityOverTypes
()
49
{
50
return
m_HasPriorityOverTypes
;
51
}
52
53
// !can this event play during hold breath
54
bool
HasHoldBreathException
()
55
{
56
return
false
;
57
}
58
59
void
PlayerSoundEventBase
()
60
{
61
m_Type
=
EPlayerSoundEventType
.GENERAL;
62
}
63
64
void
~PlayerSoundEventBase
()
65
{
66
if
(!
m_SoundSetCallback
)
67
OnEnd
();
68
}
69
70
int
GetSoundVoiceAnimEventClassID
()
71
{
72
return
m_SoundVoiceAnimEventClassID
;
73
}
74
75
bool
HasPriorityOverCurrent
(
PlayerBase
player,
EPlayerSoundEventID
other_state_id,
EPlayerSoundEventType
type_other)
76
{
77
return
true
;
78
}
79
80
bool
IsFinished
()
81
{
82
if
(
IsDummy
())
83
{
84
return
IsDummyFinished
();
85
}
86
else
87
{
88
return
!
IsSoundCallbackExist
();
89
}
90
}
91
92
bool
IsDummyFinished
()
93
{
94
return
g_Game
.GetTime() > (
m_DummyStartTime
+
m_DummySoundLength
);
95
}
96
97
98
void
OnTick
(
float
delta_time)
99
{
100
if
(
m_SoundSetCallback
)
101
{
102
m_SoundSetCallback
.SetPosition(
m_Player
.GetPosition());
103
//---------- Playback event -------------
104
if
( delta_time > 0 &&
m_ProcessPlaybackEvent
)
//delta_time 0 is for remotes
105
{
106
107
m_PlayTime
+= delta_time;
108
//this is not 100% precise as the playback position is not obtained from the sound system
109
float
playback01 =
Math
.
Clamp
(
m_PlayTime
/
m_SoundSetCallback
.GetLength(),0,1);
110
SendEvent
(playback01);
111
//---------- Playback event -------------
112
}
113
}
114
}
115
116
bool
CanPlay
(
PlayerBase
player)
117
{
118
player.GetMovementState(
m_Hms
);
119
120
if
(player.IsHoldingBreath() && !
HasHoldBreathException
())
121
{
122
return
false
;
123
}
124
if
(player.m_IsDrowning || (player.IsSwimming() &&
m_Hms
.m_iMovement != 0))
125
{
126
return
false
;
127
}
128
return
true
;
129
}
130
131
void
Init
(
PlayerBase
player)
132
{
133
InitEx
(player,0);
134
}
135
136
void
InitEx
(
PlayerBase
player,
int
param)
137
{
138
m_Player
= player;
139
m_Param
= param;
140
if
(param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
141
{
142
m_HasPriorityOverTypes
= -1;
143
}
144
}
145
146
void
OnEnd
()
147
{
148
if
(
m_ProcessPlaybackEvent
)
149
SendEvent
(1);
150
}
151
152
void
SendEvent
(
float
time)
153
{
154
if
(
m_PlayTime
< 0 || !
m_SoundSetCallback
)
//negative m_PlayTime value indicates the event has already been sent for playback01 = 1
155
return
;
156
157
m_Player
.OnVoiceEventPlayback(
this
,
m_SoundSetCallback
, time);
158
if
(time >= 1)
159
m_PlayTime
= -
float
.MAX;
160
}
161
162
void
OnInterupt
()
163
{
164
165
}
166
167
override
void
OnPlay
(
PlayerBase
player)
168
{
169
super.OnPlay(player);
170
//Print("start playing -------------------->" + m_Type);
171
player.OnVoiceEvent(
this
);
172
//m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
173
}
174
175
override
bool
Play
()
176
{
177
if
(!super.Play())
178
return
false
;
179
180
if
( !
IsDummy
() )
181
{
182
m_SoundSetCallback
=
m_Player
.ProcessVoiceEvent(
""
,
""
,
m_SoundVoiceAnimEventClassID
);
183
184
if
(
m_SoundSetCallback
)
185
{
186
AbstractWaveEvents
events =
AbstractWaveEvents
.Cast(
m_SoundSetCallback
.GetUserData());
187
events.
Event_OnSoundWaveEnded
.
Insert
(
OnEnd
);
188
events.
Event_OnSoundWaveStopped
.
Insert
(
OnInterupt
);
189
return
true
;
190
}
191
else
192
return
false
;
193
}
194
else
195
{
196
m_DummyStartTime
=
g_Game
.GetTime();
197
return
true
;
198
}
199
return
false
;
200
201
}
202
}
m_Type
eBleedingSourceType m_Type
Definition
bleedingsource.c:25
m_Player
map m_Player
AbstractWaveEvents
Definition
sound.c:147
HumanMovementState
Definition
human.c:1154
Math
Definition
enmath.c:7
PlayerBase
Definition
playerbaseclient.c:2
PlayerSoundEventBase
Definition
damageevents.c:2
PlayerSoundEventBase::HasPriorityOverCurrent
override bool HasPriorityOverCurrent(PlayerBase player, EPlayerSoundEventID other_state_id, EPlayerSoundEventType type_other)
Definition
damageevents.c:15
PlayerSoundEventBase::HasHoldBreathException
override bool HasHoldBreathException()
Definition
holdbreathevents.c:8
PlayerSoundEventBase::OnEnd
override void OnEnd()
Definition
jumpevents.c:24
ScriptInvoker::Insert
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
SoundEventBase
Definition
soundevents.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Init
override Widget Init()
Definition
dayzgame.c:127
Math::Clamp
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
Play
proto void Play()
Definition
smptanimmeta.c:144
OnEnd
void OnEnd()
Definition
sound.c:226
AbstractWaveEvents::Event_OnSoundWaveEnded
ref ScriptInvoker Event_OnSoundWaveEnded
Definition
sound.c:152
AbstractWaveEvents::Event_OnSoundWaveStopped
ref ScriptInvoker Event_OnSoundWaveStopped
Definition
sound.c:149
OnPlay
void OnPlay()
Definition
sound.c:206
HasHoldBreathException
override bool HasHoldBreathException()
Definition
holdbreathevents.c:24
MELEE
@ MELEE
Definition
impacteffects.c:7
GENERAL
@ GENERAL
Definition
infectedsoundeventbase.c:3
ENUM_COUNT
@ ENUM_COUNT
Definition
infectedsoundeventhandler.c:11
CanPlay
override bool CanPlay()
Definition
mindstates.c:16
OnTick
void OnTick(PlayerBase player, float deltaT)
Definition
heavymetal.c:219
GetPriorityOverTypes
EPlayerSoundEventType GetPriorityOverTypes()
Definition
playersoundeventbase.c:48
HIGHEST_PRIORITY
enum EPlayerSoundEventType HIGHEST_PRIORITY
SKIP_CONTROLLED_PLAYER
enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER
~PlayerSoundEventBase
void ~PlayerSoundEventBase()
Definition
playersoundeventbase.c:64
EPlayerSoundEventType
EPlayerSoundEventType
Definition
playersoundeventbase.c:2
INJURY
@ INJURY
Definition
playersoundeventbase.c:8
DUMMY
@ DUMMY
Definition
playersoundeventbase.c:7
DROWNING
@ DROWNING
Definition
playersoundeventbase.c:9
DAMAGE
@ DAMAGE
Definition
playersoundeventbase.c:6
m_PlayTime
float m_PlayTime
Definition
playersoundeventbase.c:38
m_IsDummyType
bool m_IsDummyType
Definition
playersoundeventbase.c:36
m_Hms
ref HumanMovementState m_Hms
Definition
playersoundeventbase.c:40
m_DummySoundLength
float m_DummySoundLength
Definition
playersoundeventbase.c:34
STOP_PLAYBACK
enum EPlayerSoundEventType STOP_PLAYBACK
m_DummyStartTime
float m_DummyStartTime
Definition
playersoundeventbase.c:35
m_HasPriorityOverTypes
EPlayerSoundEventType m_HasPriorityOverTypes
Definition
playersoundeventbase.c:41
IsDummy
bool IsDummy()
Definition
playersoundeventbase.c:43
m_ProcessPlaybackEvent
bool m_ProcessPlaybackEvent
Definition
playersoundeventbase.c:37
InitEx
void InitEx(PlayerBase player, int param)
Definition
playersoundeventbase.c:136
IsFinished
bool IsFinished()
Definition
playersoundeventbase.c:80
PlayerSoundEventBase
void PlayerSoundEventBase()
Definition
playersoundeventbase.c:59
IsDummyFinished
bool IsDummyFinished()
Definition
playersoundeventbase.c:92
OnInterupt
void OnInterupt()
Definition
playersoundeventbase.c:162
GetSoundVoiceAnimEventClassID
int GetSoundVoiceAnimEventClassID()
Definition
playersoundeventbase.c:70
EPlayerSoundEventID
EPlayerSoundEventID
Definition
playersoundeventhandler.c:3
STAMINA
@ STAMINA
Definition
playerstatspco.c:149
SendEvent
static proto native void SendEvent(StatsEventData data)
universal analytics event
m_SoundSetCallback
AbstractWave m_SoundSetCallback
Definition
soundevents.c:86
m_SoundVoiceAnimEventClassID
int m_SoundVoiceAnimEventClassID
Definition
soundevents.c:89
IsSoundCallbackExist
bool IsSoundCallbackExist()
Definition
soundevents.c:115
m_Param
int m_Param
Definition
soundevents.c:93
Games
Dayz
scripts
4_world
classes
soundevents
playersoundevents
playersoundeventbase.c
Generated by
1.17.0