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

Protected Member Functions

void OnExecuteImpl (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
override void CreateAndSetupActionCallback (ActionData action_data)
 

Private Member Functions

void ActionTakeHybridAttachmentToHands ()
 
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 OnExecuteClient (ActionData action_data)
 

Detailed Description

Definition at line 1 of file ActionTakeHybridAttachmentToHands.c.

Constructor & Destructor Documentation

◆ ActionTakeHybridAttachmentToHands()

void ActionTakeHybridAttachmentToHands::ActionTakeHybridAttachmentToHands ( )
inlineprivate

Definition at line 3 of file ActionTakeHybridAttachmentToHands.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 ActionTakeHybridAttachmentToHands::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 31 of file ActionTakeHybridAttachmentToHands.c.

32 {
33 EntityAI tgt_entity = EntityAI.Cast(target.GetObject());
34
35 if (tgt_entity && BaseBuildingBase.Cast(tgt_entity) && !tgt_entity.IsBeingPlaced() /*&& BaseBuildingBase.Cast(tgt_entity).IsPlayerInside(player,"")*/)
36 {
37 string component_name = tgt_entity.GetActionComponentName(target.GetComponentIndex());
38
39 ItemBase attachment = ItemBase.Cast(tgt_entity.FindAttachmentBySlotName(component_name));
40
41 if (attachment && player.GetInventory().CanAddEntityIntoHands(attachment) && attachment.IsTakeable())
42 return true;
43 }
44 return false;
45 }

◆ CanContinue()

override bool ActionTakeHybridAttachmentToHands::CanContinue ( ActionData action_data)
inlineprivate

Definition at line 47 of file ActionTakeHybridAttachmentToHands.c.

48 {
49 return true;
50 }

◆ CreateAndSetupActionCallback()

override void ActionTakeHybridAttachmentToHands::CreateAndSetupActionCallback ( ActionData action_data)
inlineprotected

Definition at line 89 of file ActionTakeHybridAttachmentToHands.c.

90 {
91 EntityAI tgt_entity = EntityAI.Cast(action_data.m_Target.GetObject());
92 string component_name = tgt_entity.GetActionComponentName(action_data.m_Target.GetComponentIndex());
94 bool heavy_item = false;
95
96 if (tgt_entity && ItemBase.CastTo(attachment, tgt_entity.FindAttachmentBySlotName(component_name)))
97 {
99 if (attachment && attachment.ConfigIsExisting("heavyItem") && attachment.ConfigGetBool("heavyItem"))
100 heavy_item = true;
101 }
102
103 if (heavy_item)
104 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
105 else
106 {
107 if (action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
108 Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS, GetCallbackClassTypename()));
109 else
110 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_PRONE));
111 }
112 callback.SetActionData(action_data);
113 callback.InitActionComponent();
114 action_data.m_Callback = callback;
115 }
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(), and AnimatedActionBase::GetCallbackClassTypename().

◆ CreateConditionComponents()

override void ActionTakeHybridAttachmentToHands::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionTakeHybridAttachmentToHands.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.

◆ GetInputType()

override ActionTakeHybridAttachmentToHands::GetInputType ( )
inlineprivate

◆ HasProgress()

override bool ActionTakeHybridAttachmentToHands::HasProgress ( )
inlineprivate

Definition at line 26 of file ActionTakeHybridAttachmentToHands.c.

27 {
28 return false;
29 }

◆ HasProneException()

override bool ActionTakeHybridAttachmentToHands::HasProneException ( )
inlineprivate

Definition at line 16 of file ActionTakeHybridAttachmentToHands.c.

17 {
18 return true;
19 }

◆ OnExecuteClient()

override void ActionTakeHybridAttachmentToHands::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 52 of file ActionTakeHybridAttachmentToHands.c.

References OnExecuteImpl().

◆ OnExecuteImpl()

void ActionTakeHybridAttachmentToHands::OnExecuteImpl ( ActionData action_data)
inlineprotected

Definition at line 57 of file ActionTakeHybridAttachmentToHands.c.

58 {
59 EntityAI tgt_entity = EntityAI.Cast(action_data.m_Target.GetObject());
60 string component_name = tgt_entity.GetActionComponentName(action_data.m_Target.GetComponentIndex());
62
63 if (tgt_entity && ItemBase.CastTo(attachment, tgt_entity.FindAttachmentBySlotName(component_name)))
64 {
66 float stackable = attachment.GetTargetQuantityMax(-1);
67
68 if (stackable == 0 || stackable >= attachment.GetQuantity())
69 {
70 //take to hands
71 action_data.m_Player.PredictiveTakeEntityToHands(attachment);
72 }
73 else if (stackable != 0 && stackable < attachment.GetQuantity())
74 {
75 //split and take to hands
76 attachment.SplitIntoStackMaxHandsClient(action_data.m_Player);
77 }
78 }
79 }
void ClearInventoryReservationEx(ActionData action_data)
Definition ActionBase.c:790

References ClearInventoryReservationEx().

Referenced by OnExecuteClient(), and OnExecuteServer().

◆ OnExecuteServer()

override void ActionTakeHybridAttachmentToHands::OnExecuteServer ( ActionData action_data)
inlineprotected

Definition at line 81 of file ActionTakeHybridAttachmentToHands.c.

82 {
83 if (GetGame().IsMultiplayer())
84 return; // multiplayer handled on client side via OnExecuteClient
85 else
86 OnExecuteImpl(action_data); // single player
87 }
proto native CGame GetGame()

References GetGame(), and OnExecuteImpl().


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