2024-04-15 22:04:55 +00:00
|
|
|
@icon("res://behaviours/edible.svg")
|
2024-04-13 21:43:19 +00:00
|
|
|
extends Node
|
|
|
|
class_name Edible
|
|
|
|
|
2024-04-15 20:43:26 +00:00
|
|
|
## Emits [signal eaten] when eaten by an [Eater] whose acceptable diets contain this node's [field diet].
|
|
|
|
##
|
|
|
|
## To add multiple possible [Edible] diets to an entity, add multiple [Edible] nodes to it.
|
2024-04-13 21:43:19 +00:00
|
|
|
|
2024-04-14 23:23:06 +00:00
|
|
|
signal eaten
|
|
|
|
|
|
|
|
|
2024-04-15 20:43:26 +00:00
|
|
|
@export var diet: StringName = &""
|
2024-04-13 22:23:33 +00:00
|
|
|
|
|
|
|
|
2024-04-15 20:43:26 +00:00
|
|
|
func eat():
|
|
|
|
eaten.emit()
|
2024-04-15 22:16:57 +00:00
|
|
|
|
|
|
|
func _on_eaten() -> void:
|
|
|
|
Log.p(self, "Got eaten.")
|