summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua378
1 files changed, 231 insertions, 147 deletions
diff --git a/init.lua b/init.lua
index ce946a2..909978c 100644
--- a/init.lua
+++ b/init.lua
@@ -1,196 +1,205 @@
--- Unified Dyes Mod by Vanessa Ezekowitz ~~ 2012-07-08
+-- Unified Dyes Mod by Vanessa Ezekowitz ~~ 2012-07-24
--
-- License: GPL
--
-- This mod depends on ironzorg's flowers mod
--
---=================================================================
--- Smelting/crafting recipes needed to generate various base colors
--- (the register_craftitem functions are in the generate-the-rest
--- loop below the base colors).
-
------------------
--- Primary colors
-
--- Red (rose)
+--===========================================================================
+-- First you need something to put the dyes into - glass bottles
+--
+-- Smelt some sand into glass as usual, then smelt one of the resulting glass
+-- blocks to get a 9-pack of empty bottles.
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:red 2",
- recipe = "flowers:flower_rose",
+minetest.register_craftitem("unifieddyes:empty_bottle", {
+ description = "Empty Glass Bottle",
+ inventory_image = "unifieddyes_empty_bottle.png",
})
--- Green (cactus)
-
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:green 2",
- recipe = "default:cactus",
+minetest.register_craftitem("unifieddyes:bottle_9_pack", {
+ description = "Empty Glass Bottles (9-pack)",
+ inventory_image = "unifieddyes_bottle_9_pack.png",
})
minetest.register_craft({
type = "cooking",
- output = "unifieddyes:green 2",
- recipe = "flowers:flower_waterlily",
+ output = "unifieddyes:bottle_9_pack",
+ recipe = "default:glass",
})
+-- The use of this mod will, if the mods that depend on it are written
+-- correctly, generate lots of empty bottles, so let's recycle them.
+
+-- First, pack them into a 9-pack unit by placing one into each of the 9
+-- crafting slots.
+
minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:green 2",
+ output = "unifieddyes:bottle_9_pack",
recipe = {
- "unifieddyes:blue",
- "unifieddyes:yellow",
- },
+ { "unifieddyes:empty_bottle", "unifieddyes:empty_bottle", "unifieddyes:empty_bottle" },
+ { "unifieddyes:empty_bottle", "unifieddyes:empty_bottle", "unifieddyes:empty_bottle" },
+ { "unifieddyes:empty_bottle", "unifieddyes:empty_bottle", "unifieddyes:empty_bottle" },
+ },
})
--- Blue (Viola)
+-- then smelt the 9-pack back into a glass block:
minetest.register_craft({
type = "cooking",
- output = "unifieddyes:blue 2",
- recipe = "flowers:flower_viola",
+ output = "default:glass",
+ recipe = "unifieddyes:bottle_9_pack",
})
+-- Now, once you have a 9-pack of bottles, craft it with one bucket of water
+-- and a piece of jungle grass to get 9 individual portions of the liquid dye
+-- base and an empty bucket:
--------------------
--- Secondary colors
-
--- Cyan
+minetest.register_craftitem("unifieddyes:dye_base", {
+ description = "Uncolored Dye Base Liquid",
+ inventory_image = "unifieddyes_dye_base.png",
+})
minetest.register_craft( {
type = "shapeless",
- output = "unifieddyes:cyan 2",
+ output = "unifieddyes:dye_base 9",
recipe = {
- "unifieddyes:blue",
- "unifieddyes:green",
- },
+ "bucket:bucket_water",
+ "default:junglegrass",
+ "unifieddyes:bottle_9_pack",
+ },
+ replacements = { {'bucket:bucket_water', 'bucket:bucket_empty'}, },
})
--- Magenta
+--==========================================================================
+-- Now we need to turn our color sources (flowers, etc) into pigments and from
+-- there into actual usable dyes. There are seven base colors - one for each
+-- flower, plus black (as "carbon black") from coal, and white (as "titanium
+-- dioxide") from stone. Most give two portions of pigment; cactus gives 6,
+-- stone gives 10.
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:magenta 2",
- recipe = {
- "unifieddyes:blue",
- "unifieddyes:red",
- },
-})
+pigments = {
+ "red",
+ "orange",
+ "yellow",
+ "green",
+ "blue",
+ "carbon_black",
+}
--- Yellow (yellow dandelion)
+pigmentsdesc = {
+ "Red",
+ "Orange",
+ "Yellow",
+ "Green",
+ "Blue",
+}
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:yellow 2",
- recipe = "flowers:flower_dandelion_yellow",
-})
+dyesdesc = {
+ "Red",
+ "Orange",
+ "Yellow",
+ "Green",
+ "Blue",
+}
+
+colorsources = {
+ "flowers:flower_rose",
+ "flowers:flower_tulip",
+ "flowers:flower_dandelion_yellow",
+ "flowers:flower_waterlily",
+ "flowers:flower_viola",
+}
+for color = 1, 5 do
-------------------
--- Tertiary colors
+ -- the recipes to turn sources into pigments
--- Orange (tulip)
+ minetest.register_craftitem("unifieddyes:pigment_"..pigments[color], {
+ description = pigmentsdesc[color].." Pigment",
+ inventory_image = "unifieddyes_pigment_"..pigments[color]..".png",
+ })
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:orange 2",
- recipe = "flowers:flower_tulip",
-})
+ minetest.register_craft({
+ type = "cooking",
+ output = "unifieddyes:pigment_"..pigments[color].." 2",
+ recipe = colorsources[color],
+ })
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:orange 2",
- recipe = {
- "unifieddyes:yellow",
- "unifieddyes:red",
- },
-})
+ -- The recipes to turn pigments into usable dyes
+
+ minetest.register_craftitem("unifieddyes:"..pigments[color], {
+ description = dyesdesc[color].." Dye",
+ inventory_image = "unifieddyes_"..pigments[color]..".png",
+ })
+ minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:"..pigments[color],
+ recipe = {
+ "unifieddyes:pigment_"..pigments[color],
+ "unifieddyes:dye_base"
+ }
+ })
+end
--- Lime
+-- Stone->titanium dioxide and cactus->green pigment are done separately
+-- because of their larger yields
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:lime 2",
- recipe = {
- "unifieddyes:yellow",
- "unifieddyes:green",
- },
+minetest.register_craftitem("unifieddyes:titanium_dioxide", {
+ description = "Titanium Dioxide",
+ inventory_image = "unifieddyes_titanium_dioxide.png",
})
--- Aqua
+minetest.register_craft({
+ type = "cooking",
+ output = "unifieddyes:titanium_dioxide 10",
+ recipe = "default:stone",
+})
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:aqua 2",
- recipe = {
- "unifieddyes:cyan",
- "unifieddyes:green",
- },
+minetest.register_craft({
+ type = "cooking",
+ output = "unifieddyes:pigment_green 6",
+ recipe = "default:cactus",
})
--- Sky blue
+-- coal->carbon black and carbon black -> black dye are done separately
+-- because of the different names
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:skyblue 2",
- recipe = {
- "unifieddyes:cyan",
- "unifieddyes:blue",
- },
+minetest.register_craftitem("unifieddyes:carbon_black", {
+ description = "Carbon Black",
+ inventory_image = "unifieddyes_carbon_black.png",
})
--- Violet
+minetest.register_craft({
+ type = "cooking",
+ output = "unifieddyes:carbon_black 2",
+ recipe = "default:coal_lump",
+})
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:violet 2",
- recipe = {
- "unifieddyes:blue",
- "unifieddyes:magenta",
- },
+minetest.register_craftitem("unifieddyes:black", {
+ description = "Carbon Black",
+ inventory_image = "unifieddyes_black.png",
})
minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:violet 3",
- recipe = {
- "unifieddyes:blue",
- "unifieddyes:blue",
- "unifieddyes:red",
- },
+ type = "shapeless",
+ output = "unifieddyes:black",
+ recipe = {
+ "unifieddyes:carbon_black",
+ "unifieddyes:dye_base",
+ },
})
+--=======================================================================
+-- Now that we have the dyes in a usable form, let's mix the various
+-- ingredients together to create the rest of the mod's colors and greys.
--- Red-violet
-
-minetest.register_craft( {
- type = "shapeless",
- output = "unifieddyes:redviolet 2",
- recipe = {
- "unifieddyes:red",
- "unifieddyes:magenta",
- },
-})
----------------------------
-- The 5 levels of greyscale
-- White paint
-minetest.register_craftitem("unifieddyes:titanium_dioxide", {
- description = "Titanium Dioxide Powder",
- inventory_image = "unifieddyes_titanium_dioxide.png",
- groups = {dye=1},
-})
-
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:titanium_dioxide 10",
- recipe = "default:stone",
-})
-
minetest.register_craft( {
type = "shapeless",
output = "unifieddyes:white_paint",
@@ -207,7 +216,6 @@ minetest.register_craftitem("unifieddyes:white_paint", {
groups = {dye=1},
})
-
-- Light grey paint
minetest.register_craft( {
@@ -216,7 +224,7 @@ minetest.register_craft( {
recipe = {
"unifieddyes:white_paint",
"unifieddyes:white_paint",
- "unifieddyes:black",
+ "unifieddyes:carbon_black",
},
})
@@ -226,7 +234,6 @@ minetest.register_craftitem("unifieddyes:lightgrey_paint", {
groups = {dye=1},
})
-
-- Medium grey paint
minetest.register_craft( {
@@ -234,7 +241,7 @@ minetest.register_craft( {
output = "unifieddyes:grey_paint 2",
recipe = {
"unifieddyes:white_paint",
- "unifieddyes:black",
+ "unifieddyes:carbon_black",
},
})
@@ -244,7 +251,6 @@ minetest.register_craftitem("unifieddyes:grey_paint", {
groups = {dye=1},
})
-
-- Dark grey paint
minetest.register_craft( {
@@ -252,8 +258,8 @@ minetest.register_craft( {
output = "unifieddyes:darkgrey_paint 3",
recipe = {
"unifieddyes:white_paint",
- "unifieddyes:black",
- "unifieddyes:black",
+ "unifieddyes:carbon_black",
+ "unifieddyes:carbon_black",
},
})
@@ -264,26 +270,103 @@ minetest.register_craftitem("unifieddyes:darkgrey_paint", {
})
--- Black dye (coal)
+--=============================================================================
+-- Smelting/crafting recipes needed to generate various remaining 'full' colors
+-- (the register_craftitem functions are in the generate-the-rest loop below).
-minetest.register_craft({
- type = "cooking",
- output = "unifieddyes:black 2",
- recipe = "default:coal_lump",
+-- Cyan
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:cyan 2",
+ recipe = {
+ "unifieddyes:blue",
+ "unifieddyes:green",
+ },
})
-minetest.register_craftitem("unifieddyes:black", {
- description = "Black Dye",
- inventory_image = "unifieddyes_black.png",
- groups = {dye=1},
+-- Magenta
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:magenta 2",
+ recipe = {
+ "unifieddyes:blue",
+ "unifieddyes:red",
+ },
})
+-- Lime
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:lime 2",
+ recipe = {
+ "unifieddyes:yellow",
+ "unifieddyes:green",
+ },
+})
+
+-- Aqua
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:aqua 2",
+ recipe = {
+ "unifieddyes:cyan",
+ "unifieddyes:green",
+ },
+})
+
+-- Sky blue
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:skyblue 2",
+ recipe = {
+ "unifieddyes:cyan",
+ "unifieddyes:blue",
+ },
+})
+
+-- Violet
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:violet 2",
+ recipe = {
+ "unifieddyes:blue",
+ "unifieddyes:magenta",
+ },
+})
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:violet 3",
+ recipe = {
+ "unifieddyes:blue",
+ "unifieddyes:blue",
+ "unifieddyes:red",
+ },
+})
+
+
+-- Red-violet
+
+minetest.register_craft( {
+ type = "shapeless",
+ output = "unifieddyes:redviolet 2",
+ recipe = {
+ "unifieddyes:red",
+ "unifieddyes:magenta",
+ },
+})
-- =================================================================
-- Finally, generate all of additional variants of hue, saturation, and
--- brightness from the above 12 base colors.
+-- brightness.
-- "s50" in a file/item name means "saturation: 50%".
-- Brightness levels in the textures are 33% ("dark"), 66% ("medium"),
@@ -440,5 +523,6 @@ for i = 1, 12 do
end
+
print("[UnifiedDyes] Loaded!")