Reduce logging spam
This commit is contained in:
@@ -5,6 +5,10 @@ enum States {
|
||||
PECKING
|
||||
}
|
||||
|
||||
@export var minimum_pecking_schedule_gap := 8.0
|
||||
@export var maximum_pecking_schedule_gap := 25.0
|
||||
@export var should_log_pecking_schedule := false
|
||||
|
||||
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
|
||||
|
||||
var current_state := States.IDLE
|
||||
@@ -23,11 +27,12 @@ func _process(delta: float) -> void:
|
||||
animated_sprite_2d.play("pecking")
|
||||
await animated_sprite_2d.animation_finished
|
||||
animated_sprite_2d.play("idle")
|
||||
pecking_sched = randf_range(8.0, 25.0)
|
||||
pecking_sched = randf_range(minimum_pecking_schedule_gap, maximum_pecking_schedule_gap)
|
||||
pecking_timer = 0
|
||||
current_state = States.IDLE
|
||||
_print_sched()
|
||||
|
||||
|
||||
func _print_sched() -> void:
|
||||
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
||||
if should_log_pecking_schedule:
|
||||
print("%s Pecking Schedule: %f" % [name, pecking_sched])
|
||||
|
||||
@@ -4,6 +4,9 @@ extends Node2D
|
||||
@export var spawn_markers: Node2D
|
||||
@export var destination_markers: Node2D
|
||||
|
||||
# Debug
|
||||
@export var should_log_schedule := false
|
||||
|
||||
@export_range(0.0, 60.0) var minimum_schedule_gap := 20.0
|
||||
@export_range(1.0, 61.0) var maximum_schedule_gap := 60.0
|
||||
|
||||
@@ -25,7 +28,8 @@ func _ready() -> void:
|
||||
# At spawn, we might want to spawn some leaves sooner...
|
||||
_spawn_schedule -= randf_range(0.0, _spawn_schedule)
|
||||
_spawn_schedule = max(0, _spawn_schedule)
|
||||
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
||||
|
||||
_log_schedule()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -33,6 +37,7 @@ func _process(delta: float) -> void:
|
||||
if _spawn_timer >= _spawn_schedule:
|
||||
_spawn_timer = 0.0
|
||||
_set_random_spawn_schedule()
|
||||
_log_schedule()
|
||||
|
||||
var spawn := _get_random_spawn_point()
|
||||
var destination := _get_random_destination_point()
|
||||
@@ -76,3 +81,8 @@ func _get_random_destination_point() -> Vector2:
|
||||
var offset := Vector2(randf_range(-5.0, 5.0), randf_range(-5.0, 5.0))
|
||||
|
||||
return marker.position + offset
|
||||
|
||||
|
||||
func _log_schedule() -> void:
|
||||
if should_log_schedule:
|
||||
print("%s - Leaf Spawn Schedule: %f" % [get_parent().name, _spawn_schedule])
|
||||
|
||||
Reference in New Issue
Block a user