Skip to content

Commit

Permalink
rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Jan 20, 2024
1 parent e43218e commit f981956
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/08_gui_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(attr = {})

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)
Expand Down
2 changes: 1 addition & 1 deletion lib/game_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def on_shutdown
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 ...'
Expand Down
2 changes: 1 addition & 1 deletion lib/net_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ def send_packet(payload, opts = { chunks: 1, client: nil, addr: nil })
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
2 changes: 1 addition & 1 deletion lib/packet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(data, prefix = '')
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*')
Expand Down
4 changes: 2 additions & 2 deletions lib/teeworlds_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def process_server_packet(packet)
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)
Expand Down Expand Up @@ -480,7 +480,7 @@ def tick
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
Expand Down
5 changes: 2 additions & 3 deletions lib/teeworlds_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
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 = {})
Expand Down Expand Up @@ -423,7 +422,7 @@ def tick
packet.client = client
end

puts packet.to_s if @verbose
puts packet if @verbose
on_packet(packet)
end
end

0 comments on commit f981956

Please sign in to comment.