From 390840e6f01c757fab04e6cc5a7e36a92ae2394f Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Tue, 1 Nov 2022 13:56:19 +0100 Subject: [PATCH] Fixing drunk coders mess --- teeworlds.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/teeworlds.rb b/teeworlds.rb index 8976d9c..bff7b2c 100755 --- a/teeworlds.rb +++ b/teeworlds.rb @@ -59,7 +59,7 @@ class NetBase data = (header + payload).pack('C*') @s.send(data, 0, @ip, @port) - if @verbose + if @verbose || flags[:test] p = Packet.new(data, '>') puts p.to_s end @@ -121,7 +121,7 @@ class TwClient def send_enter_game() @netbase.send_packet( NetChunk.create_vital_header({vital: true}, 1) + - [pack_msg_id(NETMSG_READY)]) + [pack_msg_id(NETMSG_ENTERGAME, true)]) end ## @@ -130,10 +130,8 @@ class TwClient # Takes a NETMSGTYPE_CL_* integer # and returns a byte that can be send over # the network - # - # todo: does not support system flag yet - def pack_msg_id(msg_id) - msg_id << 1 + def pack_msg_id(msg_id, system = false) + (msg_id << 1) | (system ? 1 : 0) end def send_chat(str)