2015-07-03 07:57:09 +03:00
|
|
|
local init = os.clock()
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2017-02-12 01:17:16 +03:00
|
|
|
local block = {}
|
|
|
|
block.dyes = {
|
2015-06-29 20:55:56 +03:00
|
|
|
{"white", "White", "white"},
|
|
|
|
{"grey", "Grey", "dark_grey"},
|
2017-02-12 02:00:17 +03:00
|
|
|
{"silver", "Light Grey", "grey"},
|
2015-06-29 20:55:56 +03:00
|
|
|
{"black", "Black", "black"},
|
|
|
|
{"red", "Red", "red"},
|
|
|
|
{"yellow", "Yellow", "yellow"},
|
|
|
|
{"green", "Green", "dark_green"},
|
|
|
|
{"cyan", "Cyan", "cyan"},
|
|
|
|
{"blue", "Blue", "blue"},
|
|
|
|
{"magenta", "Magenta", "magenta"},
|
|
|
|
{"orange", "Orange", "orange"},
|
|
|
|
{"purple", "Purple", "violet"},
|
2017-01-04 08:30:42 +03:00
|
|
|
{"brown", "Brown", "brown"},
|
|
|
|
{"pink", "Pink", "pink"},
|
2015-06-29 20:55:56 +03:00
|
|
|
{"lime", "Lime", "green"},
|
|
|
|
{"light_blue", "Light Blue", "lightblue"},
|
|
|
|
}
|
|
|
|
|
2017-02-12 01:17:16 +03:00
|
|
|
minetest.register_node("mcl_colorblocks:hardened_clay", {
|
2015-06-29 20:55:56 +03:00
|
|
|
description = "Hardened Clay",
|
|
|
|
tiles = {"hardened_clay.png"},
|
|
|
|
stack_max = 64,
|
2017-01-20 06:54:09 +03:00
|
|
|
groups = {cracky=3,hardened_clay=1,building_block=1},
|
2017-02-11 20:46:23 +03:00
|
|
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
2017-02-12 01:17:16 +03:00
|
|
|
output = "mcl_colorblocks:hardened_clay",
|
2017-02-01 01:32:56 +03:00
|
|
|
recipe = "mcl_core:clay",
|
2017-01-04 13:49:05 +03:00
|
|
|
cooktime = 10,
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2017-02-12 01:17:16 +03:00
|
|
|
for _, row in ipairs(block.dyes) do
|
2015-06-29 20:55:56 +03:00
|
|
|
local name = row[1]
|
|
|
|
local desc = row[2]
|
|
|
|
local craft_color_group = row[3]
|
|
|
|
-- Node Definition
|
2017-02-12 01:33:06 +03:00
|
|
|
minetest.register_node("mcl_colorblocks:hardened_clay_"..name, {
|
|
|
|
description = desc.." Hardened Clay",
|
|
|
|
tiles = {"hardened_clay_stained_"..name..".png"},
|
|
|
|
groups = {cracky=3,hardened_clay=1,building_block=1},
|
|
|
|
stack_max = 64,
|
|
|
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("mcl_colorblocks:concrete_powder_"..name, {
|
|
|
|
description = desc.." Concrete Powder",
|
|
|
|
tiles = {"mcl_colorblocks_concrete_powder_"..name..".png"},
|
|
|
|
groups = {crumbly=3,concrete_powder=1,building_block=1,falling_node=1},
|
|
|
|
stack_max = 64,
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = mcl_sounds.node_sound_sand_defaults(),
|
2017-02-12 01:46:41 +03:00
|
|
|
|
|
|
|
-- Specify the node to which this node will convert after getting in contact with water
|
|
|
|
_mcl_colorblocks_harden_to = "mcl_colorblocks:concrete_"..name,
|
2017-02-12 01:33:06 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("mcl_colorblocks:concrete_"..name, {
|
|
|
|
description = desc.." Concrete",
|
|
|
|
tiles = {"mcl_colorblocks_concrete_"..name..".png"},
|
|
|
|
groups = {cracky=3,conrete=1,building_block=1},
|
|
|
|
stack_max = 64,
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Crafting recipes
|
2015-06-29 20:55:56 +03:00
|
|
|
if craft_color_group then
|
|
|
|
minetest.register_craft({
|
2017-02-12 01:33:06 +03:00
|
|
|
output = 'mcl_colorblocks:hardened_clay_'..name..' 8',
|
2015-06-29 20:55:56 +03:00
|
|
|
recipe = {
|
2017-02-12 01:17:16 +03:00
|
|
|
{'mcl_colorblocks:hardened_clay', 'mcl_colorblocks:hardened_clay', 'mcl_colorblocks:hardened_clay'},
|
|
|
|
{'mcl_colorblocks:hardened_clay', 'mcl_dye:'..craft_color_group, 'mcl_colorblocks:hardened_clay'},
|
|
|
|
{'mcl_colorblocks:hardened_clay', 'mcl_colorblocks:hardened_clay', 'mcl_colorblocks:hardened_clay'},
|
2015-06-29 20:55:56 +03:00
|
|
|
},
|
|
|
|
})
|
2017-02-12 01:33:06 +03:00
|
|
|
minetest.register_craft({
|
2017-02-12 01:51:13 +03:00
|
|
|
type = "shapeless",
|
2017-02-12 01:33:06 +03:00
|
|
|
output = 'mcl_colorblocks:concrete_powder_'..name..' 8',
|
|
|
|
recipe = {
|
2017-02-12 01:51:13 +03:00
|
|
|
'mcl_core:sand', 'mcl_core:gravel', 'mcl_core:sand',
|
|
|
|
'mcl_core:gravel', 'mcl_dye:'..craft_color_group, 'mcl_core:gravel',
|
|
|
|
'mcl_core:sand', 'mcl_core:gravel', 'mcl_core:sand',
|
|
|
|
}
|
2017-02-12 01:33:06 +03:00
|
|
|
})
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-12 01:46:41 +03:00
|
|
|
-- When water touches concrete powder, it turns into concrete of the same color
|
|
|
|
minetest.register_abm({
|
|
|
|
label = "Concrete powder hardening",
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
nodenames = {"group:concrete_powder"},
|
|
|
|
neighbors = {"group:water"},
|
|
|
|
action = function(pos, node)
|
|
|
|
local harden_to = minetest.registered_nodes[node.name]._mcl_colorblocks_harden_to
|
|
|
|
minetest.swap_node(pos, { name = harden_to, param = node.param, param2 = node.param2 })
|
|
|
|
end,
|
|
|
|
})
|
2017-02-12 01:33:06 +03:00
|
|
|
|
2015-07-03 07:57:09 +03:00
|
|
|
local time_to_load= os.clock() - init
|
|
|
|
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
|
|
|
|
|