DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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
16
17 //--- POWER EVENTS
18 override void OnSwitchOn()
19 {
20 super.OnSwitchOn();
21
22 //sound (client only)
24 }
25
26 override void OnSwitchOff()
27 {
28 super.OnSwitchOff();
29
30 //sound (client only)
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)
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)
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
84 override void SetActions()
85 {
86 super.SetActions();
87
92 }
93}
void AddAction(typename actionName)
protected ExplosiveLight m_Light
light
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
protected void SoundTurnOn()
protected void SoundBurningStop()
Definition Blowtorch.c:56
PortableGasLampLight m_Light
override void OnSwitchOn()
override void OnSwitchOff()
override void OnWorkStop()
protected EffectSound m_SoundTurnOff
protected EffectSound m_SoundTurnOn
override void OnWorkStart()
protected EffectSound m_SoundBurningLoop
Definition Blowtorch.c:9
protected void SoundBurningStart()
Definition Blowtorch.c:51
protected void SoundTurnOff()
override void SetActions()
proto native CGame GetGame()