Add thrown plates absorb food on station

This commit is contained in:
JonShard
2026-07-28 09:22:03 +02:00
parent 29083a4250
commit bbf982c2f6
6 changed files with 21 additions and 13 deletions
+9 -3
View File
@@ -36,10 +36,15 @@ func _on_body_entered(body: Node3D) -> void:
if not body.is_in_group(target_group):
return
print("Container _on_body_entered body: ", body)
var picked_by = xr_pickable.get_picked_up_by()
if picked_by and picked_by.is_in_group("station"):
# If compatible and enough space, add item
# If one of us is in a station
var picked_by = xr_pickable.get_picked_up_by()
var body_pickable = body as XRToolsPickable
var body_picked_by = body_pickable.get_picked_up_by() if body_pickable else null
if (picked_by and picked_by.is_in_group("station")) or (body_picked_by and body_picked_by.is_in_group("station")):
# If enough space, add item
var food_item = body.get_node("FoodItem")
print("Container in station found %s of type %s: %s" % [target_group, FoodItem.Type.keys()[food_item.type], body.name])
var meal_count := contained_items.filter(func(f): return f.type == FoodItem.Type.MEAL).size()
@@ -52,6 +57,7 @@ func _on_body_entered(body: Node3D) -> void:
_add_item(body)
# Contents are synced as data (ids on the plate's PlateController), not
# reparented nodes: reparenting a MultiplayerSpawner-tracked item out of
# WorldContent would despawn it on every client the instant it happened.