From 15139ceb684d6fdf963a918234305cc1df1f9084 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sat, 12 Nov 2022 11:38:46 +0100 Subject: [PATCH] Ignore input packets from clients --- lib/game_server.rb | 9 +++++++++ lib/teeworlds_server.rb | 2 ++ 2 files changed, 11 insertions(+) diff --git a/lib/game_server.rb b/lib/game_server.rb index 57d85cd..ab9c3c4 100644 --- a/lib/game_server.rb +++ b/lib/game_server.rb @@ -62,4 +62,13 @@ class GameServer @server.send_server_info(packet.client, ServerInfo.new.to_a) @server.send_game_info(packet.client, GameInfo.new.to_a) end + + def on_input(chunk, packet) + # vanilla server responds to input with 2 chunks + # - input_timing + # - snap (empty) + + # we do nothing for now + # TODO: do something + end end diff --git a/lib/teeworlds_server.rb b/lib/teeworlds_server.rb index ceaeaf1..f476b64 100644 --- a/lib/teeworlds_server.rb +++ b/lib/teeworlds_server.rb @@ -98,6 +98,8 @@ class TeeworldsServer @game_server.on_ready(chunk, packet) when NETMSG_ENTERGAME @game_server.on_enter_game(chunk, packet) + when NETMSG_INPUT + @game_server.on_input(chunk, packet) else puts "Unsupported system msg: #{chunk.msg}" exit(1)