Re-add Pipeworks compatibility
This commit is contained in:
parent
acdbad46c6
commit
c57efcdd5c
@ -41,7 +41,10 @@ local function addPipeworksCompatibility(name,sides,inputInventory)
|
||||
return nil
|
||||
end
|
||||
local result=inv:add_item(listname,stack)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
local def=minetest.registered_nodes[node.name]
|
||||
if def and def._industrialtest_self then
|
||||
def._industrialtest_self:triggerIfNeeded(pos)
|
||||
end
|
||||
return result
|
||||
end,
|
||||
can_insert=function(pos,node,stack,direction)
|
||||
@ -53,6 +56,16 @@ local function addPipeworksCompatibility(name,sides,inputInventory)
|
||||
end
|
||||
return inv:room_for_item(listname,stack)
|
||||
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,
|
||||
connect_sides={
|
||||
left=1,
|
||||
@ -157,7 +170,8 @@ local override={
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local result=inv:add_item(listname,stack)
|
||||
minetest.registered_nodes["industrialtest:nuclear_reactor"].on_metadata_inventory_put(pos)
|
||||
industrialtest.Reactor.synchronizeChambers(pos)
|
||||
industrialtest.Reactor:triggerIfNeeded(pos)
|
||||
return result
|
||||
end,
|
||||
can_insert=function(pos,node,stack,direction)
|
||||
@ -171,6 +185,14 @@ local override={
|
||||
local inv=meta:get_inventory()
|
||||
return inv:room_for_item(listname,stack)
|
||||
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",
|
||||
connect_sides={
|
||||
left=1,
|
||||
@ -207,10 +229,22 @@ override.tube.insert_object=function(pos,node,stack,direction)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local result=inv:add_item(listname,stack)
|
||||
minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"].on_metadata_inventory_put(pos)
|
||||
industrialtest.Reactor:synchronizeToChamber(pos)
|
||||
local reactorPos=minetest.deserialize(meta:get_string("reactor"))
|
||||
industrialtest.Reactor:triggerIfNeeded(reactorPos)
|
||||
return result
|
||||
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=function(pos)
|
||||
minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"].after_place_node_old(pos)
|
||||
@ -269,14 +303,14 @@ override={
|
||||
if direction.y==1 then
|
||||
listname="powerStorage"
|
||||
elseif direction.y==-1 then
|
||||
listname="fuel"
|
||||
listname="src"
|
||||
else
|
||||
listname="target"
|
||||
listname="dst"
|
||||
end
|
||||
local def=stack:get_definition()
|
||||
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
||||
(listname=="fuel" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||
(listname=="target" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||
(listname=="src" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||
(listname=="dst" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||
return nil
|
||||
end
|
||||
local meta=minetest.get_meta(pos)
|
||||
@ -290,21 +324,28 @@ override={
|
||||
if direction.y==1 then
|
||||
listname="powerStorage"
|
||||
elseif direction.y==-1 then
|
||||
listname="fuel"
|
||||
listname="src"
|
||||
else
|
||||
listname="target"
|
||||
listname="dst"
|
||||
end
|
||||
local def=stack:get_definition()
|
||||
if (listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
|
||||
(listname=="fuel" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||
(listname=="target" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||
(listname=="src" and (not def.groups or not def.groups._industrialtest_fuel)) or
|
||||
(listname=="dst" and (not def.groups or not def.groups._industrialtest_fueled)) then
|
||||
return false
|
||||
end
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
return inv:room_for_item(listname,stack)
|
||||
end,
|
||||
input_inventory="target",
|
||||
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.CanningMachine:triggerIfNeeded(pos)
|
||||
return stack
|
||||
end,
|
||||
input_inventory="dst",
|
||||
connect_sides={
|
||||
left=1,
|
||||
right=1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user