diff --git a/colors.lua b/colors.lua index 463dac1..0b12569 100644 --- a/colors.lua +++ b/colors.lua @@ -9,7 +9,7 @@ local palettes = {} local MP = minetest.get_modpath("isogen") local function parse_file(filename) - for line in io.lines(MP .. "/colors/" .. filename) do + for line in io.lines(filename) do if #line > 2 and line:sub(1,1) ~= "#" then local i = 1 local name @@ -58,18 +58,24 @@ local function parse_mapcolors() end local function init() - parse_file("advtrains.txt") - parse_file("everness.txt") - parse_file("mc2.txt") - parse_file("miles.txt") - parse_file("mtg.txt") - parse_file("naturalbiomes.txt") - parse_file("nodecore.txt") - parse_file("scifi_nodes.txt") - parse_file("vanessa.txt") - parse_file("void.txt") + parse_file(MP .. "/colors/" .. "advtrains.txt") + parse_file(MP .. "/colors/" .. "everness.txt") + parse_file(MP .. "/colors/" .. "mc2.txt") + parse_file(MP .. "/colors/" .. "miles.txt") + parse_file(MP .. "/colors/" .. "mtg.txt") + parse_file(MP .. "/colors/" .. "naturalbiomes.txt") + parse_file(MP .. "/colors/" .. "nodecore.txt") + parse_file(MP .. "/colors/" .. "scifi_nodes.txt") + parse_file(MP .. "/colors/" .. "vanessa.txt") + parse_file(MP .. "/colors/" .. "void.txt") parse_palette("unifieddyes_palette_extended") parse_mapcolors() + + -- check for world-specific colors.txt file + local world_colors_filename = minetest.get_worldpath() .. "/colors.txt" + if io.open(world_colors_filename) then + parse_file(world_colors_filename) + end end local is_initialized = false diff --git a/readme.md b/readme.md index 7d567d5..d992d9c 100644 --- a/readme.md +++ b/readme.md @@ -22,6 +22,14 @@ If the `worldedit` mod is present you can use the following command to render th **NOTE**: larger regions require more memory +# Colors + +Supported node-colors: +* colors.txt files in the `/colors` directory +* palette-support for `unifieddyes_palette_extended` +* `mapcolor` node definition +* `colors.txt` file in the world-directory (if found) + # Api ## `isogen.draw(pos1, pos2, cube_len?)`