Bluespace lockers fix (#13575)
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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<BluespaceLockerComponent>(potentialLink);
|
||||
targetBluespaceComponent = compInitializeHandle.Comp;
|
||||
targetBluespaceComponent = AddComp<BluespaceLockerComponent>(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<BluespaceLockerComponent>(lockerUid);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user