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
of the noise values. You can always use the Perlin Value
Getter for the exact values.
If you have problems seeing color differences, feel free
to edit these files in the `textures` directory of this
mod with an image editor:
If you have problems seeing color differences, activate
the grayscale color palette in the mod settings.
* `perlin_explorer_node_palette.png`: High value colors
* `perlin_explorer_node_palette_low.png`: Low values colors
The following settings are only used when you want
to place nodes in a certain area:
* X, Y, Z: Coordinates of the bottom left front corner if you
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
-- (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.
-- A number between 1 to 256
-- * 1 = Full 256 palette.
@ -265,10 +270,17 @@ minetest.register_on_mods_loaded(function()
end)
-- Test nodes to generate a map based on a perlin noise
local paramtype2
if COLORIZE_NODES then
local paramtype2, palette
if colorize_nodes then
paramtype2 = "color"
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", {
description = S("Perlin Test Node (High Value)"),
@ -276,7 +288,7 @@ minetest.register_node("perlin_explorer:node", {
sunlight_propagates = true,
paramtype2 = paramtype2,
tiles = {"perlin_explorer_node.png"},
palette = "perlin_explorer_node_palette.png",
palette = palette,
groups = { dig_immediate = 3 },
-- Force-drop without metadata to avoid spamming the inventory
drop = "perlin_explorer:node",
@ -287,7 +299,7 @@ minetest.register_node("perlin_explorer:node_low", {
sunlight_propagates = true,
paramtype2 = paramtype2,
tiles = {"perlin_explorer_node_low.png"},
palette = "perlin_explorer_node_palette_low.png",
palette = palette_low,
groups = { dig_immediate = 3 },
-- Force-drop without metadata to avoid spamming the inventory
drop = "perlin_explorer:node_low",
@ -302,6 +314,7 @@ minetest.register_node("perlin_explorer:grid", {
paramtype2 = paramtype2,
tiles = {"perlin_explorer_grid.png"},
palette = "perlin_explorer_node_palette.png",
palette = palette,
groups = { dig_immediate = 3 },
drop = "perlin_explorer:grid",
})
@ -313,7 +326,7 @@ minetest.register_node("perlin_explorer:grid_low", {
paramtype2 = paramtype2,
tiles = {"perlin_explorer_grid_low.png"},
use_texture_alpha = "clip",
palette = "perlin_explorer_node_palette_low.png",
palette = palette_low,
groups = { dig_immediate = 3 },
drop = "perlin_explorer:grid_low",
})
@ -332,7 +345,7 @@ minetest.register_node("perlin_explorer:mini", {
sunlight_propagates = true,
paramtype2 = paramtype2,
tiles = {"perlin_explorer_mini.png"},
palette = "perlin_explorer_node_palette.png",
palette = palette,
groups = { dig_immediate = 3 },
drop = "perlin_explorer:mini",
})
@ -350,7 +363,7 @@ minetest.register_node("perlin_explorer:mini_low", {
paramtype2 = paramtype2,
tiles = {"perlin_explorer_mini_low.png"},
use_texture_alpha = "clip",
palette = "perlin_explorer_node_palette_low.png",
palette = palette_low,
groups = { dig_immediate = 3 },
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