Files
tbd-station-14/Content.Shared/Shuttles/Systems/SharedShuttleConsoleSystem.cs
metalgearsloth 1e82d0c7ed Add docking window to shuttle consoles (#8756)
* lewd

* A

* Realtime

* Sleepy dork

* Draw radar position

* Accurate infiltrator

* experiments

* Better drawing

* Labels

* I need aan adult

* Cleanup

* Show toggles

* display I guess

* A

* fix

* fix

* cleanupsies

* Bit more polish

* Make sure mass scanners actually work

* Remove dummy state

* fren

* opposite

* aghost crash

* comment

* What's in a name

* woops

* Show docking ports

* Dock highlighting

* Drawing dock

* Shitty docks

* Lots of docking drawing

* Autodock working

* dork

* More graceful shutdown

* zoomies

* Lines and distance change

* revert

* Good enough

* cleanup

* Fix default range

* Dock UI and loc update

* Update on undock

* Loc fixes
2022-06-16 15:28:16 +10:00

51 lines
1.6 KiB
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Movement;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Serialization;
namespace Content.Shared.Shuttles.Systems
{
public abstract class SharedShuttleConsoleSystem : EntitySystem
{
[Dependency] protected readonly ActionBlockerSystem ActionBlockerSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PilotComponent, UpdateCanMoveEvent>(HandleMovementBlock);
SubscribeLocalEvent<PilotComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<PilotComponent, ComponentShutdown>(HandlePilotShutdown);
}
[Serializable, NetSerializable]
protected sealed class PilotComponentState : ComponentState
{
public EntityUid? Console { get; }
public PilotComponentState(EntityUid? uid)
{
Console = uid;
}
}
protected virtual void HandlePilotShutdown(EntityUid uid, PilotComponent component, ComponentShutdown args)
{
ActionBlockerSystem.UpdateCanMove(uid);
}
private void OnStartup(EntityUid uid, PilotComponent component, ComponentStartup args)
{
ActionBlockerSystem.UpdateCanMove(uid);
}
private void HandleMovementBlock(EntityUid uid, PilotComponent component, UpdateCanMoveEvent args)
{
if (component.LifeStage > ComponentLifeStage.Running)
return;
if (component.Console == null) return;
args.Cancel();
}
}
}