From db31e46d1d31e504350206882fd19a4b2dd0d124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Thu, 12 Oct 2023 10:38:20 +0200 Subject: [PATCH] Fix more sequence problems They never stop coming, do they --- tptmp/client/client.lua | 28 ++++++++++++++++++---------- tptmp/client/init.lua | 7 +++---- tptmp/common/config.lua | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tptmp/client/client.lua b/tptmp/client/client.lua index fc2566f..adfabf5 100644 --- a/tptmp/client/client.lua +++ b/tptmp/client/client.lua @@ -401,17 +401,21 @@ function client_i:handle_flood_39_() end member.last_tool = member[index_to_lrax[index]] local x, y = self:read_xy_12_() - util.flood_any(x, y, member.last_tool, -1, -1, member) + if member.last_tool then + util.flood_any(x, y, member.last_tool, -1, -1, member) + end end function client_i:handle_lineend_40_() local member = self:member_prefix_() local x1, y1 = member.line_x, member.line_y local x2, y2 = self:read_xy_12_() - if member.kmod_a then - x2, y2 = util.line_snap_coords(x1, y1, x2, y2) + if member:can_render() and x1 and member.last_tool then + if member.kmod_a then + x2, y2 = util.line_snap_coords(x1, y1, x2, y2) + end + util.create_line_any(x1, y1, x2, y2, member.size_x, member.size_y, member.last_tool, member.shape, member, false) end - util.create_line_any(x1, y1, x2, y2, member.size_x, member.size_y, member.last_tool, member.shape, member, false) member.line_x, member.line_y = nil, nil end @@ -419,10 +423,12 @@ function client_i:handle_rectend_41_() local member = self:member_prefix_() local x1, y1 = member.rect_x, member.rect_y local x2, y2 = self:read_xy_12_() - if member.kmod_a then - x2, y2 = util.rect_snap_coords(x1, y1, x2, y2) + if member:can_render() and x1 and member.last_tool then + if member.kmod_a then + x2, y2 = util.rect_snap_coords(x1, y1, x2, y2) + end + util.create_box_any(x1, y1, x2, y2, member.last_tool, member) end - util.create_box_any(x1, y1, x2, y2, member.last_tool, member) member.rect_x, member.rect_y = nil, nil end @@ -434,7 +440,9 @@ function client_i:handle_pointsstart_42_() end member.last_tool = member[index_to_lrax[index]] local x, y = self:read_xy_12_() - util.create_parts_any(x, y, member.size_x, member.size_y, member.last_tool, member.shape, member) + if member:can_render() and member.last_tool then + util.create_parts_any(x, y, member.size_x, member.size_y, member.last_tool, member.shape, member) + end member.last_x = x member.last_y = y end @@ -442,7 +450,7 @@ end function client_i:handle_pointscont_43_() local member = self:member_prefix_() local x, y = self:read_xy_12_() - if member.last_x then + if member:can_render() and member.last_tool and member.last_x then util.create_line_any(member.last_x, member.last_y, x, y, member.size_x, member.size_y, member.last_tool, member.shape, member, true) end member.last_x = x @@ -1181,7 +1189,7 @@ function client_i:tick_sim_() for _, member in pairs(self.id_to_member) do if member:can_render() then local lx, ly = member.line_x, member.line_y - if member.last_tool == util.from_tool.DEFAULT_UI_WIND and not (member.select or member.place) and lx then + if lx and member.last_tool == util.from_tool.DEFAULT_UI_WIND and not (member.select or member.place) and lx then local px, py = member.pos_x, member.pos_y if member.kmod_a then px, py = util.line_snap_coords(lx, ly, px, py) diff --git a/tptmp/client/init.lua b/tptmp/client/init.lua index 3a5330c..8ba75aa 100644 --- a/tptmp/client/init.lua +++ b/tptmp/client/init.lua @@ -281,8 +281,8 @@ local function run() sx, sy = 0, 0 end local tool = member.last_tool or member.tool_l - local tool_name = util.to_tool[tool] or decode_rulestring(tool) or "UNKNOWN" - local tool_class = util.xid_class[tool] + local tool_name = (tool and util.to_tool[tool] or decode_rulestring(tool)) or "UNKNOWN" + local tool_class = tool and util.xid_class[tool] if elem[tool_name] and tool ~= 0 and tool_name ~= "UNKNOWN" then local real_name = elem.property(elem[tool_name], "Name") if real_name ~= "" then @@ -300,8 +300,7 @@ local function run() local repl_tool_name if member.bmode ~= 0 then local repl_tool = member.tool_x - repl_tool_name = util.to_tool[repl_tool] or "UNKNOWN" - local repl_tool_class = util.xid_class[repl_tool] + repl_tool_name = repl_tool and util.to_tool[repl_tool] or "UNKNOWN" if elem[repl_tool_name] and repl_tool ~= 0 and repl_tool_name ~= "UNKNOWN" then local real_name = elem.property(elem[repl_tool_name], "Name") if real_name ~= "" then diff --git a/tptmp/common/config.lua b/tptmp/common/config.lua index 5477e59..f593a8e 100644 --- a/tptmp/common/config.lua +++ b/tptmp/common/config.lua @@ -6,7 +6,7 @@ return { -- *********************************************************************** -- * Protocol version, between 0 and 254. 255 is reserved for future use. - version = 30, + version = 31, -- * Client-to-server message size limit, between 0 and 255, the latter -- limit being imposted by the protocol.