mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
Pull some parent node vars for stairs and slabs
Co-authored-by: tenplus1 <tenplus1@users.noreply.github.com>
This commit is contained in:
parent
5875820542
commit
f5802a3e40
1 changed files with 27 additions and 8 deletions
|
@ -57,13 +57,24 @@ local function warn_if_exists(nodename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- get node settings to use for stairs
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil, nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Register stair
|
-- Register stair
|
||||||
-- Node will be called stairs:stair_<subname>
|
-- Node will be called stairs:stair_<subname>
|
||||||
|
|
||||||
function stairs.register_stair(subname, recipeitem, groups, images, description,
|
function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||||
sounds, worldaligntex)
|
sounds, worldaligntex)
|
||||||
local src_def = minetest.registered_nodes[recipeitem]
|
local light_source, texture_alpha, sunlight = get_node_vars(recipeitem)
|
||||||
|
|
||||||
-- Set backface culling and world-aligned textures
|
-- Set backface culling and world-aligned textures
|
||||||
local stair_images = {}
|
local stair_images = {}
|
||||||
|
@ -93,7 +104,9 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = stair_images,
|
tiles = stair_images,
|
||||||
use_texture_alpha = src_def and src_def.use_texture_alpha,
|
use_texture_alpha = texture_alpha,
|
||||||
|
sunlight_propagates = sunlight,
|
||||||
|
light_source = light_source,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -165,7 +178,7 @@ end
|
||||||
|
|
||||||
function stairs.register_slab(subname, recipeitem, groups, images, description,
|
function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
sounds, worldaligntex)
|
sounds, worldaligntex)
|
||||||
local src_def = minetest.registered_nodes[recipeitem]
|
local light_source, texture_alpha, sunlight = get_node_vars(recipeitem)
|
||||||
|
|
||||||
-- Set world-aligned textures
|
-- Set world-aligned textures
|
||||||
local slab_images = {}
|
local slab_images = {}
|
||||||
|
@ -191,7 +204,9 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = slab_images,
|
tiles = slab_images,
|
||||||
use_texture_alpha = src_def and src_def.use_texture_alpha,
|
use_texture_alpha = texture_alpha,
|
||||||
|
sunlight_propagates = sunlight,
|
||||||
|
light_source = light_source,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -303,7 +318,7 @@ end
|
||||||
|
|
||||||
function stairs.register_stair_inner(subname, recipeitem, groups, images,
|
function stairs.register_stair_inner(subname, recipeitem, groups, images,
|
||||||
description, sounds, worldaligntex, full_description)
|
description, sounds, worldaligntex, full_description)
|
||||||
local src_def = minetest.registered_nodes[recipeitem]
|
local light_source, texture_alpha, sunlight = get_node_vars(recipeitem)
|
||||||
|
|
||||||
-- Set backface culling and world-aligned textures
|
-- Set backface culling and world-aligned textures
|
||||||
local stair_images = {}
|
local stair_images = {}
|
||||||
|
@ -338,7 +353,9 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images,
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = stair_images,
|
tiles = stair_images,
|
||||||
use_texture_alpha = src_def and src_def.use_texture_alpha,
|
use_texture_alpha = texture_alpha,
|
||||||
|
sunlight_propagates = sunlight,
|
||||||
|
light_source = light_source,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -393,7 +410,7 @@ end
|
||||||
|
|
||||||
function stairs.register_stair_outer(subname, recipeitem, groups, images,
|
function stairs.register_stair_outer(subname, recipeitem, groups, images,
|
||||||
description, sounds, worldaligntex, full_description)
|
description, sounds, worldaligntex, full_description)
|
||||||
local src_def = minetest.registered_nodes[recipeitem]
|
local light_source, texture_alpha, sunlight = get_node_vars(recipeitem)
|
||||||
|
|
||||||
-- Set backface culling and world-aligned textures
|
-- Set backface culling and world-aligned textures
|
||||||
local stair_images = {}
|
local stair_images = {}
|
||||||
|
@ -428,7 +445,9 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images,
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = stair_images,
|
tiles = stair_images,
|
||||||
use_texture_alpha = src_def and src_def.use_texture_alpha,
|
use_texture_alpha = texture_alpha,
|
||||||
|
sunlight_propagates = sunlight,
|
||||||
|
light_source = light_source,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue