feat: loading into subway, fixing bugs there

This commit is contained in:
tiger tiger tiger 2026-01-18 22:29:57 +01:00
parent 5a040af04d
commit 3c5bab0753
8 changed files with 39 additions and 16 deletions

View File

@ -35,11 +35,15 @@ func _play_intro_scene() -> void:
func get_ready():
await get_tree().process_frame
pull_save_state(State.save_game)
card_board.board_completed.connect(func():
%DoorInteractable.show()
if not save_game.is_childhood_board_complete:
save_game.is_childhood_board_complete = true
save_room())
save_room()
)
pull_save_state(State.save_game)
card_board.closed.connect(save_room)

View File

@ -1907,7 +1907,9 @@ transform = Transform3D(1, 0, 2.9802322e-08, 0, 1, 0, -2.9802322e-08, 0, 1, -0.0
transform = Transform3D(0.99999976, 0, 0, 0, 1, 0, 0, 0, 0.99999976, 0.10009599, -0.040801764, -0.19775379)
[node name="DoorInteractable" parent="logic" instance=ExtResource("22_ks23q")]
unique_name_in_owner = true
transform = Transform3D(-0.9999984, 0, 8.7422585e-08, 0, 1, 0, -8.7422585e-08, 0, -0.9999984, 0.42437345, 0.9173807, -0.95442796)
visible = false
interaction = ExtResource("11_5bsh1")
billboard = false

View File

@ -27,7 +27,7 @@ enum {NAVIGATE, ASSIGN, DRAG}
func play():
_check_completion() # check completion one extra time on on enter
check_board_completion()
await closed
_finalize_board_state()
@ -104,7 +104,7 @@ func _process(delta: float):
func _check_completion() -> void:
if is_board_complete():
board_was_completed = true
give_lore_feedback()
board_completed.emit()
## Finalizes board state before closing (ends drags, cleans up transitions)
@ -114,6 +114,7 @@ func _finalize_board_state() -> void:
_end_drag(selection)
for item in notes:
item.is_dragged = false
for item in cards:
item.is_dragged = false
@ -507,10 +508,11 @@ func initialise_from_save(savegame: SaveGame) -> void:
sticky.position = position + size / 2.0
push_warning(" Sticky '%s' - no saved position, using center" % sticky.name)
print_debug("CardBoard: Load complete!")
# Re-sort by positions for correct z-ordering
_sort_by_positions()
print_debug("CardBoard: Load complete!")
_check_completion()
# === Computed Properties ===

View File

@ -147,8 +147,8 @@ _data = {
}
[node name="board" type="PanelContainer"]
z_index = -10
material = SubResource("ShaderMaterial_ttqei")
clip_contents = true
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0

View File

@ -18,7 +18,8 @@ func _ready():
func vanish():
super.vanish()
await Main.curtain.black() # Go straight to loading screen
await Main.curtain.close() # Go straight to loading screen
Main.load_subway()
## Main play coroutine - simple linear flow for burning a card
func play() -> void:

View File

@ -15,6 +15,7 @@ var playable : Playable = null
@export var billboard : bool = true
var active : bool = false
var shown : bool = false
var hover : bool = false
var collected : bool = false:

View File

@ -177,8 +177,9 @@ var has_entered:bool = false:
delay_passed = false
var delay_passed:bool = false
func _on_ray_entered(_area):
func _on_ray_entered(_area : Area3D):
var parent := _area.get_parent() as Interactable
if not parent.visible: return
assert(parent != null, "Ray entered non-interactable area!")
printt("ray entered", parent.name, parent)
parent.hover = true
@ -188,6 +189,7 @@ func _on_ray_entered(_area):
func _on_ray_exited(_area):
var parent := _area.get_parent() as Interactable
if not parent.visible: return
printt("ray exited", parent.name, parent)
parent.hover = false
# Switch back to default cursor when not hovering

View File

@ -74,7 +74,17 @@ func start_game(save: SaveGame) -> void:
await _load_room(room_path)
await State.room.play()
func _load_room(next_path: String) -> bool:
func load_subway():
await curtain.close()
if State.room:
State.room.queue_free()
await _load_room(transition_room_path)
await State.room.play()
func _load_room(scene_path: String) -> void:
await curtain.close()
%Loading.play()
@ -82,10 +92,10 @@ func _load_room(next_path: String) -> bool:
State.room.unload()
State.room = null
ResourceLoader.load_threaded_request(next_path, "PackedScene", true)
ResourceLoader.load_threaded_request(scene_path, "PackedScene", true)
while true:
await get_tree().process_frame
var state := ResourceLoader.load_threaded_get_status(next_path)
var state := ResourceLoader.load_threaded_get_status(scene_path)
match state:
ResourceLoader.THREAD_LOAD_LOADED:
var next_scene := ResourceLoader.load_threaded_get(youth_room_path) as PackedScene
@ -94,8 +104,9 @@ func _load_room(next_path: String) -> bool:
await get_tree().process_frame
await State.room.get_ready()
%Loading.stop()
return true
return
ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load room.")
break
return false
assert(false, "Couldn't load room %s" % scene_path)