Pipeworks compatibility: Nuclear Reactor

This commit is contained in:
mrkubax10 2024-02-29 20:39:26 +01:00
parent 64cdff6139
commit a8b625f782

View File

@ -222,3 +222,52 @@ minetest.override_item("industrialtest:solar_panel",override)
minetest.override_item("industrialtest:lv_solar_array",override)
minetest.override_item("industrialtest:mv_solar_array",override)
minetest.override_item("industrialtest:hv_solar_array",override)
-- Nuclear Reactor
def=table.copy(minetest.registered_nodes["industrialtest:nuclear_reactor"])
def.groups.tubedevice=1
def.groups.tubedevice_receiver=1
override={
groups=def.groups,
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)
return result
end,
can_insert=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 false
end
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
return inv:room_for_item(listname,stack)
end,
input_inventory="fuel",
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:nuclear_reactor",override)
minetest.override_item("industrialtest:nuclear_reactor_active",override)