DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл ActionDeployObject.c

См. исходные тексты.

Структуры данных

class  PlaceObjectActionReciveData
 

Функции

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)
 

Переменные

vector m_Position
 
vector m_Orientation
 

Функции

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
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 {
41 return true;
42 }
43 }
44 }
45 return false;
46 }
47 //Server
48 return true;
49 }
Definition EntityAI.c:95
proto native CGame GetGame()

Перекрестные ссылки GetGame().

◆ ActionConditionContinue()

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

Перекрестные ссылки GetGame().

◆ ActionDeployObject()

PlaceObjectActionReciveData ActionReciveData ActionDeployObject ( )
10 {
11 m_CommandUID = 0;
12 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
13 }
int m_CommandUID
Definition ActionBase.c:31
int m_StanceMask
Definition ActionBase.c:33
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

◆ CanBeUsedWithBrokenLegs()

override bool CanBeUsedWithBrokenLegs ( )
26 {
27 return false;
28 }

◆ HandleReciveData()

override void HandleReciveData ( ActionReciveData action_recive_data,
ActionData action_data )
281 {
282 super.HandleReciveData(action_recive_data, action_data);
283
286
287 action_data_po.m_Position = recive_data_po.m_Position;
288 action_data_po.m_Orientation = recive_data_po.m_Orientation;
289 }
Definition ActionDeployBase.c:2
Definition ActionDeployObject.c:2

◆ HasAlternativeInterrupt()

override bool HasAlternativeInterrupt ( )
16 {
17 return true;
18 }

◆ IsDeploymentAction()

override bool IsDeploymentAction ( )
21 {
22 return true;
23 }

◆ OnEndClient()

override void OnEndClient ( ActionData action_data)
166 {
167 super.OnEndClient(action_data);
168
170 if (!poActionData.m_AlreadyPlaced)
171 {
172 action_data.m_Player.PlacingCancelLocal();
173
174 //action terminated locally, send cancel to server
175 poActionData.m_Player.GetActionManager().RequestEndAction();
176 if (action_data.m_Player.GetHologramLocal())
177 action_data.m_Player.GetHologramLocal().SetUpdatePosition(true);
178
180 if (action_data.m_MainItem.GetInventory().GetCurrentInventoryLocation(source) && source.GetType() == InventoryLocationType.GROUND)
181 {
182 action_data.m_Player.PredictiveTakeEntityToHands(action_data.m_MainItem);
183 }
184 }
185 }
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4
InventoryLocation.
Definition InventoryLocation.c:29

◆ OnEndServer()

override void OnEndServer ( ActionData action_data)
188 {
189 super.OnEndServer(action_data);
190
191 if (!action_data || !action_data.m_MainItem)
192 return;
193
195 if (!poActionData.m_AlreadyPlaced)
196 {
197 GetGame().ClearJunctureEx(action_data.m_Player, action_data.m_MainItem);
198 action_data.m_MainItem.SetIsBeingPlaced(false);
199
200 if (GetGame().IsMultiplayer())
201 {
202 action_data.m_Player.PlacingCancelServer();
203 action_data.m_MainItem.SoundSynchRemoteReset();
204 }
205 else
206 {
207 //local singleplayer
208 action_data.m_Player.PlacingCancelLocal();
209 action_data.m_Player.PlacingCancelServer();
210 }
211 }
212 else
213 {
214 action_data.m_MainItem.SetIsDeploySound(false);
215 action_data.m_MainItem.SetIsPlaceSound(false);
216 action_data.m_MainItem.SoundSynchRemoteReset();
217
218 if (action_data.m_MainItem.IsBasebuildingKit())
219 {
220 action_data.m_MainItem.Delete();
221 }
222 else
223 {
224 GetGame().ClearJunctureEx(action_data.m_Player, action_data.m_MainItem);
225 }
226 }
227 }

Перекрестные ссылки GetGame().

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)
245 {
246 action_data.m_MainItem.SoundSynchRemote();
247 }

◆ OnFinishProgressClient()

override void OnFinishProgressClient ( ActionData action_data)
151 {
153 if (!poActionData)
154 return;
155
157 vector position = action_data.m_Player.GetLocalProjectionPosition();
158 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
159
160 poActionData.m_AlreadyPlaced = true;
161
162 entity_for_placing.OnPlacementComplete(action_data.m_Player, position, orientation);
163 }
Definition Building.c:6
Definition EnConvert.c:106

◆ OnStartAnimationLoop()

override void OnStartAnimationLoop ( ActionData action_data)
230 {
231 if (!GetGame().IsDedicatedServer())
232 {
233 if (action_data.m_Player.GetItemInHands())
234 ActiondeployObjectCB.Cast(action_data.m_Callback).DropDuringPlacing(); //legacy stuff
235
236 if (HasProgress()) // if object has no progress, it is moved directly when action finishes
237 {
238 ClearInventoryReservationEx(action_data); // Clear reservation as we put the main item from hands on ground
240 }
241 }
242 }
override bool HasProgress()
Definition ActionActivateTrap.c:41
void DropDuringPlacing()
DEPRECATED.

Перекрестные ссылки DropDuringPlacing(), GetGame() и HasProgress().

◆ OnStartClient()

override void OnStartClient ( ActionData action_data)
109 {
111 if (!poActionData)
112 return;
113
114 if (GetGame().IsMultiplayer())
115 action_data.m_Player.PlacingCompleteLocal();
116 }

Перекрестные ссылки GetGame().

◆ OnStartServer()

override void OnStartServer ( ActionData action_data)
119 {
120 super.OnStartServer(action_data);
121
122 if (GetGame().IsMultiplayer())
123 {
126
127 if (!poActionData)
128 return;
129
131 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
132 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
133
134 if (action_data.m_MainItem)
135 {
136 poActionData.m_Player.PlacingStartServer(action_data.m_MainItem);
137
138 GetGame().AddActionJuncture(action_data.m_Player, entity_for_placing, 10000);
139 action_data.m_MainItem.SetIsBeingPlaced(true);
140 }
141 }
142 else
143 {
144 //local singleplayer
145 action_data.m_Player.PlacingStartServer(action_data.m_MainItem);
146 action_data.m_MainItem.SetIsBeingPlaced(true);
147 }
148 }

Перекрестные ссылки GetGame().

◆ ReadFromContext()

override bool ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
260 {
263
264 super.ReadFromContext(ctx, action_recive_data);
266
267 vector entity_position = "0 0 0";
268 vector entity_orientation = "0 0 0";
269 if (!ctx.Read(entity_position))
270 return false;
271 if (!ctx.Read(entity_orientation))
272 return false;
273
274 action_data_po.m_Position = entity_position;
275 action_data_po.m_Orientation = entity_orientation;
276
277 return true;
278 }

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )
74 {
75 if (super.SetupAction(player, target, item, action_data, extra_data))
76 {
79 poActionData.m_AlreadyPlaced = false;
80 if (!GetGame().IsDedicatedServer())
81 {
82 player.GetHologramLocal().SetUpdatePosition(false);
83
84 Hologram hologram = player.GetHologramLocal();
85 if (hologram)
86 {
87 poActionData.m_Position = player.GetHologramLocal().GetProjectionPosition();
88 poActionData.m_Orientation = player.GetHologramLocal().GetProjectionOrientation();
89
90 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
91 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
92 }
93 else
94 {
95 return false;
96 }
97 }
98
99 if (!action_data.m_MainItem)
100 return false;
101
102 SetupAnimation(action_data.m_MainItem);
103 return true;
104 }
105 return false;
106 }
void SetupAnimation(ItemBase item)
Definition ActionDeployObject.c:291
Definition Hologram.c:2

Перекрестные ссылки GetGame() и SetupAnimation().

◆ SetupAnimation()

void SetupAnimation ( ItemBase item)
292 {
293 if (item.IsDeployable())
294 {
295 if (item.IsHeavyBehaviour())
296 {
297 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_HEAVY;
298 }
299 else if (item.IsOneHandedBehaviour())
300 {
301 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_1HD;
302 }
303 else if (item.IsTwoHandedBehaviour())
304 {
305 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DEPLOY_2HD;
306 }
307 else
308 {
309 Debug.Log("Error: check " + item + " behaviour");
310 }
311 }
312 else
313 {
314 if (item.IsHeavyBehaviour())
315 {
316 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_HEAVY;
317 }
318 else if (item.IsOneHandedBehaviour())
319 {
320 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_1HD;
321 }
322 else if (item.IsTwoHandedBehaviour())
323 {
324 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_PLACING_2HD;
325 }
326 else
327 {
328 Debug.Log("Error: check " + item + " behaviour");
329 }
330 }
331 }
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:136

Перекрестные ссылки Debug::Log() и m_CommandUID.

Используется в SetupAction().

◆ WriteToContext()

override void WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
250 {
251 super.WriteToContext(ctx, action_data);
252
254
255 ctx.Write(poActionData.m_Position);
256 ctx.Write(poActionData.m_Orientation);
257 }

Переменные

◆ m_Orientation

vector m_Orientation

◆ m_Position

vector m_Position