Fix restorative

This commit is contained in:
2026-02-12 23:28:51 -08:00
parent 9615e1e251
commit 68b1455c53
8 changed files with 34 additions and 27 deletions

View File

@@ -12,6 +12,7 @@ using Zennysoft.Ma.Adapter;
using System.IO;
using System.Threading.Tasks;
using Zennysoft.Game.Implementation;
using Zennysoft.Ma.Adapter.Entity;
[Meta(typeof(IAutoNode))]
public partial class Game : Node3D, IGame
@@ -172,9 +173,10 @@ public partial class Game : Node3D, IGame
OnLoadLevelRequest += LoadLevel;
GameRepo.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
GameRepo.CloseInventoryEvent += ExitInventoryAction;
GameRepo.EnemyDied += GameRepo_EnemyDied;
_player.Inventory.BroadcastMessage += BroadcastMessage;
_map.FloorLoaded += OnFloorLoadFinished;
@@ -189,6 +191,11 @@ public partial class Game : Node3D, IGame
InGameUI.PlayerInfoUI.Activate();
}
private void GameRepo_EnemyDied(IEnemy obj)
{
DropRestorative(obj.GlobalPosition);
}
private void BroadcastMessage(string obj)
{
InGameUI.InventoryMessageUI.DisplayMessage(obj);
@@ -404,7 +411,7 @@ public partial class Game : Node3D, IGame
var restorativeScene = GD.Load<PackedScene>("res://src/items/restorative/Restorative.tscn");
var restorative = restorativeScene.Instantiate<Restorative>();
AddChild(restorative);
restorative.GlobalPosition = vector;
restorative.GlobalPosition = new Vector3(vector.X, 2f, vector.Z) + (-_player.GetGlobalBasis().Z);
}
private void UseTeleportPrompt_CloseTeleportPrompt()
@@ -427,8 +434,6 @@ public partial class Game : Node3D, IGame
GameRepo.Resume();
}
private void GameEventDepot_RestorativePickedUp(IHealthPack obj) => _player.VTComponent.Restore((int)obj.RestoreAmount);
private void IsPaused_Sync(bool isPaused) => GetTree().Paused = isPaused;
private void FinishedLoadingSaveFile() => EmitSignal(SignalName.SaveFileLoaded);
@@ -606,7 +611,6 @@ public partial class Game : Node3D, IGame
OnLoadLevelRequest -= LoadLevel;
GameRepo.RestorativePickedUp -= GameEventDepot_RestorativePickedUp;
GameRepo.CloseInventoryEvent -= ExitInventoryAction;
_player.Inventory.BroadcastMessage -= BroadcastMessage;