Generate all mapcolors

This commit is contained in:
Aaron Suen 2023-12-02 15:16:52 -05:00
parent 2b85eb9dcd
commit 91175ace30
3 changed files with 26 additions and 10 deletions

View File

@ -30,7 +30,8 @@ for i = 0, nodecore.hard_stone_strata do
drop_in_place = modname .. ((i > 1)
and (":ore_" .. (i - 1)) or (i > 0) and ":ore" or ":cobble"),
strata = strata,
silktouch = false
silktouch = false,
mapcolor = {r = 69, g = 58, b = 53},
})
end
@ -54,7 +55,8 @@ minetest.register_node(modname .. ":cobble", {
},
sounds = nodecore.sounds("nc_terrain_chompy")
},
sounds = nodecore.sounds("nc_terrain_stony")
sounds = nodecore.sounds("nc_terrain_stony"),
mapcolor = {r = 62, g = 52, b = 59},
})
minetest.register_node(modname .. ":egg", {
@ -77,7 +79,8 @@ minetest.register_node(modname .. ":egg", {
},
stack_max = 1,
on_place = minetest.rotate_and_place,
sounds = nodecore.sounds("nc_terrain_stony")
sounds = nodecore.sounds("nc_terrain_stony"),
mapcolor = {r = 81, g = 60, b = 54},
})
minetest.register_craftitem(modname .. ":prill", {

View File

@ -1,8 +1,10 @@
-- LUALOCALS < ---------------------------------------------------------
local ipairs, math, minetest, nodecore, pairs, string, type, vector
= ipairs, math, minetest, nodecore, pairs, string, type, vector
local math_random, string_gsub, string_lower
= math.random, string.gsub, string.lower
local ipairs, math, minetest, nodecore, pairs, string, tonumber, type,
vector
= ipairs, math, minetest, nodecore, pairs, string, tonumber, type,
vector
local math_random, string_gsub, string_lower, string_sub
= math.random, string.gsub, string.lower, string.sub
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
@ -238,12 +240,22 @@ function myapi.register_cat(desc, basetiles, basedef, overlays)
}, basedef))
end
function myapi.register_cat_spots(id, base, spot, ...)
function myapi.register_cat_spots(id, base, spot, basedef, ...)
local txr = "nc_cats_base.png^[multiply:" .. base
if base ~= spot then
txr = txr .. "^(nc_cats_spots.png^[multiply:" .. spot .. ")"
end
return myapi.register_cat(id, {txr}, ...)
basedef = nodecore.underride(basedef or {}, {
mapcolor = {
r = (tonumber(string_sub(base, 2, 3), 16)
+ tonumber(string_sub(spot, 2, 3), 16)) / 2,
g = (tonumber(string_sub(base, 4, 5), 16)
+ tonumber(string_sub(spot, 4, 5), 16)) / 2,
b = (tonumber(string_sub(base, 6, 7), 16)
+ tonumber(string_sub(spot, 6, 7), 16)) / 2,
}
})
return myapi.register_cat(id, {txr}, basedef, ...)
end
function myapi.makecat(pos, param2, creator)

View File

@ -75,6 +75,7 @@ do
end
return qty >= total and 1 or 0
end,
groups = {[modname .. "_rainbow"] = 1}
groups = {[modname .. "_rainbow"] = 1},
mapcolor = {r = 147, g = 55, b = 225}
})
end