feat: fahrplan, poc

This commit is contained in:
tiger tiger tiger 2026-01-20 23:19:20 +01:00
parent 0d150d31fc
commit d26ace7dff
6 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,4 @@
class_name Fahrplan class_name Fahrplan extends Node3D
extends Node3D
## easy graph: <station> : [Track1Train1 (next halt), Track1Train2], [Track2Train1(next halt), ...] ## easy graph: <station> : [Track1Train1 (next halt), Track1Train2], [Track2Train1(next halt), ...]
@onready var fahrplan : Dictionary[Node3D, Array] = { @onready var fahrplan : Dictionary[Node3D, Array] = {
@ -26,6 +25,10 @@ func _set_signage_texts(group: StringName, message: String) -> void:
await get_tree().create_timer(0.05).timeout await get_tree().create_timer(0.05).timeout
func _ready() -> void: func _ready() -> void:
var x : Node3D = $station_hirschfeld
print(x.name)
await get_tree().process_frame
tracks[0].departure.connect(player_departed) tracks[0].departure.connect(player_departed)
tracks[1].departure.connect(player_departed) tracks[1].departure.connect(player_departed)
enter_station($station_hirschfeld) enter_station($station_hirschfeld)
@ -51,14 +54,14 @@ func train_traffic_loop(track: Dolly, cancel: Array) -> void:
await get_tree().create_timer(randf_range(random_wait.x, random_wait.y)).timeout await get_tree().create_timer(randf_range(random_wait.x, random_wait.y)).timeout
if cancel.is_empty(): return # abort the loop if cancel.is_empty(): return # abort the loop
track.cycle() await track.cycle()
var cancellation_token : Array var cancellation_token : Array
func enter_station(station: Node): func enter_station(station: Node):
prints("------------", "ENTER STATION", station, station.name, "------------") prints("------------", "ENTER STATION", station, station.name, "------------")
current_station.visible = false if current_station: current_station.visible = false
current_station = station current_station = station
current_station.visible = true current_station.visible = true
cancellation_token = ["go"] # Allocate a new stopping token cancellation_token = ["go"] # Allocate a new stopping token

View File

@ -1 +1 @@
uid://d4dq6pg3qkfn5 uid://bi4cwmajhpa5f

View File

@ -1,8 +1,8 @@
extends RoomTemplate extends RoomTemplate
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:
super._ready() super._ready()
id = State.rooms.TRANSITION id = State.rooms.TRANSITION
@ -28,6 +28,12 @@ func pull_save_state(save: SaveGame) -> void:
# Call parent to restore player position # Call parent to restore player position
super.pull_save_state(save) super.pull_save_state(save)
## left here for reference... the ~35 lines of code above should be enoough ## left here for reference... the ~35 lines of code above should be enoough
#var left_first_station: bool = false #var left_first_station: bool = false
#func on_first_station() -> void: #func on_first_station() -> void:

View File

@ -4,7 +4,7 @@
[ext_resource type="AudioStream" uid="uid://31dunmt6i7ck" path="res://base-environments/transition/audio/328953__sandermotions__escalator-1.wav" id="3_ke0al"] [ext_resource type="AudioStream" uid="uid://31dunmt6i7ck" path="res://base-environments/transition/audio/328953__sandermotions__escalator-1.wav" id="3_ke0al"]
[ext_resource type="PackedScene" uid="uid://tuv111h6jsnu" path="res://base-environments/transition/import/textures/meta_station_imported.tscn" id="5_ru87u"] [ext_resource type="PackedScene" uid="uid://tuv111h6jsnu" path="res://base-environments/transition/import/textures/meta_station_imported.tscn" id="5_ru87u"]
[node name="dungeon_station" instance=ExtResource("1_4tuwp")] [node name="station_hirschfeld" instance=ExtResource("1_4tuwp")]
[node name="meta_station" parent="." index="5" instance=ExtResource("5_ru87u")] [node name="meta_station" parent="." index="5" instance=ExtResource("5_ru87u")]

View File

@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://snugj1gnggjj" path="res://base-environments/transition/code/subway_sequence.gd" id="1_yfan7"] [ext_resource type="Script" uid="uid://snugj1gnggjj" path="res://base-environments/transition/code/subway_sequence.gd" id="1_yfan7"]
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="2_il5go"] [ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="2_il5go"]
[ext_resource type="Script" uid="uid://d4dq6pg3qkfn5" path="res://base-environments/transition/code/fahrplan.gd" id="4_yfan7"] [ext_resource type="Script" uid="uid://bi4cwmajhpa5f" path="res://base-environments/transition/code/fahrplan.gd" id="4_yfan7"]
[ext_resource type="PackedScene" uid="uid://d2j0d88axhfue" path="res://base-environments/transition/stations/dungeon_station.tscn" id="5_rum2v"] [ext_resource type="PackedScene" uid="uid://d2j0d88axhfue" path="res://base-environments/transition/stations/dungeon_station.tscn" id="5_rum2v"]
[ext_resource type="VoxelGIData" uid="uid://d0ywd1vewvryc" path="res://base-environments/transition/vfx/dungeon_VoxelGI.res" id="6_ii0j1"] [ext_resource type="VoxelGIData" uid="uid://d0ywd1vewvryc" path="res://base-environments/transition/vfx/dungeon_VoxelGI.res" id="6_ii0j1"]
[ext_resource type="AudioStream" uid="uid://ba7s5uqc4iu66" path="res://base-environments/transition/audio/537769__janbezouska__factory-fluorescent-light-buzz.wav" id="7_rkl48"] [ext_resource type="AudioStream" uid="uid://ba7s5uqc4iu66" path="res://base-environments/transition/audio/537769__janbezouska__factory-fluorescent-light-buzz.wav" id="7_rkl48"]
@ -217,18 +217,20 @@ initial_pitch = -30.0
[node name="Track0Dolly" parent="Logic" instance=ExtResource("17_yfan7")] [node name="Track0Dolly" parent="Logic" instance=ExtResource("17_yfan7")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.2, -0.2, -32.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.2, -0.2, -32.5)
visible = false
index = 0 index = 0
signage_group = "signage1" signage_group = "signage2"
[node name="Track1Dolly" parent="Logic" instance=ExtResource("17_yfan7")] [node name="Track1Dolly" parent="Logic" instance=ExtResource("17_yfan7")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -6.2, -0.2, -32.5) transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, -6.2, -0.2, -32.5)
visible = false
index = 1 index = 1
signage_group = "signage2" signage_group = "signage1"
[node name="Fahrplan" type="Node3D" parent="Logic"] [node name="Fahrplan" type="Node3D" parent="Logic"]
script = ExtResource("4_yfan7") script = ExtResource("4_yfan7")
metadata/_custom_type_script = "uid://d4dq6pg3qkfn5" metadata/_custom_type_script = "uid://bi4cwmajhpa5f"
[node name="station_hirschfeld" parent="Logic/Fahrplan" instance=ExtResource("5_rum2v")] [node name="station_hirschfeld" parent="Logic/Fahrplan" instance=ExtResource("5_rum2v")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.021, 0, -0.018) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.021, 0, -0.018)
@ -236,7 +238,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.021, 0, -0.018)
[node name="VoxelGI" type="VoxelGI" parent="Logic/Fahrplan/station_hirschfeld"] [node name="VoxelGI" type="VoxelGI" parent="Logic/Fahrplan/station_hirschfeld"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.020572662, 1.5449562, -25.981638) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.020572662, 1.5449562, -25.981638)
subdiv = 2 subdiv = 2
size = Vector3(11, 3.75, 84) size = Vector3(20, 3.75, 84)
data = ExtResource("6_ii0j1") data = ExtResource("6_ii0j1")
[node name="SubwayMap3D" type="Node3D" parent="Logic/Fahrplan/station_hirschfeld"] [node name="SubwayMap3D" type="Node3D" parent="Logic/Fahrplan/station_hirschfeld"]
@ -399,6 +401,7 @@ operation = 2
mesh = SubResource("BoxMesh_symoa") mesh = SubResource("BoxMesh_symoa")
[node name="station_ministry" parent="Logic/Fahrplan" instance=ExtResource("11_vomua")] [node name="station_ministry" parent="Logic/Fahrplan" instance=ExtResource("11_vomua")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1.2, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1.2, 0, 0, 0)
visible = false visible = false