Partial hand ECS (#5634)
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com> Co-authored-by: Paul <ritter.paul1@googlemail.com>
This commit is contained in:
@@ -57,7 +57,7 @@ namespace Content.Shared.Item
|
||||
return;
|
||||
|
||||
Verb verb = new();
|
||||
verb.Act = () => args.Hands.TryPutInActiveHandOrAny(args.Target);
|
||||
verb.Act = () => args.Hands.PutInHand(args.Target);
|
||||
verb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png";
|
||||
|
||||
// if the item already in a container (that is not the same as the user's), then change the text.
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -123,7 +125,7 @@ namespace Content.Shared.Item
|
||||
if (!CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (!_entMan.TryGetComponent(user, out SharedHandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(user, out SharedHandsComponent hands))
|
||||
return false;
|
||||
|
||||
var activeHand = hands.ActiveHand;
|
||||
@@ -131,15 +133,27 @@ namespace Content.Shared.Item
|
||||
if (activeHand == null)
|
||||
return false;
|
||||
|
||||
hands.TryPickupEntityToActiveHand(Owner);
|
||||
hands.TryPickupEntityToActiveHand(Owner, animateUser: true);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void OnEquippedPrefixChange() { }
|
||||
private void OnEquippedPrefixChange()
|
||||
{
|
||||
if (Owner.TryGetContainer(out var container))
|
||||
EntitySystem.Get<SharedHandsSystem>().UpdateHandVisualizer(container.Owner);
|
||||
}
|
||||
|
||||
public virtual void RemovedFromSlot() { }
|
||||
public void RemovedFromSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
component.Visible = true;
|
||||
}
|
||||
|
||||
public virtual void EquippedToSlot() { }
|
||||
public virtual void EquippedToSlot()
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))
|
||||
component.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user