frame-of-mind/src/base-environments/transition/subway_sequence.gd

176 lines
5.9 KiB
GDScript3
Raw Normal View History

2025-07-01 12:40:48 +00:00
extends RoomTemplate
2025-10-07 22:37:05 +00:00
@export var all_stations: Dictionary[Station.id, Station]
@export var all_lines: Dictionary[TrainLine.id, TrainLine]
2025-10-29 21:48:41 +00:00
func _ready() -> void:
2025-12-02 20:38:17 +00:00
id = State.rooms.TRANSITION
2025-10-29 21:48:41 +00:00
%LeftDetection.body_entered.connect(on_left_train_enter)
%RightDetection.body_entered.connect(on_right_train_enter)
%LeftDetection.body_exited.connect(on_left_train_exit)
%RightDetection.body_exited.connect(on_right_train_exit)
2025-12-02 20:38:17 +00:00
%burnout_station.leave_room.connect(func():
pull_save_state(save_game)
get_parent().load_save(save_game))
2025-10-29 21:48:41 +00:00
func start_room():
2025-12-02 20:38:17 +00:00
save_game = State.active_save_game
2025-10-29 21:48:41 +00:00
State.pass_stage_to(%PlayerController)
on_first_station()
var left_first_station: bool = false
func on_first_station():
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_DND
await get_tree().create_timer(5.0).timeout
%ShedulePlayer_R.play("train_arriving")
await get_tree().create_timer(12.0).timeout
if left_first_station: return
%ShedulePlayer_R.play("train_leaving")
await get_tree().create_timer(3.0).timeout
%RightLabel.text = "do not board"
await get_tree().create_timer(6.0).timeout
%ShedulePlayer_L.play("train_arriving")
var on_second_platform: bool = false
func on_first_transition(_is_left: bool = false):
%StationPlayer.play("first_transition")
await get_tree().create_timer(1.0).timeout
on_second_platform = true
func on_second_transition():
%StationPlayer.play("second_transition")
func on_third_transition():
%StationPlayer.play("third_transition")
func pull_save_state(save: SaveGame) -> void:
2025-12-02 20:38:17 +00:00
#FIXME
2025-10-29 21:48:41 +00:00
save.sequences_enabled = Scenes.enabled_sequences
2025-12-02 20:38:17 +00:00
save.current_room = State.rooms.ADULTHOOD
save_game = save
2025-10-29 21:48:41 +00:00
func prepare_transition():
2025-12-02 20:38:17 +00:00
for child in %Stations.get_children():
if child is Node3D:
if not child.name == "burnout_station":
child.queue_free()
2025-10-29 21:48:41 +00:00
func unload():
pass
func on_left_train_enter(_body):
if not left_first_station:
left_first_station = true
await get_tree().create_timer(2.0).timeout
%Train2.get_child(0).door_open = false
on_first_transition(true)
await get_tree().create_timer(5.0).timeout
2025-11-01 13:54:25 +00:00
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_VOLUNTARY
%SubwayMap.current_station = Scenes.id.ADULT_VOLUNTARY
2025-10-29 21:48:41 +00:00
%RightLabel.text = "U3 Gesundquell \n via Rosenthal Hospital"
await get_tree().create_timer(5.0).timeout
2025-11-01 13:54:25 +00:00
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_CHRISTMAS
%SubwayMap.current_station = Scenes.id.ADULT_CHRISTMAS
2025-10-29 21:48:41 +00:00
await get_tree().create_timer(5.0).timeout
%Train2.get_child(0).door_open = true
await get_tree().create_timer(5.0).timeout
if not changeover:
%Train2.get_child(0).door_open = false
on_second_transition()
await get_tree().create_timer(5.0).timeout
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_UNI
%SubwayMap.current_station = Scenes.id.ADULT_UNI
%RightLabel.text = "do not board"
%LeftLabel.text = "do not board"
on_final = true
await get_tree().create_timer(5.0).timeout
%Train2.get_child(0).door_open = true
else:
%ShedulePlayer_L.play("train_leaving")
%LeftLabel.text = "do not board"
return
if changeover:
%ShedulePlayer_R.play("train_leaving")
await get_tree().create_timer(2.0).timeout
%Train2.get_child(0).door_open = false
on_second_transition()
await get_tree().create_timer(5.0).timeout
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_THERAPY
%SubwayMap.current_station = Scenes.id.ADULT_THERAPY
%RightLabel.text = "do not board"
%LeftLabel.text = "do not board"
on_final = true
await get_tree().create_timer(5.0).timeout
%Train2.get_child(0).door_open = true
2025-12-02 20:38:17 +00:00
var on_final: bool = false:
set(final):
#FIXME: this needs to be a proper sequence!
on_final = final
await get_tree().create_timer(0.5).timeout
if final: prepare_transition()
2025-10-29 21:48:41 +00:00
var on_direct_path: bool = false
func on_right_train_enter(_body):
if not left_first_station:
on_direct_path = true
%Train.get_child(0).door_open = false
await get_tree().create_timer(2.0).timeout
left_first_station = true
on_first_transition(false)
await get_tree().create_timer(5.0).timeout
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_EATING
%SubwayMap.current_station = Scenes.id.ADULT_EATING
%LeftLabel.text = "U8 Gesundquell \n via Rosenthal Hospital"
await get_tree().create_timer(5.0).timeout
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_UNI
%SubwayMap.current_station = Scenes.id.ADULT_UNI
await get_tree().create_timer(5.0).timeout
%Train.get_child(0).door_open = true
await get_tree().create_timer(5.0).timeout
if not changeover:
%Train.get_child(0).door_open = false
on_second_transition()
await get_tree().create_timer(5.0).timeout
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_BURNOUT
%SubwayMap.current_station = Scenes.id.ADULT_BURNOUT
%RightLabel.text = "do not board"
%LeftLabel.text = "do not board"
on_final = true
await get_tree().create_timer(5.0).timeout
%Train.get_child(0).door_open = true
else:
%ShedulePlayer_R.play("train_leaving")
%RightLabel.text = "do not board"
return
if changeover:
on_second_transition()
if on_direct_path: %ShedulePlayer_L.play("train_leaving")
await get_tree().create_timer(5.0).timeout
2025-11-01 13:54:25 +00:00
Scenes.enabled_sequences += 1 << Scenes.id.ADULT_CHRISTMAS
%SubwayMap.current_station = Scenes.id.ADULT_CHRISTMAS
2025-10-29 21:48:41 +00:00
await get_tree().create_timer(2.0).timeout
%Train2.get_child(0).door_open = false
%RightLabel.text = "do not board"
%LeftLabel.text = "do not board"
on_final = true
await get_tree().create_timer(5.0).timeout
%Train.get_child(0).door_open = true
var changeover: bool = false
func on_left_train_exit(_body):
if on_second_platform and not on_final:
changeover = true
%ShedulePlayer_R.play("train_arriving")
func on_right_train_exit(_body):
if on_second_platform and not on_final:
changeover = true
%ShedulePlayer_L.play("train_arriving")
await get_tree().create_timer(10).timeout
%RightLabel.text = "U1 weissnicht \n via Saint-Exupery Sq."
await get_tree().create_timer(5).timeout
%ShedulePlayer_R.play("train_arriving")