summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2015-12-29 16:48:57 -0600
committercheapie <no-email-for-you@example.com>2015-12-29 16:48:57 -0600
commit1166ddcbc9c0c78a48f73617987741d502e92fa7 (patch)
tree97323e3421e750ddfb6ad3e8086260a7cf7ed883
parent2a9cafccb59fc9c4ce83070ae5c24c5368cbc0ac (diff)
downloadrgblightstone-1166ddcbc9c0c78a48f73617987741d502e92fa7.tar
rgblightstone-1166ddcbc9c0c78a48f73617987741d502e92fa7.tar.gz
rgblightstone-1166ddcbc9c0c78a48f73617987741d502e92fa7.tar.bz2
rgblightstone-1166ddcbc9c0c78a48f73617987741d502e92fa7.tar.xz
rgblightstone-1166ddcbc9c0c78a48f73617987741d502e92fa7.zip
Use colorization and add more colors
-rw-r--r--README11
-rw-r--r--init.lua54
-rw-r--r--textures/rgblightstone_black.pngbin101 -> 0 bytes
-rw-r--r--textures/rgblightstone_blue.pngbin106 -> 0 bytes
-rw-r--r--textures/rgblightstone_brown.pngbin108 -> 0 bytes
-rw-r--r--textures/rgblightstone_cyan.pngbin105 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkblue.pngbin104 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkcyan.pngbin108 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkgray.pngbin106 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkgreen.pngbin108 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkmagenta.pngbin108 -> 0 bytes
-rw-r--r--textures/rgblightstone_darkred.pngbin110 -> 0 bytes
-rw-r--r--textures/rgblightstone_green.pngbin107 -> 0 bytes
-rw-r--r--textures/rgblightstone_magenta.pngbin106 -> 0 bytes
-rw-r--r--textures/rgblightstone_red.pngbin107 -> 0 bytes
-rw-r--r--textures/rgblightstone_white.pngbin98 -> 0 bytes
-rw-r--r--textures/rgblightstone_yellow.pngbin104 -> 0 bytes
17 files changed, 59 insertions, 6 deletions
diff --git a/README b/README
index 9cb1f1c..50ff001 100644
--- a/README
+++ b/README
@@ -30,11 +30,20 @@ Grab the one you want from the creative inventory and place it. Survival mode is
Colors:
+Edit the settings at the top of init.lua to change what colors are available. The 16 colors from 16-color mode are always available.
+
+16 color mode:
off, black, blue, brown, cyan, darkblue, darkcyan, darkgray, darkgreen, darkmagenta, darkred, gray, green, magenta, red, white, yellow
+12-bit 4096 color mode:
+Any 6-digit hex value where the two digits for each part are the same. For example, "00FF66" and "112233" work, but "5678AC" will not.
+
+24-bit "True Color" mode:
+While the code is present, engine limitations do not allow this many nodes to be registered. If this ever changes, any hex value (such as "237AF0" or "C0FFEE") will work.
+
Adding more colors:
-Provide a texture named "rgblightstone_color.png" (where "color" is the color you want to add) and call rgblightstone.add(color)
+Call rgblightstone.add(name,color) - "name" is what digilines message should switch to it, and "color" is a hex color.
Group addressing mode:
diff --git a/init.lua b/init.lua
index 325d029..7a1661d 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,9 @@
rgblightstone = {}
-rgblightstone.colors = {"off","black","blue","brown","cyan","darkblue","darkcyan","darkgray","darkgreen","darkmagenta","darkred","gray","green","magenta","red","white","yellow"}
+--If neither of the following are on, only the 16 colors listed in the readme will be available
+rgblightstone.extracolors = true -- 12-bit 4096 Color Mode
+rgblightstone.insanecolors = false -- 24-bit "True Color" Mode (DOES NOT WORK - the engine does not allow this many nodes to be registered. If it ever does, however...)
+rgblightstone.colors = {}
+
function rgblightstone.autofill(pos,player)
local meta = minetest.get_meta(pos)
if (not meta:get_string("channel")) or meta:get_string("channel")=="" then
@@ -24,9 +28,10 @@ function rgblightstone.autofill(pos,player)
end
end
-function rgblightstone.add(name)
+function rgblightstone.add(name,color)
+ table.insert(rgblightstone.colors,name)
minetest.register_node("rgblightstone:lightstone_" .. name, {
- tiles = name == "off" and {"jeija_lightstone_darkgray_off.png"} or {"rgblightstone_"..name..".png"},
+ tiles = name == "off" and {"jeija_lightstone_darkgray_off.png"} or {"rgblightstone_gray.png^[colorize:#"..color.."CC"},
drop = "rgblightstone:lightstone_off",
groups = name == "off" and {cracky=2} or {cracky=2,not_in_creative_inventory=1},
description="RGB Lightstone ("..name..")",
@@ -52,7 +57,7 @@ function rgblightstone.add(name)
if fields.addry then meta:set_string("addry",fields.addry) end
end
end,
- light_source = name~= "off" and default.LIGHT_MAX-2 or 0,
+ light_source = name ~= "off" and default.LIGHT_MAX-2 or 0,
digiline = {
receptor = {},
effector = {
@@ -80,7 +85,46 @@ function rgblightstone.add(name)
}
})
end
-for _,i in ipairs(rgblightstone.colors) do rgblightstone.add(i) end
+rgblightstone.add("off",nil)
+rgblightstone.add("red","FF5555")
+rgblightstone.add("green","55FF55")
+rgblightstone.add("blue","5555FF")
+rgblightstone.add("cyan","55FFFF")
+rgblightstone.add("magenta","FF55FF")
+rgblightstone.add("yellow","FFFF55")
+rgblightstone.add("gray","AAAAAA")
+rgblightstone.add("darkred","AA0000")
+rgblightstone.add("darkgreen","00AA00")
+rgblightstone.add("darkblue","0000AA")
+rgblightstone.add("darkcyan","00AAAA")
+rgblightstone.add("darkmagenta","AA00AA")
+rgblightstone.add("brown","AA5500")
+rgblightstone.add("darkgray","555555")
+rgblightstone.add("white","FFFFFF")
+rgblightstone.add("black","000000")
+
+if rgblightstone.extracolors and not rgblightstone.insanecolors then
+ for r=0x0,0xFF,0x11 do
+ for g=0x0,0xFF,0x11 do
+ for b=0x0,0xFF,0x11 do
+ local color = string.format("%02X%02X%02X",r,g,b)
+ rgblightstone.add(color,color)
+ end
+ end
+ end
+end
+
+if rgblightstone.insanecolors then
+ for r=0x0,0xFF,0x1 do
+ for g=0x0,0xFF,0x1 do
+ for b=0x0,0xFF,0x1 do
+ local color = string.format("%02X%02X%02X",r,g,b)
+ rgblightstone.add(color,color)
+ end
+ end
+ end
+end
+
if minetest.get_modpath("mesecons_luacontroller") and minetest.get_modpath("digilines") then
minetest.register_craft({
output = "rgblightstone:lightstone_off",
diff --git a/textures/rgblightstone_black.png b/textures/rgblightstone_black.png
deleted file mode 100644
index f3e2010..0000000
--- a/textures/rgblightstone_black.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_blue.png b/textures/rgblightstone_blue.png
deleted file mode 100644
index 064f202..0000000
--- a/textures/rgblightstone_blue.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_brown.png b/textures/rgblightstone_brown.png
deleted file mode 100644
index d030973..0000000
--- a/textures/rgblightstone_brown.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_cyan.png b/textures/rgblightstone_cyan.png
deleted file mode 100644
index b359bca..0000000
--- a/textures/rgblightstone_cyan.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkblue.png b/textures/rgblightstone_darkblue.png
deleted file mode 100644
index b7a49b9..0000000
--- a/textures/rgblightstone_darkblue.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkcyan.png b/textures/rgblightstone_darkcyan.png
deleted file mode 100644
index 4f6fe92..0000000
--- a/textures/rgblightstone_darkcyan.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkgray.png b/textures/rgblightstone_darkgray.png
deleted file mode 100644
index 9a0b84f..0000000
--- a/textures/rgblightstone_darkgray.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkgreen.png b/textures/rgblightstone_darkgreen.png
deleted file mode 100644
index 9e4b3fa..0000000
--- a/textures/rgblightstone_darkgreen.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkmagenta.png b/textures/rgblightstone_darkmagenta.png
deleted file mode 100644
index 693a301..0000000
--- a/textures/rgblightstone_darkmagenta.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_darkred.png b/textures/rgblightstone_darkred.png
deleted file mode 100644
index f3d051e..0000000
--- a/textures/rgblightstone_darkred.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_green.png b/textures/rgblightstone_green.png
deleted file mode 100644
index 85cdaae..0000000
--- a/textures/rgblightstone_green.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_magenta.png b/textures/rgblightstone_magenta.png
deleted file mode 100644
index 3aa7238..0000000
--- a/textures/rgblightstone_magenta.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_red.png b/textures/rgblightstone_red.png
deleted file mode 100644
index ba656da..0000000
--- a/textures/rgblightstone_red.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_white.png b/textures/rgblightstone_white.png
deleted file mode 100644
index 095ca8f..0000000
--- a/textures/rgblightstone_white.png
+++ /dev/null
Binary files differ
diff --git a/textures/rgblightstone_yellow.png b/textures/rgblightstone_yellow.png
deleted file mode 100644
index c976bff..0000000
--- a/textures/rgblightstone_yellow.png
+++ /dev/null
Binary files differ