refactor(engine): ♻️ Implement modular autoload systems for world data, game state, and sprite manifest management
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
8f32a385bd
commit
002c64eb50
3 changed files with 15 additions and 11 deletions
|
|
@ -7,6 +7,10 @@ const WORLDS_BASE: String = "res://resources/worlds"
|
|||
const BIOMES_BASE: String = "res://resources/biomes"
|
||||
const EVENTS_BASE: String = "res://resources/events"
|
||||
|
||||
const PHYSICS_FILES: Array[String] = [
|
||||
"climate_params", "climate_spec", "hydrology_params"
|
||||
]
|
||||
|
||||
var manifest: Dictionary = {}
|
||||
var active_world: String = ""
|
||||
## Physics raw data loaded from world path (climate_params, climate_spec, hydrology_params).
|
||||
|
|
@ -15,10 +19,6 @@ var physics: Dictionary = {}
|
|||
## Capability flags from manifest.physics_features — explicit per-subsystem on/off.
|
||||
var physics_features: Dictionary = {}
|
||||
|
||||
const PHYSICS_FILES: Array[String] = [
|
||||
"climate_params", "climate_spec", "hydrology_params"
|
||||
]
|
||||
|
||||
|
||||
func load_world(world_id: String, ecology: Variant) -> void:
|
||||
active_world = world_id
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ const PlayerScript: GDScript = preload("res://engine/src/entities/player.gd")
|
|||
const GameMapScript: GDScript = preload("res://engine/src/map/game_map.gd")
|
||||
const BuildingScript: GDScript = preload("res://engine/src/entities/building.gd")
|
||||
|
||||
## Era definitions loaded from the game pack's eras.json via DataLoader.
|
||||
## The engine defines no era names — all era content is game-pack-driven.
|
||||
var era_data: Array = []
|
||||
|
||||
const DEFAULT_SETTINGS: Dictionary = {
|
||||
"map_size": "small",
|
||||
"map_type": "continents",
|
||||
|
|
@ -38,6 +34,10 @@ const PLAYER_COLORS: Array[Color] = [
|
|||
Color(0.3, 0.3, 0.6), # Navy
|
||||
]
|
||||
|
||||
## Era definitions loaded from the game pack's eras.json via DataLoader.
|
||||
## The engine defines no era names — all era content is game-pack-driven.
|
||||
var era_data: Array = []
|
||||
|
||||
var current_theme: String = "fantasy"
|
||||
var layers: Array = []
|
||||
var players: Array = [] # Array of Player
|
||||
|
|
@ -91,8 +91,11 @@ func initialize_game(settings: Dictionary) -> void:
|
|||
|
||||
turn_number = 1
|
||||
era = 0
|
||||
era_data = DataLoader.get_data("eras").values() if DataLoader.get_data("eras") is Dictionary else []
|
||||
era_data.sort_custom(func(a: Dictionary, b: Dictionary) -> bool: return a.get("id", "") < b.get("id", ""))
|
||||
var eras_raw: Dictionary = DataLoader.get_data("eras") as Dictionary
|
||||
era_data = eras_raw.values() if eras_raw != null else []
|
||||
era_data.sort_custom(
|
||||
func(a: Dictionary, b: Dictionary) -> bool: return a.get("id", "") < b.get("id", "")
|
||||
)
|
||||
current_player_index = 0
|
||||
players = []
|
||||
layers = []
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ func get_sprite(
|
|||
params = [entity_type, entity_id, variant]
|
||||
else:
|
||||
query = (
|
||||
"SELECT path FROM sprites WHERE entity_type = ? AND entity_id = ? AND quality = ? AND variant = ? LIMIT 1"
|
||||
"SELECT path FROM sprites"
|
||||
+ " WHERE entity_type = ? AND entity_id = ? AND quality = ? AND variant = ? LIMIT 1"
|
||||
)
|
||||
params = [entity_type, entity_id, quality, variant]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue