Add black, white, blue and brown dyes.

Until now, the black, white, blue and brown dyes doubled as squid ink sac,
bone meal, lapis lazuli and cocoa beans.  Since these latter items have all
been given their own craftitem registration, the missing dyes can finally
be added in their own right.

* Add `"mcl_dye:black"` and its crafting recipe.
* Add `"mcl_dye:white"` and its crafting recipe.
* Add `"mcl_dye:blue"` and its crafting recipe.
* Add `"mcl_dye:brown"` and its crafting recipe.
* Remove aliases for white and brown dyes.
* Rename dye item images to be conforming to mineclone naming standards.
* Minor simplifications of mcl_dye/init.lua.
This commit is contained in:
kabou 2022-05-03 00:10:29 +02:00
parent cb6a9e7e35
commit 70a1fdad5a
24 changed files with 58 additions and 56 deletions

View File

@ -61,41 +61,39 @@ mcl_dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "o
-- - unicolor_medium_<excolor>_s50 -- - unicolor_medium_<excolor>_s50
-- - unicolor_dark_<excolor>_s50 -- - unicolor_dark_<excolor>_s50
-- Local stuff
local dyelocal = {}
-- This collection of colors is partly a historic thing, partly something else. -- This collection of colors is partly a historic thing, partly something else.
dyelocal.dyes = { local dyes = {
{"white", "mcl_dye_white", S("Bone Meal"), {dye=1, craftitem=1, basecolor_white=1, excolor_white=1, unicolor_white=1}}, {"white", S("White Dye"), {basecolor_white=1, excolor_white=1, unicolor_white=1}},
{"grey", "dye_grey", S("Light Grey Dye"), {dye=1, craftitem=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, {"grey", S("Light Grey Dye"), {basecolor_grey=1, excolor_grey=1, unicolor_grey=1}},
{"dark_grey", "dye_dark_grey", S("Grey Dye"), {dye=1, craftitem=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, {"dark_grey", S("Grey Dye"), {basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}},
{"black", "mcl_dye_black", S("Ink Sac"), {dye=1, craftitem=1, basecolor_black=1, excolor_black=1, unicolor_black=1}}, {"black", S("Black Dye"), {basecolor_black=1, excolor_black=1, unicolor_black=1}},
{"violet", "dye_violet", S("Purple Dye"), {dye=1, craftitem=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}}, {"violet", S("Purple Dye"), {basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}},
{"blue", "mcl_dye_blue", S("Lapis Lazuli"), {dye=1, craftitem=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}}, {"blue", S("Blue Dye"), {basecolor_blue=1, excolor_blue=1, unicolor_blue=1}},
{"lightblue", "mcl_dye_light_blue", S("Light Blue Dye"), {dye=1, craftitem=1, basecolor_blue=1, excolor_blue=1, unicolor_light_blue=1}}, {"lightblue", S("Light Blue Dye"), {basecolor_blue=1, excolor_blue=1, unicolor_light_blue=1}},
{"cyan", "dye_cyan", S("Cyan Dye"), {dye=1, craftitem=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}}, {"cyan", S("Cyan Dye"), {basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}},
{"dark_green", "dye_dark_green", S("Cactus Green"),{dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}}, {"dark_green", S("Cactus Green"), {basecolor_green=1, excolor_green=1, unicolor_dark_green=1}},
{"green", "mcl_dye_lime", S("Lime Dye"), {dye=1, craftitem=1, basecolor_green=1, excolor_green=1, unicolor_green=1}}, {"green", S("Lime Dye"), {basecolor_green=1, excolor_green=1, unicolor_green=1}},
{"yellow", "dye_yellow", S("Dandelion Yellow"), {dye=1, craftitem=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}}, {"yellow", S("Dandelion Yellow"), {basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}},
{"brown", "mcl_dye_brown", S("Cocoa Beans"), {dye=1, craftitem=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1, compostability = 65}}, {"brown", S("Brown Dye"), {basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}},
{"orange", "dye_orange", S("Orange Dye"), {dye=1, craftitem=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}}, {"orange", S("Orange Dye"), {basecolor_orange=1, excolor_orange=1, unicolor_orange=1}},
{"red", "dye_red", S("Rose Red"), {dye=1, craftitem=1, basecolor_red=1, excolor_red=1, unicolor_red=1}}, {"red", S("Rose Red"), {basecolor_red=1, excolor_red=1, unicolor_red=1}},
{"magenta", "dye_magenta", S("Magenta Dye"), {dye=1, craftitem=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}}, {"magenta", S("Magenta Dye"), {basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}},
{"pink", "dye_pink", S("Pink Dye"), {dye=1, craftitem=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}}, {"pink", S("Pink Dye"), {basecolor_red=1, excolor_red=1, unicolor_light_red=1}},
} }
dyelocal.unicolor_to_dye_id = {} local unicolor_to_dye_id = {}
for d=1, #dyelocal.dyes do for d = 1, #dyes do
for k, _ in pairs(dyelocal.dyes[d][4]) do for k, _ in pairs(dyes[d][3]) do
if string.sub(k, 1, 9) == "unicolor_" then if string.sub(k, 1, 9) == "unicolor_" then
dyelocal.unicolor_to_dye_id[k] = dyelocal.dyes[d][1] unicolor_to_dye_id[k] = dyes[d][1]
end end
end end
end end
-- Takes an unicolor group name (e.g. “unicolor_white”) and returns a corresponding dye name (if it exists), nil otherwise. -- Takes an unicolor group name (e.g. “unicolor_white”) and returns a
-- corresponding dye name (if it exists), nil otherwise.
function mcl_dye.unicolor_to_dye(unicolor_group) function mcl_dye.unicolor_to_dye(unicolor_group)
local color = dyelocal.unicolor_to_dye_id[unicolor_group] local color = unicolor_to_dye_id[unicolor_group]
if color then if color then
return "mcl_dye:" .. color return "mcl_dye:" .. color
else else
@ -104,24 +102,17 @@ function mcl_dye.unicolor_to_dye(unicolor_group)
end end
-- Define items -- Define items
for _, row in ipairs(dyelocal.dyes) do for _, row in ipairs(dyes) do
local name = row[1] local groups = row[3]
-- White dye is an alias and brown dye is defined explicitly below groups.dye = 1
if name ~= "white" and name ~= "brown" then groups.craftitem = 1
local img = row[2] minetest.register_craftitem("mcl_dye:" .. row[1], {
local description = row[3] inventory_image = "mcl_dye_" .. row[1] .. ".png",
local groups = row[4] description = row[2],
local item_name = "mcl_dye:"..name _doc_items_longdesc = S("This item is a dye which is used for dyeing and crafting."),
local item_image = img..".png" _doc_items_usagehelp = S("Rightclick on a sheep to dye its wool. Other things are dyed by crafting."),
minetest.register_craftitem(item_name, { groups = groups,
inventory_image = item_image, })
description = description,
_doc_items_longdesc = S("This item is a dye which is used for dyeing and crafting."),
_doc_items_usagehelp = S("Rightclick on a sheep to dye its wool. Other things are dyed by crafting."),
groups = groups,
stack_max = 64,
})
end
end end
-- Legacy support for things now in mcl_bone_meal. -- Legacy support for things now in mcl_bone_meal.
@ -138,11 +129,6 @@ function mcl_dye.register_on_bone_meal_apply(func)
end end
-- End of legacy support -- End of legacy support
-- aliases for items that are used as dyes.
minetest.register_alias("mcl_dye:white", "mcl_bone_meal:bone_meal")
minetest.register_alias("mcl_dye:brown", "mcl_cocoas:cocoa_beans")
-- Dye mixing -- Dye mixing
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
@ -206,6 +192,14 @@ minetest.register_craft({
}) })
-- Dye creation -- Dye creation
minetest.register_craft({
output = "mcl_dye:black",
recipe = {{"mcl_mobitems:ink_sac"}},
})
minetest.register_craft({
output = "mcl_dye:white",
recipe = {{"mcl_bone_meal:bone_meal"}},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_dye:yellow", output = "mcl_dye:yellow",
recipe = {{"mcl_flowers:dandelion"}}, recipe = {{"mcl_flowers:dandelion"}},
@ -214,6 +208,10 @@ minetest.register_craft({
output = "mcl_dye:yellow 2", output = "mcl_dye:yellow 2",
recipe = {{"mcl_flowers:sunflower"}}, recipe = {{"mcl_flowers:sunflower"}},
}) })
minetest.register_craft({
output = "mcl_dye:blue",
recipe = {{"mcl_core:lapis"}},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_dye:lightblue", output = "mcl_dye:lightblue",
recipe = {{"mcl_flowers:blue_orchid"}}, recipe = {{"mcl_flowers:blue_orchid"}},
@ -238,6 +236,10 @@ minetest.register_craft({
output = "mcl_dye:magenta 2", output = "mcl_dye:magenta 2",
recipe = {{"mcl_flowers:lilac"}}, recipe = {{"mcl_flowers:lilac"}},
}) })
minetest.register_craft({
output = "mcl_dye:brown",
recipe = {{"mcl_cocoas:cocoa_beans"}},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_dye:orange", output = "mcl_dye:orange",
recipe = {{"mcl_flowers:tulip_orange"}}, recipe = {{"mcl_flowers:tulip_orange"}},

View File

@ -4,7 +4,7 @@ Light Grey Dye=Hellgrauer Farbstoff
Grey Dye=Grauer Farbstoff Grey Dye=Grauer Farbstoff
Ink Sac=Tintenbeutel Ink Sac=Tintenbeutel
Purple Dye=Violetter Farbstoff Purple Dye=Violetter Farbstoff
Lapis Lazuli=Lapislazuli Blue Dye=Blaue Farbstoff
Light Blue Dye=Hellblauer Farbstoff Light Blue Dye=Hellblauer Farbstoff
Cyan Dye=Türkiser Farbstoff Cyan Dye=Türkiser Farbstoff
Cactus Green=Kaktusgrün Cactus Green=Kaktusgrün

View File

@ -4,7 +4,7 @@ Light Grey Dye=Tinte gris claro
Grey Dye=Tinte gris Grey Dye=Tinte gris
Ink Sac=Saco de tinta Ink Sac=Saco de tinta
Purple Dye=Tinte púrpura Purple Dye=Tinte púrpura
Lapis Lazuli=Lapislázuli Blue Dye=Tinte azul
Light Blue Dye=Tinte azul claro Light Blue Dye=Tinte azul claro
Cyan Dye=Tinte cian Cyan Dye=Tinte cian
Cactus Green=Tinte verde Cactus Green=Tinte verde

View File

@ -4,7 +4,7 @@ Light Grey Dye=Teinture Gris Clair
Grey Dye=Teinture Gris Grey Dye=Teinture Gris
Ink Sac=Poche d'Encre Ink Sac=Poche d'Encre
Purple Dye=Teinture Violette Purple Dye=Teinture Violette
Lapis Lazuli=Lapis Lazuli Blue Dye=Teinture Bleu
Light Blue Dye=Teinture Bleu Clair Light Blue Dye=Teinture Bleu Clair
Cyan Dye=Teinture Cyan Cyan Dye=Teinture Cyan
Cactus Green=Cactus Vert Cactus Green=Cactus Vert

View File

@ -4,7 +4,7 @@ Light Grey Dye=Jasnoszara farba
Grey Dye=Szara farba Grey Dye=Szara farba
Ink Sac=Torbiel z atramentem Ink Sac=Torbiel z atramentem
Purple Dye=Fioletowa farba Purple Dye=Fioletowa farba
Lapis Lazuli=Lazuryt Blue Dye=Niebieska farba
Light Blue Dye=Jasnoniebieska farba Light Blue Dye=Jasnoniebieska farba
Cyan Dye=Błękitna farba Cyan Dye=Błękitna farba
Cactus Green=Kaktusowa zieleń Cactus Green=Kaktusowa zieleń

View File

@ -4,7 +4,7 @@ Light Grey Dye=Светло-серый краситель
Grey Dye=Серый краситель Grey Dye=Серый краситель
Ink Sac=Чернильный мешок Ink Sac=Чернильный мешок
Purple Dye=Пурпурный краситель Purple Dye=Пурпурный краситель
Lapis Lazuli=Ляпис-лазурь Blue Dye=голубой краситель
Light Blue Dye=Светло-голубой краситель Light Blue Dye=Светло-голубой краситель
Cyan Dye=Голубой краситель Cyan Dye=Голубой краситель
Cactus Green=Зелень кактуса Cactus Green=Зелень кактуса

View File

@ -4,7 +4,7 @@ Light Grey Dye=淺灰色染料
Grey Dye=灰色染料 Grey Dye=灰色染料
Ink Sac=墨囊 Ink Sac=墨囊
Purple Dye=紫色染料 Purple Dye=紫色染料
Lapis Lazuli=青金石 Blue Dye=藍色染料
Light Blue Dye=淺藍色染料 Light Blue Dye=淺藍色染料
Cyan Dye=青色染料 Cyan Dye=青色染料
Cactus Green=仙人掌綠 Cactus Green=仙人掌綠

View File

@ -4,7 +4,7 @@ Light Grey Dye=
Grey Dye= Grey Dye=
Ink Sac= Ink Sac=
Purple Dye= Purple Dye=
Lapis Lazuli= Blue Dye=
Light Blue Dye= Light Blue Dye=
Cyan Dye= Cyan Dye=
Cactus Green= Cactus Green=

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B