Improvements to save and loading

Improvements to Chinthe animation logic
Fix broken Godot Tool system and just use a more manual approach to setting map nodes
Remove ItemDatabase from individual room scenes
This commit is contained in:
2025-10-24 01:33:18 -07:00
parent f5360adbf1
commit 286c221530
93 changed files with 497 additions and 678 deletions

View File

@@ -60,12 +60,19 @@ public partial class Game : Node3D, IGame
public RescuedItemDatabase RescuedItems { get; set; } = default!;
public QuestData QuestData { get; private set; }
private EffectService _effectService;
private IInstantiator _instantiator;
private Player _player;
private Map _map;
public Game()
{
QuestData = new QuestData();
}
public void Setup()
{
_container = new SimpleInjector.Container();
@@ -91,30 +98,24 @@ public partial class Game : Node3D, IGame
{
var gameData = new GameData()
{
PlayerData = new PlayerData()
{
Inventory = (Inventory)_player.Inventory,
HealthComponent = (HealthComponent)_player.HealthComponent,
},
MapData = new MapData()
{
},
RescuedItems = new RescuedItemDatabase()
{
Items = RescuedItems.Items
},
QuestData = new QuestData()
{
QuestMarker1 = QuestData.QuestMarker1
}
};
return gameData;
},
onLoad:
(chunk, data) =>
{
RescuedItems = data.RescuedItems;
chunk.LoadChunkSaveData(data.PlayerData);
chunk.LoadChunkSaveData(data.MapData);
}
);
{
RescuedItems = data.RescuedItems;
QuestData = data.QuestData;
}
);
}
public void OnResolved()
@@ -127,7 +128,7 @@ public partial class Game : Node3D, IGame
{
try
{
var gameData = await saveFileManager.Load() as GameData;
var gameData = await saveFileManager.Load<GameData>();
return gameData;
}
catch (FileNotFoundException)
@@ -200,6 +201,7 @@ public partial class Game : Node3D, IGame
{
FloorClearMenu.FadeOut();
Task.Run(() => _map.LoadFloor());
Task.Run(() => Save());
if (_player.EquipmentComponent.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnChange)
{
var itemToDestroy = _player.EquipmentComponent.EquippedWeapon.Value;
@@ -248,6 +250,7 @@ public partial class Game : Node3D, IGame
public void OnReady()
{
InitializeGame();
SaveFile.Load();
_map.LoadFloor();
GameRepo.Resume();
InGameUI.Show();
@@ -272,6 +275,8 @@ public partial class Game : Node3D, IGame
_map.InitializeMapData();
}
public async Task Save() => await SaveFile.Save();
public void FloorExitReached()
{
GameState.Input(new GameState.Input.FloorExitEntered());