Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
transmitterbase.c
Go to the documentation of this file.
1 //TRANSMITTER BASE
3 {
4  //Sounds
5  string SOUND_RADIO_TURNED_ON = "";
6 
7  protected EffectSound m_SoundLoop;
8 
9  // --- SYSTEM EVENTS
10  override void OnStoreSave( ParamsWriteContext ctx )
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
25  int tuned_frequency_idx;
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
43  void SetNextFrequency( PlayerBase player = NULL )
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  {
88  GetCompEM().SwitchOff();
89  }
90  }
91 
92  override void OnWorkStart()
93  {
94  //turn on broadcasting/receiving
95  EnableBroadcast ( true );
96  EnableReceive ( true );
97  SwitchOn ( true );
98 
99  //play sound
100  SoundTurnedOnNoiseStart();
101  }
102 
103  override void OnWorkStop()
104  {
105  //auto switch off (EM)
106  GetCompEM().SwitchOff();
107 
108  //turn off broadcasting/receiving
109  EnableBroadcast ( false );
110  EnableReceive ( false );
111  SwitchOn ( false );
112 
113  //stop sound
114  SoundTurnedOnNoiseStop();
115  }
116 
117  //================================================================
118  // SOUNDS
119  //================================================================
120  //Static noise when the radio is turned on
121  protected void SoundTurnedOnNoiseStart()
122  {
123  PlaySoundSetLoop( m_SoundLoop, SOUND_RADIO_TURNED_ON, 1.0, 1.0 );
124  }
125 
126  protected void SoundTurnedOnNoiseStop()
127  {
128  StopSoundSet( m_SoundLoop );
129  }
130 
131  override void SetActions()
132  {
133  super.SetActions();
134 
138  }
139 }
OnWorkStop
override void OnWorkStop()
Definition: m18smokegrenade_colorbase.c:2
ItemTransmitter
Definition: transmitterbase.c:2
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition: effectsound.c:4
PlayerBase
Definition: playerbaseclient.c:1
TransmitterBase
Definition: baseradio.c:1
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
ActionTuneFrequency
ActionTuneFrequencyCB ActionContinuousBaseCB ActionTuneFrequency()
Definition: actiontunefrequency.c:13
ActionTurnOnTransmitter
ActionTurnOnWeaponFlashlight ActionTurnOnTransmitter
OnStoreSave
void OnStoreSave(ParamsWriteContext ctx)
Definition: modifierbase.c:229
ActionTurnOffTransmitter
ActionTurnOffWeaponFlashlight ActionTurnOffTransmitter
OnStoreLoad
bool OnStoreLoad(ParamsReadContext ctx, int version)
Definition: modifiersmanager.c:270
OnWorkStart
override void OnWorkStart()
Definition: smokegrenadebase.c:175