Cargo selling fixes (#17876)

- Prevent selling dead mobs (getting used as easy corpse disposal).
- Fix a broadcast event being raised O(n) times instead of O(1)
This commit is contained in:
metalgearsloth
2023-07-10 05:24:48 +10:00
committed by GitHub
parent ec58d2e716
commit 68b56878bc
3 changed files with 24 additions and 20 deletions

View File

@@ -10,6 +10,7 @@ using Content.Shared.Access.Systems;
using Content.Shared.Administration.Logs;
using Content.Shared.Cargo;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Mobs.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
@@ -45,12 +46,18 @@ public sealed partial class CargoSystem : SharedCargoSystem
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
private ISawmill _sawmill = default!;
private EntityQuery<TransformComponent> _xformQuery;
private EntityQuery<CargoSellBlacklistComponent> _blacklistQuery;
private EntityQuery<MobStateComponent> _mobQuery;
public override void Initialize()
{
base.Initialize();
_sawmill = Logger.GetSawmill("cargo");
_xformQuery = GetEntityQuery<TransformComponent>();
_blacklistQuery = GetEntityQuery<CargoSellBlacklistComponent>();
_mobQuery = GetEntityQuery<MobStateComponent>();
InitializeConsole();
InitializeShuttle();
InitializeTelepad();
@@ -60,6 +67,7 @@ public sealed partial class CargoSystem : SharedCargoSystem
public override void Shutdown()
{
base.Shutdown();
ShutdownShuttle();
CleanupCargoShuttle();
}