refactor(climate): ♻️ Restructure climate_base.gd and climate.gd for improved data processing and simulation capabilities

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-29 10:07:31 -07:00
parent ca62ab4c34
commit aec9f262cc
2 changed files with 26 additions and 11 deletions

View file

@ -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

View file

@ -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 = {}