DayZ 1.24
Loading...
Searching...
No Matches
PortableGasLamp.c
Go to the documentation of this file.
1class PortableGasLamp extends ItemBase
2{
3 PortableGasLampLight m_Light;
4
5 private const string GAS_LIGHT_MATERIAL_ON = "dz\\gear\\cooking\\data\\GasLightOn.rvmat";
6 private const string GAS_LIGHT_MATERIAL_OFF = "dz\\data\\data\\default.rvmat";
7
8 //sound
9 const string SOUND_BURNING = "portablegaslamp_burn_SoundSet";
10 const string SOUND_TURN_ON = "portablegaslamp_turn_on_SoundSet";
11 const string SOUND_TURN_OFF = "portablegaslamp_turn_off_SoundSet";
12
13 protected EffectSound m_SoundBurningLoop;
16
17 //--- POWER EVENTS
18 override void OnSwitchOn()
19 {
20 super.OnSwitchOn();
21
22 //sound (client only)
23 SoundTurnOn();
24 }
25
26 override void OnSwitchOff()
27 {
28 super.OnSwitchOff();
29
30 //sound (client only)
31 SoundTurnOff();
32 }
33
34 override void OnWorkStart()
35 {
36 if (!GetGame().IsServer() || !GetGame().IsMultiplayer()) // client side
37 {
38 m_Light = PortableGasLampLight.Cast(ScriptedLightBase.CreateLight(PortableGasLampLight, "0 0 0"));
39 m_Light.AttachOnMemoryPoint(this, "light");
40 }
41
42 //refresh visual
43 SetObjectMaterial(0, GAS_LIGHT_MATERIAL_ON);
44
45 //sound (client only)
46 SoundBurningStart();
47 }
48
49 override void OnWorkStop()
50 {
51 if (m_Light)
52 m_Light.FadeOut();
53
54 //refresh visual
55 SetObjectMaterial(0, GAS_LIGHT_MATERIAL_OFF);
56
57 //sound (client only)
58 SoundBurningStop();
59 }
60
61 //================================================================
62 // SOUNDS
63 //================================================================
64 protected void SoundBurningStart()
65 {
66 PlaySoundSetLoop(m_SoundBurningLoop, SOUND_BURNING, 0.1, 0.3);
67 }
68
69 protected void SoundBurningStop()
70 {
71 StopSoundSet(m_SoundBurningLoop);
72 }
73
74 protected void SoundTurnOn()
75 {
76 PlaySoundSet(m_SoundTurnOn, SOUND_TURN_ON, 0.1, 0.1);
77 }
78
79 protected void SoundTurnOff()
80 {
81 PlaySoundSet(m_SoundTurnOff, SOUND_TURN_OFF, 0.1, 0.1);
82 }
83
93}
void AddAction(typename actionName)
ExplosiveLight m_Light
light
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void OnSwitchOn()
EffectSound m_SoundTurnOn
EffectSound m_SoundTurnOff
override void OnWorkStart()
void SoundTurnOn()
override void SetActions()
void SoundBurningStart()
void SoundTurnOff()
override void OnWorkStop()
override void OnSwitchOff()
void SoundBurningStop()
PortableGasLampLight m_Light
proto native CGame GetGame()