3 Commits

Author SHA1 Message Date
JonShard b7775e9de6 Add progress bar to Table 2026-07-27 13:32:04 +02:00
JonShard 01587e3b9c Add progress bar to Sink 2026-07-27 12:53:33 +02:00
JonShard f4b2e687b5 Add Progress bar to Hob 2026-07-27 10:16:44 +02:00
12 changed files with 218 additions and 70 deletions
+4 -4
View File
@@ -45,7 +45,7 @@ static func get_combination_result(first_id: StringName, second_id: StringName)
return get_item_scene(result_id) return get_item_scene(result_id)
static func get_cooking_result(ingredient_id: StringName) -> PackedScene: static func get_cooking_result(ingredient_id: StringName) -> String:
load_recipes() load_recipes()
for cooked_id in _cooking_map.keys(): for cooked_id in _cooking_map.keys():
var cook_defs = _cooking_map[cooked_id] var cook_defs = _cooking_map[cooked_id]
@@ -53,12 +53,12 @@ static func get_cooking_result(ingredient_id: StringName) -> PackedScene:
if typeof(cook_defs) == TYPE_ARRAY: if typeof(cook_defs) == TYPE_ARRAY:
for cook_def in cook_defs: for cook_def in cook_defs:
if cook_def["ingredient"] == ingredient_id: if cook_def["ingredient"] == ingredient_id:
return get_item_scene(cooked_id) return cooked_id
else: else:
var cook_def = cook_defs var cook_def = cook_defs
if cook_def["ingredient"] == ingredient_id: if cook_def["ingredient"] == ingredient_id:
return get_item_scene(cooked_id) return cooked_id
return null return ""
static func get_cooking_time(ingredient_id: StringName) -> float: static func get_cooking_time(ingredient_id: StringName) -> float:
+6 -3
View File
@@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_dlkho"] [ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_dlkho"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"] [sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
size = Vector3(1, 1, 1.0517578)
[sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"] [sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"]
radius = 0.3 radius = 0.3
@@ -15,7 +16,8 @@ albedo_color = Color(1.1759251, 0.741115, 0.5692133, 1)
[node name="Counter" type="StaticBody3D" unique_id=1487893288 groups=["station"]] [node name="Counter" type="StaticBody3D" unique_id=1487893288 groups=["station"]]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=692568688] [node name="CollisionShape3DCuttingBoard" type="CollisionShape3D" parent="." unique_id=706340473]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.025878906)
shape = SubResource("BoxShape3D_24d3s") shape = SubResource("BoxShape3D_24d3s")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272 groups=["station"]] [node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272 groups=["station"]]
@@ -31,6 +33,7 @@ transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_dlkho") shape = SubResource("SphereShape3D_dlkho")
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=451757283] [node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=451757283]
use_collision = true
[node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D" unique_id=305755330] [node name="CSGBox3D" type="CSGBox3D" parent="CSGCombiner3D" unique_id=305755330]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.045776367, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.045776367, 0)
@@ -64,8 +67,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.060837455, 0.12459713, 0.55
radius = 0.025492515 radius = 0.025492515
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D" unique_id=187377667] [node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D" unique_id=187377667]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.060742255, 0.4885016, 0.0011152327) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.060742255, 0.51602846, 0.0011152327)
size = Vector3(0.56365967, 0.092285156, 0.42160034) size = Vector3(0.56365967, 0.037231445, 0.42160034)
material = SubResource("StandardMaterial3D_vlqg6") material = SubResource("StandardMaterial3D_vlqg6")
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D6" unique_id=1146824846] [node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D6" unique_id=1146824846]
+9 -4
View File
@@ -2,8 +2,10 @@
[ext_resource type="Script" uid="uid://bsn8vhv5adxdo" path="res://Stations/hob.gd" id="1_7jc4g"] [ext_resource type="Script" uid="uid://bsn8vhv5adxdo" path="res://Stations/hob.gd" id="1_7jc4g"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="2_er1dp"] [ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="2_er1dp"]
[ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="3_7uuqv"]
[ext_resource type="Script" uid="uid://bv7oracwmgre8" path="res://UI/progress_bar_3d.gd" id="3_zz9kp"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"] [sub_resource type="BoxShape3D" id="BoxShape3D_kdxnr"]
[sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"] [sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"]
radius = 0.3 radius = 0.3
@@ -20,7 +22,7 @@ properties/1/replication_mode = 1
script = ExtResource("1_7jc4g") script = ExtResource("1_7jc4g")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1283846023] [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1283846023]
shape = SubResource("BoxShape3D_24d3s") shape = SubResource("BoxShape3D_kdxnr")
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=538157739] [node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=538157739]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0)
@@ -112,6 +114,9 @@ transform = Transform3D(0.94465846, 0, 0, 0, 0.94465846, 0, 0, 0, 0.94465846, -0
operation = 2 operation = 2
size = Vector3(0.9842529, 0.8349304, 0.072387695) size = Vector3(0.9842529, 0.8349304, 0.072387695)
[node name="Sync" type="MultiplayerSynchronizer" parent="."] [node name="Sync" type="MultiplayerSynchronizer" parent="." unique_id=768992259]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_hob") replication_config = SubResource("SceneReplicationConfig_np_hob")
[node name="ProgressBar3D" parent="." unique_id=654673176 instance=ExtResource("3_7uuqv")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.74736404, -0.09216304)
script = ExtResource("3_zz9kp")
+26 -5
View File
@@ -4,14 +4,29 @@ const RECIPE_MANAGER = preload("res://RecipeManager.gd")
@export var cook_speed = 1 @export var cook_speed = 1
@onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone @onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
var time_cooked = 0 var time_cooked = 0
var cooking_result = null var cooking_result: String
var cooking_result_time = 0 var cooking_result_time = 0
func _ready() -> void: func _ready() -> void:
if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Hob missing reference to progressbar, or wrong type:", progress_bar)
snap_zone.has_picked_up.connect(_on_object_picked_up) snap_zone.has_picked_up.connect(_on_object_picked_up)
snap_zone.has_dropped.connect(_on_object_dropped) snap_zone.has_dropped.connect(_on_object_dropped)
_refresh_progress_bar()
func _refresh_progress_bar() -> void:
var progress := 0.0
if cooking_result and cooking_result_time > 0:
progress = clampf(float(time_cooked) / cooking_result_time, 0.0, 1.0)
#print("time_cooked: %s / cooking_result_time: %s = progress: %s" % [time_cooked, cooking_result_time, progress])
progress_bar.set_progress(progress)
progress_bar.set_bar_visible(not cooking_result.is_empty())
progress_bar.override_fill_color(Color.RED if cooking_result == "charcoal" else Color.GREEN)
func _on_object_picked_up(_item) -> void: func _on_object_picked_up(_item) -> void:
print("Hob: object picked up: ", _item) print("Hob: object picked up: ", _item)
@@ -23,21 +38,24 @@ func _on_object_picked_up(_item) -> void:
return return
var result = RECIPE_MANAGER.get_cooking_result(_food_item.id) var result = RECIPE_MANAGER.get_cooking_result(_food_item.id)
if not result: if not result:
print("Hob: held a FoodItem that is not cookable, id: ", _food_item.id) print("Hob: held a FoodItem that is not cookable, id: %s result: %s" % [_food_item.id, result])
return return
cooking_result = result cooking_result = result
cooking_result_time = RECIPE_MANAGER.get_cooking_time(_food_item.id) cooking_result_time = RECIPE_MANAGER.get_cooking_time(_food_item.id)
print("Hob: set cooking_result ", cooking_result)
_refresh_progress_bar()
func _on_object_dropped() -> void: func _on_object_dropped() -> void:
print("Hob: object drop ") print("Hob: object drop ")
time_cooked = 0 time_cooked = 0
cooking_result = null cooking_result = ""
cooking_result_time = 0 cooking_result_time = 0
_refresh_progress_bar()
func convert_held_to_item(_item: PackedScene) -> void: func convert_held_to_item(_item: String) -> void:
if not NetworkManager.owns_world(): if not NetworkManager.owns_world():
return return
print("Hob converting ", _item) print("Hob converting ", _item)
@@ -50,7 +68,7 @@ func convert_held_to_item(_item: PackedScene) -> void:
# Spawn the new item through the server so it replicates to every peer # Spawn the new item through the server so it replicates to every peer
# (including late joiners), in the old item's position. # (including late joiners), in the old item's position.
var original_transform = old_pickable.global_transform var original_transform = old_pickable.global_transform
var new_scene_instance = NetworkManager.spawn_item(_item.resource_path, original_transform) var new_scene_instance = NetworkManager.spawn_item(RECIPE_MANAGER.get_item_scene(_item).resource_path, original_transform)
# Drop and free the old item and pick up the new one # Drop and free the old item and pick up the new one
print("Hob freeing old_pickable ", old_pickable) print("Hob freeing old_pickable ", old_pickable)
@@ -62,8 +80,11 @@ func convert_held_to_item(_item: PackedScene) -> void:
# If cooking something, progress cooking, when done, convert item # If cooking something, progress cooking, when done, convert item
func _process(delta: float) -> void: func _process(delta: float) -> void:
if cooking_result: if cooking_result:
#print("Hob cooking_result: ", cooking_result)
time_cooked += cook_speed * delta time_cooked += cook_speed * delta
_refresh_progress_bar()
if time_cooked >= cooking_result_time: if time_cooked >= cooking_result_time:
time_cooked = 0 time_cooked = 0
convert_held_to_item(cooking_result) convert_held_to_item(cooking_result)
+47 -28
View File
@@ -1,40 +1,59 @@
extends StaticBody3D extends StaticBody3D
const plate_wash_time: float = 3.0 const plate_wash_time: float = 3.0
@export var plate_scene : PackedScene
@export_range(0.0, 10.0, 0.1) var wash_speed: float = 1.0 @export_range(0.0, 10.0, 0.1) var wash_speed: float = 1.0
@onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone @onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
var progress: float = 0.0 var time_washed: float = 0.0
var is_washing: bool = false
var plate: PlateController = null
func _ready() -> void: func _ready() -> void:
if not plate_scene: if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Sink is missing reference to plate scene") push_error("Sink missing reference to progressbar, or wrong type:", progress_bar)
snap_zone.has_picked_up.connect(_on_object_picked_up)
snap_zone.has_dropped.connect(_on_object_dropped)
progress_bar.override_fill_color(Color.DODGER_BLUE)
_refresh_progress_bar()
func _refresh_progress_bar() -> void:
progress_bar.set_progress(clampf(float(time_washed) / plate_wash_time, 0.0, 1.0))
progress_bar.set_bar_visible(is_washing)
func _on_object_picked_up(_item) -> void:
print("Sink: object picked up: ", _item)
plate = _item.get_node_or_null("PlateController") as PlateController
if plate:
is_washing = plate.is_dirty
func _on_object_dropped() -> void:
print("Sink: object drop ")
_reset_sink()
func _reset_sink():
time_washed = 0
is_washing = false
plate = null
_refresh_progress_bar()
func complete_washing():
plate.is_dirty = false
_reset_sink()
print("Sink washing complete!")
func _process(delta: float) -> void: func _process(delta: float) -> void:
var item = snap_zone.picked_up_object if is_washing:
time_washed += wash_speed * delta
if not item: _refresh_progress_bar()
progress = 0 print("Sink washing plate: ", time_washed)
return # Exit early since there's nothing to process
var plate: PlateController = item.get_node_or_null("PlateController") as PlateController
if plate:
# Not dirty? Nothing to wash
if not plate.is_dirty:
return
# Washing logic using the encapsulated property
if progress >= plate_wash_time:
plate.is_dirty = false # This automatically updates visibility and the container state!
print("Sink washing complete!")
else:
progress += wash_speed * delta
print("Sink washing plate: ", progress)
# Sink empty, reset progress
if not snap_zone.picked_up_object:
progress = 0
if time_washed >= plate_wash_time:
complete_washing()
+6 -4
View File
@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://byh5j25mwt3oc" path="res://Stations/sink.gd" id="1_7hh4b"] [ext_resource type="Script" uid="uid://byh5j25mwt3oc" path="res://Stations/sink.gd" id="1_7hh4b"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="2_3ocod"] [ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="2_3ocod"]
[ext_resource type="PackedScene" uid="uid://bp3v1jl8pctro" path="res://Containers/plate.tscn" id="2_ai6d4"] [ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="4_1pinr"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"] [sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
@@ -16,7 +16,6 @@ properties/0/replication_mode = 1
[node name="Sink" type="StaticBody3D" unique_id=2055277359 groups=["station"]] [node name="Sink" type="StaticBody3D" unique_id=2055277359 groups=["station"]]
script = ExtResource("1_7hh4b") script = ExtResource("1_7hh4b")
plate_scene = ExtResource("2_ai6d4")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=964735164] [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=964735164]
shape = SubResource("BoxShape3D_24d3s") shape = SubResource("BoxShape3D_24d3s")
@@ -41,6 +40,7 @@ shape = SubResource("SphereShape3D_dlkho")
transform = Transform3D(1.1506689, 0, 0, 0, 2.334253, 0, 0, 0, 1, 0, 1.2831618, 0.06031096) transform = Transform3D(1.1506689, 0, 0, 0, 2.334253, 0, 0, 0, 1, 0, 1.2831618, 0.06031096)
operation = 2 operation = 2
radial_segments = 20 radial_segments = 20
smooth_faces = false
[node name="CSGTorus3D" type="CSGTorus3D" parent="CSGCombiner3D" unique_id=2055166617] [node name="CSGTorus3D" type="CSGTorus3D" parent="CSGCombiner3D" unique_id=2055166617]
transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 0.84928787, 0, 0.5107032, -0.20686007) transform = Transform3D(-4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0, 0.84928787, 0, 0.5107032, -0.20686007)
@@ -81,6 +81,8 @@ transform = Transform3D(1.3113414e-07, 0.12955962, 0.99157166, 8.8817837e-16, 0.
operation = 2 operation = 2
size = Vector3(1.4033203, 1.2053223, 0.352417) size = Vector3(1.4033203, 1.2053223, 0.352417)
[node name="Sync" type="MultiplayerSynchronizer" parent="."] [node name="Sync" type="MultiplayerSynchronizer" parent="." unique_id=1601242574]
root_path = NodePath("..")
replication_config = SubResource("SceneReplicationConfig_np_sink") replication_config = SubResource("SceneReplicationConfig_np_sink")
[node name="ProgressBar3D" parent="." unique_id=654673176 instance=ExtResource("4_1pinr")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8164611, -0.035980098)
+34 -15
View File
@@ -3,17 +3,17 @@ extends StaticBody3D
const GAME_MANAGER = preload("res://GameManager.gd") const GAME_MANAGER = preload("res://GameManager.gd")
@export var initial_thinking_time: float = 6 @export var thinking_duration: float = 6
@export var initial_primary_time: float = 60 @export var primary_duration: float = 23
@export var initial_friend_time: float = 10 @export var friend_duration: float = 10
@export var initial_eating_time: float = 4 @export var eating_duration: float = 4
@onready var label_3d: Label3D = $Label3D @onready var label_3d: Label3D = $Label3D
@onready var label_3d_time: Label3D = $Label3DTime @onready var label_3d_time: Label3D = $Label3DTime
@onready var snap_zones: Array[XRToolsSnapZone] = [] @onready var snap_zones: Array[XRToolsSnapZone] = []
@onready var progress_bar: ProgressBar3D = $ProgressBar3D
const lbl_thinking: String = "Thinking..." const lbl_thinking: String = "..."
const lbl_waiting_primary: String = "Waiting for food"
const lbl_gameover: String = "Game Over!" const lbl_gameover: String = "Game Over!"
const lbl_eating: String = "Eating..." const lbl_eating: String = "Eating..."
@@ -35,13 +35,18 @@ enum TableState {
## the same text. Use _setState(), never assign _state directly. ## the same text. Use _setState(), never assign _state directly.
var _state: TableState = TableState.EMPTY: set = _set_state var _state: TableState = TableState.EMPTY: set = _set_state
var _state_time: float = 0.0: set = _set_state_time var _state_time: float = 0.0: set = _set_state_time
var _state_duration: float = 0.0 # set in _set_state_time
var _unsatisfied_orders: Array[String] = []: set = _set_unsatisfied_orders var _unsatisfied_orders: Array[String] = []: set = _set_unsatisfied_orders
func _ready() -> void: func _ready() -> void:
if not label_3d: if not label_3d:
push_error("Table is missing reference to Label3D") push_error("Table is missing reference to Label3D")
if not label_3d_time: if not label_3d_time:
push_error("Table is missing reference to Label3DTime") push_error("Table is missing reference to Label3DTime")
if not progress_bar or progress_bar is not ProgressBar3D:
push_error("Hob missing reference to progressbar, or wrong type:", progress_bar)
progress_bar.y_billboard = true
# Get snap_zones for plates, store in array snap_zones # Get snap_zones for plates, store in array snap_zones
for child in get_children(): for child in get_children():
@@ -64,7 +69,6 @@ func _on_object_picked_up(_item) -> void:
_absorb_item_if_correct(_item) _absorb_item_if_correct(_item)
func _on_object_dropped() -> void: func _on_object_dropped() -> void:
print("Table: object dropped ") print("Table: object dropped ")
@@ -128,14 +132,19 @@ func _setState(newState: TableState) -> void:
match newState: match newState:
TableState.EMPTY: TableState.EMPTY:
_state_time = 0.0 _state_time = 0.0
_state_duration = 0.0
TableState.THINKING: TableState.THINKING:
_state_time = initial_eating_time _state_time = eating_duration
_state_duration = eating_duration # Can't be done in _set_state(), will set duration inside timer
TableState.WAITING_PRIMARY: TableState.WAITING_PRIMARY:
_state_time = initial_primary_time _state_time = primary_duration
_state_duration = primary_duration
TableState.WAITING_FRIEND: TableState.WAITING_FRIEND:
_state_time = initial_friend_time _state_time = friend_duration
_state_duration = friend_duration
TableState.EATING: TableState.EATING:
_state_time = initial_eating_time _state_time = eating_duration
_state_duration = eating_duration
_state = newState _state = newState
@@ -143,19 +152,29 @@ func _setState(newState: TableState) -> void:
## Pure presentation, driven off the current (locally authoritative or ## Pure presentation, driven off the current (locally authoritative or
## synced-from-server) state. Runs on every peer. ## synced-from-server) state. Runs on every peer.
func _refresh_display() -> void: func _refresh_display() -> void:
if not label_3d:
return
match _state: match _state:
TableState.EMPTY: TableState.EMPTY:
progress_bar.set_bar_visible(false)
label_3d.text = "empty" label_3d.text = "empty"
TableState.THINKING: TableState.THINKING:
progress_bar.set_bar_visible(false)
label_3d.text = lbl_thinking label_3d.text = lbl_thinking
TableState.WAITING_PRIMARY, TableState.WAITING_FRIEND: TableState.WAITING_PRIMARY:
label_3d.text = "%s\n%s" % [TableState.keys()[_state], "\n".join(_unsatisfied_orders)] label_3d.text = "%s\n%s" % [TableState.keys()[_state], "\n".join(_unsatisfied_orders)]
progress_bar.set_bar_visible(true)
progress_bar.override_fill_color(Color.RED if _state_time < 10 else Color.YELLOW)
TableState.WAITING_FRIEND:
label_3d.text = "%s\n%s" % [TableState.keys()[_state], "\n".join(_unsatisfied_orders)]
progress_bar.set_bar_visible(true)
progress_bar.override_fill_color(Color.RED if _state_time < 5 else Color.YELLOW)
TableState.EATING: TableState.EATING:
label_3d.text = lbl_eating label_3d.text = lbl_eating
if label_3d_time: progress_bar.set_bar_visible(false)
label_3d_time.text = "%.1f" % _state_time label_3d_time.text = "%.1f" % _state_time
print("_state_duration = ", _state_duration)
progress_bar.set_progress(clampf(float(_state_time) / _state_duration, 0.0, 1.0))
func _set_state(value: TableState) -> void: func _set_state(value: TableState) -> void:
+6 -1
View File
@@ -2,6 +2,7 @@
[ext_resource type="Script" uid="uid://caeikc7e3igkd" path="res://Stations/table.gd" id="1_2vcpj"] [ext_resource type="Script" uid="uid://caeikc7e3igkd" path="res://Stations/table.gd" id="1_2vcpj"]
[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_8j1nt"] [ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_8j1nt"]
[ext_resource type="PackedScene" uid="uid://bxbocxdaayvwx" path="res://UI/progress_bar.tscn" id="3_kjf1i"]
[sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"] [sub_resource type="BoxShape3D" id="BoxShape3D_24d3s"]
@@ -162,10 +163,14 @@ vertical_alignment = 0
line_spacing = -15.0 line_spacing = -15.0
[node name="Label3DTime" type="Label3D" parent="." unique_id=1534849507] [node name="Label3DTime" type="Label3D" parent="." unique_id=1534849507]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3306234, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4532461, 0)
pixel_size = 0.003 pixel_size = 0.003
billboard = 2 billboard = 2
text = "20.1s" text = "20.1s"
[node name="Sync" type="MultiplayerSynchronizer" parent="." unique_id=2000411505] [node name="Sync" type="MultiplayerSynchronizer" parent="." unique_id=2000411505]
replication_config = SubResource("SceneReplicationConfig_np_table") replication_config = SubResource("SceneReplicationConfig_np_table")
[node name="ProgressBar3D" parent="." unique_id=654673176 instance=ExtResource("3_kjf1i")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3676775, 0)
y_billboard = true
+32
View File
@@ -0,0 +1,32 @@
[gd_scene format=3 uid="uid://bxbocxdaayvwx"]
[ext_resource type="Script" uid="uid://bv7oracwmgre8" path="res://UI/progress_bar_3d.gd" id="1_ng8tm"]
[sub_resource type="ViewportTexture" id="ViewportTexture_copv3"]
viewport_path = NodePath("Sprite3D/SubViewport")
[node name="ProgressBar3D" type="Node3D" unique_id=654673176]
script = ExtResource("1_ng8tm")
[node name="Sprite3D" type="Sprite3D" parent="." unique_id=1484008334]
pixel_size = 0.002
texture = SubResource("ViewportTexture_copv3")
[node name="SubViewport" type="SubViewport" parent="Sprite3D" unique_id=35936518]
transparent_bg = true
size = Vector2i(320, 80)
[node name="ProgressBar" type="ProgressBar" parent="Sprite3D/SubViewport" unique_id=727723524]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -150.0
offset_top = -13.5
offset_right = 150.0
offset_bottom = 36.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
+33
View File
@@ -0,0 +1,33 @@
extends Node3D
class_name ProgressBar3D
@export var y_billboard: bool = false
@onready var progress_bar: ProgressBar = $Sprite3D/SubViewport/ProgressBar
@onready var sprite_3d: Sprite3D = $Sprite3D
func _ready() -> void:
if not progress_bar:
push_error("Progressbar3D missing reference to ProgressBar")
if y_billboard:
$Sprite3D.billboard = BaseMaterial3D.BillboardMode.BILLBOARD_FIXED_Y
func set_progress(value: float) -> void:
print("ProgressBar set_progress: ", value)
progress_bar.value = clamp(value, 0.0, 1.0) * 100
func get_progress() -> float:
return progress_bar.value
func set_bar_visible(value: bool) -> void:
progress_bar.visible = value
func override_fill_color(color: Color) -> void:
var style_box := StyleBoxFlat.new()
style_box.bg_color = color
# Override the 'fill' StyleBox on the ProgressBar
progress_bar.add_theme_stylebox_override("fill", style_box)
+1
View File
@@ -0,0 +1 @@
uid://bv7oracwmgre8
+9 -1
View File
@@ -16,7 +16,8 @@
"dd822d14-88e5-4790-808e-7d2cf7f79133", "dd822d14-88e5-4790-808e-7d2cf7f79133",
"784d5cd3-333a-40a9-b35f-3d0c73f00761", "784d5cd3-333a-40a9-b35f-3d0c73f00761",
"21bc19f1-ee3c-4bbb-ab9a-07ec6123a823", "21bc19f1-ee3c-4bbb-ab9a-07ec6123a823",
"d93a31cd-d475-4c5a-87fc-983174b2594f" "d93a31cd-d475-4c5a-87fc-983174b2594f",
"9d7ecbc4-db2a-4d09-9f40-ceed3cf98c00"
] ]
}, },
{ {
@@ -242,6 +243,13 @@
"description": "", "description": "",
"category": "bf4ec62e-526e-4027-876f-0b22bd17f79a", "category": "bf4ec62e-526e-4027-876f-0b22bd17f79a",
"steps": [] "steps": []
},
{
"uuid": "9d7ecbc4-db2a-4d09-9f40-ceed3cf98c00",
"title": "Add test that a hob can chain cook",
"description": "",
"category": "bf4ec62e-526e-4027-876f-0b22bd17f79a",
"steps": []
} }
], ],
"layout": { "layout": {