Skip to content

Commit

Permalink
Fix job booklets spawn under station (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
t0stiman authored Dec 3, 2023
1 parent 757a52e commit e558fbd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Mapify/SceneInitializers/GameContent/StationSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ public override void Run()
private static void SetupJobBookletSpawnSurface(Station station, StationController stationController)
{
PointOnPlane jobBookletSpawnSurface = station.transform.parent.GetComponentInChildren<PointOnPlane>();
if (jobBookletSpawnSurface != null)
return;
GameObject jobBookletSpawnSurfaceObject = station.gameObject.NewChildWithPosition("JobSpawnerAnchor", station.transform.TransformPoint(station.bookletSpawnArea.center));
jobBookletSpawnSurface = jobBookletSpawnSurfaceObject.AddComponent<PointOnPlane>();
Vector3 size = station.bookletSpawnArea.size;
jobBookletSpawnSurface.xSize = size.x;
jobBookletSpawnSurface.xSize = size.z;

if (jobBookletSpawnSurface == null)
{
GameObject jobBookletSpawnSurfaceObject = station.gameObject.NewChildWithPosition("JobSpawnerAnchor", station.transform.TransformPoint(station.bookletSpawnArea.center));
jobBookletSpawnSurface = jobBookletSpawnSurfaceObject.AddComponent<PointOnPlane>();
Vector3 size = station.bookletSpawnArea.size;
jobBookletSpawnSurface.xSize = size.x;
jobBookletSpawnSurface.zSize = size.z;
}

StationController_Field_jobBookletSpawnSurface.SetValue(stationController, jobBookletSpawnSurface);
}

Expand Down

0 comments on commit e558fbd

Please sign in to comment.