DayZ 1.24
Loading...
Searching...
No Matches
ActionTakeMaterialToHands Class Reference
Inheritance diagram for ActionTakeMaterialToHands:
[legend]
Collaboration diagram for ActionTakeMaterialToHands:
[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 ActionTakeMaterialToHands ()
 
override void CreateConditionComponents ()
 
override bool HasProneException ()
 
override void OnActionInfoUpdate (PlayerBase player, ActionTarget target, ItemBase item)
 
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 ActionTakeMaterialToHands.c.

Constructor & Destructor Documentation

◆ ActionTakeMaterialToHands()

void ActionTakeMaterialToHands::ActionTakeMaterialToHands ( )
inlineprivate

Definition at line 3 of file ActionTakeMaterialToHands.c.

4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
6 m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
7 m_Text = "#take";
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 ActionTakeMaterialToHands::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 40 of file ActionTakeMaterialToHands.c.

41 {
42 EntityAI target_entity = EntityAI.Cast(target.GetObject());
43 if (target_entity && target_entity.CanUseConstruction())
44 {
46 if (!base_building.IsPlayerInside(player, ""))
47 return false;
48
49 ConstructionActionData construction_action_data = player.GetConstructionActionData();
50 string main_part_name = target_entity.GetActionComponentName(target.GetComponentIndex());
51 //Print(main_part_name);
52
53 if (GetGame().IsMultiplayer() || GetGame().IsServer())
54 construction_action_data.RefreshAttachmentsToDetach(target_entity, main_part_name);
55 EntityAI attachment = construction_action_data.GetActualAttachmentToDetach();
56
57 if (attachment && player.GetInventory().CanAddEntityIntoHands(attachment) && attachment.GetHierarchyRootPlayer() != player)
58 return true;
59 }
60
61 return false;
62 }
proto native CGame GetGame()

References GetGame().

◆ CanContinue()

override bool ActionTakeMaterialToHands::CanContinue ( ActionData action_data)
inlineprivate

Definition at line 64 of file ActionTakeMaterialToHands.c.

65 {
66 return true;
67 }

◆ CreateAndSetupActionCallback()

override void ActionTakeMaterialToHands::CreateAndSetupActionCallback ( ActionData action_data)
inlineprotected

Definition at line 103 of file ActionTakeMaterialToHands.c.

104 {
105 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
106 EntityAI target = construction_action_data.GetActualAttachmentToDetach();
107
108 bool heavy_item = false;
110 if (target && target.ConfigIsExisting("heavyItem") && target.ConfigGetBool("heavyItem"))
111 heavy_item = true;
112
113 if (heavy_item)
114 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
115 else
116 {
117 if (action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT))
118 Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS, GetCallbackClassTypename()));
119 else
120 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_PRONE));
121 }
122 callback.SetActionData(action_data);
123 callback.InitActionComponent();
124 action_data.m_Callback = callback;
125 }
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 ActionTakeMaterialToHands::CreateConditionComponents ( )
inlineprivate

Definition at line 10 of file ActionTakeMaterialToHands.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 ActionTakeMaterialToHands::GetInputType ( )
inlineprivate

◆ HasProgress()

override bool ActionTakeMaterialToHands::HasProgress ( )
inlineprivate

Definition at line 35 of file ActionTakeMaterialToHands.c.

36 {
37 return false;
38 }

◆ HasProneException()

override bool ActionTakeMaterialToHands::HasProneException ( )
inlineprivate

Definition at line 16 of file ActionTakeMaterialToHands.c.

17 {
18 return true;
19 }

◆ OnActionInfoUpdate()

override void ActionTakeMaterialToHands::OnActionInfoUpdate ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 21 of file ActionTakeMaterialToHands.c.

22 {
23 ConstructionActionData construction_action_data = player.GetConstructionActionData();
24 EntityAI attachment = construction_action_data.GetActualAttachmentToDetach();
25
26 if (attachment)
27 m_Text = "#take " + attachment.GetDisplayName();
28 }

References m_Text.

◆ OnExecuteClient()

override void ActionTakeMaterialToHands::OnExecuteClient ( ActionData action_data)
inlineprivate

Definition at line 69 of file ActionTakeMaterialToHands.c.

70 {
72 }
void OnExecuteImpl(ActionData action_data)

References OnExecuteImpl().

◆ OnExecuteImpl()

void ActionTakeMaterialToHands::OnExecuteImpl ( ActionData action_data)
inlineprotected

Definition at line 74 of file ActionTakeMaterialToHands.c.

75 {
76 ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
77 ItemBase item_target = ItemBase.Cast(construction_action_data.GetActualAttachmentToDetach());
78 if (item_target)
79 {
80 float stackable = item_target.GetTargetQuantityMax();
81
82 if (stackable == 0 || stackable >= item_target.GetQuantity())
83 {
84 //take to hands
85 action_data.m_Player.PredictiveTakeEntityToHands(item_target);
86 }
87 else if (stackable != 0 && stackable < item_target.GetQuantity())
88 {
89 //split and take to hands
90 item_target.SplitIntoStackMaxHandsClient(action_data.m_Player);
91 }
92 }
93 }

Referenced by OnExecuteClient(), and OnExecuteServer().

◆ OnExecuteServer()

override void ActionTakeMaterialToHands::OnExecuteServer ( ActionData action_data)
inlineprotected

Definition at line 95 of file ActionTakeMaterialToHands.c.

96 {
97 if (GetGame().IsMultiplayer())
98 return; // multiplayer handled on client side via OnExecuteClient
99 else
100 OnExecuteImpl(action_data); // single player
101 }

References GetGame(), and OnExecuteImpl().


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