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

Protected Member Functions

void Disarm ()
 
void OnRingingStopClient ()
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override void SetAlarmTimeServer (float time01)
 
void SetAlarmTimeServerSecs (int inSecs)
 
override void GetDebugActions (out TSelectableActionInfoArrayEx outputList)
 
override bool OnAction (int action_id, Man player, ParamsReadContext ctx)
 
override string GetDebugText ()
 

Private Member Functions

override void Init ()
 
override void SetActions ()
 
override string GetExplosiveTriggerSlotName ()
 
override string GetToggleSound ()
 
override string GetRingingSound ()
 
string GetRingingStopSound ()
 
override string GetDestroyedSound ()
 
override string GetHitSound ()
 
override string GetWorkingSound ()
 
int GetMinutesMax ()
 
int Time01ToSeconds (float time01)
 
float SecondsTo01 (int seconds)
 
override float GetRingingDurationMax ()
 
override void TurnOff ()
 
void OnUpdate ()
 

Private Attributes

const string RINGING_SOUND = "KitchenTimer_Ring_Loop_SoundSet"
 
const string DESTROYED_SOUND = "AlarmClock_Destroyed_SoundSet"
 
const string HIT_SOUND = "AlarmClock_Hit_SoundSet"
 
const string WORKING_SOUND = "KitchenTimer_Ticking_Loop_SoundSet"
 
EffectSound m_RingingStopSound
 
int m_AlarmInSecs
 

Static Private Attributes

static ref NoiseParams m_NoisePar
 
static NoiseSystem m_NoiseSystem
 

Detailed Description

Definition at line 1 of file KitchenTimer.c.

Member Function Documentation

◆ Disarm()

void KitchenTimer::Disarm ( )
inlineprotected

Definition at line 124 of file KitchenTimer.c.

125 {
126 super.Disarm();
128 }
void SetAlarmTimeServerSecs(int inSecs)

References SetAlarmTimeServerSecs().

◆ GetDebugActions()

override void KitchenTimer::GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
inlineprotected

Definition at line 198 of file KitchenTimer.c.

199 {
200 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ALARM_SET_AHEAD, "Set Alarm Ahead", FadeColors.LIGHT_GREY));
201 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
202
203 super.GetDebugActions(outputList);
204 }
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
EActions
Definition EActions.c:2
const int SAT_DEBUG_ACTION
Definition constants.c:424

References SAT_DEBUG_ACTION.

◆ GetDebugText()

override string KitchenTimer::GetDebugText ( )
inlineprotected

Definition at line 219 of file KitchenTimer.c.

220 {
221 string debug_output;
222
223 if (GetGame().IsDedicatedServer())
224 {
225 debug_output = "alarm in: " + m_AlarmInSecs.ToString() + " secs" + "\n";
226 debug_output += "current state: " + typename.EnumToString(EAlarmClockState, m_State) + "\n";
227 debug_output += "ringing for " + m_RingingDuration.ToString() + " secs" + "\n";
228 debug_output += "ringing max " + GetRingingDurationMax().ToString() + " secs" + "\n";
229 }
230 else
231 debug_output = "this is client";
232
233 return debug_output;
234 }
float m_RingingDuration
Definition ClockBase.c:16
EAlarmClockState
Definition ClockBase.c:2
bool m_State
override float GetRingingDurationMax()
proto string ToString()
proto native CGame GetGame()

References GetGame(), GetRingingDurationMax(), m_AlarmInSecs, m_RingingDuration, m_State, and float::ToString().

◆ GetDestroyedSound()

override string KitchenTimer::GetDestroyedSound ( )
inlineprivate

Definition at line 58 of file KitchenTimer.c.

59 {
60 return DESTROYED_SOUND;
61 }
const string DESTROYED_SOUND
Definition KitchenTimer.c:4

References DESTROYED_SOUND.

◆ GetExplosiveTriggerSlotName()

override string KitchenTimer::GetExplosiveTriggerSlotName ( )
inlineprivate

Definition at line 38 of file KitchenTimer.c.

39 {
40 return "TriggerKitchenTimer";
41 }

◆ GetHitSound()

override string KitchenTimer::GetHitSound ( )
inlineprivate

Definition at line 63 of file KitchenTimer.c.

64 {
65 return HIT_SOUND;
66 }
const string HIT_SOUND
Definition KitchenTimer.c:5

References HIT_SOUND.

◆ GetMinutesMax()

int KitchenTimer::GetMinutesMax ( )
inlineprivate

Definition at line 73 of file KitchenTimer.c.

74 {
75 return 45;
76 }

Referenced by SecondsTo01(), and Time01ToSeconds().

◆ GetRingingDurationMax()

override float KitchenTimer::GetRingingDurationMax ( )
inlineprivate

Definition at line 89 of file KitchenTimer.c.

90 {
91 return 60;
92 }

Referenced by GetDebugText(), and OnUpdate().

◆ GetRingingSound()

override string KitchenTimer::GetRingingSound ( )
inlineprivate

Definition at line 48 of file KitchenTimer.c.

49 {
50 return RINGING_SOUND;
51 }
const string RINGING_SOUND
Definition KitchenTimer.c:3

References RINGING_SOUND.

◆ GetRingingStopSound()

string KitchenTimer::GetRingingStopSound ( )
inlineprivate

Definition at line 53 of file KitchenTimer.c.

54 {
55 return "KitchenTimer_Ring_End_SoundSet";
56 }

Referenced by OnRingingStopClient().

◆ GetToggleSound()

override string KitchenTimer::GetToggleSound ( )
inlineprivate

Definition at line 43 of file KitchenTimer.c.

44 {
45 return "";
46 }

◆ GetWorkingSound()

override string KitchenTimer::GetWorkingSound ( )
inlineprivate

Definition at line 68 of file KitchenTimer.c.

69 {
70 return WORKING_SOUND;
71 }
const string WORKING_SOUND
Definition KitchenTimer.c:6

References WORKING_SOUND.

◆ Init()

override void KitchenTimer::Init ( )
inlineprivate

Definition at line 14 of file KitchenTimer.c.

15 {
16 super.Init();
17
18 if (GetGame().IsServer())
19 {
20 m_NoiseSystem = GetGame().GetNoiseSystem();
22 {
23 // Create and load noise parameters
25 m_NoisePar.LoadFromPath("cfgVehicles " + GetType() + " NoiseKitchenTimer");
26 }
27 }
28 }
eBleedingSourceType GetType()
class NoiseSystem NoiseParams()
Definition Noise.c:15
static ref NoiseParams m_NoisePar
Definition KitchenTimer.c:9
static NoiseSystem m_NoiseSystem

References GetGame(), GetType(), m_NoisePar, m_NoiseSystem, and NoiseParams().

◆ OnAction()

override bool KitchenTimer::OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
inlineprotected

Definition at line 206 of file KitchenTimer.c.

207 {
208 if (super.OnAction(action_id, player, ctx))
209 return true;
210
211 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
212 {
213 if (action_id == EActions.ALARM_SET_AHEAD)
215 }
216 return false;
217 }

References GetGame(), and SetAlarmTimeServerSecs().

◆ OnRingingStopClient()

void KitchenTimer::OnRingingStopClient ( )
inlineprotected

Definition at line 130 of file KitchenTimer.c.

131 {
133 PlaySoundSet(m_RingingStopSound, GetRingingStopSound(), 0, 0);
134
135 super.OnRingingStopClient();
136
137 }
EffectSound m_RingingSoundLoop
Definition ClockBase.c:19
EffectSound m_RingingStopSound
Definition KitchenTimer.c:8
string GetRingingStopSound()

References GetRingingStopSound(), m_RingingSoundLoop, and m_RingingStopSound.

◆ OnStoreLoad()

override bool KitchenTimer::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 139 of file KitchenTimer.c.

140 {
141 if (!super.OnStoreLoad(ctx, version))
142 return false;
143
144 if (version < 128)
145 return true;
146
148
149 if (!ctx.Read(state))
150 return false;
151
152 int time;
153 if (!ctx.Read(time))
154 return false;
155
157
158 if (state == EAlarmClockState.SET)
160 else if (state == EAlarmClockState.RINGING)
162
163 return true;
164 }
void MakeRingingStart()
Definition ClockBase.c:213
void SetState(bool state)

References MakeRingingStart(), SetAlarmTimeServerSecs(), and SetState().

◆ OnStoreSave()

override void KitchenTimer::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 166 of file KitchenTimer.c.

167 {
168 super.OnStoreSave(ctx);
169
170 ctx.Write(m_State);
171 ctx.Write(m_AlarmInSecs);
172 }

References m_AlarmInSecs, and m_State.

◆ OnUpdate()

void KitchenTimer::OnUpdate ( )
inlineprivate

Definition at line 100 of file KitchenTimer.c.

101 {
102 if (m_AlarmInSecs > 0)
103 {
106 SetAnimationPhaseNow("ClockAlarm", time01);
107 if (IsRinging())
109 }
110 else if (!IsRinging())
112
113 if (IsRinging())
114 {
116
118 TurnOff();
119 else if (m_NoiseSystem)
121 }
122 }
bool IsRinging()
Definition ClockBase.c:269
static const float UPDATE_TICK_RATE
Definition ClockBase.c:14
void MakeRingingStop()
Definition ClockBase.c:222
class JsonUndergroundAreaTriggerData GetPosition
override void TurnOff()
float SecondsTo01(int seconds)

References GetPosition, GetRingingDurationMax(), IsRinging(), m_AlarmInSecs, m_NoisePar, m_NoiseSystem, m_RingingDuration, MakeRingingStart(), MakeRingingStop(), SecondsTo01(), TurnOff(), and UPDATE_TICK_RATE.

◆ SecondsTo01()

float KitchenTimer::SecondsTo01 ( int seconds)
inlineprivate

Definition at line 84 of file KitchenTimer.c.

85 {
86 return Math.InverseLerp(0, GetMinutesMax() * 60, seconds);
87 }
int GetMinutesMax()
Definition EnMath.c:7
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...

References GetMinutesMax(), and Math::InverseLerp().

Referenced by OnUpdate(), and SetAlarmTimeServerSecs().

◆ SetActions()

override void KitchenTimer::SetActions ( )
inlineprivate

Definition at line 30 of file KitchenTimer.c.

31 {
32 super.SetActions();
33
36 }
ActionResetKitchenTimerClockCB ActionSingleUseBaseCB ActionResetKitchenTimer()
void AddAction(typename actionName)

References ActionResetKitchenTimer(), and AddAction().

◆ SetAlarmTimeServer()

override void KitchenTimer::SetAlarmTimeServer ( float time01)
inlineprotected

Definition at line 179 of file KitchenTimer.c.

180 {
181 SetAnimationPhaseNow("ClockAlarm", time01);
183
184 if (m_AlarmInSecs > 0)
185 TurnOn();
186 }
void TurnOn()
Definition ClockBase.c:279
int Time01ToSeconds(float time01)

References m_AlarmInSecs, Time01ToSeconds(), and TurnOn().

Referenced by SetAlarmTimeServerSecs().

◆ SetAlarmTimeServerSecs()

void KitchenTimer::SetAlarmTimeServerSecs ( int inSecs)
inlineprotected

Definition at line 188 of file KitchenTimer.c.

189 {
191 }
override void SetAlarmTimeServer(float time01)

References SecondsTo01(), and SetAlarmTimeServer().

Referenced by Disarm(), OnAction(), and OnStoreLoad().

◆ Time01ToSeconds()

int KitchenTimer::Time01ToSeconds ( float time01)
inlineprivate

Definition at line 78 of file KitchenTimer.c.

79 {
80 return Math.Lerp(0, GetMinutesMax() * 60, time01);
81 }
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.

References GetMinutesMax(), and Math::Lerp().

Referenced by SetAlarmTimeServer().

◆ TurnOff()

override void KitchenTimer::TurnOff ( )
inlineprivate

Definition at line 94 of file KitchenTimer.c.

95 {
96 super.TurnOff();
98 }
EffectSound m_WorkingSound
Definition ClockBase.c:23
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.

References SEffectManager::DestroyEffect(), and m_WorkingSound.

Referenced by OnUpdate().

Member Data Documentation

◆ DESTROYED_SOUND

const string KitchenTimer::DESTROYED_SOUND = "AlarmClock_Destroyed_SoundSet"
private

Definition at line 4 of file KitchenTimer.c.

Referenced by GetDestroyedSound().

◆ HIT_SOUND

const string KitchenTimer::HIT_SOUND = "AlarmClock_Hit_SoundSet"
private

Definition at line 5 of file KitchenTimer.c.

Referenced by GetHitSound().

◆ m_AlarmInSecs

int KitchenTimer::m_AlarmInSecs
private

Definition at line 12 of file KitchenTimer.c.

Referenced by GetDebugText(), OnStoreSave(), OnUpdate(), and SetAlarmTimeServer().

◆ m_NoisePar

ref NoiseParams KitchenTimer::m_NoisePar
staticprivate

Definition at line 9 of file KitchenTimer.c.

Referenced by Init(), and OnUpdate().

◆ m_NoiseSystem

NoiseSystem KitchenTimer::m_NoiseSystem
staticprivate

Definition at line 10 of file KitchenTimer.c.

Referenced by Init(), and OnUpdate().

◆ m_RingingStopSound

EffectSound KitchenTimer::m_RingingStopSound
private

Definition at line 8 of file KitchenTimer.c.

Referenced by OnRingingStopClient().

◆ RINGING_SOUND

const string KitchenTimer::RINGING_SOUND = "KitchenTimer_Ring_Loop_SoundSet"
private

Definition at line 3 of file KitchenTimer.c.

Referenced by GetRingingSound().

◆ WORKING_SOUND

const string KitchenTimer::WORKING_SOUND = "KitchenTimer_Ticking_Loop_SoundSet"
private

Definition at line 6 of file KitchenTimer.c.

Referenced by GetWorkingSound().


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