mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-07 10:32:11 +02:00
selective disabling of stairsplus groups in inventory
This commit is contained in:
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user