-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sprites-but-gaming
- Loading branch information
Showing
122 changed files
with
115,740 additions
and
582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
Content.Server/DeltaV/Station/Components/StationSurfaceComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Content.Server.Station.Systems; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Server.Station.Components; | ||
|
||
/// <summary> | ||
/// Loads a surface map on mapinit. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(StationSurfaceSystem))] | ||
public sealed partial class StationSurfaceComponent : Component | ||
{ | ||
/// <summary> | ||
/// Path to the map to load. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public ResPath? MapPath; | ||
|
||
/// <summary> | ||
/// The map that was loaded. | ||
/// </summary> | ||
[DataField] | ||
public EntityUid? Map; | ||
} |
40 changes: 40 additions & 0 deletions
40
Content.Server/DeltaV/Station/Systems/StationSurfaceSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.