Read custom laser colors from settings
This commit is contained in:
parent
494643d6c6
commit
891489a293
@ -10,6 +10,23 @@ lzr_laser.DEFAULT_LASER_COLORS = {
|
||||
[lzr_globals.COLOR_MAGENTA] = "#FF00FF",
|
||||
[lzr_globals.COLOR_WHITE] = "#FFFFFF",
|
||||
}
|
||||
local colors = { "red", "green", "blue", "yellow", "cyan", "magenta", "white" }
|
||||
|
||||
local function read_laser_color_settings()
|
||||
for c=1, #colors do
|
||||
local setting = minetest.settings:get("lzr_laser_color_"..colors[c])
|
||||
if setting then
|
||||
local hexcode = string.match(setting, "[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]")
|
||||
if hexcode then
|
||||
lzr_laser.DEFAULT_LASER_COLORS[c] = "#" .. hexcode
|
||||
minetest.log("action", "[lzr_laser] Custom laser color read from setting 'lzr_laser_color_"..colors[c]..": #"..hexcode)
|
||||
elseif setting ~= "" then
|
||||
minetest.log("warning", "[lzr_laser] Setting 'lzr_laser_color_"..colors[c].."' has wrong syntax. Must be a 6-digit hexadecimal number (0-9, A-F).")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
read_laser_color_settings()
|
||||
|
||||
-- List of patterns to apply on lasers to distinguish them by some other
|
||||
-- way than just color. Implemented to deal with colorblindness.
|
||||
|
@ -10,3 +10,41 @@ lzr_patterned_lasers (Represent laser colors by patterns [colorblind support]) b
|
||||
# If true, background ambience sounds will be played.
|
||||
# Note: You can always toggle ambience sounds in-game with the '/ambience' command.
|
||||
lzr_ambience_start_with_ambience (Ambience sounds) bool true
|
||||
|
||||
[Laser colors]
|
||||
# Replace the color of red lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_red (Red laser color override) string FF0000
|
||||
|
||||
# Replace the color of green lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_green (Green laser color override) string 00FF00
|
||||
|
||||
# Replace the color of blue lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format
|
||||
lzr_laser_color_blue (Blue laser color override) string 0000FF
|
||||
|
||||
# Replace the color of yellow lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_yellow (Yellow laser color override) string FFFF00
|
||||
|
||||
# Replace the color of cyan lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_cyan (Cyan laser color override) string 00FFFF
|
||||
|
||||
# Replace the color of magenta lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_magenta (Magenta laser color override) string FF00FF
|
||||
|
||||
# Replace the color of white lasers with a custom color.
|
||||
# Specified by a 6-digit hexadecimal number (0-9, A-F)
|
||||
# in RRGGBB format.
|
||||
lzr_laser_color_white (White laser color override) string FFFFFF
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user