T2 tutorial: all five chapters with Old Tam, scripted dusk and demo wolf, rabbits for the hunt, title-screen Tutorial entry, pause-menu skip/leave, goodbye card; full bot playthrough test

This commit is contained in:
Paul Bailey
2026-11-05 14:43:00 +00:00
parent 5b5dd3d609
commit f93ebe1bea
11 changed files with 976 additions and 36 deletions

View File

@@ -61,9 +61,14 @@ func setup(p: Node3D) -> void:
_redraw()
func _unhandled_input(event: InputEvent) -> void:
if Guide.active and event is InputEventKey and event.pressed and not event.echo and event.keycode == KEY_H:
if not Guide.active or not (event is InputEventKey) or not event.pressed or event.echo:
return
if event.keycode == KEY_H:
_hidden = not _hidden
_redraw()
elif event.keycode in [KEY_ENTER, KEY_KP_ENTER] and Guide.current().get("goal", {}).has("continue"):
Guide.continue_step()
get_viewport().set_input_as_handled()
func _redraw() -> void:
var s: Dictionary = Guide.current()
@@ -84,13 +89,62 @@ func _on_done(_i: int, s: Dictionary) -> void:
tw.tween_interval(1.4)
tw.tween_property(_tick, "modulate:a", 0.0, 0.6)
## The end: Old Tam's summary, and Start your own world / Keep exploring.
var card: PanelContainer
func _on_finished() -> void:
_box.visible = false
_tick.text = "✓ Chapter done. More of the tutorial is on its way."
_tick.modulate.a = 1.0
var tw := create_tween()
tw.tween_interval(3.0)
tw.tween_property(_tick, "modulate:a", 0.0, 1.0)
if card != null and is_instance_valid(card):
return
card = UITheme.panel()
card.set_anchors_and_offsets_preset(Control.PRESET_CENTER)
card.grow_horizontal = Control.GROW_DIRECTION_BOTH
card.grow_vertical = Control.GROW_DIRECTION_BOTH
card.mouse_filter = Control.MOUSE_FILTER_STOP
add_child(card)
var v := VBoxContainer.new()
v.add_theme_constant_override("separation", 10)
v.custom_minimum_size = Vector2(520, 0)
card.add_child(v)
var f: Dictionary = Guide.finish
v.add_child(UITheme.label(String(f.get("title", "Tutorial done")), 26))
var t := UITheme.label("%s: \"%s\"" % [Guide.guide_name, String(f.get("text", ""))] if not Guide.guide_name.is_empty() else String(f.get("text", "")), 16, UITheme.TEXT_DIM)
t.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
t.custom_minimum_size = Vector2(520, 0)
v.add_child(t)
var h := HBoxContainer.new()
h.add_theme_constant_override("separation", 10)
v.add_child(h)
for b in [["Start your own world", _on_new_world], ["Keep exploring", _on_keep_exploring]]:
var btn := Button.new()
btn.text = b[0]
btn.focus_mode = Control.FOCUS_NONE
btn.custom_minimum_size = Vector2(240, 44)
btn.add_theme_font_size_override("font_size", 18)
btn.pressed.connect(b[1])
h.add_child(btn)
if player != null and player.get("ui_open") != null:
player.ui_open = true
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func _on_keep_exploring() -> void:
if card != null:
card.queue_free()
card = null
if player != null and player.get("ui_open") != null:
player.ui_open = false
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
## Saves the tutorial world and goes to the title screen's New World page.
func _on_new_world() -> void:
if Guide.world != null and is_instance_valid(Guide.world):
Guide.world.save_now()
get_tree().paused = false
Saves.current_id = ""
get_tree().auto_accept_quit = true
var TS: Script = load("res://scripts/ui/title_screen.gd")
TS.start_page = "new"
get_tree().change_scene_to_file("res://scenes/title.tscn")
func _process(_delta: float) -> void:
_update_marker()