Implemented offline mode

This commit is contained in:
Eduard Urbach 2024-02-12 09:48:58 +01:00
parent 18b20f33a5
commit 9ceaa3c649
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 9 additions and 3 deletions

View File

@ -1,12 +1,18 @@
extends Node extends Node
func _ready(): func _ready():
%Logout.success.emit() # %Logout.success.emit()
pause(true) pause(true)
%Login.success.connect(on_login) %Login.success.connect(on_login)
%Logout.success.connect(on_logout) %Logout.success.connect(on_logout)
%Login.send_login() # %Login.send_login()
Global.username = "Local"
Global.account_id = "test"
Global.auth_token = "test"
%Login.success.emit()
Global.player = %PlayerAdd.spawn_player(Global.account_id)
func _input(event): func _input(event):
if event.is_action_pressed("toggle_fullscreen"): if event.is_action_pressed("toggle_fullscreen"):

View File

@ -24,7 +24,6 @@ func handle_packet(data: PackedByteArray):
var player := spawn_player(player_id) var player := spawn_player(player_id)
player.position = server_position player.position = server_position
player.set_character_name(player_name) player.set_character_name(player_name)
Global.players.add(player)
func spawn_player(id: String) -> Player: func spawn_player(id: String) -> Player:
var player: Player var player: Player
@ -48,4 +47,5 @@ func spawn_player(id: String) -> Player:
player.controller = ProxyController.new(player) player.controller = ProxyController.new(player)
player.add_child(player.controller) player.add_child(player.controller)
Global.players.add(player)
return player return player