table fix

This commit is contained in:
algodoogle
2026-08-11 15:22:42 +01:00
parent 4f8c96d089
commit 88dcfbafdf
2 changed files with 24 additions and 3 deletions
+11 -2
View File
@@ -132,7 +132,13 @@ func _ready() -> void:
for snap_zone_node in snap_zones:
snap_zone_node.has_picked_up.connect(_on_object_picked_up)
snap_zone_node.has_dropped.connect(_on_object_dropped)
set_process(true)
# Never on a client: the state machine is server-authoritative and _state is
# synced down. NetworkManager._gate_station() already turned processing off,
# but a spawned station is gated BEFORE its _ready() runs, so an unconditional
# set_process(true) here would quietly re-arm the FSM on every client — and
# _state_end(EATING) re-enables the snap zones, which then fight the server
# for items sitting on the table.
set_process(NetworkManager.owns_world())
_set_state(TableState.EMPTY)
@@ -258,8 +264,11 @@ func _collect_money_from_food():
func _set_snap_zones_enabled(value: bool) -> void:
# Enabling is the world owner's call only — a client's zones stay gated no
# matter what state its copy of the FSM thinks it is in.
var enabled := value and NetworkManager.owns_world()
for zone in snap_zones:
zone.enabled = value
zone.enabled = enabled
## Server-only state transition: sets the new state's timer and assigns