tether-gun fixes (#19658)

- Just remove container tethering entirely.
This commit is contained in:
metalgearsloth
2023-08-31 10:51:42 +10:00
committed by GitHub
parent c5c99151aa
commit 6abe63cf9e

View File

@@ -45,10 +45,26 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
SubscribeLocalEvent<TetheredComponent, BuckleAttemptEvent>(OnTetheredBuckleAttempt);
SubscribeLocalEvent<TetheredComponent, UpdateCanMoveEvent>(OnTetheredUpdateCanMove);
SubscribeLocalEvent<TetheredComponent, EntGotInsertedIntoContainerMessage>(OnTetheredContainerInserted);
InitializeForce();
}
private void OnTetheredContainerInserted(EntityUid uid, TetheredComponent component, EntGotInsertedIntoContainerMessage args)
{
if (TryComp<TetherGunComponent>(component.Tetherer, out var tetherGun))
{
StopTether(component.Tetherer, tetherGun);
return;
}
if (TryComp<ForceGunComponent>(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<TetheredComponent>(target) || !TryComp<PhysicsComponent>(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)