DayZ 1.24
Loading...
Searching...
No Matches
TransmitterBase.c
Go to the documentation of this file.
1//TRANSMITTER BASE
3{
4 //Sounds
5 string SOUND_RADIO_TURNED_ON = "";
6
8
9 // --- SYSTEM EVENTS
11 {
12 super.OnStoreSave(ctx);
13
14 //store tuned frequency
15 ctx.Write(GetTunedFrequencyIndex());
16 }
17
18 override bool OnStoreLoad(ParamsReadContext ctx, int version)
19 {
20 if (!super.OnStoreLoad(ctx, version))
21 return false;
22
23 //--- Transmitter data ---
24 //load and set tuned frequency
26 if (!ctx.Read(tuned_frequency_idx))
27 {
28 SetFrequencyByIndex(0); //set default
29 return false;
30 }
31 SetFrequencyByIndex(tuned_frequency_idx);
32 //---
33
34 return true;
35 }
36
37 override bool IsTransmitter()
38 {
39 return true;
40 }
41
42 //--- ACTIONS
44 {
45 SetNextChannel();
46
47 /*
48 if ( player )
49 {
50 DisplayRadioInfo( GetTunedFrequency().ToString(), player );
51 }
52 */
53 }
54
55 //--- HUD
56 /*
57 protected Hud GetHud( PlayerBase player )
58 {
59 if ( !player )
60 {
61 return NULL;
62 }
63
64 return player.m_Hud;
65 }
66
67 void DisplayRadioInfo( string message, PlayerBase player )
68 {
69 Hud hud;
70 if ( player )
71 {
72 hud = GetHud( player );
73 }
74
75 if ( hud )
76 {
77 hud.SetWalkieTalkieText( message );
78 hud.ShowWalkieTalkie( 3 );
79 }
80 }
81 */
82
83 //--- POWER EVENTS
84 override void OnSwitchOn()
85 {
86 if (!GetCompEM().CanWork())
87 GetCompEM().SwitchOff();
88 }
89
90 override void OnWorkStart()
91 {
92 //turn on broadcasting/receiving
93 EnableBroadcast(true);
94 EnableReceive(true);
95 SwitchOn(true);
96
97 //play sound
98 SoundTurnedOnNoiseStart();
99 }
100
101 override void OnWorkStop()
102 {
103 //auto switch off (EM)
104 GetCompEM().SwitchOff();
105
106 //turn off broadcasting/receiving
107 EnableBroadcast(false);
108 EnableReceive(false);
109 SwitchOn(false);
110
111 //stop sound
112 SoundTurnedOnNoiseStop();
113 }
114
115 //================================================================
116 // SOUNDS
117 //================================================================
118 //Static noise when the radio is turned on
119 protected void SoundTurnedOnNoiseStart()
120 {
121 PlaySoundSetLoop(m_SoundLoop, SOUND_RADIO_TURNED_ON, 1.0, 1.0);
122 }
123
124 protected void SoundTurnedOnNoiseStop()
125 {
126 StopSoundSet(m_SoundLoop);
127 }
128
129 override void SetActions()
130 {
131 super.SetActions();
132
136 }
137}
ActionTuneFrequencyCB ActionContinuousBaseCB ActionTuneFrequency()
ActionTurnOffTransmitterCB ActionSingleUseBaseCB ActionTurnOffTransmitter()
ActionTurnOnTransmitterCB ActionSingleUseBaseCB ActionTurnOnTransmitter()
void AddAction(typename actionName)
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void SetActions()
override void OnSwitchOn()
void SoundTurnedOnNoiseStart()
void SetNextFrequency(PlayerBase player=NULL)
override void OnWorkStop()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
void SoundTurnedOnNoiseStop()
override void OnStoreSave(ParamsWriteContext ctx)
override void OnWorkStart()
override bool IsTransmitter()
EffectSound m_SoundLoop
Serialization general interface. Serializer API works with:
Definition Serializer.c:56