mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-26 02:40:23 +01:00
Merge pull request #11 from Novatux/master
Fixed a bug where autocrafter could be used to clone items.
This commit is contained in:
commit
a2fc554700
@ -4,6 +4,9 @@ function autocraft(inventory)
|
|||||||
local recipe=inventory:get_list("recipe")
|
local recipe=inventory:get_list("recipe")
|
||||||
local result
|
local result
|
||||||
local new
|
local new
|
||||||
|
for i=1,9 do
|
||||||
|
recipe[i]=ItemStack({name=recipe[i]:get_name(),count=1})
|
||||||
|
end
|
||||||
result,new=minetest.get_craft_result({method="normal",width=3,items=recipe})
|
result,new=minetest.get_craft_result({method="normal",width=3,items=recipe})
|
||||||
local input=inventory:get_list("input")
|
local input=inventory:get_list("input")
|
||||||
if result.item:is_empty() then return end
|
if result.item:is_empty() then return end
|
||||||
@ -28,7 +31,9 @@ function autocraft(inventory)
|
|||||||
inventory:remove_item("src",stack)
|
inventory:remove_item("src",stack)
|
||||||
end
|
end
|
||||||
inventory:add_item("dst",result)
|
inventory:add_item("dst",result)
|
||||||
print(dump(new))
|
for i=1,9 do
|
||||||
|
inventory:add_item("dst",new.items[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("pipeworks:autocrafter",{
|
minetest.register_node("pipeworks:autocrafter",{
|
||||||
|
@ -54,7 +54,7 @@ end
|
|||||||
|
|
||||||
function tube_autoroute(pos)
|
function tube_autoroute(pos)
|
||||||
nctr = minetest.env:get_node(pos)
|
nctr = minetest.env:get_node(pos)
|
||||||
print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice"))
|
--print ("minetest.get_item_group("..nctr.name..',"tubedevice") == '..minetest.get_item_group(nctr.name, "tubedevice"))
|
||||||
if (is_tube(nctr.name) == nil)
|
if (is_tube(nctr.name) == nil)
|
||||||
and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end
|
and minetest.get_item_group(nctr.name, "tubedevice") ~= 1 then return end
|
||||||
|
|
||||||
|
18
compat.lua
18
compat.lua
@ -57,6 +57,12 @@ minetest.register_node(":default:furnace", {
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(":default:furnace_active", {
|
minetest.register_node(":default:furnace_active", {
|
||||||
@ -111,6 +117,12 @@ minetest.register_node(":default:furnace_active", {
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(":default:chest", {
|
minetest.register_node(":default:chest", {
|
||||||
@ -159,4 +171,10 @@ minetest.register_node(":default:chest", {
|
|||||||
minetest.log("action", player:get_player_name()..
|
minetest.log("action", player:get_player_name()..
|
||||||
" takes stuff from chest at "..minetest.pos_to_string(pos))
|
" takes stuff from chest at "..minetest.pos_to_string(pos))
|
||||||
end,
|
end,
|
||||||
|
after_place_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos)
|
||||||
|
tube_scanforobjects(pos)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
@ -282,7 +282,6 @@ function notvel(tbl,vel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function go_next(pos,velocity,stack)
|
function go_next(pos,velocity,stack)
|
||||||
--print(dump(pos))
|
|
||||||
local chests={}
|
local chests={}
|
||||||
local tubes={}
|
local tubes={}
|
||||||
local cnode=minetest.env:get_node(pos)
|
local cnode=minetest.env:get_node(pos)
|
||||||
@ -313,7 +312,6 @@ function go_next(pos,velocity,stack)
|
|||||||
npos=addVect(pos,vect)
|
npos=addVect(pos,vect)
|
||||||
node=minetest.env:get_node(npos)
|
node=minetest.env:get_node(npos)
|
||||||
tube_receiver=minetest.get_item_group(node.name,"tubedevice_receiver")
|
tube_receiver=minetest.get_item_group(node.name,"tubedevice_receiver")
|
||||||
--tubelike=minetest.get_item_group(node.name,"tubelike")
|
|
||||||
meta=minetest.env:get_meta(npos)
|
meta=minetest.env:get_meta(npos)
|
||||||
tubelike=meta:get_int("tubelike")
|
tubelike=meta:get_int("tubelike")
|
||||||
if tube_receiver==1 then
|
if tube_receiver==1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user