44 lines
1.4 KiB
Lua
44 lines
1.4 KiB
Lua
|
|
minetest.register_craft({
|
|
output = "railcarts:hopper 1",
|
|
recipe = {
|
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
|
{"", "default:steel_ingot", ""},
|
|
}
|
|
})
|
|
local hopper = pipeworks.clone_node("default:chest")
|
|
hopper.description = "Hopper"
|
|
hopper.tiles[1] = "pipeworks_filter_side.png"
|
|
hopper.tiles[2] = "pipeworks_filter_side.png"
|
|
hopper.tiles[3] = "railcarts_hopper_side.png"
|
|
hopper.tiles[4] = "railcarts_hopper_side.png"
|
|
hopper.tiles[5] = "railcarts_hopper_side.png"
|
|
hopper.tiles[6] = "railcarts_hopper_side.png"
|
|
hopper.groups.tubedevice = 1
|
|
hopper.groups.tubedevice_receiver = 1
|
|
hopper.tube = {
|
|
insert_object = function(pos, node, stack, direction)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:add_item("main", stack)
|
|
end,
|
|
can_insert = function(pos, node, stack, direction)
|
|
if direction.y ~= -1 then return false end
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:room_for_item("main", stack)
|
|
end,
|
|
input_inventory = "main",
|
|
connect_sides = {top=1}
|
|
}
|
|
hopper.after_place_node = function(pos)
|
|
pipeworks.scan_for_tube_objects(pos)
|
|
end
|
|
hopper.after_dig_node = function(pos)
|
|
pipeworks.scan_for_tube_objects(pos)
|
|
end
|
|
|
|
minetest.register_node("railcarts:hopper", hopper)
|
|
|