From 8b2b904834bfcc44406986ba45b580c3ffd47246 Mon Sep 17 00:00:00 2001 From: Rendo Date: Sun, 13 Jul 2025 05:54:12 +0500 Subject: [PATCH] Resource order --- resources/plants/Aloe.tres | 1 + resources/plants/Cucumber.tres | 1 + resources/plants/Garlic.tres | 1 + resources/plants/Nerdus.tres | 1 + resources/plants/PotatoMine.tres | 1 + resources/plants/Snowpea.tres | 1 + resources/plants/Spikeweed.tres | 1 + resources/plants/Sunflower.tres | 1 + resources/plants/Threepeater.tres | 1 + resources/plants/Wallnut.tres | 1 + resources/zombies/basic.tres | 1 + resources/zombies/buckethead.tres | 1 + resources/zombies/conehead.tres | 1 + resources/zombies/hobo.tres | 1 + scripts/gui/almanach/AlmanachGrid.cs | 14 ++++++++++++-- scripts/resources/DisplayResource.cs | 1 + 16 files changed, 27 insertions(+), 2 deletions(-) diff --git a/resources/plants/Aloe.tres b/resources/plants/Aloe.tres index 08652d7..1058daf 100644 --- a/resources/plants/Aloe.tres +++ b/resources/plants/Aloe.tres @@ -14,3 +14,4 @@ ReloadTime = 15.0 ReloadProgress = 0.0 Preview = ExtResource("1_t4137") Layer = 1 +Order = 6 diff --git a/resources/plants/Cucumber.tres b/resources/plants/Cucumber.tres index 36790af..73c491f 100644 --- a/resources/plants/Cucumber.tres +++ b/resources/plants/Cucumber.tres @@ -18,4 +18,5 @@ ReloadTime = 5.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_3gogt") Layer = 1 +Order = 8 metadata/_custom_type_script = "uid://cyenlko1knygw" diff --git a/resources/plants/Garlic.tres b/resources/plants/Garlic.tres index 07baa57..0ad4a9a 100644 --- a/resources/plants/Garlic.tres +++ b/resources/plants/Garlic.tres @@ -14,3 +14,4 @@ ReloadTime = 7.5 ReloadProgress = 0.67 Preview = ExtResource("1_datic") Layer = 1 +Order = 7 diff --git a/resources/plants/Nerdus.tres b/resources/plants/Nerdus.tres index 90edeb0..decda3b 100644 --- a/resources/plants/Nerdus.tres +++ b/resources/plants/Nerdus.tres @@ -18,4 +18,5 @@ ReloadTime = 10.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_ivp5w") Layer = 1 +Order = 11 metadata/_custom_type_script = "uid://cyenlko1knygw" diff --git a/resources/plants/PotatoMine.tres b/resources/plants/PotatoMine.tres index 776ad20..6c6f453 100644 --- a/resources/plants/PotatoMine.tres +++ b/resources/plants/PotatoMine.tres @@ -14,3 +14,4 @@ ReloadTime = 25.0 ReloadProgress = 0.9 Preview = ExtResource("1_xk2pg") Layer = 1 +Order = 3 diff --git a/resources/plants/Snowpea.tres b/resources/plants/Snowpea.tres index 93d6bde..51db90a 100644 --- a/resources/plants/Snowpea.tres +++ b/resources/plants/Snowpea.tres @@ -14,3 +14,4 @@ ReloadTime = 5.0 ReloadProgress = 0.0 Preview = ExtResource("1_7fyy2") Layer = 1 +Order = 5 diff --git a/resources/plants/Spikeweed.tres b/resources/plants/Spikeweed.tres index cfd319b..977223b 100644 --- a/resources/plants/Spikeweed.tres +++ b/resources/plants/Spikeweed.tres @@ -14,3 +14,4 @@ ReloadTime = 5.0 ReloadProgress = 0.0 Preview = ExtResource("1_2ol2i") Layer = 1 +Order = 4 diff --git a/resources/plants/Sunflower.tres b/resources/plants/Sunflower.tres index 7347bf8..5d05e64 100644 --- a/resources/plants/Sunflower.tres +++ b/resources/plants/Sunflower.tres @@ -14,3 +14,4 @@ ReloadTime = 5.0 ReloadProgress = 1.0 Preview = ExtResource("1_8rd5i") Layer = 1 +Order = 1 diff --git a/resources/plants/Threepeater.tres b/resources/plants/Threepeater.tres index 4a62eef..d8f8fcb 100644 --- a/resources/plants/Threepeater.tres +++ b/resources/plants/Threepeater.tres @@ -14,3 +14,4 @@ ReloadTime = 5.0 ReloadProgress = 0.0 Preview = ExtResource("1_hinp6") Layer = 1 +Order = 10 diff --git a/resources/plants/Wallnut.tres b/resources/plants/Wallnut.tres index 63b6271..ea3bcaa 100644 --- a/resources/plants/Wallnut.tres +++ b/resources/plants/Wallnut.tres @@ -14,3 +14,4 @@ ReloadTime = 20.0 ReloadProgress = 0.0 Preview = ExtResource("1_2akap") Layer = 1 +Order = 2 diff --git a/resources/zombies/basic.tres b/resources/zombies/basic.tres index cfa837e..7239564 100644 --- a/resources/zombies/basic.tres +++ b/resources/zombies/basic.tres @@ -18,4 +18,5 @@ ReloadTime = 1.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_wu2q8") Layer = 1 +Order = 0 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/buckethead.tres b/resources/zombies/buckethead.tres index ef9c339..02c4457 100644 --- a/resources/zombies/buckethead.tres +++ b/resources/zombies/buckethead.tres @@ -18,4 +18,5 @@ ReloadTime = 1.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_drksh") Layer = 1 +Order = 2 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/conehead.tres b/resources/zombies/conehead.tres index 637299f..bbf134c 100644 --- a/resources/zombies/conehead.tres +++ b/resources/zombies/conehead.tres @@ -18,4 +18,5 @@ ReloadTime = 1.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_q44xp") Layer = 1 +Order = 1 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/resources/zombies/hobo.tres b/resources/zombies/hobo.tres index 693c1a1..38c432e 100644 --- a/resources/zombies/hobo.tres +++ b/resources/zombies/hobo.tres @@ -18,4 +18,5 @@ ReloadTime = 1.0 ReloadProgress = 0.0 Preview = SubResource("AtlasTexture_73ahc") Layer = 1 +Order = 5 metadata/_custom_type_script = "uid://cqxj7o8hdm82n" diff --git a/scripts/gui/almanach/AlmanachGrid.cs b/scripts/gui/almanach/AlmanachGrid.cs index bc6e3ce..f14ad0b 100644 --- a/scripts/gui/almanach/AlmanachGrid.cs +++ b/scripts/gui/almanach/AlmanachGrid.cs @@ -12,7 +12,12 @@ public partial class AlmanachGrid : GridContainer if (_zombies) { - foreach (var resource in GameRegistry.GetZombies()) + var list = GameRegistry.GetZombies(); + list.Sort((a, b) => + { + return a.Order - b.Order; + }); + foreach (var resource in list) { Seedpacket slot = _plantCard.Instantiate(); AddChild(slot); @@ -23,7 +28,12 @@ public partial class AlmanachGrid : GridContainer } else { - foreach (var resource in GameRegistry.GetPlants()) + var list = GameRegistry.GetPlants(); + list.Sort((a, b) => + { + return a.Order - b.Order; + }); + foreach (var resource in list) { Seedpacket slot = _plantCard.Instantiate(); AddChild(slot); diff --git a/scripts/resources/DisplayResource.cs b/scripts/resources/DisplayResource.cs index fb98245..f05cd53 100644 --- a/scripts/resources/DisplayResource.cs +++ b/scripts/resources/DisplayResource.cs @@ -16,5 +16,6 @@ public partial class DisplayResource : Resource public Texture2D Preview; [Export] public CustomSeedpacketFrame customFrame; [Export] public int Layer = 1; + [Export] public int Order = 0; public string internal_id; }