summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-12 20:26:23 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-12 20:34:28 -0400
commit078a998d2969fbdcd4fd3657ee286b7922b0e160 (patch)
tree139b6aacfe330a77d25fd6ff245cce6dbcf1a378
parent4b8899736084cee9bb3ac1090ea9f3f7275d573a (diff)
downloadunifieddyes-078a998d2969fbdcd4fd3657ee286b7922b0e160.tar
unifieddyes-078a998d2969fbdcd4fd3657ee286b7922b0e160.tar.gz
unifieddyes-078a998d2969fbdcd4fd3657ee286b7922b0e160.tar.bz2
unifieddyes-078a998d2969fbdcd4fd3657ee286b7922b0e160.tar.xz
unifieddyes-078a998d2969fbdcd4fd3657ee286b7922b0e160.zip
append `output` given to color craft helper if prefix/suffix are used
(if any; allows specifying an item count/yield for the recipe)
-rw-r--r--API.md2
-rw-r--r--init.lua11
2 files changed, 7 insertions, 6 deletions
diff --git a/API.md b/API.md
index 664f0b4..6f1b9d0 100644
--- a/API.md
+++ b/API.md
@@ -117,7 +117,7 @@ This will loop through all of Unified Dyes' color lists, generating one recipe f
`recipe` is the same as in the normal call, except that Unified Dyes will replace all instances of the string "NEUTRAL_NODE" with the item specified in the preceding `neutral_node` field. Every instance of "MAIN_DYE" will be replaced with a portion of dye, as Unified Dyes' recipe helper works through its color lists (i.e. this field will become whatever dye is needed for each recipe).
-`output_prefix` and `output_suffix`, if specified (must use both if at all), will cause the recipe registration to ignore the usual `output` field, and instead set to the output item to `output_prefix` + (hue) + `output_suffix`. Used for mods that use the split 89-color palette. `hue` will thus be one of the 12 hues, or "grey", as defined by the split palettes.
+`output_prefix` and `output_suffix`, if specified (must use both if at all), will cause the recipe registration to set to the output item to `output_prefix` + (hue) + `output_suffix` + `output`. Used for mods that use the split 89-color palette. `hue` will thus be one of the 12 hues, or "grey", as defined by the split palettes. In this situation, you can set `output` to your recipe yield (with a leading space) if needed. For example, if the prefix is "foo:bar", the suffix is "baz", and the output is set to " 3", then the craft helper will generate output item strings of the form "foo:bar_COLOR_baz 3", for each color in the table.
**`unifieddyes.make_colored_itemstack(itemstack, palette, color)`**
diff --git a/init.lua b/init.lua
index 1be45c4..09b156f 100644
--- a/init.lua
+++ b/init.lua
@@ -265,18 +265,19 @@ local function register_c(craft, hue, sat, val)
recipe = string.gsub(recipe, "NEUTRAL_NODE", craft.neutral_node)
local newrecipe = minetest.deserialize(recipe)
- local output = craft.output
+ local coutput = craft.output or ""
+ local output = coutput
if craft.output_prefix then
if craft.palette ~= "split" then
- output = craft.output_prefix..color..craft.output_suffix
+ output = craft.output_prefix..color..craft.output_suffix..coutput
else
if hue == "white" or hue == "black" or string.find(hue, "grey") then
- output = craft.output_prefix.."grey"..craft.output_suffix
+ output = craft.output_prefix.."grey"..craft.output_suffix..coutput
elseif hue == "pink" then
dye = "dye:light_red"
- output = craft.output_prefix.."red"..craft.output_suffix
+ output = craft.output_prefix.."red"..craft.output_suffix..coutput
else
- output = craft.output_prefix..hue..craft.output_suffix
+ output = craft.output_prefix..hue..craft.output_suffix..coutput
end
end
end