DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionPackTent.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7}
8
10{
11 void ActionPackTent()
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
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
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};
ActionData CreateActionData()
Definition ActionBase.c:213
void CreateConditionComponents()
Definition ActionBase.c:218
protected float m_SpecialtyWeight
Definition ActionBase.c:68
bool IsUsingProxies()
not using plane object - it's using multiple proxies
Definition ActionBase.c:256
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition ActionBase.c:144
string GetAdminLogMessage(ActionData action_data)
bool HasProgress()
For UI: hiding of progress bar.
Definition ActionBase.c:238
protected string m_Text
Definition ActionBase.c:49
protected bool m_FullBody
Definition ActionBase.c:52
protected int m_StanceMask
Definition ActionBase.c:53
ActionPackTentCB ActionContinuousBaseCB ActionPackTent()
class ActionTargets ActionTarget
void Start()
Plays all elements this effects consists of.
Definition Effect.c:153
override void OnEnd()
Definition JumpEvents.c:57
protected ActionData m_ActionData
protected void OnFinishProgressServer(ActionData action_data)
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
ref ActionTarget m_Target
Definition ActionBase.c:32
override void CreateActionComponent()
override bool ActionConditionContinue(ActionData action_data)
protected void OnExecute(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const float DEFAULT
const float DEFAULT_DEPLOY
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602