DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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
22 }
23
24 override void OnWorkStop()
25 {
26 #ifndef SERVER
27 if (m_Light)
28 {
29 m_Light.FadeOut();
30 }
31 #endif
32
33 RefreshFlameVisual(false);
35 }
36
37 protected void RefreshFlameVisual(bool working = false)
38 {
39 if (working)
40 {
41 SetObjectTexture(0, TEXTURE_FLAME);
42 SetAnimationPhase(ANIM_PHASE_FLAME, 0.0);
43 }
44 else
45 {
46 SetObjectTexture(0, "");
47 SetAnimationPhase(ANIM_PHASE_FLAME, 1.0);
48 }
49 }
50
51 protected void SoundBurningStart()
52 {
53 PlaySoundSetLoop(m_SoundBurningLoop, SOUND_BURNING, 0.1, 0.0);
54 }
55
56 protected void SoundBurningStop()
57 {
58 StopSoundSet(m_SoundBurningLoop);
59 }
60
61 override bool CanPutInCargo(EntityAI parent)
62 {
63 if (!super.CanPutInCargo(parent))
64 {
65 return false;
66 }
67
68 return !GetCompEM().IsSwitchedOn();
69 }
70
71 override bool CanRemoveFromCargo(EntityAI parent)
72 {
73 return true;
74 }
75
76 override bool IsIgnited()
77 {
78 return GetCompEM().IsWorking();
79 }
80
81 override void OnIgnitedTarget(EntityAI ignited_item)
82 {
83 if (GetGame().IsServer())
84 {
85 if (GetGasCanister())
86 {
87 ComponentEnergyManager canisterEM = GetGasCanister().GetCompEM();
88 if (canisterEM)
89 canisterEM.AddEnergy(-1 * (GetCompEM().GetEnergyUsage() * UATimeSpent.FIREPLACE_IGNITE));
90 }
91 }
92 }
93
94 override bool CanIgniteItem(EntityAI ignite_target = NULL)
95 {
96 return ignite_target.CanBeIgnitedBy(this);
97 }
98
99 override void SetActions()
100 {
101 super.SetActions();
102
108 }
109
111 {
112 if (GetInventory().AttachmentCount() != 0)
113 {
114 return GetInventory().GetAttachmentFromIndex(0);
115 }
116
117 return null;
118 }
119
120 bool HasEnoughEnergyForRepair(float pTime)
121 {
122 if (GetGasCanister())
123 {
124 ComponentEnergyManager canisterEM = GetGasCanister().GetCompEM();
125 if (canisterEM)
126 {
127 return canisterEM.GetEnergy() > GetCompEM().GetEnergyUsage() * pTime;
128 }
129 }
130
131 return false;
132 }
133
134 override void OnDebugSpawn()
135 {
136 GetInventory().CreateInInventory("LargeGasCanister");
137 }
138}
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
ActionRepairCarChassisWithBlowtorchCB ActionRepairCarChassisCB ActionRepairCarChassisWithBlowtorch()
ActionRepairCarEngineWithBlowtorchCB ActionRepairCarEngineCB ActionRepairCarEngineWithBlowtorch()
ActionRepairCarPartWithBlowtorchCB ActionRepairCarPartCB ActionRepairCarPartWithBlowtorch()
ActionRepairItemWithBlowtorchCB ActionContinuousBaseCB ActionRepairItemWithBlowtorch()
void AddAction(typename actionName)
protected ExplosiveLight m_Light
light
float AddEnergy(float added_energy)
Energy manager: Adds energy to this device and clamps it within its min/max storage limits....
float GetEnergy()
Energy manager: Returns the amount of stored energy this device has.
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void OnDebugSpawn()
Definition Blowtorch.c:134
override void OnIgnitedTarget(EntityAI ignited_item)
Definition Blowtorch.c:81
protected void SoundBurningStop()
Definition Blowtorch.c:56
protected BlowtorchLight m_Light
Definition Blowtorch.c:7
override bool CanPutInCargo(EntityAI parent)
Definition Blowtorch.c:61
override void OnWorkStop()
Definition Blowtorch.c:24
override bool IsIgnited()
Definition Blowtorch.c:76
protected void RefreshFlameVisual(bool working=false)
Definition Blowtorch.c:37
override bool CanIgniteItem(EntityAI ignite_target=NULL)
Definition Blowtorch.c:94
override bool CanRemoveFromCargo(EntityAI parent)
Definition Blowtorch.c:71
override void OnWorkStart()
Definition Blowtorch.c:11
protected EffectSound m_SoundBurningLoop
Definition Blowtorch.c:9
protected void SoundBurningStart()
Definition Blowtorch.c:51
bool HasEnoughEnergyForRepair(float pTime)
Definition Blowtorch.c:120
override void SetActions()
Definition Blowtorch.c:99
protected EntityAI GetGasCanister()
Definition Blowtorch.c:110
const float FIREPLACE_IGNITE
proto native CGame GetGame()