style: apply gdformat formatting across the entire project

Auto-format all GDScript files using gdformat from gdtoolkit.
This is a baseline formatting pass to ensure consistent style:

- Normalizes indentation and spacing
- Wraps long lines to 100 characters
- Removes trailing whitespace
- Standardizes blank lines between functions

68 files reformatted, 8 files left unchanged (3rd-party addon files
with parse errors excluded).
This commit is contained in:
2026-07-05 23:06:23 +02:00
parent 28a2e42c41
commit 4463e524aa
69 changed files with 2253 additions and 1647 deletions
+28 -16
View File
@@ -13,6 +13,7 @@ var resources: Array[ResourceStateRecord] = []
var storages: Array[StorageStateRecord] = []
var economic_events: Array[EconomicEventRecord] = []
func to_dictionary() -> Dictionary:
var npc_data: Array[Dictionary] = []
for npc_record in npcs:
@@ -39,15 +40,18 @@ func to_dictionary() -> Dictionary:
"economic_events": event_data
}
func to_json() -> String:
return JSON.stringify(to_dictionary())
static func from_json(json_text: String) -> SimulationStateRecord:
var parsed = JSON.parse_string(json_text)
if not parsed is Dictionary:
return null
return from_dictionary(parsed)
static func from_dictionary(record_data: Dictionary) -> SimulationStateRecord:
if record_data.get("schema", "") != SCHEMA_NAME:
return null
@@ -56,19 +60,25 @@ static func from_dictionary(record_data: Dictionary) -> SimulationStateRecord:
record_data = _migrate_legacy(record_data, version)
elif version != SCHEMA_VERSION:
return null
if not record_data.has_all([
"simulation", "village", "npcs", "resources", "storages",
"economic_events"
]):
if not record_data.has_all(
["simulation", "village", "npcs", "resources", "storages", "economic_events"]
):
return null
var simulation_data = record_data["simulation"]
if not simulation_data is Dictionary:
return null
if not simulation_data.has_all([
"seed", "tick_interval", "tick_count", "clock_accumulator",
"clock_elapsed_ticks", "wander_random_streams", "next_event_id"
]):
if not simulation_data.has_all(
[
"seed",
"tick_interval",
"tick_count",
"clock_accumulator",
"clock_elapsed_ticks",
"wander_random_streams",
"next_event_id"
]
):
return null
var wander_streams = simulation_data["wander_random_streams"]
if not wander_streams is Array:
@@ -160,20 +170,22 @@ static func from_dictionary(record_data: Dictionary) -> SimulationStateRecord:
return record
static func _migrate_legacy(
legacy_data: Dictionary,
version: int
) -> Dictionary:
static func _migrate_legacy(legacy_data: Dictionary, version: int) -> Dictionary:
var migrated := legacy_data.duplicate(true)
migrated["schema_version"] = SCHEMA_VERSION
if version == LEGACY_SCHEMA_VERSION:
var village_data: Dictionary = legacy_data.get("village", {})
var initial_food := float(village_data.get("food", 0.0))
migrated["storages"] = [
StorageStateRecord.create(
SimulationIds.STORAGE_VILLAGE_PANTRY,
{String(SimulationIds.RESOURCE_FOOD): initial_food}
).to_dictionary()
(
StorageStateRecord
. create(
SimulationIds.STORAGE_VILLAGE_PANTRY,
{String(SimulationIds.RESOURCE_FOOD): initial_food}
)
. to_dictionary()
)
]
migrated["economic_events"] = []
var simulation_data: Dictionary = migrated.get("simulation", {})