🐛 fixed dayplanted confusion on plants

This commit is contained in:
2025-12-02 15:45:44 +01:00
parent c7a4aea70b
commit e65330786e
4 changed files with 47 additions and 10 deletions
@@ -1,3 +1,4 @@
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Savegame;
using Godot;
using Godot.Collections;
@@ -6,15 +7,25 @@ namespace Babushka.scripts.CSharp.Low_Code.Variables;
public partial class SaveableVariableNode : VariableNode, ISaveable
{
public override void _Ready()
[Export] private bool _debug;
public override void _EnterTree()
{
LoadFromSaveData();
ValueChanged += UpdateSaveData;
SavegameService.OnSaveGameReset += SaveGameReset;
}
private void SaveGameReset()
{
Payload = default;
GD.Print($"Saveable Variable reset to {Payload}");
}
public override void _ExitTree()
{
ValueChanged -= UpdateSaveData;
SavegameService.OnSaveGameReset -= SaveGameReset;
}
public void UpdateSaveData()
@@ -43,6 +54,11 @@ public partial class SaveableVariableNode : VariableNode, ISaveable
{
Payload = save["payload"];
}
if (_debug)
{
GD.Print($"SaveableVariable {Name} loaded payload: {Payload}.");
}
}
}
}