summary refs log tree commit diff stats
path: root/racing/manager.gd
blob: 0d29eff1c000b4d0abf1a3fb5c42d0db33a340bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
extends Node

var SCRIPT_multiplayer

var level
var start_pos
var end_pos
var lobby_id
var held_messages = []
var started_time


func everyone_ready():
	global._print("RM: Everyone Ready")

	var player = get_tree().get_root().get_node("Spatial/player")
	get_node("/root/Spatial").remove_child(get_node("/root/Spatial/blindfold"))
	var indicator = player.get_node("pivot/camera/achievement_label")
	var regular_font = indicator.get_font("font")
	indicator.visible = true
	indicator.text = "Destination:\n%s" % end_pos["title"]

	if end_pos.has("small_font") and end_pos["small_font"]:
		var dynamic_font = DynamicFont.new()
		dynamic_font.font_data = load("res://fonts/Lingo.ttf")
		dynamic_font.size = 96
		dynamic_font.outline_color = Color(0, 0, 0, 1)
		dynamic_font.outline_size = 2
		indicator.add_font_override("font", dynamic_font)

	yield(get_tree().create_timer(10), "timeout")

	if end_pos.has("small_font") and end_pos["small_font"]:
		indicator.add_font_override("font", regular_font)

	indicator.text = "3..."
	yield(get_tree().create_timer(1), "timeout")

	indicator.text = "2..."
	yield(get_tree().create_timer(1), "timeout")

	indicator.text = "1..."
	yield(get_tree().create_timer(0.5), "timeout")

	get_node("/root/Spatial/Multiplayer").send_timeout()


func start_timer():
	started_time = Time.get_ticks_msec()
	get_node("/root/Spatial/Timer").start()