DayZ 1.24
Loading...
Searching...
No Matches
ActionTakeItemToHands.c File Reference

Go to the source code of this file.

Classes

class  ActionTakeItemToHands
 

Functions

override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool UseMainItem ()
 
override bool MainItemAlwaysInHands ()
 
override void CreateAndSetupActionCallback (ActionData action_data)
 
override void Start (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
override void OnExecuteClient (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnEndClient (ActionData action_data)
 
void PerformSwap (ActionData action_data)
 

Variables

ActionTakeItemToHands m_Executable
 

Function Documentation

◆ ActionCondition()

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

Definition at line 112 of file ActionTakeItemToHands.c.

113 {
114 ItemBase targetItem = ItemBase.Cast(target.GetObject());
115 if (!targetItem || !targetItem.IsTakeable() || targetItem.IsBeingPlaced())
116 return false;
117
118 return player.GetInventory().CanSwapEntitiesEx(targetItem, item);
119 }

◆ CreateAndSetupActionCallback()

override void CreateAndSetupActionCallback ( ActionData action_data)

Definition at line 131 of file ActionTakeItemToHands.c.

132 {
133 EntityAI target = EntityAI.Cast(action_data.m_Target.GetObject());
134 if (!target)
135 return;
136
138
139 if (target.IsHeavyBehaviour())
140 Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY, GetCallbackClassTypename(), DayZPlayerConstants.STANCEMASK_ERECT));
141 else
142 return;
143
144 callback.SetActionData(action_data);
145 callback.InitActionComponent();
146 action_data.m_Callback = callback;
147 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ MainItemAlwaysInHands()

override bool MainItemAlwaysInHands ( )

Definition at line 126 of file ActionTakeItemToHands.c.

127 {
128 return true;
129 }

◆ OnEndClient()

override void OnEndClient ( ActionData action_data)

Definition at line 196 of file ActionTakeItemToHands.c.

197 {
198 if (m_Executable)
199 {
200 m_Executable = false;
201 return;
202 }
203
205 }
ActionTakeItemToHands m_Executable
void PerformSwap(ActionData action_data)

References m_Executable, and PerformSwap().

◆ OnEndServer()

override void OnEndServer ( ActionData action_data)

Definition at line 182 of file ActionTakeItemToHands.c.

183 {
184 if (m_Executable)
185 {
186 m_Executable = false;
187 return;
188 }
189
190 if (GetGame().IsMultiplayer())
191 return;
192
194 }
proto native CGame GetGame()

References GetGame(), m_Executable, and PerformSwap().

◆ OnExecuteClient()

override void OnExecuteClient ( ActionData action_data)

Definition at line 174 of file ActionTakeItemToHands.c.

175 {
176 if (!m_Executable)
177 return;
178
180 }

References m_Executable, and PerformSwap().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 163 of file ActionTakeItemToHands.c.

164 {
165 if (!m_Executable)
166 return;
167
168 if (GetGame().IsMultiplayer())
169 return;
170
172 }

References GetGame(), m_Executable, and PerformSwap().

◆ PerformSwap()

void PerformSwap ( ActionData action_data)

Definition at line 207 of file ActionTakeItemToHands.c.

208 {
209 EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
210 if (action_data.m_Player)
211 {
213 if (action_data.m_Player.NeedInventoryJunctureFromServer(ntarget, ntarget.GetHierarchyParent(), action_data.m_Player))
214 invMode = InventoryMode.JUNCTURE;
215
216 action_data.m_Player.TakeEntityToHandsImpl(invMode, ntarget);
217 }
218 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition Inventory.c:22

Referenced by OnEndClient(), OnEndServer(), OnExecuteClient(), and OnExecuteServer().

◆ Start()

override void Start ( ActionData action_data)

Definition at line 149 of file ActionTakeItemToHands.c.

150 {
151 super.Start(action_data);
152
153 bool b1 = action_data.m_MainItem.ConfigGetString("physLayer") == "item_large";
154 action_data.m_MainItem.m_ThrowItemOnDrop = b1;
155
156 EntityAI object = EntityAI.Cast(action_data.m_Target.GetObject());
157 if (!object || !object.IsHeavyBehaviour())
158 action_data.m_Player.GetActionManager().Interrupt();
159 else
160 m_Executable = true;
161 }
override bool IsHeavyBehaviour()
Definition ItemBase.c:8861

References IsHeavyBehaviour(), and m_Executable.

◆ UseMainItem()

override bool UseMainItem ( )

Definition at line 121 of file ActionTakeItemToHands.c.

122 {
123 return true;
124 }

Variable Documentation

◆ m_Executable