Hide ruins spawns (#23857)

* Hide ruins spawns

* Update count

* Add naming
This commit is contained in:
metalgearsloth
2024-01-10 22:15:48 +11:00
committed by GitHub
parent 9d52833938
commit b30afb357c
3 changed files with 33 additions and 1 deletions

View File

@@ -23,6 +23,16 @@ public record struct GridSpawnGroup
public int MinCount = 1; public int MinCount = 1;
public int MaxCount = 1; public int MaxCount = 1;
/// <summary>
/// Hide the IFF of the grid.
/// </summary>
public bool Hide = false;
/// <summary>
/// Should we set the metadata name of a grid. Useful for admin purposes.
/// </summary>
public bool NameGrid = false;
public GridSpawnGroup() public GridSpawnGroup()
{ {
} }

View File

@@ -3,6 +3,7 @@ using Content.Server.Station.Components;
using Content.Server.Station.Events; using Content.Server.Station.Events;
using Content.Shared.Cargo.Components; using Content.Shared.Cargo.Components;
using Content.Shared.CCVar; using Content.Shared.CCVar;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -87,6 +88,13 @@ public sealed partial class ShuttleSystem
if (_loader.TryLoad(mapId, path.ToString(), out var ent) && ent.Count == 1) if (_loader.TryLoad(mapId, path.ToString(), out var ent) && ent.Count == 1)
{ {
if (group.Hide)
{
var iffComp = EnsureComp<IFFComponent>(ent[0]);
iffComp.Flags |= IFFFlags.Hide;
Dirty(ent[0], iffComp);
}
if (TryComp<ShuttleComponent>(ent[0], out var shuttle)) if (TryComp<ShuttleComponent>(ent[0], out var shuttle))
{ {
TryFTLProximity(ent[0], shuttle, targetGrid.Value); TryFTLProximity(ent[0], shuttle, targetGrid.Value);
@@ -96,6 +104,12 @@ public sealed partial class ShuttleSystem
{ {
valid = false; valid = false;
} }
if (group.NameGrid)
{
var name = path.FilenameWithoutExtension;
_metadata.SetEntityName(ent[0], name);
}
} }
else else
{ {

View File

@@ -52,6 +52,10 @@
paths: paths:
- /Maps/Shuttles/mining.yml - /Maps/Shuttles/mining.yml
ruins: ruins:
hide: true
nameGrid: true
minCount: 2
maxCount: 2
paths: paths:
- /Maps/Ruins/derelict.yml - /Maps/Ruins/derelict.yml
- /Maps/Ruins/djstation.yml - /Maps/Ruins/djstation.yml
@@ -59,7 +63,7 @@
- /Maps/Ruins/relaystation.yml - /Maps/Ruins/relaystation.yml
- /Maps/Ruins/whiteship_ancient.yml - /Maps/Ruins/whiteship_ancient.yml
- /Maps/Ruins/whiteship_bluespacejumper.yml - /Maps/Ruins/whiteship_bluespacejumper.yml
- type: entity - type: entity
@@ -75,6 +79,10 @@
paths: paths:
- /Maps/Shuttles/mining.yml - /Maps/Shuttles/mining.yml
ruins: ruins:
hide: true
nameGrid: true
minCount: 2
maxCount: 2
paths: paths:
- /Maps/Ruins/derelict.yml - /Maps/Ruins/derelict.yml
- /Maps/Ruins/djstation.yml - /Maps/Ruins/djstation.yml