From 255fbf19cc9499ef384d41f68515da5e49e8a3ce Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Tue, 19 Aug 2025 12:38:02 -0700 Subject: added menus, reworking GC client architecture --- scripts/Globals.gd | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'scripts/Globals.gd') diff --git a/scripts/Globals.gd b/scripts/Globals.gd index 18f3d19..3603dbd 100644 --- a/scripts/Globals.gd +++ b/scripts/Globals.gd @@ -1,7 +1,33 @@ extends Node # Y R B G W Cy Pk O P dG -const colors = [ Color(1, 1, 0), Color(1, 0, 0), Color(0.3, 0.3, 1), Color(0, 0.8, 0), Color(1, 1, 1), Color(0, 1, 1), Color(1, .35, 1), Color(1, 0.4, 0), Color(0.38, 0, 0.38), Color(0, 0.4, 0) ] +const colors : Array = [ Color(1, 1, 0), Color(1, 0, 0), Color(0.3, 0.3, 1), Color(0, 0.8, 0), Color(1, 1, 1), Color(0, 1, 1), Color(1, .35, 1), Color(1, 0.4, 0), Color(0.38, 0, 0.38), Color(0, 0.4, 0) ] + +const airport_names_file : String = 'res://resources/airports.txt' +var airport_names : Array = [] + +const DEFAULT_GC_URL : String = "ws://192.168.7.112:8181" +var GC_URL : String = "ws://192.168.7.112:8181" func _ready(): + load_airport_names() set_process(false) + +func update_gc_url(new_url : String): + GC_URL = new_url + + + +func load_airport_names(): + var f = File.new() + f.open(airport_names_file, File.READ) + var index = 1 + while not f.eof_reached(): # iterate through all lines until the end of file is reached + airport_names.push_back(f.get_line()) + f.close() + +func get_random_airport_name(exceptions=[]): + var name_index:int = randi() % len(airport_names) + while airport_names[name_index] in exceptions: + name_index = randi() % len(airport_names) + return airport_names[name_index] -- cgit v1.2.3