feat: loading into subway, fixing bugs there
This commit is contained in:
parent
5a040af04d
commit
3c5bab0753
|
|
@ -35,11 +35,15 @@ func _play_intro_scene() -> void:
|
||||||
func get_ready():
|
func get_ready():
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
|
|
||||||
pull_save_state(State.save_game)
|
|
||||||
|
|
||||||
card_board.board_completed.connect(func():
|
card_board.board_completed.connect(func():
|
||||||
save_game.is_childhood_board_complete = true
|
%DoorInteractable.show()
|
||||||
save_room())
|
if not save_game.is_childhood_board_complete:
|
||||||
|
save_game.is_childhood_board_complete = true
|
||||||
|
save_room()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
pull_save_state(State.save_game)
|
||||||
|
|
||||||
card_board.closed.connect(save_room)
|
card_board.closed.connect(save_room)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
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")]
|
[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)
|
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")
|
interaction = ExtResource("11_5bsh1")
|
||||||
billboard = false
|
billboard = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ enum {NAVIGATE, ASSIGN, DRAG}
|
||||||
|
|
||||||
|
|
||||||
func play():
|
func play():
|
||||||
_check_completion() # check completion one extra time on on enter
|
check_board_completion()
|
||||||
await closed
|
await closed
|
||||||
_finalize_board_state()
|
_finalize_board_state()
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ func _process(delta: float):
|
||||||
func _check_completion() -> void:
|
func _check_completion() -> void:
|
||||||
if is_board_complete():
|
if is_board_complete():
|
||||||
board_was_completed = true
|
board_was_completed = true
|
||||||
give_lore_feedback()
|
board_completed.emit()
|
||||||
|
|
||||||
|
|
||||||
## Finalizes board state before closing (ends drags, cleans up transitions)
|
## Finalizes board state before closing (ends drags, cleans up transitions)
|
||||||
|
|
@ -114,6 +114,7 @@ func _finalize_board_state() -> void:
|
||||||
_end_drag(selection)
|
_end_drag(selection)
|
||||||
for item in notes:
|
for item in notes:
|
||||||
item.is_dragged = false
|
item.is_dragged = false
|
||||||
|
|
||||||
for item in cards:
|
for item in cards:
|
||||||
item.is_dragged = false
|
item.is_dragged = false
|
||||||
|
|
||||||
|
|
@ -507,10 +508,11 @@ func initialise_from_save(savegame: SaveGame) -> void:
|
||||||
sticky.position = position + size / 2.0
|
sticky.position = position + size / 2.0
|
||||||
push_warning(" Sticky '%s' - no saved position, using center" % sticky.name)
|
push_warning(" Sticky '%s' - no saved position, using center" % sticky.name)
|
||||||
|
|
||||||
print_debug("CardBoard: Load complete!")
|
|
||||||
|
|
||||||
# Re-sort by positions for correct z-ordering
|
# Re-sort by positions for correct z-ordering
|
||||||
_sort_by_positions()
|
_sort_by_positions()
|
||||||
|
print_debug("CardBoard: Load complete!")
|
||||||
|
_check_completion()
|
||||||
|
|
||||||
|
|
||||||
# === Computed Properties ===
|
# === Computed Properties ===
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,8 @@ _data = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="board" type="PanelContainer"]
|
[node name="board" type="PanelContainer"]
|
||||||
z_index = -10
|
|
||||||
material = SubResource("ShaderMaterial_ttqei")
|
material = SubResource("ShaderMaterial_ttqei")
|
||||||
|
clip_contents = true
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ func _ready():
|
||||||
func vanish():
|
func vanish():
|
||||||
super.vanish()
|
super.vanish()
|
||||||
await Main.curtain.black() # Go straight to loading screen
|
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
|
## Main play coroutine - simple linear flow for burning a card
|
||||||
func play() -> void:
|
func play() -> void:
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ var playable : Playable = null
|
||||||
@export var billboard : bool = true
|
@export var billboard : bool = true
|
||||||
|
|
||||||
var active : bool = false
|
var active : bool = false
|
||||||
|
|
||||||
var shown : bool = false
|
var shown : bool = false
|
||||||
var hover : bool = false
|
var hover : bool = false
|
||||||
var collected : bool = false:
|
var collected : bool = false:
|
||||||
|
|
|
||||||
|
|
@ -177,8 +177,9 @@ var has_entered:bool = false:
|
||||||
delay_passed = false
|
delay_passed = false
|
||||||
var delay_passed:bool = false
|
var delay_passed:bool = false
|
||||||
|
|
||||||
func _on_ray_entered(_area):
|
func _on_ray_entered(_area : Area3D):
|
||||||
var parent := _area.get_parent() as Interactable
|
var parent := _area.get_parent() as Interactable
|
||||||
|
if not parent.visible: return
|
||||||
assert(parent != null, "Ray entered non-interactable area!")
|
assert(parent != null, "Ray entered non-interactable area!")
|
||||||
printt("ray entered", parent.name, parent)
|
printt("ray entered", parent.name, parent)
|
||||||
parent.hover = true
|
parent.hover = true
|
||||||
|
|
@ -188,6 +189,7 @@ func _on_ray_entered(_area):
|
||||||
|
|
||||||
func _on_ray_exited(_area):
|
func _on_ray_exited(_area):
|
||||||
var parent := _area.get_parent() as Interactable
|
var parent := _area.get_parent() as Interactable
|
||||||
|
if not parent.visible: return
|
||||||
printt("ray exited", parent.name, parent)
|
printt("ray exited", parent.name, parent)
|
||||||
parent.hover = false
|
parent.hover = false
|
||||||
# Switch back to default cursor when not hovering
|
# Switch back to default cursor when not hovering
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,17 @@ func start_game(save: SaveGame) -> void:
|
||||||
await _load_room(room_path)
|
await _load_room(room_path)
|
||||||
await State.room.play()
|
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()
|
await curtain.close()
|
||||||
%Loading.play()
|
%Loading.play()
|
||||||
|
|
||||||
|
|
@ -82,10 +92,10 @@ func _load_room(next_path: String) -> bool:
|
||||||
State.room.unload()
|
State.room.unload()
|
||||||
State.room = null
|
State.room = null
|
||||||
|
|
||||||
ResourceLoader.load_threaded_request(next_path, "PackedScene", true)
|
ResourceLoader.load_threaded_request(scene_path, "PackedScene", true)
|
||||||
while true:
|
while true:
|
||||||
await get_tree().process_frame
|
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:
|
match state:
|
||||||
ResourceLoader.THREAD_LOAD_LOADED:
|
ResourceLoader.THREAD_LOAD_LOADED:
|
||||||
var next_scene := ResourceLoader.load_threaded_get(youth_room_path) as PackedScene
|
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 get_tree().process_frame
|
||||||
await State.room.get_ready()
|
await State.room.get_ready()
|
||||||
%Loading.stop()
|
%Loading.stop()
|
||||||
return true
|
return
|
||||||
ResourceLoader.THREAD_LOAD_FAILED:
|
ResourceLoader.THREAD_LOAD_FAILED:
|
||||||
push_error("Failed to load room.")
|
push_error("Failed to load room.")
|
||||||
break
|
break
|
||||||
return false
|
|
||||||
|
assert(false, "Couldn't load room %s" % scene_path)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue