Refactor hut tier definitions to use images and scales instead of scene paths; add moddable visual component

This commit is contained in:
2025-08-23 15:41:57 +02:00
parent 8efbc9cc6e
commit 608bcc552d
15 changed files with 204 additions and 15 deletions

View File

@@ -14,6 +14,7 @@ public partial class PopulationVisualizer : Node
[Export] private Node2D _markersContainer;
[Export] private int _unitsPerMarker = 5;
[Export] public VisualCategory Category { get; private set; }
[Export] private PackedScene _moddableVisualScene;
private List<TierDefinition> _tiers;
private readonly List<FollowerMarker> _markers = [];
@@ -105,11 +106,15 @@ public partial class PopulationVisualizer : Node
if (i < followersToShow)
{
if (!marker.IsOccupied || _lastKnownTierIndex != newTierIndex)
var currentVisual = marker.GetChildOrNull<ModdableVisual>(0);
if (currentVisual == null || currentVisual.Tier != currentTier.TierEnum)
{
if (marker.IsOccupied) marker.RemoveFollower();
var followerInstance = currentTier.Scene.Instantiate<Follower>();
marker.PlaceFollower(followerInstance);
if (marker.GetChildCount() > 0) marker.GetChild(0).QueueFree();
var visualInstance = _moddableVisualScene.Instantiate<ModdableVisual>();
visualInstance.Initialize(currentTier.TierEnum, currentTier.Texture, currentTier.Scale);
marker.AddChild(visualInstance);
needsChange = true;
}
}