From fda3ca433b13f68da14600dfb06345f5ac76adb7 Mon Sep 17 00:00:00 2001 From: Rendo Date: Wed, 30 Jul 2025 05:45:12 +0500 Subject: [PATCH] initial reload --- assets/plants/Garlic.tres | 2 +- assets/plants/PotatoMine.tres | 2 +- scripts/gui/seedpackets/HotbarPregameHandler.cs | 1 + scripts/gui/seedpackets/PrepickedHandler.cs | 1 + scripts/gui/seedpackets/Seedpacket.cs | 5 +++++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/plants/Garlic.tres b/assets/plants/Garlic.tres index 9b19b7b..d821c21 100644 --- a/assets/plants/Garlic.tres +++ b/assets/plants/Garlic.tres @@ -13,6 +13,6 @@ DescriptionKey = "garlic_desc" Cost = 50.0 Scene = ExtResource("2_81n0p") ReloadTime = 7.5 -ReloadProgress = 0.67 +ReloadProgress = 0.0 Preview = ExtResource("1_datic") Order = 7 diff --git a/assets/plants/PotatoMine.tres b/assets/plants/PotatoMine.tres index 1abf969..825de86 100644 --- a/assets/plants/PotatoMine.tres +++ b/assets/plants/PotatoMine.tres @@ -13,6 +13,6 @@ DescriptionKey = "potatomine_desc" Cost = 25.0 Scene = ExtResource("2_ig2ti") ReloadTime = 25.0 -ReloadProgress = 0.9 +ReloadProgress = 0.0 Preview = ExtResource("1_xk2pg") Order = 3 diff --git a/scripts/gui/seedpackets/HotbarPregameHandler.cs b/scripts/gui/seedpackets/HotbarPregameHandler.cs index 0f9a656..eded986 100644 --- a/scripts/gui/seedpackets/HotbarPregameHandler.cs +++ b/scripts/gui/seedpackets/HotbarPregameHandler.cs @@ -25,6 +25,7 @@ public class HotbarPregameHandler : SeedpacketHandler, ISeedpacketPress if (state == RuntimeLevelData.LevelStates.Game) { _owner.SetHandler(new HotbarHandler(_owner)); + _owner.StartWithResourceOffset(); } else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds) { diff --git a/scripts/gui/seedpackets/PrepickedHandler.cs b/scripts/gui/seedpackets/PrepickedHandler.cs index 96dd3fc..0988e56 100644 --- a/scripts/gui/seedpackets/PrepickedHandler.cs +++ b/scripts/gui/seedpackets/PrepickedHandler.cs @@ -14,6 +14,7 @@ public class PrepickedHandler : SeedpacketHandler if (state == RuntimeLevelData.LevelStates.Game) { _owner.SetHandler(new HotbarHandler(_owner)); + _owner.StartWithResourceOffset(); } else if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds) { diff --git a/scripts/gui/seedpackets/Seedpacket.cs b/scripts/gui/seedpackets/Seedpacket.cs index 23fe08d..dae46e7 100644 --- a/scripts/gui/seedpackets/Seedpacket.cs +++ b/scripts/gui/seedpackets/Seedpacket.cs @@ -81,6 +81,11 @@ public partial class Seedpacket : TextureButton { _timer.Start(); } + public void StartWithResourceOffset() + { + _timer.Start(_resource.ReloadTime * (1.0 - _resource.ReloadProgress)+0.05); + Callable.From(()=>{ _timer.WaitTime = _resource.ReloadTime; }).CallDeferred(); + } public void OnUnfocused() {