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

Go to the source code of this file.

Classes

class  PlaceObjectActionReciveData
 

Functions

PlaceObjectActionReciveData ActionReciveData ActionDeployObject ()
 
override bool HasAlternativeInterrupt ()
 
override bool IsDeploymentAction ()
 
override bool CanBeUsedWithBrokenLegs ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
override void OnStartClient (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnFinishProgressClient (ActionData action_data)
 
override void OnEndClient (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnStartAnimationLoop (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
override void HandleReciveData (ActionReciveData action_recive_data, ActionData action_data)
 
void SetupAnimation (ItemBase item)
 

Variables

vector m_Position
 
vector m_Orientation
 

Function Documentation

◆ ActionCondition()

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

Definition at line 30 of file ActionDeployObject.c.

31 {
32 //Client
33 if (!GetGame().IsDedicatedServer())
34 {
35 if (player.IsPlacingLocal())
36 {
37 if (!player.GetHologramLocal().IsColliding())
38 {
39 if (item.CanBePlaced(player, player.GetHologramLocal().GetProjectionEntity().GetPosition()))
40 return true;
41 }
42 }
43 return false;
44 }
45 //Server
46 return true;
47 }
proto native CGame GetGame()

References GetGame().

◆ ActionConditionContinue()

override bool ActionConditionContinue ( ActionData action_data)

Definition at line 49 of file ActionDeployObject.c.

50 {
51 //Server
52 if (GetGame().IsDedicatedServer())
53 {
54 if (action_data.m_Player.IsPlacingServer())
55 {
56 if (GetGame().IsMultiplayer())
57 action_data.m_Player.GetHologramServer().EvaluateCollision(action_data.m_MainItem);
58
59 if (!action_data.m_Player.GetHologramServer().IsColliding())
60 {
61 if (action_data.m_MainItem.CanBePlaced(action_data.m_Player, action_data.m_Player.GetHologramServer().GetProjectionEntity().GetPosition()))
62 return true;
63 }
64 return false;
65 }
66 return false;
67 }
68 return true;
69 }

References GetGame().

◆ ActionDeployObject()

PlaceObjectActionReciveData ActionReciveData ActionDeployObject ( )

Definition at line 1 of file ActionDeployObject.c.

10 {
11 m_CommandUID = 0;
12 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
13 }
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

◆ CanBeUsedWithBrokenLegs()

override bool CanBeUsedWithBrokenLegs ( )

Definition at line 25 of file ActionDeployObject.c.

26 {
27 return false;
28 }

◆ HandleReciveData()

override void HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )

◆ HasAlternativeInterrupt()

override bool HasAlternativeInterrupt ( )

Definition at line 15 of file ActionDeployObject.c.

16 {
17 return true;
18 }

◆ IsDeploymentAction()

override bool IsDeploymentAction ( )

Definition at line 20 of file ActionDeployObject.c.

21 {
22 return true;
23 }

◆ OnEndClient()

override void OnEndClient ( ActionData action_data)

Definition at line 159 of file ActionDeployObject.c.

160 {
161 super.OnEndClient(action_data);
162
164 if (!poActionData.m_AlreadyPlaced)
165 {
166 action_data.m_Player.PlacingCancelLocal();
167
168 //action terminated locally, send cancel to server
169 poActionData.m_Player.GetActionManager().RequestEndAction();
170 if (action_data.m_Player.GetHologramLocal())
171 action_data.m_Player.GetHologramLocal().SetUpdatePosition(true);
172
174 if (action_data.m_MainItem.GetInventory().GetCurrentInventoryLocation(source) && source.GetType() == InventoryLocationType.GROUND)
175 action_data.m_Player.PredictiveTakeEntityToHands(action_data.m_MainItem);
176 }
177 }
InventoryLocationType
types of Inventory Location
InventoryLocation.

◆ OnEndServer()

override void OnEndServer ( ActionData action_data)

Definition at line 179 of file ActionDeployObject.c.

180 {
181 super.OnEndServer(action_data);
182
183 if (!action_data || !action_data.m_MainItem)
184 return;
185
187 if (!poActionData.m_AlreadyPlaced)
188 {
189 GetGame().ClearJunctureEx(action_data.m_Player, action_data.m_MainItem);
190 action_data.m_MainItem.SetIsBeingPlaced(false);
191
192 if (GetGame().IsMultiplayer())
193 {
194 action_data.m_Player.PlacingCancelServer();
195 action_data.m_MainItem.SoundSynchRemoteReset();
196 }
197 else
198 {
199 //local singleplayer
200 action_data.m_Player.PlacingCancelLocal();
201 action_data.m_Player.PlacingCancelServer();
202 }
203 }
204 else
205 {
206 action_data.m_MainItem.SetIsDeploySound(false);
207 action_data.m_MainItem.SetIsPlaceSound(false);
208 action_data.m_MainItem.SoundSynchRemoteReset();
209
210 if (action_data.m_MainItem.IsBasebuildingKit())
211 action_data.m_MainItem.Delete();
212 else
213 GetGame().ClearJunctureEx(action_data.m_Player, action_data.m_MainItem);
214 }
215 }

References GetGame().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 228 of file ActionDeployObject.c.

229 {
230 action_data.m_MainItem.SoundSynchRemote();
231 }

◆ OnFinishProgressClient()

override void OnFinishProgressClient ( ActionData action_data)

Definition at line 144 of file ActionDeployObject.c.

145 {
147 if (!poActionData)
148 return;
149
151 vector position = action_data.m_Player.GetLocalProjectionPosition();
152 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
153
154 poActionData.m_AlreadyPlaced = true;
155
156 entity_for_placing.OnPlacementComplete(action_data.m_Player, position, orientation);
157 }

◆ OnStartAnimationLoop()

override void OnStartAnimationLoop ( ActionData action_data)

Definition at line 217 of file ActionDeployObject.c.

218 {
219 if (!GetGame().IsDedicatedServer())
220 {
221 if (action_data.m_Player.GetItemInHands())
222 ActiondeployObjectCB.Cast(action_data.m_Callback).DropDuringPlacing(); //legacy stuff
223
225 }
226 }
void DropDuringPlacing()
DEPRECATED.

References DropDuringPlacing(), and GetGame().

◆ OnStartClient()

override void OnStartClient ( ActionData action_data)

Definition at line 104 of file ActionDeployObject.c.

105 {
107 if (!poActionData)
108 return;
109
110 if (GetGame().IsMultiplayer())
111 action_data.m_Player.PlacingCompleteLocal();
112 }

References GetGame().

◆ OnStartServer()

override void OnStartServer ( ActionData action_data)

Definition at line 114 of file ActionDeployObject.c.

115 {
116 if (GetGame().IsMultiplayer())
117 {
120
121 if (!poActionData)
122 return;
123
125 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
126 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
127
128 if (action_data.m_MainItem)
129 {
130 poActionData.m_Player.PlacingStartServer(action_data.m_MainItem);
131
132 GetGame().AddActionJuncture(action_data.m_Player, entity_for_placing, 10000);
133 action_data.m_MainItem.SetIsBeingPlaced(true);
134 }
135 }
136 else
137 {
138 //local singleplayer
139 action_data.m_Player.PlacingStartServer(action_data.m_MainItem);
140 action_data.m_MainItem.SetIsBeingPlaced(true);
141 }
142 }

References GetGame().

◆ ReadFromContext()

override bool ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )

Definition at line 243 of file ActionDeployObject.c.

244 {
247
248 super.ReadFromContext(ctx, action_recive_data);
250
251 vector entity_position = "0 0 0";
252 vector entity_orientation = "0 0 0";
253 if (!ctx.Read(entity_position))
254 return false;
255 if (!ctx.Read(entity_orientation))
256 return false;
257
258 action_data_po.m_Position = entity_position;
259 action_data_po.m_Orientation = entity_orientation;
260
261 return true;
262 }

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )

Definition at line 71 of file ActionDeployObject.c.

72 {
73 if (super.SetupAction(player, target, item, action_data, extra_data))
74 {
77 poActionData.m_AlreadyPlaced = false;
78 if (!GetGame().IsDedicatedServer())
79 {
80 player.GetHologramLocal().SetUpdatePosition(false);
81
82 Hologram hologram = player.GetHologramLocal();
83 if (hologram)
84 {
85 poActionData.m_Position = player.GetHologramLocal().GetProjectionPosition();
86 poActionData.m_Orientation = player.GetHologramLocal().GetProjectionOrientation();
87
88 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
89 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
90 }
91 else
92 return false;
93 }
94
95 if (!action_data.m_MainItem)
96 return false;
97
98 SetupAnimation(action_data.m_MainItem);
99 return true;
100 }
101 return false;
102 }
void SetupAnimation(ItemBase item)

References GetGame(), and SetupAnimation().

◆ SetupAnimation()

void SetupAnimation ( ItemBase item)

Definition at line 275 of file ActionDeployObject.c.

276 {
277 if (item.IsDeployable())
278 {
279 if (item.IsHeavyBehaviour())
280 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_HEAVY;
281 else if (item.IsOneHandedBehaviour())
282 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_1HD;
283 else if (item.IsTwoHandedBehaviour())
284 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_2HD;
285 else
286 Debug.Log("Error: check " + item + " behaviour");
287 }
288 else
289 {
290 if (item.IsHeavyBehaviour())
291 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_HEAVY;
292 else if (item.IsOneHandedBehaviour())
293 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_1HD;
294 else if (item.IsTwoHandedBehaviour())
295 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_2HD;
296 else
297 Debug.Log("Error: check " + item + " behaviour");
298 }
299 }
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133

References Debug::Log().

Referenced by SetupAction().

◆ WriteToContext()

override void WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )

Definition at line 233 of file ActionDeployObject.c.

234 {
235 super.WriteToContext(ctx, action_data);
236
238
239 ctx.Write(poActionData.m_Position);
240 ctx.Write(poActionData.m_Orientation);
241 }

Variable Documentation

◆ m_Orientation

vector m_Orientation

Definition at line 11 of file ActionDeployObject.c.

◆ m_Position

vector m_Position

Definition at line 10 of file ActionDeployObject.c.