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 var time_at_patch : float = 0.0
func enter(_msg := {}): func enter(_msg := {}):
Log.pr("I am going to attempt to gather some stuff!")
bee.just_gathering = true bee.just_gathering = true
#animator.play("Idle") #animator.play("Idle")

View file

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

View file

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

View file

@ -6,12 +6,7 @@ class_name BeeSleeping
var time_at_patch : float = 0.0 var time_at_patch : float = 0.0
func enter(_msg := {}): func enter(_msg := {}):
Log.pr("BuzzzZZZzzzZZZZzzz (Sleeping)!") pass
#animator.play("Idle")
func update(_delta):
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 pass

View file

@ -8,7 +8,6 @@ class_name BeeTravelling
var return_to_hive : bool = false var return_to_hive : bool = false
func enter(_msg := {}): func enter(_msg := {}):
Log.pr("I am on the move!")
return_to_hive = false return_to_hive = false
## Get the next target location from the bee ## Get the next target location from the bee
if bee.just_gathering: if bee.just_gathering:
@ -17,11 +16,8 @@ func enter(_msg := {}):
else: else:
target = bee.get_next_target() target = bee.get_next_target()
Log.pr(bee, target)
# If we have no target, we are returning to the hive # If we have no target, we are returning to the hive
if !target: if !target:
Log.pr("No more drones to visit, going to go back to the hive")
return_to_hive = true return_to_hive = true
bee.animation_player.play("Flying") 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 var just_gathering : bool = false # Used to check if the bee has just been gathering to return to their previous director
func _ready(): func _ready():
speed = randi_range(35,55) # Randomise the bee speed a bit 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(): func get_current_director():
return drone_manager.get_director(latest_target_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 ## If we are at the highest director, we need to go to a flower
func get_next_target(): func get_next_target():
if nectar == 0: if nectar == 0:
Log.pr("I have no nectar")
## If there is a next directory drone, lets go to it ## If there is a next directory drone, lets go to it
var next_drone = drone_manager.get_next_director(latest_target_director) var next_drone = drone_manager.get_next_director(latest_target_director)
if next_drone: if next_drone:
Log.pr("Next drone target", next_drone)
latest_target_director = next_drone.visit_order latest_target_director = next_drone.visit_order
return next_drone return next_drone
## If there is no next drone, check for a collector drone ## If there is no next drone, check for a collector drone
var collector_drone = drone_manager.get_collector() var collector_drone = drone_manager.get_collector()
if collector_drone: if collector_drone:
Log.pr("Collector drone target", collector_drone)
return collector_drone return collector_drone
else: else:
Log.pr("I have nectar")
## Let's go home, we need the previous director drones location ## Let's go home, we need the previous director drones location
var previous_drone = drone_manager.get_previous_director(latest_target_director) var previous_drone = drone_manager.get_previous_director(latest_target_director)
if previous_drone: if previous_drone:
Log.pr("Previous drone target", previous_drone)
latest_target_director = previous_drone.visit_order latest_target_director = previous_drone.visit_order
return previous_drone return previous_drone

View file

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

View file

@ -3,16 +3,10 @@ class_name Beehive
var dancer_in_range : bool = false var dancer_in_range : bool = false
func _ready():
Log.pr("Beehive has joined the party")
func _on_area_2d_area_entered(area:Area2D): func _on_area_2d_area_entered(area:Area2D):
Log.pr("Beehive: Area entered", area)
if area.is_in_group("dancer"): if area.is_in_group("dancer"):
dancer_in_range = true dancer_in_range = true
print("Dancer in range")
func _on_area_2d_area_exited(area:Area2D): func _on_area_2d_area_exited(area:Area2D):
if area.is_in_group("dancer"): if area.is_in_group("dancer"):
dancer_in_range = false 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! # everything that uses a state machine!
func _ready(): func _ready():
Log.pr("FSM Ready")
for child in get_children(): for child in get_children():
if child is State: if child is State:
states[child.name.to_lower()] = child states[child.name.to_lower()] = child
child.state_transition.connect(change_state) child.state_transition.connect(change_state)
Log.pr(states)
if initial_state: if initial_state:
initial_state.enter() initial_state.enter()
current_state = initial_state current_state = initial_state

View file

@ -10,9 +10,6 @@ var max_bees = 100
var spawn_interval = 0.5 var spawn_interval = 0.5
var spawn_timer = 0.0 var spawn_timer = 0.0
func _ready():
Log.pr("Bee Spawner ready")
func spawn_bee(): func spawn_bee():
var bee_instance = bee.instantiate() var bee_instance = bee.instantiate()
add_child(bee_instance) add_child(bee_instance)

View file

@ -16,9 +16,6 @@ var director_drones : Array = [] # List of all director drones in the world
@onready var distractor_drone = preload("res://entities/DistractorDrone.tscn") @onready var distractor_drone = preload("res://entities/DistractorDrone.tscn")
@onready var collector_drone = preload("res://entities/CollectorDrone.tscn") @onready var collector_drone = preload("res://entities/CollectorDrone.tscn")
func _ready() -> void:
Log.pr("Drone Manager Ready...")
## Function to detect right click event ## Function to detect right click event
func _input(event) -> void: func _input(event) -> void:
if spawning_drone: if spawning_drone:

View file

@ -1,11 +1 @@
extends Node2D extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready():
Log.pr("Hello there...")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass

View file

@ -61,9 +61,10 @@ script = ExtResource("3_gg2a6")
shape = SubResource("CircleShape2D_ewfly") shape = SubResource("CircleShape2D_ewfly")
[node name="Dog" type="Polygon2D" parent="."] [node name="Dog" type="Polygon2D" parent="."]
position = Vector2(-354, 53) position = Vector2(796, 426)
color = Color(0.803922, 0.407843, 0.239216, 1) color = Color(0.803922, 0.407843, 0.239216, 1)
polygon = PackedVector2Array(819, 301, 866, 278, 888, 364, 842, 319, 832, 373, 806, 423, 775, 424, 754, 377, 762, 319, 728, 360, 739, 263, 765, 284) offset = Vector2(0, -15)
polygon = PackedVector2Array(17, -32, 57, -45, 51, 27, 29, -5, 31, 27, 15, 57, -15, 55, -29, 31, -23, -9, -51, 25, -53, -43, -17, -32)
[node name="BeeSpawner" type="Node2D" parent="."] [node name="BeeSpawner" type="Node2D" parent="."]
script = ExtResource("2_qqqq4") script = ExtResource("2_qqqq4")

View file

@ -7,7 +7,6 @@ var last_update : float = 0
@onready var nectar_bar = get_node("%NectarBar") @onready var nectar_bar = get_node("%NectarBar")
func _ready(): func _ready():
Log.pr("UIComponent ready")
update_ui() update_ui()
func _process(delta): func _process(delta):
@ -17,8 +16,9 @@ func _process(delta):
last_update = 0 last_update = 0
update_ui() update_ui()
func update_ui(): if GameState.level_complete:
Log.pr("UIComponent update_ui") update_ui()
func update_ui():
nectar_bar.value = GameState.gathered_nectar nectar_bar.value = GameState.gathered_nectar
nectar_bar.max_value = GameState.required_nectar nectar_bar.max_value = GameState.required_nectar

View file

@ -12,12 +12,8 @@ var gathered_nectar : int = 0 :
@export var required_nectar : int = 100 @export var required_nectar : int = 100
func _ready():
Log.pr("GameStateManager ready")
func add_nectar(): func add_nectar():
gathered_nectar += 1 gathered_nectar += 1
Log.pr("Nectar gathered", gathered_nectar)
func game_win(): func game_win():
Log.pr("Game win") Log.pr("Game win")