WarpZone.gd 842 B

1234567891011121314151617181920212223242526272829
  1. class_name WarpZone
  2. extends Node
  3. @export var enable_sides := true
  4. @export var pipe_destinations := [-1, -1, -1]
  5. func _ready() -> void:
  6. if enable_sides == false:
  7. $Pipes/Right.queue_free()
  8. $Pipes/Left.queue_free()
  9. var idx := 0
  10. for i in [$Pipes/Left/TextLabel, $Pipes/Middle/TextLabel, $Pipes/Right/TextLabel]:
  11. if pipe_destinations[idx] > 9:
  12. i.text = ["A", "B", "C", "D"][int(pipe_destinations[idx]) % 10]
  13. else:
  14. i.text = str(pipe_destinations[idx])
  15. idx += 1
  16. func activate() -> void:
  17. CameraHandler.cam_locked = true
  18. for i in get_tree().get_nodes_in_group("Labels"):
  19. i.show()
  20. for i in get_tree().get_nodes_in_group("Plants"):
  21. i.queue_free()
  22. if enable_sides:
  23. $Pipes/Left/Pipe.world_num = pipe_destinations[0]
  24. $Pipes/Right/Pipe.world_num = pipe_destinations[2]
  25. $Pipes/Middle/Pipe.world_num = pipe_destinations[1]