online multiplayer chess game (note server currently down)
Diffstat (limited to 'Utils.gd')
-rw-r--r--Utils.gd11
1 files changed, 10 insertions, 1 deletions
diff --git a/Utils.gd b/Utils.gd
index 0c6e7a0..cfe5ec1 100644
--- a/Utils.gd
+++ b/Utils.gd
@@ -60,6 +60,15 @@ static func get_node_name(node) -> Array:
return ["", ""]
+func internet_available() -> bool:
+ var http = HTTPRequest.new()
+ add_child(http)
+ var httpurl = "https://1.1.1.1"
+ var returnable = http.request(httpurl) == OK
+ http.queue_free()
+ return returnable
+
+
func walk_dir(path = "res://assets/pieces") -> PoolStringArray: # walk the directory, finding the asset packs
var folders: PoolStringArray = [] # init the folders
var dir := Directory.new() # init the directory
@@ -71,7 +80,7 @@ func walk_dir(path = "res://assets/pieces") -> PoolStringArray: # walk the dire
folders.append(file_name) # add the folder
file_name = dir.get_next() # get the next file
else:
- printerr("An error occurred when trying to access the path " + path) # print the error
+ Log.err("An error occurred when trying to access the path " + path) # print the error
return folders # return the folders