DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Land_Radio_PanelBig.c
Go to the documentation of this file.
1class Land_Radio_PanelBig extends StaticTransmitter
2{
3 override bool DisableVicinityIcon()
4 {
5 return true;
6 }
7
8 // --- SYSTEM EVENTS
9 override void OnStoreSave( ParamsWriteContext ctx )
10 {
11 super.OnStoreSave( ctx );
12
13 //store tuned frequency
14 ctx.Write( GetTunedFrequencyIndex() );
15 }
16
17 override bool OnStoreLoad( ParamsReadContext ctx, int version )
18 {
19 if ( !super.OnStoreLoad( ctx, version ) )
20 return false;
21
22 //--- Panel Radio data ---
23 //load and set tuned frequency
24 int tuned_frequency_idx;
25 if ( !ctx.Read( tuned_frequency_idx ) )
26 {
27 tuned_frequency_idx = 0; //set default
28 }
29 SetFrequencyByIndex( tuned_frequency_idx );
30 //---
31
32 return true;
33 }
34
35 //--- BASE
36 override bool IsStaticTransmitter()
37 {
38 return true;
39 }
40
41 void SetNextFrequency( PlayerBase player = NULL )
42 {
43 SetNextChannel();
44
45 /*
46 if ( player )
47 {
48 DisplayRadioInfo( GetTunedFrequency().ToString(), player );
49 }
50 */
51 }
52
53 //--- POWER EVENTS
54 override void OnSwitchOn()
55 {
56 if ( !GetCompEM().CanWork() )
57 {
58 GetCompEM().SwitchOff();
59 }
60 }
61
62 override void OnWorkStart()
63 {
64 //turn on broadcasting/receiving
65 EnableBroadcast ( true );
66 EnableReceive ( true );
67 SwitchOn ( true );
68 }
69
70 override void OnWorkStop()
71 {
72 //auto switch off (EM)
73 GetCompEM().SwitchOff();
74
75 //turn off broadcasting/receiving
76 EnableBroadcast ( false );
77 EnableReceive ( false );
78 SwitchOn ( false );
79 }
80
81 override void SetActions()
82 {
83 super.SetActions();
84
86 }
87}
void AddAction(typename actionName)
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto bool Read(void value_in)
override bool DisableVicinityIcon()
void SetNextFrequency(PlayerBase player=NULL)
override void OnStoreSave(ParamsWriteContext ctx)
override void OnSwitchOn()
override bool IsStaticTransmitter()
override void OnWorkStop()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWorkStart()
override void SetActions()