Implement valid sides for other nodes

This commit is contained in:
Cam B 2021-01-22 01:48:23 +00:00
parent c0f2ffc99a
commit a2f903cac2
9 changed files with 14 additions and 9 deletions

@ -76,15 +76,13 @@ tubelib.register_node("tubelib:blackhole", {}, {
on_pull_item = nil, -- not needed
on_unpull_item = nil, -- not needed
valid_sides = {R=false, L=true, B=false, F=false, D=false, U=false},
on_push_item = function(pos, side, item)
if side == "L" then
local meta = minetest.get_meta(pos)
local disappeared = meta:get_int("disappeared") + item:get_count()
meta:set_int("disappeared", disappeared)
meta:set_string("infotext", disappeared.." "..S("items disappeared"))
return true
end
return false
end,
on_recv_message = function(pos, topic, payload)

@ -238,7 +238,7 @@ tubelib.register_node("tubelib:pusher",
on_push_item = nil, -- pusher has no inventory
on_unpull_item = nil, -- pusher has no inventory
is_pusher = true, -- is a pulling/pushing node
valid_sides = {R=true, L=true, B=false, F=false, D=false, U=false},
on_recv_message = function(pos, topic, payload)
local resp = State:on_receive_message(pos, topic, payload)
if resp then

@ -132,6 +132,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons1:detector", {"tubelib_addons1:detector_active"}, {
valid_sides = {R=true, L=true, B=false, F=false, D=false, U=false},
on_push_item = function(pos, side, item)
if side ~= "L" then return false end
local player_name = minetest.get_meta(pos):get_string("player_name")

@ -139,6 +139,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons1:funnel", {}, {
valid_sides = {U=false},
on_pull_item = function(pos, side)
local meta = minetest.get_meta(pos)
return tubelib.get_item(meta, "main")

@ -281,6 +281,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons1:liquidsampler",
{"tubelib_addons1:liquidsampler_active", "tubelib_addons1:liquidsampler_defect"}, {
valid_sides = {L=false},
on_pull_item = function(pos, side)
return tubelib.get_item(M(pos), "dst")
end,

@ -237,6 +237,7 @@ tubelib.register_node("tubelib_addons1:pusher_fast",
on_push_item = nil, -- pusher has no inventory
on_unpull_item = nil, -- pusher has no inventory
is_pusher = true, -- is a pulling/pushing node
valid_sides = {R=true, L=true, B=false, F=false, D=false, U=false},
on_recv_message = function(pos, topic, payload)
local resp = State:on_receive_message(pos, topic, payload)

@ -448,6 +448,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons1:quarry",
{"tubelib_addons1:quarry_active", "tubelib_addons1:quarry_defect"}, {
valid_sides = {L=false},
on_pull_item = function(pos, side)
return tubelib.get_item(M(pos), "main")
end,

@ -141,6 +141,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons3:funnel", {}, {
valid_sides = {U=false},
on_pull_stack = function(pos, side)
local meta = minetest.get_meta(pos)
return tubelib.get_stack(meta, "main")

@ -219,6 +219,7 @@ minetest.register_craft({
tubelib.register_node("tubelib_addons3:pusher",
{"tubelib_addons3:pusher_active", "tubelib_addons3:pusher_defect"}, {
is_pusher = true, -- is a pulling/pushing node
valid_sides = {R=true, L=true, B=false, F=false, D=false, U=false},
on_recv_message = function(pos, topic, payload)
local resp = State:on_receive_message(pos, topic, payload)