From aec9f262ccde89ab31dbeef61da9123a24f5d6d2 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 29 Mar 2026 10:07:31 -0700 Subject: [PATCH] =?UTF-8?q?refactor(climate):=20=E2=99=BB=EF=B8=8F=20Restr?= =?UTF-8?q?ucture=20climate=5Fbase.gd=20and=20climate.gd=20for=20improved?= =?UTF-8?q?=20data=20processing=20and=20simulation=20capabilities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- engine/src/modules/climate/climate.gd | 29 ++++++++++++++-------- engine/src/modules/climate/climate_base.gd | 8 ++++++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/engine/src/modules/climate/climate.gd b/engine/src/modules/climate/climate.gd index 07f734f3..087d7812 100644 --- a/engine/src/modules/climate/climate.gd +++ b/engine/src/modules/climate/climate.gd @@ -34,19 +34,22 @@ func process_turn(game_map: RefCounted, turn: int = 0, seed: int = 42) -> void: _apply_aerosol_forcing(game_map) _update_temperatures(game_map) _update_lake_thermal_effects(game_map) - _update_moisture_wind(game_map) - _update_moisture_rivers(game_map) - _update_lake_evaporation(game_map) - _update_deep_earth_water(game_map) - _update_precipitation(game_map) - _update_surface_runoff(game_map) + if _physics_flags.get("water_cycle", true): + _update_moisture_wind(game_map) + _update_moisture_rivers(game_map) + _update_lake_evaporation(game_map) + if _physics_flags.get("volcanism", true): + _update_deep_earth_water(game_map) + _update_precipitation(game_map) + _update_surface_runoff(game_map) _check_terrain_evolution(game_map) _tick_ley_residue(game_map) - EcologicalEventsScript.process_events( - game_map, turn, seed, _spec, DataLoader.get_ecological_events(), - GameState.get_max_event_tier() - ) - AnchorDecayScript.process_decay(game_map, _spec) + if _physics_flags.get("ecology", true): + EcologicalEventsScript.process_events( + game_map, turn, seed, _spec, DataLoader.get_ecological_events(), + GameState.get_max_event_tier() + ) + AnchorDecayScript.process_decay(game_map, _spec) _update_ley_network(game_map) _compute_global_stats(game_map) _clear_magic_deltas(game_map) @@ -418,6 +421,10 @@ func _ensure_params() -> void: push_warning( "Climate: climate_spec.json missing — terrain transitions use built-in defaults" ) + var world_flags: Dictionary = DataLoader.get_physics_features() + if not world_flags.is_empty(): + for key: String in world_flags: + _physics_flags[key] = world_flags[key] _params_loaded = true diff --git a/engine/src/modules/climate/climate_base.gd b/engine/src/modules/climate/climate_base.gd index 15160c20..827b357d 100644 --- a/engine/src/modules/climate/climate_base.gd +++ b/engine/src/modules/climate/climate_base.gd @@ -62,6 +62,14 @@ var _seed: int = 42 var _params: Dictionary = {} var _spec: Dictionary = {} var _params_loaded: bool = false +# Physics capability flags from world manifest (physics_features block). +# Defaults to all-enabled so Earth worlds without the field keep working. +var _physics_flags: Dictionary = { + "water_cycle": true, + "weather_events": true, + "ecology": true, + "volcanism": true, +} # Per-terrain data cache (albedo, evapotranspiration) keyed by biome_id string var _terrain_cache: Dictionary = {}