Fix async usage in InteractionSystem

Fixes #2524
This commit is contained in:
Víctor Aguilera Puerto
2020-11-10 22:47:43 +01:00
parent e567e9fec1
commit 44ee2b7ab6
3 changed files with 6 additions and 10 deletions

View File

@@ -568,7 +568,7 @@ namespace Content.Server.GameObjects.Components.GUI
} }
} }
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null) public override async void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
{ {
base.HandleNetworkMessage(message, channel, session); base.HandleNetworkMessage(message, channel, session);
@@ -609,7 +609,7 @@ namespace Content.Server.GameObjects.Components.GUI
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>(); var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
if (used != null) if (used != null)
{ {
_ = interactionSystem.Interaction(Owner, used, hand.Entity, await interactionSystem.Interaction(Owner, used, hand.Entity,
EntityCoordinates.Invalid); EntityCoordinates.Invalid);
} }
else else

View File

@@ -432,7 +432,7 @@ namespace Content.Server.GameObjects.Components.GUI
/// Message that tells us to equip or unequip items from the inventory slots /// Message that tells us to equip or unequip items from the inventory slots
/// </summary> /// </summary>
/// <param name="msg"></param> /// <param name="msg"></param>
private void HandleInventoryMessage(ClientInventoryMessage msg) private async void HandleInventoryMessage(ClientInventoryMessage msg)
{ {
switch (msg.Updatetype) switch (msg.Updatetype)
{ {
@@ -463,7 +463,7 @@ namespace Content.Server.GameObjects.Components.GUI
{ {
if (activeHand != null) if (activeHand != null)
{ {
_ = interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner, await interactionSystem.Interaction(Owner, activeHand.Owner, itemContainedInSlot.Owner,
new EntityCoordinates()); new EntityCoordinates());
} }
else if (Unequip(msg.Inventoryslot)) else if (Unequip(msg.Inventoryslot))

View File

@@ -1,10 +1,8 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
using Content.Server.GameObjects.Components.Pulling; using Content.Server.GameObjects.Components.Pulling;
using Content.Server.GameObjects.Components.Timing; using Content.Server.GameObjects.Components.Timing;
using Content.Server.Interfaces.GameObjects.Components.Items; using Content.Server.Interfaces.GameObjects.Components.Items;
@@ -13,14 +11,12 @@ using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems; using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input; using Content.Shared.Input;
using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Interfaces.GameObjects.Components;
using Content.Shared.Physics.Pull;
using Content.Shared.Utility; using Content.Shared.Utility;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Server.Interfaces.Player; using Robust.Server.Interfaces.Player;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Input; using Robust.Shared.Input;
using Robust.Shared.Input.Binding; using Robust.Shared.Input.Binding;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
@@ -288,7 +284,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return pull.TogglePull(player); return pull.TogglePull(player);
} }
private void UserInteraction(IEntity player, EntityCoordinates coordinates, EntityUid clickedUid) private async void UserInteraction(IEntity player, EntityCoordinates coordinates, EntityUid clickedUid)
{ {
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null // Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
if (!EntityManager.TryGetEntity(clickedUid, out var attacked)) if (!EntityManager.TryGetEntity(clickedUid, out var attacked))
@@ -393,7 +389,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
// InteractUsing/AfterInteract: We will either use the item on the nearby object // InteractUsing/AfterInteract: We will either use the item on the nearby object
if (item != null) if (item != null)
{ {
_ = Interaction(player, item, attacked, coordinates); await Interaction(player, item, attacked, coordinates);
} }
// InteractHand/Activate: Since our hand is empty we will use InteractHand/Activate // InteractHand/Activate: Since our hand is empty we will use InteractHand/Activate
else else