rubocop -a

This commit is contained in:
ChillerDragon 2024-01-20 22:33:25 +08:00
parent e43218edbb
commit f9819565e4
6 changed files with 8 additions and 9 deletions

View file

@ -28,7 +28,7 @@ WINDOW_HEIGHT = 500
class Gui < Gosu::Window
def initialize
super WINDOW_WIDTH, WINDOW_HEIGHT
super(WINDOW_WIDTH, WINDOW_HEIGHT)
self.caption = 'ruby teeworlds client'
@client = TeeworldsClient.new
@client.connect('localhost', 8303, detach: true)

View file

@ -149,7 +149,7 @@ class GameServer
return if call_hook(:shutdown, Context.new(nil)).nil?
puts '[gameserver] disconnecting all clients ...'
@server.clients.each do |id, client|
@server.clients.each do |_id, client|
@server.send_ctrl_close(client, @server.shutdown_reason)
end
puts '[gameserver] shutting down ...'

View file

@ -105,6 +105,6 @@ class NetBase
end
@s.send(data, 0, ip, port)
puts Packet.new(data, '>').to_s if @verbose || opts[:test]
puts Packet.new(data, '>') if @verbose || opts[:test]
end
end

View file

@ -27,7 +27,7 @@ class Packet
flags_byte = @data[0].unpack('B*')
@flags = PacketFlags.new(flags_byte.first[2..5]).hash
@payload = @data[PACKET_HEADER_SIZE..]
return unless flags_compressed
return unless flags_compressed
@payload = @huffman.decompress(@payload.unpack('C*'))
@payload = @payload.pack('C*')

View file

@ -440,7 +440,7 @@ class TeeworldsClient
data = packet.payload
if data.size.zero?
puts 'Error: packet payload is empty'
puts packet.to_s
puts packet
return
end
chunks = BigChungusTheChunkGetter.get_chunks(data)
@ -480,7 +480,7 @@ class TeeworldsClient
data = pck.first
packet = Packet.new(data, '<')
puts packet.to_s if @verbose
puts packet if @verbose
# process connless packets data
if packet.flags_control

View file

@ -15,8 +15,7 @@ require_relative 'game_server'
require_relative 'models/token'
class Client
attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game
attr_accessor :authed
attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game, :authed
attr_reader :ack
def initialize(attr = {})
@ -423,7 +422,7 @@ class TeeworldsServer
packet.client = client
end
puts packet.to_s if @verbose
puts packet if @verbose
on_packet(packet)
end
end