Crazy Glue Fix (#17262)

This commit is contained in:
brainfood1183
2023-06-15 04:02:33 +01:00
committed by GitHub
parent 372735f9e0
commit 78939b4c04
2 changed files with 6 additions and 12 deletions

View File

@@ -39,11 +39,9 @@ namespace Content.Server.Glue
return;
}
if (HasComp<ItemComponent>(target))
{
_audio.PlayPvs(component.Squeeze, uid);
EnsureComp<UnremoveableComponent>(target);
_popup.PopupEntity(Loc.GetString("glue-success", ("target", Identity.Entity(target, EntityManager))), args.User,
args.User, PopupType.Medium);
EnsureComp<GluedComponent>(target);

View File

@@ -1,8 +1,7 @@
using Content.Shared.Interaction.Components;
using Robust.Shared.Timing;
using Content.Shared.Interaction;
using Content.Shared.Glue;
using Content.Shared.Hands.Components;
using Content.Shared.Hands;
namespace Content.Server.Glue;
@@ -16,7 +15,7 @@ public sealed class GluedSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<GluedComponent, ComponentInit>(OnGluedInit);
SubscribeLocalEvent<GluedComponent, InteractHandEvent>(OnPickUp);
SubscribeLocalEvent<GluedComponent, GotEquippedHandEvent>(OnHandPickUp);
}
// Timing to remove glued and unremoveable.
@@ -52,13 +51,10 @@ public sealed class GluedSystem : EntitySystem
}
// Timers start only when the glued item is picked up.
private void OnPickUp(EntityUid uid, GluedComponent component, InteractHandEvent args)
private void OnHandPickUp(EntityUid uid, GluedComponent component, GotEquippedHandEvent args)
{
var userHands = Comp<HandsComponent>(args.User);
if (userHands.ActiveHandEntity == uid)
{
component.GlueBroken = true;
component.GlueTime = _timing.CurTime + component.GlueCooldown;
}
EnsureComp<UnremoveableComponent>(uid);
component.GlueBroken = true;
component.GlueTime = _timing.CurTime + component.GlueCooldown;
}
}