DayZ 1.24
Loading...
Searching...
No Matches
Blowtorch.c
Go to the documentation of this file.
1class Blowtorch extends ItemBase
2{
3 const string TEXTURE_FLAME = "dz\\gear\\cooking\\data\\flame_butane_ca.paa";
4 const string ANIM_PHASE_FLAME = "FlameHide";
5 const string SOUND_BURNING = "Blowtorch_Loop_SoundSet";
6
8
10
11 override void OnWorkStart()
12 {
13 super.OnWorkStart();
14
15#ifndef SERVER
16 m_Light = BlowtorchLight.Cast(ScriptedLightBase.CreateLight(BlowtorchLight, "0 0 0"));
17 m_Light.AttachOnMemoryPoint(this, "light");
18#endif
19
20 RefreshFlameVisual(true);
21 SoundBurningStart();
22 }
23
24 override void OnWorkStop()
25 {
26#ifndef SERVER
27 if (m_Light)
28 m_Light.FadeOut();
29#endif
30
31 RefreshFlameVisual(false);
32 SoundBurningStop();
33 }
34
35 protected void RefreshFlameVisual(bool working = false)
36 {
37 if (working)
38 {
39 SetObjectTexture(0, TEXTURE_FLAME);
40 SetAnimationPhase(ANIM_PHASE_FLAME, 0.0);
41 }
42 else
43 {
44 SetObjectTexture(0, "");
45 SetAnimationPhase(ANIM_PHASE_FLAME, 1.0);
46 }
47 }
48
49 protected void SoundBurningStart()
50 {
51 PlaySoundSetLoop(m_SoundBurningLoop, SOUND_BURNING, 0.1, 0.0);
52 }
53
54 protected void SoundBurningStop()
55 {
56 StopSoundSet(m_SoundBurningLoop);
57 }
58
59 override bool CanPutInCargo(EntityAI parent)
60 {
61 if (!super.CanPutInCargo(parent))
62 return false;
63
64 return !GetCompEM().IsSwitchedOn();
65 }
66
67 override bool CanRemoveFromCargo(EntityAI parent)
68 {
69 return true;
70 }
71
72 override bool IsIgnited()
73 {
74 return GetCompEM().IsWorking();
75 }
76
78 {
79 if (GetGame().IsServer())
80 {
81 if (GetGasCanister())
82 {
83 ComponentEnergyManager canisterEM = GetGasCanister().GetCompEM();
84 if (canisterEM)
85 canisterEM.AddEnergy(-1 * (GetCompEM().GetEnergyUsage() * UATimeSpent.FIREPLACE_IGNITE));
86 }
87 }
88 }
89
91 {
92 return ignite_target.CanBeIgnitedBy(this);
93 }
94
105
107 {
108 if (GetInventory().AttachmentCount() != 0)
109 return GetInventory().GetAttachmentFromIndex(0);
110
111 return null;
112 }
113
115 {
116 if (GetGasCanister())
117 {
118 ComponentEnergyManager canisterEM = GetGasCanister().GetCompEM();
119 if (canisterEM)
120 return canisterEM.GetEnergy() > GetCompEM().GetEnergyUsage() * pTime;
121 }
122
123 return false;
124 }
125
126 override void OnDebugSpawn()
127 {
128 GetInventory().CreateInInventory("LargeGasCanister");
129 }
130}
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
ActionRepairCarChassisWithBlowtorchCB ActionRepairCarChassisCB ActionRepairCarChassisWithBlowtorch()
ActionRepairCarEngineWithBlowtorchCB ActionRepairCarEngineCB ActionRepairCarEngineWithBlowtorch()
ActionRepairCarPartWithBlowtorchCB ActionRepairCarPartCB ActionRepairCarPartWithBlowtorch()
ActionRepairItemWithBlowtorchCB ActionContinuousBaseCB ActionRepairItemWithBlowtorch()
void AddAction(typename actionName)
ExplosiveLight m_Light
light
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void OnWorkStart()
Definition Blowtorch.c:11
EntityAI GetGasCanister()
Definition Blowtorch.c:106
override void SetActions()
Definition Blowtorch.c:95
void RefreshFlameVisual(bool working=false)
Definition Blowtorch.c:35
void SoundBurningStart()
Definition Blowtorch.c:49
BlowtorchLight m_Light
Definition Blowtorch.c:7
EffectSound m_SoundBurningLoop
Definition Blowtorch.c:9
override bool IsIgnited()
Definition Blowtorch.c:72
override void OnWorkStop()
Definition Blowtorch.c:24
override bool CanRemoveFromCargo(EntityAI parent)
Definition Blowtorch.c:67
bool HasEnoughEnergyForRepair(float pTime)
Definition Blowtorch.c:114
override bool CanPutInCargo(EntityAI parent)
Definition Blowtorch.c:59
override void OnDebugSpawn()
Definition Blowtorch.c:126
void SoundBurningStop()
Definition Blowtorch.c:54
override bool CanIgniteItem(EntityAI ignite_target=NULL)
Definition Blowtorch.c:90
override void OnIgnitedTarget(EntityAI ignited_item)
Definition Blowtorch.c:77
const float FIREPLACE_IGNITE
proto native CGame GetGame()