Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionrefueltorch.c
Go to the documentation of this file.
1
class
ActionRefuelTorch
:
ActionSingleUseBase
2
{
3
void
ActionRefuelTorch
()
4
{
5
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_ATTACHITEM;
6
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT |
DayZPlayerConstants
.STANCEMASK_CROUCH;
7
m_Text
=
"#STR_RefuelTorch0"
;
8
}
9
10
override
void
CreateConditionComponents
()
11
{
12
m_ConditionTarget
=
new
CCTNonRuined
();
13
m_ConditionItem
=
new
CCINonRuined
();
14
}
15
16
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item)
17
{
18
Torch torch;
19
Rag rag;
20
Rag torchRag;
21
22
if
((
Class
.
CastTo
(torch,target.GetObject()) &&
Class
.
CastTo
(rag,item)) || (
Class
.
CastTo
(rag,target.GetObject()) &&
Class
.
CastTo
(torch,item)))
23
{
24
if
(
Class
.
CastTo
(torchRag,torch.GetRag()))
25
{
26
int
slotId =
InventorySlots
.
INVALID
;
27
InventoryLocation
lcn =
new
InventoryLocation
();
28
torchRag.GetInventory().GetCurrentInventoryLocation(lcn);
29
slotId = lcn.
GetSlot
();
30
31
return
torch.GetInventory().GetSlotLock(slotId) && torch.GetRagQuantity() < torchRag.GetQuantityMax() && torch.IsRagDryEnough(rag);
32
}
33
}
34
35
return
false
;
36
}
37
38
override
void
OnExecuteServer
(
ActionData
action_data)
39
{
40
Torch torch;
41
Rag rag;
42
Rag torchRag;
43
44
if
((
Class
.
CastTo
(torch,action_data.m_Target.GetObject()) &&
Class
.
CastTo
(rag,action_data.m_MainItem)) || (
Class
.
CastTo
(rag,action_data.m_Target.GetObject()) &&
Class
.
CastTo
(torch,action_data.m_MainItem)))
45
{
46
Class
.
CastTo
(torchRag,torch.GetRag());
47
48
int
qtyTransfer = torchRag.GetQuantityMax() - torch.GetRagQuantity();
//torch rag capacity
49
qtyTransfer = (
int
)
Math
.
Clamp
(rag.GetQuantity(),0,qtyTransfer);
50
torchRag.AddQuantity(qtyTransfer);
51
rag.AddQuantity(-qtyTransfer);
52
}
53
}
54
};
int
Param3 int
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionRefuelTorch::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
actionrefueltorch.c:38
ActionRefuelTorch::ActionRefuelTorch
void ActionRefuelTorch()
Definition
actionrefueltorch.c:3
ActionRefuelTorch::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionrefueltorch.c:10
ActionRefuelTorch::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionrefueltorch.c:16
ActionSingleUseBase::ActionSingleUseBase
void ActionSingleUseBase()
Definition
actionsingleusebase.c:31
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
CCINonRuined
Definition
ccinonruined.c:2
CCTNonRuined
Definition
cctnonruined.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetSlot
proto native int GetSlot()
returns slot id if current type is Attachment
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
InventorySlots::INVALID
const int INVALID
Invalid slot (-1).
Definition
inventoryslots.c:17
ItemBase
Definition
inventoryitem.c:742
Math
Definition
enmath.c:7
PlayerBase
Definition
playerbaseclient.c:2
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Math::Clamp
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionrefueltorch.c
Generated by
1.17.0