Bluespace lockers update (#13469)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using Content.Server.Resist;
|
using Content.Server.Resist;
|
||||||
using Content.Server.Station.Components;
|
using Content.Server.Station.Components;
|
||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
|
using Content.Server.Storage.EntitySystems;
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -11,6 +12,7 @@ namespace Content.Server.StationEvents.Events;
|
|||||||
public sealed class BluespaceLockerLink : StationEventSystem
|
public sealed class BluespaceLockerLink : StationEventSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly BluespaceLockerSystem _bluespaceLocker = default!;
|
||||||
|
|
||||||
public override string Prototype => "BluespaceLockerLink";
|
public override string Prototype => "BluespaceLockerLink";
|
||||||
|
|
||||||
@@ -30,18 +32,17 @@ public sealed class BluespaceLockerLink : StationEventSystem
|
|||||||
!HasComp<StationMemberComponent>(potentialLink.ToCoordinates().GetGridUid(EntityManager)))
|
!HasComp<StationMemberComponent>(potentialLink.ToCoordinates().GetGridUid(EntityManager)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
using var compInitializeHandle = EntityManager.AddComponentUninitialized<BluespaceLockerComponent>(potentialLink);
|
var comp = AddComp<BluespaceLockerComponent>(potentialLink);
|
||||||
var comp = compInitializeHandle.Comp;
|
|
||||||
|
|
||||||
comp.PickLinksFromSameMap = true;
|
comp.PickLinksFromSameMap = true;
|
||||||
comp.MinBluespaceLinks = 1;
|
comp.MinBluespaceLinks = 1;
|
||||||
comp.BluespaceEffectOnInit = true;
|
|
||||||
comp.BehaviorProperties.BluespaceEffectOnTeleportSource = true;
|
comp.BehaviorProperties.BluespaceEffectOnTeleportSource = true;
|
||||||
comp.AutoLinksBidirectional = true;
|
comp.AutoLinksBidirectional = true;
|
||||||
comp.AutoLinksUseProperties = true;
|
comp.AutoLinksUseProperties = true;
|
||||||
|
comp.AutoLinkProperties.BluespaceEffectOnInit = true;
|
||||||
comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true;
|
comp.AutoLinkProperties.BluespaceEffectOnTeleportSource = true;
|
||||||
|
_bluespaceLocker.GetTarget(potentialLink, comp);
|
||||||
compInitializeHandle.Dispose();
|
_bluespaceLocker.BluespaceEffect(potentialLink, comp, comp, true);
|
||||||
|
|
||||||
Sawmill.Info($"Converted {ToPrettyString(potentialLink)} to bluespace locker");
|
Sawmill.Info($"Converted {ToPrettyString(potentialLink)} to bluespace locker");
|
||||||
|
|
||||||
|
|||||||
@@ -57,12 +57,6 @@ public sealed class BluespaceLockerComponent : Component
|
|||||||
|
|
||||||
public CancellationTokenSource? CancelToken;
|
public CancellationTokenSource? CancelToken;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines if bluespace effect is show on component init
|
|
||||||
/// </summary>
|
|
||||||
[DataField("bluespaceEffectOnInit")]
|
|
||||||
public bool BluespaceEffectOnInit;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if links automatically added get the source locker set as a target
|
/// Determines if links automatically added get the source locker set as a target
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -75,8 +69,12 @@ public sealed class BluespaceLockerComponent : Component
|
|||||||
[DataField("autoLinksUseProperties"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("autoLinksUseProperties"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool AutoLinksUseProperties;
|
public bool AutoLinksUseProperties;
|
||||||
|
|
||||||
|
[DataField("usesSinceLinkClear"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int UsesSinceLinkClear;
|
public int UsesSinceLinkClear;
|
||||||
|
|
||||||
|
[DataField("bluespaceEffectMinInterval"), ViewVariables(VVAccess.ReadOnly)]
|
||||||
|
public uint BluespaceEffectNextTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines properties of automatically created links
|
/// Determines properties of automatically created links
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -111,12 +109,30 @@ public record BluespaceLockerBehaviorProperties
|
|||||||
[DataField("transportSentient"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("transportSentient"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool TransportSentient { get; set; } = true;
|
public bool TransportSentient { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the the locker will act on opens.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("actOnOpen"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool ActOnOpen { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the the locker will act on closes.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("actOnClose"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool ActOnClose { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delay to wait after closing before transporting
|
/// Delay to wait after closing before transporting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("delay"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("delay"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float Delay { get; set; }
|
public float Delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if bluespace effect is show on component init
|
||||||
|
/// </summary>
|
||||||
|
[DataField("bluespaceEffectOnInit"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool BluespaceEffectOnInit;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines prototype to spawn for bluespace effect
|
/// Defines prototype to spawn for bluespace effect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -135,12 +151,25 @@ public record BluespaceLockerBehaviorProperties
|
|||||||
[DataField("bluespaceEffectOnTeleportTarget"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("bluespaceEffectOnTeleportTarget"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool BluespaceEffectOnTeleportTarget { get; set; }
|
public bool BluespaceEffectOnTeleportTarget { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the minimum interval between bluespace effects
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="BluespaceEffectPrototype"/>
|
||||||
|
[DataField("bluespaceEffectMinInterval"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public double BluespaceEffectMinInterval { get; set; } = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses left before the locker is destroyed. -1 indicates infinite
|
/// Uses left before the locker is destroyed. -1 indicates infinite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("destroyAfterUses"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("destroyAfterUses"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int DestroyAfterUses { get; set; } = -1;
|
public int DestroyAfterUses { get; set; } = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Minimum number of entities that must be transported to count a use for <see cref="DestroyAfterUses"/>
|
||||||
|
/// </summary>
|
||||||
|
[DataField("destroyAfterUsesMinItemsToCountUse"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int DestroyAfterUsesMinItemsToCountUse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How to destroy the locker after it runs out of uses
|
/// How to destroy the locker after it runs out of uses
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -152,6 +181,18 @@ public record BluespaceLockerBehaviorProperties
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("clearLinksEvery"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("clearLinksEvery"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int ClearLinksEvery { get; set; } = -1;
|
public int ClearLinksEvery { get; set; } = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if cleared links have their component removed
|
||||||
|
/// </summary>
|
||||||
|
[DataField("clearLinksDebluespaces"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool ClearLinksDebluespaces { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Links will not be valid if they're not bidirectional
|
||||||
|
/// </summary>
|
||||||
|
[DataField("invalidateOneWayLinks"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool InvalidateOneWayLinks { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ using Content.Server.Tools.Systems;
|
|||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Server.Storage.EntitySystems;
|
namespace Content.Server.Storage.EntitySystems;
|
||||||
|
|
||||||
public sealed class BluespaceLockerSystem : EntitySystem
|
public sealed class BluespaceLockerSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
|
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
|
||||||
[Dependency] private readonly WeldableSystem _weldableSystem = default!;
|
[Dependency] private readonly WeldableSystem _weldableSystem = default!;
|
||||||
[Dependency] private readonly LockSystem _lockSystem = default!;
|
[Dependency] private readonly LockSystem _lockSystem = default!;
|
||||||
@@ -38,23 +39,42 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
GetTarget(uid, component);
|
GetTarget(uid, component);
|
||||||
|
|
||||||
if (component.BluespaceEffectOnInit)
|
if (component.BehaviorProperties.BluespaceEffectOnInit)
|
||||||
BluespaceEffect(uid, component);
|
BluespaceEffect(uid, component, component, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BluespaceEffect(EntityUid uid, BluespaceLockerComponent component)
|
public void BluespaceEffect(EntityUid effectTargetUid, BluespaceLockerComponent effectSourceComponent, BluespaceLockerComponent? effectTargetComponent, bool bypassLimit = false)
|
||||||
{
|
{
|
||||||
Spawn(component.BehaviorProperties.BluespaceEffectPrototype, uid.ToCoordinates());
|
if (!bypassLimit && Resolve(effectTargetUid, ref effectTargetComponent, false))
|
||||||
|
if (effectTargetComponent!.BehaviorProperties.BluespaceEffectMinInterval > 0)
|
||||||
|
{
|
||||||
|
var curTimeTicks = _timing.CurTick.Value;
|
||||||
|
if (curTimeTicks < effectTargetComponent.BluespaceEffectNextTime)
|
||||||
|
return;
|
||||||
|
|
||||||
|
effectTargetComponent.BluespaceEffectNextTime = curTimeTicks + (uint) (_timing.TickRate * effectTargetComponent.BehaviorProperties.BluespaceEffectMinInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
Spawn(effectSourceComponent.BehaviorProperties.BluespaceEffectPrototype, effectTargetUid.ToCoordinates());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreOpen(EntityUid uid, BluespaceLockerComponent component, StorageBeforeOpenEvent args)
|
private void PreOpen(EntityUid uid, BluespaceLockerComponent component, StorageBeforeOpenEvent args)
|
||||||
{
|
{
|
||||||
EntityStorageComponent? entityStorageComponent = null;
|
EntityStorageComponent? entityStorageComponent = null;
|
||||||
|
int transportedEntities = 0;
|
||||||
|
|
||||||
if (!Resolve(uid, ref entityStorageComponent))
|
if (!Resolve(uid, ref entityStorageComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.CancelToken?.Cancel();
|
if (component.CancelToken != null)
|
||||||
|
{
|
||||||
|
component.CancelToken.Cancel();
|
||||||
|
component.CancelToken = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!component.BehaviorProperties.ActOnOpen)
|
||||||
|
return;
|
||||||
|
|
||||||
// Select target
|
// Select target
|
||||||
var target = GetTarget(uid, component);
|
var target = GetTarget(uid, component);
|
||||||
@@ -74,11 +94,17 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (EntityManager.HasComponent<MindComponent>(entity))
|
if (EntityManager.HasComponent<MindComponent>(entity))
|
||||||
{
|
{
|
||||||
if (component.BehaviorProperties.TransportSentient)
|
if (!component.BehaviorProperties.TransportSentient)
|
||||||
|
continue;
|
||||||
|
|
||||||
entityStorageComponent.Contents.Insert(entity, EntityManager);
|
entityStorageComponent.Contents.Insert(entity, EntityManager);
|
||||||
|
transportedEntities++;
|
||||||
}
|
}
|
||||||
else if (component.BehaviorProperties.TransportEntities)
|
else if (component.BehaviorProperties.TransportEntities)
|
||||||
|
{
|
||||||
entityStorageComponent.Contents.Insert(entity, EntityManager);
|
entityStorageComponent.Contents.Insert(entity, EntityManager);
|
||||||
|
transportedEntities++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move contained air
|
// Move contained air
|
||||||
@@ -90,17 +116,28 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
|
|
||||||
// Bluespace effects
|
// Bluespace effects
|
||||||
if (component.BehaviorProperties.BluespaceEffectOnTeleportSource)
|
if (component.BehaviorProperties.BluespaceEffectOnTeleportSource)
|
||||||
BluespaceEffect(target.Value.uid, component);
|
BluespaceEffect(target.Value.uid, component, target.Value.bluespaceLockerComponent);
|
||||||
if (component.BehaviorProperties.BluespaceEffectOnTeleportTarget)
|
if (component.BehaviorProperties.BluespaceEffectOnTeleportTarget)
|
||||||
BluespaceEffect(uid, component);
|
BluespaceEffect(uid, component, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyAfterLimit(uid, component);
|
DestroyAfterLimit(uid, component, transportedEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ValidLink(EntityUid locker, EntityUid link, BluespaceLockerComponent lockerComponent)
|
private bool ValidLink(EntityUid locker, EntityUid link, BluespaceLockerComponent lockerComponent, bool intendToLink = false)
|
||||||
{
|
{
|
||||||
return link.Valid && TryComp<EntityStorageComponent>(link, out var linkStorage) && linkStorage.LifeStage != ComponentLifeStage.Deleted && link != locker;
|
if (!link.Valid ||
|
||||||
|
!TryComp<EntityStorageComponent>(link, out var linkStorage) ||
|
||||||
|
linkStorage.LifeStage == ComponentLifeStage.Deleted ||
|
||||||
|
link == locker)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (lockerComponent.BehaviorProperties.InvalidateOneWayLinks &&
|
||||||
|
!(intendToLink && lockerComponent.AutoLinksBidirectional) &&
|
||||||
|
!(HasComp<BluespaceLockerComponent>(link) && Comp<BluespaceLockerComponent>(link).BluespaceLinks.Contains(locker)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>True if any HashSet in <paramref name="a"/> would grant access to <paramref name="b"/></returns>
|
/// <returns>True if any HashSet in <paramref name="a"/> would grant access to <paramref name="b"/></returns>
|
||||||
@@ -120,15 +157,15 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
|
|
||||||
private bool ValidAutolink(EntityUid locker, EntityUid link, BluespaceLockerComponent lockerComponent)
|
private bool ValidAutolink(EntityUid locker, EntityUid link, BluespaceLockerComponent lockerComponent)
|
||||||
{
|
{
|
||||||
if (!ValidLink(locker, link, lockerComponent))
|
if (!ValidLink(locker, link, lockerComponent, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (lockerComponent.PickLinksFromSameMap &&
|
if (lockerComponent.PickLinksFromSameMap &&
|
||||||
link.ToCoordinates().GetMapId(_entityManager) != locker.ToCoordinates().GetMapId(_entityManager))
|
link.ToCoordinates().GetMapId(EntityManager) != locker.ToCoordinates().GetMapId(EntityManager))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (lockerComponent.PickLinksFromStationGrids &&
|
if (lockerComponent.PickLinksFromStationGrids &&
|
||||||
!HasComp<StationMemberComponent>(link.ToCoordinates().GetGridUid(_entityManager)))
|
!HasComp<StationMemberComponent>(link.ToCoordinates().GetGridUid(EntityManager)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (lockerComponent.PickLinksFromResistLockers &&
|
if (lockerComponent.PickLinksFromResistLockers &&
|
||||||
@@ -157,7 +194,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (EntityUid uid, EntityStorageComponent storageComponent, BluespaceLockerComponent? bluespaceLockerComponent)? GetTarget(EntityUid lockerUid, BluespaceLockerComponent component)
|
public (EntityUid uid, EntityStorageComponent storageComponent, BluespaceLockerComponent? bluespaceLockerComponent)? GetTarget(EntityUid lockerUid, BluespaceLockerComponent component)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -179,13 +216,26 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
component.BluespaceLinks.Add(potentialLink);
|
component.BluespaceLinks.Add(potentialLink);
|
||||||
if (component.AutoLinksBidirectional || component.AutoLinksUseProperties)
|
if (component.AutoLinksBidirectional || component.AutoLinksUseProperties)
|
||||||
{
|
{
|
||||||
var targetBluespaceComponent = EnsureComp<BluespaceLockerComponent>(potentialLink);
|
var targetBluespaceComponent = CompOrNull<BluespaceLockerComponent>(potentialLink);
|
||||||
|
|
||||||
|
if (targetBluespaceComponent == null)
|
||||||
|
{
|
||||||
|
using var compInitializeHandle =
|
||||||
|
EntityManager.AddComponentUninitialized<BluespaceLockerComponent>(potentialLink);
|
||||||
|
targetBluespaceComponent = compInitializeHandle.Comp;
|
||||||
|
|
||||||
if (component.AutoLinksBidirectional)
|
if (component.AutoLinksBidirectional)
|
||||||
targetBluespaceComponent.BluespaceLinks.Add(lockerUid);
|
targetBluespaceComponent.BluespaceLinks.Add(lockerUid);
|
||||||
|
|
||||||
if (component.AutoLinksUseProperties)
|
if (component.AutoLinksUseProperties)
|
||||||
targetBluespaceComponent.BehaviorProperties = component.AutoLinkProperties with {};
|
targetBluespaceComponent.BehaviorProperties = component.AutoLinkProperties with {};
|
||||||
|
|
||||||
|
compInitializeHandle.Dispose();
|
||||||
|
}
|
||||||
|
else if (component.AutoLinksBidirectional)
|
||||||
|
{
|
||||||
|
targetBluespaceComponent.BluespaceLinks.Add(lockerUid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (component.BluespaceLinks.Count >= component.MinBluespaceLinks)
|
if (component.BluespaceLinks.Count >= component.MinBluespaceLinks)
|
||||||
break;
|
break;
|
||||||
@@ -194,7 +244,12 @@ 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)
|
||||||
|
RemComp<BluespaceLockerComponent>(lockerUid);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to select, validate, and return a link
|
// Attempt to select, validate, and return a link
|
||||||
var links = component.BluespaceLinks.ToArray();
|
var links = component.BluespaceLinks.ToArray();
|
||||||
@@ -218,12 +273,16 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
private void PostClose(EntityUid uid, BluespaceLockerComponent component, bool doDelay = true)
|
private void PostClose(EntityUid uid, BluespaceLockerComponent component, bool doDelay = true)
|
||||||
{
|
{
|
||||||
EntityStorageComponent? entityStorageComponent = null;
|
EntityStorageComponent? entityStorageComponent = null;
|
||||||
|
int transportedEntities = 0;
|
||||||
|
|
||||||
if (!Resolve(uid, ref entityStorageComponent))
|
if (!Resolve(uid, ref entityStorageComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.CancelToken?.Cancel();
|
component.CancelToken?.Cancel();
|
||||||
|
|
||||||
|
if (!component.BehaviorProperties.ActOnClose)
|
||||||
|
return;
|
||||||
|
|
||||||
// Do delay
|
// Do delay
|
||||||
if (doDelay && component.BehaviorProperties.Delay > 0)
|
if (doDelay && component.BehaviorProperties.Delay > 0)
|
||||||
{
|
{
|
||||||
@@ -249,11 +308,17 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (EntityManager.HasComponent<MindComponent>(entity))
|
if (EntityManager.HasComponent<MindComponent>(entity))
|
||||||
{
|
{
|
||||||
if (component.BehaviorProperties.TransportSentient)
|
if (!component.BehaviorProperties.TransportSentient)
|
||||||
|
continue;
|
||||||
|
|
||||||
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
|
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
|
||||||
|
transportedEntities++;
|
||||||
}
|
}
|
||||||
else if (component.BehaviorProperties.TransportEntities)
|
else if (component.BehaviorProperties.TransportEntities)
|
||||||
|
{
|
||||||
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
|
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
|
||||||
|
transportedEntities++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move contained air
|
// Move contained air
|
||||||
@@ -287,20 +352,27 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
|
|
||||||
// Bluespace effects
|
// Bluespace effects
|
||||||
if (component.BehaviorProperties.BluespaceEffectOnTeleportSource)
|
if (component.BehaviorProperties.BluespaceEffectOnTeleportSource)
|
||||||
BluespaceEffect(uid, component);
|
BluespaceEffect(uid, component, component);
|
||||||
if (component.BehaviorProperties.BluespaceEffectOnTeleportTarget)
|
if (component.BehaviorProperties.BluespaceEffectOnTeleportTarget)
|
||||||
BluespaceEffect(target.Value.uid, component);
|
BluespaceEffect(target.Value.uid, component, target.Value.bluespaceLockerComponent);
|
||||||
|
|
||||||
DestroyAfterLimit(uid, component);
|
DestroyAfterLimit(uid, component, transportedEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DestroyAfterLimit(EntityUid uid, BluespaceLockerComponent component)
|
private void DestroyAfterLimit(EntityUid uid, BluespaceLockerComponent component, int transportedEntities)
|
||||||
{
|
{
|
||||||
|
if (component.BehaviorProperties.DestroyAfterUsesMinItemsToCountUse > transportedEntities)
|
||||||
|
return;
|
||||||
|
|
||||||
if (component.BehaviorProperties.ClearLinksEvery != -1)
|
if (component.BehaviorProperties.ClearLinksEvery != -1)
|
||||||
{
|
{
|
||||||
component.UsesSinceLinkClear++;
|
component.UsesSinceLinkClear++;
|
||||||
if (component.BehaviorProperties.ClearLinksEvery >= component.UsesSinceLinkClear)
|
if (component.BehaviorProperties.ClearLinksEvery <= component.UsesSinceLinkClear)
|
||||||
{
|
{
|
||||||
|
if (component.BehaviorProperties.ClearLinksDebluespaces)
|
||||||
|
foreach (var link in component.BluespaceLinks)
|
||||||
|
RemComp<BluespaceLockerComponent>(link);
|
||||||
|
|
||||||
component.BluespaceLinks.Clear();
|
component.BluespaceLinks.Clear();
|
||||||
component.UsesSinceLinkClear = 0;
|
component.UsesSinceLinkClear = 0;
|
||||||
}
|
}
|
||||||
@@ -316,12 +388,13 @@ public sealed class BluespaceLockerSystem : EntitySystem
|
|||||||
switch (component.BehaviorProperties.DestroyType)
|
switch (component.BehaviorProperties.DestroyType)
|
||||||
{
|
{
|
||||||
case BluespaceLockerDestroyType.Explode:
|
case BluespaceLockerDestroyType.Explode:
|
||||||
_explosionSystem.QueueExplosion(uid.ToCoordinates().ToMap(_entityManager),
|
_explosionSystem.QueueExplosion(uid.ToCoordinates().ToMap(EntityManager),
|
||||||
ExplosionSystem.DefaultExplosionPrototypeId, 4, 1, 2, maxTileBreak: 0);
|
ExplosionSystem.DefaultExplosionPrototypeId, 4, 1, 2, maxTileBreak: 0);
|
||||||
goto case BluespaceLockerDestroyType.Delete;
|
goto case BluespaceLockerDestroyType.Delete;
|
||||||
case BluespaceLockerDestroyType.Delete:
|
case BluespaceLockerDestroyType.Delete:
|
||||||
QueueDel(uid);
|
QueueDel(uid);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case BluespaceLockerDestroyType.DeleteComponent:
|
case BluespaceLockerDestroyType.DeleteComponent:
|
||||||
RemComp<BluespaceLockerComponent>(uid);
|
RemComp<BluespaceLockerComponent>(uid);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -364,14 +364,18 @@
|
|||||||
components:
|
components:
|
||||||
- type: BluespaceLocker
|
- type: BluespaceLocker
|
||||||
minBluespaceLinks: 1
|
minBluespaceLinks: 1
|
||||||
bluespaceEffectOnInit: true
|
|
||||||
behaviorProperties:
|
behaviorProperties:
|
||||||
delay: 0.5
|
delay: 1
|
||||||
|
actOnOpen: false
|
||||||
|
bluespaceEffectOnInit: true
|
||||||
bluespaceEffectOnTeleportSource: true
|
bluespaceEffectOnTeleportSource: true
|
||||||
bluespaceEffectOnTeleportTarget: true
|
bluespaceEffectOnTeleportTarget: true
|
||||||
destroyAfterUses: 2
|
destroyAfterUses: 1
|
||||||
|
destroyAfterUsesMinItemsToCountUse: 1
|
||||||
destroyType: Delete
|
destroyType: Delete
|
||||||
autoLinksUseProperties: true
|
autoLinksUseProperties: true
|
||||||
autoLinkProperties:
|
autoLinkProperties:
|
||||||
|
actOnOpen: false
|
||||||
|
actOnClose: false
|
||||||
destroyAfterUses: 2
|
destroyAfterUses: 2
|
||||||
destroyType: DeleteComponent
|
destroyType: DeleteComponent
|
||||||
|
|||||||
@@ -163,12 +163,15 @@
|
|||||||
pickLinksFromSameMap: true
|
pickLinksFromSameMap: true
|
||||||
minBluespaceLinks: 1
|
minBluespaceLinks: 1
|
||||||
behaviorProperties:
|
behaviorProperties:
|
||||||
|
clearLinksDebluespaces: true
|
||||||
transportEntities: false
|
transportEntities: false
|
||||||
bluespaceEffectOnTeleportSource: true
|
bluespaceEffectOnTeleportSource: true
|
||||||
clearLinksEvery: 2
|
clearLinksEvery: 2
|
||||||
autoLinksBidirectional: true
|
autoLinksBidirectional: true
|
||||||
autoLinksUseProperties: true
|
autoLinksUseProperties: true
|
||||||
|
usesSinceLinkClear: -1 # hacky
|
||||||
autoLinkProperties:
|
autoLinkProperties:
|
||||||
|
invalidateOneWayLinks: true
|
||||||
transportEntities: false
|
transportEntities: false
|
||||||
bluespaceEffectOnTeleportSource: true
|
bluespaceEffectOnTeleportSource: true
|
||||||
destroyAfterUses: 2
|
destroyAfterUses: 2
|
||||||
|
|||||||
@@ -492,6 +492,8 @@ public sealed class $CLASS$ : Shared$CLASS$ {
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autolathe/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autolathe/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Barotrauma/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Barotrauma/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bloodloss/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bloodloss/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bluespace/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bluespaced/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bwoink/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=bwoink/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=BYOND/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=BYOND/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue"><data /></s:String>
|
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue"><data /></s:String>
|
||||||
|
|||||||
Reference in New Issue
Block a user