Skip to content

Commit

Permalink
Merge pull request #50 from SwissalpS/multinodeTrouble
Browse files Browse the repository at this point in the history
fix multinode trouble in field mode
  • Loading branch information
SwissalpS authored Feb 25, 2024
2 parents 2cd312b + d138cb3 commit fa89c9f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
20240225 * SwissalpS patched a crash situation with multinode-nodes. Thanks frogTheSecond and Huhhila for detecting and reporting.
20221107 * fluxionary fixed typo unkown -> unknown
20220830 * SwissalpS fixed de translation typo. Thanks Niklp09 for reporting.
20220626 * SwissalpS fixed case where other drops were prefered from actual node that user tried to set to.
20220624 * SX added technic.plus compat fix
Expand Down
2 changes: 1 addition & 1 deletion compat/ehlphabet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local skip = {}
for _, n in ipairs(exceptions) do skip[n] = true end

local function ehlphabet_number_sticker(item_name)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

return item_name:match('^ehlphabet:([0-9]+)'),
item_name:find('_sticker$') and true
Expand Down
4 changes: 2 additions & 2 deletions compat/letters.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if not minetest.get_modpath('letters') then return end
-- for inspection tool
local S = replacer.S
local function add_recipe_u(item_name, _, recipes)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

local input, letter = item_name:match('^(.+)_letter_(.)u$')
if not input then return end
Expand All @@ -21,7 +21,7 @@ replacer.register_craft_method('letters:upper', 'letters:letter_cutter_upper', a


local function add_recipe_l(item_name, _, recipes)
if not item_name or not 'string' == type(item_name) then return end
if not item_name or 'string' ~= type(item_name) then return end

local input, letter = item_name:match('^(.+)_letter_(.)l$')
if not input then return end
Expand Down
2 changes: 1 addition & 1 deletion compat/wine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in_out['wine:glass_coffee_liquor'] = 'farming:coffee_beans'
in_out['wine:glass_champagne'] = 'wine:glass_champagne_raw'

local function add_recipe(item_name, _, recipes)
if not 'string' == type(item_name)
if 'string' ~= type(item_name)
or not item_name:find('^wine:glass_') then return end

-- this one is an exception
Expand Down
2 changes: 1 addition & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-- Changelog: see CHANGELOG file

replacer = {}
replacer.version = 20220830
replacer.version = 20240225

replacer.has_bakedclay = minetest.get_modpath('bakedclay')
replacer.has_basic_dyes = minetest.get_modpath('dye')
Expand Down
12 changes: 12 additions & 0 deletions replacer/replacer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,18 @@ function replacer.on_use(itemstack, player, pt, right_clicked)
end
end
end
-- with multinode-nodes it is possible to click the
-- node in a way that none of the coordinates of
-- ``normal`` is 0, leading to empty ``dirs`` and crash
-- when passing nil to vector functions.
-- Player can click on another part of the node to
-- have success.
if 0 == #dirs then
r.play_sound(name, true)
r.inform(name, rb.no_pos)
return
end

-- The normal is used as offset to test if the searched position
-- is next to the field; the offset goes in the other direction when
-- a right click happens
Expand Down

0 comments on commit fa89c9f

Please sign in to comment.