mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Move CartridgeLoader to shared * get containered bozo * the dirtening * mass shared the cartridges * predict keb cartridges * no overpopups * the tidying continues * review * aaaaaa * fix UI flickers * dependency me * mimed * refactor: removed unused usings, dots at the end of old xml-doc, additional in line-breaks --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: Fildrance <fildrance@gmail.com>
30 lines
1 KiB
C#
30 lines
1 KiB
C#
using Content.Shared.GPS.Components;
|
|
|
|
namespace Content.Shared.CartridgeLoader.Cartridges;
|
|
|
|
public sealed partial class AstroNavCartridgeSystem : EntitySystem
|
|
{
|
|
[Dependency] private CartridgeLoaderSystem _cartridgeLoaderSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<AstroNavCartridgeComponent, CartridgeAddedEvent>(OnCartridgeAdded);
|
|
SubscribeLocalEvent<AstroNavCartridgeComponent, CartridgeRemovedEvent>(OnCartridgeRemoved);
|
|
}
|
|
|
|
private void OnCartridgeAdded(Entity<AstroNavCartridgeComponent> ent, ref CartridgeAddedEvent args)
|
|
{
|
|
EnsureComp<HandheldGPSComponent>(args.Loader);
|
|
}
|
|
|
|
private void OnCartridgeRemoved(Entity<AstroNavCartridgeComponent> ent, ref CartridgeRemovedEvent args)
|
|
{
|
|
// only remove when the program itself is removed
|
|
if (!_cartridgeLoaderSystem.HasProgram<AstroNavCartridgeComponent>(args.Loader.AsNullable()))
|
|
{
|
|
RemComp<HandheldGPSComponent>(args.Loader);
|
|
}
|
|
}
|
|
}
|