Make server log look nice in non verbose mode

This commit is contained in:
ChillerDragon 2022-11-13 10:42:49 +01:00
parent 3358cc6608
commit fc48a53bbd
4 changed files with 5 additions and 3 deletions

View file

@ -68,6 +68,8 @@ class GameServer
packet.client.in_game = true
@server.send_server_info(packet.client, ServerInfo.new.to_a)
@server.send_game_info(packet.client, GameInfo.new.to_a)
puts "'#{packet.client.player.name}' joined the game"
end
def on_rcon_cmd(chunk, _packet)

View file

@ -76,7 +76,7 @@ class NetBase
header += str_bytes(@peer_token)
data = (header + payload).pack('C*')
puts "send to #{ip}:#{port}"
puts "send to #{ip}:#{port}" if @verbose
@s.send(data, 0, ip, port)
puts Packet.new(data, '>').to_s if @verbose || opts[:test]

View file

@ -115,7 +115,7 @@ class TeeworldsServer
on_message(chunk, packet)
return
end
puts "proccess chunk with msg: #{chunk.msg}"
puts "proccess chunk with msg: #{chunk.msg}" if @verbose
case chunk.msg
when NETMSG_INFO
@game_server.on_info(chunk, packet)

View file

@ -3,5 +3,5 @@
require_relative 'lib/teeworlds_server'
srv = TeeworldsServer.new(verbose: true)
srv = TeeworldsServer.new(verbose: false)
srv.run('127.0.0.1', 8303)