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:
+27
-44
@@ -8,25 +8,24 @@ const DEBUG_LOGS := true
|
||||
|
||||
var active_npc_visuals := {}
|
||||
|
||||
|
||||
func debug_log(message: String) -> void:
|
||||
if DEBUG_LOGS:
|
||||
print("[WorldViewManager] ", message)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
call_deferred("initialize_world_view")
|
||||
|
||||
|
||||
func initialize_world_view() -> void:
|
||||
await get_tree().physics_frame
|
||||
if simulation_manager.has_signal("npc_target_requested"):
|
||||
simulation_manager.npc_target_requested.connect(
|
||||
_on_npc_target_requested
|
||||
)
|
||||
simulation_manager.npc_target_requested.connect(_on_npc_target_requested)
|
||||
else:
|
||||
push_error("WorldViewManager: missing npc_target_requested signal")
|
||||
if simulation_manager.has_signal("npc_travel_requested"):
|
||||
simulation_manager.npc_travel_requested.connect(
|
||||
_on_npc_travel_requested
|
||||
)
|
||||
simulation_manager.npc_travel_requested.connect(_on_npc_travel_requested)
|
||||
else:
|
||||
push_error("WorldViewManager: missing npc_travel_requested signal")
|
||||
if simulation_manager.has_signal("npc_died"):
|
||||
@@ -34,19 +33,16 @@ func initialize_world_view() -> void:
|
||||
else:
|
||||
push_error("WorldViewManager: SimulationManager has no npc_died signal")
|
||||
if simulation_manager.has_signal("npc_inventory_changed"):
|
||||
simulation_manager.npc_inventory_changed.connect(
|
||||
_on_npc_inventory_changed
|
||||
)
|
||||
simulation_manager.npc_inventory_changed.connect(_on_npc_inventory_changed)
|
||||
else:
|
||||
push_error(
|
||||
"WorldViewManager: SimulationManager has no npc_inventory_changed signal"
|
||||
)
|
||||
push_error("WorldViewManager: SimulationManager has no npc_inventory_changed signal")
|
||||
if simulation_manager.has_signal("state_restored"):
|
||||
simulation_manager.state_restored.connect(_on_simulation_state_restored)
|
||||
else:
|
||||
push_error("WorldViewManager: SimulationManager has no state_restored signal")
|
||||
spawn_initial_npcs()
|
||||
|
||||
|
||||
func spawn_initial_npcs() -> void:
|
||||
if simulation_manager == null:
|
||||
push_error("WorldViewManager: simulation_manager is missing")
|
||||
@@ -61,6 +57,7 @@ func spawn_initial_npcs() -> void:
|
||||
for npc in simulation_manager.npcs:
|
||||
spawn_npc_visual(npc)
|
||||
|
||||
|
||||
func spawn_npc_visual(npc: SimNPC) -> void:
|
||||
if active_npc_visuals.has(npc.id):
|
||||
return
|
||||
@@ -87,18 +84,17 @@ func spawn_npc_visual(npc: SimNPC) -> void:
|
||||
elif npc.task_state == SimNPC.TASK_STATE_TRAVELING:
|
||||
simulation_manager.request_current_travel(npc.id)
|
||||
|
||||
|
||||
func despawn_npc_visual(npc_id: int) -> bool:
|
||||
var visual = active_npc_visuals.get(npc_id) as Node3D
|
||||
if visual == null:
|
||||
return false
|
||||
simulation_manager.synchronize_npc_position(
|
||||
npc_id,
|
||||
visual.global_position
|
||||
)
|
||||
simulation_manager.synchronize_npc_position(npc_id, visual.global_position)
|
||||
active_npc_visuals.erase(npc_id)
|
||||
visual.queue_free()
|
||||
return true
|
||||
|
||||
|
||||
func reload_npc_visual(npc_id: int) -> bool:
|
||||
if active_npc_visuals.has(npc_id):
|
||||
return false
|
||||
@@ -108,25 +104,22 @@ func reload_npc_visual(npc_id: int) -> bool:
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _on_npc_target_requested(npc: SimNPC) -> void:
|
||||
var visual = active_npc_visuals.get(npc.id) as Node3D
|
||||
if visual == null:
|
||||
return
|
||||
if not simulation_manager.resolve_npc_target(
|
||||
npc.id,
|
||||
visual.global_position
|
||||
):
|
||||
if not simulation_manager.resolve_npc_target(npc.id, visual.global_position):
|
||||
debug_log("Target resolution failed for %s" % npc.npc_name)
|
||||
|
||||
func _on_npc_travel_requested(
|
||||
npc: SimNPC,
|
||||
target_position: Vector3
|
||||
) -> void:
|
||||
|
||||
func _on_npc_travel_requested(npc: SimNPC, target_position: Vector3) -> void:
|
||||
var visual = active_npc_visuals.get(npc.id)
|
||||
if visual == null:
|
||||
return
|
||||
visual.set_target_position(target_position)
|
||||
|
||||
|
||||
func _on_npc_visual_arrived(sim_id: int) -> void:
|
||||
debug_log("NPC visual arrived. sim_id=%s" % sim_id)
|
||||
if simulation_manager == null:
|
||||
@@ -134,12 +127,10 @@ func _on_npc_visual_arrived(sim_id: int) -> void:
|
||||
return
|
||||
var visual = active_npc_visuals.get(sim_id) as Node3D
|
||||
if visual != null:
|
||||
simulation_manager.synchronize_npc_position(
|
||||
sim_id,
|
||||
visual.global_position
|
||||
)
|
||||
simulation_manager.synchronize_npc_position(sim_id, visual.global_position)
|
||||
simulation_manager.notify_npc_arrived(sim_id)
|
||||
|
||||
|
||||
func _on_npc_visual_navigation_failed(sim_id: int) -> void:
|
||||
debug_log("NPC visual navigation failed. sim_id=%s" % sim_id)
|
||||
if simulation_manager == null:
|
||||
@@ -147,18 +138,14 @@ func _on_npc_visual_navigation_failed(sim_id: int) -> void:
|
||||
return
|
||||
var visual = active_npc_visuals.get(sim_id) as Node3D
|
||||
if visual != null:
|
||||
simulation_manager.synchronize_npc_position(
|
||||
sim_id,
|
||||
visual.global_position
|
||||
)
|
||||
simulation_manager.synchronize_npc_position(sim_id, visual.global_position)
|
||||
simulation_manager.notify_npc_navigation_failed(sim_id)
|
||||
|
||||
func _on_npc_visual_position_changed(
|
||||
sim_id: int,
|
||||
active_position: Vector3
|
||||
) -> void:
|
||||
|
||||
func _on_npc_visual_position_changed(sim_id: int, active_position: Vector3) -> void:
|
||||
simulation_manager.synchronize_npc_position(sim_id, active_position)
|
||||
|
||||
|
||||
func _on_npc_died(npc: SimNPC) -> void:
|
||||
if not active_npc_visuals.has(npc.id):
|
||||
return
|
||||
@@ -168,11 +155,8 @@ func _on_npc_died(npc: SimNPC) -> void:
|
||||
else:
|
||||
push_error("WorldViewManager: NPCVisual has no apply_dead_visual_state")
|
||||
|
||||
func _on_npc_inventory_changed(
|
||||
npc: SimNPC,
|
||||
item_id: StringName,
|
||||
amount: float
|
||||
) -> void:
|
||||
|
||||
func _on_npc_inventory_changed(npc: SimNPC, item_id: StringName, amount: float) -> void:
|
||||
if item_id != SimulationIds.RESOURCE_FOOD:
|
||||
return
|
||||
var visual = active_npc_visuals.get(npc.id)
|
||||
@@ -181,9 +165,8 @@ func _on_npc_inventory_changed(
|
||||
if visual.has_method("set_carried_food_visible"):
|
||||
visual.set_carried_food_visible(amount > 0.0)
|
||||
else:
|
||||
push_error(
|
||||
"WorldViewManager: NPCVisual has no set_carried_food_visible method"
|
||||
)
|
||||
push_error("WorldViewManager: NPCVisual has no set_carried_food_visible method")
|
||||
|
||||
|
||||
func _on_simulation_state_restored() -> void:
|
||||
for visual in active_npc_visuals.values():
|
||||
|
||||
Reference in New Issue
Block a user