Fix bug when insertion item via tubes to appliance.

This commit is contained in:
SFENCE 2021-04-02 07:45:33 +02:00
parent 7aee597d99
commit fdad5d9cfb

View File

@ -512,13 +512,17 @@ end
-- tube can insert
function appliance:tube_can_insert (pos, node, stack, direction, owner)
if self.recipes then
local input = self.recipes.inputs[stack:get_name()];
if input then
return appliances.recipe_inventory_can_put(pos, self.input_stack, 1, stack, nil, recipes);
if self.have_input then
local input = self.recipes.inputs[stack:get_name()];
if input then
return self:recipe_inventory_can_put(pos, self.input_stack, 1, stack, nil, recipes);
end
end
local usage = self.recipes.usages[stack:get_name()];
if usage then
return appliances.recipe_inventory_can_put(pos, self.use_stack, 1, stack, nil, recipes);
if self.have_usage then
local usage = self.recipes.usages[stack:get_name()];
if usage then
return self:recipe_inventory_can_put(pos, self.use_stack, 1, stack, nil, recipes);
end
end
end
return false;
@ -528,13 +532,17 @@ function appliance:tube_insert (pos, node, stack, direction, owner)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory();
local input = self.recipes.inputs[stack:get_name()];
if input then
return inv:add_item(self.input_stack, stack);
if self.have_input then
local input = self.recipes.inputs[stack:get_name()];
if input then
return inv:add_item(self.input_stack, stack);
end
end
local usages = self.recipes.usages[stack:get_name()];
if usages then
return inv:add_item(self.use_stack, stack);
if self.have_usage then
local usages = self.recipes.usages[stack:get_name()];
if usages then
return inv:add_item(self.use_stack, stack);
end
end
end
@ -686,11 +694,11 @@ end
-- appliance node callbacks for pipeworks
function appliance:cb_tube_insert_object(pos, node, stack, direction, owner)
local stack = appliance:tube_insert(pos, node, stack, direction, owner);
local stack = self:tube_insert(pos, node, stack, direction, owner);
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory();
local use_input, use_usage = appliance:recipe_aviable_input(inv)
local use_input, use_usage = self:recipe_aviable_input(inv)
if use_input then
self:activate(pos, meta);
end
@ -698,7 +706,7 @@ function appliance:cb_tube_insert_object(pos, node, stack, direction, owner)
return stack;
end
function appliance:cb_tube_can_insert(pos, node, stack, direction, owner)
return appliance:tube_can_insert(pos, node, stack, direction, owner);
return self:tube_can_insert(pos, node, stack, direction, owner);
end
-- appliance node callbacks for technic