Refactor food items to use shared inherited scene.

This commit is contained in:
JonShard
2026-08-16 10:31:39 +02:00
parent f0bb044d12
commit 1a7f641974
14 changed files with 259 additions and 519 deletions
+5 -2
View File
@@ -25,13 +25,16 @@ func _set_stations_enabled(value: bool) -> void:
station.enabled = value
# Despawn all food_items unless it's in a "persistent_inventory" snap_zone
# Despawn all despawnable pickables unless it's in a "persistent_inventory"
# snap_zone. Permanent fixtures (e.g. a station's knife) opt out entirely by
# having no DespawningItem child, or a disabled one.
func despawn_unheld_pickables():
var root = get_tree().get_root()
var pickables: Array[Node] = []
_collect_pickables(root, pickables)
for pickable in pickables:
if not Helper.find_food_item(pickable):
var despawning_item := pickable.get_node_or_null("DespawningItem") as DespawningItem
if not despawning_item or not despawning_item.enabled:
continue
var held_by: Node = pickable.get_picked_up_by()
if not held_by: