Pipeworks compatibility: Geothermal Generator and Water Mill

This commit is contained in:
mrkubax10 2024-02-29 18:53:12 +01:00
parent 3bc3dab88c
commit 29f6bd2852

View File

@ -95,3 +95,66 @@ override={
minetest.override_item("industrialtest:generator",override)
minetest.override_item("industrialtest:generator_active",override)
-- Geothermal Generator
def=table.copy(minetest.registered_nodes["industrialtest:geothermal_generator"])
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="leftover"
elseif direction.y==-1 then
listname="fluid"
else
listname="charged"
end
if listname=="charged" 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="leftover"
elseif direction.y==-1 then
listname="fluid"
else
listname="charged"
end
if listname=="charged" 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="leftover",
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:geothermal_generator",override)
minetest.override_item("industrialtest:geothermal_generator_active",override)
-- Water Mill
minetest.override_item("industrialtest:water_mill",override)