diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs index 9a421cd..08aab4d 100644 --- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs +++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using Babushka.scripts.CSharp.Common.Services; using Godot; diff --git a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs index 6a53ccb..7abbb81 100644 --- a/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs +++ b/scripts/CSharp/Common/Farming/FieldBehaviour2D.cs @@ -13,7 +13,7 @@ namespace Babushka.scripts.CSharp.Common.Farming; /// Defines the behaviour of the field, i.e. interactions, states and effects. /// [GlobalClass] -public partial class FieldBehaviour2D : Sprite2D +public partial class FieldBehaviour2D : Sprite2D, ISaveable { [ExportGroup("Persistence")] [Export] public string SaveId = ""; diff --git a/scripts/CSharp/Common/Inventory/InventoryInstance.cs b/scripts/CSharp/Common/Inventory/InventoryInstance.cs index 64530b6..61f45fe 100644 --- a/scripts/CSharp/Common/Inventory/InventoryInstance.cs +++ b/scripts/CSharp/Common/Inventory/InventoryInstance.cs @@ -7,7 +7,7 @@ using Babushka.scripts.CSharp.Common.Savegame; namespace Babushka.scripts.CSharp.Common.Inventory; -public partial class InventoryInstance : Node +public partial class InventoryInstance : Node, ISaveable { private List _slots = new(); public IReadOnlyList Slots => _slots; diff --git a/scripts/CSharp/Common/Savegame/ISaveable.cs b/scripts/CSharp/Common/Savegame/ISaveable.cs new file mode 100644 index 0000000..060b1b0 --- /dev/null +++ b/scripts/CSharp/Common/Savegame/ISaveable.cs @@ -0,0 +1,17 @@ +namespace Babushka.scripts.CSharp.Common.Savegame; + +/// +/// Defines the behaviour of Nodes that have fields that should save / load to disk. +/// +public interface ISaveable +{ + /// + /// Adds or updates the field data that shall be stored to disk. + /// + public void UpdateSaveData(); + + /// + /// Loads the field data from disk. + /// + public void LoadFromSaveData(); +} \ No newline at end of file