selective disabling of stairsplus groups in inventory

This commit is contained in:
Isidor Zeuner
2018-01-10 13:11:22 +01:00
parent f6e0db21b2
commit 5be8311b0d
7 changed files with 15 additions and 6 deletions

View File

@ -27,3 +27,9 @@ end
-- Show stairs/slabs/panels/microblocks in creative inventory (true or false):
setting("bool", "stairsplus_in_creative_inventory", false)
setting("bool", "stairsplus_microblocks_not_in_creative_inventory", false)
setting("bool", "stairsplus_panels_not_in_creative_inventory", false)
setting("bool", "stairsplus_slabs_not_in_creative_inventory", false)
setting("bool", "stairsplus_slopes_not_in_creative_inventory", false)
setting("bool", "stairsplus_stairs_not_in_creative_inventory", false)

View File

@ -34,7 +34,7 @@ function stairsplus.copytable(orig)
return copy
end
function stairsplus:prepare_groups(groups)
function stairsplus:prepare_groups(groups, disabled_in_inventory)
local result = {}
if groups then
for k, v in pairs(groups) do
@ -46,6 +46,9 @@ function stairsplus:prepare_groups(groups)
if not moreblocks.config.stairsplus_in_creative_inventory then
result.not_in_creative_inventory = 1
end
if disabled_in_inventory then
result.not_in_creative_inventory = 1
end
return result
end

View File

@ -94,7 +94,7 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
def.paramtype = "light"
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.groups = stairsplus:prepare_groups(fields.groups)
def.groups = stairsplus:prepare_groups(fields.groups, moreblocks.config.stairsplus_microblocks_not_in_creative_inventory)
def.description = desc
if fields.drop and not (type(fields.drop) == "table") then
def.drop = modname.. ":micro_" ..fields.drop..alternate

View File

@ -95,7 +95,7 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.description = desc
def.groups = stairsplus:prepare_groups(fields.groups)
def.groups = stairsplus:prepare_groups(fields.groups, moreblocks.config.stairsplus_panels_not_in_creative_inventory)
if fields.drop and not (type(fields.drop) == "table") then
def.drop = modname.. ":panel_" ..fields.drop..alternate
end

View File

@ -90,7 +90,7 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
def.paramtype = "light"
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.groups = stairsplus:prepare_groups(fields.groups)
def.groups = stairsplus:prepare_groups(fields.groups, moreblocks.config.stairsplus_slabs_not_in_creative_inventory)
if alternate == "" then
def.groups.slab = 1
end

View File

@ -249,7 +249,7 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields)
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.description = desc
def.groups = stairsplus:prepare_groups(fields.groups)
def.groups = stairsplus:prepare_groups(fields.groups, moreblocks.config.stairsplus_slopes_not_in_creative_inventory)
if fields.drop and not (type(fields.drop) == "table") then
def.drop = modname.. ":slope_" ..fields.drop..alternate
end

View File

@ -135,7 +135,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.description = desc
def.groups = stairsplus:prepare_groups(fields.groups)
def.groups = stairsplus:prepare_groups(fields.groups, moreblocks.config.stairsplus_stairs_not_in_creative_inventory)
if alternate == "" then
def.groups.stair = 1
end