Skip to content

Commit

Permalink
fix(src): По идее починена загрузка лаваленда
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrodinger71 committed Feb 21, 2025
1 parent 4e8d5ce commit 6c21fcf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
56 changes: 28 additions & 28 deletions Content.Server/ADT/Planet/PlanetSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,36 @@ public EntityUid SpawnPlanet(ProtoId<PlanetPrototype> id, bool runMapInit = true
/// Spawns an initialized planet map from a planet prototype and loads a grid onto it.
/// Returns the map entity if loading succeeded.
/// </summary>
// public EntityUid? LoadPlanet(ProtoId<PlanetPrototype> id, string path)
// {
// var map = SpawnPlanet(id, runMapInit: false);
// var mapId = Comp<MapComponent>(map).MapId;
public EntityUid? LoadPlanet(ProtoId<PlanetPrototype> id, string path)
{
var map = SpawnPlanet(id, runMapInit: false);
var mapId = Comp<MapComponent>(map).MapId;

// if (!_mapManager.IsMapInitialized(mapId))
// {
// Log.Error($"Map with ID {mapId} does not exist. Cannot proceed with loading.");
// return null;
// }
if (!_mapManager.IsMapInitialized(mapId))
{
Log.Error($"Map with ID {mapId} does not exist. Cannot proceed with loading.");
return null;
}

// if (!_mapLoader.TryLoadGrid(mapId, new ResPath(path), out var grids))
// {
// Log.Error($"Failed to load planet grid {path} for planet {id}!");
// return null;
// }
if (!_mapLoader.TryLoadGrid(mapId, new ResPath(path), out var grids))
{
Log.Error($"Failed to load planet grid {path} for planet {id}!");
return null;
}

// if (grids.HasValue)
// {
// var gridUid = grids.Value;
// _setTiles.Clear();
// var aabb = Comp<MapGridComponent>(gridUid).LocalAABB;
// _biome.ReserveTiles(map, aabb.Enlarged(0.2f), _setTiles);
// }
// else
// {
// Log.Error("Grid not found for this map.");
// }
if (grids.HasValue)
{
var gridUid = grids.Value;
_setTiles.Clear();
var aabb = Comp<MapGridComponent>(gridUid).LocalAABB;
_biome.ReserveTiles(map, aabb.Enlarged(0.2f), _setTiles);
}
else
{
Log.Error("Grid not found for this map.");
}

// _map.InitializeMap(map);
// return map;
// }
_map.InitializeMap(map);
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private void OnMapInit(Entity<StationPlanetSpawnerComponent> ent, ref MapInitEve
if (ent.Comp.GridPath is not {} path)
return;

// ent.Comp.Map = _planet.LoadPlanet(ent.Comp.Planet, path.ToString()); # Закоменчено в апстриме
ent.Comp.Map = _planet.LoadPlanet(ent.Comp.Planet, path.ToString());
}

private void OnShutdown(Entity<StationPlanetSpawnerComponent> ent, ref ComponentShutdown args)
Expand Down

0 comments on commit 6c21fcf

Please sign in to comment.