Content changes for grid splitting (#7645) (#7746)

Co-authored-by: Vera Aguilera Puerto <gradientvera@outlook.com>
This commit is contained in:
metalgearsloth
2022-04-24 13:54:25 +10:00
committed by GitHub
parent a2da1580d0
commit 72da2db62d
35 changed files with 291 additions and 151 deletions

View File

@@ -38,6 +38,7 @@ namespace Content.Server.Shuttles.EntitySystems
SubscribeLocalEvent<DockingComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<DockingComponent, PowerChangedEvent>(OnPowerChange);
SubscribeLocalEvent<DockingComponent, AnchorStateChangedEvent>(OnAnchorChange);
SubscribeLocalEvent<DockingComponent, ReAnchorEvent>(OnDockingReAnchor);
SubscribeLocalEvent<DockingComponent, GetVerbsEvent<InteractionVerb>>(OnVerb);
SubscribeLocalEvent<DockingComponent, BeforeDoorAutoCloseEvent>(OnAutoClose);
@@ -256,6 +257,16 @@ namespace Content.Server.Shuttles.EntitySystems
}
}
private void OnDockingReAnchor(EntityUid uid, DockingComponent component, ref ReAnchorEvent args)
{
if (!component.Docked) return;
var other = Comp<DockingComponent>(component.DockedWith!.Value);
Undock(component);
Dock(component, other);
}
private void OnPowerChange(EntityUid uid, DockingComponent component, PowerChangedEvent args)
{
// This is because power can change during startup for <Reasons> and undock