Compare commits

...

5 Commits

Author SHA1 Message Date
Pedro Gimeno 7e09d68d38 Remove redundant line 2018-01-20 00:41:28 +01:00
Pedro Gimeno 42723886ae Fix crash in parsing colours 2017-12-27 13:51:47 +01:00
Pedro Gimeno 3fd00c30ec (Hopefully) fix link to the wiki. 2017-12-22 17:08:55 +01:00
Pedro Gimeno 66bccccaff Move documentation to the wiki 2017-12-22 17:06:44 +01:00
Pedro Gimeno 984b0feb5c Change recipe to one that makes better sense, using dyes. 2017-12-22 14:14:43 +01:00
3 changed files with 5 additions and 22 deletions

View File

@ -2,21 +2,4 @@
This adds some interesting items to the Digilines mod.
## Multicolour Light block
This block can be controlled and read via a digiline. The channel can only be configured once; to change it, the node must be dug and placed again. Anyone can set it, not just the placer. The channel will be a string, even when digits are entered. An empty channel name is not allowed.
The digiline signal must be a string with one of these formats:
- "on" - light on
- "off" - light off
- "#rgb" - change colour (3 hex digits)
- "#rrggbb" - colour (6 hex digits)
- "on#rgb"
- "off#rgb"
- "on#rrggbb"
- "off#rrggbb" - change both light on/off status and colour
Despite accepting any hex colours, due to Minetest limitations only 125 are possible, which are all possible combinations of values 00, 40, 80, C0 and FF in each of R, G and B (values 00-33 count as 00, values 34-66 count as 40, values 67-99 count as 80, values 9A-CC count as C0, and values CD-FF count as FF)
After being configured, it will send on the selected channel the string "L <playername>" when the node is punched (L for left-clicked) and the string "R <playername>" when the node is right-clicked (with the actual player's name, of course).
For full documentation, see the [wiki](../../wiki).

View File

@ -1,2 +1,3 @@
default
dye
digilines

View File

@ -54,13 +54,13 @@ local function multicolour_light_effector_action(pos, node, channel, msg)
local configured_channel = minetest.get_meta(pos):get_string("digich")
if channel == configured_channel and type(msg) == "string" then
local node = minetest.get_node(pos)
local onoff, colour = msg:match("^([^#]+)#?(%x-)$")
local onoff, colour = msg:match("^([^#]*)#?(%x-)$")
if onoff == "off" and node.name == "digiplay:multicolour_light_on" then
node.name = "digiplay:multicolour_light"
elseif onoff == "on" and node.name == "digiplay:multicolour_light" then
node.name = "digiplay:multicolour_light_on"
end
if colour ~= "" then
if colour ~= "" and colour ~= nil then
local base
if colour:match("^%x%x%x%x%x%x$") then
base = 256
@ -111,7 +111,6 @@ for i = 0, 1 do
}
if i == 1 then
node_definition.tiles[1] = "digiplay_multicolour_light_on.png"
node_definition.light_source = 12
node_definition.drop = "digiplay:multicolour_light"
node_definition.groups.not_in_creative_inventory = 1
@ -124,7 +123,7 @@ minetest.register_craft {
recipe = {
{"", "digilines:wire_std_00000000", ""},
{"default:clay", "default:mese_crystal_fragment", "default:clay"},
{"", "digilines:wire_std_00000000", ""}
{"dye:red", "dye:green", "dye:blue"}
};
}