@ -3,11 +3,12 @@ extends HTTPRequest
var is_update_payload = false
var save_to
var time = 0
export var domain = " http://ipv4.cosinegaming.com "
func _ready ( ) :
connect ( " request_completed " , self , " _request_completed " )
# Check if we need an update
request ( " https://www.cosinegaming.com /static/vanagloria/version.json" , [ ] , false )
request ( domain + " /static/vanagloria/version.json " , [ ] , false )
set_process ( true )
func _request_completed ( result , response_code , headers , body ) :
@ -27,7 +28,7 @@ func _request_completed(result, response_code, headers, body):
save_to = server . save_location
use_threads = true
print ( " Need to update! Downloading " + server . download_path )
request ( server . download_path )
request ( domain + server . download_path )
else :
print ( " Update recieved. Saving to " + save_to )
var file = File . new ( )
@ -39,7 +40,9 @@ func _request_completed(result, response_code, headers, body):
func _process ( delta ) :
time += delta
var fake_progress = 1 - ( 0.8 / time )
get_node ( " ../ProgressBar " ) . value = 100 * fake_progress
# var progress = get_downloaded_bytes() / get_body_size()
var progress = fake_progress
get_node ( " ../ProgressBar " ) . value = 100 * progress
func restart ( ) :
# Pass on args to new instance, then quit