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_lines: Dictionary[TrainLine.id, TrainLine]
|
||||
|
||||
func _ready() -> void:
|
||||
id = State.rooms.TRANSITION
|
||||
super._ready()
|
||||
|
||||
func get_ready_async() -> void:
|
||||
await super.get_ready_async()
|
||||
|
||||
func start_room():
|
||||
await super.start_room()
|
||||
func start_room_async():
|
||||
await super.start_room_async()
|
||||
|
||||
Scenes.player_enable.emit(true)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ func _ready() -> void:
|
|||
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
||||
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
|
||||
%TherapyUniInteractable.visible = save_game.subway_burnout
|
||||
|
|
@ -17,16 +18,15 @@ func get_ready() -> void:
|
|||
)
|
||||
|
||||
|
||||
func start_room():
|
||||
await super.start_room()
|
||||
%UI.show()
|
||||
|
||||
%PlayerController.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
func start_room_async():
|
||||
await super.start_room_async()
|
||||
# Give player control immediately, then open
|
||||
%PlayerController.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
Scenes.player_enable.emit(true)
|
||||
|
||||
await Main.curtain.open()
|
||||
|
||||
|
||||
func prepare_transition():
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@ func _ready() -> void:
|
|||
super._ready() # UwU, superclass _ready is not called by Godot automatically...
|
||||
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()
|
||||
|
||||
# To start breathing etc.
|
||||
|
|
@ -33,12 +37,6 @@ func _play_intro_scene() -> void:
|
|||
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:
|
||||
super.pull_save_state(save)
|
||||
prints("youth_room.gd", "pull_save_state()", self)
|
||||
|
|
|
|||
|
|
@ -33,29 +33,28 @@ func _ready() -> void:
|
|||
_debug_mode()
|
||||
|
||||
|
||||
|
||||
|
||||
func get_ready():
|
||||
func get_ready_async():
|
||||
prints("----------", "GET_READY", self.name, "--------------")
|
||||
pull_save_state(save_game)
|
||||
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:
|
||||
for i in range(20):
|
||||
await get_tree().process_frame
|
||||
await get_ready()
|
||||
await start_room()
|
||||
for i in range(20): await get_tree().process_frame #HACK - can probably be removed
|
||||
|
||||
await get_ready_async()
|
||||
await start_room_async()
|
||||
|
||||
var next_room : StringName = await proceed
|
||||
prints("----------", "PROCEEDING", 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:
|
||||
# Override this function to load the state of the chapter from State.save_game
|
||||
restore_player_from_save(save)
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ func _ready() -> void:
|
|||
prints("room_with_board.gd", "_ready()", self, owner)
|
||||
|
||||
|
||||
|
||||
func get_ready():
|
||||
super.get_ready()
|
||||
func get_ready_async():
|
||||
super.get_ready_async()
|
||||
prints("room_with_board.gd", "get_ready()", self)
|
||||
|
||||
assert(card_board, str(self) + " has no CardBoard")
|
||||
|
|
|
|||
Loading…
Reference in New Issue