Added thread safe packet handlers
This commit is contained in:
@ -15,9 +15,13 @@ func handle_packet(data: PackedByteArray):
|
||||
var player_id := buffer.get_string()
|
||||
var player := Global.players.get_player(player_id)
|
||||
var message := buffer.get_utf8_string()
|
||||
message = escape_bbcode(message)
|
||||
|
||||
Log.info("%s: %s" % [player.name, message])
|
||||
message_received.emit("[color=#e0e0e0]%s:[/color] %s" % [player.name, escape_bbcode(message)])
|
||||
emit.call_deferred(player.name, message)
|
||||
|
||||
func emit(player_name: String, message: String):
|
||||
message_received.emit("[color=#e0e0e0]%s:[/color] %s" % [player_name, message])
|
||||
|
||||
func escape_bbcode(text: String) -> String:
|
||||
return text.replace("[", "[lb]")
|
||||
|
Reference in New Issue
Block a user