Bluespace lockers fix (#13575)
This commit is contained in:
@@ -41,7 +41,7 @@ public sealed class BluespaceLockerLink : StationEventSystem
|
|||||||
comp.AutoLinksUseProperties = true;
|
comp.AutoLinksUseProperties = true;
|
||||||
comp.AutoLinkProperties.BluespaceEffectOnInit = true;
|
comp.AutoLinkProperties.BluespaceEffectOnInit = true;
|
||||||
comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true;
|
comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true;
|
||||||
_bluespaceLocker.GetTarget(potentialLink, comp);
|
_bluespaceLocker.GetTarget(potentialLink, comp, true);
|
||||||
_bluespaceLocker.BluespaceEffect(potentialLink, comp, comp, true);
|
_bluespaceLocker.BluespaceEffect(potentialLink, comp, comp, true);
|
||||||
|
|
||||||
Sawmill.Info($"Converted {ToPrettyString(potentialLink)} to bluespace locker");
|
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)
|
private void OnStartup(EntityUid uid, BluespaceLockerComponent component, ComponentStartup args)
|
||||||
{
|
{
|
||||||
GetTarget(uid, component);
|
GetTarget(uid, component, true);
|
||||||
|
|
||||||
if (component.BehaviorProperties.BluespaceEffectOnInit)
|
if (component.BehaviorProperties.BluespaceEffectOnInit)
|
||||||
BluespaceEffect(uid, component, component, true);
|
BluespaceEffect(uid, component, component, true);
|
||||||
@@ -194,7 +194,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
return true;
|
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)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -220,9 +220,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
|
|
||||||
if (targetBluespaceComponent == null)
|
if (targetBluespaceComponent == null)
|
||||||
{
|
{
|
||||||
using var compInitializeHandle =
|
targetBluespaceComponent = AddComp<BluespaceLockerComponent>(potentialLink);
|
||||||
EntityManager.AddComponentUninitialized<BluespaceLockerComponent>(potentialLink);
|
|
||||||
targetBluespaceComponent = compInitializeHandle.Comp;
|
|
||||||
|
|
||||||
if (component.AutoLinksBidirectional)
|
if (component.AutoLinksBidirectional)
|
||||||
targetBluespaceComponent.BluespaceLinks.Add(lockerUid);
|
targetBluespaceComponent.BluespaceLinks.Add(lockerUid);
|
||||||
@@ -230,7 +228,8 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
if (component.AutoLinksUseProperties)
|
if (component.AutoLinksUseProperties)
|
||||||
targetBluespaceComponent.BehaviorProperties = component.AutoLinkProperties with {};
|
targetBluespaceComponent.BehaviorProperties = component.AutoLinkProperties with {};
|
||||||
|
|
||||||
compInitializeHandle.Dispose();
|
GetTarget(potentialLink, targetBluespaceComponent, true);
|
||||||
|
BluespaceEffect(potentialLink, targetBluespaceComponent, targetBluespaceComponent, true);
|
||||||
}
|
}
|
||||||
else if (component.AutoLinksBidirectional)
|
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 there are no possible link targets and no links, return null
|
||||||
if (component.BluespaceLinks.Count == 0)
|
if (component.BluespaceLinks.Count == 0)
|
||||||
{
|
{
|
||||||
if (component.MinBluespaceLinks == 0)
|
if (component.MinBluespaceLinks == 0 && init)
|
||||||
RemComp<BluespaceLockerComponent>(lockerUid);
|
RemComp<BluespaceLockerComponent>(lockerUid);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user