static IntPoint3? GetLocNearEntry(EnvironmentObject env) { foreach (var p in IntPoint2.SquareSpiral(env.StartLocation.ToIntPoint(), env.Width / 2)) { if (env.Size.Plane.Contains(p) == false) continue; var z = env.GetDepth(p); var p3 = new IntPoint3(p, z); if (EnvironmentHelpers.CanEnter(env, p3)) return p3; } return null; }