1
0
mirror of https://codeberg.org/tenplus1/bakedclay.git synced 2024-09-18 08:10:16 +02:00

tidy code

This commit is contained in:
tenplus1 2024-07-28 10:23:10 +01:00
parent edc74e1583
commit 313e54cf69
3 changed files with 68 additions and 64 deletions

View File

@ -1,6 +1,10 @@
-- translation support -- translation support
local S = minetest.get_translator("bakedclay") local S = minetest.get_translator("bakedclay")
-- new flowers
local flowers = { local flowers = {
{"delphinium", S("Blue Delphinium"), {"delphinium", S("Blue Delphinium"),
{-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}}, {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}},
@ -15,8 +19,8 @@ local flowers = {
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_dark_green = 1}} {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_dark_green = 1}}
} }
-- register some new flowers to fill in missing dye colours -- helper function
-- flower registration (borrowed from default game)
local function add_simple_flower(name, desc, box, f_groups) local function add_simple_flower(name, desc, box, f_groups)
f_groups.snappy = 3 f_groups.snappy = 3
@ -41,11 +45,14 @@ local function add_simple_flower(name, desc, box, f_groups)
}) })
end end
-- register new flowers to fill in missing dye colours
for _,item in pairs(flowers) do for _,item in pairs(flowers) do
add_simple_flower(unpack(item)) add_simple_flower(unpack(item))
end end
-- add new flowers to mapgen -- add new flowers to mapgen
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = {"default:dirt_with_grass"}, place_on = {"default:dirt_with_grass"},
@ -118,7 +125,8 @@ minetest.register_decoration({
num_spawn_by = 1 num_spawn_by = 1
}) })
-- flowerpot mod -- flowerpot mod support
if minetest.get_modpath("flowerpot") then if minetest.get_modpath("flowerpot") then
flowerpot.register_node("bakedclay:delphinium") flowerpot.register_node("bakedclay:delphinium")
flowerpot.register_node("bakedclay:thistle") flowerpot.register_node("bakedclay:thistle")

View File

@ -32,7 +32,6 @@ local stairsplus_mod = minetest.get_modpath("moreblocks")
and minetest.global_exists("stairsplus") and minetest.global_exists("stairsplus")
local stairsplus_compat = minetest.settings:get_bool("stairsplus_clay_compatibility") ~= false local stairsplus_compat = minetest.settings:get_bool("stairsplus_clay_compatibility") ~= false
-- scroll through colours -- scroll through colours
for _, clay in pairs(clay) do for _, clay in pairs(clay) do
@ -166,16 +165,14 @@ minetest.register_craft({
-- register a few extra dye colour options -- register a few extra dye colour options
minetest.register_craft( { minetest.register_craft({
type = "shapeless",
output = "dye:green 4", output = "dye:green 4",
recipe = {"default:cactus"} recipe = {{"default:cactus"}}
}) })
minetest.register_craft( { minetest.register_craft({
type = "shapeless",
output = "dye:brown 4", output = "dye:brown 4",
recipe = {"default:dry_shrub"} recipe = {{"default:dry_shrub"}}
}) })
-- only add light grey recipe if unifieddye mod isnt present (conflict) -- only add light grey recipe if unifieddye mod isnt present (conflict)
@ -183,15 +180,13 @@ minetest.register_craft( {
if not minetest.get_modpath("unifieddyes") then if not minetest.get_modpath("unifieddyes") then
minetest.register_craft( { minetest.register_craft( {
type = "shapeless",
output = "dye:dark_grey 3", output = "dye:dark_grey 3",
recipe = {"dye:black", "dye:black", "dye:white"} recipe = {{"dye:black", "dye:black", "dye:white"}}
}) })
minetest.register_craft( { minetest.register_craft( {
type = "shapeless",
output = "dye:grey 3", output = "dye:grey 3",
recipe = {"dye:black", "dye:white", "dye:white"} recipe = {{"dye:black", "dye:white", "dye:white"}}
}) })
end end

View File

@ -1,64 +1,65 @@
-- helpers
local p = "bakedclay:" local p = "bakedclay:"
local p2 = "bakedclay:terracotta_"
-- add lucky blocks
lucky_block:add_blocks({ lucky_block:add_blocks({
{"dro", {"bakedclay:"}, 10, true}, {"dro", {"bakedclay:"}, 10, true},
{"fal", { {"fal", {
p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green", p .. "black", p .. "blue", p .. "brown", p .. "cyan", p .. "dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange", p .. "dark_grey", p .. "green", p .. "grey", p .. "magenta", p .. "orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural" p .. "pink", p .. "red", p .. "violet", p .. "white", p .. "yellow", p .. "natural"
}, 0}, }, 0},
{"fal", { {"fal", {
p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green", p .. "black", p .. "blue", p .. "brown", p .. "cyan", p .. "dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange", p .. "dark_grey", p .. "green", p .. "grey", p .. "magenta", p .. "orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural" p .. "pink", p .. "red", p .. "violet", p .. "white", p .. "yellow", p .. "natural"
}, 0, true}, }, 0, true},
{"dro", {p.."delphinium"}, 5}, {"dro", {p .. "delphinium"}, 5},
{"dro", {p.."lazarus"}, 5}, {"dro", {p .. "lazarus"}, 5},
{"dro", {p.."mannagrass"}, 5}, {"dro", {p .. "mannagrass"}, 5},
{"dro", {p.."thistle"}, 6}, {"dro", {p .. "thistle"}, 6},
{"flo", 5, { {"flo", 5, {
p.."natural", p.."black", p.."blue", p.."brown", p.."cyan", p .. "natural", p .. "black", p .. "blue", p .. "brown", p .. "cyan",
p.."dark_green", p.."dark_grey", p.."green", p.."grey", p.."magenta", p .. "dark_green", p .. "dark_grey", p .. "green", p .. "grey", p .. "magenta",
p.."orange", p.."pink", p.."red", p.."violet", p.."white", p.."yellow" p .. "orange", p .. "pink", p .. "red", p .. "violet", p .. "white", p .. "yellow"
}, 2}, }, 2},
{"nod", "default:chest", 0, { {"nod", "default:chest", 0, {
{name = p.."natural", max = 30}, {name = p .. "natural", max = 20},
{name = p.."black", max = 30}, {name = p .. "black", max = 20},
{name = p.."blue", max = 30}, {name = p .. "blue", max = 20},
{name = p.."brown", max = 30}, {name = p .. "brown", max = 20},
{name = p.."cyan", max = 30}, {name = p .. "cyan", max = 20},
{name = p.."dark_green", max = 30}, {name = p .. "dark_green", max = 20},
{name = p.."dark_grey", max = 30}, {name = p .. "dark_grey", max = 20},
{name = p.."green", max = 30}, {name = p .. "green", max = 20},
{name = p.."grey", max = 30}, {name = p .. "grey", max = 20},
{name = p.."magenta", max = 30}, {name = p .. "magenta", max = 20},
{name = p.."orange", max = 30}, {name = p .. "orange", max = 20},
{name = p.."pink", max = 30}, {name = p .. "pink", max = 20},
{name = p.."red", max = 30}, {name = p .. "red", max = 20},
{name = p.."violet", max = 30}, {name = p .. "violet", max = 20},
{name = p.."white", max = 30}, {name = p .. "white", max = 20},
{name = p.."yellow", max = 30} {name = p .. "yellow", max = 20}
}} }},
})
p = "bakedclay:terracotta_"
lucky_block:add_blocks({
{"nod", "default:chest", 0, { {"nod", "default:chest", 0, {
{name = p.."black", max = 20}, {name = p2 .. "black", max = 20},
{name = p.."blue", max = 20}, {name = p2 .. "blue", max = 20},
{name = p.."brown", max = 20}, {name = p2 .. "brown", max = 20},
{name = p.."cyan", max = 20}, {name = p2 .. "cyan", max = 20},
{name = p.."dark_green", max = 20}, {name = p2 .. "dark_green", max = 20},
{name = p.."dark_grey", max = 20}, {name = p2 .. "dark_grey", max = 20},
{name = p.."green", max = 20}, {name = p2 .. "green", max = 20},
{name = p.."grey", max = 20}, {name = p2 .. "grey", max = 20},
{name = p.."magenta", max = 20}, {name = p2 .. "magenta", max = 20},
{name = p.."orange", max = 20}, {name = p2 .. "orange", max = 20},
{name = p.."pink", max = 20}, {name = p2 .. "pink", max = 20},
{name = p.."red", max = 20}, {name = p2 .. "red", max = 20},
{name = p.."violet", max = 20}, {name = p2 .. "violet", max = 20},
{name = p.."white", max = 20}, {name = p2 .. "white", max = 20},
{name = p.."yellow", max = 20} {name = p2 .. "yellow", max = 20}
}} }}
}) })