diff --git a/Content.Server/StationEvents/Events/BluespaceLocker.cs b/Content.Server/StationEvents/Events/BluespaceLocker.cs index a9be23db58..88de303c07 100644 --- a/Content.Server/StationEvents/Events/BluespaceLocker.cs +++ b/Content.Server/StationEvents/Events/BluespaceLocker.cs @@ -41,7 +41,7 @@ public sealed class BluespaceLockerLink : StationEventSystem comp.AutoLinksUseProperties = true; comp.AutoLinkProperties.BluespaceEffectOnInit = true; comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true; - _bluespaceLocker.GetTarget(potentialLink, comp); + _bluespaceLocker.GetTarget(potentialLink, comp, true); _bluespaceLocker.BluespaceEffect(potentialLink, comp, comp, true); Sawmill.Info($"Converted {ToPrettyString(potentialLink)} to bluespace locker"); diff --git a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs index 467391594e..ea4b5e1d06 100644 --- a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs +++ b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs @@ -37,7 +37,7 @@ public sealed class BluespaceLockerSystem : EntitySystem private void OnStartup(EntityUid uid, BluespaceLockerComponent component, ComponentStartup args) { - GetTarget(uid, component); + GetTarget(uid, component, true); if (component.BehaviorProperties.BluespaceEffectOnInit) BluespaceEffect(uid, component, component, true); @@ -194,7 +194,7 @@ public sealed class BluespaceLockerSystem : EntitySystem return true; } - public (EntityUid uid, EntityStorageComponent storageComponent, BluespaceLockerComponent? bluespaceLockerComponent)? GetTarget(EntityUid lockerUid, BluespaceLockerComponent component) + public (EntityUid uid, EntityStorageComponent storageComponent, BluespaceLockerComponent? bluespaceLockerComponent)? GetTarget(EntityUid lockerUid, BluespaceLockerComponent component, bool init = false) { while (true) { @@ -220,9 +220,7 @@ public sealed class BluespaceLockerSystem : EntitySystem if (targetBluespaceComponent == null) { - using var compInitializeHandle = - EntityManager.AddComponentUninitialized(potentialLink); - targetBluespaceComponent = compInitializeHandle.Comp; + targetBluespaceComponent = AddComp(potentialLink); if (component.AutoLinksBidirectional) targetBluespaceComponent.BluespaceLinks.Add(lockerUid); @@ -230,7 +228,8 @@ public sealed class BluespaceLockerSystem : EntitySystem if (component.AutoLinksUseProperties) targetBluespaceComponent.BehaviorProperties = component.AutoLinkProperties with {}; - compInitializeHandle.Dispose(); + GetTarget(potentialLink, targetBluespaceComponent, true); + BluespaceEffect(potentialLink, targetBluespaceComponent, targetBluespaceComponent, true); } else if (component.AutoLinksBidirectional) { @@ -245,7 +244,7 @@ public sealed class BluespaceLockerSystem : EntitySystem // If there are no possible link targets and no links, return null if (component.BluespaceLinks.Count == 0) { - if (component.MinBluespaceLinks == 0) + if (component.MinBluespaceLinks == 0 && init) RemComp(lockerUid); return null;