NagPlace.gd 623 B

1234567891011121314151617181920212223242526272829303132333435
  1. extends Spatial
  2. var lab
  3. var tim
  4. var size = 0.019
  5. export var col = Color8(255,255,255)
  6. func _ready():
  7. scale=Vector3(1,1,1)*size
  8. func _input(event):
  9. if event.is_action_pressed("ui_cancel"):
  10. if is_instance_valid(lab) and "quit" in lab.text: #uuuugly
  11. get_tree().quit()
  12. func ask_exit():
  13. nag ("repeat to quit")
  14. func nag(text = "transport error"):
  15. lab = Label3D.new()
  16. lab.text = text
  17. lab.color = col
  18. lab.power = 3
  19. add_child(lab)
  20. tim = Timer.new()
  21. tim.wait_time = 2
  22. add_child(tim)
  23. tim.start()
  24. tim.one_shot=true
  25. tim.connect("timeout",self,"destruct")
  26. func destruct():
  27. for n in [lab,tim]:
  28. n.queue_free()