Client info is actually used to display join msgs

Looked at the c++ client code and it actually does that.
The entergame message is only used in demos. Yeet on those.
This commit is contained in:
ChillerDragon 2022-11-05 11:34:34 +01:00
parent d71a198219
commit 8fe595b0a6
3 changed files with 3 additions and 23 deletions

View file

@ -38,11 +38,6 @@ class GameClient
@players = {}
end
def on_client_enter(chunk)
puts "ON CLIENT ENTER"
puts chunk
end
def on_client_info(chunk)
# puts "Got playerinfo flags: #{chunk.flags}"
u = Unpacker.new(chunk.data[1..])
@ -86,6 +81,9 @@ class GameClient
@client.send_msg_startinfo
end
def on_emoticon(chunk)
end
def on_map_change(chunk)
context = Context.new(@client, chunk: chunk)
if @client.hooks[:map_change]
@ -99,14 +97,6 @@ class GameClient
end
def on_chat(chunk)
# 06 01 00 40 41 00
# msg mode cl_id trgt A nullbyte?
# all -1
# mode = chunk.data[1]
# client_id = chunk.data[2]
# target = chunk.data[3]
# msg = chunk.data[4..]
u = Unpacker.new(chunk.data[1..])
data = {
mode: u.get_int(),

View file

@ -265,7 +265,6 @@ class TeeworldsClient
case chunk.msg
when NETMSGTYPE_SV_READYTOENTER then @game_client.on_ready_to_enter(chunk)
when NETMSGTYPE_SV_CLIENTINFO then @game_client.on_client_info(chunk)
when NETMSGTYPE_DE_CLIENTENTER then @game_client.on_client_enter(chunk)
when NETMSGTYPE_SV_EMOTICON then @game_client.on_emoticon(chunk)
when NETMSGTYPE_SV_CHAT then @game_client.on_chat(chunk)
else

View file

@ -27,9 +27,6 @@ args[:port] = args[:port] || 8303
client = TeeworldsClient.new(verbose: args[:verbose])
client.set_startinfo(
name: "ruby gamer")
client.on_chat do |msg|
puts "[chat] #{msg}"
end
@ -39,10 +36,4 @@ Signal.trap('INT') do
end
# connect and detach thread
client.connect(args[:ip], args[:port], detach: true)
# after 2 seconds reconnect
# and block the main thread
sleep 2
client.connect(args[:ip], args[:port], detach: false)