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
+74 -62
View File
@@ -7,41 +7,47 @@ const PREVIOUS_SCHEMA_VERSION := 2
var data: Dictionary
func _init(record_data: Dictionary = {}) -> void:
data = record_data.duplicate(true)
static func capture(npc: SimNPC) -> NPCStateRecord:
return NPCStateRecord.new({
"schema_version": SCHEMA_VERSION,
"id": npc.id,
"name": npc.npc_name,
"profession": String(npc.profession),
"hunger": npc.hunger,
"energy": npc.energy,
"strength": npc.strength,
"intelligence": npc.intelligence,
"current_task": String(npc.current_task),
"task_state": String(npc.task_state),
"position": [npc.position.x, npc.position.y, npc.position.z],
"is_starving": npc.is_starving,
"starvation_ticks": npc.starvation_ticks,
"starvation_death_threshold": npc.starvation_death_threshold,
"is_dead": npc.is_dead,
"task_duration": npc.task_duration,
"task_progress": npc.task_progress,
"task_complete": npc.task_complete,
"target_id": String(npc.target_id),
"travel_target_position": [
npc.travel_target_position.x,
npc.travel_target_position.y,
npc.travel_target_position.z
],
"has_travel_target": npc.has_travel_target,
"inventory": npc.inventory.duplicate(true),
"last_task": String(npc.last_task),
"random_seed": str(npc.random_source.seed),
"random_state": str(npc.random_source.state)
})
return NPCStateRecord.new(
{
"schema_version": SCHEMA_VERSION,
"id": npc.id,
"name": npc.npc_name,
"profession": String(npc.profession),
"hunger": npc.hunger,
"energy": npc.energy,
"strength": npc.strength,
"intelligence": npc.intelligence,
"current_task": String(npc.current_task),
"task_state": String(npc.task_state),
"position": [npc.position.x, npc.position.y, npc.position.z],
"is_starving": npc.is_starving,
"starvation_ticks": npc.starvation_ticks,
"starvation_death_threshold": npc.starvation_death_threshold,
"is_dead": npc.is_dead,
"task_duration": npc.task_duration,
"task_progress": npc.task_progress,
"task_complete": npc.task_complete,
"target_id": String(npc.target_id),
"travel_target_position":
[
npc.travel_target_position.x,
npc.travel_target_position.y,
npc.travel_target_position.z
],
"has_travel_target": npc.has_travel_target,
"inventory": npc.inventory.duplicate(true),
"last_task": String(npc.last_task),
"random_seed": str(npc.random_source.seed),
"random_state": str(npc.random_source.state)
}
)
static func from_dictionary(record_data: Dictionary) -> NPCStateRecord:
var version := int(record_data.get("schema_version", -1))
@@ -49,23 +55,40 @@ static func from_dictionary(record_data: Dictionary) -> NPCStateRecord:
record_data = _migrate_legacy(record_data, version)
elif version != SCHEMA_VERSION:
return null
if not record_data.has_all([
"id", "name", "profession", "hunger", "energy", "strength",
"intelligence", "current_task", "task_state", "position",
"is_starving", "starvation_ticks", "starvation_death_threshold",
"is_dead", "task_duration", "task_progress", "task_complete",
"target_id", "travel_target_position", "has_travel_target", "inventory",
"last_task", "random_seed", "random_state"
]):
if not record_data.has_all(
[
"id",
"name",
"profession",
"hunger",
"energy",
"strength",
"intelligence",
"current_task",
"task_state",
"position",
"is_starving",
"starvation_ticks",
"starvation_death_threshold",
"is_dead",
"task_duration",
"task_progress",
"task_complete",
"target_id",
"travel_target_position",
"has_travel_target",
"inventory",
"last_task",
"random_seed",
"random_state"
]
):
return null
var saved_position = record_data["position"]
if not saved_position is Array or saved_position.size() != 3:
return null
var saved_target_position = record_data["travel_target_position"]
if (
not saved_target_position is Array
or saved_target_position.size() != 3
):
if not saved_target_position is Array or saved_target_position.size() != 3:
return null
if not record_data["inventory"] is Dictionary:
return null
@@ -74,36 +97,26 @@ static func from_dictionary(record_data: Dictionary) -> NPCStateRecord:
return null
var action_id := StringName(record_data["current_task"])
if (
action_id not in [
SimulationIds.ACTION_IDLE,
SimulationIds.ACTION_DEAD
]
action_id not in [SimulationIds.ACTION_IDLE, SimulationIds.ACTION_DEAD]
and SimulationDefinitions.get_action(action_id) == null
):
return null
var last_action_id := StringName(record_data["last_task"])
if (
not last_action_id.is_empty()
and SimulationDefinitions.get_action(last_action_id) == null
):
if not last_action_id.is_empty() and SimulationDefinitions.get_action(last_action_id) == null:
return null
return NPCStateRecord.new(record_data)
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:
migrated["travel_target_position"] = legacy_data.get(
"position",
[0.0, 0.0, 0.0]
)
migrated["travel_target_position"] = legacy_data.get("position", [0.0, 0.0, 0.0])
migrated["has_travel_target"] = false
migrated["inventory"] = {}
return migrated
func restore(debug_logs: bool) -> SimNPC:
var random_source := RandomNumberGenerator.new()
random_source.seed = String(data["random_seed"]).to_int()
@@ -122,9 +135,7 @@ func restore(debug_logs: bool) -> SimNPC:
npc.current_task = StringName(data["current_task"])
npc.task_state = StringName(data["task_state"])
npc.position = Vector3(
float(saved_position[0]),
float(saved_position[1]),
float(saved_position[2])
float(saved_position[0]), float(saved_position[1]), float(saved_position[2])
)
npc.is_starving = bool(data["is_starving"])
npc.starvation_ticks = int(data["starvation_ticks"])
@@ -146,5 +157,6 @@ func restore(debug_logs: bool) -> SimNPC:
npc.debug_logs = debug_logs
return npc
func to_dictionary() -> Dictionary:
return data.duplicate(true)