public static bool CreateNewPlayer(Player p, WorldMap map) { var startingChunks = map.ChunkGrid.ByFlags[ChunkFlag.STARTING_CHUNK]; foreach (var chunk in startingChunks) { if (chunk.Buildings.Count == 0) { var centreCoords = chunk.Tiles.FindTileWithout(TerrainData.WATER); var tile = chunk.GetTile(centreCoords.Value); map.Build(p, BuildingID.CITY_CENTRE, tile); tile.TerrainData = 0; var unit = Unit.CreateNew(); map.Units.SpawnUnit(unit, tile, p); return(true); } } Log.Error($"No place found for new player {p}"); throw new Exception("No place found for new player"); }