bind new inputs

This commit is contained in:
2026-07-01 19:09:56 +02:00
parent 7be800398d
commit 238dd4a124
4 changed files with 140 additions and 119 deletions

View File

@@ -84,9 +84,12 @@ var wagon_instances: Array[Node3D] = []
var wagon_progress_offsets: Array[float] = []
var _pending_steam_distance_km: float = 0.0
var _initial_is_inmotion: bool = true
var _is_photo_mode_active: bool = false
func _ready() -> void:
randomize()
GameState.on_enable_photo_mode_request.connect(func(): _is_photo_mode_active = true)
GameState.on_disable_photo_mode_request.connect(func(): _is_photo_mode_active = false)
_cache_environment_config()
_initial_is_inmotion = is_inmotion
@@ -285,9 +288,12 @@ func _plan_stops() -> void:
stops_position.append(data["position"])
func _input(event: InputEvent) -> void:
if _is_photo_mode_active: return
if event is InputEventKey and event.pressed and not event.echo:
if event.keycode == KEY_T:
_goto_next_stop()
if event.is_action_pressed("train_horn"):
UIEvents.toot_toot.emit(true)
#elif event.keycode == KEY_F:
#_test_manual_fireworks()
@@ -322,12 +328,12 @@ func _physics_process(delta: float) -> void:
train_move(delta)
func input_controls_management(delta: float) -> void:
if not is_inmotion: return
if Input.is_action_pressed("ui_up"):
if not is_inmotion or _is_photo_mode_active: return
if Input.is_action_pressed("train_speed_up"):
train_speed += manual_acceleration * delta
elif Input.is_action_pressed("ui_down"):
elif Input.is_action_pressed("train_speed_down"):
train_speed -= manual_acceleration * delta
elif Input.is_action_pressed("ui_text_backspace"):
elif Input.is_action_pressed("train_stop"):
train_speed = 0
train_speed = clamp(train_speed, speed_min, speed_max)