refactor: named the get_ready and start_room functions _async so it's clearer how they work differently
This commit is contained in:
parent
9ea0d05d72
commit
059b4b96cc
|
|
@ -3,13 +3,16 @@ class_name SubwaySequence
|
||||||
|
|
||||||
@export var all_stations: Dictionary[Station.id, Station]
|
@export var all_stations: Dictionary[Station.id, Station]
|
||||||
@export var all_lines: Dictionary[TrainLine.id, TrainLine]
|
@export var all_lines: Dictionary[TrainLine.id, TrainLine]
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
id = State.rooms.TRANSITION
|
id = State.rooms.TRANSITION
|
||||||
super._ready()
|
super._ready()
|
||||||
|
|
||||||
|
func get_ready_async() -> void:
|
||||||
|
await super.get_ready_async()
|
||||||
|
|
||||||
func start_room():
|
func start_room_async():
|
||||||
await super.start_room()
|
await super.start_room_async()
|
||||||
|
|
||||||
Scenes.player_enable.emit(true)
|
Scenes.player_enable.emit(true)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,9 @@ func _ready() -> void:
|
||||||
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
||||||
prints("volunteer_room.gd", "_ready()", self)
|
prints("volunteer_room.gd", "_ready()", self)
|
||||||
|
|
||||||
func get_ready() -> void:
|
|
||||||
await super.get_ready()
|
func get_ready_async() -> void:
|
||||||
|
await super.get_ready_async()
|
||||||
|
|
||||||
%TherapyVoluntaryInteractable.visible = not save_game.subway_burnout
|
%TherapyVoluntaryInteractable.visible = not save_game.subway_burnout
|
||||||
%TherapyUniInteractable.visible = save_game.subway_burnout
|
%TherapyUniInteractable.visible = save_game.subway_burnout
|
||||||
|
|
@ -17,16 +18,15 @@ func get_ready() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func start_room():
|
func start_room_async():
|
||||||
await super.start_room()
|
await super.start_room_async()
|
||||||
%UI.show()
|
|
||||||
|
|
||||||
%PlayerController.process_mode = Node.PROCESS_MODE_INHERIT
|
|
||||||
# Give player control immediately, then open
|
# Give player control immediately, then open
|
||||||
|
%PlayerController.process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
Scenes.player_enable.emit(true)
|
Scenes.player_enable.emit(true)
|
||||||
|
|
||||||
await Main.curtain.open()
|
await Main.curtain.open()
|
||||||
|
|
||||||
|
|
||||||
func prepare_transition():
|
func prepare_transition():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,15 @@ func _ready() -> void:
|
||||||
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
||||||
prints("youth_room.gd", "_ready()", self)
|
prints("youth_room.gd", "_ready()", self)
|
||||||
|
|
||||||
func start_room():
|
|
||||||
await super.start_room()
|
|
||||||
|
|
||||||
%UI.show()
|
func get_ready() -> void:
|
||||||
|
await super.get_ready_async()
|
||||||
|
prints("youth_room.gd", "get_ready()", self)
|
||||||
|
await Main.curtain.open()
|
||||||
|
|
||||||
|
|
||||||
|
func start_room_async():
|
||||||
|
await super.start_room_async()
|
||||||
await Main.curtain.open()
|
await Main.curtain.open()
|
||||||
|
|
||||||
# To start breathing etc.
|
# To start breathing etc.
|
||||||
|
|
@ -33,12 +37,6 @@ func _play_intro_scene() -> void:
|
||||||
await intro.interact()
|
await intro.interact()
|
||||||
|
|
||||||
|
|
||||||
func get_ready() -> void:
|
|
||||||
await super.get_ready()
|
|
||||||
prints("youth_room.gd", "get_ready()", self)
|
|
||||||
|
|
||||||
ui.hide()# Not sure?
|
|
||||||
|
|
||||||
func pull_save_state(save: SaveGame) -> void:
|
func pull_save_state(save: SaveGame) -> void:
|
||||||
super.pull_save_state(save)
|
super.pull_save_state(save)
|
||||||
prints("youth_room.gd", "pull_save_state()", self)
|
prints("youth_room.gd", "pull_save_state()", self)
|
||||||
|
|
|
||||||
|
|
@ -33,29 +33,28 @@ func _ready() -> void:
|
||||||
_debug_mode()
|
_debug_mode()
|
||||||
|
|
||||||
|
|
||||||
|
func get_ready_async():
|
||||||
|
|
||||||
func get_ready():
|
|
||||||
prints("----------", "GET_READY", self.name, "--------------")
|
prints("----------", "GET_READY", self.name, "--------------")
|
||||||
pull_save_state(save_game)
|
pull_save_state(save_game)
|
||||||
save_game.seen.append(name)
|
save_game.seen.append(name)
|
||||||
|
|
||||||
|
|
||||||
|
func start_room_async():
|
||||||
|
prints("----------", "START_ROOM", self.name, "--------------")
|
||||||
|
await get_tree().process_frame # so this registers as a coroutine in IDE
|
||||||
|
|
||||||
|
|
||||||
func play() -> String:
|
func play() -> String:
|
||||||
for i in range(20):
|
for i in range(20): await get_tree().process_frame #HACK - can probably be removed
|
||||||
await get_tree().process_frame
|
|
||||||
await get_ready()
|
await get_ready_async()
|
||||||
await start_room()
|
await start_room_async()
|
||||||
|
|
||||||
var next_room : StringName = await proceed
|
var next_room : StringName = await proceed
|
||||||
prints("----------", "PROCEEDING", next_room, "--------------")
|
prints("----------", "PROCEEDING", next_room, "--------------")
|
||||||
return next_room
|
return next_room
|
||||||
|
|
||||||
|
|
||||||
func start_room():
|
|
||||||
prints("----------", "START_ROOM", self.name, "--------------")
|
|
||||||
await get_tree().process_frame # so this registers as a coroutine in IDE
|
|
||||||
|
|
||||||
|
|
||||||
func pull_save_state(save: SaveGame) -> void:
|
func pull_save_state(save: SaveGame) -> void:
|
||||||
# Override this function to load the state of the chapter from State.save_game
|
# Override this function to load the state of the chapter from State.save_game
|
||||||
restore_player_from_save(save)
|
restore_player_from_save(save)
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@ func _ready() -> void:
|
||||||
prints("room_with_board.gd", "_ready()", self, owner)
|
prints("room_with_board.gd", "_ready()", self, owner)
|
||||||
|
|
||||||
|
|
||||||
|
func get_ready_async():
|
||||||
func get_ready():
|
super.get_ready_async()
|
||||||
super.get_ready()
|
|
||||||
prints("room_with_board.gd", "get_ready()", self)
|
prints("room_with_board.gd", "get_ready()", self)
|
||||||
|
|
||||||
assert(card_board, str(self) + " has no CardBoard")
|
assert(card_board, str(self) + " has no CardBoard")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue