Fix up item usage
This commit is contained in:
@@ -14,6 +14,7 @@ using Zennysoft.Game.Ma.Implementation;
|
||||
using System.IO;
|
||||
using SimpleInjector;
|
||||
using static Zennysoft.Game.Ma.Implementation.GameLogic.State;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Game : Node3D, IGame
|
||||
@@ -266,7 +267,7 @@ public partial class Game : Node3D, IGame
|
||||
GameEventDepot.OnTeleportEntered();
|
||||
}
|
||||
|
||||
public void UseItem(InventoryItem item)
|
||||
public async Task UseItem(IInventoryItem item)
|
||||
{
|
||||
if (item is ConsumableItem consumableItem)
|
||||
{
|
||||
@@ -338,9 +339,12 @@ public partial class Game : Node3D, IGame
|
||||
if (throwableItem.ThrowableItemTag == ThrowableItemTag.WarpToExitIfFound)
|
||||
_effectService.WarpToExit(Player);
|
||||
}
|
||||
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
GameRepo.RemoveItemFromInventory(item);
|
||||
}
|
||||
|
||||
public void DropItem(InventoryItem item)
|
||||
public void DropItem(IInventoryItem item)
|
||||
{
|
||||
var droppedScene = GD.Load<PackedScene>("res://src/items/dropped/DroppedItem.tscn");
|
||||
var dropped = droppedScene.Instantiate<DroppedItem>();
|
||||
@@ -349,7 +353,7 @@ public partial class Game : Node3D, IGame
|
||||
dropped.Drop();
|
||||
}
|
||||
|
||||
public void ThrowItem(InventoryItem item)
|
||||
public void ThrowItem(IInventoryItem item)
|
||||
{
|
||||
var thrownScene = GD.Load<PackedScene>("res://src/items/thrown/ThrownItem.tscn");
|
||||
var thrown = thrownScene.Instantiate<ThrownItem>();
|
||||
@@ -359,11 +363,6 @@ public partial class Game : Node3D, IGame
|
||||
thrown.Throw(_effectService);
|
||||
}
|
||||
|
||||
public void AnnounceMessageOnInventoryScreen(string message)
|
||||
{
|
||||
InGameUI.InventoryMenu.ShowMessage(message);
|
||||
}
|
||||
|
||||
public IDungeonFloor CurrentFloor => Map.CurrentFloor;
|
||||
|
||||
public void EnemyDefeated(Vector3 defeatedLocation, EnemyStatResource resource)
|
||||
|
||||
Reference in New Issue
Block a user