diff --git a/init.lua b/init.lua index cafc18a..b8915f3 100644 --- a/init.lua +++ b/init.lua @@ -101,6 +101,9 @@ dofile(minetest.get_modpath("cottages").."/nodes_mining.lua"); dofile(minetest.get_modpath("cottages").."/nodes_water.lua"); --dofile(minetest.get_modpath("cottages").."/nodes_chests.lua"); +-- add receipes for threshing floor and handmill to unified_inventory +dofile(minetest.get_modpath("cottages").."/unified_inventory_receipes.lua"); + -- this is only required and useful if you run versions of the random_buildings mod where the nodes where defined inside that mod dofile(minetest.get_modpath("cottages").."/alias.lua"); diff --git a/mod.conf b/mod.conf index 7ca5444..5e183eb 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ name = cottages description = Contains a lot of blocks that fit to medieval settlements and small cottages. Comes with hammer & anvil to repair tools. Threshing floor and handmill help process grains etc. -optional_depends = default, farming, stairs, homedecor, intllib, trees, wool, moreblocks +optional_depends = default, farming, stairs, homedecor, intllib, trees, wool, moreblocks, unified_inventory author = Sokomine title = Blocks for building cottages. diff --git a/unified_inventory_receipes.lua b/unified_inventory_receipes.lua new file mode 100644 index 0000000..046aa14 --- /dev/null +++ b/unified_inventory_receipes.lua @@ -0,0 +1,28 @@ +-- unified_inventory integration +if (minetest.get_modpath("unified_inventory") == nil) then + return +end + +-- for threshing floor and handmill + +assert((type(unified_inventory.register_craft_type) == "function"), + "register_craft_type does not exist in unified_inventory") +assert((type(unified_inventory.register_craft) == "function"), + "register_craft does not exist in unified_inventory") + + +unified_inventory.register_craft_type("cottages_threshing_floor", { + description = "Threshing", + icon = "cottages_junglewood.png^farming_wheat.png", + width = 1, + height = 1, + uses_crafting_grid = false +}) + +for crop_name, seed_name in pairs(cottages.threshing_floor_receipes) do + unified_inventory.register_craft({ + output = seed_name, + type = "cottages_threshing_floor", + items = {crop_name} + }) +end