Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionpacktent.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DEFAULT_DEPLOY); //Use same time as Deploy
6  }
7 }
8 
10 {
12  {
13  m_CallbackClass = ActionPackTentCB;
15  m_CommandUID = 0;
16  m_FullBody = true;
17  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
18  m_Text = "#pack_tent";
19  }
20 
21  override void CreateConditionComponents()
22  {
25  }
26 
27  override typename GetInputType()
28  {
30  }
31 
32  override bool IsUsingProxies()
33  {
34  return true;
35  }
36 
37  override bool HasProgress()
38  {
39  return true;
40  }
41 
42  override bool HasAlternativeInterrupt()
43  {
44  return true;
45  }
46 
47  override bool ActionConditionContinue( ActionData action_data )
48  {
49  Object targetParent = action_data.m_Target.GetParent();
50  TentBase tent = TentBase.Cast( targetParent );
51  return tent.CanBePacked();
52  }
53 
55  {
57  return action_data;
58  }
59 
60  override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data = NULL)
61  {
62  if ( super.SetupAction(player, target, item, action_data, extra_data ))
63  {
64  PlaceObjectActionData poActionData;
65  poActionData = PlaceObjectActionData.Cast(action_data);
66  poActionData.m_AlreadyPlaced = false;
67  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_2HD; //Call the animation
68  return true;
69  }
70  return false;
71  }
72 
73  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
74  {
75  Object targetObject = target.GetObject();
76  Object targetParent = target.GetParent();
77 
78  TentBase inventory_tent = TentBase.Cast(targetObject);
79  if (inventory_tent && inventory_tent.GetHierarchyRootPlayer())
80  {
81  return false; //tent is somewhere in player's inventory
82  }
83 
84  if ( player && targetObject && targetParent )
85  {
86  TentBase tent = TentBase.Cast( targetParent );
87  if ( tent.CanBePacked() )
88  {
89  array<string> selections = new array<string>;
90  targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
91 
92  for ( int s = 0; s < selections.Count(); s++ )
93  {
94  if ( selections[s] == "pack" )
95  {
96  return true;
97  }
98  }
99  }
100  }
101  return false;
102  }
103 
104  override void Start( ActionData action_data ) //Setup on start of action
105  {
106  super.Start(action_data);
107 
108  if ( action_data.m_Player ) action_data.m_Player.TryHideItemInHands(true);
109  }
110 
111  override void OnExecute( ActionData action_data )
112  {
113  Object targetParent = action_data.m_Target.GetParent();
114  TentBase tent = TentBase.Cast( targetParent );
115  tent.SetIsBeingPacked(true);
116  }
117 
118  override void OnEnd( ActionData action_data )
119  {
120  Object targetParent = action_data.m_Target.GetParent();
121  TentBase tent = TentBase.Cast( targetParent );
122  tent.SetIsBeingPacked(false);
123  if ( action_data.m_Player ) action_data.m_Player.TryHideItemInHands(false);
124  }
125 
126  override void OnFinishProgressServer( ActionData action_data )
127  {
128  //vector offset = Vector(1, 0, 0);
129  Object targetParent = action_data.m_Target.GetParent();
130  TentBase tent = TentBase.Cast( targetParent );
131  if (tent.CanBePacked())
132  {
133  tent.Pack( true );
134  tent.SetPosition( action_data.m_Player.GetPosition() /*+ offset*/ ); //Add offset to allign tent with player
135  tent.SetOrientation( action_data.m_Player.GetOrientation() );
136  tent.PlaceOnSurface();
137  }
138  }
139 
140  override string GetAdminLogMessage(ActionData action_data)
141  {
142  return " packed " + action_data.m_Target.GetParent().GetDisplayName() + " with Hands ";
143  }
144 };
ItemBase
Definition: inventoryitem.c:730
Start
override void Start(ActionData action_data)
Definition: actionpacktent.c:104
ActionPackTent
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
Definition: actionpacktent.c:11
OnExecute
override void OnExecute(ActionData action_data)
Definition: actionpacktent.c:111
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
CAContinuousTime
Definition: cacontinuoustime.c:1
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actionpacktent.c:126
ContinuousInteractActionInput
Definition: actioninput.c:521
HasAlternativeInterrupt
override bool HasAlternativeInterrupt()
Definition: actionpacktent.c:42
IsUsingProxies
override bool IsUsingProxies()
Definition: actionpacktent.c:32
UASoftSkillsWeight
Definition: actionconstants.c:118
ActionPackTentCB
Definition: actionpacktent.c:1
CCINone
Definition: ccinone.c:1
ActionConditionContinue
override bool ActionConditionContinue(ActionData action_data)
Definition: actionpacktent.c:47
OnEnd
override void OnEnd(ActionData action_data)
Definition: actionpacktent.c:118
CCTCursorParent
Definition: cctcursorparent.c:1
UAMaxDistances
Definition: actionconstants.c:104
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
PlaceObjectActionData
Definition: actiondeploybase.c:1
CreateActionData
override ActionData CreateActionData()
Definition: actionpacktent.c:54
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
TentBase
Definition: cartent.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
array< string >
m_Text
protected string m_Text
Definition: actionbase.c:49
CreateConditionComponents
override void CreateConditionComponents()
Definition: actionpacktent.c:21
GetInputType
override GetInputType()
Definition: actionpacktent.c:27
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
SetupAction
override bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition: actionpacktent.c:60
ActionContinuousBase
Definition: actioncontinuousbase.c:132
GetAdminLogMessage
override string GetAdminLogMessage(ActionData action_data)
Definition: actionpacktent.c:140
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
HasProgress
override bool HasProgress()
Definition: actionpacktent.c:37
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actionpacktent.c:73