Fix client calling place_order multiple times

This commit is contained in:
JonShard
2026-08-17 15:28:13 +02:00
parent 4f9e22f0b9
commit d895bc0a47
2 changed files with 5 additions and 11 deletions
+2 -8
View File
@@ -208,6 +208,8 @@ func _on_object_dropped(_item) -> void:
func _on_player_enter(_body):
_players_count += 1
SweetLogger.debug("Player enter, players_count: {0}", [_players_count])
if _is_leader and _state == TableState.ORDERING:
place_order()
func _on_player_exit(_body):
@@ -215,13 +217,6 @@ func _on_player_exit(_body):
SweetLogger.debug("Player exit, players_count: {0}", [_players_count])
func _place_order_if_player():
if _state != TableState.ORDERING:
return
if _players_count > 0:
place_order()
func _get_plate_controller_from_item(_item: Node) -> PlateController:
if not _item:
SweetLogger.debug("Item is null")
@@ -418,7 +413,6 @@ func _process(delta: float) -> void:
_refresh_display()
if not _is_leader:
return # Follower: the group leader orchestrates the FSM, we just mirror its synced state.
_place_order_if_player()
if not NetworkManager.owns_world():
# SweetLogger.debug("Not server, skipping state update")
+2 -2
View File
@@ -98,7 +98,7 @@ const TIMESTAMP_BG_COLOR = "#1e3a5f"
#===================================================================================#
## Column widths for alignment (in characters)
const PEER_ID_COLUMN_WIDTH = 6
const LOG_TYPE_COLUMN_WIDTH = 13
const LOG_TYPE_COLUMN_WIDTH = 10
## Default mm:ss:ms; with SHOW_TIMESTAMP_HOURS, hh:mm:ss:ms
const TIMESTAMP_COLUMN_WIDTH_MMSSMS = 9
const TIMESTAMP_COLUMN_WIDTH_HHMMSSMS = 12
@@ -229,7 +229,7 @@ func _print_rich_log(peer_id_str: String, log_type: String, message: String, scr
var peer_padded = _truncate_text(_pad_text(peer_label, PEER_ID_COLUMN_WIDTH), TRUNCATE_PEER_NAME)
# Format peer ID with its background color
var peer_formatted = _format_rich_text(peer_padded + " ", peer_color.bg_color, peer_color.text_color)
var peer_formatted = _format_rich_text(" " + peer_padded, peer_color.bg_color, peer_color.text_color)
# Format log type with its background color
var log_type_padded = _pad_text(log_type_label, LOG_TYPE_COLUMN_WIDTH)