From 6ef30d87ab601f1ef4cbd1508010f51f9f7a142f Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Tue, 5 Sep 2023 10:25:48 +0100 Subject: [PATCH] Use node sounds when none selected If sounds is nil when registering stairs, node sounds can be used. --- mods/stairs/init.lua | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index 4c622b93..db44f5c5 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -69,10 +69,10 @@ local function get_node_vars(nodename) local def = minetest.registered_nodes[nodename] if def then - return def.light_source, def.use_texture_alpha, def.sunlight_propagates + return def.light_source, def.use_texture_alpha, def.sunlight_propagates, def.sounds end - return nil, nil, nil + return nil, nil, nil, nil end -- Set backface culling and world-aligned textures @@ -95,7 +95,7 @@ end function stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex) - local light_source, texture_alpha, sunlight = get_node_vars(recipeitem) + local light, alpha, sunlight, node_sounds = get_node_vars(recipeitem) local stair_images = set_textures(images, worldaligntex) local new_groups = table.copy(groups) new_groups.stair = 1 @@ -104,14 +104,14 @@ function stairs.register_stair(subname, recipeitem, groups, images, description, description = description, drawtype = "nodebox", tiles = stair_images, - use_texture_alpha = texture_alpha, + use_texture_alpha = alpha, sunlight_propagates = sunlight, - light_source = light_source, + light_source = light, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = new_groups, - sounds = sounds, + sounds = sounds or node_sounds, node_box = { type = "fixed", fixed = { @@ -178,7 +178,7 @@ end function stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex) - local light_source, texture_alpha, sunlight = get_node_vars(recipeitem) + local light, alpha, sunlight, mode_sounds = get_node_vars(recipeitem) local slab_images = set_textures(images, worldaligntex) local new_groups = table.copy(groups) new_groups.slab = 1 @@ -187,14 +187,14 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, description = description, drawtype = "nodebox", tiles = slab_images, - use_texture_alpha = texture_alpha, + use_texture_alpha = alpha, sunlight_propagates = sunlight, - light_source = light_source, + light_source = light, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = new_groups, - sounds = sounds, + sounds = sounds or node_sounds, node_box = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, @@ -301,7 +301,7 @@ end function stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description) - local light_source, texture_alpha, sunlight = get_node_vars(recipeitem) + local light, alpha, sunlight, node_sounds = get_node_vars(recipeitem) local stair_images = set_textures(images, worldaligntex) local new_groups = table.copy(groups) new_groups.stair = 1 @@ -315,14 +315,14 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images, description = description, drawtype = "nodebox", tiles = stair_images, - use_texture_alpha = texture_alpha, + use_texture_alpha = alpha, sunlight_propagates = sunlight, - light_source = light_source, + light_source = light, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = new_groups, - sounds = sounds, + sounds = sounds or node_sounds, node_box = { type = "fixed", fixed = { @@ -372,7 +372,7 @@ end function stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description) - local light_source, texture_alpha, sunlight = get_node_vars(recipeitem) + local light, alpha, sunlight, node_sounds = get_node_vars(recipeitem) local stair_images = set_textures(images, worldaligntex) local new_groups = table.copy(groups) new_groups.stair = 1 @@ -386,14 +386,14 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images, description = description, drawtype = "nodebox", tiles = stair_images, - use_texture_alpha = texture_alpha, + use_texture_alpha = alpha, sunlight_propagates = sunlight, - light_source = light_source, + light_source = light, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, groups = new_groups, - sounds = sounds, + sounds = sounds or node_sounds, node_box = { type = "fixed", fixed = {