summaryrefslogtreecommitdiff
path: root/scripts/Globals.gd
diff options
context:
space:
mode:
authorAnson Bridges <bridges.anson@gmail.com>2025-08-19 12:38:02 -0700
committerAnson Bridges <bridges.anson@gmail.com>2025-08-19 12:38:02 -0700
commit255fbf19cc9499ef384d41f68515da5e49e8a3ce (patch)
tree13c838229198383b24644f613787e34842ea7ab2 /scripts/Globals.gd
parentf087c6a98b1da55525a6e3c1d7c82477f82eb5cd (diff)
added menus, reworking GC client architecture
Diffstat (limited to 'scripts/Globals.gd')
-rw-r--r--scripts/Globals.gd28
1 files changed, 27 insertions, 1 deletions
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]