9class ActionCreateGreenhouseGardenPlot: ActionContinuousBase
11 GardenPlot m_GardenPlot;
12 private const float CAMERA_PITCH_THRESHOLD = -30;
14 void ActionCreateGreenhouseGardenPlot()
21 m_Text =
"#make_garden_plot";
35 if ( player.IsPlacingLocal() )
41 Object target_object = target.GetObject();
46 if ( target_object && ( greenHouse || polytunnel ) )
48 string action_selection = target_object.GetActionComponentName( target.GetComponentIndex() );
50 if ( action_selection !=
"soil" )
56 vector pos = target_object.GetPosition();
58 g_Game.GetObjectsAtPosition3D( pos, 2, nearest_objects, proxy_cargos );
60 for (
int i = 0; i < nearest_objects.Count(); ++i )
62 Object object = nearest_objects.Get( i );
64 if (
object.IsInherited( GardenPlot ) )
76 override void OnFinishProgressServer(
ActionData action_data )
80 EntityAI entity_for_placing = action_data.m_MainItem;
81 Object targetObject = action_data.m_Target.GetObject();
83 vector position = targetObject.GetPosition();
90 position[1] = position[1] - 1.15;
92 position[1] = position[1] - 1.05;
94 vector orientation = targetObject.GetOrientation();
97 if (
g_Game.IsMultiplayer())
102 m_GardenPlot = GardenPlot.Cast(
g_Game.CreateObjectEx(
"GardenPlotPolytunnel", position,
ECE_KEEPHEIGHT));
106 m_GardenPlot = GardenPlot.Cast(
g_Game.CreateObjectEx(
"GardenPlotGreenhouse", position,
ECE_KEEPHEIGHT));
109 m_GardenPlot.SetOrientation(orientation);
110 m_GardenPlot.OnPlacementComplete(action_data.m_Player);
114 if (!
g_Game.IsMultiplayer())
119 m_GardenPlot = GardenPlot.Cast(
g_Game.CreateObjectEx(
"GardenPlotPolytunnel", position,
ECE_KEEPHEIGHT));
123 m_GardenPlot = GardenPlot.Cast(
g_Game.CreateObjectEx(
"GardenPlotGreenhouse", position,
ECE_KEEPHEIGHT));
126 m_GardenPlot.SetOrientation(orientation);
127 m_GardenPlot.OnPlacementComplete(action_data.m_Player);