silo bugs fixed
This commit is contained in:
parent
f7c3b8731f
commit
d87ea392b1
@ -26,6 +26,9 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
-- check if it is powder
|
||||||
|
local ndef = minetest.registered_craftitems[stack:get_name()] or {}
|
||||||
|
if ndef.groups and ndef.groups.powder == 1 then
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
nvm.item_name = nil
|
nvm.item_name = nil
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
@ -35,6 +38,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||||||
if inv:contains_item(listname, ItemStack(stack:get_name())) then
|
if inv:contains_item(listname, ItemStack(stack:get_name())) then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -229,11 +233,22 @@ techage.register_node({"techage:ta3_silo", "techage:ta4_silo"}, {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_push_item = function(pos, in_dir, stack)
|
on_push_item = function(pos, in_dir, stack)
|
||||||
|
-- check if it is powder
|
||||||
|
local name = stack:get_name()
|
||||||
|
local ndef = minetest.registered_craftitems[name] or {}
|
||||||
|
if ndef.groups and ndef.groups.powder == 1 then
|
||||||
local inv = M(pos):get_inventory()
|
local inv = M(pos):get_inventory()
|
||||||
if inv:room_for_item("main", stack) then
|
|
||||||
|
if inv:is_empty("main") then
|
||||||
inv:add_item("main", stack)
|
inv:add_item("main", stack)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if inv:contains_item("main", name) and inv:room_for_item("main", stack) then
|
||||||
|
inv:add_item("main", stack)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
on_unpull_item = function(pos, in_dir, stack)
|
on_unpull_item = function(pos, in_dir, stack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user