Prevent certain foldable items from being unfolded on structures (#36687)
initial commit
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using Content.Shared.Construction.EntitySystems;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
namespace Content.Shared.Foldable;
|
||||
|
||||
@@ -9,6 +12,8 @@ public sealed class DeployFoldableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
||||
[Dependency] private readonly FoldableSystem _foldable = default!;
|
||||
[Dependency] private readonly AnchorableSystem _anchorable = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -57,6 +62,13 @@ public sealed class DeployFoldableSystem : EntitySystem
|
||||
if (!TryComp<FoldableComponent>(ent, out var foldable))
|
||||
return;
|
||||
|
||||
if (!TryComp(ent.Owner, out PhysicsComponent? anchorBody)
|
||||
|| !_anchorable.TileFree(args.ClickLocation, anchorBody))
|
||||
{
|
||||
_popup.PopupPredicted(Loc.GetString("foldable-deploy-fail", ("object", ent)), ent, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp(args.User, out HandsComponent? hands)
|
||||
|| !_hands.TryDrop(args.User, args.Used, targetDropLocation: args.ClickLocation, handsComp: hands))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user