Fix issue while moving item in Canning Machine
This commit is contained in:
parent
c57efcdd5c
commit
25680ace72
@ -99,7 +99,7 @@ function industrialtest.CanningMachine.getFormspec(self,pos)
|
|||||||
return parentFormspec..table.concat(formspec,"")
|
return parentFormspec..table.concat(formspec,"")
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,count)
|
function industrialtest.CanningMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||||
if toList=="src" then
|
if toList=="src" then
|
||||||
local inv=minetest.get_meta(pos):get_inventory()
|
local inv=minetest.get_meta(pos):get_inventory()
|
||||||
local itemstack=inv:get_stack(fromList,fromIndex)
|
local itemstack=inv:get_stack(fromList,fromIndex)
|
||||||
@ -112,10 +112,13 @@ function industrialtest.CanningMachine.allowMetadataInventoryMove(self,pos,fromL
|
|||||||
local def=itemstack:get_definition()
|
local def=itemstack:get_definition()
|
||||||
return (def.groups and def.groups._industrialtest_fueled) and count or 0
|
return (def.groups and def.groups._industrialtest_fueled) and count or 0
|
||||||
end
|
end
|
||||||
return math.min(count,industrialtest.ActivatedElectricMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,count))
|
if toList=="leftover" then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return math.min(count,industrialtest.ActivatedElectricMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count))
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.allowMetadataInventoryPut(self,pos,listname,index,stack)
|
function industrialtest.CanningMachine.allowMetadataInventoryPut(self,pos,listname,index,stack,player)
|
||||||
if listname=="src" then
|
if listname=="src" then
|
||||||
local def=stack:get_definition()
|
local def=stack:get_definition()
|
||||||
return (def.groups and def.groups._industrialtest_fuel) and stack:get_count() or 0
|
return (def.groups and def.groups._industrialtest_fuel) and stack:get_count() or 0
|
||||||
@ -124,10 +127,13 @@ function industrialtest.CanningMachine.allowMetadataInventoryPut(self,pos,listna
|
|||||||
local def=stack:get_definition()
|
local def=stack:get_definition()
|
||||||
return (def.groups and def.groups._industrialtest_fueled) and stack:get_count() or 0
|
return (def.groups and def.groups._industrialtest_fueled) and stack:get_count() or 0
|
||||||
end
|
end
|
||||||
return math.min(stack:get_count(),industrialtest.ActivatedElectricMachine.allowMetadataInventoryPut(self,pos,listname,index,stack))
|
if listname=="leftover" then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return math.min(stack:get_count(),industrialtest.ActivatedElectricMachine.allowMetadataInventoryPut(self,pos,listname,index,stack,player))
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.allowMetadataInventoryTake(self,pos,listname,index,stack)
|
function industrialtest.CanningMachine.allowMetadataInventoryTake(self,pos,listname,index,stack,player)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
local fuelSlot=inv:get_stack("src",1)
|
local fuelSlot=inv:get_stack("src",1)
|
||||||
@ -136,7 +142,7 @@ function industrialtest.CanningMachine.allowMetadataInventoryTake(self,pos,listn
|
|||||||
meta:set_float("srcTime",0)
|
meta:set_float("srcTime",0)
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
end
|
end
|
||||||
return industrialtest.ActivatedElectricMachine.allowMetadataInventoryTake(self,pos,listname,index,stack)
|
return industrialtest.ActivatedElectricMachine.allowMetadataInventoryTake(self,pos,listname,index,stack,player)
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||||
@ -151,7 +157,7 @@ function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.onMetadataInventoryPut(self,pos)
|
function industrialtest.CanningMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
industrialtest.ActivatedElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
|
industrialtest.ActivatedElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user