Pipeworks compatibility: Rotary Macerator

This commit is contained in:
mrkubax10 2024-03-09 10:23:56 +01:00
parent a90b4f8cfe
commit 6a636099b3
1 changed files with 62 additions and 0 deletions

View File

@ -401,6 +401,68 @@ override={
minetest.override_item("industrialtest:canning_machine",override)
minetest.override_item("industrialtest:canning_machine_active",override)
-- Rotary Macerator
def=table.copy(minetest.registered_nodes["industrialtest:rotary_macerator"])
def.groups.tubedevice=1
def.groups.tubedevice_receiver=1
override={
groups=def.groups,
tube={
insert_object=function(pos,node,stack,direction)
local listname
if direction.y==1 then
listname="powerStorage"
elseif direction.y==-1 then
listname="src"
else
listname="modifier"
end
local def=stack:get_definition()
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
if direction.y==1 then
listname="powerStorage"
elseif direction.y==-1 then
listname="src"
else
listname="modifier"
end
local def=stack:get_definition()
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("industrialtest:rotary_macerator",override)
minetest.override_item("industrialtest:rotary_macerator_active",override)
-- Simple electric item processors
for _,name in ipairs(industrialtest.internal.simpleElectricItemProcessors) do
local def=table.copy(minetest.registered_nodes[name])