From aea6c5dd1dc2356ec93e75b4fa55bd5fb72459fd Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Wed, 7 Jun 2017 11:42:44 -0500 Subject: [PATCH] Stairs: Add backface culling to stair meshes If backface culling is not specified for a tile in 'images' it is set to true. Slabs already have backface culling due to being defined as nodeboxes (which are then converted to meshnodes). --- mods/stairs/init.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index ab80fbbe..e7e40c6b 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -46,12 +46,24 @@ end -- Node will be called stairs:stair_ function stairs.register_stair(subname, recipeitem, groups, images, description, sounds) + local stair_images = {} + for i, image in ipairs(images) do + if type(image) == "string" then + stair_images[i] = { + name = image, + backface_culling = true, + } + elseif image.backface_culling == nil then -- override using any other value + stair_images[i] = table.copy(image) + stair_images[i].backface_culling = true + end + end groups.stair = 1 minetest.register_node(":stairs:stair_" .. subname, { description = description, drawtype = "mesh", mesh = "stairs_stair.obj", - tiles = images, + tiles = stair_images, paramtype = "light", paramtype2 = "facedir", is_ground_content = false,