class_name LoginServer extends Server signal logged_in(packet: LoginServerLoginSuccessPacket) @warning_ignore("shadowed_variable") func _init(host: String, port: int = 6900) -> void: super._init(host, port) func login(username: String, password: String): var login_server_login_packet = LoginServerLoginPacket.new() login_server_login_packet.username = username login_server_login_packet.password = password peer.put_data(login_server_login_packet.to_bytes()) var packet = await received_packet if packet is LoginServerLoginSuccessPacket: print(inst_to_dict(packet)) logged_in.emit(packet) func get_keep_alive_timer() -> Timer: var login_server_keep_alive_timer = Timer.new() login_server_keep_alive_timer.name = "LoginServerKeepAliveTimer" login_server_keep_alive_timer.autostart = true login_server_keep_alive_timer.one_shot = false login_server_keep_alive_timer.wait_time = 30.0 # 60.0 login_server_keep_alive_timer.timeout.connect(func(): var login_server_keep_alive_packet := LoginServerKeepAlivePacket.new() login_server_keep_alive_packet.user_name = "dweipert" send(login_server_keep_alive_packet) ) return login_server_keep_alive_timer