diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8000a6f..0000000 --- a/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random - Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/README.md b/README.md index 2fbeb0c..9c4ed7a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# sfcraftguide -A simple craftguide with progressive reveal and sfinv integration +Minetest Game mod: mtg_craftguide +================================= + +Adds a "Recipes" tab to the inventory. Click an item to see it's recipes. +Click again to show usages. + +Based on [craftguide](https://github.com/minetest-mods/craftguide). + +Authors of media +---------------- + +paramat (CC BY-SA 3.0): + +* craftguide_clear_icon.png +* craftguide_next_icon.png +* craftguide_prev_icon.png +* craftguide_search_icon.png + +Neuromancer (CC BY-SA 3.0): + +* craftguide_furnace.png + +Wuzzy (CC BY-SA 3.0): + +* craftguide_shapeless.png diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..f3de3db --- /dev/null +++ b/init.lua @@ -0,0 +1,434 @@ +local S = minetest.get_translator("mtg_craftguide") +local esc = minetest.formspec_escape + +local player_data = {} +local init_items = {} +local recipes_cache = {} +local usages_cache = {} + +local group_stereotypes = { + dye = "dye:white", + wool = "wool:white", + coal = "default:coal_lump", + vessel = "vessels:glass_bottle", + flower = "flowers:dandelion_yellow" +} + +local group_names = { + coal = S("Any coal"), + sand = S("Any sand"), + wool = S("Any wool"), + stick = S("Any stick"), + vessel = S("Any vessel"), + wood = S("Any wood planks"), + stone = S("Any kind of stone block"), + + ["color_red,flower"] = S("Any red flower"), + ["color_blue,flower"] = S("Any blue flower"), + ["color_black,flower"] = S("Any black flower"), + ["color_green,flower"] = S("Any green flower"), + ["color_white,flower"] = S("Any white flower"), + ["color_orange,flower"] = S("Any orange flower"), + ["color_violet,flower"] = S("Any violet flower"), + ["color_yellow,flower"] = S("Any yellow flower"), + + ["color_red,dye"] = S("Any red dye"), + ["color_blue,dye"] = S("Any blue dye"), + ["color_cyan,dye"] = S("Any cyan dye"), + ["color_grey,dye"] = S("Any grey dye"), + ["color_pink,dye"] = S("Any pink dye"), + ["color_black,dye"] = S("Any black dye"), + ["color_brown,dye"] = S("Any brown dye"), + ["color_green,dye"] = S("Any green dye"), + ["color_white,dye"] = S("Any white dye"), + ["color_orange,dye"] = S("Any orange dye"), + ["color_violet,dye"] = S("Any violet dye"), + ["color_yellow,dye"] = S("Any yellow dye"), + ["color_magenta,dye"] = S("Any magenta dye"), + ["color_dark_grey,dye"] = S("Any dark grey dye"), + ["color_dark_green,dye"] = S("Any dark green dye") +} + +local function table_replace(t, val, new) + for k, v in pairs(t) do + if v == val then + t[k] = new + end + end +end + +local function extract_groups(str) + if str:sub(1, 6) == "group:" then + return str:sub(7):split() + end + return nil +end + +local function item_has_groups(item_groups, groups) + for _, group in ipairs(groups) do + if not item_groups[group] then + return false + end + end + return true +end + +local function groups_to_item(groups) + if #groups == 1 then + local group = groups[1] + if group_stereotypes[group] then + return group_stereotypes[group] + elseif minetest.registered_items["default:"..group] then + return "default:"..group + end + end + + for name, def in pairs(minetest.registered_items) do + if item_has_groups(def.groups, groups) then + return name + end + end + + return ":unknown" +end + +local function get_craftable_recipes(output) + local recipes = minetest.get_all_craft_recipes(output) + if not recipes then + return nil + end + + for i = #recipes, 1, -1 do + for _, item in pairs(recipes[i].items) do + local groups = extract_groups(item) + if groups then + item = groups_to_item(groups) + end + if not minetest.registered_items[item] then + table.remove(recipes, i) + break + end + end + end + + if #recipes > 0 then + return recipes + end +end + +local function show_item(def) + return def.groups.not_in_craft_guide ~= 1 and def.description ~= "" +end + +local function cache_usages(recipe) + local added = {} + for _, item in pairs(recipe.items) do + if not added[item] then + local groups = extract_groups(item) + if groups then + for name, def in pairs(minetest.registered_items) do + if not added[name] and show_item(def) + and item_has_groups(def.groups, groups) then + local usage = table.copy(recipe) + table_replace(usage.items, item, name) + usages_cache[name] = usages_cache[name] or {} + table.insert(usages_cache[name], usage) + added[name] = true + end + end + elseif show_item(minetest.registered_items[item]) then + usages_cache[item] = usages_cache[item] or {} + table.insert(usages_cache[item], recipe) + end + added[item] = true + end + end +end + +minetest.register_on_mods_loaded(function() + for name, def in pairs(minetest.registered_items) do + if show_item(def) then + local recipes = get_craftable_recipes(name) + if recipes then + recipes_cache[name] = recipes + for _, recipe in ipairs(recipes) do + cache_usages(recipe) + end + end + end + end + for name, def in pairs(minetest.registered_items) do + if recipes_cache[name] or usages_cache[name] then + table.insert(init_items, name) + end + end + table.sort(init_items) +end) + +local function coords(i, cols) + return i % cols, math.floor(i / cols) +end + +local function is_fuel(item) + return minetest.get_craft_result({method="fuel", items={item}}).time > 0 +end + +local function item_button_fs(fs, x, y, item, element_name, groups) + table.insert(fs, ("item_image_button[%s,%s;1.05,1.05;%s;%s;%s]") + :format(x, y, item, element_name, groups and "\n"..esc(S("G")) or "")) + + local tooltip + if groups then + table.sort(groups) + tooltip = group_names[table.concat(groups, ",")] + if not tooltip then + local groupstr = {} + for _, group in ipairs(groups) do + table.insert(groupstr, minetest.colorize("yellow", group)) + end + groupstr = table.concat(groupstr, ", ") + tooltip = S("Any item belonging to the group(s): @1", groupstr) + end + elseif is_fuel(item) then + local itemdef = minetest.registered_items[item:match("%S*")] + local desc = itemdef and itemdef.description or S("Unknown Item") + tooltip = desc.."\n"..minetest.colorize("orange", S("Fuel")) + end + if tooltip then + table.insert(fs, ("tooltip[%s;%s]"):format(element_name, esc(tooltip))) + end +end + +local function recipe_fs(fs, data) + local recipe = data.recipes[data.rnum] + local width = recipe.width + local cooktime, shapeless + + if recipe.method == "cooking" then + cooktime, width = width, 1 + elseif width == 0 then + shapeless = true + if #recipe.items == 1 then + width = 1 + elseif #recipe.items <= 4 then + width = 2 + else + width = 3 + end + end + + table.insert(fs, ("label[5.5,1;%s]"):format(esc(data.show_usages + and S("Usage @1 of @2", data.rnum, #data.recipes) + or S("Recipe @1 of @2", data.rnum, #data.recipes)))) + + if #data.recipes > 1 then + table.insert(fs, + "image_button[5.5,1.6;0.8,0.8;craftguide_prev_icon.png;recipe_prev;]".. + "image_button[6.2,1.6;0.8,0.8;craftguide_next_icon.png;recipe_next;]".. + "tooltip[recipe_prev;"..esc(S("Previous recipe")).."]".. + "tooltip[recipe_next;"..esc(S("Next recipe")).."]") + end + + local rows = math.ceil(table.maxn(recipe.items) / width) + if width > 3 or rows > 3 then + table.insert(fs, ("label[0,1;%s]") + :format(esc(S("Recipe is too big to be displayed.")))) + return + end + + local base_x = 3 - width + local base_y = rows == 1 and 1 or 0 + + for i, item in pairs(recipe.items) do + local x, y = coords(i - 1, width) + + local elem_name = item + local groups = extract_groups(item) + if groups then + item = groups_to_item(groups) + elem_name = esc(item.."."..table.concat(groups, "+")) + end + item_button_fs(fs, base_x + x, base_y + y, item, elem_name, groups) + end + + if shapeless or recipe.method == "cooking" then + table.insert(fs, ("image[3.2,0.5;0.5,0.5;craftguide_%s.png]") + :format(shapeless and "shapeless" or "furnace")) + local tooltip = shapeless and S("Shapeless") or + S("Cooking time: @1", minetest.colorize("yellow", cooktime)) + table.insert(fs, "tooltip[3.2,0.5;0.5,0.5;"..esc(tooltip).."]") + end + table.insert(fs, "image[3,1;1,1;sfinv_crafting_arrow.png]") + + item_button_fs(fs, 4, 1, recipe.output, recipe.output:match("%S*")) +end + +local function get_formspec(player) + local name = player:get_player_name() + local data = player_data[name] + data.pagemax = math.max(1, math.ceil(#data.items / 32)) + + local fs = {} + table.insert(fs, + "style_type[item_image_button;padding=2]".. + "field[0.3,4.2;2.8,1.2;filter;;"..esc(data.filter).."]".. + "label[5.8,4.15;"..minetest.colorize("yellow", data.pagenum).." / ".. + data.pagemax.."]".. + "image_button[2.63,4.05;0.8,0.8;craftguide_search_icon.png;search;]".. + "image_button[3.25,4.05;0.8,0.8;craftguide_clear_icon.png;clear;]".. + "image_button[5,4.05;0.8,0.8;craftguide_prev_icon.png;prev;]".. + "image_button[7.25,4.05;0.8,0.8;craftguide_next_icon.png;next;]".. + "tooltip[search;"..esc(S("Search")).."]".. + "tooltip[clear;"..esc(S("Reset")).."]".. + "tooltip[prev;"..esc(S("Previous page")).."]".. + "tooltip[next;"..esc(S("Next page")).."]".. + "field_close_on_enter[filter;false]") + + if #data.items == 0 then + table.insert(fs, "label[3,2;"..esc(S("No items to show.")).."]") + else + local first_item = (data.pagenum - 1) * 32 + for i = first_item, first_item + 31 do + local item = data.items[i + 1] + if not item then + break + end + local x, y = coords(i % 32, 8) + item_button_fs(fs, x, y, item, item) + end + end + + table.insert(fs, "container[0,5.6]") + if data.recipes then + recipe_fs(fs, data) + elseif data.prev_item then + table.insert(fs, ("label[2,1;%s]"):format(esc(data.show_usages + and S("No usages.").."\n"..S("Click again to show recipes.") + or S("No recipes.").."\n"..S("Click again to show usages.")))) + end + table.insert(fs, "container_end[]") + + return table.concat(fs) +end + +local function imatch(str, filter) + return str:lower():find(filter, 1, true) ~= nil +end + +local function execute_search(data) + local filter = data.filter + if filter == "" then + data.items = init_items + return + end + data.items = {} + + for _, item in ipairs(init_items) do + local def = minetest.registered_items[item] + local desc = def and minetest.get_translated_string(data.lang_code, def.description) + + if imatch(item, filter) or desc and imatch(desc, filter) then + table.insert(data.items, item) + end + end +end + +local function on_receive_fields(player, fields) + local name = player:get_player_name() + local data = player_data[name] + + if fields.clear then + data.filter = "" + data.pagenum = 1 + data.prev_item = nil + data.recipes = nil + data.items = init_items + return true + + elseif fields.key_enter_field == "filter" or fields.search then + local new = fields.filter:lower() + if data.filter == new then + return + end + data.filter = new + data.pagenum = 1 + execute_search(data) + return true + + elseif fields.prev or fields.next then + if data.pagemax == 1 then + return + end + data.pagenum = data.pagenum + (fields.next and 1 or -1) + if data.pagenum > data.pagemax then + data.pagenum = 1 + elseif data.pagenum == 0 then + data.pagenum = data.pagemax + end + return true + + elseif fields.recipe_next or fields.recipe_prev then + data.rnum = data.rnum + (fields.recipe_next and 1 or -1) + if data.rnum > #data.recipes then + data.rnum = 1 + elseif data.rnum == 0 then + data.rnum = #data.recipes + end + return true + + else + local item + for field in pairs(fields) do + if field:find(":") then + item = field:match("[%w_:]+") + break + end + end + if not item then + return + end + + if item == data.prev_item then + data.show_usages = not data.show_usages + else + data.show_usages = nil + end + if data.show_usages then + data.recipes = usages_cache[item] + else + data.recipes = recipes_cache[item] + end + data.prev_item = item + data.rnum = 1 + return true + end +end + +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + local info = minetest.get_player_information(name) + + player_data[name] = { + filter = "", + pagenum = 1, + items = init_items, + lang_code = info.lang_code + } +end) + +minetest.register_on_leaveplayer(function(player) + local name = player:get_player_name() + player_data[name] = nil +end) + +sfinv.register_page("mtg_craftguide:craftguide", { + title = esc(S("Recipes")), + get = function(self, player, context) + return sfinv.make_formspec(player, context, get_formspec(player)) + end, + on_player_receive_fields = function(self, player, context, fields) + if on_receive_fields(player, fields) then + sfinv.set_player_inventory_formspec(player) + end + end +}) diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..8d28c5c --- /dev/null +++ b/license.txt @@ -0,0 +1,63 @@ +License of source code +---------------------- + +The MIT License (MIT) + +Copyright (C) 2015-2019 Jean-Patrick Guerrero and contributors. +Copyright (C) 2020 pauloue + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) + +Copyright (C) 2018 paramat +Copyright (C) Neuromancer +Copyright (C) 2017 Wuzzy + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/locale/mtg_craftguide.de.tr b/locale/mtg_craftguide.de.tr new file mode 100644 index 0000000..d90f833 --- /dev/null +++ b/locale/mtg_craftguide.de.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Beliebige Kohle +Any sand=Beliebiger Sand +Any wool=Beliebige Wolle +Any stick=Beliebiger Stock +Any vessel=Beliebiges Gefäß +Any wood planks=Beliebige Holzplanken +Any kind of stone block=Beliebige Art von Steinblock +Any red flower=Beliebige rote Blume +Any blue flower=Beliebige blaue Blume +Any black flower=Beliebige schwarze Blume +Any green flower=Beliebige grüne Blume +Any white flower=Beliebige weiße Blume +Any orange flower=Beliebige orange Blume +Any violet flower=Beliebige violette Blume +Any yellow flower=Beliebige gelbe Blume +Any red dye=Beliebiger roter Farbstoff +Any blue dye=Beliebiger blauer Farbstoff +Any cyan dye=Beliebiger türkiser Farbstoff +Any grey dye=Beliebiger grauer Farbstoff +Any pink dye=Beliebiger rosa Farbstoff +Any black dye=Beliebiger schwarzer Farbstoff +Any brown dye=Beliebiger brauner Farbstoff +Any green dye=Beliebiger grüner Farbstoff +Any white dye=Beliebiger weißer Farbstoff +Any orange dye=Beliebiger orange Farbstoff +Any violet dye=Beliebiger violetter Farbstoff +Any yellow dye=Beliebiger gelber Farbstoff +Any magenta dye=Beliebiger magenta Farbstoff +Any dark grey dye=Beliebiger dunkelgrauer Farbstoff +Any dark green dye=Beliebiger dunkelgrüner Farbstoff +# Label for group ingredients +G=G +Any item belonging to the group(s): @1=Beliebiger Gegenstand, der zu Gruppe(n) gehört: @1 +Unknown Item=Unbekannter Gegenstand +Fuel=Brennstoff +Usage @1 of @2=Verwendung @1 von @2 +Recipe @1 of @2=Rezept @1 von @2 +Previous recipe=Vorheriges Rezept +Next recipe=Nächstes Rezept +Recipe is too big to be displayed.=Rezept ist zu groß für die Anzeige. +Shapeless=Formlos +Cooking time: @1=Kochdauer: @1 +Search=Suche +Reset=Zurücksetzen +Previous page=Vorherige Seite +Next page=Nächste Seite +No items to show.=Keine Gegenstände anzuzeigen. +No usages.=Keine Verwendungen. +Click again to show recipes.=Erneut klicken, um Rezepte zu zeigen. +No recipes.=Keine Rezepte. +Click again to show usages.=Erneut klicken, um Verwendungen zu zeigen. +Recipes=Rezepte diff --git a/locale/mtg_craftguide.eo.tr b/locale/mtg_craftguide.eo.tr new file mode 100644 index 0000000..7201deb --- /dev/null +++ b/locale/mtg_craftguide.eo.tr @@ -0,0 +1,54 @@ +# textdomain: mtg_craftguide + +Any coal=Ajna karbo +Any sand=Ajna sablo +Any wool=Ajna lano +Any stick=Ajna bastono +Any vessel=Ajna vazo +Any wood planks=Ajna ligna tabulo +Any kind of stone block=Ia ŝtona ŝtipo +Any red flower=Ajna ruĝa floro +Any blue flower=Ajna blua floro +Any black flower=Ajna nigra floro +Any green flower=Ajna verda floro +Any white flower=Ajna blanka floro +Any orange flower=Ajna oranĝa floro +Any violet flower=Ajna viola floro +Any yellow flower=Ajna flava floro +Any red dye=Ajna ruĝa tinkturo +Any blue dye=Ajna blua tinkturo +Any cyan dye=Ajna bluverda tinkturo +Any grey dye=Ajna graja tinkturo +Any pink dye=Ajna rosa tinkturo +Any black dye=Ajna nigra tinkturo +Any brown dye=Ajna bruna tinkturo +Any green dye=Ajna verda tinkturo +Any white dye=Ajna blanka tinkturo +Any orange dye=Ajna oranĝa tinkturo +Any violet dye=Ajna viola tinkturo +Any yellow dye=Ajna flava tinkturo +Any magenta dye=Ajna fuksina tinkturo +Any dark grey dye=Ajna malhela graja tinkturo +Any dark green dye=Ajna malhela verda tinkturo +# Label for group ingredients +G=A +Any item belonging to the group(s): @1=Ajna objekto de la aro(j) +Unknown Item=Obskura Objekto +Fuel=Brulaĵo +Usage @1 of @2=Utilo @1 el @2 +Recipe @1 of @2=Recepto @1 el @2 +Previous recipe=Pasinta recepto +Next recipe=Sekvinta recepto +Recipe is too big to be displayed.=La recepto estas tro granda por prezenti +Shapeless=Senforma +Cooking time: @1=Tempo por kuirado: @1 +Search=Ŝerĉu +Reset=Rekomincigu +Previous page=Pasinta paĝo +Next page=Sekvinta paĝo +No items to show.=Ne estas objektoj por prezenti +No usages.=Ne estas utiloj +Click again to show recipes.=Anklaku ankoraŭ por prezenti receptojn +No recipes.=Ne estas receptoj +Click again to show usages.=Anklaku ankoraŭ por prezenti utiloj +Recipes=Receptoj diff --git a/locale/mtg_craftguide.es.tr b/locale/mtg_craftguide.es.tr new file mode 100644 index 0000000..a5b5149 --- /dev/null +++ b/locale/mtg_craftguide.es.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Carbón +Any sand=Arena +Any wool=Lana +Any stick=Palitos +Any vessel=Recipiente +Any wood planks=Tablas de madera +Any kind of stone block=Derivado de bloque de piedra +Any red flower=Flor roja +Any blue flower=Flor azul +Any black flower=Flor negra +Any green flower=Flor verde +Any white flower=Flor blanca +Any orange flower=Flor naranja +Any violet flower=Flor violeta +Any yellow flower=Flor amarilla +Any red dye=Tinte rojo +Any blue dye=Tinte azul +Any cyan dye=Tinte cian +Any grey dye=Tinte gris +Any pink dye=Tinte rosa +Any black dye=Tinte negro +Any brown dye=Tinte marrón +Any green dye=Tinte verde +Any white dye=Tinte blanco +Any orange dye=Tinte naranja +Any violet dye=Tinte violeta +Any yellow dye=Tinte amarillo +Any magenta dye=Tinte magenta +Any dark grey dye=Tinte gris oscuro +Any dark green dye=Tinte verde oscuro +# Label for group ingredients +G=G +Any item belonging to the group(s): @1=Objeto del grupo: @1 +Unknown Item=Objeto desconocido +Fuel=Combustible +Usage @1 of @2=Usa @1 en @2 +Recipe @1 of @2=Receta @1 en @2 +Previous recipe=Receta anterior +Next recipe=Próxima Receta +Recipe is too big to be displayed.=La receta es muy grande para ser mostrada. +Shapeless=Sin forma +Cooking time: @1=Tiempo de cocción: @1 +Search=Buscar +Reset=Resetear +Previous page=Página anterior +Next page=Próxima página +No items to show.=No hay objetos para mostrar. +No usages.=Sin usos. +Click again to show recipes.=Clica de nuevo para mostrar recetas. +No recipes.=No hay recetas. +Click again to show usages.=Clica de nuevo para mostrar usos. +Recipes=Recetas diff --git a/locale/mtg_craftguide.fr.tr b/locale/mtg_craftguide.fr.tr new file mode 100644 index 0000000..afc8224 --- /dev/null +++ b/locale/mtg_craftguide.fr.tr @@ -0,0 +1,54 @@ +# textdomain: mtg_craftguide + +Any coal=Quelconque charbon +Any sand=Quelconque sable +Any wool=Quelconque laine +Any stick=Quelconque bâton +Any vessel=Quelconque couvert +Any wood planks=Quelconques planches de bois +Any kind of stone block=Quelconque roche +Any red flower=Quelconque fleur rouge +Any blue flower=Quelconque fleur bleue +Any black flower=Quelconque fleur noire +Any green flower=Quelconque fleur verte +Any white flower=Quelconque fleur blanche +Any orange flower=Quelconque fleur orange +Any violet flower=Quelconque fleur violette +Any yellow flower=Quelconque fleur jaune +Any red dye=Quelconque colorant rouge +Any blue dye=Quelconque colorant bleu +Any cyan dye=Quelconque colorant bleu ciel +Any grey dye=Quelconque colorant gris +Any pink dye=Quelconque colorant rose +Any black dye=Quelconque colorant noir +Any brown dye=Quelconque colorant marron +Any green dye=Quelconque colorant vert +Any white dye=Quelconque colorant blanc +Any orange dye=Quelconque colorant orange +Any violet dye=Quelconque colorant violet +Any yellow dye=Quelconque colorant jaune +Any magenta dye=Quelconque colorant magenta +Any dark grey dye=Quelconque colorant gris foncé +Any dark green dye=Quelconque colorant vert foncé +# Label for group ingredients +G=G +Any item belonging to the group(s): @1=Tout item appartenant au(x) groupe(s) : @1 +Unknown Item=Object inconnu +Fuel=Combustible +Usage @1 of @2=Usage @1 sur @2 +Recipe @1 of @2=Recette @1 sur @2 +Previous recipe=Recette précédente +Next recipe=Prochaine recette +Recipe is too big to be displayed.=Recette trop grande pour être affichée. +Shapeless=Sans forme +Cooking time: @1=Temps de cuisson : @1 +Search=Recherche +Reset=Réinitialiser +Previous page=Page précédente +Next page=Prochaine page +No items to show.=Aucun item à afficher. +No usages.=Sans utilité. +Click again to show recipes.=Cliquez encore pour afficher la recette. +No recipes.=Aucune recette. +Click again to show usages.=Cliquez encore pour afficher l'usage. +Recipes=Recettes diff --git a/locale/mtg_craftguide.ja.tr b/locale/mtg_craftguide.ja.tr new file mode 100644 index 0000000..c6ec66a --- /dev/null +++ b/locale/mtg_craftguide.ja.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=石炭 +Any sand=砂 +Any wool=羊毛 +Any stick=棒 +Any vessel=瓶 +Any wood planks=板材 +Any kind of stone block=石のブロック +Any red flower=赤色の花 +Any blue flower=青色の花 +Any black flower=黒色の花 +Any green flower=緑色の花 +Any white flower=白色の花 +Any orange flower=橙色の花 +Any violet flower=紫色の花 +Any yellow flower=黄色の花 +Any red dye=赤色の染料 +Any blue dye=青色の染料 +Any cyan dye=青緑色の染料 +Any grey dye=灰色の染料 +Any pink dye=桃色の染料 +Any black dye=黒色の染料 +Any brown dye=茶色の染料 +Any green dye=緑色の染料 +Any white dye=白色の染料 +Any orange dye=橙色の染料 +Any violet dye=紫色の染料 +Any yellow dye=黄色の染料 +Any magenta dye=赤紫色の染料 +Any dark grey dye=濃灰色の染料 +Any dark green dye=濃緑色の染料 +# Label for group ingredients +G= +Any item belonging to the group(s): @1=グループに属するアイテム: @1 +Unknown Item=不明なアイテム +Fuel=燃料 +Usage @1 of @2=利用方法 @1 / @2 +Recipe @1 of @2=レシピ @1 / @2 +Previous recipe=前のレシピ +Next recipe=次のレシピ +Recipe is too big to be displayed.=レシピが大きすぎて表示できません。 +Shapeless=無形 +Cooking time: @1=調理時間: @1 +Search=検索 +Reset=リセット +Previous page=前のページ +Next page=次のページ +No items to show.=表示する項目がありません。 +No usages.=利用方法がありません。 +Click again to show recipes.=もう一度クリックするとレシピを表示します。 +No recipes.=レシピがありません。 +Click again to show usages.=もう一度クリックすると使用方法を表示します。 +Recipes=レシピ diff --git a/locale/mtg_craftguide.jbo.tr b/locale/mtg_craftguide.jbo.tr new file mode 100644 index 0000000..c9e6fbf --- /dev/null +++ b/locale/mtg_craftguide.jbo.tr @@ -0,0 +1,54 @@ +# textdomain: mtg_craftguide +Any coal=lo cmina lo'i kolme +Any sand=lo cmima lo'i sance +Any wool=lo cmima lo'i sunla +Any stick=lo cmima lo'i grana +Any vessel=lo cmima lo'i vasru +Any wood planks=lo cmima lo'i mudri tanbo +Any kind of stone block=lo cmima lo'i rokci bliku +Any red flower=lo cmima lo'i xunre xrula +Any blue flower=lo cmima lo'i blanu xrula +Any black flower=lo cmima lo'i xekri xrula +Any green flower=lo cmima lo'i crino xrula +Any white flower=lo cmima lo'i blabi xrula +Any orange flower=lo cmima lo'i narju xrula +Any violet flower=lo cmima lo'i zirpu xrula +Any yellow flower=lo cmima lo'i pelxu xrula +Any red dye=lo cmima lo'i xunre xinmo +Any blue dye=lo cmima lo'i blanu xinmo +Any cyan dye=lo cmima lo'i cicna xinmo +Any grey dye=lo cmima lo'i grusi xinmo +Any pink dye=lo cmima lo'i xunblabi xinmo +Any black dye=lo cmima lo'i xekri xinmo +Any brown dye=lo cmima lo'i bunre xinmo +Any green dye=lo cmima lo'i crino xinmo +Any white dye=lo cmima lo'i blabi xinmo +Any orange dye=lo cmima lo'i narju xinmo +Any violet dye=lo cmima lo'i zirpu xinmo +Any yellow dye=lo cmima lo'i pelxu xinmo +Any magenta dye=lo cmima lo'i nukni xinmo +Any dark grey dye=lo cmima lo'i xekri grusi xinmo +Any dark green dye=lo cmima lo'i xekri crino xinmo +# Label for group ingredients +# c = cmima +G=c +Any item belonging to the group(s): @1=lo cmima lo'i me zoi gi'u.@1.gi'u +Unknown Item=lo na te djuno dacti +Fuel=.i livla +Usage @1 of @2=.i meirmoi fe li @1 li @2@nle'i te zbasu +Recipe @1 of @2=.i meirmoi fe li @1 li @2@nle'i te jukpa +Previous recipe=lidne +Next recipe=selyli'e +Recipe is too big to be displayed.=.i lo te jukpa cu dukse lo ka barda tezu'e lo nu jarco +Shapeless=tarmi claxu +Cooking time: @1=lo pu'u jukpa cu snidu li @1 +Search=sisku +Reset=kraga'igau +Previous page=lidne +Next page=selyli'e +No items to show.=no da dacti cu se jarco +No usages.=na te zbasu +Click again to show recipes.=.i ko rapli .iklki fi lo nu .arco lo te jukpa +No recipes.=na te jukpa +Click again to show usages.=.i ko rapli .iklki fi lo nu .arco lo te zbasu +Recipes=lo te jukpa diff --git a/locale/mtg_craftguide.pt_BR.tr b/locale/mtg_craftguide.pt_BR.tr new file mode 100644 index 0000000..a4bbf7f --- /dev/null +++ b/locale/mtg_craftguide.pt_BR.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Qualquer carvão +Any sand=Qualquer areia +Any wool=Qualquer madeira +Any stick=Qualquer graveto +Any vessel=Qualquer navio +Any wood planks=Qualquer tábua de madeira +Any kind of stone block=Qualquer tipo de bloco de pedra +Any red flower=Qualquer flor vermelha +Any blue flower=Qualquer flor azul +Any black flower=Qualquer flor preta +Any green flower=Qualquer flor verde +Any white flower=Qualquer flor branca +Any orange flower=Qualquer flor laranja +Any violet flower=Qualquer flor violeta +Any yellow flower=Qualquer flor amarela +Any red dye=Qualquer tinta vermelha +Any blue dye=Qualquer tinta azul +Any cyan dye=Qualquer tinta ciano +Any grey dye=Qualquer tinta cinza +Any pink dye=Qualquer tinta rosa +Any black dye=Qualquer tinta preto +Any brown dye=Qualquer tinta marrom +Any green dye=Qualquer tinta verde +Any white dye=Qualquer tinta branca +Any orange dye=Qualquer tinta laranja +Any violet dye=Qualquer tinta violeta +Any yellow dye=Qualquer tinta amarela +Any magenta dye=Qualquer tinta magenta +Any dark grey dye=Qualquer tinta cinza-escuro +Any dark green dye=Qualquer tinta cinza-escuro +# Label for group ingredients +G=G +Any item belonging to the group(s): @1=Qualquer item pertencente ao(s) grupo(s): @1 +Unknown Item=Item Desconhecido +Fuel=Combustível +Usage @1 of @2=Uso @1 de @2 +Recipe @1 of @2=Receita @1 de @2 +Previous recipe=Receita anterior +Next recipe=Próxima receita +Recipe is too big to be displayed.=Receita é muito grande para ser exibida. +Shapeless=Sem forma +Cooking time: @1=Tempo de Cozimento: @1 +Search=Buscar +Reset=Redefinir +Previous page=Página anterior +Next page=Próxima página +No items to show.=Nenhum item para mostrar. +No usages.=Nenhum uso. +Click again to show recipes.=Clique novamente para mostrar receitas. +No recipes.=Nenhuma receita. +Click again to show usages.=Clique novamente para mostrar os usos. +Recipes=Receitas diff --git a/locale/mtg_craftguide.ru.tr b/locale/mtg_craftguide.ru.tr new file mode 100644 index 0000000..8c74106 --- /dev/null +++ b/locale/mtg_craftguide.ru.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Любой уголь +Any sand=Любой песок +Any wool=Любая шерсть +Any stick=Любая палка +Any vessel=Любой сосуд +Any wood planks=Любые деревянные палки +Any kind of stone block=Любой каменный блок +Any red flower=Любой красный цветок +Any blue flower=Любой синий цветок +Any black flower=Любой чёрный цветок +Any green flower=Любой зелёный цветок +Any white flower=Любой белый цветок +Any orange flower=Любой оранжевый цветок +Any violet flower=Любой фиолетовый цветок +Any yellow flower=Любой жёлтый цветок +Any red dye=Любая красная краска +Any blue dye=Любая синяя краска +Any cyan dye=Любая сине-зелёная краска +Any grey dye=Любая серая краска +Any pink dye=Любая розовая краска +Any black dye=Любая чёрная краска +Any brown dye=Любая коричневая краска +Any green dye=Любая зелёная краска +Any white dye=Любая белая краска +Any orange dye=Любая оранжевая краска +Any violet dye=Любая фиолетовая краска +Any yellow dye=Любая жёлтая краска +Any magenta dye=Любая пурпурная краска +Any dark grey dye=Любая тёмно-серая краска +Any dark green dye=Любая тёмно-зелёная краска +# Label for group ingredients +G= +Any item belonging to the group(s): @1=Любой предмет из групп(ы): @1 +Unknown Item=Неизвествый предмет +Fuel=Топливо +Usage @1 of @2= +Recipe @1 of @2= +Previous recipe=Предыдущий рецепт +Next recipe=Следующий рецепт +Recipe is too big to be displayed.=Рецепт слишком большой для показа +Shapeless= +Cooking time: @1=Время изготовления: @1 +Search=Поиск +Reset=Сбросить +Previous page=Предыдущая страница +Next page=Следующая страница +No items to show.=Нет элементов для отображения. +No usages.= +Click again to show recipes.=Нажмите снова для отображения рецептов. +No recipes.=Нет рецептов. +Click again to show usages.= +Recipes=Рецепты diff --git a/locale/mtg_craftguide.sv.tr b/locale/mtg_craftguide.sv.tr new file mode 100644 index 0000000..00b4056 --- /dev/null +++ b/locale/mtg_craftguide.sv.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Någon typ av kol +Any sand=Någon typ av sand +Any wool=Någon typ av ull +Any stick=Någon typ av pinne +Any vessel=Någon typ av fartygshylla +Any wood planks=Någon typ av träplanka +Any kind of stone block=Någon typ av stenblock +Any red flower=Någon typ av röd blomma +Any blue flower=Någon typ av blå blomma +Any black flower=Någon typ av svart blomma +Any green flower=Någon typ av grön blomma +Any white flower=Någon typ av vit blomma +Any orange flower=Någon typ av orange blomma +Any violet flower=Någon typ av violett blomma +Any yellow flower=Någon typ av gul blomma +Any red dye=Någon typ av röd färg +Any blue dye=Någon typ av blå färg +Any cyan dye=Någon typ av cyan färg +Any grey dye=Någon typ av grå färg +Any pink dye=Någon typ av rosa färg +Any black dye=Någon typ av svart färg +Any brown dye=Någon typ av brun färg +Any green dye=Någon typ av grön färg +Any white dye=Någon typ av vit färg +Any orange dye=Någon typ av orange färg +Any violet dye=Någon typ av violett färg +Any yellow dye=Någon typ av gul färg +Any magenta dye=Någon typ av magenta färg +Any dark grey dye=Någon typ av mörkgrå färg +Any dark green dye=Någon typ av mörkgrön färg +# Label for group ingredients +G=G +Any item belonging to the group(s): @1=Vilket föremål som helst som tillhör grupp(erna): @1 +Unknown Item=Okänt föremål +Fuel=Bränsle +Usage @1 of @2=Användning @1 av @2 +Recipe @1 of @2=Recept @1 av @2 +Previous recipe=Föregående recept +Next recipe=Nästa recept +Recipe is too big to be displayed.=Receptet är för stort för att visas. +Shapeless=Formlöst +Cooking time: @1=Tillagningstid: @1 +Search=Sök +Reset=Återställ +Previous page=Föregående sida +Next page=Nästa sida +No items to show.=Inga föremål att visa. +No usages.=Inga användningsområden. +Click again to show recipes.=Tryck igen för att visa recept. +No recipes.=Inga recept. +Click again to show usages.=Tryck igen för att visa användningsområden. +Recipes=Recept diff --git a/locale/mtg_craftguide.uk.tr b/locale/mtg_craftguide.uk.tr new file mode 100644 index 0000000..52d33a4 --- /dev/null +++ b/locale/mtg_craftguide.uk.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=Будь-яке вугілля +Any sand=Будь-якій пісок +Any wool=Будь-яка вовна +Any stick=Будь-яка паличка +Any vessel=Будь-який посуд +Any wood planks=Будь-які дерев'яні палички +Any kind of stone block=Будь-який кам'яний блок +Any red flower=Будь-яка червона квітка +Any blue flower=Будь-яка синя квітка +Any black flower=Будь-яка чорна квітка +Any green flower=Будь-яка зелена квітка +Any white flower=Будь-яка біла квітка +Any orange flower=Будь-яка помаранчева квітка +Any violet flower=Будь-яка фіолетова квітка +Any yellow flower=Будь-яка жовта квітка +Any red dye=Будь-яка червона фарба +Any blue dye=Будь-яка синя фарба +Any cyan dye=Будь-яка синьо-зелена фарба +Any grey dye=Будь-яка сіра фарба +Any pink dye=Будь-яка рожева фарба +Any black dye=Будь-яка чорна фарба +Any brown dye=Будь-яка коричнева фарба +Any green dye=Будь-яка зелена фарба +Any white dye=Будь-яка біла фарба +Any orange dye=Будь-яка помаранчева фарба +Any violet dye=Будь-яка фіолетова фарба +Any yellow dye=Будь-яка жовта фарба +Any magenta dye=Будь-який пурпурна фарба +Any dark grey dye=Будь-яка темно-сіра фарба +Any dark green dye=Будь-яка темно-зелена фарба +# Label for group ingredients +G= +Any item belonging to the group(s): @1=Будь-який предмет з груп(и): @1 +Unknown Item=Невідомий предмет +Fuel=Паливо +Usage @1 of @2=Використано @1 з @2 +Recipe @1 of @2=Рецепт @1 з @2 +Previous recipe=Попередній рецепт +Next recipe=Наступний рецепт +Recipe is too big to be displayed.=Рецепт занадто великий для показу. +Shapeless=Безформний +Cooking time: @1=Час виготовлення: @1 +Search=Пошук +Reset=Скинути +Previous page=Попередня сторінка +Next page=Наступна сторінка +No items to show.=Немає елементів для показу. +No usages.=Не використовується. +Click again to show recipes.=Натисніть ще раз, щоб показати рецепти. +No recipes.=Немає рецептів. +Click again to show usages.=Натисніть ще раз, щоб показати використання. +Recipes=Рецепти diff --git a/locale/mtg_craftguide.zh_CN.tr b/locale/mtg_craftguide.zh_CN.tr new file mode 100644 index 0000000..56ae7d5 --- /dev/null +++ b/locale/mtg_craftguide.zh_CN.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=任何煤炭 +Any sand=任何沙子 +Any wool=任何羊毛 +Any stick=任何棒 +Any vessel=任何容器 +Any wood planks=任何木板 +Any kind of stone block=任何种类的石块 +Any red flower=任何红色花朵 +Any blue flower=任何蓝色花朵 +Any black flower=任何黑色花朵 +Any green flower=任何绿色花朵 +Any white flower=任何白色花朵 +Any orange flower=任何橙色花朵 +Any violet flower=任何紫色花朵 +Any yellow flower=任何黄色花朵 +Any red dye=任何红色染料 +Any blue dye=任何蓝色染料 +Any cyan dye=任何青色染料 +Any grey dye=任何灰色染料 +Any pink dye=任何粉色染料 +Any black dye=任何黑色染料 +Any brown dye=任何棕色染料 +Any green dye=任何绿色染料 +Any white dye=任何白色染料 +Any orange dye=任何橙色染料 +Any violet dye=任何紫色染料 +Any yellow dye=任何黄色染料 +Any magenta dye=任何品红染料 +Any dark grey dye=任何暗灰染料 +Any dark green dye=任何暗绿染料 +# Label for group ingredients +G= +Any item belonging to the group(s): @1=属于该组的任何项目:@1 +Unknown Item=未知项目 +Fuel=燃料 +Usage @1 of @2=用法@1,共@2个 +Recipe @1 of @2=配方@1,共@2个 +Previous recipe=上一配方 +Next recipe=下一配方 +Recipe is too big to be displayed.=配方太大,无法显示 +Shapeless=没有形状 +Cooking time: @1=烹饪时间:@1 +Search=搜索 +Reset=重置 +Previous page=上一页 +Next page=下一页 +No items to show.=没有项目可以显示。 +No usages.=没有用法 +Click again to show recipes.=再次单击以显示配方。 +No recipes.=没有配方。 +Click again to show usages.=再次单击以显示用法 +Recipes=配方 diff --git a/locale/mtg_craftguide.zh_TW.tr b/locale/mtg_craftguide.zh_TW.tr new file mode 100644 index 0000000..859cdfe --- /dev/null +++ b/locale/mtg_craftguide.zh_TW.tr @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal=任何煤炭 +Any sand=任何沙子 +Any wool=任何羊毛 +Any stick=任何棒 +Any vessel=任何容器 +Any wood planks=任何木板 +Any kind of stone block=任何種類的石塊 +Any red flower=任何紅色花朵 +Any blue flower=任何藍色花朵 +Any black flower=任何黑色花朵 +Any green flower=任何綠色花朵 +Any white flower=任何白色花朵 +Any orange flower=任何橙色花朵 +Any violet flower=任何紫色花朵 +Any yellow flower=任何黃色花朵 +Any red dye=任何紅色染料 +Any blue dye=任何藍色染料 +Any cyan dye=任何青色染料 +Any grey dye=任何灰色染料 +Any pink dye=任何粉色染料 +Any black dye=任何黑色染料 +Any brown dye=任何棕色染料 +Any green dye=任何綠色染料 +Any white dye=任何白色染料 +Any orange dye=任何橙色染料 +Any violet dye=任何紫色染料 +Any yellow dye=任何黃色染料 +Any magenta dye=任何品紅染料 +Any dark grey dye=任何暗灰染料 +Any dark green dye=任何暗綠染料 +# Label for group ingredients +G= +Any item belonging to the group(s): @1=屬於該組的任何項目:@1 +Unknown Item=未知項目 +Fuel=燃料 +Usage @1 of @2=用法@1,共@2個 +Recipe @1 of @2=配方@1,共@2個 +Previous recipe=上一配方 +Next recipe=下一配方 +Recipe is too big to be displayed.=配方太大,無法顯示 +Shapeless=沒有形狀 +Cooking time: @1=烹飪時間:@1 +Search=搜索 +Reset=重置 +Previous page=上一頁 +Next page=下一頁 +No items to show.=沒有項目可以顯示。 +No usages.=沒有用法 +Click again to show recipes.=再次單擊以顯示配方。 +No recipes.=沒有配方。 +Click again to show usages.=再次單擊以顯示用法 +Recipes=配方 diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..e02a721 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,53 @@ +# textdomain: mtg_craftguide +Any coal= +Any sand= +Any wool= +Any stick= +Any vessel= +Any wood planks= +Any kind of stone block= +Any red flower= +Any blue flower= +Any black flower= +Any green flower= +Any white flower= +Any orange flower= +Any violet flower= +Any yellow flower= +Any red dye= +Any blue dye= +Any cyan dye= +Any grey dye= +Any pink dye= +Any black dye= +Any brown dye= +Any green dye= +Any white dye= +Any orange dye= +Any violet dye= +Any yellow dye= +Any magenta dye= +Any dark grey dye= +Any dark green dye= +# Label for group ingredients +G= +Any item belonging to the group(s): @1= +Unknown Item= +Fuel= +Usage @1 of @2= +Recipe @1 of @2= +Previous recipe= +Next recipe= +Recipe is too big to be displayed.= +Shapeless= +Cooking time: @1= +Search= +Reset= +Previous page= +Next page= +No items to show.= +No usages.= +Click again to show recipes.= +No recipes.= +Click again to show usages.= +Recipes= diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..3b2d975 --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = mtg_craftguide +description = Minetest Game mod: mtg_craftguide +depends = sfinv diff --git a/textures/craftguide_clear_icon.png b/textures/craftguide_clear_icon.png new file mode 100644 index 0000000..1a0e513 Binary files /dev/null and b/textures/craftguide_clear_icon.png differ diff --git a/textures/craftguide_furnace.png b/textures/craftguide_furnace.png new file mode 100644 index 0000000..60d1a61 Binary files /dev/null and b/textures/craftguide_furnace.png differ diff --git a/textures/craftguide_next_icon.png b/textures/craftguide_next_icon.png new file mode 100644 index 0000000..266c9ba Binary files /dev/null and b/textures/craftguide_next_icon.png differ diff --git a/textures/craftguide_prev_icon.png b/textures/craftguide_prev_icon.png new file mode 100644 index 0000000..c807296 Binary files /dev/null and b/textures/craftguide_prev_icon.png differ diff --git a/textures/craftguide_search_icon.png b/textures/craftguide_search_icon.png new file mode 100644 index 0000000..1c374ca Binary files /dev/null and b/textures/craftguide_search_icon.png differ diff --git a/textures/craftguide_shapeless.png b/textures/craftguide_shapeless.png new file mode 100644 index 0000000..51d8ce5 Binary files /dev/null and b/textures/craftguide_shapeless.png differ