Skip to content

Commit

Permalink
Stopped CommRelay spawning inside planets
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxar-tc committed Nov 18, 2015
1 parent 89c71e2 commit a7a6068
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions EssentialsPlugin/Utility/MathUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ public static Vector3D RandomPositionFromPoint(Vector3D start, double distance)

public static Vector3 GenerateRandomEdgeVector()
{
float halfExtent = MyAPIGateway.Entities.WorldSafeHalfExtent() - 1000;
if (halfExtent == 0f)
halfExtent = 900000f;
float halfExtent = MyAPIGateway.Entities.WorldSafeHalfExtent();
if (halfExtent == 0f)
halfExtent = 900000f;
//if world size is infinite, put the relay 900km away from center to prevent it spawning inside a planet
else
halfExtent -= 1000;

return new Vector3(GenerateRandomCoord(halfExtent), GenerateRandomCoord(halfExtent), GenerateRandomCoord(halfExtent));
}
Expand Down

0 comments on commit a7a6068

Please sign in to comment.