TowerGame/scripts/buildings/storage.gd

13 lines
312 B
GDScript3
Raw Normal View History

extends Building
var held_item: Item = null
func _process(delta: float) -> void:
super(delta)
if is_functional():
if !producer.consumers.is_empty() and held_item == null:
held_item = consumer.take_any_item_from_storage()
if held_item != null and producer.send_item(held_item):
held_item = null