Use node sounds when none selected

If sounds is nil when registering stairs, node sounds can be used.
This commit is contained in:
tenplus1 2023-09-05 10:25:48 +01:00 committed by GitHub
parent 76cc86c827
commit 6ef30d87ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 18 deletions

View File

@ -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 = {