Refresh master server entries every 5 seconds

This commit is contained in:
Hamcha 2020-07-14 09:21:52 +02:00
parent 6ea963f1f6
commit 546d83bf1d
Signed by: hamcha
GPG key ID: 41467804B19A3315

View file

@ -1,10 +1,13 @@
extends Control extends Control
const REFRESH_SERVER_DELAY = 5.0
export var scale = 4 setget set_scale export var scale = 4 setget set_scale
export var upThreshold = 1.0/59.0 export var upThreshold = 1.0/59.0
export var downThreshold = 1.0/30.0 export var downThreshold = 1.0/30.0
export var delay = 1.0 export var delay = 1.0
export var refresh_server_remaining = REFRESH_SERVER_DELAY
onready var viewport = $Viewport onready var viewport = $Viewport
onready var background = $Background onready var background = $Background
@ -20,6 +23,10 @@ func _ready() -> void:
request_servers() request_servers()
func _process(delta: float) -> void: func _process(delta: float) -> void:
refresh_server_remaining -= delta
if refresh_server_remaining <= 0:
request_servers()
refresh_server_remaining = REFRESH_SERVER_DELAY
# Give the system time to adjust # Give the system time to adjust
if delay > 0: if delay > 0:
delay -= delta delay -= delta