@@ -45,10 +45,26 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<TetheredComponent, BuckleAttemptEvent>(OnTetheredBuckleAttempt);
|
SubscribeLocalEvent<TetheredComponent, BuckleAttemptEvent>(OnTetheredBuckleAttempt);
|
||||||
SubscribeLocalEvent<TetheredComponent, UpdateCanMoveEvent>(OnTetheredUpdateCanMove);
|
SubscribeLocalEvent<TetheredComponent, UpdateCanMoveEvent>(OnTetheredUpdateCanMove);
|
||||||
|
SubscribeLocalEvent<TetheredComponent, EntGotInsertedIntoContainerMessage>(OnTetheredContainerInserted);
|
||||||
|
|
||||||
InitializeForce();
|
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)
|
private void OnTetheredBuckleAttempt(EntityUid uid, TetheredComponent component, ref BuckleAttemptEvent args)
|
||||||
{
|
{
|
||||||
args.Cancelled = true;
|
args.Cancelled = true;
|
||||||
@@ -152,7 +168,8 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
|||||||
if (HasComp<TetheredComponent>(target) || !TryComp<PhysicsComponent>(target, out var physics))
|
if (HasComp<TetheredComponent>(target) || !TryComp<PhysicsComponent>(target, out var physics))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (physics.BodyType == BodyType.Static && !component.CanUnanchor)
|
if (physics.BodyType == BodyType.Static && !component.CanUnanchor ||
|
||||||
|
_container.IsEntityInContainer(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (physics.Mass > component.MassLimit)
|
if (physics.Mass > component.MassLimit)
|
||||||
|
|||||||
Reference in New Issue
Block a user