Stairs: Safer slab name check
author12Me21 <12Me21.MC@gmail.com>
Mon, 3 Sep 2018 02:34:56 +0000 (22:34 -0400)
committerParamat <paramat@users.noreply.github.com>
Mon, 3 Sep 2018 02:34:56 +0000 (03:34 +0100)
Before, it checked if the node name *contained* "stairs:slab_", which could detect
things like "xxxxxstairs:slab_xxxx". Changed the pattern to "^stairs:slab_".

mods/stairs/init.lua

index f6511187514371fcd9648be635e693135f18cebb..0bbb034b1020d190357343d625701c12bb62b845 100644 (file)
@@ -185,7 +185,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
                        local creative_enabled = (creative and creative.is_enabled_for
                                        and creative.is_enabled_for(player_name))
 
-                       if under and under.name:find("stairs:slab_") then
+                       if under and under.name:find("^stairs:slab_") then
                                -- place slab using under node orientation
                                local dir = minetest.dir_to_facedir(vector.subtract(
                                        pointed_thing.above, pointed_thing.under), true)