diff --git a/doc/functions.md b/doc/functions.md index fd4541a..2759faa 100644 --- a/doc/functions.md +++ b/doc/functions.md @@ -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 \ No newline at end of file +* 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 \ No newline at end of file diff --git a/mod.conf b/mod.conf index c89ed8b..67eb9ff 100644 --- a/mod.conf +++ b/mod.conf @@ -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 diff --git a/src/functions.lua b/src/functions.lua index 52a1b16..ba918bd 100644 --- a/src/functions.lua +++ b/src/functions.lua @@ -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 \ No newline at end of file