add more asserts

This commit is contained in:
2024-10-06 19:40:26 +10:00
parent ab17b3489f
commit 78cb85eb92
5 changed files with 11 additions and 3 deletions

View File

@@ -13,6 +13,12 @@ var ant_nitwit := preload("res://scenes/units/ant_nitwit.tscn")
@onready var nitwits_holder: Node = $/root/World/Units/Nitwits
func _ready() -> void:
assert(ui_origin != null, "ui_origin missing!")
assert(nitwits_holder != null, "nitwits_holder missing!")
super._ready()
## Returns amount of honeydew that did not fit
func put_honeydew(amount: int) -> int:
var new_honeydew_amount := honeydew + amount

View File

@@ -1,4 +1,7 @@
extends Node
@onready var anthill_info: AnthillInfo = $/root/World/UI/AnthillInfo
@onready var anthill_info: AnthillInfo = $/root/World/UI/AnthillInfo
func _ready() -> void:
assert(anthill_info != null, "anthill_info missing!")

View File

@@ -14,6 +14,7 @@ func _ready() -> void:
assert(label != null, "label missing!")
assert(nitwit_button != null, "nitwit_button missing!")
assert(add_one_button != null, "add_one_button missing!")
assert(add_five_button != null, "add_five_button missing!")
assert(counter != null, "counter missing!")
super._ready()
nitwit_button.pressed.connect(_on_nitwit_button_pressed)

View File

@@ -26,7 +26,6 @@ func _ready() -> void:
assert(camera != null, "camera missing!")
assert(selection_sprite != null, "selection_sprite missing!")
set_selected(false)
if spawn_pos != null and spawn_pos != Vector3.ZERO:
global_position = spawn_pos
super._ready()

View File

@@ -20,7 +20,6 @@ var wandering_center: Vector3 = Vector3.ZERO
func _ready() -> void:
assert(hover_sprite != null, "hover_sprite missing!")
assert(nav_agent != null, "nav_agent missing!")
assert(animation_tree != null, "animation_tree missing!")
assert(visibility_notifier != null, "visibility_notifier missing!")