2 Commits

Author SHA1 Message Date
JonShard d5c162a51a Fix all tables consumed the same customer. 2026-08-06 18:49:57 +02:00
JonShard 1cf3afd440 Add DayController and QueueController to handle spawning of customer through out a day 2026-08-06 14:51:49 +02:00
19 changed files with 276 additions and 58 deletions
+25 -22
View File
@@ -13,31 +13,31 @@
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1fmci"]
animation = &"Grip"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_73fu8"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_itrmp"]
animation = &"Grip"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ouruy"]
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_nrfrd"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_i0gvw"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_73fu8"]
animation = &"Grip 5"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_5mmou"]
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_ouruy"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_yfij0"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_i0gvw"]
graph_offset = Vector2(-536, 11)
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_1fmci")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_73fu8")
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_itrmp")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_ouruy")
nodes/Grip/node = SubResource("AnimationNodeBlend2_nrfrd")
nodes/Grip/position = Vector2(0, 20)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_i0gvw")
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_73fu8")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_5mmou")
nodes/Trigger/node = SubResource("AnimationNodeBlend2_ouruy")
nodes/Trigger/position = Vector2(-360, 20)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
@@ -45,33 +45,34 @@ node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &
transparency = 1
albedo_color = Color(1, 1, 1, 0.5882353)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_itrmp"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_5mmou"]
animation = &"Grip"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_nrfrd"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yfij0"]
animation = &"Grip"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_73fu8"]
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_2ebvs"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ouruy"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_l8v2a"]
animation = &"Grip 5"
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_i0gvw"]
[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_qpjda"]
filter_enabled = true
filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"]
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_5mmou"]
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_itrmp")
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_37hbl"]
graph_offset = Vector2(-552.664, 107.301)
nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_5mmou")
nodes/ClosedHand1/position = Vector2(-600, 300)
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_nrfrd")
nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_yfij0")
nodes/ClosedHand2/position = Vector2(-360, 300)
nodes/Grip/node = SubResource("AnimationNodeBlend2_73fu8")
nodes/Grip/node = SubResource("AnimationNodeBlend2_2ebvs")
nodes/Grip/position = Vector2(0, 40)
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_ouruy")
nodes/OpenHand/node = SubResource("AnimationNodeAnimation_l8v2a")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("AnimationNodeBlend2_i0gvw")
nodes/Trigger/node = SubResource("AnimationNodeBlend2_qpjda")
nodes/Trigger/position = Vector2(-360, 40)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
@@ -119,13 +120,14 @@ bone_idx = 9
[node name="Poke" parent="XRControllerLeftHand/LeftHand/Hand_low_L/Armature/Skeleton3D/BoneAttachment3D" unique_id=259928841 instance=ExtResource("7_1fmci")]
[node name="AnimationTree" parent="XRControllerLeftHand/LeftHand" index="1"]
tree_root = SubResource("AnimationNodeBlendTree_yfij0")
tree_root = SubResource("AnimationNodeBlendTree_i0gvw")
[node name="MovementDirect" parent="XRControllerLeftHand" unique_id=1865515938 instance=ExtResource("2_q1xvu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.009340696, -0.0074635968, 0.024033919)
strafe = true
[node name="FunctionPickup" parent="XRControllerLeftHand" unique_id=2133415351 instance=ExtResource("3_rd8py")]
grab_collision_mask = 327748
[node name="FunctionPointer" parent="XRControllerLeftHand" unique_id=315304316 instance=ExtResource("6_ptr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0.05, -0.1)
@@ -179,7 +181,7 @@ bone_idx = 9
[node name="Poke" parent="XRControllerRightHand/RightHand/Hand_low_R/Armature/Skeleton3D/BoneAttachment3D" unique_id=303927399 instance=ExtResource("7_1fmci")]
[node name="AnimationTree" parent="XRControllerRightHand/RightHand" index="1"]
tree_root = SubResource("AnimationNodeBlendTree_5mmou")
tree_root = SubResource("AnimationNodeBlendTree_37hbl")
[node name="MovementTurn" parent="XRControllerRightHand" unique_id=154529119 instance=ExtResource("4_rd8py")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0074635968, 0.024033919)
@@ -187,6 +189,7 @@ turn_mode = 2
smooth_turn_speed = 3.5
[node name="FunctionPickup" parent="XRControllerRightHand" unique_id=1876210450 instance=ExtResource("3_rd8py")]
grab_collision_mask = 327748
[node name="FunctionPointer" parent="XRControllerRightHand" unique_id=2017919314 instance=ExtResource("6_ptr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, 0.05, -0.1)
-1
View File
@@ -25,7 +25,6 @@ func despawn_unheld_pickables():
NetworkManager.despawn_item(pickable)
continue
if not held_by.is_in_group("persistent_inventory"):
held_by.get_parent().print_tree_pretty()
print("BuildModeController despawn_unheld_pickables held_by: %s, pickable: %s " % [held_by, pickable])
NetworkManager.despawn_item(pickable)
+6
View File
@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://bnwb7imcotkod"]
[ext_resource type="Script" uid="uid://bsdpd18i1i17s" path="res://prefabs/build_mode_controller.gd" id="1_7i0c4"]
[node name="BuildModeController" type="Node" unique_id=552013109]
script = ExtResource("1_7i0c4")
+6
View File
@@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://dm70ynyuw1a5u"]
[ext_resource type="Script" uid="uid://bbr5arulbeuvq" path="res://scenes/day_controller.gd" id="1_lna8j"]
[node name="DayController" type="Node" unique_id=1418639156]
script = ExtResource("1_lna8j")
+58
View File
@@ -0,0 +1,58 @@
class_name DayController
extends Node
# DayController Emits singals to spawn customers.
var day_time_remaining: float = 0.0
var customers_spawned: int = 0
var customers_served: int = 0
func _ready() -> void:
GameManager.game_state = GameManager.GameState.BUILDING
Signals.game_state_changed.connect(_on_game_state_changed)
func _on_game_state_changed(new_state: GameManager.GameState) -> void:
if new_state == GameManager.GameState.RUNNING:
start_next_day()
# Returns 0-1 progress of the day time
func get_day_progression() -> float:
return 1 - (day_time_remaining / GameManager.day_length_seconds)
func _reset_values() -> void:
day_time_remaining = GameManager.day_length_seconds
customers_spawned = 0
customers_served = 0
func start_next_day() -> void:
print("DayController: start_next_day")
_reset_values()
GameManager.customers_per_day += GameManager.customers_count_increase_per_day
GameManager.day_number += 1
func finish_current_day() -> void:
print("DayController: finish_current_day")
_reset_values()
func _process(delta: float) -> void:
if GameManager.game_state != GameManager.GameState.RUNNING:
return
day_time_remaining -= delta
var customers_at_this_time = GameManager.customers_per_day * get_day_progression()
#print("DayController: customers_at_this_time: ", customers_at_this_time)
if customers_spawned < customers_at_this_time:
customers_spawned += 1
print("DayController: spawning customer")
Signals.request_customer_spawn.emit()
# If day complete
if GameManager.customers_per_day == customers_served and customers_spawned == GameManager.customers_per_day:
print("DayController: Day complete")
finish_current_day()
+1
View File
@@ -0,0 +1 @@
uid://bbr5arulbeuvq
+63
View File
@@ -0,0 +1,63 @@
class_name QueueController
extends Node3D
@export var queue_patience: float = 120
@export var progress_bar_3d: ProgressBar3D
@export var label_3d: Label3D
var _customers: Array[float] = [] # Temp. Array of their patience
var _tables: Array[Node3D] = []
func _ready() -> void:
progress_bar_3d.override_fill_color(Color.YELLOW)
progress_bar_3d.exponential = true
Signals.request_customer_spawn.connect(_on_request_customer_spawn)
Signals.game_state_changed.connect(_on_game_state_changed)
func _on_game_state_changed(new_state: GameManager.GameState) -> void:
if new_state == GameManager.GameState.RUNNING:
_rebuild_table_list()
func _on_request_customer_spawn() -> void:
spawn_customer()
func spawn_customer() -> void:
_customers.append(queue_patience)
func _rebuild_table_list() -> void:
_tables.clear()
_tables.append_array(get_tree().get_nodes_in_group("table"))
print("QueueController _rebuild_table_list complete: ", _tables)
func _try_to_assign_customers() -> void:
for customer in _customers:
for table: Table in _tables:
var result: bool = table.try_consume_customer()
if result == true:
_customers.pop_front()
break
func _process(delta: float) -> void:
# Process customers patience
for i in range(0, _customers.size()):
_customers[i] -= delta
if _customers[i] <= 0:
GameManager.game_over()
_try_to_assign_customers()
# Update visuals
if not _customers.is_empty():
label_3d.text = "Customers in queue: " + str(_customers.size())
progress_bar_3d.set_progress(_customers.front() / queue_patience)
else:
progress_bar_3d.set_progress(0)
label_3d.text = "No Customers"
+1
View File
@@ -0,0 +1 @@
uid://dww2icfivdsai
+38 -21
View File
@@ -6,15 +6,17 @@
[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://textures/dev_material_3d.tres" id="4_kpgm6"]
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://stations/Hob.tscn" id="5_gfdi7"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://stations/Counter.tscn" id="7_jnxsa"]
[ext_resource type="PackedScene" uid="uid://drwuhqb3pjtiy" path="res://items/potato.tscn" id="8_1qeqw"]
[ext_resource type="PackedScene" uid="uid://dlw5geheupgpt" path="res://stations/hatch.tscn" id="8_atgwk"]
[ext_resource type="Script" uid="uid://bsdpd18i1i17s" path="res://prefabs/build_mode_controller.gd" id="9_atgwk"]
[ext_resource type="PackedScene" uid="uid://dvrk268s7gkxh" path="res://stations/sink.tscn" id="10_dhas4"]
[ext_resource type="PackedScene" uid="uid://bnwb7imcotkod" path="res://prefabs/build_mode_controller.tscn" id="9_hooyg"]
[ext_resource type="PackedScene" uid="uid://caf0xanmxbshy" path="res://stations/table.tscn" id="11_gaw43"]
[ext_resource type="PackedScene" uid="uid://cwnwo4i28upap" path="res://stations/raw_burger_dispenser.tscn" id="12_hooyg"]
[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="12_n58f2"]
[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://stations/BurgerBunsDispenser.tscn" id="13_cqmpj"]
[ext_resource type="PackedScene" uid="uid://xtcei2uvd5li" path="res://UI/game_over_panel.tscn" id="13_hooyg"]
[ext_resource type="PackedScene" uid="uid://ck5tuftqmyiue" path="res://stations/plate_dispenser.tscn" id="14_bjwcu"]
[ext_resource type="Script" uid="uid://cwijoksyou1ey" path="res://prefabs/GameOvercontroler.gd" id="14_cqmpj"]
[ext_resource type="PackedScene" uid="uid://sc6i0i1f0o48" path="res://stations/potato_dispenser.tscn" id="15_hooyg"]
[ext_resource type="Script" uid="uid://dww2icfivdsai" path="res://scenes/queue_controller.gd" id="15_cqmpj"]
[ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="15_hooyg"]
[ext_resource type="PackedScene" uid="uid://dm70ynyuw1a5u" path="res://prefabs/day_controller.tscn" id="17_bjwcu"]
[sub_resource type="Environment" id="Environment_bvwq1"]
background_mode = 2
@@ -97,24 +99,17 @@ shape = SubResource("BoxShape3D_24d3s")
[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("7_jnxsa")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.6, 0, 0)
[node name="Potato" parent="." unique_id=962444046 instance=ExtResource("8_1qeqw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.273382, 1.5940565, -0.036002517)
[node name="Hatch" parent="." unique_id=1341321603 instance=ExtResource("8_atgwk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0, 0)
[node name="Hatch2" parent="." unique_id=1755144529 instance=ExtResource("8_atgwk")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0)
[node name="BuildModeController" type="Node" parent="." unique_id=1876729190]
script = ExtResource("9_atgwk")
[node name="Sink" parent="." unique_id=1559059799 instance=ExtResource("10_dhas4")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.2, 0, 0)
[node name="BuildModeController" parent="." unique_id=552013109 instance=ExtResource("9_hooyg")]
[node name="Table" parent="." unique_id=1863572470 instance=ExtResource("11_gaw43")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 1.8)
[node name="Table2" parent="." unique_id=987495548 instance=ExtResource("11_gaw43")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 2.4)
[node name="Table3" parent="." unique_id=113648557 instance=ExtResource("11_gaw43")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8, 0, 3)
[node name="GameOverPanel" parent="." unique_id=522901881 instance=ExtResource("12_n58f2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 2.7718225, 2.8122003, 1.8000003)
scene = ExtResource("13_hooyg")
@@ -126,5 +121,27 @@ scene_properties_keys = PackedStringArray("game_over_panel.gd")
[node name="controler" type="Node" parent="GameOverPanel" unique_id=1442195864]
script = ExtResource("14_cqmpj")
[node name="PotatoDispenser" parent="." unique_id=1410160280 instance=ExtResource("15_hooyg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8000002, 0, 0)
[node name="RawBurgerDispenser" parent="." unique_id=383615587 instance=ExtResource("12_hooyg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6, 0, 0)
[node name="BurgerBunsDispenser" parent="." unique_id=1410160280 instance=ExtResource("13_cqmpj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2, 0, 0)
[node name="PlateDispenser" parent="." unique_id=53391541 instance=ExtResource("14_bjwcu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8000001, 0, 0.6)
[node name="QueueController" type="Node3D" parent="." unique_id=1490726434 node_paths=PackedStringArray("progress_bar_3d", "label_3d")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -1.2, 0, 4.8)
script = ExtResource("15_cqmpj")
progress_bar_3d = NodePath("ProgressBar3D")
label_3d = NodePath("Label3D")
[node name="ProgressBar3D" parent="QueueController" unique_id=654673176 instance=ExtResource("15_hooyg")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2.4, 0)
exponential = true
[node name="Label3D" type="Label3D" parent="QueueController" unique_id=1060766769]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.147749, 0)
text = "X customers in queue"
[node name="DayController" parent="." unique_id=1418639156 instance=ExtResource("17_bjwcu")]
+1
View File
@@ -74,6 +74,7 @@ mass = 0.004
gravity_scale = 0.5
linear_damp = 100.0
script = ExtResource("2_tbkb3")
picked_up_layer = 64
release_mode = 1
[node name="CollisionShape3D" type="CollisionShape3D" parent="MoveHandle" unique_id=1692047616]
+19 -7
View File
@@ -22,7 +22,6 @@ const lbl_gameover: String = "Game Over!"
const lbl_eating: String = "Eating..."
### Finite State Machine ####
enum TableState {
IDLE, # Don't update table. incorrect GameState
EMPTY, # Just finished eating or havent eaten yet
@@ -50,10 +49,11 @@ var _players_count: int = 0
func place_order() -> void:
print("Table place_order()")
var new_orders: Array[String] = _unsatisfied_orders.duplicate()
for _i in range(0, randi_range(1, 2)):
new_orders.append(GameManager.get_random_meal())
for _i in range(0, randi_range(0, 1)):
new_orders.append(GameManager.get_random_side())
# for _i in range(0, randi_range(1, 2)):
# new_orders.append(GameManager.get_random_meal())
# for _i in range(0, randi_range(0, 1)):
# new_orders.append(GameManager.get_random_side())
new_orders.append(GameManager.get_random_meal())
_unsatisfied_orders = new_orders
_original_orders = _unsatisfied_orders.duplicate()
@@ -95,6 +95,14 @@ func clearAllFood() -> void:
NetworkManager.despawn_item(held_object)
# Group called from Queue when trying to assign customers to tables
func try_consume_customer() -> bool:
if _state == TableState.EMPTY:
print("Table try_consume_customer, consumed a customer")
_state_end(TableState.EMPTY)
return true
return false
func _ready() -> void:
if not label_3d:
@@ -266,8 +274,6 @@ func _set_state(newState: TableState) -> void:
_state = newState
customers.visible = false
TableState.EMPTY:
_state_time = randf_range(3, 7)
_state_duration = _state_time
customers.visible = false
_state = newState
TableState.THINKING:
@@ -364,6 +370,8 @@ func _refresh_display() -> void:
func _process(delta: float) -> void:
_refresh_display()
if GameManager.game_state == GameManager.GameState.GAME_OVER:
return
_place_order_if_player()
# If build mode, set, exit loop, be idle
@@ -378,6 +386,10 @@ func _process(delta: float) -> void:
elif _state == TableState.IDLE:
return
# No counting down if wer're empty
if _state == TableState.EMPTY:
return
# Wait for state to finish
if _state_time > 0.0:
_state_time = max(0.0, _state_time - delta)
+2
View File
@@ -141,6 +141,7 @@ size = Vector3(0.05, 0.6713196, 0.05)
[node name="Label3D" type="Label3D" parent="Table" unique_id=662960977]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.8263302, 0)
pixel_size = 0.003
billboard = 2
text = "table state"
vertical_alignment = 0
@@ -148,6 +149,7 @@ line_spacing = -15.0
[node name="Label3DTime" type="Label3D" parent="Table" unique_id=1534849507]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.0147986, 0)
visible = false
pixel_size = 0.003
billboard = 2
text = "20.1s"
+2 -2
View File
@@ -59,9 +59,10 @@ offset_left = 20.0
offset_top = 80.0
offset_right = -20.0
offset_bottom = -20.0
current_tab = 0
current_tab = 1
[node name="Stations" type="GridContainer" parent="TabContainer" unique_id=189446761]
visible = false
layout_mode = 2
columns = 6
metadata/_tab_index = 0
@@ -102,7 +103,6 @@ station_name = "Plates"
cost = 80
[node name="Food" type="GridContainer" parent="TabContainer" unique_id=422899445]
visible = false
layout_mode = 2
columns = 6
metadata/_tab_index = 1
+21
View File
@@ -58,7 +58,28 @@ Shared INventory
list
## Customer design
- A customer is a simple goto point object. has queue_patience float
- A customer is spawned in street, told to move to QueueController Area
- A QueueController tracks the entered customer and tells it to take a queue position
- A QueueController displays a progress bar above door of queue_patience of the customer in the Area3D with the least patience.
- On new table available, QueueController tells front customer in queue to sit at table
## Modifiers
- Disposable plates. no washing. much less money
## Weird ideas
- carry 4 plates. A snapzone on forearm that only accept plate, and drops it if tilted too much. Real waiter feel.
## Research
- Reasearch is its own currency.
- You unlock items in shop with reseach points. Then you can buy them. You "buy" the same tile twice.
+12 -1
View File
@@ -1,17 +1,28 @@
class_name GameManager
extends Node
const STAR_DAY_FREQUENCY: int = 3
static var money: int = 1000
static var day_number: int = 1
static var meals_in_play: Array[String]
static var sides_in_play: Array[String]
# GameConfig - difficulty settings
static var day_length_seconds: float = 60.0
static var customers_per_day: float = 5.0
static var customers_count_increase_per_day: float = 1.0
static var group_min_size: int = 1
static var group_max_size: int = 2
enum GameState {
RUNNING,
GAME_OVER,
BUILDING
}
static var game_state: GameState = GameState.RUNNING: set = _set_game_state
static var game_state: GameState = GameState.BUILDING: set = _set_game_state
static func _set_game_state(value: GameState):
game_state = value
+1
View File
@@ -4,3 +4,4 @@ signal game_over
signal restart_game
signal game_state_changed(new_state: GameManager.GameState)
signal station_bought(instance: Node3D)
signal request_customer_spawn()
+18 -2
View File
@@ -22,14 +22,16 @@
"uuid": "211e4050-31cd-4425-a2ba-8ca56b4764cd",
"title": "Todo",
"tasks": [
"55ac73b8-4378-4b58-bf3c-33f64590c804"
"55ac73b8-4378-4b58-bf3c-33f64590c804",
"dcdef6be-39f9-44b3-a892-b74afe880909"
]
},
{
"uuid": "fab8a81b-7ca9-4026-96bb-ed66ea58ef2e",
"title": "Doing",
"tasks": [
"f8073eb2-8786-47b7-b63f-fa70c3f7115a"
"f8073eb2-8786-47b7-b63f-fa70c3f7115a",
"ba3c1f0c-1d34-431a-9e42-f80f8d8159a4"
]
},
{
@@ -274,6 +276,20 @@
"description": "",
"category": "bf4ec62e-526e-4027-876f-0b22bd17f79a",
"steps": []
},
{
"uuid": "ba3c1f0c-1d34-431a-9e42-f80f8d8159a4",
"title": "QueueController",
"description": "- A customer is a simple goto point object. has queue_patience float\n- A customer is spawned in street, told to move to QueueController Area\n- A QueueController tracks the entered customer and tells it to take a queue position \n- A QueueController displays a progress bar above door of queue_patience of the customer in the Area3D with the least patience.\n- On new table available, QueueController tells front customer in queue to sit at table\n\n",
"category": "bf4ec62e-526e-4027-876f-0b22bd17f79a",
"steps": []
},
{
"uuid": "dcdef6be-39f9-44b3-a892-b74afe880909",
"title": "Customer Pathfinder",
"description": "- A customer is a simple goto point object. has queue_patience float\n- A customer is spawned in street, told to move to QueueController Area\n- A QueueController tracks the entered customer and tells it to take a queue position \n- A QueueController displays a progress bar above door of queue_patience of the customer in the Area3D with the least patience.\n- On new table available, QueueController tells front customer in queue to sit at table\n\n",
"category": "bf4ec62e-526e-4027-876f-0b22bd17f79a",
"steps": []
}
],
"layout": {
+1
View File
@@ -85,6 +85,7 @@ set_game_over={
3d_physics/layer_3="Pickable Objects"
3d_physics/layer_4="Wall Walking"
3d_physics/layer_5="Grappling Target"
3d_physics/layer_7="Movement Handle"
3d_physics/layer_17="Held Objects"
3d_physics/layer_18="Player Hands"
3d_physics/layer_19="Grab Handles"
-1
View File
@@ -1 +0,0 @@
uid://be8o8m6xpp3kc