From 7ebef6172c6c155ab613a3c657bcee0b20af32ca Mon Sep 17 00:00:00 2001 From: Sofia Date: Mon, 3 Aug 2026 17:14:50 +0300 Subject: [PATCH] Update cooldown enum --- godot/scenes/player/local_player.tscn | 2 -- godot/scenes/ui/cooldown_icon.tscn | 6 +++--- rust/src/ui/cooldown_icon.rs | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/godot/scenes/player/local_player.tscn b/godot/scenes/player/local_player.tscn index 4d84fda..a9f12f9 100644 --- a/godot/scenes/player/local_player.tscn +++ b/godot/scenes/player/local_player.tscn @@ -126,8 +126,6 @@ stream = ExtResource("9_qpw6d") bus = &"SFX" [node name="cooldown_icon" parent="." unique_id=1635472390 instance=ExtResource("10_h6dt6")] -max = 10.0 -value = 0.0 [node name="hud" parent="." unique_id=2049159590 instance=ExtResource("5_cv68x")] diff --git a/godot/scenes/ui/cooldown_icon.tscn b/godot/scenes/ui/cooldown_icon.tscn index 52794ee..fd5b6f2 100644 --- a/godot/scenes/ui/cooldown_icon.tscn +++ b/godot/scenes/ui/cooldown_icon.tscn @@ -5,7 +5,6 @@ [node name="cooldown_icon" type="CooldownIcon" unique_id=1635472390 node_paths=PackedStringArray("text_rect", "label", "add_label")] max = 10.0 -value = 1.5116633333332667 text_rect = NodePath("texture_progress_bar") label = NodePath("cd_label") add_label = NodePath("add_label") @@ -34,7 +33,7 @@ grow_horizontal = 2 grow_vertical = 2 max_value = 10.0 step = 0.05 -value = 8.5 +value = 10.0 fill_mode = 4 nine_patch_stretch = true texture_under = ExtResource("2_xkf6q") @@ -43,13 +42,14 @@ tint_under = Color(0.30323282, 0.30323282, 0.30323282, 1) metadata/_edit_lock_ = true [node name="cd_label" type="Label" parent="." unique_id=694927561] +visible = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -text = "1.5" +text = "0.0" horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_lock_ = true diff --git a/rust/src/ui/cooldown_icon.rs b/rust/src/ui/cooldown_icon.rs index 6362c44..cc765d3 100644 --- a/rust/src/ui/cooldown_icon.rs +++ b/rust/src/ui/cooldown_icon.rs @@ -7,7 +7,7 @@ use godot::{ #[godot(via = u8)] pub enum CooldownType { #[default] - Fill, + Cooldown, Empty, } @@ -43,7 +43,7 @@ impl IControl for CooldownIcon { fn process(&mut self, delta: f64) { let delta = match self.cd_type { - CooldownType::Fill => -delta, + CooldownType::Cooldown => -delta, CooldownType::Empty => delta, }; self.value = (self.value + delta).clamp(self.min, self.max); @@ -56,7 +56,7 @@ impl CooldownIcon { pub fn update(&mut self) { if let Some(bar) = &mut self.text_rect { let fill_mode = match self.cd_type { - CooldownType::Fill => FillMode::CLOCKWISE, + CooldownType::Cooldown => FillMode::CLOCKWISE, CooldownType::Empty => FillMode::COUNTER_CLOCKWISE, }; bar.set_fill_mode(fill_mode); @@ -64,14 +64,14 @@ impl CooldownIcon { bar.set_max(self.max); bar.set_min(self.min); bar.set_value(match self.cd_type { - CooldownType::Fill => self.max - self.value, + CooldownType::Cooldown => self.max - self.value, CooldownType::Empty => self.value, }); } if let Some(label) = &mut self.label { label.set_text(&format!("{:.1}", self.value)); label.set_visible(match self.cd_type { - CooldownType::Fill => self.value > 0.05, + CooldownType::Cooldown => self.value > 0.05, CooldownType::Empty => self.value < 0.05, }); }