Refactor: Added explicit typing and void return types

- Introduced explicit typing to variables and functions across multiple scripts for better code clarity.
- Specified 'void' as the return type for functions that do not return a value.
- Removed redundant code in some scripts.
This commit is contained in:
Dan 2024-05-15 10:42:16 +01:00
parent a62cd6018e
commit 2a9e78b52e
37 changed files with 216 additions and 248 deletions

View file

@ -1,7 +1,7 @@
extends State
class_name BeeIdle
@onready var bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
@onready var bee : Bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
var idle_time : float = 0.0
@ -10,14 +10,14 @@ var target : Vector2 = Vector2.ZERO
var acquire_new_target : bool = false
func enter(_msg := {}):
func enter(_msg : Dictionary = {}) -> void:
if acquire_new_target:
target = bee.get_global_position() + Vector2(randi_range(-60, 60), randi_range(-60, 60))
func exit():
func exit() -> void:
acquire_new_target = true
func update(delta : float):
func update(delta : float) -> void:
if target == Vector2.ZERO:
randomize()
@ -39,7 +39,7 @@ func physics_update(delta : float) -> void:
bee.move_and_collide(bee.velocity)
bee.bee_body.look_at(target)
func find_something_to_do():
func find_something_to_do() -> void:
if bee.nectar > 0:
Log.pr("I have pollen, time to move..")
## Bee has pollen - head home