Refresh master server entries every 5 seconds
This commit is contained in:
parent
6ea963f1f6
commit
546d83bf1d
1 changed files with 7 additions and 0 deletions
|
@ -1,10 +1,13 @@
|
|||
extends Control
|
||||
|
||||
const REFRESH_SERVER_DELAY = 5.0
|
||||
|
||||
export var scale = 4 setget set_scale
|
||||
export var upThreshold = 1.0/59.0
|
||||
export var downThreshold = 1.0/30.0
|
||||
|
||||
export var delay = 1.0
|
||||
export var refresh_server_remaining = REFRESH_SERVER_DELAY
|
||||
|
||||
onready var viewport = $Viewport
|
||||
onready var background = $Background
|
||||
|
@ -20,6 +23,10 @@ func _ready() -> void:
|
|||
request_servers()
|
||||
|
||||
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
|
||||
if delay > 0:
|
||||
delay -= delta
|
||||
|
|
Reference in a new issue