From 19207e7f72efc2477207fde99db87c49fd1a103d Mon Sep 17 00:00:00 2001 From: JonShard Date: Thu, 30 Jul 2026 11:29:28 +0200 Subject: [PATCH] Add Table handles meals served before order taken --- Scenes/JonScene.tscn | 7 +++++-- Stations/table.gd | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Scenes/JonScene.tscn b/Scenes/JonScene.tscn index 5eab24d..f73010f 100644 --- a/Scenes/JonScene.tscn +++ b/Scenes/JonScene.tscn @@ -100,11 +100,14 @@ primary_duration = 35.0 [node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_ctden")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.35077858, 0.50655985, -1.2833805) +[node name="Hob2" parent="." unique_id=1368146287 instance=ExtResource("4_ctden")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.24922144, 0.50655985, -1.2833805) + [node name="Sink" parent="." unique_id=2055277359 instance=ExtResource("13_o1b3t")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.24685252, 0.51461196, -1.2828919) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.84685254, 0.51461196, -1.2828919) [node name="DirtStation" parent="." unique_id=160842153 instance=ExtResource("14_irf4n")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.7978771, 0.50655985, -1.2598276) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3978771, 0.50655985, -1.2598276) [node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("15_di04w")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.94890714, 0.5115015, -1.3041471) diff --git a/Stations/table.gd b/Stations/table.gd index 435ae36..747a2e5 100644 --- a/Stations/table.gd +++ b/Stations/table.gd @@ -104,6 +104,9 @@ func _get_plate_from_item(_item: Node) -> PlateController: func _absorb_item_if_correct(_item: Node) -> void: + if not _item: + return + # Get plate controller in childer of _item (hopefully a plate XRpickable) var plate_controller = _get_plate_from_item(_item) if not plate_controller: @@ -174,24 +177,32 @@ func _setState(newState: TableState) -> void: _state_time = 5.0 _state_duration = 5.0 customers.visible = false + _state = newState TableState.THINKING: _state_time = thinking_duration _state_duration = thinking_duration # Can't be done in _set_state(), will set duration inside timer + _state = newState TableState.ORDERING: _state_time = ordering_duration _state_duration = ordering_duration + _state = newState TableState.WAITING_PRIMARY: _state_time = primary_duration _state_duration = primary_duration + _state = newState + # Absorm meals that were already in the table when the state starts + for zone in snap_zones: + _absorb_item_if_correct(zone.picked_up_object) TableState.WAITING_FRIEND: _state_time = friend_duration _state_duration = friend_duration + _state = newState TableState.EATING: _state_time = eating_duration _state_duration = eating_duration _set_snap_zones_enabled(false) + _state = newState - _state = newState # When state timer is finished, do this stuff before moving to next state