forked from mrkubax10/industrialtest
Pipeworks compatibility: Simple electric item processors
This commit is contained in:
parent
e890a2002f
commit
7f1efd3472
@ -400,3 +400,50 @@ override={
|
||||
|
||||
minetest.override_item("industrialtest:canning_machine",override)
|
||||
minetest.override_item("industrialtest:canning_machine_active",override)
|
||||
|
||||
-- Simple electric item processors
|
||||
for _,name in ipairs(industrialtest.internal.simpleElectricItemProcessors) do
|
||||
local def=table.copy(minetest.registered_nodes[name])
|
||||
def.groups.tubedevice=1
|
||||
def.groups.tubedevice_receiver=1
|
||||
|
||||
local override={
|
||||
groups=def.groups,
|
||||
tube={
|
||||
insert_object=function(pos,node,stack,direction)
|
||||
local listname=direction.y==1 and "powerStorage" or "src"
|
||||
if listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta()) then
|
||||
return nil
|
||||
end
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv=meta:get_inventory()
|
||||
local result=inv:add_item(listname,stack)
|
||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||
return result
|
||||
end,
|
||||
can_insert=function(pos,node,stack,direction)
|
||||
local listname=direction.y==1 and "powerStorage" or "src"
|
||||
if listname=="powerStorage" and not industrialtest.api.hasPowerStorage(stack:get_meta()) 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="dst",
|
||||
connect_sides={
|
||||
left=1,
|
||||
right=1,
|
||||
back=1,
|
||||
bottom=1,
|
||||
top=1
|
||||
}
|
||||
},
|
||||
after_place_node=pipeworks.after_place,
|
||||
after_dig_node=pipeworks.after_dig,
|
||||
on_rotate=pipeworks.on_rotate
|
||||
}
|
||||
|
||||
minetest.override_item(name,override)
|
||||
minetest.override_item(name.."_active",override)
|
||||
end
|
||||
|
@ -17,6 +17,8 @@
|
||||
local machine={}
|
||||
local simpleElectricItemProcessor={}
|
||||
|
||||
industrialtest.internal.simpleElectricItemProcessors={}
|
||||
|
||||
industrialtest.internal.mclAfterDigNode=function(pos,oldmeta,lists)
|
||||
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_furnaces/init.lua#L538
|
||||
local meta=minetest.get_meta(pos)
|
||||
@ -765,4 +767,5 @@ function industrialtest.internal.registerSimpleElectricItemProcessor(config)
|
||||
return simpleElectricItemProcessor.activeOnTimer(pos,elapsed,meta,inv,config)
|
||||
end
|
||||
})
|
||||
table.insert(industrialtest.internal.simpleElectricItemProcessors,"industrialtest:"..config.name)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user