Files
Delta-v/Content.Server/DeltaV/Station/Systems/StationSurfaceSystem.cs
T
8588bb0e0d glacier real (#1169)
* glacier real

* troll

* atmosia tweaks

* 1 less can of plasma not too op

* replace troll generator with solar crate

* add StationSurface to glacier

* add surface map

* biome stuff upstream #28017

* unpause after loading

* fix no terrain

* comment out the surface spawning

* shipyard

* glacier justiceroid

* updateprototype and cleanup

* fix random shit

* untroll

* courier

* add to test :trollface:

* fix

* futureproofing

* hot loop inlet lmao

* tweak some pumps in atmosia

* carpy and make salv locker lighting better

* Edit lights, move salv dock, add justice maints, edit entity names for casing consistency, other minor edits

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
2024-07-17 11:39:09 -05:00

41 lines
1.2 KiB
C#

using Content.Server.Parallax;
using Content.Server.Station.Components;
using Robust.Server.GameObjects;
namespace Content.Server.Station.Systems;
public sealed class StationSurfaceSystem : EntitySystem
{
[Dependency] private readonly BiomeSystem _biome = default!;
[Dependency] private readonly MapSystem _map = default!;
[Dependency] private readonly MapLoaderSystem _mapLoader = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StationSurfaceComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(Entity<StationSurfaceComponent> ent, ref MapInitEvent args)
{
if (ent.Comp.MapPath is not {} path)
return;
var map = _map.CreateMap(out var mapId);
if (!_mapLoader.TryLoad(mapId, path.ToString(), out _))
{
Log.Error($"Failed to load surface map {ent.Comp.MapPath}!");
Del(map);
return;
}
// loading replaced the map entity with a new one so get the latest id
map = _map.GetMap(mapId);
_map.SetPaused(map, false);
_biome.SetEnabled(map); // generate the terrain after the grids loaded to prevent it getting hidden under it
ent.Comp.Map = map;
}
}