1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-23 00:24:21 +00:00
hella-farm/behaviours/edible_tracker.gd

17 lines
408 B
GDScript3
Raw Normal View History

2024-04-15 22:20:21 +00:00
@icon("res://behaviours/edible_tracker.svg")
2024-04-16 00:47:31 +00:00
extends Tracker
2024-04-15 22:20:21 +00:00
class_name EdibleTracker
## Keeps track of what [Edible]s are inside the area.
@export var acceptable_diets: Array[StringName] = []
2024-04-16 00:47:31 +00:00
func check_diet_then_track(body: Node2D) -> void:
2024-04-15 22:20:21 +00:00
var edibles: Array = body.find_children("Edible", "Edible", false, false)
for edible in edibles:
if edible.tag in acceptable_diets:
2024-04-16 00:47:31 +00:00
track(body)
break