Compare commits
No commits in common. "25680ace72797101668664fb1f0a0a4982558616" and "acdbad46c63369e5321930cebb3c1bcdc3bdca4a" have entirely different histories.
25680ace72
...
acdbad46c6
@ -41,10 +41,7 @@ local function addPipeworksCompatibility(name,sides,inputInventory)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local result=inv:add_item(listname,stack)
|
local result=inv:add_item(listname,stack)
|
||||||
local def=minetest.registered_nodes[node.name]
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
if def and def._industrialtest_self then
|
|
||||||
def._industrialtest_self:triggerIfNeeded(pos)
|
|
||||||
end
|
|
||||||
return result
|
return result
|
||||||
end,
|
end,
|
||||||
can_insert=function(pos,node,stack,direction)
|
can_insert=function(pos,node,stack,direction)
|
||||||
@ -56,16 +53,6 @@ local function addPipeworksCompatibility(name,sides,inputInventory)
|
|||||||
end
|
end
|
||||||
return inv:room_for_item(listname,stack)
|
return inv:room_for_item(listname,stack)
|
||||||
end,
|
end,
|
||||||
remove_items=function(pos,node,stack,direction,count,listname)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:remove_item(listname,stack)
|
|
||||||
local def=minetest.registered_nodes[node.name]
|
|
||||||
if def and def._industrialtest_self then
|
|
||||||
def._industrialtest_self:triggerIfNeeded(pos)
|
|
||||||
end
|
|
||||||
return stack
|
|
||||||
end,
|
|
||||||
input_inventory=inputInventory,
|
input_inventory=inputInventory,
|
||||||
connect_sides={
|
connect_sides={
|
||||||
left=1,
|
left=1,
|
||||||
@ -170,8 +157,7 @@ local override={
|
|||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
local result=inv:add_item(listname,stack)
|
local result=inv:add_item(listname,stack)
|
||||||
industrialtest.Reactor.synchronizeChambers(pos)
|
minetest.registered_nodes["industrialtest:nuclear_reactor"].on_metadata_inventory_put(pos)
|
||||||
industrialtest.Reactor:triggerIfNeeded(pos)
|
|
||||||
return result
|
return result
|
||||||
end,
|
end,
|
||||||
can_insert=function(pos,node,stack,direction)
|
can_insert=function(pos,node,stack,direction)
|
||||||
@ -185,14 +171,6 @@ local override={
|
|||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
return inv:room_for_item(listname,stack)
|
return inv:room_for_item(listname,stack)
|
||||||
end,
|
end,
|
||||||
remove_items=function(pos,node,stack,direction,count,listname)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:remove_item(listname,stack)
|
|
||||||
industrialtest.Reactor.synchronizeChambers(pos)
|
|
||||||
industrialtest.Reactor:triggerIfNeeded(pos)
|
|
||||||
return stack
|
|
||||||
end,
|
|
||||||
input_inventory="fuel",
|
input_inventory="fuel",
|
||||||
connect_sides={
|
connect_sides={
|
||||||
left=1,
|
left=1,
|
||||||
@ -229,22 +207,10 @@ override.tube.insert_object=function(pos,node,stack,direction)
|
|||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
local result=inv:add_item(listname,stack)
|
local result=inv:add_item(listname,stack)
|
||||||
industrialtest.Reactor:synchronizeToChamber(pos)
|
minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"].on_metadata_inventory_put(pos)
|
||||||
local reactorPos=minetest.deserialize(meta:get_string("reactor"))
|
|
||||||
industrialtest.Reactor:triggerIfNeeded(reactorPos)
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
override.tube.remove_items=function(pos,node,stack,direction,count,listname)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:remove_item(listname,stack)
|
|
||||||
industrialtest.Reactor:synchronizeToChamber(pos)
|
|
||||||
local reactorPos=minetest.deserialize(meta:get_string("reactor"))
|
|
||||||
industrialtest.Reactor:triggerIfNeeded(reactorPos)
|
|
||||||
return stack
|
|
||||||
end
|
|
||||||
|
|
||||||
override.after_place_node_old=def.after_place_node
|
override.after_place_node_old=def.after_place_node
|
||||||
override.after_place_node=function(pos)
|
override.after_place_node=function(pos)
|
||||||
minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"].after_place_node_old(pos)
|
minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"].after_place_node_old(pos)
|
||||||
@ -303,14 +269,14 @@ override={
|
|||||||
if direction.y==1 then
|
if direction.y==1 then
|
||||||
listname="powerStorage"
|
listname="powerStorage"
|
||||||
elseif direction.y==-1 then
|
elseif direction.y==-1 then
|
||||||
listname="src"
|
listname="fuel"
|
||||||
else
|
else
|
||||||
listname="dst"
|
listname="target"
|
||||||
end
|
end
|
||||||
local def=stack:get_definition()
|
local def=stack:get_definition()
|
||||||
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
||||||
(listname=="src" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
(listname=="fuel" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||||
(listname=="dst" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
(listname=="target" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
@ -324,28 +290,21 @@ override={
|
|||||||
if direction.y==1 then
|
if direction.y==1 then
|
||||||
listname="powerStorage"
|
listname="powerStorage"
|
||||||
elseif direction.y==-1 then
|
elseif direction.y==-1 then
|
||||||
listname="src"
|
listname="fuel"
|
||||||
else
|
else
|
||||||
listname="dst"
|
listname="target"
|
||||||
end
|
end
|
||||||
local def=stack:get_definition()
|
local def=stack:get_definition()
|
||||||
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
||||||
(listname=="src" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
(listname=="fuel" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||||
(listname=="dst" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
(listname=="target" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
return inv:room_for_item(listname,stack)
|
return inv:room_for_item(listname,stack)
|
||||||
end,
|
end,
|
||||||
remove_items=function(pos,node,stack,direction,count,listname)
|
input_inventory="target",
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
local inv=meta:get_inventory()
|
|
||||||
inv:remove_item(listname,stack)
|
|
||||||
industrialtest.CanningMachine:triggerIfNeeded(pos)
|
|
||||||
return stack
|
|
||||||
end,
|
|
||||||
input_inventory="dst",
|
|
||||||
connect_sides={
|
connect_sides={
|
||||||
left=1,
|
left=1,
|
||||||
right=1,
|
right=1,
|
||||||
|
@ -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,toIndex,count)
|
function industrialtest.CanningMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,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,13 +112,10 @@ 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
|
||||||
if toList=="leftover" then
|
return math.min(count,industrialtest.ActivatedElectricMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,count))
|
||||||
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,player)
|
function industrialtest.CanningMachine.allowMetadataInventoryPut(self,pos,listname,index,stack)
|
||||||
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
|
||||||
@ -127,13 +124,10 @@ 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
|
||||||
if listname=="leftover" then
|
return math.min(stack:get_count(),industrialtest.ActivatedElectricMachine.allowMetadataInventoryPut(self,pos,listname,index,stack))
|
||||||
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,player)
|
function industrialtest.CanningMachine.allowMetadataInventoryTake(self,pos,listname,index,stack)
|
||||||
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)
|
||||||
@ -142,7 +136,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,player)
|
return industrialtest.ActivatedElectricMachine.allowMetadataInventoryTake(self,pos,listname,index,stack)
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
|
||||||
@ -157,7 +151,7 @@ function industrialtest.CanningMachine.onMetadataInventoryMove(self,pos,fromList
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.CanningMachine.onMetadataInventoryPut(self,pos,listname,index,stack)
|
function industrialtest.CanningMachine.onMetadataInventoryPut(self,pos)
|
||||||
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