Removing a lot of logging

This commit is contained in:
Dan Baker 2024-05-05 18:08:50 +01:00
parent e88b2248b3
commit 07b63a8426
15 changed files with 9 additions and 67 deletions

View file

@ -7,7 +7,6 @@ class_name BeeGathering
var time_at_patch : float = 0.0
func enter(_msg := {}):
Log.pr("I am going to attempt to gather some stuff!")
bee.just_gathering = true
#animator.play("Idle")

View file

@ -6,7 +6,6 @@ class_name BeeIdle
var idle_time : float = 0.0
func enter(_msg := {}):
Log.pr("I sit by idl-bee")
#animator.play("Idle")
pass
@ -15,7 +14,6 @@ func update(delta : float):
idle_time += delta
if idle_time > 2.0:
Log.pr("Been idle for 2 seconds, check for something to do...")
find_something_to_do()
idle_time = 0.0
pass
@ -23,10 +21,8 @@ func update(delta : float):
func find_something_to_do():
if bee.nectar > 0:
## Bee has pollen - head home
Log.pr(bee, "I have nectar, I should return to the hive")
state_transition.emit(self, "Travelling")
else:
## Bee has no pollen - they should move to a flower
Log.pr(bee, "I have no nectar, I should find a flower")
state_transition.emit(self, "Travelling")
pass

View file

@ -5,11 +5,8 @@ class_name BeeReturning
@onready var target = get_tree().get_first_node_in_group("beehive")
func enter(_msg := {}):
Log.pr("I return to the hive!")
bee.animation_player.play("Flying")
func update(delta : float) -> void:
if target:

View file

@ -6,12 +6,7 @@ class_name BeeSleeping
var time_at_patch : float = 0.0
func enter(_msg := {}):
Log.pr("BuzzzZZZzzzZZZZzzz (Sleeping)!")
#animator.play("Idle")
func update(_delta : float):
# If there is a dancing bee in range of the hive then
# we have a chance to wake up the bee...
pass
func update(_delta):
pass

View file

@ -8,7 +8,6 @@ class_name BeeTravelling
var return_to_hive : bool = false
func enter(_msg := {}):
Log.pr("I am on the move!")
return_to_hive = false
## Get the next target location from the bee
if bee.just_gathering:
@ -17,11 +16,8 @@ func enter(_msg := {}):
else:
target = bee.get_next_target()
Log.pr(bee, target)
# If we have no target, we are returning to the hive
if !target:
Log.pr("No more drones to visit, going to go back to the hive")
return_to_hive = true
bee.animation_player.play("Flying")

View file

@ -15,13 +15,8 @@ var in_range_of_flowers : bool = false
var just_gathering : bool = false # Used to check if the bee has just been gathering to return to their previous director
func _ready():
speed = randi_range(35,55) # Randomise the bee speed a bit
Log.pr("I have never bee-n so ready!")
Log.pr(fsm.current_state.name)
func get_current_director():
return drone_manager.get_director(latest_target_director)
@ -32,27 +27,21 @@ func get_current_director():
## If we are at the highest director, we need to go to a flower
func get_next_target():
if nectar == 0:
Log.pr("I have no nectar")
## If there is a next directory drone, lets go to it
var next_drone = drone_manager.get_next_director(latest_target_director)
if next_drone:
Log.pr("Next drone target", next_drone)
latest_target_director = next_drone.visit_order
return next_drone
## If there is no next drone, check for a collector drone
var collector_drone = drone_manager.get_collector()
if collector_drone:
Log.pr("Collector drone target", collector_drone)
return collector_drone
else:
Log.pr("I have nectar")
## Let's go home, we need the previous director drones location
var previous_drone = drone_manager.get_previous_director(latest_target_director)
if previous_drone:
Log.pr("Previous drone target", previous_drone)
latest_target_director = previous_drone.visit_order
return previous_drone

View file

@ -10,10 +10,8 @@ func _on_area_entered(area:Area2D):
## Check if the area entered is a flower patch
if area.is_in_group("flowers"):
bee.in_range_of_flowers = true
Log.pr("I found some flowers!")
func _on_area_exited(area:Area2D):
## Check if the area exited is a flower patch
if area.is_in_group("flowers"):
bee.in_range_of_flowers = false
Log.pr("I left the flowers!")
bee.in_range_of_flowers = false

View file

@ -3,16 +3,10 @@ class_name Beehive
var dancer_in_range : bool = false
func _ready():
Log.pr("Beehive has joined the party")
func _on_area_2d_area_entered(area:Area2D):
Log.pr("Beehive: Area entered", area)
if area.is_in_group("dancer"):
dancer_in_range = true
print("Dancer in range")
func _on_area_2d_area_exited(area:Area2D):
if area.is_in_group("dancer"):
dancer_in_range = false
print("Dancer out of range")

View file

@ -10,14 +10,11 @@ var current_state : State
# everything that uses a state machine!
func _ready():
Log.pr("FSM Ready")
for child in get_children():
if child is State:
states[child.name.to_lower()] = child
child.state_transition.connect(change_state)
Log.pr(states)
if initial_state:
initial_state.enter()
current_state = initial_state