This commit is contained in:
Leon Friedrich
2022-03-17 20:13:31 +13:00
committed by GitHub
parent 7b84362901
commit bfd95c493b
94 changed files with 1454 additions and 2185 deletions

View File

@@ -1,14 +1,14 @@
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Shared.Placeable
{
public sealed class PlaceableSurfaceSystem : EntitySystem
{
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
public override void Initialize()
{
base.Initialize();
@@ -52,16 +52,13 @@ namespace Content.Shared.Placeable
if (!surface.IsPlaceable)
return;
if(!EntityManager.TryGetComponent<SharedHandsComponent?>(args.User, out var handComponent))
return;
if(!handComponent.TryDropEntity(args.Used, EntityManager.GetComponent<TransformComponent>(surface.Owner).Coordinates))
if (!_handsSystem.TryDrop(args.User, args.Used))
return;
if (surface.PlaceCentered)
EntityManager.GetComponent<TransformComponent>(args.Used).LocalPosition = EntityManager.GetComponent<TransformComponent>(uid).LocalPosition + surface.PositionOffset;
Transform(args.Used).LocalPosition = Transform(uid).LocalPosition + surface.PositionOffset;
else
EntityManager.GetComponent<TransformComponent>(args.Used).Coordinates = args.ClickLocation;
Transform(args.Used).Coordinates = args.ClickLocation;
args.Handled = true;
}