Added register stairs/slabs function

This commit is contained in:
Kazooo100 2024-07-23 14:22:46 -04:00
parent 688f12a970
commit 4d5c1e3eab
3 changed files with 72 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Functions API
## `can_interact_with_node(player, pos)`
returns `bool`
@ -10,4 +11,15 @@ checks for the ability to interact with a node via:
supports
* minetest game default if present
* else polyfill
* else polyfill
## `register_stairs_slabs(Name, BaseItem, Tiles, DigGroups, Sounds, StairName, SlabName)`
Creates stairs, slabs and sometimes more.
Supports:
* mineclonXX
* farlands redo
* any game with stairs
* any game with stairs redo
* any game with stairs plus

View File

@ -1,3 +1,3 @@
name = xcompat
description = Provides cross compatibility between mods and games for sounds and crafting materials.
optional_depends = default, fl_stone, fl_trees, mcl_sounds, hades_sounds, ks_sounds, nodes_nature, fl_topsoil, fl_trees, mcl_core, farming, x_farming, sounds
optional_depends = default, fl_stone, fl_trees, mcl_sounds, hades_sounds, ks_sounds, nodes_nature, fl_topsoil, fl_trees, mcl_core, farming, x_farming, sounds, stairs, stairsplus, mcl_stairs, fl_stairs

View File

@ -16,4 +16,62 @@ function functions.can_interact_with_node(player, pos)
return false
end
function functions.register_stairs_slabs(Name, BaseItem, Tiles, DigGroups, Sounds, StairName, SlabName)
--skip if farlands as farlands reloaded uses diggroups to make stairs/slabs
--if minetest.get_modpath("fl_core") then return end
local LName = string.lower(Name)
if minetest.global_exists("stairs") then
if stairs.mod and stairs.mod == "redo" then
stairs.register_all(
LName,
BaseItem,
DigGroups,
Tiles,
Name,
Sounds,
--true/false world align texture
true
)
else
stairs.register_stair_and_slab(
LName,
BaseItem,
DigGroups,
Tiles,
StairName,
SlabName,
Sounds
)
end
elseif minetest.global_exists("stairsplus") then
stairsplus:register_all(
Name,
Name,
BaseItem,
{
description = Name,
tiles = Tiles,
groups = DigGroups,
sounds = Sounds
}
)
elseif minetest.global_exists("mcl_stairs") then
--mcl_stairs.register_stair_and_slab(LName
mcl_stairs.register_stair_and_slab(LName, {
baseitem = BaseItem,
--base_description = Name,
description_stair = StairName,
description_slab = SlabName,
})
elseif minetest.global_exists("fl_stairs") then
minetest.override_item(BaseItem, {
groups = {stairtable=1,},
})
end
end
return functions