Pipeworks compatibility: Nuclear Reactor Chamber

This commit is contained in:
mrkubax10 2024-03-23 19:52:35 +01:00
parent ab367b4f29
commit e3e00e59a1

View File

@ -157,6 +157,7 @@ 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)
return result
end,
can_insert=function(pos,node,stack,direction)
@ -188,6 +189,36 @@ local override={
minetest.override_item("industrialtest:nuclear_reactor",override)
minetest.override_item("industrialtest:nuclear_reactor_active",override)
-- Nuclear Reactor Chamber
override=table.copy(override)
def=table.copy(minetest.registered_nodes["industrialtest:nuclear_reactor_chamber"])
override.groups=def.groups
override.groups.tubedevice=1
override.groups.tubedevice_receiver=1
override.tube.insert_object=function(pos,node,stack,direction)
local listname=direction.y==0 and "charged" or "fuel"
local def=stack:get_definition()
if (listname=="charged" and not industrialtest.api.hasPowerStorage(stack:get_meta())) or
(listname=="fuel" and (not def.groups or not def.groups._industrialtest_placedInNuclearReactor)) then
return nil
end
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)
return result
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)
pipeworks.after_place(pos)
end
minetest.override_item("industrialtest:nuclear_reactor_chamber",override)
-- BatBox
addPipeworksCompatibility("industrialtest:batbox",{
{