Fix plates not syncing dirty

This commit is contained in:
JonShard
2026-08-20 09:23:25 +02:00
parent 62ea4a1540
commit 06dde91468
4 changed files with 17 additions and 16 deletions
+17 -13
View File
@@ -4,26 +4,30 @@ extends Node
@onready var dirty_node: Node3D = $"../Dirty"
@onready var container: ItemContainer = $"../Container"
@export var is_dirty: bool = false
## Synced summary of the plate's contents (item ids). The contents themselves
## are the real item nodes ItemContainer reparents under the plate; this is only
## what other systems read to ask "what is on this plate" without walking them.
@export var contained_ids: Array[String] = []
@export var is_dirty: bool = false:
get:
return is_dirty
set(value):
if NetworkManager.owns_world():
clients_set_dirty.rpc(value)
is_dirty = value
container.enabled = not value
dirty_node.visible = value
SweetLogger.info("Set plate dirty: {0}", [value])
@rpc("authority", "call_remote", "reliable")
func clients_set_dirty(value: bool) -> void:
is_dirty = value
func get_food_items() -> Array[FoodItem]:
return container.contained_items
func _ready() -> void:
if not dirty_node:
SweetLogger.warning("{0} missing dirty_node reference", [name])
dirty_node.visible = is_dirty
func _process(_delta: float) -> void:
if is_dirty:
container.enabled = false
dirty_node.visible = true
else:
container.enabled = true
dirty_node.visible = false
SweetLogger.warning("{0} missing dirty_node reference", [name])
-2
View File
@@ -179,8 +179,6 @@ func apply_held_state() -> void:
and _pickable.collision_mask == 0 \
and _pickable.enabled == want_enabled:
return
if NetworkManager.is_online(): # This was spamming that Knife was frozen every frame.
SweetLogger.debug("{0}: freezing (non-authority, owner=peer {1})", [_pickable.name, net_held_by])
_pickable.freeze = true
_pickable.freeze_mode = RigidBody3D.FREEZE_MODE_KINEMATIC
_pickable.collision_mask = 0
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
uid://be8o8m6xpp3kc