docs: fix tavern lobby plan after review
This commit is contained in:
@@ -52,11 +52,18 @@ var _current_scene_node: Node = null
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var is_server := OS.has_feature("dedicated_server") \
|
||||
or "--server" in OS.get_cmdline_user_args()
|
||||
if not is_server:
|
||||
call_deferred("transition_to", "tavern")
|
||||
NetworkManager.game_started.connect(_on_game_started)
|
||||
# Defer until main.tscn and its CurrentScene node are in the tree.
|
||||
# call_deferred is not sufficient here — autoloads init before the main
|
||||
# scene. Connect to root.ready (fires once, after main scene is ready).
|
||||
get_tree().root.ready.connect(_on_root_ready, CONNECT_ONE_SHOT)
|
||||
|
||||
|
||||
func _on_root_ready() -> void:
|
||||
var args := OS.get_cmdline_args() + OS.get_cmdline_user_args()
|
||||
var is_server := OS.has_feature("dedicated_server") or "--server" in args
|
||||
if not is_server:
|
||||
transition_to("tavern")
|
||||
|
||||
|
||||
func transition_to(scene_name: String) -> void:
|
||||
@@ -65,11 +72,15 @@ func transition_to(scene_name: String) -> void:
|
||||
if packed == null:
|
||||
push_error("[SceneManager] Scene not found: %s" % scene_name)
|
||||
return
|
||||
var container := get_node_or_null("/root/Main/CurrentScene")
|
||||
if container == null:
|
||||
push_error("[SceneManager] CurrentScene node not found in main.tscn")
|
||||
return
|
||||
if _current_scene_node != null:
|
||||
_current_scene_node.queue_free()
|
||||
_current_scene_node = null
|
||||
_current_scene_node = packed.instantiate()
|
||||
get_node("/root/Main/CurrentScene").add_child(_current_scene_node)
|
||||
container.add_child(_current_scene_node)
|
||||
|
||||
|
||||
func _on_game_started() -> void:
|
||||
@@ -142,14 +153,7 @@ script = ExtResource("1")
|
||||
[node name="CurrentScene" type="Node" parent="."]
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add ruf-der-pilze/scenes/main.tscn
|
||||
git commit -m "refactor: replace Lobby child with CurrentScene in main.tscn"
|
||||
```
|
||||
|
||||
> Note: Do NOT run the game yet — `tavern.tscn` doesn't exist, so SceneManager will push_error. That's expected. Continue to Task 3.
|
||||
> **Do NOT commit yet** — without `tavern.tscn` the game will crash. The commit happens at the end of Task 4 once the scene file exists.
|
||||
|
||||
---
|
||||
|
||||
@@ -225,12 +229,7 @@ func _on_start_pressed() -> void:
|
||||
NetworkManager.request_start_game.rpc_id(1)
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
|
||||
```bash
|
||||
git add ruf-der-pilze/scripts/tavern.gd
|
||||
git commit -m "feat: add tavern.gd (port of lobby.gd with CanvasLayer paths)"
|
||||
```
|
||||
> **Do NOT commit yet** — commit happens together with `tavern.tscn` in Task 4.
|
||||
|
||||
---
|
||||
|
||||
@@ -253,7 +252,7 @@ Camera: position (0, 3, 6), rotated −18° on X axis (looking slightly downward
|
||||
- [ ] **Step 1: Create `tavern.tscn`**
|
||||
|
||||
```
|
||||
[gd_scene load_steps=9 format=3]
|
||||
[gd_scene load_steps=8 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/tavern.gd" id="1"]
|
||||
|
||||
@@ -365,10 +364,10 @@ visible = false
|
||||
|
||||
> Note: If Godot logs a `load_steps` mismatch warning on first run, open the scene in the editor once — it will correct the value automatically on save.
|
||||
|
||||
- [ ] **Step 2: Commit**
|
||||
- [ ] **Step 2: Commit all three files together** (main.tscn + tavern.gd + tavern.tscn form one working unit)
|
||||
|
||||
```bash
|
||||
git add ruf-der-pilze/scenes/tavern.tscn
|
||||
git add ruf-der-pilze/scenes/main.tscn ruf-der-pilze/scripts/tavern.gd ruf-der-pilze/scenes/tavern.tscn
|
||||
git commit -m "feat: add tavern.tscn — 3D room with CanvasLayer UI overlay"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user