change server history appending

This commit is contained in:
Teatov 2025-02-13 21:28:29 +10:00
parent 3d53e70e7b
commit 3568f927fc

View File

@ -74,8 +74,13 @@ func _on_join_button_pressed() -> void:
if not (address in _server_history):
_server_history.append(address)
var file := FileAccess.open(SERVER_HISTORY_PATH, FileAccess.WRITE)
file.store_string("\n".join(_server_history))
var file := FileAccess.open(SERVER_HISTORY_PATH, FileAccess.READ_WRITE)
if file:
file.seek_end()
file.store_line(address)
else:
file = FileAccess.open(SERVER_HISTORY_PATH, FileAccess.WRITE)
file.store_line(address)
Networker.set_local_player_info(_name_edit.text)
Networker.join_game(address)