Dayz Explorer 1.28.160049
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 target_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
110
112 {
113 if (GetInventory().AttachmentCount() != 0)
114 {
115 return GetInventory().GetAttachmentFromIndex(0);
116 }
117
118 return null;
119 }
120
121 bool HasEnoughEnergyForRepair(float pTime)
122 {
123 if (GetGasCanister())
124 {
125 ComponentEnergyManager canisterEM = GetGasCanister().GetCompEM();
126 if (canisterEM)
127 {
128 return canisterEM.GetEnergy() > GetCompEM().GetEnergyUsage() * pTime;
129 }
130 }
131
132 return false;
133 }
134
135 override void OnDebugSpawn()
136 {
137 GetInventory().CreateInInventory("LargeGasCanister");
138 }
139}
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
ActionRepairBoatEngineCB ActionRepairVehiclePartCB ActionRepairBoatEngine()
ActionRepairCarChassisWithBlowtorchCB ActionRepairCarChassisCB ActionRepairCarChassisWithBlowtorch()
ActionRepairCarEngineWithBlowtorchCB ActionRepairCarEngineCB ActionRepairCarEngineWithBlowtorch()
ActionRepairCarPartWithBlowtorchCB ActionRepairCarPartCB ActionRepairCarPartWithBlowtorch()
ActionRepairItemWithBlowtorchCB ActionContinuousBaseCB ActionRepairItemWithBlowtorch()
void AddAction(typename actionName)
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 OnWorkStart()
Definition blowtorch.c:11
EntityAI GetGasCanister()
Definition blowtorch.c:111
override void SetActions()
Definition blowtorch.c:99
void RefreshFlameVisual(bool working=false)
Definition blowtorch.c:37
void SoundBurningStart()
Definition blowtorch.c:51
BlowtorchLight m_Light
Definition blowtorch.c:7
EffectSound m_SoundBurningLoop
Definition blowtorch.c:9
override bool IsIgnited()
Definition blowtorch.c:76
override void OnWorkStop()
Definition blowtorch.c:24
override void OnIgnitedTarget(EntityAI target_item)
Definition blowtorch.c:81
override bool CanRemoveFromCargo(EntityAI parent)
Definition blowtorch.c:71
bool HasEnoughEnergyForRepair(float pTime)
Definition blowtorch.c:121
override bool CanPutInCargo(EntityAI parent)
Definition blowtorch.c:61
override void OnDebugSpawn()
Definition blowtorch.c:135
void SoundBurningStop()
Definition blowtorch.c:56
override bool CanIgniteItem(EntityAI ignite_target=NULL)
Definition blowtorch.c:94
proto native CGame GetGame()
class Land_Buoy extends House m_Light