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

Protected Member Functions

void AnimateAlarmHand (float value)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override void OnDebugSpawn ()
 

Private Member Functions

override void Init ()
 
void ~AlarmClock_ColorBase ()
 
override void SetActions ()
 
override string GetToggleSound ()
 
override string GetRingingSound ()
 
override string GetDestroyedSound ()
 
override string GetHitSound ()
 
override string GetExplosiveTriggerSlotName ()
 
override void GetDebugActions (out TSelectableActionInfoArrayEx outputList)
 
override bool OnAction (int action_id, Man player, ParamsReadContext ctx)
 
override string GetDebugText ()
 
void OnUpdate ()
 

Private Attributes

const string RINGING_SOUND = "AlarmClock_Ring_Loop_SoundSet"
 
const string TURN_TOGGLE_SOUND = "AlarmClock_Turn_Off_SoundSet"
 
const string DESTROYED_SOUND = "AlarmClock_Destroyed_SoundSet"
 
const string HIT_SOUND = "AlarmClock_Hit_SoundSet"
 

Static Private Attributes

static ref NoiseParams m_NoisePar
 
static NoiseSystem m_NoiseSystem
 

Detailed Description

Definition at line 1 of file AlarmClock.c.

Constructor & Destructor Documentation

◆ ~AlarmClock_ColorBase()

void AlarmClock_ColorBase::~AlarmClock_ColorBase ( )
inlineprivate

Definition at line 27 of file AlarmClock.c.

28 {
29#ifndef SERVER
31#endif
32 }
void OnRingingStopClient()
Definition ClockBase.c:158

References OnRingingStopClient().

Member Function Documentation

◆ AnimateAlarmHand()

void AlarmClock_ColorBase::AnimateAlarmHand ( float value)
inlineprotected

Definition at line 135 of file AlarmClock.c.

136 {
137 SetAnimationPhaseNow("ClockAlarm", value);
138 }

◆ GetDebugActions()

override void AlarmClock_ColorBase::GetDebugActions ( out TSelectableActionInfoArrayEx outputList)
inlineprivate

Definition at line 69 of file AlarmClock.c.

70 {
71 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ACTIVATE_ENTITY, "SetAlarmAhead1Min", FadeColors.LIGHT_GREY));
72 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.LIGHT_GREY));
73
74 super.GetDebugActions(outputList);
75 }
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 AlarmClock_ColorBase::GetDebugText ( )
inlineprivate

Definition at line 90 of file AlarmClock.c.

91 {
92 string debug_output;
93
94 if (GetGame().IsDedicatedServer())
95 {
96 debug_output = "alarm in: " + GetAlarmInMin().ToString() + " mins" + "\n";
97 debug_output += "current state: " + typename.EnumToString(EAlarmClockState, m_State) + "\n";;
98 debug_output += "ringing for " + m_RingingDuration.ToString() + " secs" + "\n";
99 debug_output += "ringing max " + GetRingingDurationMax().ToString() + " secs" + "\n";
100 }
101 else
102 debug_output = "this is client";
103 return debug_output;
104 }
float m_RingingDuration
Definition ClockBase.c:16
int GetAlarmInMin()
Definition ClockBase.c:53
EAlarmClockState
Definition ClockBase.c:2
float GetRingingDurationMax()
Definition ClockBase.c:173
bool m_State
proto string ToString()
proto native CGame GetGame()

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

◆ GetDestroyedSound()

override string AlarmClock_ColorBase::GetDestroyedSound ( )
inlineprivate

Definition at line 54 of file AlarmClock.c.

55 {
56 return DESTROYED_SOUND;
57 }
const string DESTROYED_SOUND
Definition AlarmClock.c:5

References DESTROYED_SOUND.

◆ GetExplosiveTriggerSlotName()

override string AlarmClock_ColorBase::GetExplosiveTriggerSlotName ( )
inlineprivate

Definition at line 64 of file AlarmClock.c.

65 {
66 return "TriggerAlarmClock";
67 }

◆ GetHitSound()

override string AlarmClock_ColorBase::GetHitSound ( )
inlineprivate

Definition at line 59 of file AlarmClock.c.

60 {
61 return HIT_SOUND;
62 }
const string HIT_SOUND
Definition AlarmClock.c:6

References HIT_SOUND.

◆ GetRingingSound()

override string AlarmClock_ColorBase::GetRingingSound ( )
inlineprivate

Definition at line 49 of file AlarmClock.c.

50 {
51 return RINGING_SOUND;
52 }
const string RINGING_SOUND
Definition AlarmClock.c:3

References RINGING_SOUND.

◆ GetToggleSound()

override string AlarmClock_ColorBase::GetToggleSound ( )
inlineprivate

Definition at line 44 of file AlarmClock.c.

45 {
46 return TURN_TOGGLE_SOUND;
47 }
const string TURN_TOGGLE_SOUND
Definition AlarmClock.c:4

References TURN_TOGGLE_SOUND.

◆ Init()

override void AlarmClock_ColorBase::Init ( )
inlineprivate

Definition at line 12 of file AlarmClock.c.

13 {
14 super.Init();
15 if (GetGame().IsServer())
16 {
17 m_NoiseSystem = GetGame().GetNoiseSystem();
19 {
20 // Create and load noise parameters
22 m_NoisePar.LoadFromPath("cfgVehicles " + GetType() + " NoiseAlarmClock");
23 }
24 }
25 }
eBleedingSourceType GetType()
class NoiseSystem NoiseParams()
Definition Noise.c:15
static ref NoiseParams m_NoisePar
Definition AlarmClock.c:9
static NoiseSystem m_NoiseSystem
Definition AlarmClock.c:10

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

◆ OnAction()

override bool AlarmClock_ColorBase::OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
inlineprivate

Definition at line 77 of file AlarmClock.c.

78 {
79 if (super.OnAction(action_id, player, ctx))
80 return true;
81 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
82 {
83 if (action_id == EActions.ACTIVATE_ENTITY)
85
86 }
87 return false;
88 }
void SetAlarmInXMins(int in_mins)
Definition ClockBase.c:163

References GetGame(), and SetAlarmInXMins().

◆ OnDebugSpawn()

override void AlarmClock_ColorBase::OnDebugSpawn ( )
inlineprotected

Definition at line 177 of file AlarmClock.c.

178 {
179 TurnOn();
181 }
void TurnOn()
Definition ClockBase.c:279
void MakeRingingStart()
Definition ClockBase.c:213

References MakeRingingStart(), and TurnOn().

◆ OnStoreLoad()

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

Definition at line 141 of file AlarmClock.c.

142 {
143 if (!super.OnStoreLoad(ctx, version))
144 return false;
145
146 if (version < 126)
147 return true;
148
150
151 if (!ctx.Read(state))
152 return false;
153
154 float time;
155
156 if (!ctx.Read(time))
157 return false;
158
161 if (state == EAlarmClockState.SET)
162 TurnOn();
163 else if (state == EAlarmClockState.RINGING)
165
166 return true;
167 }
void SetAlarmTimeServer(float time01)
Definition ClockBase.c:294
void SetState(bool state)

References MakeRingingStart(), SetAlarmTimeServer(), SetState(), and TurnOn().

◆ OnStoreSave()

override void AlarmClock_ColorBase::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 169 of file AlarmClock.c.

170 {
171 super.OnStoreSave(ctx);
172
173 ctx.Write(m_State);
174 ctx.Write(m_AlarmTime01);
175 }
enum EAlarmClockState m_AlarmTime01

References m_AlarmTime01, and m_State.

◆ OnUpdate()

void AlarmClock_ColorBase::OnUpdate ( )
inlineprivate

Definition at line 106 of file AlarmClock.c.

107 {
108 if (IsAlarmOn())
109 {
110 //due to variable server time flow(day-night time accel), it's not possible to simply set a timer for X secs without some convoluted math/code, so we need to check at regular intervals
112
113 int pass, hour, minute;
114 GetGame().GetWorld().GetDate(pass, pass, pass, hour, minute);
115
117
118 //Print(GetAlarmInMin());
119
122 }
123
124 if (IsRinging())
125 {
127
129 TurnOff();
130 else if (m_NoiseSystem)
132 }
133 }
void TurnOff()
Definition ClockBase.c:284
bool IsRinging()
Definition ClockBase.c:269
bool IsAlarmOn()
Definition ClockBase.c:274
static int ConvertAlarmHand01ToMins12h(float time01)
Definition ClockBase.c:65
static const float UPDATE_TICK_RATE
Definition ClockBase.c:14
static int ConvertTimeToMins12h(int hour, int minute)
Definition ClockBase.c:81
class JsonUndergroundAreaTriggerData GetPosition

References ConvertAlarmHand01ToMins12h(), ConvertTimeToMins12h(), GetGame(), GetPosition, GetRingingDurationMax(), IsAlarmOn(), IsRinging(), m_AlarmTime01, m_NoisePar, m_NoiseSystem, m_RingingDuration, MakeRingingStart(), TurnOff(), and UPDATE_TICK_RATE.

◆ SetActions()

override void AlarmClock_ColorBase::SetActions ( )
inlineprivate

Definition at line 35 of file AlarmClock.c.

36 {
37 super.SetActions();
38
42 }
ActionTurnOffAlarmClockCB ActionSingleUseBaseCB ActionTurnOffAlarmClock()
ActionTurnOnAlarmClockCB ActionSingleUseBaseCB ActionTurnOnAlarmClock()
void AddAction(typename actionName)

References ActionTurnOffAlarmClock(), ActionTurnOnAlarmClock(), and AddAction().

Member Data Documentation

◆ DESTROYED_SOUND

const string AlarmClock_ColorBase::DESTROYED_SOUND = "AlarmClock_Destroyed_SoundSet"
private

Definition at line 5 of file AlarmClock.c.

Referenced by GetDestroyedSound().

◆ HIT_SOUND

const string AlarmClock_ColorBase::HIT_SOUND = "AlarmClock_Hit_SoundSet"
private

Definition at line 6 of file AlarmClock.c.

Referenced by GetHitSound().

◆ m_NoisePar

ref NoiseParams AlarmClock_ColorBase::m_NoisePar
staticprivate

Definition at line 9 of file AlarmClock.c.

Referenced by Init(), and OnUpdate().

◆ m_NoiseSystem

NoiseSystem AlarmClock_ColorBase::m_NoiseSystem
staticprivate

Definition at line 10 of file AlarmClock.c.

Referenced by Init(), and OnUpdate().

◆ RINGING_SOUND

const string AlarmClock_ColorBase::RINGING_SOUND = "AlarmClock_Ring_Loop_SoundSet"
private

Definition at line 3 of file AlarmClock.c.

Referenced by GetRingingSound().

◆ TURN_TOGGLE_SOUND

const string AlarmClock_ColorBase::TURN_TOGGLE_SOUND = "AlarmClock_Turn_Off_SoundSet"
private

Definition at line 4 of file AlarmClock.c.

Referenced by GetToggleSound().


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