hands ECS (#7081)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Clothing.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
@@ -12,6 +12,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
public sealed class SecretStashSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -83,7 +84,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
}
|
||||
|
||||
// try to move item from hands to stash container
|
||||
if (!hands.Drop(itemToHideUid, container))
|
||||
if (!_handsSystem.TryDropIntoContainer(userUid, itemToHideUid, container))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -115,13 +116,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
// get item inside container
|
||||
var itemUid = container.ContainedEntity;
|
||||
if (!EntityManager.TryGetComponent(itemUid, out SharedItemComponent? item))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
hands.PutInHandOrDrop(item);
|
||||
_handsSystem.PickupOrDrop(userUid, container.ContainedEntity.Value, handsComp: hands);
|
||||
|
||||
// show success message
|
||||
var successMsg = Loc.GetString("comp-secret-stash-action-get-item-found-something",
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -13,6 +10,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
public sealed class SpawnItemsOnUseSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -57,10 +55,9 @@ namespace Content.Server.Storage.EntitySystems
|
||||
EntityManager.DeleteEntity(uid);
|
||||
}
|
||||
|
||||
if (entityToPlaceInHands != null
|
||||
&& EntityManager.TryGetComponent<SharedHandsComponent?>(args.User, out var hands))
|
||||
if (entityToPlaceInHands != null)
|
||||
{
|
||||
hands.TryPutInAnyHand(entityToPlaceInHands.Value);
|
||||
_handsSystem.PickupOrDrop(args.User, entityToPlaceInHands.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user