hands ECS (#7081)
This commit is contained in:
@@ -7,7 +7,6 @@ using Content.Server.DoAfter;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Nutrition.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -20,7 +19,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
@@ -39,6 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
|
||||
[Dependency] private readonly InventorySystem _inventorySystem = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -223,18 +223,12 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
var finisher = EntityManager.SpawnEntity(component.TrashPrototype, position);
|
||||
|
||||
// If the user is holding the item
|
||||
if (user != null &&
|
||||
EntityManager.TryGetComponent(user.Value, out HandsComponent? handsComponent) &&
|
||||
handsComponent.IsHolding(component.Owner))
|
||||
if (user != null && _handsSystem.IsHolding(user.Value, component.Owner, out var hand))
|
||||
{
|
||||
EntityManager.DeleteEntity((component).Owner);
|
||||
|
||||
// Put the trash in the user's hand
|
||||
if (EntityManager.TryGetComponent(finisher, out SharedItemComponent? item) &&
|
||||
handsComponent.CanPutInHand(item))
|
||||
{
|
||||
handsComponent.PutInHand(item);
|
||||
}
|
||||
_handsSystem.TryPickup(user.Value, finisher, hand);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -329,10 +323,10 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
var usedTypes = UtensilType.None;
|
||||
|
||||
foreach (var item in hands.GetAllHeldItems())
|
||||
foreach (var item in _handsSystem.EnumerateHeld(user, hands))
|
||||
{
|
||||
// Is utensil?
|
||||
if (!EntityManager.TryGetComponent(item.Owner, out UtensilComponent? utensil))
|
||||
if (!EntityManager.TryGetComponent(item, out UtensilComponent? utensil))
|
||||
continue;
|
||||
|
||||
if ((utensil.Types & component.Utensil) != 0 && // Acceptable type?
|
||||
|
||||
Reference in New Issue
Block a user