summary refs log tree commit diff stats
path: root/racing
diff options
context:
space:
mode:
Diffstat (limited to 'racing')
-rw-r--r--racing/lobby.gd18
-rw-r--r--racing/manager.gd12
-rw-r--r--racing/router.gd22
3 files changed, 36 insertions, 16 deletions
diff --git a/racing/lobby.gd b/racing/lobby.gd index d326098..3a04460 100644 --- a/racing/lobby.gd +++ b/racing/lobby.gd
@@ -247,16 +247,10 @@ func _read_p2p_packet() -> void:
247 Steam.P2P_SEND_RELIABLE_WITH_BUFFERING, 247 Steam.P2P_SEND_RELIABLE_WITH_BUFFERING,
248 false 248 false
249 ) 249 )
250 if "start_x" in data: 250 if "start_name" in data:
251 race_manager.level = data["level"] 251 race_manager.level = data["level"]
252 race_manager.start_pos = { 252 race_manager.start_pos = router.get_area(data["level"], data["start_name"])
253 "title": data["start_name"], 253 race_manager.end_pos = router.get_area(data["level"], data["end_name"])
254 "pos": [int(data["start_x"]), int(data["start_y"]), int(data["start_z"])]
255 }
256 race_manager.end_pos = {
257 "title": data["end_name"],
258 "pos": [int(data["end_x"]), int(data["end_y"]), int(data["end_z"])]
259 }
260 254
261 is_starting = true 255 is_starting = true
262 _start_game() 256 _start_game()
@@ -336,13 +330,7 @@ func _main_button_pressed():
336 { 330 {
337 "level": route[0], 331 "level": route[0],
338 "start_name": start_pos["title"], 332 "start_name": start_pos["title"],
339 "start_x": str(start_pos["pos"][0]),
340 "start_y": str(start_pos["pos"][1]),
341 "start_z": str(start_pos["pos"][2]),
342 "end_name": end_pos["title"], 333 "end_name": end_pos["title"],
343 "end_x": str(end_pos["pos"][0]),
344 "end_y": str(end_pos["pos"][1]),
345 "end_z": str(end_pos["pos"][2]),
346 }, 334 },
347 RECIPIENT_BROADCAST_ALL, 335 RECIPIENT_BROADCAST_ALL,
348 Steam.P2P_SEND_RELIABLE, 336 Steam.P2P_SEND_RELIABLE,
diff --git a/racing/manager.gd b/racing/manager.gd index 573e50a..0d29eff 100644 --- a/racing/manager.gd +++ b/racing/manager.gd
@@ -16,11 +16,23 @@ func everyone_ready():
16 var player = get_tree().get_root().get_node("Spatial/player") 16 var player = get_tree().get_root().get_node("Spatial/player")
17 get_node("/root/Spatial").remove_child(get_node("/root/Spatial/blindfold")) 17 get_node("/root/Spatial").remove_child(get_node("/root/Spatial/blindfold"))
18 var indicator = player.get_node("pivot/camera/achievement_label") 18 var indicator = player.get_node("pivot/camera/achievement_label")
19 var regular_font = indicator.get_font("font")
19 indicator.visible = true 20 indicator.visible = true
20 indicator.text = "Destination:\n%s" % end_pos["title"] 21 indicator.text = "Destination:\n%s" % end_pos["title"]
21 22
23 if end_pos.has("small_font") and end_pos["small_font"]:
24 var dynamic_font = DynamicFont.new()
25 dynamic_font.font_data = load("res://fonts/Lingo.ttf")
26 dynamic_font.size = 96
27 dynamic_font.outline_color = Color(0, 0, 0, 1)
28 dynamic_font.outline_size = 2
29 indicator.add_font_override("font", dynamic_font)
30
22 yield(get_tree().create_timer(10), "timeout") 31 yield(get_tree().create_timer(10), "timeout")
23 32
33 if end_pos.has("small_font") and end_pos["small_font"]:
34 indicator.add_font_override("font", regular_font)
35
24 indicator.text = "3..." 36 indicator.text = "3..."
25 yield(get_tree().create_timer(1), "timeout") 37 yield(get_tree().create_timer(1), "timeout")
26 38
diff --git a/racing/router.gd b/racing/router.gd index ea3693f..627412d 100644 --- a/racing/router.gd +++ b/racing/router.gd
@@ -72,7 +72,13 @@ const LL2_AREAS = [
72 {"title": "The Sapient", "pos": [-36, 36, -36]}, 72 {"title": "The Sapient", "pos": [-36, 36, -36]},
73 {"title": "The Ethereal", "pos": [-42, 0, -22]}, 73 {"title": "The Ethereal", "pos": [-42, 0, -22]},
74 {"title": "The Learned", "pos": [34, 1, -64], "no_start": true}, 74 {"title": "The Learned", "pos": [34, 1, -64], "no_start": true},
75 {"title": "Whispers Behind Quiet Walls", "pos": [44, 0, -51], "no_start": true, "long": true}, 75 {
76 "title": "Whispers Behind Quiet Walls",
77 "pos": [44, 0, -51],
78 "no_start": true,
79 "long": true,
80 "small_font": true
81 },
76 {"title": "The Lunar", "pos": [45, 0, -22]}, 82 {"title": "The Lunar", "pos": [45, 0, -22]},
77 {"title": "The Arcadian", "pos": [86, 0, -53]}, 83 {"title": "The Arcadian", "pos": [86, 0, -53]},
78 {"title": "The Frozen", "pos": [84, 0, -27]}, 84 {"title": "The Frozen", "pos": [84, 0, -27]},
@@ -177,3 +183,17 @@ func choose_route(levelchoice: int, lengthchoice: int):
177 found = true 183 found = true
178 184
179 return [level_name, start_pos, end_pos] 185 return [level_name, start_pos, end_pos]
186
187
188func get_area(level, name):
189 var areas_slot
190 if level == "level1":
191 areas_slot = LL1_AREAS
192 elif level == "level2":
193 areas_slot = LL2_AREAS
194
195 for item in areas_slot:
196 if item["title"] == name:
197 return item
198
199 return {"title": "Error"}