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:
@@ -2,9 +2,11 @@ extends SceneTree
|
||||
|
||||
var failures: Array[String] = []
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_run")
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
_test_registry_integrity()
|
||||
_test_definition_backed_behavior()
|
||||
@@ -20,12 +22,10 @@ func _run() -> void:
|
||||
push_error("[TEST] " + failure)
|
||||
quit(1)
|
||||
|
||||
|
||||
func _test_registry_integrity() -> void:
|
||||
var errors := SimulationDefinitions.validate()
|
||||
_check(
|
||||
errors.is_empty(),
|
||||
"Definition registry should validate: %s" % [errors]
|
||||
)
|
||||
_check(errors.is_empty(), "Definition registry should validate: %s" % [errors])
|
||||
|
||||
var action_ids: Array[StringName] = []
|
||||
for definition in SimulationDefinitions.get_actions():
|
||||
@@ -34,30 +34,19 @@ func _test_registry_integrity() -> void:
|
||||
SimulationDefinitions.get_action(definition.action_id) == definition,
|
||||
"Action lookup should return '%s'" % definition.action_id
|
||||
)
|
||||
_check(
|
||||
action_ids.size() == 9,
|
||||
"Registry should contain all nine executable prototype actions"
|
||||
)
|
||||
_check(action_ids.size() == 9, "Registry should contain all nine executable prototype actions")
|
||||
|
||||
var profession_ids := SimulationDefinitions.get_profession_ids()
|
||||
_check(
|
||||
profession_ids.size() == 5,
|
||||
"Registry should contain all five prototype professions"
|
||||
)
|
||||
_check(profession_ids.size() == 5, "Registry should contain all five prototype professions")
|
||||
for profession_id in profession_ids:
|
||||
_check(
|
||||
SimulationDefinitions.get_profession(profession_id) != null,
|
||||
"Profession lookup should return '%s'" % profession_id
|
||||
)
|
||||
|
||||
|
||||
func _test_definition_backed_behavior() -> void:
|
||||
var npc := SimNPC.new(
|
||||
500,
|
||||
"DefinitionWorker",
|
||||
SimulationIds.PROFESSION_SCHOLAR,
|
||||
5.0,
|
||||
5.0
|
||||
)
|
||||
var npc := SimNPC.new(500, "DefinitionWorker", SimulationIds.PROFESSION_SCHOLAR, 5.0, 5.0)
|
||||
npc.set_task(SimulationIds.ACTION_STUDY)
|
||||
var study := SimulationDefinitions.get_action(SimulationIds.ACTION_STUDY)
|
||||
_check(
|
||||
@@ -68,23 +57,18 @@ func _test_definition_backed_behavior() -> void:
|
||||
study.preferred_profession_id == SimulationIds.PROFESSION_SCHOLAR,
|
||||
"Study should reference the stable scholar profession ID"
|
||||
)
|
||||
var gather := SimulationDefinitions.get_action(
|
||||
SimulationIds.ACTION_GATHER_FOOD
|
||||
)
|
||||
var gather := SimulationDefinitions.get_action(SimulationIds.ACTION_GATHER_FOOD)
|
||||
_check(
|
||||
gather.target_type == SimulationIds.TARGET_RESOURCE
|
||||
and gather.resource_action_id == SimulationIds.ACTION_GATHER_FOOD,
|
||||
(
|
||||
gather.target_type == SimulationIds.TARGET_RESOURCE
|
||||
and gather.resource_action_id == SimulationIds.ACTION_GATHER_FOOD
|
||||
),
|
||||
"Gather-food target metadata should come from its definition"
|
||||
)
|
||||
|
||||
|
||||
func _test_state_reference_validation() -> void:
|
||||
var npc := SimNPC.new(
|
||||
501,
|
||||
"ValidationWorker",
|
||||
SimulationIds.PROFESSION_FARMER,
|
||||
5.0,
|
||||
5.0
|
||||
)
|
||||
var npc := SimNPC.new(501, "ValidationWorker", SimulationIds.PROFESSION_FARMER, 5.0, 5.0)
|
||||
var valid_data := NPCStateRecord.capture(npc).to_dictionary()
|
||||
var invalid_profession := valid_data.duplicate(true)
|
||||
invalid_profession["profession"] = "missing_profession"
|
||||
@@ -99,6 +83,7 @@ func _test_state_reference_validation() -> void:
|
||||
"NPC state should reject an unknown action ID"
|
||||
)
|
||||
|
||||
|
||||
func _test_id_round_trip() -> void:
|
||||
var manager: Node = load("res://simulation/SimulationManager.gd").new()
|
||||
manager.debug_logs = false
|
||||
@@ -116,8 +101,7 @@ func _test_id_round_trip() -> void:
|
||||
)
|
||||
for npc in restored.npcs:
|
||||
_check(
|
||||
typeof(npc.profession) == TYPE_STRING_NAME,
|
||||
"Profession should restore as StringName"
|
||||
typeof(npc.profession) == TYPE_STRING_NAME, "Profession should restore as StringName"
|
||||
)
|
||||
_check(
|
||||
typeof(npc.current_task) == TYPE_STRING_NAME,
|
||||
@@ -131,6 +115,7 @@ func _test_id_round_trip() -> void:
|
||||
manager.free()
|
||||
restored.free()
|
||||
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
if not condition:
|
||||
failures.append(message)
|
||||
|
||||
Reference in New Issue
Block a user