-
Notifications
You must be signed in to change notification settings - Fork 37
API usage
Rules indicates direction and position the digiline message will reach from or to current location of message, which must be a triple of integer coords or function. Function used as rule must accept a table containing definition of node at current location of message as its only argument and return integer coords can be used as rule.
Ruleset(rules) are arrays containing route rules. For example, ruleset below shows rules that only allow messages transformed to adjacent node at x-positive and z-positive direction:
ruleset = {
{x=1, y=0, z=0},
{x=0, y=0, z=1}
}
Invoke digiline:receptor_send
function to send message on bus. Ruleset is specificated routes of transmitted message, which must be a subset of nodedef.digilines.receptors.rules
, or message will not be transmitted on digiline bus. Messages can be string, number or table, but functions are not recommanded to be transformed on bus and will be removed in future.
digiline:receptor_send(position_of_message, ruleset, channel, message)
To make node response digiline message, add digiline property to node's def table, as shown below:
minetest.register_node("node:name", {
...,
digilines = {
receptor = {
-- expected to be ruleset, indicates locations where this node can transmit messages to. Omit to use default rules.
rules = {},
},
wire = {
-- expected to be ruleset, indicates locations where this node can relay messages from and to. Omit to use default rules.
rules = {},
}
effector = {
-- expected to be ruleset, indicates locations where this node can receive messages from. Omit to use default rules.
rules = {},
-- invoked when this node receives a message from digiline
action = function(position_of_message, nodedef, channel, message) end
}
}
}