minetest_colorcubes/init.lua

73 lines
3.2 KiB
Lua
Raw Normal View History

2014-06-10 08:51:12 -07:00
local cc = {}
2016-07-02 17:01:15 -07:00
cc.colors = { "white", "yellow", "orange", "red", "redviolet", "magenta", "violet", "blue", "skyblue", "cyan", "aqua", "green", "lime", "pink", "brown", "dark_green", "light_gray", "dark_gray", "black" }
cc.dyecolors = { "unicolor_white", "unicolor_yellow", "unicolor_orange", "unicolor_red", "unicolor_red_violet", "unicolor_magenta", "unicolor_violet", "unicolor_blue", "unicolor_sky_blue", "unicolor_cyan", "unicolor_aqua", "unicolor_green", "unicolor_lime", "unicolor_light_red", "unicolor_dark_orange", "unicolor_dark_green", "unicolor_grey", "unicolor_darkgrey", "unicolor_black" }
cc.human_colors = { "white", "yellow", "orange", "red", "red-violet", "magenta", "violet", "blue", "skyblue", "cyan", "aqua", "green", "lime", "pink", "brown", "dark green", "light gray", "dark gray", "black" }
local light_level = 14
2014-06-10 08:51:12 -07:00
for i=1,#cc.colors do
local c = cc.colors[i]
local h = cc.human_colors[i]
local nodedef1 = {
description = h.." abstract block",
tiles = { "colorcubes_1_"..c..".png" },
2014-06-10 08:51:12 -07:00
groups = { dig_immediate = 2 },
sounds = { footstep = { name = "colorcubes_block_footstep", gain = 0.5 } }
}
local nodedef_window = {
description = h.." abstract window block",
tiles = { "colorcubes_window_"..c..".png" },
2014-10-10 01:57:51 -07:00
inventory_image = minetest.inventorycube("colorcubes_window_"..c..".png"),
groups = { dig_immediate = 2 },
use_texture_alpha = true,
drawtype = "glasslike",
2014-10-10 01:57:51 -07:00
sunlight_propagates = true,
paramtype = "light",
}
2014-06-10 08:51:12 -07:00
local nodedef4 = {
description = h.." tiled abstract block",
tiles = { "colorcubes_4_"..c..".png" },
2014-06-10 08:51:12 -07:00
groups = { dig_immediate = 2 },
sounds = { footstep = { name = "colorcubes_block_footstep", gain = 0.5 } }
}
local nodedef_inward = {
description = h.." inward abstract block",
tiles = { "colorcubes_inward_"..c..".png" },
2014-06-10 08:51:12 -07:00
groups = { dig_immediate = 2 },
sounds = { footstep = { name = "colorcubes_block_footstep", gain = 0.5 } }
}
2016-07-02 17:01:15 -07:00
if light_level > 1 then
local nodedef_light = {
description = h.." abstract lamp",
tiles = { "colorcubes_light_"..c..".png" },
groups = { dig_immediate = 2 },
sounds = { footstep = { name = "colorcubes_block_footstep", gain = 0.5 } },
light_source = light_level,
}
minetest.register_node("colorcubes:"..c.."_light", nodedef_light)
light_level = light_level - 1
end
2014-06-10 18:02:47 -07:00
minetest.register_node("colorcubes:"..c.."_single", nodedef1)
minetest.register_node("colorcubes:"..c.."_window", nodedef_window)
2014-06-10 08:51:12 -07:00
minetest.register_node("colorcubes:"..c.."_tiled", nodedef4)
minetest.register_node("colorcubes:"..c.."_inward", nodedef_inward)
2014-06-10 21:05:30 -07:00
--[[ If the paint_roller mod is installed, register the nodes to it ]]
if(minetest.get_modpath("paint_roller") ~= nil) then
local d = cc.dyecolors[i]
paint_roller.register_one("colorcubes:"..c.."_single", d, "Simple Abstract Blocks" )
paint_roller.register_one("colorcubes:"..c.."_tiled", d, "Tiled Abstract Blocks" )
paint_roller.register_one("colorcubes:"..c.."_inward", d, "Inwardly-Patterend Abstract Blocks" )
paint_roller.register_one("colorcubes:"..c.."_window", d, "Abstract Window Block" )
end
2014-06-10 08:51:12 -07:00
minetest.register_craft({
output = "colorcubes:"..c.."_tiled 4",
recipe = {
{"colorcubes:"..c, "colorcubes:"..c },
{"colorcubes:"..c, "colorcubes:"..c },
},
})
end