add interface to check if a liquid inventory node supports millibuckets
This commit is contained in:
parent
38a827dd46
commit
3b37329ba6
7
API
7
API
@ -26,6 +26,13 @@ node definition implements all or some of these functions:
|
||||
node_io_can_put_liquid(pos, node, side) -> bool
|
||||
node_io_can_take_item(pos, node, side) -> bool
|
||||
node_io_can_take_liquid(pos, node, side) -> bool
|
||||
node_io_accepts_millibuckets(pos, node, side) -> bool
|
||||
-- if false, transfer node should only put and take in 1000 increments
|
||||
-- inventory nodes that don't accept milibuckets should:
|
||||
-- return zero in node_io_room_for_liquid() if non-1000 increment
|
||||
-- return millibuckets parameter in node_io_put_liquid() if non-1000 increment
|
||||
-- only return upto a 1000 increment in node_io_take_liquid()
|
||||
-- transfer nodes that can put non-1000 increments should always check this or the inventory node might pretend to be full
|
||||
|
||||
|
||||
node_io_put_item(pos, node, side, putter, itemstack)
|
||||
|
5
init.lua
5
init.lua
@ -60,6 +60,11 @@ node_io.can_take_liquid = function(pos, node, side)
|
||||
if not ndef or not ndef.node_io_can_take_liquid then return false end
|
||||
return ndef.node_io_can_take_liquid(pos, node, side)
|
||||
end
|
||||
node_io.accepts_millibuckets = function(pos, node, side)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef or not ndef.node_io_accepts_millibuckets then return false end
|
||||
return ndef.node_io_accepts_millibuckets(pos, node, side)
|
||||
end
|
||||
|
||||
node_io.room_for_item = function(pos, node, side, itemstack, count) -- returns non-negative number
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
|
Loading…
x
Reference in New Issue
Block a user