Predict general interactions. (#6856)

This commit is contained in:
Leon Friedrich
2022-03-09 20:12:17 +13:00
committed by GitHub
parent 60e7ef6073
commit 0f435f31c8
10 changed files with 283 additions and 256 deletions

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Item
/// Players can pick up, drop, and put items in bags, and they can be seen in player's hands.
/// </summary>
[NetworkedComponent()]
public abstract class SharedItemComponent : Component, IInteractHand
public abstract class SharedItemComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
@@ -97,22 +97,6 @@ namespace Content.Shared.Item
[DataField("sprite")]
public readonly string? RsiPath;
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
{
var user = eventArgs.User;
if (!_entMan.TryGetComponent(user, out SharedHandsComponent hands))
return false;
var activeHand = hands.ActiveHand;
if (activeHand == null)
return false;
// hands checks action blockers
return hands.TryPickupEntityToActiveHand(Owner, animateUser: true);
}
public void RemovedFromSlot()
{
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component))