3 override void CreateActionComponent()
11 GardenPlot m_GardenPlot;
21 m_Text =
"#make_garden_plot";
27 if (!
GetGame().IsDedicatedServer())
30 if (player.GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS)
33 if (player.IsPlacingLocal())
35 Hologram hologram = player.GetHologramLocal();
37 Class.CastTo(item_GP, hologram.GetProjectionEntity());
38 CheckSurfaceBelowGardenPlot(player, item_GP, hologram);
40 if (!hologram.IsColliding())
51 override void SetupAnimation(
ItemBase item)
59 void CheckSurfaceBelowGardenPlot(
PlayerBase player, GardenPlot item_GP,
Hologram hologram)
62 item_GP.GetCollisionBox(min_max);
63 float offset = min_max[1][1] - min_max[0][1];
65 vector pos_adjusted = item_GP.GetPosition();
66 pos_adjusted[1] = pos_adjusted[1] + offset;
68 if (item_GP.CanBePlaced(player, pos_adjusted) )
70 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftCloseProjectionVector())))
72 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightCloseProjectionVector())))
74 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetLeftFarProjectionVector())))
76 if (item_GP.CanBePlaced(NULL, item_GP.CoordToParent(hologram.GetRightFarProjectionVector())))
78 hologram.SetIsCollidingGPlot(
false);
87 hologram.SetIsCollidingGPlot(
true);
90 override void DropDuringPlacing(
PlayerBase player)
94 override void OnFinishProgressClient(
ActionData action_data)
98 poActionData.m_AlreadyPlaced =
true;
101 override void OnFinishProgressServer(
ActionData action_data)
105 EntityAI entity_for_placing = action_data.m_MainItem;
106 vector position = action_data.m_Player.GetLocalProjectionPosition();
107 vector orientation = action_data.m_Player.GetLocalProjectionOrientation();
111 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramServer().PlaceEntity(entity_for_placing));
112 m_GardenPlot.SetOrientation(orientation);
113 action_data.m_Player.GetHologramServer().CheckPowerSource();
114 action_data.m_Player.PlacingCompleteServer();
116 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
120 if (!
GetGame().IsMultiplayer())
122 m_GardenPlot = GardenPlot.Cast(action_data.m_Player.GetHologramLocal().PlaceEntity(entity_for_placing));
123 m_GardenPlot.SetOrientation(orientation);
124 action_data.m_Player.PlacingCompleteLocal();
126 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
129 GetGame().ClearJuncture(action_data.m_Player, entity_for_placing);
130 action_data.m_MainItem.SetIsBeingPlaced(
false);
132 poActionData.m_AlreadyPlaced =
true;
133 action_data.m_MainItem.SoundSynchRemoteReset();
135 MiscGameplayFunctions.DealAbsoluteDmg(action_data.m_MainItem, 10);