38 if (!
GetGame().IsDedicatedServer())
40 if (player.IsPlacingLocal())
42 if (!player.GetHologramLocal().IsColliding())
44 if (item.
CanBePlaced(player, player.GetHologramLocal().GetProjectionEntity().GetPosition()))
56 override bool ActionConditionContinue(ActionData action_data)
59 if (
GetGame().IsDedicatedServer())
61 if (action_data.m_Player.IsPlacingServer())
64 action_data.m_Player.GetHologramServer().EvaluateCollision(action_data.m_MainItem);
66 if (!action_data.m_Player.GetHologramServer().IsColliding())
68 if (action_data.m_MainItem.CanBePlaced(action_data.m_Player, action_data.m_Player.GetHologramServer().GetProjectionEntity().GetPosition()))
78 override bool SetupAction(
PlayerBase player, ActionTarget target,
ItemBase item, out ActionData action_data,
Param extra_data = NULL)
80 if (super.SetupAction(player, target, item, action_data, extra_data))
86 poActionData.m_AlreadyPlaced =
false;
88 if (!
GetGame().IsDedicatedServer())
90 player.GetHologramLocal().SetUpdatePosition(
false);
92 Hologram hologram = player.GetHologramLocal();
98 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
99 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
107 if (!poActionData.m_MainItem)
110 SetupAnimation(poActionData.m_MainItem);
126 override void OnStartServer(ActionData action_data)
128 super.OnStartServer(action_data);
136 EntityAI entity_for_placing = poActionData.m_MainItem;
137 poActionData.m_Player.SetLocalProjectionPosition(poActionData.m_Position);
138 poActionData.m_Player.SetLocalProjectionOrientation(poActionData.m_Orientation);
140 if (poActionData.m_MainItem)
142 poActionData.m_Player.PlacingStartServer(poActionData.m_MainItem);
144 GetGame().AddActionJuncture(poActionData.m_Player, entity_for_placing, 10000);
145 poActionData.m_MainItem.SetIsBeingPlaced(
true);
151 poActionData.m_Player.PlacingStartServer(poActionData.m_MainItem);
152 poActionData.m_MainItem.SetIsBeingPlaced(
true);
155 if (poActionData.m_MainItem.GetPlaceSoundset() !=
string.Empty)
156 poActionData.m_MainItem.StartItemSoundServer(SoundConstants.ITEM_PLACE);
158 if (poActionData.m_MainItem.GetLoopDeploySoundset() !=
string.Empty)
159 poActionData.m_MainItem.StartItemSoundServer(SoundConstants.ITEM_DEPLOY_LOOP);
162 override void OnFinishProgressClient(ActionData action_data)
168 EntityAI entity_for_placing = poActionData.m_MainItem;
169 vector position = poActionData.m_Player.GetLocalProjectionPosition();
170 vector orientation = poActionData.m_Player.GetLocalProjectionOrientation();
172 poActionData.m_AlreadyPlaced =
true;
174 entity_for_placing.OnPlacementComplete(poActionData.m_Player, position, orientation);
177 override void OnFinishProgressServer(ActionData action_data)
179 super.OnFinishProgressServer(action_data);
181 if (action_data.m_MainItem.GetDeploySoundset() !=
string.Empty)
182 action_data.m_MainItem.StartItemSoundServer(SoundConstants.ITEM_DEPLOY);
183 if (action_data.m_MainItem.GetLoopDeploySoundset() !=
string.Empty)
184 action_data.m_MainItem.StopItemSoundServer(SoundConstants.ITEM_DEPLOY_LOOP);
187 override void OnEndClient(ActionData action_data)
189 super.OnEndClient(action_data);
195 if (!poActionData.m_AlreadyPlaced)
197 poActionData.m_Player.PlacingCancelLocal();
200 poActionData.m_Player.GetActionManager().RequestEndAction();
201 if (poActionData.m_Player.GetHologramLocal())
202 poActionData.m_Player.GetHologramLocal().SetUpdatePosition(
true);
205 if (poActionData.m_MainItem.GetInventory().GetCurrentInventoryLocation(source) && source.GetType() ==
InventoryLocationType.GROUND)
207 poActionData.m_Player.PredictiveTakeEntityToHands(poActionData.m_MainItem);
212 override void OnEndServer(ActionData action_data)
214 super.OnEndServer(action_data);
217 if (!poActionData || !poActionData.m_MainItem)
220 if (!poActionData.m_AlreadyPlaced)
222 GetGame().ClearJunctureEx(poActionData.m_Player, poActionData.m_MainItem);
223 poActionData.m_MainItem.SetIsBeingPlaced(
false);
227 poActionData.m_Player.PlacingCancelServer();
232 poActionData.m_Player.PlacingCancelLocal();
233 poActionData.m_Player.PlacingCancelServer();
238 if (poActionData.m_MainItem.IsBasebuildingKit())
240 poActionData.m_MainItem.Delete();
244 GetGame().ClearJunctureEx(poActionData.m_Player, poActionData.m_MainItem);
248 if (poActionData.m_MainItem.GetLoopDeploySoundset() !=
string.Empty)
249 poActionData.m_MainItem.StopItemSoundServer(SoundConstants.ITEM_DEPLOY_LOOP);
281 if (!action_recive_data)
284 super.ReadFromContext(ctx, action_recive_data);
287 vector entity_position =
"0 0 0";
288 vector entity_orientation =
"0 0 0";
289 if (!ctx.Read(entity_position))
291 if (!ctx.Read(entity_orientation))
294 recive_data_po.m_Position = entity_position;
295 recive_data_po.m_Orientation = entity_orientation;
300 override void HandleReciveData(ActionReciveData action_recive_data, ActionData action_data)
302 super.HandleReciveData(action_recive_data, action_data);
307 action_data_po.m_Position = recive_data_po.m_Position;
308 action_data_po.m_Orientation = recive_data_po.m_Orientation;
313 Debug.Log(
string.Format(
"HandleReciveData | received pos: %1", action_data_po.m_Position),
"hologramLogs");
322 if (item.IsHeavyBehaviour())
326 else if (item.IsOneHandedBehaviour())
330 else if (item.IsTwoHandedBehaviour())
336 Debug.Log(
"Error: check " + item +
" behaviour");
341 if (item.IsHeavyBehaviour())
345 else if (item.IsOneHandedBehaviour())
349 else if (item.IsTwoHandedBehaviour())
355 Debug.Log(
"Error: check " + item +
" behaviour");