Add files via upload
This commit is contained in:
@@ -184,3 +184,7 @@ v0.1.30
|
|||||||
|
|
||||||
v0.1.31
|
v0.1.31
|
||||||
* Added crafter.
|
* Added crafter.
|
||||||
|
|
||||||
|
|
||||||
|
v0.1.32
|
||||||
|
* Fixed crafter not return replacement items properly.
|
||||||
|
22
crafter.lua
22
crafter.lua
@@ -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
|
-- items is list of recipe grid
|
||||||
local function craft (pos, items, recipe, qty, inv_list)
|
local function craft (pos, items, recipe, qty, inv_list)
|
||||||
local output, leftover = minetest.get_craft_result (recipe)
|
local output, leftover = minetest.get_craft_result (recipe)
|
||||||
@@ -584,13 +598,19 @@ local function craft (pos, items, recipe, qty, inv_list)
|
|||||||
count = 0
|
count = 0
|
||||||
end
|
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
|
if count < 1 then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
2
init.lua
2
init.lua
@@ -1,4 +1,4 @@
|
|||||||
local version = "0.1.31"
|
local version = "0.1.32"
|
||||||
local mod_storage = minetest.get_mod_storage ()
|
local mod_storage = minetest.get_mod_storage ()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ CC BY-SA 3.0
|
|||||||
|
|
||||||
Version
|
Version
|
||||||
=======
|
=======
|
||||||
0.1.31
|
0.1.32
|
||||||
|
|
||||||
|
|
||||||
Minetest Version
|
Minetest Version
|
||||||
|
Reference in New Issue
Block a user