Skip to content

Commit 3d0215b

Browse files
committed
Guard script: Simplify debug information
1 parent 465b29e commit 3d0215b

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

  • scenes/game_elements/characters/enemies/guard/components

scenes/game_elements/characters/enemies/guard/components/guard.gd

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ func _update_debug_info() -> void:
224224
if not debug_info.visible:
225225
return
226226
debug_info.text = ""
227-
debug_property("position")
228-
debug_value("state", State.keys()[state])
229-
debug_property("previous_patrol_point_idx")
230-
debug_property("current_patrol_point_idx")
231-
debug_value("time left", "%.2f" % guard_movement.still_time_left_in_seconds)
232-
debug_value("target point", guard_movement.destination)
227+
debug_info.text += "%s: %s\n" % ["position", position]
228+
debug_info.text += "%s: %s\n" % ["state", State.keys()[state]]
229+
debug_info.text += "%s: %s\n" % ["previous_patrol_point_idx", previous_patrol_point_idx]
230+
debug_info.text += "%s: %s\n" % ["current_patrol_point_idx", current_patrol_point_idx]
231+
debug_info.text += "%s: %.2f\n" % ["time left", guard_movement.still_time_left_in_seconds]
232+
debug_info.text += "%s: %s\n" % ["target point", guard_movement.destination]
233233

234234

235235
## What happens when the guard reached the point it was walking towards
@@ -293,16 +293,6 @@ func _set_state(new_state: State) -> void:
293293
breadcrumbs.push_back(global_position)
294294

295295

296-
## Pass a property name as a parameter and it shows its name and its value
297-
func debug_property(property_name: String) -> void:
298-
debug_value(property_name, get(property_name))
299-
300-
301-
## Pass a value name and its value and it shows it on DebugInfo
302-
func debug_value(value_name: String, value: Variant) -> void:
303-
debug_info.text += "%s: %s\n" % [value_name, value]
304-
305-
306296
## Calculate and set the next point in the patrol path.
307297
## The guard would circle back if the path is open, and go in rounds if the
308298
## path is closed.

0 commit comments

Comments
 (0)