Lockable seeds

This commit is contained in:
Rendo 2025-07-22 03:23:46 +05:00
commit a4c58bb245
19 changed files with 405 additions and 61 deletions

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon.Components.GUI.Seedpackets;
using Newlon.Components.Level;
namespace Newlon.Components.GUI;
@ -11,7 +12,7 @@ public partial class GridLoader : GridContainer
{
_plantCard = ResourceLoader.Load<PackedScene>(SEEDPACKED_UID);
var list = PlayerProgress.Instance.PlayerPlants;
var list = GameRegistry.GetPlants();
list.Sort((a, b) =>
{
return a.Order - b.Order;
@ -22,7 +23,10 @@ public partial class GridLoader : GridContainer
AddChild(slot);
slot.SetResource(resource);
slot.SetHandler(new ChoosableHandler(slot));
slot.SetForbidden(RuntimeLevelData.LevelResource.forbiddenPlants.Contains(resource.internal_id));
slot.SetLocked(PlayerProgress.Instance.PlayerPlants.Contains(resource) == false);
var handler = new ChoosableHandler(slot);
slot.SetHandler(handler);
}
}
}