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:
@@ -1,5 +1,6 @@
|
||||
extends SceneTree
|
||||
|
||||
|
||||
class FakeActiveWorld:
|
||||
extends Node
|
||||
|
||||
@@ -12,12 +13,15 @@ class FakeActiveWorld:
|
||||
func get_activity_target(_action_id: StringName) -> Dictionary:
|
||||
return {"target_id": "", "position": activity_position}
|
||||
|
||||
|
||||
var failures: Array[String] = []
|
||||
var travel_requests: Array[Vector3] = []
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_run")
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
_test_selection_and_execution_are_separate()
|
||||
_test_target_resolution_and_travel_are_separate()
|
||||
@@ -31,16 +35,11 @@ func _run() -> void:
|
||||
push_error("[TEST] " + failure)
|
||||
quit(1)
|
||||
|
||||
|
||||
func _test_selection_and_execution_are_separate() -> void:
|
||||
var village := SimVillage.new()
|
||||
village.debug_logs = false
|
||||
var npc := SimNPC.new(
|
||||
700,
|
||||
"BoundaryWorker",
|
||||
SimulationIds.PROFESSION_FARMER,
|
||||
5.0,
|
||||
5.0
|
||||
)
|
||||
var npc := SimNPC.new(700, "BoundaryWorker", SimulationIds.PROFESSION_FARMER, 5.0, 5.0)
|
||||
npc.hunger = 80.0
|
||||
var executor := ActionExecutionSystem.new()
|
||||
executor.advance_npc(npc, village)
|
||||
@@ -55,12 +54,12 @@ func _test_selection_and_execution_are_separate() -> void:
|
||||
"Selection should independently choose food retrieval"
|
||||
)
|
||||
|
||||
|
||||
func _test_target_resolution_and_travel_are_separate() -> void:
|
||||
var adapter := FakeActiveWorld.new()
|
||||
adapter.resource_candidates = [{
|
||||
"target_id": "boundary_bush",
|
||||
"position": Vector3(3.0, 0.0, 2.0)
|
||||
}]
|
||||
adapter.resource_candidates = [
|
||||
{"target_id": "boundary_bush", "position": Vector3(3.0, 0.0, 2.0)}
|
||||
]
|
||||
root.add_child(adapter)
|
||||
|
||||
var manager: Node = load("res://simulation/SimulationManager.gd").new()
|
||||
@@ -70,18 +69,20 @@ func _test_target_resolution_and_travel_are_separate() -> void:
|
||||
manager.set_process(false)
|
||||
manager.npc_travel_requested.connect(_on_travel_requested)
|
||||
|
||||
var resource_state := ResourceStateRecord.from_dictionary({
|
||||
"schema_version": ResourceStateRecord.SCHEMA_VERSION,
|
||||
"node_id": "boundary_bush",
|
||||
"action_id": String(SimulationIds.ACTION_GATHER_FOOD),
|
||||
"resource_id": String(SimulationIds.RESOURCE_FOOD),
|
||||
"amount_remaining": 5.0,
|
||||
"yield_per_action": 1.0,
|
||||
"reserved_by": -1,
|
||||
"enabled": true,
|
||||
"can_npcs_use": true,
|
||||
"can_player_use": true
|
||||
})
|
||||
var resource_state := ResourceStateRecord.from_dictionary(
|
||||
{
|
||||
"schema_version": ResourceStateRecord.SCHEMA_VERSION,
|
||||
"node_id": "boundary_bush",
|
||||
"action_id": String(SimulationIds.ACTION_GATHER_FOOD),
|
||||
"resource_id": String(SimulationIds.RESOURCE_FOOD),
|
||||
"amount_remaining": 5.0,
|
||||
"yield_per_action": 1.0,
|
||||
"reserved_by": -1,
|
||||
"enabled": true,
|
||||
"can_npcs_use": true,
|
||||
"can_player_use": true
|
||||
}
|
||||
)
|
||||
manager.resource_states[resource_state.get_node_id()] = resource_state
|
||||
|
||||
var npc: SimNPC = manager.npcs[0]
|
||||
@@ -91,8 +92,7 @@ func _test_target_resolution_and_travel_are_separate() -> void:
|
||||
"Target resolver should resolve a resource from adapter facts"
|
||||
)
|
||||
_check(
|
||||
npc.target_id == &"boundary_bush"
|
||||
and resource_state.get_reserved_by() == npc.id,
|
||||
npc.target_id == &"boundary_bush" and resource_state.get_reserved_by() == npc.id,
|
||||
"Target resolver should authoritatively assign and reserve the target"
|
||||
)
|
||||
_check(
|
||||
@@ -113,12 +113,11 @@ func _test_target_resolution_and_travel_are_separate() -> void:
|
||||
manager.free()
|
||||
adapter.free()
|
||||
|
||||
func _on_travel_requested(
|
||||
_npc: SimNPC,
|
||||
target_position: Vector3
|
||||
) -> void:
|
||||
|
||||
func _on_travel_requested(_npc: SimNPC, target_position: Vector3) -> void:
|
||||
travel_requests.append(target_position)
|
||||
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
if not condition:
|
||||
failures.append(message)
|
||||
|
||||
Reference in New Issue
Block a user