♻️ reworked and debugged the SaveSystem. Removed unnecessary scene reference.

This commit is contained in:
2025-11-25 14:39:31 +01:00
parent 638ebaff46
commit e9cd4ce276
5 changed files with 27 additions and 32 deletions
+2 -7
View File
@@ -11,10 +11,6 @@ namespace Babushka.scripts.CSharp.Common.Temp;
/// </summary>
public partial class MVPDuck : Node2D, ISaveable
{
[ExportGroup("Persistence")]
// A container for the current scene. Used to automatically add the current scene context to the save ID.
[Export] public VariableResource _sceneKeyProvider;
[ExportGroup("Animation")]
[Export] private Node2D _penTarget;
[Export] private int _transferDelayMs;
@@ -70,7 +66,7 @@ public partial class MVPDuck : Node2D, ISaveable
string id = GetMeta("SaveID").AsString();
GD.Print($"Updating Save ID for object {Name}: {id}");
SavegameService.AppendDataToSave(_sceneKeyProvider.Payload.AsString(), id, payloadData);
SavegameService.AppendDataToSave( id, payloadData);
}
/// <summary>
@@ -78,11 +74,10 @@ public partial class MVPDuck : Node2D, ISaveable
/// </summary>
public void LoadFromSaveData()
{
var sceneName = _sceneKeyProvider.Payload.AsString();
string id = GetMeta("SaveID").AsString();
GD.Print($"Loading Save ID for object {Name}: " + id);
Dictionary<string, Variant> save = SavegameService.GetSaveData(sceneName, id);
Dictionary<string, Variant> save = SavegameService.GetSaveData(id);
if (save.Count > 0)
{
float xPos = 0;