Make InteractUsing async, make tools use DoAfter. (#1772)

* Make IInteractUsing async, make tools use DoAfter.

* Disable warning 1998 in Content.Server

* Update Content.Server/GameObjects/Components/AnchorableComponent.cs
This commit is contained in:
Víctor Aguilera Puerto
2020-08-18 14:39:08 +02:00
committed by GitHub
parent bbdfe44224
commit d9ae942759
45 changed files with 195 additions and 100 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Movement;
@@ -438,7 +439,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// Uses a weapon/object on an entity
/// Finds components with the InteractUsing interface and calls their function
/// </summary>
public void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation)
public async Task Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation)
{
var attackMsg = new InteractUsingMessage(user, weapon, attacked, clickLocation);
RaiseLocalEvent(attackMsg);
@@ -458,7 +459,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
{
foreach (var attackBy in attackBys)
{
if (attackBy.InteractUsing(attackByEventArgs))
if (await attackBy.InteractUsing(attackByEventArgs))
{
// If an InteractUsing returns a status completion we finish our attack
return;