Added global stair fixing patch

This commit is contained in:
Yessiest 2022-06-12 11:23:58 +00:00
parent e1be7b551d
commit f297a002ad
4 changed files with 40 additions and 16 deletions

View File

@ -67,6 +67,7 @@ default.gui_survival_form = "size[8,8.5]"..
-- Load files
local default_path = minetest.get_modpath("default")
dofile(default_path.."/stairgate_hack.lua")
dofile(default_path.."/functions.lua")
dofile(default_path.."/trees.lua")
dofile(default_path.."/nodes.lua")

View File

@ -0,0 +1,23 @@
local walign_stairs = minetest.settings:get_bool("stairs_world_align")
if not walign_stairs then
return
end
local stairs_ignore_str = minetest.settings:get("stairs_ignore") or ""
local stairs_ignore = {}
stairs_ignore_str:gsub("[^,]+",function(stairtype)
stairs_ignore[stairtype] = true
end)
minetest.___local_register_node = minetest.register_node
minetest.register_node = function(...)
local args = {...}
if (args[2].drawtype == "nodebox") and (args[1]:match("stair")) then
if not stairs_ignore[args[1]] then
for index,tile in pairs(args[2].tiles) do
if type(tile) == "table" then
tile.align_style = "world"
end
end
end
end
minetest.___local_register_node(unpack(args))
end

View File

@ -24,10 +24,6 @@ minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
local replace = minetest.settings:get_bool("enable_stairs_replace_abm")
-- Get setting for replace ABM
local walign_stairs = minetest.settings:get_bool("stairs_world_align")
local function rotate_and_place(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
@ -539,7 +535,7 @@ my_register_stair_and_slab(
"Wooden Stair",
"Wooden Slab",
default.node_sound_wood_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -550,7 +546,7 @@ my_register_stair_and_slab(
"Jungle Wood Stair",
"Jungle Wood Slab",
default.node_sound_wood_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -561,7 +557,7 @@ my_register_stair_and_slab(
"Pine Wood Stair",
"Pine Wood Slab",
default.node_sound_wood_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -572,7 +568,7 @@ my_register_stair_and_slab(
"Acacia Wood Stair",
"Acacia Wood Slab",
default.node_sound_wood_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -583,7 +579,7 @@ my_register_stair_and_slab(
"Aspen Wood Stair",
"Aspen Wood Slab",
default.node_sound_wood_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -627,7 +623,7 @@ my_register_stair_and_slab(
"Stone Brick Stair",
"Stone Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -671,7 +667,7 @@ my_register_stair_and_slab(
"Desert Stone Brick Stair",
"Desert Stone Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -704,7 +700,7 @@ my_register_stair_and_slab(
"Sandstone Brick Stair",
"Sandstone Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -737,7 +733,7 @@ my_register_stair_and_slab(
"Desert Sandstone Brick Stair",
"Desert Sandstone Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -770,7 +766,7 @@ my_register_stair_and_slab(
"Silver Sandstone Brick Stair",
"Silver Sandstone Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -803,7 +799,7 @@ my_register_stair_and_slab(
"Obsidian Brick Stair",
"Obsidian Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(
@ -825,7 +821,7 @@ my_register_stair_and_slab(
"Brick Stair",
"Brick Slab",
default.node_sound_stone_defaults(),
walign_stairs
false
)
my_register_stair_and_slab(

View File

@ -79,3 +79,7 @@ enable_weather (Enable weather) bool true
# Fix stairs and slabs rendering by forcing all stair/slab types to
# align with the world.
stairs_world_align (World-align stairs) bool true
# Ignore certain types of stairs when aligning to world
# Use a comma-separated list of stair types (with no spaces)
stairs_ignore (Ignore stairs types) string ""