Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
blowtorch.c
Go to the documentation of this file.
1
class
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
7
protected
BlowtorchLight
m_Light
;
8
9
protected
EffectSound
m_SoundBurningLoop
;
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
{
29
m_Light
.FadeOut();
30
}
31
#endif
32
33
RefreshFlameVisual
(
false
);
34
SoundBurningStop
();
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
(
g_Game
.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
103
AddAction
(
ActionLightItemOnFireWithBlowtorch
);
104
AddAction
(
ActionRepairCarEngineWithBlowtorch
);
105
AddAction
(
ActionRepairCarChassisWithBlowtorch
);
106
AddAction
(
ActionRepairCarPartWithBlowtorch
);
107
AddAction
(
ActionRepairItemWithBlowtorch
);
108
AddAction
(
ActionRepairBoatEngine
);
109
}
110
111
protected
EntityAI
GetGasCanister
()
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
}
ActionLightItemOnFireWithBlowtorch
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
Definition
actionlightitemonfirewithblowtorch.c:11
ActionRepairBoatEngine
ActionRepairBoatEngineCB ActionRepairVehiclePartCB ActionRepairBoatEngine()
Definition
actionrepairboatengine.c:11
ActionRepairCarChassisWithBlowtorch
ActionRepairCarChassisWithBlowtorchCB ActionRepairCarChassisCB ActionRepairCarChassisWithBlowtorch()
Definition
actionrepaircarchassiswithblowtorch.c:11
ActionRepairCarEngineWithBlowtorch
ActionRepairCarEngineWithBlowtorchCB ActionRepairCarEngineCB ActionRepairCarEngineWithBlowtorch()
Definition
actionrepaircarenginewithblowtorch.c:11
ActionRepairCarPartWithBlowtorch
ActionRepairCarPartWithBlowtorchCB ActionRepairCarPartCB ActionRepairCarPartWithBlowtorch()
Definition
actionrepaircarpartwithblowtorch.c:11
ActionRepairItemWithBlowtorch
ActionRepairItemWithBlowtorchCB ActionContinuousBaseCB ActionRepairItemWithBlowtorch()
Definition
actionrepairitemwithblowtorch.c:11
AddAction
void AddAction(typename actionName)
Definition
advancedcommunication.c:220
BlowtorchLight
Definition
blowtorchlight.c:2
ComponentEnergyManager
Definition
componentenergymanager.c:19
ComponentEnergyManager::AddEnergy
float AddEnergy(float added_energy)
Energy manager: Adds energy to this device and clamps it within its min/max storage limits....
Definition
componentenergymanager.c:1265
ComponentEnergyManager::GetEnergy
float GetEnergy()
Energy manager: Returns the amount of stored energy this device has.
Definition
componentenergymanager.c:1259
EffectSound
Wrapper class for managing sound through SEffectManager.
Definition
effectsound.c:5
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
ItemBase::OnDebugSpawn
override void OnDebugSpawn()
Definition
blowtorch.c:135
ItemBase::ANIM_PHASE_FLAME
const string ANIM_PHASE_FLAME
Definition
blowtorch.c:4
ItemBase::GetGasCanister
EntityAI GetGasCanister()
Definition
blowtorch.c:111
ItemBase::RefreshFlameVisual
void RefreshFlameVisual(bool working=false)
Definition
blowtorch.c:37
ItemBase::m_Light
BlowtorchLight m_Light
Definition
blowtorch.c:7
ItemBase::CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition
blowtorch.c:61
ItemBase::OnWorkStop
override void OnWorkStop()
Definition
blowtorch.c:24
ItemBase::IsIgnited
override bool IsIgnited()
Definition
blowtorch.c:76
ItemBase::m_SoundBurningLoop
EffectSound m_SoundBurningLoop
Definition
blowtorch.c:9
ItemBase::CanIgniteItem
override bool CanIgniteItem(EntityAI ignite_target=NULL)
Definition
blowtorch.c:94
ItemBase::CanRemoveFromCargo
override bool CanRemoveFromCargo(EntityAI parent)
Definition
blowtorch.c:71
ItemBase::OnWorkStart
override void OnWorkStart()
Definition
blowtorch.c:11
ItemBase::SoundBurningStop
void SoundBurningStop()
Definition
blowtorch.c:56
ItemBase::OnIgnitedTarget
override void OnIgnitedTarget(EntityAI target_item)
Definition
blowtorch.c:81
ItemBase::TEXTURE_FLAME
const string TEXTURE_FLAME
Definition
blowtorch.c:3
ItemBase::SoundBurningStart
void SoundBurningStart()
Definition
blowtorch.c:51
ItemBase::SOUND_BURNING
const string SOUND_BURNING
Definition
blowtorch.c:5
ItemBase::HasEnoughEnergyForRepair
bool HasEnoughEnergyForRepair(float pTime)
Definition
blowtorch.c:121
ItemBase::SetActions
override void SetActions()
Definition
blowtorch.c:99
ScriptedLightBase
Definition
pointlightbase.c:2
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::FIREPLACE_IGNITE
const float FIREPLACE_IGNITE
Definition
actionconstants.c:96
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Games
Dayz
scripts
4_world
entities
itembase
blowtorch.c
Generated by
1.17.0