feat: player can now leave the train

This commit is contained in:
tiger tiger tiger 2026-01-20 21:35:12 +01:00
parent 4b07eaf6c5
commit 31b17e802d
4 changed files with 155 additions and 95 deletions

View File

@ -31,7 +31,7 @@ func cycle() -> void:
func _seat_player_if_inside() -> void:
if %EntryDetect.overlaps_body(State.player):
prints("Player is inside Train on", self.name)
prints("Player asleep inside Train", self.name)
State.player.sleeping = true
var s1 := %Seat1
var s2 := %Seat2
@ -40,6 +40,14 @@ func _seat_player_if_inside() -> void:
State.player.reparent(seat)
func _unseat_player_if_inside() -> void:
if %EntryDetect.overlaps_body(State.player):
prints("Player no longer asleep on Train", self.name)
State.player.sleeping = false
State.player.reparent(get_parent())
func arrive() -> void:
%SubwayTrainAudio.play(0)
%SubwayTrainAudioIntense.play(0)
@ -51,6 +59,7 @@ func arrive() -> void:
tween.parallel().tween_property(child, "global_position", self.global_position, arrival_time)
await tween.finished
subway.door_open = true
_unseat_player_if_inside()
func leave() -> void:
@ -69,3 +78,4 @@ func leave() -> void:
if not child.visible: continue
# Warp back
child.global_position = origination.global_position
arrive()

View File

@ -0,0 +1,6 @@
extends Node3D
class_name StationSwapper
const fahplan : Dictionary[Node3D, Array] = {
%station_hirschfeld : [[%station_university],[%station_parity_square]]
}

View File

@ -0,0 +1 @@
uid://d4dq6pg3qkfn5

File diff suppressed because one or more lines are too long