Pipeworks compatibility: Canning Machine

This commit is contained in:
mrkubax10 2024-02-29 21:57:38 +01:00
parent 73232db9a0
commit e890a2002f

View File

@ -334,3 +334,69 @@ override.groups=minetest.registered_nodes["industrialtest:mfsu"].groups
override.groups.tubedevice=1
override.groups.tubedevice_receiver=1
minetest.override_item("industrialtest:mfsu",override)
-- Canning Machine
def=table.copy(minetest.registered_nodes["industrialtest:canning_machine"])
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="fuel"
else
listname="target"
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
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="fuel"
else
listname="target"
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
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",
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:canning_machine",override)
minetest.override_item("industrialtest:canning_machine_active",override)