From 6abe63cf9e4ef6ece533781bf4fda68d2e9060d4 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:51:42 +1000 Subject: [PATCH] tether-gun fixes (#19658) - Just remove container tethering entirely. --- .../Weapons/Misc/SharedTetherGunSystem.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs index 1e4e890224..3c88e716b6 100644 --- a/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs +++ b/Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs @@ -45,10 +45,26 @@ public abstract partial class SharedTetherGunSystem : EntitySystem SubscribeLocalEvent(OnTetheredBuckleAttempt); SubscribeLocalEvent(OnTetheredUpdateCanMove); + SubscribeLocalEvent(OnTetheredContainerInserted); InitializeForce(); } + private void OnTetheredContainerInserted(EntityUid uid, TetheredComponent component, EntGotInsertedIntoContainerMessage args) + { + if (TryComp(component.Tetherer, out var tetherGun)) + { + StopTether(component.Tetherer, tetherGun); + return; + } + + if (TryComp(component.Tetherer, out var forceGun)) + { + StopTether(component.Tetherer, forceGun); + return; + } + } + private void OnTetheredBuckleAttempt(EntityUid uid, TetheredComponent component, ref BuckleAttemptEvent args) { args.Cancelled = true; @@ -152,7 +168,8 @@ public abstract partial class SharedTetherGunSystem : EntitySystem if (HasComp(target) || !TryComp(target, out var physics)) return false; - if (physics.BodyType == BodyType.Static && !component.CanUnanchor) + if (physics.BodyType == BodyType.Static && !component.CanUnanchor || + _container.IsEntityInContainer(target)) return false; if (physics.Mass > component.MassLimit)