Capture and customize colors of default minetest_game nodes
parent
c722243971
commit
0ead6905fe
|
@ -35,7 +35,7 @@ So here is the example using the canvas with size 16 marking its capture space:
|
||||||
|
|
||||||
![Empty canvas](/screenshots/canvas-empty.png)
|
![Empty canvas](/screenshots/canvas-empty.png)
|
||||||
|
|
||||||
In this space you can build anthing you like by using colored wool blocks_
|
In this space you can build anything you like by using colored wool blocks or most of the built-in blocks shipped with minetest_game:
|
||||||
|
|
||||||
![Building inside the canvas](/screenshots/canvas-build.png)
|
![Building inside the canvas](/screenshots/canvas-build.png)
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ By default, four versions of each mesh will be available:
|
||||||
![Wool version](/screenshots/version-wool.png)
|
![Wool version](/screenshots/version-wool.png)
|
||||||
![Wool bordered compare](/screenshots/wool-bordered-compare.png)
|
![Wool bordered compare](/screenshots/wool-bordered-compare.png)
|
||||||
|
|
||||||
|
Sample of natural terrain capture:
|
||||||
|
![Non wool capture](/screenshots/non-wool-capture.png)
|
||||||
|
|
||||||
Such new blocks can't be crafted (I plan to make sort of a crafting station where you put some material and chose the model you want to craft), so you either need to give them to yourself or to find them in the Creative inventory. All such meshes show up if you filter for either "wesh" or "mesh".
|
Such new blocks can't be crafted (I plan to make sort of a crafting station where you put some material and chose the model you want to craft), so you either need to give them to yourself or to find them in the Creative inventory. All such meshes show up if you filter for either "wesh" or "mesh".
|
||||||
|
|
||||||
![Creative search](/screenshots/creative-search.png)
|
![Creative search](/screenshots/creative-search.png)
|
||||||
|
@ -113,3 +116,7 @@ A couple considerations:
|
||||||
- the bottom-right transparent area never gets used
|
- the bottom-right transparent area never gets used
|
||||||
- the used texture for each face will actually be a bit smaller (in the "wool-72.png" file the squares are 18 pixels in side, but the texture will only use a 16x16 square inside of it)
|
- the used texture for each face will actually be a bit smaller (in the "wool-72.png" file the squares are 18 pixels in side, but the texture will only use a 16x16 square inside of it)
|
||||||
- you're not forced to use any particular size for your texture as long as it's square (I guess, let me know if you find any problems)
|
- you're not forced to use any particular size for your texture as long as it's square (I guess, let me know if you find any problems)
|
||||||
|
|
||||||
|
# Changing default colors assigned to nodes
|
||||||
|
|
||||||
|
The file [nodecolors.conf](/nodecolors.conf) contains the `modname:nodename = color` associations for all the nodes that get loaded in a minetest_game world. You're free to alter them or to add to this list as you please, just make sure you stick to wool colors cause any invalid color will be replaced by "air".
|
||||||
|
|
44
init.lua
44
init.lua
|
@ -98,16 +98,18 @@ function wesh._init_colors()
|
||||||
"cyan",
|
"cyan",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- The following loop populates the color_vertices table with data like this...
|
-- The following loop populates the color_vertices table with data like this...
|
||||||
--
|
--
|
||||||
-- wesh.color_vertices = {
|
-- wesh.color_vertices = {
|
||||||
-- violet = { 1, 2, 3, 4 },
|
-- violet = { 1, 2, 3, 4 },
|
||||||
-- white = { 5, 6, 7, 8 },
|
-- white = { 5, 6, 7, 8 },
|
||||||
--
|
--
|
||||||
-- ...and so forth, in a boring sequence.
|
-- ...and so forth, in a boring sequence.
|
||||||
--
|
--
|
||||||
-- Such indices will refer to the vt sequence generated by _init_vertex_textures()
|
-- Such indices will refer to the vt sequence generated by _init_vertex_textures()
|
||||||
|
-- The same loop will also fill the nodename_to_color table with default fallbacks for wool
|
||||||
|
|
||||||
|
wesh.nodename_to_color = {}
|
||||||
wesh.color_vertices = {}
|
wesh.color_vertices = {}
|
||||||
for i, color in ipairs(wesh.colors) do
|
for i, color in ipairs(wesh.colors) do
|
||||||
local t = {}
|
local t = {}
|
||||||
|
@ -116,7 +118,28 @@ function wesh._init_colors()
|
||||||
table.insert(t, k)
|
table.insert(t, k)
|
||||||
end
|
end
|
||||||
wesh.color_vertices[color] = t
|
wesh.color_vertices[color] = t
|
||||||
|
if color ~= "air" then
|
||||||
|
wesh.nodename_to_color["wool:" .. color] = color
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The following loop will fill the nodename_to_color table with custom values
|
||||||
|
local file = io.open(wesh.modpath .. "/nodecolors.conf", "rb")
|
||||||
|
if not file then
|
||||||
|
minetest.debug("[wesh] Unable to load nodecolors.conf file from mod folder")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local content = file:read("*all")
|
||||||
|
local lines = content:gsub("(\r\n)+", "\r"):gsub("\r+", "\n"):split("\n")
|
||||||
|
for _, line in ipairs(lines) do
|
||||||
|
local parts = line:gsub("%s+", ""):split("=")
|
||||||
|
if #parts == 2 then
|
||||||
|
wesh.nodename_to_color[parts[1]] = parts[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
file:close()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function wesh._init_geometry()
|
function wesh._init_geometry()
|
||||||
|
@ -395,8 +418,7 @@ end
|
||||||
function wesh.get_node_color(pos)
|
function wesh.get_node_color(pos)
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if not node then return "air" end
|
if not node then return "air" end
|
||||||
local parts = string.split(node.name, ":")
|
return wesh.nodename_to_color[node.name] or "air"
|
||||||
return parts[#parts]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function wesh.make_absolute(canvas_pos, canv_size, facedir, relative_pos)
|
function wesh.make_absolute(canvas_pos, canv_size, facedir, relative_pos)
|
||||||
|
|
|
@ -0,0 +1,291 @@
|
||||||
|
air = air
|
||||||
|
beds:bed_bottom = air
|
||||||
|
beds:bed_top = air
|
||||||
|
beds:fancy_bed_bottom = air
|
||||||
|
beds:fancy_bed_top = air
|
||||||
|
bones:bones = black
|
||||||
|
carts:brakerail = air
|
||||||
|
carts:powerrail = air
|
||||||
|
carts:rail = air
|
||||||
|
default:acacia_bush_leaves = dark_green
|
||||||
|
default:acacia_bush_sapling = dark_green
|
||||||
|
default:acacia_bush_stem = dark_green
|
||||||
|
default:acacia_leaves = dark_green
|
||||||
|
default:acacia_sapling = dark_green
|
||||||
|
default:acacia_tree = brown
|
||||||
|
default:acacia_wood = brown
|
||||||
|
default:apple = red
|
||||||
|
default:aspen_leaves = dark_green
|
||||||
|
default:aspen_sapling = dark_green
|
||||||
|
default:aspen_tree = brown
|
||||||
|
default:aspen_wood = brown
|
||||||
|
default:bookshelf = brown
|
||||||
|
default:brick = red
|
||||||
|
default:bronzeblock = orange
|
||||||
|
default:bush_leaves = dark_green
|
||||||
|
default:bush_sapling = dark_green
|
||||||
|
default:bush_stem = dark_green
|
||||||
|
default:cactus = green
|
||||||
|
default:chest = brown
|
||||||
|
default:chest_locked = brown
|
||||||
|
default:chest_locked_open = brown
|
||||||
|
default:chest_open = brown
|
||||||
|
default:clay = grey
|
||||||
|
default:cloud = air
|
||||||
|
default:coalblock = black
|
||||||
|
default:cobble = grey
|
||||||
|
default:copperblock = orange
|
||||||
|
default:coral_brown = brown
|
||||||
|
default:coral_orange = orange
|
||||||
|
default:coral_skeleton = white
|
||||||
|
default:desert_cobble = grey
|
||||||
|
default:desert_sand = grey
|
||||||
|
default:desert_sandstone = grey
|
||||||
|
default:desert_sandstone_block = grey
|
||||||
|
default:desert_sandstone_brick = grey
|
||||||
|
default:desert_stone = brown
|
||||||
|
default:desert_stone_block = brown
|
||||||
|
default:desert_stonebrick = brown
|
||||||
|
default:diamondblock = cyan
|
||||||
|
default:dirt = brown
|
||||||
|
default:dirt_with_dry_grass = yellow
|
||||||
|
default:dirt_with_grass = green
|
||||||
|
default:dirt_with_grass_footsteps = green
|
||||||
|
default:dirt_with_rainforest_litter = dark_green
|
||||||
|
default:dirt_with_snow = white
|
||||||
|
default:dry_grass_1 = air
|
||||||
|
default:dry_grass_2 = air
|
||||||
|
default:dry_grass_3 = air
|
||||||
|
default:dry_grass_4 = air
|
||||||
|
default:dry_grass_5 = air
|
||||||
|
default:dry_shrub = air
|
||||||
|
default:fence_acacia_wood = air
|
||||||
|
default:fence_aspen_wood = air
|
||||||
|
default:fence_junglewood = air
|
||||||
|
default:fence_pine_wood = air
|
||||||
|
default:fence_wood = air
|
||||||
|
default:furnace = dark_grey
|
||||||
|
default:furnace_active = dark_grey
|
||||||
|
default:glass = air
|
||||||
|
default:goldblock = yellow
|
||||||
|
default:grass_1 = air
|
||||||
|
default:grass_2 = air
|
||||||
|
default:grass_3 = air
|
||||||
|
default:grass_4 = air
|
||||||
|
default:grass_5 = air
|
||||||
|
default:gravel = grey
|
||||||
|
default:ice = cyan
|
||||||
|
default:junglegrass = air
|
||||||
|
default:jungleleaves = dark_green
|
||||||
|
default:junglesapling = dark_green
|
||||||
|
default:jungletree = brown
|
||||||
|
default:junglewood = brown
|
||||||
|
default:ladder_steel = air
|
||||||
|
default:ladder_wood = air
|
||||||
|
default:lava_flowing = red
|
||||||
|
default:lava_source = red
|
||||||
|
default:leaves = dark_green
|
||||||
|
default:mese = yellow
|
||||||
|
default:mese_post_light = air
|
||||||
|
default:meselamp = yellow
|
||||||
|
default:mossycobble = dark_grey
|
||||||
|
default:obsidian = dark_grey
|
||||||
|
default:obsidian_block = dark_grey
|
||||||
|
default:obsidian_glass = air
|
||||||
|
default:obsidianbrick = dark_grey
|
||||||
|
default:papyrus = green
|
||||||
|
default:pine_needles = dark_green
|
||||||
|
default:pine_sapling = dark_green
|
||||||
|
default:pine_tree = brown
|
||||||
|
default:pine_wood = brown
|
||||||
|
default:river_water_flowing = blue
|
||||||
|
default:river_water_source = blue
|
||||||
|
default:sand = grey
|
||||||
|
default:sandstone = grey
|
||||||
|
default:sandstone_block = grey
|
||||||
|
default:sandstonebrick = grey
|
||||||
|
default:sapling = green
|
||||||
|
default:sign_wall_steel = air
|
||||||
|
default:sign_wall_wood = air
|
||||||
|
default:silver_sand = grey
|
||||||
|
default:silver_sandstone = grey
|
||||||
|
default:silver_sandstone_block = grey
|
||||||
|
default:silver_sandstone_brick = grey
|
||||||
|
default:snow = white
|
||||||
|
default:snowblock = white
|
||||||
|
default:steelblock = grey
|
||||||
|
default:stone = grey
|
||||||
|
default:stone_block = grey
|
||||||
|
default:stone_with_coal = grey
|
||||||
|
default:stone_with_copper = grey
|
||||||
|
default:stone_with_diamond = grey
|
||||||
|
default:stone_with_gold = grey
|
||||||
|
default:stone_with_iron = grey
|
||||||
|
default:stone_with_mese = grey
|
||||||
|
default:stone_with_tin = grey
|
||||||
|
default:stonebrick = grey
|
||||||
|
default:tinblock = grey
|
||||||
|
default:torch = air
|
||||||
|
default:torch_ceiling = air
|
||||||
|
default:torch_wall = air
|
||||||
|
default:tree = brown
|
||||||
|
default:water_flowing = blue
|
||||||
|
default:water_source = blue
|
||||||
|
default:wood = brown
|
||||||
|
doors:door_glass_a = air
|
||||||
|
doors:door_glass_b = air
|
||||||
|
doors:door_obsidian_glass_a = air
|
||||||
|
doors:door_obsidian_glass_b = air
|
||||||
|
doors:door_steel_a = air
|
||||||
|
doors:door_steel_b = air
|
||||||
|
doors:door_wood_a = air
|
||||||
|
doors:door_wood_b = air
|
||||||
|
doors:gate_acacia_wood_closed = air
|
||||||
|
doors:gate_acacia_wood_open = air
|
||||||
|
doors:gate_aspen_wood_closed = air
|
||||||
|
doors:gate_aspen_wood_open = air
|
||||||
|
doors:gate_junglewood_closed = air
|
||||||
|
doors:gate_junglewood_open = air
|
||||||
|
doors:gate_pine_wood_closed = air
|
||||||
|
doors:gate_pine_wood_open = air
|
||||||
|
doors:gate_wood_closed = air
|
||||||
|
doors:gate_wood_open = air
|
||||||
|
doors:hidden = air
|
||||||
|
doors:trapdoor = air
|
||||||
|
doors:trapdoor_open = air
|
||||||
|
doors:trapdoor_steel = air
|
||||||
|
doors:trapdoor_steel_open = air
|
||||||
|
farming:cotton_1 = air
|
||||||
|
farming:cotton_2 = air
|
||||||
|
farming:cotton_3 = air
|
||||||
|
farming:cotton_4 = air
|
||||||
|
farming:cotton_5 = air
|
||||||
|
farming:cotton_6 = air
|
||||||
|
farming:cotton_7 = air
|
||||||
|
farming:cotton_8 = air
|
||||||
|
farming:desert_sand_soil = brown
|
||||||
|
farming:desert_sand_soil_wet = brown
|
||||||
|
farming:seed_cotton = air
|
||||||
|
farming:seed_wheat = air
|
||||||
|
farming:soil = air
|
||||||
|
farming:soil_wet = air
|
||||||
|
farming:straw = air
|
||||||
|
farming:wheat_1 = air
|
||||||
|
farming:wheat_2 = air
|
||||||
|
farming:wheat_3 = air
|
||||||
|
farming:wheat_4 = air
|
||||||
|
farming:wheat_5 = air
|
||||||
|
farming:wheat_6 = air
|
||||||
|
farming:wheat_7 = air
|
||||||
|
farming:wheat_8 = air
|
||||||
|
fire:basic_flame = air
|
||||||
|
fire:permanent_flame = air
|
||||||
|
flowers:dandelion_white = white
|
||||||
|
flowers:dandelion_yellow = yellow
|
||||||
|
flowers:geranium = blue
|
||||||
|
flowers:mushroom_brown = brown
|
||||||
|
flowers:mushroom_red = red
|
||||||
|
flowers:rose = red:tuli
|
||||||
|
flowers:tulip = orange
|
||||||
|
flowers:viola = violet
|
||||||
|
flowers:waterlily = green
|
||||||
|
ignore = air
|
||||||
|
stairs:slab_acacia_wood = brown
|
||||||
|
stairs:slab_aspen_wood = brown
|
||||||
|
stairs:slab_brick = red
|
||||||
|
stairs:slab_bronzeblock = orange
|
||||||
|
stairs:slab_cobble = grey
|
||||||
|
stairs:slab_copperblock = orange
|
||||||
|
stairs:slab_desert_cobble = grey
|
||||||
|
stairs:slab_desert_sandstone = grey
|
||||||
|
stairs:slab_desert_sandstone_block = grey
|
||||||
|
stairs:slab_desert_sandstone_brick = grey
|
||||||
|
stairs:slab_desert_stone = brown
|
||||||
|
stairs:slab_desert_stone_block = brown
|
||||||
|
stairs:slab_desert_stonebrick = brown
|
||||||
|
stairs:slab_goldblock = yellow
|
||||||
|
stairs:slab_ice = cyan
|
||||||
|
stairs:slab_junglewood = brown
|
||||||
|
stairs:slab_mossycobble = grey
|
||||||
|
stairs:slab_obsidian = dark_grey
|
||||||
|
stairs:slab_obsidian_block = dark_grey
|
||||||
|
stairs:slab_obsidianbrick = dark_grey
|
||||||
|
stairs:slab_pine_wood = brown
|
||||||
|
stairs:slab_sandstone = grey
|
||||||
|
stairs:slab_sandstone_block = grey
|
||||||
|
stairs:slab_sandstonebrick = grey
|
||||||
|
stairs:slab_silver_sandstone = grey
|
||||||
|
stairs:slab_silver_sandstone_block = grey
|
||||||
|
stairs:slab_silver_sandstone_brick = grey
|
||||||
|
stairs:slab_snowblock = white
|
||||||
|
stairs:slab_steelblock = grey
|
||||||
|
stairs:slab_stone = grey
|
||||||
|
stairs:slab_stone_block = grey
|
||||||
|
stairs:slab_stonebrick = grey
|
||||||
|
stairs:slab_straw = yellow
|
||||||
|
stairs:slab_wood = brown
|
||||||
|
stairs:stair_acacia_wood = brown
|
||||||
|
stairs:stair_aspen_wood = brown
|
||||||
|
stairs:stair_brick = red
|
||||||
|
stairs:stair_bronzeblock = orange
|
||||||
|
stairs:stair_cobble = grey
|
||||||
|
stairs:stair_copperblock = orange
|
||||||
|
stairs:stair_desert_cobble = grey
|
||||||
|
stairs:stair_desert_sandstone = grey
|
||||||
|
stairs:stair_desert_sandstone_block = grey
|
||||||
|
stairs:stair_desert_sandstone_brick = grey
|
||||||
|
stairs:stair_desert_stone = grey
|
||||||
|
stairs:stair_desert_stone_block = grey
|
||||||
|
stairs:stair_desert_stonebrick = grey
|
||||||
|
stairs:stair_goldblock = yellow
|
||||||
|
stairs:stair_ice = cyan
|
||||||
|
stairs:stair_junglewood = brown
|
||||||
|
stairs:stair_mossycobble = grey
|
||||||
|
stairs:stair_obsidian = dark_grey
|
||||||
|
stairs:stair_obsidian_block = dark_grey
|
||||||
|
stairs:stair_obsidianbrick = dark_grey
|
||||||
|
stairs:stair_pine_wood = brown
|
||||||
|
stairs:stair_sandstone = grey
|
||||||
|
stairs:stair_sandstone_block = grey
|
||||||
|
stairs:stair_sandstonebrick = grey
|
||||||
|
stairs:stair_silver_sandstone = grey
|
||||||
|
stairs:stair_silver_sandstone_block = grey
|
||||||
|
stairs:stair_silver_sandstone_brick = grey
|
||||||
|
stairs:stair_snowblock = cyan
|
||||||
|
stairs:stair_steelblock = grey
|
||||||
|
stairs:stair_stone = grey
|
||||||
|
stairs:stair_stone_block = grey
|
||||||
|
stairs:stair_stonebrick = grey
|
||||||
|
stairs:stair_straw = yellow
|
||||||
|
stairs:stair_wood = brown
|
||||||
|
tnt:boom = air
|
||||||
|
tnt:gunpowder = air
|
||||||
|
tnt:gunpowder_burning = air
|
||||||
|
tnt:tnt = red
|
||||||
|
tnt:tnt_burning = air
|
||||||
|
vessels:drinking_glass = air
|
||||||
|
vessels:glass_bottle = air
|
||||||
|
vessels:shelf = brown
|
||||||
|
vessels:steel_bottle = air
|
||||||
|
walls:cobble = grey
|
||||||
|
walls:desertcobble = grey
|
||||||
|
walls:mossycobble = grey
|
||||||
|
wool:black = black
|
||||||
|
wool:blue = blue
|
||||||
|
wool:brown = brown
|
||||||
|
wool:cyan = cyan
|
||||||
|
wool:dark_green = dark_green
|
||||||
|
wool:dark_grey = dark_grey
|
||||||
|
wool:green = green
|
||||||
|
wool:grey = grey
|
||||||
|
wool:magenta = magenta
|
||||||
|
wool:orange = orange
|
||||||
|
wool:pink = pink
|
||||||
|
wool:red = red
|
||||||
|
wool:violet = violet
|
||||||
|
wool:white = white
|
||||||
|
wool:yellow = yellow
|
||||||
|
xpanes:bar = air
|
||||||
|
xpanes:bar_flat = air
|
||||||
|
xpanes:pane = air
|
||||||
|
xpanes:pane_flat = air
|
Binary file not shown.
After Width: | Height: | Size: 504 KiB |
Loading…
Reference in New Issue