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

Private Member Functions

void ActionTakeItemToHands ()
 
override void CreateConditionComponents ()
 
override bool HasProneException ()
 
override GetInputType ()
 
override bool HasProgress ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool CanContinue (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnExecute (ActionData action_data)
 
override void CreateAndSetupActionCallback (ActionData action_data)
 
override bool CanBeUsedOnBack ()
 

Detailed Description

Definition at line 1 of file ActionTakeItemToHands.c.

Constructor & Destructor Documentation

◆ ActionTakeItemToHands()

void ActionTakeItemToHands::ActionTakeItemToHands ( )
inlineprivate

Definition at line 3 of file ActionTakeItemToHands.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
6 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
7 m_Text = "#take_to_hands";
8 }
string m_Text
Definition ActionBase.c:49
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, AnimatedActionBase::m_CommandUIDProne, and m_Text.

Member Function Documentation

◆ ActionCondition()

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

Definition at line 31 of file ActionTakeItemToHands.c.

32 {
33 ItemBase targetItem = ItemBase.Cast(target.GetObject());
34 if (!targetItem)
35 return false;
36
37 EntityAI targetParent = EntityAI.Cast(targetItem.GetHierarchyParent());
38 if (!targetItem.IsTakeable() || targetItem.IsBeingPlaced() || targetItem.IsSetForDeletion() || (targetItem.GetHierarchyParent() && !BaseBuildingBase.Cast(targetParent)) || ((targetParent && !targetItem.CanDetachAttachment(targetParent)) || (targetParent && !targetParent.CanReleaseAttachment(targetItem))))
39 return false;
40
41 return player.GetInventory().CanAddEntityIntoHands(targetItem);
42 }

◆ CanBeUsedOnBack()

override bool ActionTakeItemToHands::CanBeUsedOnBack ( )
inlineprivate

Definition at line 102 of file ActionTakeItemToHands.c.

103 {
104 return true;
105 }

◆ CanContinue()

override bool ActionTakeItemToHands::CanContinue ( ActionData action_data)
inlineprivate

Definition at line 44 of file ActionTakeItemToHands.c.

45 {
46 return true;
47 }

◆ CreateAndSetupActionCallback()

override void ActionTakeItemToHands::CreateAndSetupActionCallback ( ActionData action_data)
inlineprivate

Definition at line 78 of file ActionTakeItemToHands.c.

79 {
80 EntityAI target = EntityAI.Cast(action_data.m_Target.GetObject());
81 if (!target)
82 return;
83
85
86 if (target.IsHeavyBehaviour())
87 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
88 else
89 {
90 if (action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
91 Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(m_CommandUID, GetCallbackClassTypename()));
92 else
93 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(m_CommandUIDProne, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_PRONE));
94 }
95
96 callback.SetActionData(action_data);
97 callback.InitActionComponent();
98 action_data.m_Callback = callback;
99 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), AnimatedActionBase::GetCallbackClassTypename(), AnimatedActionBase::m_CommandUID, and AnimatedActionBase::m_CommandUIDProne.

◆ CreateConditionComponents()

override void ActionTakeItemToHands::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionTakeItemToHands.c.

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

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ GetInputType()

override ActionTakeItemToHands::GetInputType ( )
inlineprivate

◆ HasProgress()

override bool ActionTakeItemToHands::HasProgress ( )
inlineprivate

Definition at line 26 of file ActionTakeItemToHands.c.

27 {
28 return false;
29 }

◆ HasProneException()

override bool ActionTakeItemToHands::HasProneException ( )
inlineprivate

Definition at line 16 of file ActionTakeItemToHands.c.

17 {
18 return true;
19 }

◆ OnEndServer()

override void ActionTakeItemToHands::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 49 of file ActionTakeItemToHands.c.

50 {
51 super.OnEndServer(action_data);
52
53 EntityAI takenEntity = EntityAI.Cast(action_data.m_Target.GetObject());
54 if (takenEntity && takenEntity.GetCompEM() && takenEntity.IsElectricAppliance())
55 takenEntity.GetCompEM().UnplugThis();
56 }

◆ OnExecute()

override void ActionTakeItemToHands::OnExecute ( ActionData action_data)
inlineprivate

Definition at line 58 of file ActionTakeItemToHands.c.

59 {
60 if (GetGame().IsDedicatedServer())
61 return;
62
63 ItemBase ntarget = ItemBase.Cast(action_data.m_Target.GetObject());
65
66 float stackable = ntarget.GetTargetQuantityMax(-1);
67
68 if (stackable == 0 || stackable >= ntarget.GetQuantity())
69 action_data.m_Player.PredictiveTakeEntityToHands(ntarget);
70 else
71 {
73 il.SetHands(action_data.m_Player, ntarget);
74 ntarget.SplitIntoStackMaxToInventoryLocationClient(il);
75 }
76 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:790
InventoryLocation.
proto native CGame GetGame()

References ClearInventoryReservationEx(), and GetGame().


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