rubocop -a
This commit is contained in:
parent
e43218edbb
commit
f9819565e4
|
@ -28,7 +28,7 @@ WINDOW_HEIGHT = 500
|
||||||
|
|
||||||
class Gui < Gosu::Window
|
class Gui < Gosu::Window
|
||||||
def initialize
|
def initialize
|
||||||
super WINDOW_WIDTH, WINDOW_HEIGHT
|
super(WINDOW_WIDTH, WINDOW_HEIGHT)
|
||||||
self.caption = 'ruby teeworlds client'
|
self.caption = 'ruby teeworlds client'
|
||||||
@client = TeeworldsClient.new
|
@client = TeeworldsClient.new
|
||||||
@client.connect('localhost', 8303, detach: true)
|
@client.connect('localhost', 8303, detach: true)
|
||||||
|
|
|
@ -149,7 +149,7 @@ class GameServer
|
||||||
return if call_hook(:shutdown, Context.new(nil)).nil?
|
return if call_hook(:shutdown, Context.new(nil)).nil?
|
||||||
|
|
||||||
puts '[gameserver] disconnecting all clients ...'
|
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)
|
@server.send_ctrl_close(client, @server.shutdown_reason)
|
||||||
end
|
end
|
||||||
puts '[gameserver] shutting down ...'
|
puts '[gameserver] shutting down ...'
|
||||||
|
|
|
@ -105,6 +105,6 @@ class NetBase
|
||||||
end
|
end
|
||||||
@s.send(data, 0, ip, port)
|
@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
|
||||||
end
|
end
|
||||||
|
|
|
@ -440,7 +440,7 @@ class TeeworldsClient
|
||||||
data = packet.payload
|
data = packet.payload
|
||||||
if data.size.zero?
|
if data.size.zero?
|
||||||
puts 'Error: packet payload is empty'
|
puts 'Error: packet payload is empty'
|
||||||
puts packet.to_s
|
puts packet
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
chunks = BigChungusTheChunkGetter.get_chunks(data)
|
chunks = BigChungusTheChunkGetter.get_chunks(data)
|
||||||
|
@ -480,7 +480,7 @@ class TeeworldsClient
|
||||||
data = pck.first
|
data = pck.first
|
||||||
|
|
||||||
packet = Packet.new(data, '<')
|
packet = Packet.new(data, '<')
|
||||||
puts packet.to_s if @verbose
|
puts packet if @verbose
|
||||||
|
|
||||||
# process connless packets data
|
# process connless packets data
|
||||||
if packet.flags_control
|
if packet.flags_control
|
||||||
|
|
|
@ -15,8 +15,7 @@ require_relative 'game_server'
|
||||||
require_relative 'models/token'
|
require_relative 'models/token'
|
||||||
|
|
||||||
class Client
|
class Client
|
||||||
attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game
|
attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game, :authed
|
||||||
attr_accessor :authed
|
|
||||||
attr_reader :ack
|
attr_reader :ack
|
||||||
|
|
||||||
def initialize(attr = {})
|
def initialize(attr = {})
|
||||||
|
@ -423,7 +422,7 @@ class TeeworldsServer
|
||||||
packet.client = client
|
packet.client = client
|
||||||
end
|
end
|
||||||
|
|
||||||
puts packet.to_s if @verbose
|
puts packet if @verbose
|
||||||
on_packet(packet)
|
on_packet(packet)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue