1
0
mirror of https://github.com/davisonio/colouredstonebricks.git synced 2024-12-06 03:40:17 +01:00

Fix stairsplus crash, optimise code

This commit is contained in:
Craig Davison 2017-07-24 17:48:24 +01:00
parent 9ffe5e94bd
commit dc71b951c4
No known key found for this signature in database
GPG Key ID: B22B44578F8BBB74
2 changed files with 38 additions and 55 deletions

View File

@ -1,3 +1,4 @@
default
dye
stairs?
stairsplus?

View File

@ -1,72 +1,54 @@
local COLOURS = {
"Black",
"Cyan",
"Brown",
"Dark Blue",
"Dark Green",
"Dark Grey",
"Dark Pink",
"Green",
"Grey",
"Orange",
"Pink",
"Purple",
"Red",
"White",
"Yellow"
local colours = {
{"black", "Black"},
{"cyan", "Cyan"},
{"brown", "Brown"},
{"dark_blue", "Dark Blue"},
{"dark_green", "Dark Green"},
{"dark_grey", "Dark Grey"},
{"dark_pink", "Dark Pink"},
{"green", "Green"},
{"grey", "Grey"},
{"orange", "Orange"},
{"pink", "Pink"},
{"purple", "Purple"},
{"red", "Red"},
{"white", "White"},
{"yellow", "Yellow"}
}
local COLOURS2 = {
"black",
"cyan",
"brown",
"dark_blue",
"dark_green",
"dark_grey",
"dark_pink",
"green",
"grey",
"orange",
"pink",
"purple",
"red",
"white",
"yellow"
}
for _, row in ipairs(colours) do
for number = 1, 15 do
local name = row[1]
local description = row[2]
local colour = COLOURS[number]
local colour2 = COLOURS2[number]
minetest.register_node("colouredstonebricks:"..colour2, {
description = colour.." Stone Brick",
tiles = {"colouredstonebricks_"..colour2..".png"},
minetest.register_node("colouredstonebricks:"..name, {
description = description.." Stone Brick",
tiles = {"colouredstonebricks_"..name..".png"},
groups = {cracky=3},
sounds = default.node_sound_defaults(),
})
minetest.register_craft({
type = "shapeless",
output = 'colouredstonebricks:'..colour2,
output = 'colouredstonebricks:'..name,
recipe = {
'dye:'..colour2, 'default:stonebrick',
'dye:'..name, 'default:stonebrick',
}
})
-- Support for stairsplus mod
stairsplus:register_all("colouredstonebricks", colour2, "colouredstonebricks:"..colour2, {
description = colour.." Stone Brick",
tiles = {"colouredstonebricks_"..colour2..".png"},
groups = {cracky=3},
sounds = default.node_sound_defaults(),
sunlight_propagates = true,
})
if minetest.get_modpath("moreblocks") then
stairsplus:register_all("colouredstonebricks", name, "colouredstonebricks:"..name, {
description = description.." Stone Brick",
tiles = {"colouredstonebricks_"..name..".png"},
groups = {cracky=3},
sounds = default.node_sound_defaults(),
sunlight_propagates = true,
})
end
end
minetest.register_alias("dye:dark_blue","dye:blue")
minetest.register_alias("dye:dark_pink","dye:magenta")
minetest.register_alias("dye:purple","dye:violet")
-- We don't have blue, violet or magenta coloured stone bricks (yet)
--minetest.register_alias("dye:dark_blue","dye:blue")
--minetest.register_alias("dye:dark_pink","dye:magenta")
--minetest.register_alias("dye:purple","dye:violet")