fix labels
This commit is contained in:
@@ -52,7 +52,7 @@ func _ready() -> void:
|
||||
build_train()
|
||||
_plan_stops()
|
||||
else:
|
||||
print("WARNING: Draw your Path3D!")
|
||||
print("WARNING: Draw Path3D for rails!")
|
||||
|
||||
func build_rails() -> void:
|
||||
var mat_wood = StandardMaterial3D.new()
|
||||
@@ -112,16 +112,16 @@ func build_rails() -> void:
|
||||
rail_piece.add_child(rail_dx)
|
||||
|
||||
func _plan_stops() -> void:
|
||||
var currnet_stops = []
|
||||
var current_stops = []
|
||||
for child in get_children():
|
||||
if child is Marker3D:
|
||||
var offset = curve.get_closest_offset(child.position)
|
||||
currnet_stops.append({
|
||||
current_stops.append({
|
||||
"offset": offset,
|
||||
"position": child.global_position
|
||||
})
|
||||
currnet_stops.sort_custom(func(a, b): return a["offset"] < b["offset"])
|
||||
for data in currnet_stops:
|
||||
current_stops.sort_custom(func(a, b): return a["offset"] < b["offset"])
|
||||
for data in current_stops:
|
||||
stop_offset.append(data["offset"])
|
||||
stops_position.append(data["position"])
|
||||
|
||||
@@ -130,9 +130,9 @@ func _input(event: InputEvent) -> void:
|
||||
if event.keycode == KEY_T:
|
||||
_goto_next_stop()
|
||||
elif event.keycode == KEY_F:
|
||||
_test_manual_fires()
|
||||
_test_manual_fireworks()
|
||||
|
||||
func _test_manual_fires() -> void:
|
||||
func _test_manual_fireworks() -> void:
|
||||
if fireworks_scene == null or train_instance == null: return
|
||||
|
||||
var firework_number = randi_range(5, 8)
|
||||
@@ -146,8 +146,8 @@ func _test_manual_fires() -> void:
|
||||
|
||||
if fire_root.has_method("set_color"):
|
||||
fire_root.set_color(fireworks_colors.pick_random())
|
||||
if fire_root.has_method("turnon"):
|
||||
fire_root.turnon()
|
||||
if fire_root.has_method("turn_on"):
|
||||
fire_root.turn_on()
|
||||
|
||||
await get_tree().create_timer(randf_range(0.2, 0.6)).timeout
|
||||
|
||||
@@ -260,8 +260,8 @@ func _execute_stop(go_forward: bool = true) -> void:
|
||||
|
||||
if fire_root.has_method("set_color"):
|
||||
fire_root.set_color(fireworks_colors.pick_random())
|
||||
if fire_root.has_method("turnon"):
|
||||
fire_root.turnon()
|
||||
if fire_root.has_method("turn_on"):
|
||||
fire_root.turn_on()
|
||||
|
||||
await get_tree().create_timer(randf_range(0.3, 0.8)).timeout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user