DayZ 1.24
Loading...
Searching...
No Matches
ActionRefuelTorch Class Reference
Inheritance diagram for ActionRefuelTorch:
[legend]
Collaboration diagram for ActionRefuelTorch:
[legend]

Private Member Functions

void ActionRefuelTorch ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnExecuteServer (ActionData action_data)
 

Detailed Description

Definition at line 1 of file ActionRefuelTorch.c.

Constructor & Destructor Documentation

◆ ActionRefuelTorch()

void ActionRefuelTorch::ActionRefuelTorch ( )
inlineprivate

Definition at line 3 of file ActionRefuelTorch.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ATTACHITEM;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
7 m_Text = "#STR_RefuelTorch0";
8 }
string m_Text
Definition ActionBase.c:49
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

override bool ActionRefuelTorch::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 16 of file ActionRefuelTorch.c.

17 {
18 Torch torch;
19 Rag rag;
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 {
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 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
InventoryLocation.
provides access to slot configuration
const int INVALID
Invalid slot (-1)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), and InventorySlots::INVALID.

◆ CreateConditionComponents()

override void ActionRefuelTorch::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionRefuelTorch.c.

11 {
14 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnExecuteServer()

override void ActionRefuelTorch::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 38 of file ActionRefuelTorch.c.

39 {
40 Torch torch;
41 Rag rag;
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 }
Param3 int
Definition EnMath.c:7
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'.

References Class::CastTo(), and Math::Clamp().


The documentation for this class was generated from the following file: