Compare commits

...

1 Commits

Author SHA1 Message Date
loosewheel
cd3f250303 Add files via upload 2022-08-09 20:53:32 +10:00
4 changed files with 27 additions and 3 deletions

View File

@@ -184,3 +184,7 @@ v0.1.30
v0.1.31
* Added crafter.
v0.1.32
* Fixed crafter not return replacement items properly.

View File

@@ -498,6 +498,20 @@ end
local function place_in_output (pos, stack)
local meta = minetest.get_meta (pos)
if meta then
local inv = meta:get_inventory ()
if inv then
inv:add_item ("output", stack)
end
end
end
-- items is list of recipe grid
local function craft (pos, items, recipe, qty, inv_list)
local output, leftover = minetest.get_craft_result (recipe)
@@ -584,13 +598,19 @@ local function craft (pos, items, recipe, qty, inv_list)
count = 0
end
return_input_items (over)
if not return_input_items (over) then
place_in_output (pos, ItemStack (string.format ("%s %d", over.name, count)))
end
if count < 1 then
break
end
end
end
if count > 0 then
place_in_output (pos, ItemStack (string.format ("%s %d", leftover.items[i]:get_name (), count)))
end
end
end

View File

@@ -1,4 +1,4 @@
local version = "0.1.31"
local version = "0.1.32"
local mod_storage = minetest.get_mod_storage ()

View File

@@ -13,7 +13,7 @@ CC BY-SA 3.0
Version
=======
0.1.31
0.1.32
Minetest Version