Skip to content

Commit

Permalink
Fix more sequence problems
Browse files Browse the repository at this point in the history
They never stop coming, do they
  • Loading branch information
LBPHacker committed Oct 12, 2023
1 parent cf4edd7 commit db31e46
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
28 changes: 18 additions & 10 deletions tptmp/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -401,28 +401,34 @@ 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

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

Expand All @@ -434,15 +440,17 @@ 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

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
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions tptmp/client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tptmp/common/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit db31e46

Please sign in to comment.