mirror of
https://github.com/mt-mods/xcompat.git
synced 2024-12-22 17:10:18 +01:00
Switched to using definition table, added hades support, updated stairsplus, improved world align
This commit is contained in:
parent
4d5c1e3eab
commit
4e6cf3c7e4
@ -14,12 +14,34 @@ supports
|
|||||||
* else polyfill
|
* else polyfill
|
||||||
|
|
||||||
|
|
||||||
## `register_stairs_slabs(Name, BaseItem, Tiles, DigGroups, Sounds, StairName, SlabName)`
|
## `register_stairs_slabs({def})`
|
||||||
|
|
||||||
Creates stairs, slabs and sometimes more.
|
Creates stairs, slabs and sometimes more.
|
||||||
|
|
||||||
|
Use with:
|
||||||
|
xcompat.functions.register_stairs_slabs({
|
||||||
|
baseitem = "", --the item the nodes are based on
|
||||||
|
recipeitem = "", --the item the nodes are crafted with, will use baseitem if unset
|
||||||
|
|
||||||
|
name = "Willow",
|
||||||
|
slab_name = "", --slab name, if nil will use name
|
||||||
|
slab_name_double = "", --double slab name, if nil will use slab name, if nil will use name
|
||||||
|
stair_name = "", --stair name, if nil will use name
|
||||||
|
stair_name_out = "", --outer stair name, if nil will use stair name, if nil will use name
|
||||||
|
stair_name_in = "", --outer stair name, if nil will use stair name, if nil will use name
|
||||||
|
step_name = "", --step name, if nil will use name
|
||||||
|
step_name_out = "", --outer step name, if nil will use step name, if nil will use name
|
||||||
|
step_name_in = "", --outer step name, if nil will use step name, if nil will use name
|
||||||
|
|
||||||
|
tiles = {"willow_planks.png"}, --the tiles the nodes will use, if nil will use baseitem's tiles
|
||||||
|
groups = {}, --the groups the nodes will use, if nil will use baseitem's groups
|
||||||
|
sounds = sounds, --the sounds the nodes will use, if nil will use baseitem's sounds, if baseitem has no sounds will base sounds off of baseitems groups, if nil will be silent
|
||||||
|
worldalign = true/false, --if textures should be world aligned
|
||||||
|
})
|
||||||
|
|
||||||
Supports:
|
Supports:
|
||||||
* mineclonXX
|
* MineclonXX
|
||||||
* farlands redo
|
* Farlands Redo
|
||||||
* any game with stairs
|
* Hades
|
||||||
|
* any game with "stairs"
|
||||||
* any game with stairs redo
|
* any game with stairs redo
|
||||||
* any game with stairs plus
|
* any game with stairs plus
|
2
mod.conf
2
mod.conf
@ -1,3 +1,3 @@
|
|||||||
name = xcompat
|
name = xcompat
|
||||||
description = Provides cross compatibility between mods and games for sounds and crafting materials.
|
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, stairs, stairsplus, mcl_stairs, fl_stairs
|
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, hades_stairs
|
||||||
|
@ -16,60 +16,108 @@ function functions.can_interact_with_node(player, pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function functions.register_stairs_slabs(Name, BaseItem, Tiles, DigGroups, Sounds, StairName, SlabName)
|
function functions.register_stairs_slabs(def)
|
||||||
--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)
|
local BaseItem = def.baseitem or {}
|
||||||
|
local nodedef = minetest.registered_nodes[def.baseitem]
|
||||||
|
local Groups = def.groups or nodedef.groups
|
||||||
|
local Tiles = def.tiles or nodedef.tiles
|
||||||
|
local Sounds = def.sounds or nodedef.sounds or {}
|
||||||
|
local RecipeItem = def.recipeitem or def.baseitem
|
||||||
|
|
||||||
|
local Name = def.name
|
||||||
|
local LName = def.lname or string.lower(Name):gsub("_", "")
|
||||||
|
local SlabName = def.slabname or def.name
|
||||||
|
local StairName = def.stairname or def.name
|
||||||
|
|
||||||
|
--extra names for hades
|
||||||
|
local OuterStairName = def.stair_name_out or def.stair_name or def.name
|
||||||
|
local InnerStairName = def.stair_name_in or def.stair_name or def.name
|
||||||
|
local StepName = def.step_name or def.name
|
||||||
|
local OuterStepName = def.step_name_out or def.step_name or def.name
|
||||||
|
local InnerStepName = def.step_name_in or def.step_name or def.name
|
||||||
|
local DoubleSlabName = def.slab_name_double or def.slab_name or def.name
|
||||||
|
|
||||||
if minetest.global_exists("stairs") then
|
if minetest.global_exists("stairsplus") then
|
||||||
if stairs.mod and stairs.mod == "redo" then
|
if WorldAlign == true then
|
||||||
stairs.register_all(
|
WorldAlign = "world"
|
||||||
LName,
|
elseif WorldAlign == false then
|
||||||
BaseItem,
|
WorldAlign = "node"
|
||||||
DigGroups,
|
elseif WorldAlign ~= "world" and WorldAlign ~= "node" then
|
||||||
Tiles,
|
WorldAlign = "user"
|
||||||
Name,
|
|
||||||
Sounds,
|
|
||||||
--true/false world align texture
|
|
||||||
true
|
|
||||||
)
|
|
||||||
else
|
|
||||||
stairs.register_stair_and_slab(
|
|
||||||
LName,
|
|
||||||
BaseItem,
|
|
||||||
DigGroups,
|
|
||||||
Tiles,
|
|
||||||
StairName,
|
|
||||||
SlabName,
|
|
||||||
Sounds
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
elseif minetest.global_exists("stairsplus") then
|
--[[stairsplus:register_all(
|
||||||
stairsplus:register_all(
|
|
||||||
Name,
|
Name,
|
||||||
Name,
|
Name,
|
||||||
BaseItem,
|
BaseItem,
|
||||||
{
|
{
|
||||||
description = Name,
|
tiles = Tiles,
|
||||||
|
groups = Groups,
|
||||||
|
sounds = Sounds
|
||||||
|
}
|
||||||
|
)]]
|
||||||
|
stairsplus.api.register_all(BaseItem,
|
||||||
|
{
|
||||||
tiles = Tiles,
|
tiles = Tiles,
|
||||||
groups = DigGroups,
|
groups = DigGroups,
|
||||||
sounds = Sounds
|
sounds = Sounds
|
||||||
}
|
},
|
||||||
)
|
{
|
||||||
|
align_style = WorldAlign,
|
||||||
|
allow_override_groups = true
|
||||||
|
})
|
||||||
|
elseif minetest.global_exists("stairs") then
|
||||||
|
if stairs.mod and stairs.mod == "redo" then
|
||||||
|
if WorldAlign ~= true and WorldAlign ~= false and WorldAlign ~= "" then
|
||||||
|
WorldAlign = ""
|
||||||
|
end
|
||||||
|
stairs.register_all(
|
||||||
|
LName,
|
||||||
|
RecipeItem,
|
||||||
|
Groups,
|
||||||
|
Tiles,
|
||||||
|
Name,
|
||||||
|
Sounds,
|
||||||
|
WorldAlign
|
||||||
|
)
|
||||||
|
else
|
||||||
|
stairs.register_stair_and_slab(
|
||||||
|
LName,
|
||||||
|
RecipeItem,
|
||||||
|
Groups,
|
||||||
|
Tiles,
|
||||||
|
StairName,
|
||||||
|
SlabName,
|
||||||
|
Sounds
|
||||||
|
)
|
||||||
|
end
|
||||||
elseif minetest.global_exists("mcl_stairs") then
|
elseif minetest.global_exists("mcl_stairs") then
|
||||||
--mcl_stairs.register_stair_and_slab(LName
|
|
||||||
mcl_stairs.register_stair_and_slab(LName, {
|
mcl_stairs.register_stair_and_slab(LName, {
|
||||||
baseitem = BaseItem,
|
baseitem = BaseItem,
|
||||||
--base_description = Name,
|
recipeitem = RecipeItem,
|
||||||
description_stair = StairName,
|
description_stair = StairName,
|
||||||
description_slab = SlabName,
|
description_slab = SlabName,
|
||||||
|
tiles = Tiles,
|
||||||
})
|
})
|
||||||
|
elseif minetest.global_exists("hades_stairs") then
|
||||||
|
hades_stairs.register_stair_and_slab_and_step(LName, BaseItem,
|
||||||
|
Groups,
|
||||||
|
Tiles,
|
||||||
|
Stairname,
|
||||||
|
OuterStairName,
|
||||||
|
InnerStairName,
|
||||||
|
SlabName,
|
||||||
|
StepName,
|
||||||
|
OuterStepName,
|
||||||
|
InnerStepName,
|
||||||
|
Sounds,
|
||||||
|
DoubleSlabName
|
||||||
|
)
|
||||||
elseif minetest.global_exists("fl_stairs") then
|
elseif minetest.global_exists("fl_stairs") then
|
||||||
|
Groups.stairable = 1
|
||||||
minetest.override_item(BaseItem, {
|
minetest.override_item(BaseItem, {
|
||||||
groups = {stairtable=1,},
|
groups = Groups,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user