From 63c2926519efb26f6a1cdb9baad46dc27699ef4a Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sat, 6 Sep 2025 20:37:25 +0200 Subject: [PATCH] added handmill receipes to unified_inventory --- locale/de.txt | 8 ++++---- locale/template.txt | 8 ++++---- nodes_straw.lua | 29 ++++++++++++++++++++++++++--- unified_inventory_receipes.lua | 17 +++++++++++++++++ 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/locale/de.txt b/locale/de.txt index de01a93..19cbde6 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -125,14 +125,14 @@ Mill, powered by punching = Muehle, durch Schlagen antreiben Mill, powered by punching (owned by %s) = Muehle, durch Schlagen antreiben (gehoert %s) Public mill, powered by punching (owned by %s) = Öffentliche Muehle, durch Schlagen antreiben (gehoert %s) Private mill, powered by punching (owned by %s) = Private Muehle, durch Schlagen antreiben (gehoert %s) -Wheat seeds: = Weizenkoerner +Seeds: = Getreidekoerner Flour: = Mehl Mill = Muehle Owner: %s = Besitzer: %s Punch this hand-driven mill = Schlage auf diese handbetriebene Muehle -to convert wheat seeds into flour. = um Weizenkoerner in Mehl umzuwandeln. -You have grinded %s wheat seeds (%s are left). = Du hast %s Weizenkoerner gemahlen (%s bleiben uebrig). -You have grinded the last %s wheat seeds. = Du hast die letzten %s Weizenkoerner gemahlen. +to convert seeds into flour. = um Getreidekoerner in Mehl umzuwandeln. +You have grinded %s seeds (%s are left). = Du hast %s Getreidekoerner gemahlen (%s bleiben uebrig). +You have grinded the last %s seeds. = Du hast die letzten %s Getreidekoerner gemahlen. Your threshing floor can now be used by other players as well. = Dein Dreschboden kann jetzt auch von anderen Spielern benutzt werden. Your mill, powered by punching can now be used by other players as well. = Deine Mühle kann jetzt auch von anderen Spielern benutzt werden. diff --git a/locale/template.txt b/locale/template.txt index 4c05369..67e0036 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -124,14 +124,14 @@ Mill, powered by punching = Mill, powered by punching (owned by %s) = Public mill, powered by punching (owned by %s) = Private mill, powered by punching (owned by %s) = -Wheat seeds: = +Seeds: = Flour: = Mill = Owner: %s = Punch this hand-driven mill = -to convert wheat seeds into flour. = -You have grinded %s wheat seeds (%s are left). = -You have grinded the last %s wheat seeds. = +to convert seeds into flour. = +You have grinded %s seeds (%s are left). = +You have grinded the last %s seeds. = Your threshing floor can now be used by other players as well. = Your mill, powered by punching can now be used by other players as well. = diff --git a/nodes_straw.lua b/nodes_straw.lua index 7befb07..5f289ff 100644 --- a/nodes_straw.lua +++ b/nodes_straw.lua @@ -26,6 +26,29 @@ cottages.can_thresh_stack = function(stack) end + +--cottages.handmill_product = {} +cottages.handmill_product[cottages.craftitem_seed_wheat] = 'farming:flour' +-- these are from farming_plus: +cottages.handmill_product['farming:seed_rye'] = 'farming:flour' +cottages.handmill_product['farming:seed_oat'] = 'farming:flour' +cottages.handmill_product['farming:seed_barley'] = 'farming:flour' +cottages.handmill_product['farming:seed_rice'] = 'farming:rice_flour' +-- specific to some mods: +cottages.handmill_product['farming:corn'] = 'yl_seasons:corn_flour' +cottages.handmill_product['farming:seeds_sunflower'] = 'cucina_vegana:sunflower_seeds_flour' +-- farming:flour_multigrain is probably best still done by alternate ways of crafting + +cottages.can_mill_stack = function(stack) + return (stack + and not(stack:is_empty()) + and stack:get_name() + and cottages.handmill_product[stack:get_name()] + -- the product has to be known + and minetest.registered_items[cottages.handmill_product[stack:get_name()]]) +end + + -- an even simpler from of bed - usually for animals -- it is a nodebox and not wallmounted because that makes it easier to replace beds with straw mats minetest.register_node("cottages:straw_mat", { @@ -402,11 +425,11 @@ local cottages_handmill_formspec = "size[8,8]".. "button_exit[6.0,0.0;1.5,0.5;public;"..S("Public?").."]".. "list[current_name;seeds;1,1;1,1;]".. "list[current_name;flour;5,1;2,2;]".. - "label[0,0.5;"..S("Wheat seeds:").."]".. + "label[0,0.5;"..S("Seeds:").."]".. "label[4,0.5;"..S("Flour:").."]".. "label[0,-0.3;"..S("Mill").."]".. "label[0,2.5;"..S("Punch this hand-driven mill").."]".. - "label[0,3.0;"..S("to convert wheat seeds into flour.").."]".. + "label[0,3.0;"..S("to convert seeds into flour.").."]".. "list[current_player;main;0,4;8,4;]"; minetest.register_node("cottages:handmill", { @@ -482,7 +505,7 @@ minetest.register_node("cottages:handmill", { local meta = minetest.get_meta(pos) -- only accept input the threshing floor can use/process if( listname=='flour' - or (listname=='seeds' and stack and not( cottages.handmill_product[ stack:get_name()] ))) then + or (listname=='seeds' and not(cottages.can_mill_stack(stack)) )) then return 0; end diff --git a/unified_inventory_receipes.lua b/unified_inventory_receipes.lua index 046aa14..01938b9 100644 --- a/unified_inventory_receipes.lua +++ b/unified_inventory_receipes.lua @@ -26,3 +26,20 @@ for crop_name, seed_name in pairs(cottages.threshing_floor_receipes) do items = {crop_name} }) end + + +unified_inventory.register_craft_type("cottages_handmill", { + description = "Milling", + icon = "default_stone.png", -- TODO we need a usable image of the handmill here + width = 1, + height = 1, + uses_crafting_grid = false +}) + +for input_name, product in pairs(cottages.handmill_product) do + unified_inventory.register_craft({ + output = product, + type = "cottages_handmill", + items = {input_name} + }) +end