🚧 intermediate state with homework

This commit is contained in:
2025-11-23 22:50:32 +01:00
parent bee6249c6f
commit c68727aebe
4 changed files with 45 additions and 54 deletions
@@ -1,18 +1,18 @@
using System;
using System.Linq;
using Babushka.scripts.CSharp.Common.Savegame;
using Babushka.scripts.CSharp.Common.Services;
using Babushka.scripts.CSharp.Low_Code.Variables;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
[Tool]
public partial class InteractionArea2D : Node2D, ISaveable
{
[ExportGroup("Persistence")]
[Export] public Babushka.scripts.CSharp.Low_Code.Variables.VariableResource _sceneKeyProvider;
[Export] private string _saveId;
[Export] public VariableResource _sceneKeyProvider;
[Export] private string _saveId = ""; // todo: find good default / generated solution
//todo: rewire broken instances in scenes
[ExportGroup("Settings")]
[Export] private Area2D _area;
@@ -48,7 +48,14 @@ public partial class InteractionArea2D : Node2D, ISaveable
{
_backupMaterials = _spritesToOutline.Select(s => s.Material).ToArray();
}
// bad solution for interaction areas, because they are all named the same.
// option (equally bad) 1: take grandparent's name (could be null though)
// option 2 (also bad): Write Identity Provider class that uses, checks and assigns GUIDs for this purpose.
if (string.IsNullOrEmpty(_saveId))
{
_saveId = Name;
}
LoadFromSaveData();
}