From 2429e7596770c32bdce2b2a869f7dab0b17d4367 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Tue, 11 Aug 2026 12:58:59 +0300 Subject: [PATCH] Update settings menu margins and enhance game clock functionality. Adjusted content margins in the settings menu for improved layout. Added 'jumped' signal to the game clock to handle manual time jumps, ensuring weather system responds appropriately to time changes. --- scenes/ui/settings_menu.tscn | 8 ++++---- scripts/game/game_clock.gd | 4 ++++ scripts/game/weather_system.gd | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/scenes/ui/settings_menu.tscn b/scenes/ui/settings_menu.tscn index 7838178..186379b 100644 --- a/scenes/ui/settings_menu.tscn +++ b/scenes/ui/settings_menu.tscn @@ -4,10 +4,10 @@ [ext_resource type="Script" uid="uid://jkhpwi3ngait" path="res://scripts/ui/settings_menu.gd" id="2_x3vyp"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mhswj"] -content_margin_left = 22.0 -content_margin_top = 14.0 -content_margin_right = 22.0 -content_margin_bottom = 14.0 +content_margin_left = 26.0 +content_margin_top = 16.0 +content_margin_right = 26.0 +content_margin_bottom = 16.0 bg_color = Color(1, 1, 1, 0.05882353) border_width_left = 1 border_width_top = 1 diff --git a/scripts/game/game_clock.gd b/scripts/game/game_clock.gd index 7a2874f..f5ddc1d 100644 --- a/scripts/game/game_clock.gd +++ b/scripts/game/game_clock.gd @@ -34,6 +34,9 @@ signal minute_passed(total_minutes: int) signal day_passed(day_index: int) ## Изменились скорость или состояние паузы. signal flow_changed +## Часы перевели вручную: время не шло, а прыгнуло. Подписчикам вроде погоды +## это повод не догонять новое состояние плавно, а взять его сразу. +signal jumped var running := true var speed := 1 @@ -112,6 +115,7 @@ func set_moment(moment: Dictionary) -> bool: _elapsed_minutes = float(target - _start_unix) / 60.0 _last_whole_minute = int(_elapsed_minutes) _last_day = _day_index() + jumped.emit() minute_passed.emit(_last_whole_minute) return true diff --git a/scripts/game/weather_system.gd b/scripts/game/weather_system.gd index 38de286..00822fe 100644 --- a/scripts/game/weather_system.gd +++ b/scripts/game/weather_system.gd @@ -94,6 +94,9 @@ func _ready() -> void: func attach_clock(clock: GameClock) -> void: _clock = clock _clock.minute_passed.connect(_on_minute_passed) + # Прыжок во времени — не то же, что ход времени: догонять новый сезон + # плавно после переноса на полгода бессмысленно, берём норму сразу. + _clock.jumped.connect(_on_clock_jumped) _apply_climate(1.0) @@ -130,12 +133,12 @@ func set_wind_speed(speed: float) -> void: # --- Сохранение ------------------------------------------------------------- func save_data() -> Dictionary: + # Облачность, осадки и дымку не пишем: это промежуточные значения перехода, + # и в слоте они противоречили бы названию погоды — туман с ливневыми + # осадками. При загрузке они берутся из типа напрямую. return { "kind": int(kind), "minutes_left": _minutes_left, - "clouds": clouds, - "precipitation": precipitation, - "fog": fog, "wind_speed": wind_speed, "temperature": temperature, "drift": _temperature_drift, @@ -145,17 +148,20 @@ func save_data() -> Dictionary: func load_data(data: Dictionary) -> void: kind = clampi(int(data.get("kind", Kind.CLEAR)), 0, KINDS.size() - 1) _minutes_left = int(data.get("minutes_left", MIN_DURATION)) - clouds = float(data.get("clouds", 0.12)) - precipitation = float(data.get("precipitation", 0.0)) - fog = float(data.get("fog", 0.0)) temperature = float(data.get("temperature", 8.0)) _temperature_drift = float(data.get("drift", 0.0)) set_wind_speed(float(data.get("wind_speed", 2.5))) + # Картинка сразу соответствует названию погоды, без доблёкивания. + _apply_target(1.0) changed.emit(kind) # --- Внутреннее ------------------------------------------------------------- +func _on_clock_jumped() -> void: + _apply_climate(1.0) + + func _on_minute_passed(_total_minutes: int) -> void: _apply_target(1.0 / BLEND_MINUTES) _apply_climate(1.0 / BLEND_MINUTES)