DayZ
1.24
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
m_Text
string m_Text
Definition
ActionBase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition
ActionBase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
ActionBase.c:56
m_StanceMask
int m_StanceMask
Definition
ActionBase.c:53
ActionData
Definition
ActionBase.c:21
ActionRefuelTorch
Definition
ActionRefuelTorch.c:2
ActionRefuelTorch::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
ActionRefuelTorch.c:16
ActionRefuelTorch::CreateConditionComponents
override void CreateConditionComponents()
Definition
ActionRefuelTorch.c:10
ActionRefuelTorch::ActionRefuelTorch
void ActionRefuelTorch()
Definition
ActionRefuelTorch.c:3
ActionRefuelTorch::OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition
ActionRefuelTorch.c:38
ActionSingleUseBase
Definition
ActionSingleUseBase.c:40
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
AnimatedActionBase.c:122
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:28
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:697
Math
Definition
EnMath.c:7
Param3
Definition
EntityAI.c:95
PlayerBase
Definition
PlayerBaseClient.c:2
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:597
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'.
scripts
4_World
Classes
UserActionsComponent
Actions
Continuous
ActionRefuelTorch.c
Generated by
1.10.0