Merge pull request #76 from oversword/issue-75

Implement valid sides for other nodes
This commit is contained in:
Joachim Stolberg 2021-01-24 11:20:08 +01:00 committed by GitHub
commit d44a950eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 = {"L"},
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
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,
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","L"},
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","L"},
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", {}, {
invalid_sides = {"U"},
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"}, {
invalid_sides = {"L"},
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","L"},
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"}, {
invalid_sides = {"L"},
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", {}, {
invalid_sides = {"U"},
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","L"},
on_recv_message = function(pos, topic, payload)
local resp = State:on_receive_message(pos, topic, payload)