Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondetach.c
Go to the documentation of this file.
2 {
3  int m_AttSlot;
4 }
5 
7 {
8  string m_ItemName = "";
9 
10  void ActionDetach()
11  {
12  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS;
13  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS;
14  m_Text = "#take_to_hands";
15  }
16 
17  override void CreateConditionComponents()
18  {
21  }
22 
23  override bool HasProneException()
24  {
25  return true;
26  }
27 
28  override typename GetInputType()
29  {
31  }
32 
33  override bool HasProgress()
34  {
35  return false;
36  }
37 
38  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
39  {
40  ItemBase tgt_item = ItemBase.Cast( target.GetObject() );
41  EntityAI tgt_parent = EntityAI.Cast( target.GetParent() );
42  EntityAI tgt_entity = EntityAI.Cast( target.GetObject() );
43 
44  if ( !tgt_item || !tgt_entity || !tgt_parent )
45  return false;
46 
47  if ( !tgt_parent || !tgt_item.IsItemBase() || !tgt_item.IsTakeable() || tgt_item.IsBeingPlaced() )
48  return false;
49 
50  if ( player.GetCommand_Vehicle() )
51  return false;
52 
53  if ( player.GetInventory().CanAddEntityIntoHands(tgt_entity) ) //&& !player.GetInventory().CanAddEntityIntoInventory(tgt_entity) )
54  {
55  if ( tgt_entity.GetHierarchyRootPlayer() != player )
56  {
57  if ( tgt_entity.CanDetachAttachment( tgt_parent ) && tgt_parent.CanReleaseAttachment( tgt_entity ) )
58  return true;
59  }
60  }
61 
62  return false;
63  }
64 
65  override void OnExecuteServer( ActionData action_data )
66  {
67  if ( GetGame().IsMultiplayer() )
68  return;
69 
70  ActionManagerClient am = ActionManagerClient.Cast(action_data.m_Player.GetActionManager());
71  am.UnlockInventory(action_data);
72 
73  EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
74  action_data.m_Player.PredictiveTakeEntityToHands(ntarget);
75 
76  }
77 
78  override void OnExecuteClient( ActionData action_data )
79  {
80  ActionManagerClient am = ActionManagerClient.Cast(action_data.m_Player.GetActionManager());
81  am.UnlockInventory(action_data);
82 
83  EntityAI ntarget = EntityAI.Cast(action_data.m_Target.GetObject());
84  action_data.m_Player.PredictiveTakeEntityToHands(ntarget);
85  }
86 
87  override void CreateAndSetupActionCallback( ActionData action_data )
88  {
89  EntityAI target = EntityAI.Cast(action_data.m_Target.GetObject());
90  ActionBaseCB callback;
91  if (!target)
92  return;
93 
94  if (target.IsHeavyBehaviour())
95  {
96  Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HEAVY,GetCallbackClassTypename(),DayZPlayerConstants.STANCEMASK_ERECT));
97  }
98  else
99  {
100  if( action_data.m_Player.IsPlayerInStance(DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT) )
101  {
102  Class.CastTo(callback, action_data.m_Player.AddCommandModifier_Action(DayZPlayerConstants.CMD_ACTIONMOD_PICKUP_HANDS,GetCallbackClassTypename()));
103  }
104  else
105  {
106  Class.CastTo(callback, action_data.m_Player.StartCommand_Action(DayZPlayerConstants.CMD_ACTIONFB_PICKUP_HANDS,GetCallbackClassTypename(),DayZPlayerConstants.STANCEMASK_PRONE));
107  }
108  }
109  callback.SetActionData(action_data);
110  callback.InitActionComponent();
111  action_data.m_Callback = callback;
112  }
113 };
ItemBase
Definition: inventoryitem.c:730
DetachActionData
Definition: actiondetach.c:1
GetGame
proto native CGame GetGame()
OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition: actiondetach.c:65
ActionDetach
void ActionDetach()
Definition: actiondetach.c:10
ContinuousInteractActionInput
Definition: actioninput.c:521
GetInputType
override GetInputType()
Definition: actiondetach.c:28
CreateConditionComponents
override void CreateConditionComponents()
Definition: actiondetach.c:17
CCINone
Definition: ccinone.c:1
OnExecuteClient
override void OnExecuteClient(ActionData action_data)
Definition: actiondetach.c:78
CreateAndSetupActionCallback
override void CreateAndSetupActionCallback(ActionData action_data)
Definition: actiondetach.c:87
HasProneException
override bool HasProneException()
Definition: actiondetach.c:23
m_ItemName
DetachActionData m_ItemName
CCTCursorNoRuinCheck
Definition: cctcursornoruincheck.c:1
ActionInteractBase
Definition: actioninteractbase.c:54
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actiondetach.c:38
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
HasProgress
override bool HasProgress()
Definition: actiondetach.c:33
ActionManagerClient
Definition: actionmanagerclient.c:4
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
ActionBaseCB
Definition: animatedactionbase.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
EntityAI
Definition: building.c:5