Add grayscale color palette

This commit is contained in:
Wuzzy 2022-04-20 16:18:16 +02:00
parent ae764cff25
commit feddf7273f
5 changed files with 32 additions and 13 deletions

View File

@ -222,12 +222,11 @@ Note that the colors only serve as a visual aid and
given the limited palette, is only an estimation given the limited palette, is only an estimation
of the noise values. You can always use the Perlin Value of the noise values. You can always use the Perlin Value
Getter for the exact values. Getter for the exact values.
If you have problems seeing color differences, feel free If you have problems seeing color differences, activate
to edit these files in the `textures` directory of this the grayscale color palette in the mod settings.
mod with an image editor:
* `perlin_explorer_node_palette.png`: High value colors The following settings are only used when you want
* `perlin_explorer_node_palette_low.png`: Low values colors to place nodes in a certain area:
* X, Y, Z: Coordinates of the bottom left front corner if you * X, Y, Z: Coordinates of the bottom left front corner if you
want to generate an area manually with “Apply and create” want to generate an area manually with “Apply and create”

View File

@ -1,6 +1,11 @@
-- If true, the Perlin test nodes will support color -- If true, the Perlin test nodes will support color
-- (set to false in case of performance problems) -- (set to false in case of performance problems)
local COLORIZE_NODES = true local colorize_nodes = minetest.settings:get_bool("perlin_explorer_colorize", true)
-- If true, will use the grayscale color palette.
-- If false, will use the default colors.
local grayscale_colors = minetest.settings:get_bool("perlin_explorer_grayscale", false)
-- The number of available test node colors is divided by this number. -- The number of available test node colors is divided by this number.
-- A number between 1 to 256 -- A number between 1 to 256
-- * 1 = Full 256 palette. -- * 1 = Full 256 palette.
@ -265,10 +270,17 @@ minetest.register_on_mods_loaded(function()
end) end)
-- Test nodes to generate a map based on a perlin noise -- Test nodes to generate a map based on a perlin noise
local paramtype2 local paramtype2, palette
if COLORIZE_NODES then if colorize_nodes then
paramtype2 = "color" paramtype2 = "color"
end end
if grayscale_colors then
palette = "perlin_explorer_node_palette_gray.png"
palette_low = "perlin_explorer_node_palette_gray_low.png"
else
palette = "perlin_explorer_node_palette.png"
palette_low = "perlin_explorer_node_palette_low.png"
end
minetest.register_node("perlin_explorer:node", { minetest.register_node("perlin_explorer:node", {
description = S("Perlin Test Node (High Value)"), description = S("Perlin Test Node (High Value)"),
@ -276,7 +288,7 @@ minetest.register_node("perlin_explorer:node", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_node.png"}, tiles = {"perlin_explorer_node.png"},
palette = "perlin_explorer_node_palette.png", palette = palette,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
-- Force-drop without metadata to avoid spamming the inventory -- Force-drop without metadata to avoid spamming the inventory
drop = "perlin_explorer:node", drop = "perlin_explorer:node",
@ -287,7 +299,7 @@ minetest.register_node("perlin_explorer:node_low", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_node_low.png"}, tiles = {"perlin_explorer_node_low.png"},
palette = "perlin_explorer_node_palette_low.png", palette = palette_low,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
-- Force-drop without metadata to avoid spamming the inventory -- Force-drop without metadata to avoid spamming the inventory
drop = "perlin_explorer:node_low", drop = "perlin_explorer:node_low",
@ -302,6 +314,7 @@ minetest.register_node("perlin_explorer:grid", {
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_grid.png"}, tiles = {"perlin_explorer_grid.png"},
palette = "perlin_explorer_node_palette.png", palette = "perlin_explorer_node_palette.png",
palette = palette,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
drop = "perlin_explorer:grid", drop = "perlin_explorer:grid",
}) })
@ -313,7 +326,7 @@ minetest.register_node("perlin_explorer:grid_low", {
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_grid_low.png"}, tiles = {"perlin_explorer_grid_low.png"},
use_texture_alpha = "clip", use_texture_alpha = "clip",
palette = "perlin_explorer_node_palette_low.png", palette = palette_low,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
drop = "perlin_explorer:grid_low", drop = "perlin_explorer:grid_low",
}) })
@ -332,7 +345,7 @@ minetest.register_node("perlin_explorer:mini", {
sunlight_propagates = true, sunlight_propagates = true,
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_mini.png"}, tiles = {"perlin_explorer_mini.png"},
palette = "perlin_explorer_node_palette.png", palette = palette,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
drop = "perlin_explorer:mini", drop = "perlin_explorer:mini",
}) })
@ -350,7 +363,7 @@ minetest.register_node("perlin_explorer:mini_low", {
paramtype2 = paramtype2, paramtype2 = paramtype2,
tiles = {"perlin_explorer_mini_low.png"}, tiles = {"perlin_explorer_mini_low.png"},
use_texture_alpha = "clip", use_texture_alpha = "clip",
palette = "perlin_explorer_node_palette_low.png", palette = palette_low,
groups = { dig_immediate = 3 }, groups = { dig_immediate = 3 },
drop = "perlin_explorer:mini_low", drop = "perlin_explorer:mini_low",
}) })

7
settingtypes.txt Normal file
View File

@ -0,0 +1,7 @@
# If enabled, generated nodes will be colorized.
# Disable this if you have performance problems.
perlin_explorer_colorize_nodes (Colorize nodes) bool true
# If enabled, will use the grayscale color palette for the nodes.
# If disabled, will use the default colors instead.
perlin_explorer_grayscale (Use grayscale color palette) bool false

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB