Added rich log messages
This commit is contained in:
parent
9149b0e626
commit
cb066f409a
@ -16,6 +16,6 @@ func handle_packet(data: PackedByteArray):
|
||||
var player := Global.players.get_player(player_id)
|
||||
var message := buffer.get_utf8_string()
|
||||
|
||||
print("[%s] %s: %s" % [Global.account.name, player.name, message])
|
||||
%Client.log("%s: %s" % [player.name, message])
|
||||
message_received.emit("[color=#808080]%s:[/color] %s" % [player.name, message])
|
||||
|
@ -32,3 +32,6 @@ func update_statistics():
|
||||
func send(data: PackedByteArray):
|
||||
socket.put_packet(data)
|
||||
upload += data.size()
|
||||
|
||||
func log(message: String):
|
||||
print_rich("[color=#808080][%s][/color] %s" % [Global.account.name, message])
|
||||
|
@ -9,7 +9,7 @@ func handle_packet(data: PackedByteArray):
|
||||
|
||||
var error := buffer.get_8()
|
||||
if error != 0:
|
||||
print("[%s] Login failed." % Global.account.name)
|
||||
%Client.log("[%s] Login failed." % Global.account.name)
|
||||
failure.emit()
|
||||
return
|
||||
|
||||
@ -27,7 +27,7 @@ func send_login():
|
||||
buffer.put_u8(Packet.LOGIN)
|
||||
buffer.put_data(JSON.stringify([Global.account.name, password]).to_utf8_buffer())
|
||||
%Client.send(buffer.data_array)
|
||||
print("[%s] Connecting..." % Global.account.name)
|
||||
%Client.log("Connecting...")
|
||||
|
||||
func is_logged_in() -> bool:
|
||||
return Global.account.auth_token != ""
|
||||
|
@ -19,7 +19,7 @@ func handle_packet(data: PackedByteArray):
|
||||
server_position.y = buffer.get_float()
|
||||
server_position.z = buffer.get_float()
|
||||
|
||||
print("[%s] Add player: %s %s @ %v" % [Global.account.name, player_id, player_name, server_position])
|
||||
%Client.log("Add player: %s %s @ %v" % [player_id, player_name, server_position])
|
||||
|
||||
var player := spawn_player(player_id)
|
||||
player.position = server_position
|
||||
|
@ -2,5 +2,5 @@ extends PacketHandler
|
||||
|
||||
func handle_packet(data: PackedByteArray):
|
||||
var player_id := data.get_string_from_ascii()
|
||||
print("[%s] Remove player: %s" % [Global.account.name, player_id])
|
||||
%Client.log("Remove player: %s" % player_id)
|
||||
Global.players.remove(player_id)
|
Loading…
Reference in New Issue
Block a user