Don't enable ghost roles for salvage spawns (#15598)

This commit is contained in:
metalgearsloth
2023-04-21 15:06:22 +10:00
committed by GitHub
parent 857c1462be
commit 3d1333b9ab
2 changed files with 25 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.Decals;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Shuttles.Events;
using Content.Shared.Decals;
using Content.Shared.Parallax.Biomes;
@@ -313,6 +314,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
#region Load
/// <summary>
/// Loads all of the chunks for a particular biome, as well as handle any marker chunks.
/// </summary>
private void LoadChunks(
BiomeComponent component,
EntityUid gridUid,
@@ -358,7 +362,13 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
for (var k = 0; k < layerProto.GroupCount; k++)
{
Spawn(layerProto.Prototype, new EntityCoordinates(gridUid, point));
// If it is a ghost role then purge it
// TODO: This is *kind* of a bandaid but natural mobs spawns needs a lot more work.
// Ideally we'd just have ghost role and non-ghost role variants for some stuff.
var uid = EntityManager.CreateEntityUninitialized(layerProto.Prototype, new EntityCoordinates(gridUid, point));
RemComp<GhostTakeoverAvailableComponent>(uid);
RemComp<GhostRoleComponent>(uid);
EntityManager.InitializeAndStartEntity(uid);
}
break;
@@ -381,6 +391,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
}
}
/// <summary>
/// Loads a particular queued chunk for a biome.
/// </summary>
private void LoadChunk(
BiomeComponent component,
EntityUid gridUid,
@@ -494,6 +507,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
#region Unload
/// <summary>
/// Handles all of the queued chunk unloads for a particular biome.
/// </summary>
private void UnloadChunks(BiomeComponent component, EntityUid gridUid, MapGridComponent grid, FastNoiseLite noise)
{
var active = _activeChunks[component];
@@ -510,6 +526,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
}
}
/// <summary>
/// Unloads a specific biome chunk.
/// </summary>
private void UnloadChunk(BiomeComponent component, EntityUid gridUid, MapGridComponent grid, Vector2i chunk, FastNoiseLite noise, List<(Vector2i, Tile)> tiles)
{
// Reverse order to loading

View File

@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using Content.Server.Atmos;
using Content.Server.Atmos.Components;
using Content.Server.CPUJob.JobQueues;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Parallax;
using Content.Server.Procedural;
using Content.Server.Salvage.Expeditions;
@@ -359,7 +360,10 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
foreach (var entry in EntitySpawnCollection.GetSpawns(mobGroup.Entries, random))
{
_entManager.SpawnEntity(entry, spawnPosition);
var uid = _entManager.CreateEntityUninitialized(entry, spawnPosition);
_entManager.RemoveComponent<GhostTakeoverAvailableComponent>(uid);
_entManager.RemoveComponent<GhostRoleComponent>(uid);
_entManager.InitializeAndStartEntity(uid);
}
await SuspendIfOutOfTime();