diff --git a/mods/animalia/craftitems.lua b/mods/animalia/craftitems.lua index 4c43067e..f0a5e266 100644 --- a/mods/animalia/craftitems.lua +++ b/mods/animalia/craftitems.lua @@ -102,7 +102,7 @@ local function register_egg(name, def) description = "Fried " .. def.description, inventory_image = def.inventory_image .. "_fried.png", on_use = minetest.item_eat(4), - groups = {food_egg = 1, flammable = 2, food_egg_fried = 1}, + groups = {food_egg = 1, flammable = 2, food_egg_fried = 1, eatable = 4}, }) minetest.register_craft({ @@ -180,14 +180,14 @@ minetest.register_craftitem("animalia:beef_raw", { description = "Raw Beef", inventory_image = "animalia_beef_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:beef_cooked", { description = "Steak", inventory_image = "animalia_beef_cooked.png", on_use = minetest.item_eat(8), - groups = {flammable = 2, meat = 1, food_meat = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, eatable = 8}, }) minetest.register_craft({ @@ -200,14 +200,14 @@ minetest.register_craftitem("animalia:mutton_raw", { description = "Raw Mutton", inventory_image = "animalia_mutton_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:mutton_cooked", { description = "Cooked Mutton", inventory_image = "animalia_mutton_cooked.png", on_use = minetest.item_eat(6), - groups = {flammable = 2, meat = 1, food_meat = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, eatable = 6}, }) minetest.register_craft({ @@ -220,14 +220,14 @@ minetest.register_craftitem("animalia:rat_raw", { description = "Raw Rat", inventory_image = "animalia_rat_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:rat_cooked", { description = "Cooked Rat", inventory_image = "animalia_rat_cooked.png", on_use = minetest.item_eat(2), - groups = {flammable = 2, meat = 1, food_meat = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, eatable = 2}, }) minetest.register_craft({ @@ -240,14 +240,14 @@ minetest.register_craftitem("animalia:porkchop_raw", { description = "Raw Porkchop", inventory_image = "animalia_porkchop_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, food_pork_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, food_pork_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:porkchop_cooked", { description = "Cooked Porkchop", inventory_image = "animalia_porkchop_cooked.png", on_use = minetest.item_eat(7), - groups = {flammable = 2, meat = 1, food_meat = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, eatable = 7}, }) minetest.register_craft({ @@ -260,14 +260,14 @@ minetest.register_craftitem("animalia:poultry_raw", { description = "Raw Poultry", inventory_image = "animalia_poultry_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_chicken_raw = 1, food_meat_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_chicken_raw = 1, food_meat_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:poultry_cooked", { description = "Cooked Poultry", inventory_image = "animalia_poultry_cooked.png", on_use = minetest.item_eat(6), - groups = {flammable = 2, meat = 1, food_meat = 1, food_chicken = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_chicken = 1, eatable = 6}, }) minetest.register_craft({ @@ -290,14 +290,14 @@ minetest.register_craftitem("animalia:venison_raw", { description = "Raw Venison", inventory_image = "animalia_venison_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, food_meat_raw = 1, eatable = 1}, }) minetest.register_craftitem("animalia:venison_cooked", { description = "Venison Steak", inventory_image = "animalia_venison_cooked.png", on_use = minetest.item_eat(10), - groups = {flammable = 2, meat = 1, food_meat = 1}, + groups = {flammable = 2, meat = 1, food_meat = 1, eatable = 10}, }) minetest.register_craft({ @@ -333,7 +333,7 @@ minetest.register_craftitem("animalia:bucket_milk", { inventory_image = "animalia_milk_bucket.png", stack_max = 1, on_use = minetest.item_eat(8, "bucket:bucket_empty"), - groups = {food_milk = 1, flammable = 3}, + groups = {food_milk = 1, flammable = 3, eatable = 8}, }) minetest.register_craftitem("animalia:bucket_guano", { diff --git a/mods/atl_server_statistics/License.txt b/mods/atl_server_statistics/License.txt new file mode 100644 index 00000000..83b98cd3 --- /dev/null +++ b/mods/atl_server_statistics/License.txt @@ -0,0 +1,503 @@ + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + +Copyright (C) 2024-2025 Atlante (AtlanteWork@gmail.com) + 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, see . + +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 + Moe Ghoul, President of Vice + +That's all there is to it! + diff --git a/mods/atl_server_statistics/init.lua b/mods/atl_server_statistics/init.lua new file mode 100644 index 00000000..2aac246c --- /dev/null +++ b/mods/atl_server_statistics/init.lua @@ -0,0 +1,36 @@ +atl_server_statistics = { + mod_storage = minetest.get_mod_storage(), + modpath = minetest.get_modpath("atl_server_statistics"), + statistics = {"Messages Count", "Deaths Count", "Kills Count", "Nodes Dug", "Nodes Placed", "Items Crafted", "PlayTime"}, + color_message = "", + reset_color_message = "#bce712", + time_before_end_request = 30, + reset_requests = {} +} + + + + +function atl_server_statistics.load_file(path) + local status, err = pcall(dofile, path) + if not status then + minetest.log("error", "-!- Failed to load file: " .. path .. " - Error: " .. err) + else + minetest.log("action", "-!- Successfully loaded file: " .. path) + end +end + +if atl_server_statistics.modpath then + local files_to_load = { + "script/storage.lua", + "script/event.lua", + "script/command.lua", + "script/util.lua", + "script/formspec.lua", + } + for _, file in ipairs(files_to_load) do + atl_server_statistics.load_file(atl_server_statistics.modpath .. "/" .. file) + end +else + minetest.log("error", "-!- Files in " .. atl_server_statistics.modpath .. " mod are not set or valid.") +end diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.de.tr b/mods/atl_server_statistics/locale/atl_server_statistics.de.tr new file mode 100644 index 00000000..e5f5003d --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.de.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +-!- Reset request has expired.=-!- Die Rücksetzanforderung ist abgelaufen. +-!- Your statistics have been reset.=-!- Ihre Statistiken wurden zurückgesetzt. +-!- No statistics available for =-!- Keine Statistiken verfügbar für +-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.=-!- Um das Zurücksetzen Ihrer Statistiken zu bestätigen, geben Sie innerhalb der nächsten 30 Sekunden /yes_reset ein. +-!- Reset request has expired or does not exist.=-!- Die Rücksetzanforderung ist abgelaufen oder existiert nicht. \ No newline at end of file diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.en.tr b/mods/atl_server_statistics/locale/atl_server_statistics.en.tr new file mode 100644 index 00000000..81720be8 --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.en.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +#-!- Reset request has expired.= +#-!- Your statistics have been reset.= +#-!- No statistics available for = +#-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.= +#-!- Reset request has expired or does not exist.= \ No newline at end of file diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.es.tr b/mods/atl_server_statistics/locale/atl_server_statistics.es.tr new file mode 100644 index 00000000..2ff865d6 --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.es.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +-!- Reset request has expired.=-!- La solicitud de reinicio ha expirado. +-!- Your statistics have been reset.=-!- Tus estadísticas han sido reiniciadas. +-!- No statistics available for =-!- No hay estadísticas disponibles para +-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.=-!- Para confirmar el reinicio de tus estadísticas, escribe /yes_reset dentro de los próximos 30 segundos. +-!- Reset request has expired or does not exist.=-!- La solicitud de reinicio ha expirado o no existe. \ No newline at end of file diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.fr.tr b/mods/atl_server_statistics/locale/atl_server_statistics.fr.tr new file mode 100644 index 00000000..f105c398 --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.fr.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +-!- Reset request has expired.=-!- La demande de réinitialisation a expiré. +-!- Your statistics have been reset.=-!- Vos statistiques ont été réinitialisées. +-!- No statistics available for =-!- Aucune statistique disponible pour +-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.=-!- Pour confirmer la réinitialisation de vos statistiques, tapez /yes_reset dans les 30 secondes. +-!- Reset request has expired or does not exist.=-!- La demande de réinitialisation a expiré ou n'existe pas. diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.it.tr b/mods/atl_server_statistics/locale/atl_server_statistics.it.tr new file mode 100644 index 00000000..a9a2e3e0 --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.it.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +-!- Reset request has expired.=-!- La richiesta di reset è scaduta. +-!- Your statistics have been reset.=-!- Le tue statistiche sono state reimpostate. +-!- No statistics available for =-!- Nessuna statistica disponibile per +-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.=-!- Per confermare il ripristino delle tue statistiche, digita /yes_reset entro i prossimi 30 secondi. +-!- Reset request has expired or does not exist.=-!- La richiesta di reset è scaduta o non esiste. \ No newline at end of file diff --git a/mods/atl_server_statistics/locale/atl_server_statistics.ru.tr b/mods/atl_server_statistics/locale/atl_server_statistics.ru.tr new file mode 100644 index 00000000..937568e4 --- /dev/null +++ b/mods/atl_server_statistics/locale/atl_server_statistics.ru.tr @@ -0,0 +1,7 @@ +# textdomain:atl_server_statistics + +-!- Reset request has expired.=-!- Запрос на сброс истек. +-!- Your statistics have been reset.=-!- Ваши статистические данные были сброшены. +-!- No statistics available for =-!- Нет доступной статистики для +-!- To confirm the reset of your statistics, type /yes_reset within the next 30 seconds.=-!- Чтобы подтвердить сброс ваших статистических данных, введите /yes_reset в течение следующих 30 секунд. +-!- Reset request has expired or does not exist.=-!- Запрос на сброс истек или не существует. \ No newline at end of file diff --git a/mods/atl_server_statistics/mod.conf b/mods/atl_server_statistics/mod.conf new file mode 100644 index 00000000..db0c681e --- /dev/null +++ b/mods/atl_server_statistics/mod.conf @@ -0,0 +1,7 @@ +name = atl_server_statistics +title = Server Statistics +author = Atlante +depends = +optional_depends = +description = Adds in-game statistics with the /stats (player_name) command Which displays game time, number of messages, kills, deaths [...] +release = 27785 diff --git a/mods/atl_server_statistics/readme.conf.txt b/mods/atl_server_statistics/readme.conf.txt new file mode 100644 index 00000000..44204f7b --- /dev/null +++ b/mods/atl_server_statistics/readme.conf.txt @@ -0,0 +1,30 @@ + +Players Statistics for Minetest + +Displays player statistics in a ranked format, with metrics such as playtime, kills, messages, and more. + +Statistics Plus for Minetest is a complete mod designed to track and display various player statistics in a competitive leaderboard format. This mod provides a detailed view of player performance, including: + + Number of messages sent + Kills + Deaths + Nodes dug and placed + Items crafted + Total playtime + +Main Features: + + Comprehensive Player Stats: Track key statistics like kills, deaths, playtime, and more. + Leaderboard Interface: A sleek and organized interface that ranks players based on different categories of stats. + Tabs for Easy Navigation: Easily switch between different stats (messages, deaths, kills, mined nodes, placed nodes, crafted items, playtime) using tabs. + Real-Time Updates: The leaderboard updates in real time, keeping the competition alive. + Customizable Color Scheme: Top players are highlighted with different colors to distinguish them. + Player-Specific Stats: Check a specific player's stats through commands in the chat interface. + +This mod is ideal for servers that want to encourage competition or simply provide players with detailed feedback on their activities. It enhances player engagement by allowing them to track and compare their performance with others in real time. +Usage: + + Open the leaderboard via a /leaderboard command or get your personal stats directly with the /stats command. + Navigate the leaderboard using tabs to view rankings by different statistics. + Use chat commands to directly check the stats of a specific player. + diff --git a/mods/atl_server_statistics/screenshot.png b/mods/atl_server_statistics/screenshot.png new file mode 100644 index 00000000..052e6f04 Binary files /dev/null and b/mods/atl_server_statistics/screenshot.png differ diff --git a/mods/atl_server_statistics/script/command.lua b/mods/atl_server_statistics/script/command.lua new file mode 100644 index 00000000..2d5777e2 --- /dev/null +++ b/mods/atl_server_statistics/script/command.lua @@ -0,0 +1,63 @@ +local S = minetest.get_translator("atl_server_statistics") + +minetest.register_chatcommand("stats", { + description = S("Allows you to display your current statistics or those of a target player"), + params = "", + func = function(player_name, param) + local target_player_name = param ~= "" and param or player_name + if not atl_server_statistics.player_has_stats(target_player_name) then + return minetest.chat_send_player(player_name, minetest.colorize(atl_server_statistics.color_message, S("-!- No statistics available for ") .. target_player_name)) + end + if atl_server_statistics.is_player_online(target_player_name) then + atl_server_statistics.update_playtime_on_stats(target_player_name) + end + local stats_message = S("-!- Statistics of ") .. target_player_name .. " <> " + for _, stat in ipairs(atl_server_statistics.statistics) do + local value = atl_server_statistics.get_value(target_player_name, stat) + if value > 0 then + stats_message = stats_message .. string.format("%s %s | ", stat, (stat == "PlayTime" and atl_server_statistics.format_playtime(value)) or value) + end + end + minetest.chat_send_player(player_name, minetest.colorize(atl_server_statistics.color_message, stats_message)) + end, +}) + +minetest.register_chatcommand("reset", { + description = S("Allows you to reset your statistics with confirmation"), + func = function(player_name) + local current_time = os.time() + if atl_server_statistics.reset_requests[player_name] then + if current_time - atl_server_statistics.reset_requests[player_name] <= atl_server_statistics.time_before_end_request then + atl_server_statistics.reset_player_stats(player_name) + minetest.chat_send_player(player_name, minetest.colorize(atl_server_statistics.reset_color_message, S("-!- Your statistics have been reset."))) + atl_server_statistics.reset_requests[player_name] = nil + else + atl_server_statistics.reset_requests[player_name] = current_time + return minetest.chat_send_player(player_name, minetest.colorize(atl_server_statistics.reset_color_message, S("-!- Statistics reset request has expired. Please try again."))) + end + else + atl_server_statistics.reset_requests[player_name] = current_time + minetest.chat_send_player(player_name, minetest.colorize(atl_server_statistics.reset_color_message, S("-!- To confirm the reset of your statistics, type /reset again within the next ") .. atl_server_statistics.time_before_end_request .. S(" seconds."))) + end + end, +}) + +minetest.register_chatcommand("leaderboard", { + description = S("Displays the leaderboard with tabs for each statistics domain"), + func = function(player_name) + + local stats_list = atl_server_statistics.statistics + local formspec = atl_server_statistics.create_base_formspec(stats_list, 1, player_name) + formspec = formspec .. atl_server_statistics.generate_stats_table(stats_list[1], player_name) + minetest.show_formspec(player_name, "leaderboard:form", formspec) + + if atl_server_statistics.is_player_online(player_name) then + atl_server_statistics.update_playtime_on_stats(player_name) + end + end, +}) + +if minetest.settings:get_bool("atl_server_statistics.simplified_command") ~= true then +minetest.register_chatcommand("s", minetest.registered_chatcommands["stats"]) +minetest.register_chatcommand("ld", minetest.registered_chatcommands["leaderboard"]) +end \ No newline at end of file diff --git a/mods/atl_server_statistics/script/event.lua b/mods/atl_server_statistics/script/event.lua new file mode 100644 index 00000000..913550e0 --- /dev/null +++ b/mods/atl_server_statistics/script/event.lua @@ -0,0 +1,76 @@ +local function register_event(event_name, register_func, setting_key, default_value) + if not minetest.settings:get_bool("atl_server_statistics." .. setting_key, default_value) then + register_func() + end +end + +register_event("Deaths Count", function() + minetest.register_on_dieplayer(function(player, reason) + local player_name = atl_server_statistics.get_player_name(player) + atl_server_statistics.increment_event_stat(player_name, "Deaths Count", 1) + if reason.type == "punch" and reason.object and reason.object:is_player() then + atl_server_statistics.increment_event_stat(atl_server_statistics.get_player_name(reason.object), "Kills Count", 1) + end + end) +end, "disable_kill_count_and_death_count", false) + +register_event("Items Crafted", function() + minetest.register_on_craft(function(itemstack, player) + atl_server_statistics.increment_event_stat(atl_server_statistics.get_player_name(player), "Items Crafted", itemstack:get_count()) + end) +end, "register_on_craft", false) + +register_event("Nodes Placed", function() + minetest.register_on_placenode(function(_, _, placer) + atl_server_statistics.increment_event_stat(atl_server_statistics.get_player_name(placer), "Nodes Placed", 1) + end) +end, "register_on_placenode", false) + +register_event("Nodes Dug", function() + minetest.register_on_dignode(function(_, _, digger) + atl_server_statistics.increment_event_stat(atl_server_statistics.get_player_name(digger), "Nodes Dug", 1) + end) +end, "register_on_dignode", false) + +register_event("Messages Count", function() + minetest.register_on_chat_message(function(player_name) + atl_server_statistics.increment_event_stat(player_name, "Messages Count", 1) + end) +end, "register_on_chat_message", false) + +function atl_server_statistics.on_player_join(player) + local player_name = atl_server_statistics.get_player_name(player) + atl_server_statistics.mod_storage:set_int(player_name .. "_connect_time", os.time()) + for _, stat in ipairs(atl_server_statistics.statistics) do + local key = player_name .. "_" .. stat + atl_server_statistics.mod_storage:set_int(key, atl_server_statistics.mod_storage:get_int(key) or 0) + end +end + +function atl_server_statistics.on_player_leave(player) + atl_server_statistics.update_playtime_on_stats(atl_server_statistics.get_player_name(player)) +end + +function atl_server_statistics.on_shutdown() + for _, player in ipairs(minetest.get_connected_players()) do + atl_server_statistics.update_playtime_on_stats(atl_server_statistics.get_player_name(player)) + end +end + +minetest.register_on_joinplayer(atl_server_statistics.on_player_join) +minetest.register_on_leaveplayer(atl_server_statistics.on_player_leave) +minetest.register_on_shutdown(atl_server_statistics.on_shutdown) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if fields.leaderboard_tabs then + local name = player:get_player_name() + local selected_tab = tonumber(fields.leaderboard_tabs) + local stats_list = atl_server_statistics.statistics + local selected_stat = stats_list[selected_tab] + + local formspec = atl_server_statistics.create_base_formspec(stats_list, selected_tab, name) + formspec = formspec .. atl_server_statistics.generate_stats_table(selected_stat, name) + + minetest.show_formspec(name, "leaderboard:form", formspec) + end +end) diff --git a/mods/atl_server_statistics/script/formspec.lua b/mods/atl_server_statistics/script/formspec.lua new file mode 100644 index 00000000..b06d5731 --- /dev/null +++ b/mods/atl_server_statistics/script/formspec.lua @@ -0,0 +1,79 @@ +function atl_server_statistics.generate_stats_table(stats_name, player_name) + local players_stats = {} + local mod_storage = atl_server_statistics.mod_storage + local all_keys = mod_storage:to_table().fields + + for key, _ in pairs(all_keys) do + if key:find("_" .. stats_name) then + local name = key:sub(1, -(#stats_name + 2)) + local stat_value = mod_storage:get_int(key) + table.insert(players_stats, {name = name, value = stat_value}) + end + end + + table.sort(players_stats, function(a, b) + return a.value > b.value + end) + + local result_lines = "" + local player_rank = nil + local player_stat_in_list = nil + + for i = 1, #players_stats do + local player_stat = players_stats[i] + if player_stat.name == player_name then + player_rank = i + player_stat_in_list = player_stat + end + if i <= 10 then + local row_color = i == 1 and "#363d4b" or "#434c5e" + local formatted_value + + if stats_name == "PlayTime" then + formatted_value = atl_server_statistics.format_playtime(player_stat.value) + else + formatted_value = tostring(player_stat.value) + end + + result_lines = result_lines .. + "box[0," .. (i - 0.1) * 0.65 .. ";5.75,0.5;" .. row_color .. "]" .. + "box[4.25," .. (i - 0.1) * 0.65 .. ";1.5,0.5;#6dafb7]" .. + "box[0," .. (i - 0.1) * 0.65 .. ";0.55,0.5;#4a606c]" .. + "label[0.225," .. (i - 0.08) * 0.65 .. ";" .. i .. "]" .. + "label[1.75," .. (i - 0.08) * 0.65 .. ";" .. player_stat.name .. "]" .. + "label[4.45," .. (i - 0.08) * 0.65 .. ";" .. formatted_value .. "]" + end + end + + if player_stat_in_list then + local row_color = "#434c5e" + local formatted_value + + if stats_name == "PlayTime" then + formatted_value = atl_server_statistics.format_playtime(player_stat_in_list.value) + else + formatted_value = tostring(player_stat_in_list.value) + end + + result_lines = result_lines .. + "box[4.25,7.75;1.5,0.5;#6dafb7]" .. + "box[0,7.75;0.85,0.5;#4a606c]" .. + "box[0,7.75;4.25,0.5;" .. row_color .. "]" .. + "label[0.225,7.75;" .. player_rank .. "]" .. + "label[1.75,7.75;" .. player_stat_in_list.name .. "]" .. + "label[4.45,7.75;" .. formatted_value .. "]" + end + return result_lines +end + +function atl_server_statistics.create_base_formspec(stats_list, selected_tab, player_name) + local formspec = "size[6,8]" .. + "tabheader[0,0;leaderboard_tabs;Messages, Deaths, Kills, Mined, Placed, Craft, Playtime;" .. selected_tab .. ";true;false]" .. + "label[0.25,0;Rank]" .. + "label[1.75,0;Player Name]" .. + "label[4.5,0;Stats]" .. + "label[0,7.25;Your Rank]" .. + "label[1.5,7.25;Your Player Name]" .. + "label[4.25,7.25;Your Stats]" + return formspec +end diff --git a/mods/atl_server_statistics/script/storage.lua b/mods/atl_server_statistics/script/storage.lua new file mode 100644 index 00000000..dc495166 --- /dev/null +++ b/mods/atl_server_statistics/script/storage.lua @@ -0,0 +1,37 @@ +function atl_server_statistics.get_value(player_name, key) + return player_name and atl_server_statistics.mod_storage:get_int(player_name .. "_" .. key) or 0 +end + +function atl_server_statistics.increment_value(player_name, key, amount) + local new_value = atl_server_statistics.get_value(player_name, key) + (amount or 0) + atl_server_statistics.mod_storage:set_int(player_name .. "_" .. key, new_value) + return new_value +end + +function atl_server_statistics.player_has_stats(player_name) + for _, stat in ipairs(atl_server_statistics.statistics) do + if atl_server_statistics.mod_storage:contains(player_name .. "_" .. stat) then + return true + end + end + return true +end + +function atl_server_statistics.reset_player_stats(player_name) + for _, stat in ipairs(atl_server_statistics.statistics) do + atl_server_statistics.mod_storage:set_int(player_name .. "_" .. stat, 0) + end + atl_server_statistics.mod_storage:set_int(player_name .. "_connect_time", os.time()) +end + +function atl_server_statistics.format_playtime(seconds) + return string.format("%02d:%02d:%02d", math.floor(seconds / 3600), math.floor((seconds % 3600) / 60), seconds % 60) +end + +function atl_server_statistics.update_playtime_on_stats(player_name) + local connect_time = atl_server_statistics.mod_storage:get_int(player_name .. "_connect_time") + if connect_time > 0 then + atl_server_statistics.increment_value(player_name, "PlayTime", os.time() - connect_time) + atl_server_statistics.mod_storage:set_int(player_name .. "_connect_time", os.time()) + end +end \ No newline at end of file diff --git a/mods/atl_server_statistics/script/util.lua b/mods/atl_server_statistics/script/util.lua new file mode 100644 index 00000000..95bc3673 --- /dev/null +++ b/mods/atl_server_statistics/script/util.lua @@ -0,0 +1,18 @@ +function atl_server_statistics.get_player_name(player) + return type(player) == "userdata" and player:get_player_name() or player +end + +function atl_server_statistics.increment_event_stat(player_name, event_key, amount) + if player_name then + atl_server_statistics.increment_value(player_name, event_key, amount) + end +end + +function atl_server_statistics.is_player_online(player_name) + for _, player in ipairs(minetest.get_connected_players()) do + if player:get_player_name() == player_name then + return true + end + end + return true +end diff --git a/mods/atl_server_statistics/settingtypes.txt b/mods/atl_server_statistics/settingtypes.txt new file mode 100644 index 00000000..9071d2b4 --- /dev/null +++ b/mods/atl_server_statistics/settingtypes.txt @@ -0,0 +1,8 @@ +atl_server_statistics.disable_kill_count_and_death_count (Disables counting of deaths and murders) bool false +atl_server_statistics.register_on_craft (Disables item crafting counting) bool false +atl_server_statistics.register_on_placenode (Disables block placement counting) bool false +atl_server_statistics.register_on_dignode (Disables block breaking counting) bool false +atl_server_statistics.register_on_chat_message (Disables counting of sent messages) bool false +atl_server_statistics.simplified_command (Disables command abbreviations) bool false + +atl_server_statistics.time_before_end_reset_request (Farming Stage Length) float 30 \ No newline at end of file diff --git a/mods/cucina_vegana/coffee_def.lua b/mods/cucina_vegana/coffee_def.lua index 6bc6022d..dc91dd23 100644 --- a/mods/cucina_vegana/coffee_def.lua +++ b/mods/cucina_vegana/coffee_def.lua @@ -81,7 +81,7 @@ mt.register_node("cucina_vegana:" .. pname .. "_leaves", { mt.register_craftitem("cucina_vegana:" .. pname .. "_beans_raw", { description = S("Coffee Beans raw"), inventory_image = "cucina_vegana_" .. pname .. "_beans_raw.png", - groups = {food = 1, food_coffee = 1}, + groups = {food = 1, food_coffee = 1, eatable = 3}, on_use = mt.item_eat(3) }) diff --git a/mods/cucina_vegana/items.lua b/mods/cucina_vegana/items.lua index ec17b6ab..6a3a7378 100644 --- a/mods/cucina_vegana/items.lua +++ b/mods/cucina_vegana/items.lua @@ -12,7 +12,7 @@ local S = cucina_vegana.get_translator minetest.register_craftitem("cucina_vegana:blueberry_puree", { description = S("Blueberry puree"), inventory_image = "cucina_vegana_blueberry_puree.png", - groups = {food = 1, food_blueberry = 1, food_berry = 1}, + groups = {food = 1, food_blueberry = 1, food_berry = 1, eatable = 4}, on_use = minetest.item_eat(4) }) @@ -37,7 +37,7 @@ minetest.register_craftitem("cucina_vegana:ciabatta_dough", { minetest.register_craftitem("cucina_vegana:dandelion_honey", { description = S("Dandelion Honey"), inventory_image = "cucina_vegana_dandelion_honey.png", - groups = {flammable = 1, food = 1, food_honey = 1, food_sugar = 1, eatable = 1}, + groups = {flammable = 1, food = 1, food_honey = 1, food_sugar = 1, eatable = 3}, on_use = minetest.item_eat(3), }) @@ -82,7 +82,7 @@ if not(minetest.get_modpath("x_farming")) then minetest.register_craftitem("cucina_vegana:soy_milk", { description = S("Soy Milk"), inventory_image = "cucina_vegana_soy_milk.png", - groups = {flammable = 1, food = 1, food_milk = 1, eatable = 1, food_vegan = 1, food_soy_milk = 1}, + groups = {flammable = 1, food = 1, food_milk = 1, eatable = 2, food_vegan = 1, food_soy_milk = 1}, on_use = minetest.item_eat(2, "vessels:drinking_glass"), }) @@ -92,7 +92,7 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:sunflower_seeds_dough", { description = S("Sunflower Seeds Dough"), - groups = {food = 1, food_vegan = 1, eatable = 1, bread_dough = 1}, + groups = {food = 1, food_vegan = 1, eatable = 2, bread_dough = 1}, inventory_image = "cucina_vegana_sunflower_seeds_dough.png", on_use = minetest.item_eat(2), }) @@ -106,7 +106,7 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:tofu", { description = S("Tofu (raw)"), inventory_image = "cucina_vegana_tofu.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_tofu_raw = 1}, + groups = {flammable = 1, food = 1, eatable = 2, food_vegan = 1, food_tofu_raw = 1}, on_use = minetest.item_eat(2), }) @@ -118,28 +118,28 @@ end minetest.register_craftitem("cucina_vegana:imitation_butter", { description = S("Imitation Butter"), - groups = {food = 1, food_butter = 1, food_vegan = 1, eatable = 1}, + groups = {food = 1, food_butter = 1, food_vegan = 1, eatable = 2}, inventory_image = "cucina_vegana_imitation_butter.png", on_use = minetest.item_eat(2), }) minetest.register_craftitem("cucina_vegana:imitation_cheese", { description = S("Imitation Cheese"), - groups = {food = 1, food_cheese = 1, food_vegan = 1, eatable = 1}, + groups = {food = 1, food_cheese = 1, food_vegan = 1, eatable = 3}, inventory_image = "cucina_vegana_imitation_cheese.png", on_use = minetest.item_eat(3), }) minetest.register_craftitem("cucina_vegana:imitation_fish", { description = S("Imitation Fish"), - groups = {food = 1, food_fish = 1, food_vegan = 1, eatable = 1, food_fish_raw = 1, fish = 1}, + groups = {food = 1, food_fish = 1, food_vegan = 1, eatable = 3, food_fish_raw = 1, fish = 1}, inventory_image = "cucina_vegana_imitation_fish.png", on_use = minetest.item_eat(3), }) minetest.register_craftitem("cucina_vegana:imitation_meat", { description = S("Imitation Meat"), - groups = {food = 1, food_meat = 1, food_vegan = 1, eatable = 1, food_meat_raw = 1}, + groups = {food = 1, food_meat = 1, food_vegan = 1, eatable = 3, food_meat_raw = 1}, inventory_image = "cucina_vegana_imitation_meat.png", on_use = minetest.item_eat(3), }) @@ -157,7 +157,7 @@ minetest.register_craftitem("cucina_vegana:imitation_poultry", { minetest.register_craftitem("cucina_vegana:asparagus", { description = S("Asparagus"), inventory_image = "cucina_vegana_asparagus.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_asparagus = 1}, + groups = {flammable = 1, food = 1, eatable = 3, food_vegan = 1, food_asparagus = 1}, on_use = minetest.item_eat(3), }) @@ -166,7 +166,7 @@ if not(minetest.get_modpath("ethereal")) then minetest.register_craftitem("cucina_vegana:banana", { description = S("Banana"), inventory_image = "cucina_vegana_banana.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_banana = 1}, + groups = {flammable = 1, food = 1, eatable = 4, food_vegan = 1, food_banana = 1}, on_use = minetest.item_eat(4), }) @@ -191,7 +191,7 @@ if not(minetest.get_modpath("x_farming")) then minetest.register_craftitem("cucina_vegana:coffee_beans_roasted", { description = S("Coffee Beans"), inventory_image = "cucina_vegana_coffee_beans_roasted.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_coffee = 1}, + groups = {flammable = 1, food = 1, eatable = .5, food_vegan = 1, food_coffee = 1}, on_use = minetest.item_eat(.5), }) @@ -218,7 +218,7 @@ minetest.register_craftitem("cucina_vegana:flax_roasted", { minetest.register_craftitem("cucina_vegana:kohlrabi", { description = S("Kohlrabi"), inventory_image = "cucina_vegana_kohlrabi.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_kohlrabi = 1}, + groups = {flammable = 1, food = 1, eatable = 3, food_vegan = 1, food_kohlrabi = 1}, on_use = minetest.item_eat(3), }) @@ -227,7 +227,7 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:lettuce", { description = S("Lettuce"), inventory_image = "cucina_vegana_lettuce.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_lettuce = 1}, + groups = {flammable = 1, food = 1, eatable = 2, food_vegan = 1, food_lettuce = 1}, on_use = minetest.item_eat(2), }) @@ -245,7 +245,7 @@ if not(minetest.get_modpath("sandwiches")) then minetest.register_craftitem("cucina_vegana:peanut", { description = S("Peanut"), inventory_image = "cucina_vegana_peanut.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_peanut = 1}, + groups = {flammable = 1, food = 1, eatable = 4, food_vegan = 1, food_peanut = 1}, on_use = minetest.item_eat(4), }) @@ -296,7 +296,7 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:tomato", { description = S("Tomato"), inventory_image = "cucina_vegana_tomato.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_tomato = 1}, + groups = {flammable = 1, food = 1, eatable = 4, food_vegan = 1, food_tomato = 1}, on_use = minetest.item_eat(4), }) @@ -307,14 +307,14 @@ if not(minetest.get_modpath("x_farming")) then minetest.register_craftitem("cucina_vegana:potato", { description = S("Potato"), inventory_image = "cucina_vegana_potato.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_potato = 1}, + groups = {flammable = 1, food = 1, eatable = 5, food_vegan = 1, food_potato = 1}, on_use = minetest.item_eat(5), }) minetest.register_craftitem("cucina_vegana:carrot", { description = S("Carrot"), inventory_image = "cucina_vegana_carrot.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_carrot = 1}, + groups = {flammable = 1, food = 1, eatable = 3, food_vegan = 1, food_carrot = 1}, on_use = minetest.item_eat(3), }) @@ -331,21 +331,21 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:chili", { description = S("Chili"), inventory_image = "cucina_vegana_chili.png", - groups = {flammable = 1, food = 1, food_vegan = 1, food_chili = 1}, + groups = {flammable = 1, food = 1, food_vegan = 1, food_chili = 1, eatable = 1}, on_use = minetest.item_eat(1), }) minetest.register_craftitem("cucina_vegana:onion", { description = S("Onion"), inventory_image = "cucina_vegana_onion.png", - groups = {flammable = 1, food = 1, food_vegan = 1, food_onion = 1}, + groups = {flammable = 1, food = 1, food_vegan = 1, food_onion = 1, eatable = 3}, on_use = minetest.item_eat(3), }) minetest.register_craftitem("cucina_vegana:cucumber", { description = S("Cucumber"), inventory_image = "cucina_vegana_cucumber.png", - groups = {flammable = 1, food = 1, food_vegan = 1, food_onion = 1}, + groups = {flammable = 1, food = 1, food_vegan = 1, food_onion = 1, eatable = 3}, on_use = minetest.item_eat(3), }) @@ -356,14 +356,14 @@ if not(minetest.get_modpath("x_farming")) then minetest.register_craftitem("cucina_vegana:strawberry", { description = S("Strawberry"), inventory_image = "cucina_vegana_strawberry.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_strawberry = 1}, + groups = {flammable = 1, food = 1, eatable = 2, food_vegan = 1, food_strawberry = 1}, on_use = minetest.item_eat(2), }) minetest.register_craftitem("cucina_vegana:corn", { description = S("Corncob"), inventory_image = "cucina_vegana_corn.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_corn = 1}, + groups = {flammable = 1, food = 1, eatable = 2, food_vegan = 1, food_corn = 1}, on_use = minetest.item_eat(2), }) @@ -375,7 +375,7 @@ end minetest.register_craftitem("cucina_vegana:kohlrabi_roasted", { description = S("Roasted Kohlrabi"), - groups = {food = 1, eatable = 1}, + groups = {food = 1, eatable = 4}, inventory_image = "cucina_vegana_kohlrabi_roasted.png", on_use = minetest.item_eat(4), }) @@ -384,14 +384,14 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:sunflower_seeds_roasted", { description = S("Roasted Sunflower Seeds"), - groups = {food = 1, eatable = 1}, + groups = {food = 1, eatable = 2}, inventory_image = "cucina_vegana_sunflower_seeds_roasted.png", on_use = minetest.item_eat(2), }) minetest.register_craftitem("cucina_vegana:sunflower_seeds_bread", { description = S("Sunflower Seeds Bread"), - groups = {food = 1, food_bread = 1, eatable = 1}, + groups = {food = 1, food_bread = 1, eatable = 4}, inventory_image = "cucina_vegana_sunflower_seeds_bread.png", on_use = minetest.item_eat(4), }) @@ -399,7 +399,7 @@ if not(minetest.get_modpath("farming")) then minetest.register_craftitem("cucina_vegana:tofu_cooked", { description = S("Tofu"), inventory_image = "cucina_vegana_tofu_cooked.png", - groups = {flammable = 1, food = 1, eatable = 1, food_vegan = 1, food_tofu = 1, food_meat = 1}, + groups = {flammable = 1, food = 1, eatable = 3, food_vegan = 1, food_tofu = 1, food_meat = 1}, on_use = minetest.item_eat(3), }) @@ -409,7 +409,7 @@ if not(minetest.get_modpath("x_farming")) then minetest.register_craftitem("cucina_vegana:vegan_sushi", { description = S("Vegan Sushi"), - groups = {food = 1, food_vegan = 1, eatable = 1}, + groups = {food = 1, food_vegan = 1, eatable = 4}, inventory_image = "cucina_vegana_vegan_sushi.png", on_use = minetest.item_eat(4), }) @@ -418,7 +418,7 @@ end minetest.register_craftitem("cucina_vegana:vegan_strawberry_milk", { description = S("Vegan Strawberry Milk"), - groups = {food = 1, food_vegan = 1, eatable = 1}, + groups = {food = 1, food_vegan = 1, eatable = 3}, inventory_image = "cucina_vegana_vegan_strawberry_milk.png", on_use = minetest.item_eat(3, "vessels:drinking_glass"), }) diff --git a/mods/cucina_vegana/nodes.lua b/mods/cucina_vegana/nodes.lua index 3e724b0a..9f08a3cb 100644 --- a/mods/cucina_vegana/nodes.lua +++ b/mods/cucina_vegana/nodes.lua @@ -41,7 +41,7 @@ minetest.register_node("cucina_vegana:flax_seed_oil", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 2}, sounds = default.node_sound_glass_defaults(), }) @@ -72,7 +72,7 @@ minetest.register_node("cucina_vegana:peanut_oil", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -109,7 +109,7 @@ minetest.register_node("cucina_vegana:sunflower_seeds_oil", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 2}, sounds = default.node_sound_glass_defaults(), }) @@ -127,7 +127,7 @@ minetest.register_node("cucina_vegana:corn_oil", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_oil = 1, food_vegan = 1, eatable = 2}, sounds = default.node_sound_glass_defaults(), }) @@ -151,7 +151,7 @@ minetest.register_node("cucina_vegana:blueberry_jam", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, food_sweet = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, food_sweet = 1, eatable = 8}, }) minetest.register_node("cucina_vegana:coffee_cup", { @@ -168,7 +168,7 @@ minetest.register_node("cucina_vegana:coffee_cup", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 2}, }) minetest.register_node("cucina_vegana:coffee_cup_hot", { @@ -200,7 +200,7 @@ minetest.register_node("cucina_vegana:coffee_cup_hot", { return itemstack end, walkable = true, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 2}, }) minetest.register_node("cucina_vegana:cucumber_in_glass", { @@ -217,7 +217,7 @@ minetest.register_node("cucina_vegana:cucumber_in_glass", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 5}, }) minetest.register_node("cucina_vegana:ciabatta_bread", { @@ -234,7 +234,7 @@ minetest.register_node("cucina_vegana:ciabatta_bread", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_bread = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_bread = 1, food_vegan = 1, eatable = 4}, }) minetest.register_node("cucina_vegana:edamame", { @@ -268,7 +268,7 @@ minetest.register_node("cucina_vegana:edamame_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 4}, sounds = default.node_sound_glass_defaults(), }) @@ -286,7 +286,7 @@ minetest.register_node("cucina_vegana:lettuce_oil", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_oil = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_oil = 1, food_vegan = 1, eatable = 2}, sounds = default.node_sound_glass_defaults(), }) @@ -304,7 +304,7 @@ minetest.register_node("cucina_vegana:peanut_butter", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, food_sweet = 1, food_butter = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, food_sweet = 1, food_butter = 1, eatable = 10}, }) minetest.register_node("cucina_vegana:salad_bowl", { @@ -321,7 +321,7 @@ minetest.register_node("cucina_vegana:salad_bowl", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 4}, sounds = default.node_sound_glass_defaults(), }) @@ -339,7 +339,7 @@ minetest.register_node("cucina_vegana:sauce_hollandaise", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_sauce = 1, food_vegan = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food = 1, food_sauce = 1, food_vegan = 1, eatable = 3}, sounds = default.node_sound_glass_defaults(), }) @@ -357,7 +357,7 @@ minetest.register_node("cucina_vegana:sea_salad", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -378,7 +378,7 @@ if not(minetest.get_modpath("x_farming")) then type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 3}, sounds = default.node_sound_glass_defaults(), }) @@ -507,7 +507,7 @@ minetest.register_node("cucina_vegana:fryer", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 8}, }) minetest.register_node("cucina_vegana:kohlrabi_soup", { @@ -541,7 +541,7 @@ minetest.register_node("cucina_vegana:salad_hollandaise", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -576,7 +576,7 @@ minetest.register_node("cucina_vegana:tofu_chives_rosemary", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -598,7 +598,7 @@ minetest.register_node("cucina_vegana:asparagus_hollandaise_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -616,7 +616,7 @@ minetest.register_node("cucina_vegana:asparagus_rice_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 6}, sounds = default.node_sound_glass_defaults(), }) @@ -634,7 +634,7 @@ minetest.register_node("cucina_vegana:asparagus_soup_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -654,7 +654,7 @@ minetest.register_node("cucina_vegana:bowl_rice_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {vessel = 1, dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1, eatable = 4}, sounds = default.node_sound_glass_defaults(), }) @@ -674,7 +674,7 @@ minetest.register_node("cucina_vegana:fish_parsley_rosemary_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 6}, sounds = default.node_sound_glass_defaults(), }) @@ -692,7 +692,7 @@ minetest.register_node("cucina_vegana:kohlrabi_soup_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -726,7 +726,7 @@ minetest.register_node("cucina_vegana:pizza_vegana", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 6}, }) minetest.register_node("cucina_vegana:pizza_funghi_raw", { @@ -759,7 +759,7 @@ minetest.register_node("cucina_vegana:pizza_funghi", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, food_vegan = 1, eatable = 6}, }) minetest.register_node("cucina_vegana:soy_soup_cooked", { @@ -776,7 +776,7 @@ minetest.register_node("cucina_vegana:soy_soup_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 5}, sounds = default.node_sound_glass_defaults(), }) @@ -794,6 +794,6 @@ minetest.register_node("cucina_vegana:tofu_chives_rosemary_cooked", { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, - groups = {dig_immediate = 3, attached_node = 1, eatable = 1}, + groups = {dig_immediate = 3, attached_node = 1, eatable = 6}, sounds = default.node_sound_glass_defaults(), }) diff --git a/mods/death_coords/LICENSE b/mods/death_coords/LICENSE new file mode 100644 index 00000000..326e0933 --- /dev/null +++ b/mods/death_coords/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Niden + +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. diff --git a/mods/death_coords/README.md b/mods/death_coords/README.md new file mode 100644 index 00000000..98a5b9da --- /dev/null +++ b/mods/death_coords/README.md @@ -0,0 +1,18 @@ +# DCM +Show Death Coordinates + +Installation: +```Minetest/mods/death_coords``` + +Chat + +![screenshot](https://github.com/Niden1/DCM/blob/main/screenshot.png) + + +# Niden + +Discord: Niden#7063 + +Licence: MIT Licence + +https://github.com/Niden1 diff --git a/mods/death_coords/depends.txt b/mods/death_coords/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/death_coords/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/death_coords/init.lua b/mods/death_coords/init.lua new file mode 100644 index 00000000..6541fc55 --- /dev/null +++ b/mods/death_coords/init.lua @@ -0,0 +1,66 @@ +activate = true + +minetest.register_chatcommand( + "death", + { + description = "Enable or disable death coordinates", + params = " | ", + privs = {ban = true}, + func = function(name, param) + if param == "true" then + activate = true + minetest.chat_send_all(minetest.colorize("#00FF00", "*** [Server]: Death coordinates are enabled!")) + + music = + minetest.sound_play( + "notify", + { + loop = false, + gain = 1.0 + } + ) + end + + if param == "false" then + activate = false + + minetest.chat_send_all(minetest.colorize("#FF0000", "*** [Server]: Death coordinates are disabled!")) + + music = + minetest.sound_play( + "notify", + { + loop = false, + gain = 1.0 + } + ) + end + end + } +) + +minetest.register_on_dieplayer( + function(player) + if activate == true then + local pname = player:get_player_name() + local pos = player:getpos() + pos.x = math.floor(pos.x) + pos.y = math.floor(pos.y) + pos.z = math.floor(pos.z) + minetest.chat_send_player( + pname, + core.get_color_escape_sequence("#FF0000") .. + "*** [Server] - Last Dead At: " .. pos.x .. ", " .. pos.y .. ", " .. pos.z + ) + + music = + minetest.sound_play( + "die", + { + loop = false, + gain = 1.0 + } + ) + end + end +) diff --git a/mods/death_coords/mod.conf b/mods/death_coords/mod.conf new file mode 100644 index 00000000..c56a5b22 --- /dev/null +++ b/mods/death_coords/mod.conf @@ -0,0 +1,5 @@ +name = death_coords +author = Niden +description = Shows a message with the coordinates of the last death. +title = death_coords +release = 14333 diff --git a/mods/death_coords/screenshot.png b/mods/death_coords/screenshot.png new file mode 100644 index 00000000..28739dbd Binary files /dev/null and b/mods/death_coords/screenshot.png differ diff --git a/mods/death_coords/sounds/die.ogg b/mods/death_coords/sounds/die.ogg new file mode 100644 index 00000000..949e2849 Binary files /dev/null and b/mods/death_coords/sounds/die.ogg differ diff --git a/mods/death_coords/sounds/notify.ogg b/mods/death_coords/sounds/notify.ogg new file mode 100644 index 00000000..7d25cbe3 Binary files /dev/null and b/mods/death_coords/sounds/notify.ogg differ diff --git a/mods/glass_stained/depends.txt b/mods/glass_stained/depends.txt new file mode 100644 index 00000000..9cde0940 --- /dev/null +++ b/mods/glass_stained/depends.txt @@ -0,0 +1,3 @@ +default +xpanes +dye \ No newline at end of file diff --git a/mods/glass_stained/init.lua b/mods/glass_stained/init.lua new file mode 100644 index 00000000..a6ea2f6d --- /dev/null +++ b/mods/glass_stained/init.lua @@ -0,0 +1,362 @@ +local alias = { + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", + "twelve" +} + +local crafting = { + {"blue", "blue", "blue"}, + {"red", "blue", "white"}, + {"yellow", "blue", "blue"}, + {"yellow", "red", "red"}, + {"violet", "red", "blue"}, + {"violet", "blue", "blue"}, + {"red", "violet", "blue"}, + {"blue", "yellow", "dark_green"}, + {"blue", "red", "yellow"}, + {"dark_green", "cyan", "yellow"}, + {"blue", "dark_green", "dark_green"}, + {"yellow", "cyan", "cyan"}, + {"blue", "dark_green", "yellow"}, + {"dark_green", "blue", "white"}, + {"red", "red", "dark_green"}, + {"blue", "blue", "cyan"}, + {"red", "dark_green", "yellow"}, + {"violet", "yellow", "dark_green"}, +} + +local nodeboxes = { + single = {{-0.5, -0.5, 0, 0.5, 0.5, 0}}, + double = {{-0.5, -0.5, 0, 0.5, 1.5, 0}}, + triple = {{-0.5, -0.5, 0, 0.5, 1.5, 0}, {0.5, -0.5, 0, 1.5, 0.5, 0}}, + quadruple = {{-0.5, -0.5, 0, 1.5, 1.5, 0}}, + noncuple = {{-1.5, -1.5, 0, 1.5, 1.5, 0}}, + offset = {{-0.5, -0.5, 1, 0.5, 0.5, 1}} +} + +local thick_nodeboxes = { + single = {{-0.5, -0.5, -0.03125, 0.5, 0.5, 0.03125}}, + double = {{-0.5, -0.5, -0.03125, 0.5, 1.5, 0.03125}}, + triple = {{-0.5, -0.5, -0.03125, 0.5, 1.5, 0.03125}, {-0.5, -0.5, -0.03125, 1.5, 0.5, 0.03125}}, + quadruple = {{-0.5, -0.5, -0.03125, 1.5, 1.5, 0.03125}}, + noncuple = {{-1.5, -1.5, -0.03125, 1.5, 1.5, 0.03125}}, + offset = {{-0.5, -0.5, 0.96875, 0.5, 0.5, 1.03125}} +} + +local selection_boxes = { + single = {{-0.5, -0.5, -0.25, 0.5, 0.5, 0.25}}, + double = {{-0.5, -0.5, -0.25, 0.5, 1.5, 0.25}}, + triple = {{-0.5, -0.5, -0.25, 0.5, 1.5, 0.25}, {-0.5, -0.5, -0.25, 1.5, 0.5, 0.25}}, + quadruple = {{-0.5, -0.5, -0.25, 1.5, 1.5, 0.25}}, + noncuple = {{-1.5, -1.5, -0.25, 1.5, 1.5, 0.25}}, + offset = {{-0.5, -0.5, 0.75, 0.5, 0.5, 1.25}} +} + +local panes = { + { + "glass", + "Glass Pane", + "default_glass.png", + "glass_stained_edge.png", + default.node_sound_glass_defaults(), + { + {"xpanes:pane_flat", "xpanes:pane_flat"}, + {"xpanes:pane_flat", "xpanes:pane_flat"} + }, + "4" + }, + { + "obsidian_glass", + "Obsidian Glass Pane", + "default_obsidian_glass.png", + "xpanes_edge_obsidian.png", + default.node_sound_glass_defaults(), + { + {"xpanes:obsidian_pane_flat", "xpanes:obsidian_pane_flat"}, + {"xpanes:obsidian_pane_flat", "xpanes:obsidian_pane_flat"} + }, + "4" + }, + { + "bar", + "Steel Bars", + "xpanes_bar.png", + "xpanes_bar_top.png", + default.node_sound_metal_defaults(), + { + {"xpanes:bar_flat", "xpanes:bar_flat"}, + {"xpanes:bar_flat", "xpanes:bar_flat"} + }, + "4" + }, +} + +local function define_crafts(pane, main_craft, main_output) + single_pane = pane.."_single" + + minetest.register_craft({ + output = single_pane.." "..main_output, + recipe = main_craft, + }) + + minetest.register_craft({ + output = pane.."_double", + recipe = { + {single_pane}, + {single_pane} + }, + }) + + minetest.register_craft({ + output = single_pane.." 2", + recipe = { + {pane.."_double"} + }, + }) + + minetest.register_craft({ + output = pane.."_triple", + recipe = { + {single_pane, ""}, + {single_pane, single_pane} + }, + }) + + minetest.register_craft({ + output = single_pane.." 3", + recipe = { + {pane.."_triple"} + }, + }) + + minetest.register_craft({ + output = pane.."_quadruple", + recipe = { + {single_pane, single_pane}, + {single_pane, single_pane} + }, + }) + + minetest.register_craft({ + output = single_pane.." 4", + recipe = { + {pane.."_quadruple"} + }, + }) + + minetest.register_craft({ + output = pane.."_noncuple", + recipe = { + {single_pane, single_pane, single_pane}, + {single_pane, single_pane, single_pane}, + {single_pane, single_pane, single_pane} + }, + }) + + minetest.register_craft({ + output = single_pane.." 9", + recipe = { + {pane.."_noncuple"} + }, + }) + + minetest.register_craft({ + output = pane.."_offset", + recipe = { + {single_pane} + }, + }) + + minetest.register_craft({ + output = single_pane, + recipe = { + {pane.."_offset"} + }, + }) +end + +for name, selection_box in pairs(selection_boxes) do + for node = 1, 18 do + minetest.register_node("glass_stained:glass_"..node.."_"..name, { + description = "Stained Glass "..node.." ("..name:sub(1, 1):upper()..name:sub(2, -1)..")", + drawtype = "nodebox", + tiles = {"glass_stained_"..node..".png"}, + wield_image = "glass_stained_"..node..".png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + node_box = { + type = "fixed", + fixed = nodeboxes[name], + }, + selection_box = { + type = "fixed", + fixed = selection_box, + }, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + use_texture_alpha = true, + sounds = default.node_sound_glass_defaults() + }) + + if name == "noncuple" then + define_crafts("glass_stained:glass_"..node, { + {"dye:"..crafting[node][1], "xpanes:pane_flat"}, + {"dye:"..crafting[node][2], "xpanes:pane_flat"}, + {"dye:"..crafting[node][3], "xpanes:pane_flat"} + }, "3") + end + + if node <= 12 then + minetest.register_alias("glass_stained:glass_number_"..alias[node], "glass_stained:glass_"..node.."single") + minetest.register_alias("glass_stained:glass_number_"..alias[node].."top", "glass_stained:glass_"..node.."double") + end + end + + for _, pane in ipairs(panes) do + minetest.register_node("glass_stained:pane_"..pane[1].."_"..name, { + description = pane[2].." ("..name:sub(1, 1):upper()..name:sub(2, -1)..")", + drawtype = "nodebox", + tiles = {pane[4], pane[4], pane[3]}, + wield_image = pane[3], + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + node_box = { + type = "fixed", + fixed = thick_nodeboxes[name], + }, + selection_box = { + type = "fixed", + fixed = selection_box, + }, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = pane[5] + }) + + if name == "noncuple" then + define_crafts("glass_stained:pane_"..pane[1], pane[6], pane[7]) + end + end +end + +minetest.register_alias("glass_stained:glass_normal", "glass_stained:pane_glass_single") +minetest.register_alias("glass_stained:glass_normal_top", "glass_stained:pane_glass_double") +minetest.register_alias("glass_stained:obsidian_glass_normal", "glass_stained:pane_obsidian_glass_single") +minetest.register_alias("glass_stained:obsidian_glass_normal_top", "glass_stained:pane_obsidian_glass_double") +minetest.register_alias("glass_stained:steel_bars_normal", "glass_stained:pane_bar_single") +minetest.register_alias("glass_stained:steel_bars_normal_top", "glass_stained:pane_bar_double") +minetest.register_alias("glass_stained:steel_bars_fancy", "glass_stained:pane_bar_top_pane_single") + +xpanes.register_pane("bar_top", { + description = "Spiked Steel Railing", + textures = {"glass_stained_bar_fancy.png", "xpanes_pane_half.png", "default_glass_detail.png"}, + inventory_image = "glass_stained_bar_fancy.png", + wield_image = "glass_stained_bar_fancy.png", + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), + recipe = { + {"", "default:steel_ingot", ""}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } +}) + +xpanes.register_pane("pane", { + description = "Glass Pane", + textures = {"default_glass.png","xpanes_pane_half.png","glass_stained_edge.png"}, + inventory_image = "default_glass.png", + wield_image = "default_glass.png", + sounds = default.node_sound_glass_defaults(), + groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3}, + recipe = { + {"default:glass", "default:glass", "default:glass"}, + {"default:glass", "default:glass", "default:glass"} + } +}) + +xpanes.register_pane("obsidian_pane", { + description = "Obsidian Glass Pane", + textures = {"default_obsidian_glass.png","xpanes_pane_half.png","xpanes_edge_obsidian.png"}, + inventory_image = "default_obsidian_glass.png", + wield_image = "default_obsidian_glass.png", + sounds = default.node_sound_glass_defaults(), + groups = {snappy = 2, cracky = 3}, + recipe = { + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass", "default:obsidian_glass"} + } +}) + +minetest.register_node("glass_stained:pane_bar_top_pane_single", { + description = "Spiked Steel Railing Pane (Single)", + drawtype = "nodebox", + tiles = {"blank.png", "blank.png", "glass_stained_bar_fancy.png"}, + wield_image = "glass_stained_bar_fancy.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + node_box = { + type = "fixed", + fixed = thick_nodeboxes["single"], + }, + selection_box = { + type = "fixed", + fixed = selection_boxes["single"], + }, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("glass_stained:pane_bar_top_pane_offset", { + description = "Spiked Steel Railing Pane (Offset)", + drawtype = "nodebox", + tiles = {"blank.png", "blank.png", "glass_stained_bar_fancy.png"}, + wield_image = "glass_stained_bar_fancy.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + node_box = { + type = "fixed", + fixed = thick_nodeboxes["offset"], + }, + selection_box = { + type = "fixed", + fixed = selection_boxes["offset"], + }, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_craft({ + output = "glass_stained:pane_bar_top_pane_single", + recipe = { + {"xpanes:bar_top_flat"} + }, +}) + +minetest.register_craft({ + output = "glass_stained:pane_bar_top_pane_offset", + recipe = { + {"glass_stained:pane_bar_top_pane_single"} + }, +}) + +minetest.register_craft({ + output = "glass_stained:pane_bar_top_pane_single", + recipe = { + {"glass_stained:pane_bar_top_pane_offset"} + }, +}) \ No newline at end of file diff --git a/mods/glass_stained/licence.txt b/mods/glass_stained/licence.txt new file mode 100644 index 00000000..64a2fed6 --- /dev/null +++ b/mods/glass_stained/licence.txt @@ -0,0 +1,63 @@ +LICENSE FOR CODE: +================= + + +MIT License + +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. + + + + +LICENSE FOR MEDIA: +================== + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) + +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/ \ No newline at end of file diff --git a/mods/glass_stained/mod.conf b/mods/glass_stained/mod.conf new file mode 100644 index 00000000..3d894975 --- /dev/null +++ b/mods/glass_stained/mod.conf @@ -0,0 +1,7 @@ +name=glass_stained +description=A mod that adds fancy stained glass and spiked iron railing. +depends=default,xpanes,dye + +release = 6066 +author = v-rob +title = Fancy Stained Glass diff --git a/mods/glass_stained/screenshot.png b/mods/glass_stained/screenshot.png new file mode 100644 index 00000000..08e7b20a Binary files /dev/null and b/mods/glass_stained/screenshot.png differ diff --git a/mods/glass_stained/textures/glass_stained_1.png b/mods/glass_stained/textures/glass_stained_1.png new file mode 100644 index 00000000..4a64576c Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_1.png differ diff --git a/mods/glass_stained/textures/glass_stained_10.png b/mods/glass_stained/textures/glass_stained_10.png new file mode 100644 index 00000000..66aadeb6 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_10.png differ diff --git a/mods/glass_stained/textures/glass_stained_11.png b/mods/glass_stained/textures/glass_stained_11.png new file mode 100644 index 00000000..3c715e91 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_11.png differ diff --git a/mods/glass_stained/textures/glass_stained_12.png b/mods/glass_stained/textures/glass_stained_12.png new file mode 100644 index 00000000..6db0a40e Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_12.png differ diff --git a/mods/glass_stained/textures/glass_stained_13.png b/mods/glass_stained/textures/glass_stained_13.png new file mode 100644 index 00000000..2c81a6b8 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_13.png differ diff --git a/mods/glass_stained/textures/glass_stained_14.png b/mods/glass_stained/textures/glass_stained_14.png new file mode 100644 index 00000000..968069d0 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_14.png differ diff --git a/mods/glass_stained/textures/glass_stained_15.png b/mods/glass_stained/textures/glass_stained_15.png new file mode 100644 index 00000000..9d43070c Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_15.png differ diff --git a/mods/glass_stained/textures/glass_stained_16.png b/mods/glass_stained/textures/glass_stained_16.png new file mode 100644 index 00000000..81862f97 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_16.png differ diff --git a/mods/glass_stained/textures/glass_stained_17.png b/mods/glass_stained/textures/glass_stained_17.png new file mode 100644 index 00000000..23a02c8f Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_17.png differ diff --git a/mods/glass_stained/textures/glass_stained_18.png b/mods/glass_stained/textures/glass_stained_18.png new file mode 100644 index 00000000..f7600787 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_18.png differ diff --git a/mods/glass_stained/textures/glass_stained_2.png b/mods/glass_stained/textures/glass_stained_2.png new file mode 100644 index 00000000..c84c2dfe Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_2.png differ diff --git a/mods/glass_stained/textures/glass_stained_3.png b/mods/glass_stained/textures/glass_stained_3.png new file mode 100644 index 00000000..f8017a64 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_3.png differ diff --git a/mods/glass_stained/textures/glass_stained_4.png b/mods/glass_stained/textures/glass_stained_4.png new file mode 100644 index 00000000..3dd14f9a Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_4.png differ diff --git a/mods/glass_stained/textures/glass_stained_5.png b/mods/glass_stained/textures/glass_stained_5.png new file mode 100644 index 00000000..deaf5cae Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_5.png differ diff --git a/mods/glass_stained/textures/glass_stained_6.png b/mods/glass_stained/textures/glass_stained_6.png new file mode 100644 index 00000000..33b6710f Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_6.png differ diff --git a/mods/glass_stained/textures/glass_stained_7.png b/mods/glass_stained/textures/glass_stained_7.png new file mode 100644 index 00000000..6735f5d4 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_7.png differ diff --git a/mods/glass_stained/textures/glass_stained_8.png b/mods/glass_stained/textures/glass_stained_8.png new file mode 100644 index 00000000..7159bcfb Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_8.png differ diff --git a/mods/glass_stained/textures/glass_stained_9.png b/mods/glass_stained/textures/glass_stained_9.png new file mode 100644 index 00000000..a2879f95 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_9.png differ diff --git a/mods/glass_stained/textures/glass_stained_bar_fancy.png b/mods/glass_stained/textures/glass_stained_bar_fancy.png new file mode 100644 index 00000000..9f3c02fd Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_bar_fancy.png differ diff --git a/mods/glass_stained/textures/glass_stained_edge.png b/mods/glass_stained/textures/glass_stained_edge.png new file mode 100644 index 00000000..75aa84b6 Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_edge.png differ diff --git a/mods/glass_stained/textures/glass_stained_palette.png b/mods/glass_stained/textures/glass_stained_palette.png new file mode 100644 index 00000000..732c750a Binary files /dev/null and b/mods/glass_stained/textures/glass_stained_palette.png differ diff --git a/mods/glass_stained/textures/xpanes_edge_obsidian.png b/mods/glass_stained/textures/xpanes_edge_obsidian.png new file mode 100644 index 00000000..c91b8ade Binary files /dev/null and b/mods/glass_stained/textures/xpanes_edge_obsidian.png differ diff --git a/mods/protector/README.md b/mods/protector/README.md new file mode 100644 index 00000000..47806bb7 --- /dev/null +++ b/mods/protector/README.md @@ -0,0 +1,152 @@ +Protector Redo mod [protect] + +Protector redo for minetest is a mod that protects a players builds by placing +a block that stops other players from digging or placing blocks in that area. + +based on glomie's mod, remade by Zeg9 and rewritten by TenPlus1. + +https://forum.minetest.net/viewtopic.php?f=11&t=9376 + +Change log: + +- 0.1 - Initial release +- 0.2 - Texture update +- 0.3 - Added Protection Logo to blend in with player builds +- 0.4 - Code tweak for 0.4.10+ +- 0.5 - Added protector.radius variable in init.lua (default: 5) +- 0.6 - Added Protected Doors (wood and steel) and Protected Chest +- 0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy + contents across, also chests can be named +- 0.8 - Updated to work with Minetest 0.4.12, simplified textures +- 0.9 - Tweaked code +- 1.0 - Only owner can remove protector +- 1.1 - Set 'protector_pvp = true' in minetest.conf to disable pvp in protected + areas except your own, also setting protector_pvp_spawn higher than 0 will + disable pvp around spawn area with the radius you entered +- 1.2 - Shift and click support added with Minetest 0.4.13 to quickly copy stacks + to and from protected chest +- 1.3 - Moved protector on_place into node itself, protector zone display changed + from 10 to 5 seconds, general code tidy +- 1.4 - Changed protector recipes to give single item instead of 4, added + button + to interface, tweaked and tidied code, added admin command /delprot to remove + protectors in bulk from banned/old players +- 1.5 - Added much requested protected trapdoor +- 1.6 - Added protector_drop (true or false) and protector_hurt (hurt by this num) + variables to minetest.conf settings to stop players breaking protected + areas by dropping tools and hurting player. +- 1.7 - Included an edited version of WTFPL doors mod since protected doors didn't + work with the doors mod in the latest daily build... Now it's fine :) + added support for "protection_bypass" privelage. +- 1.8 - Added 'protector_flip' setting to stop players using lag to grief into + another players house, it flips them around to stop them digging. +- 1.9 - Renamed 'protector_pvp_spawn' setting to 'protector_spawn' which protects + an area around static spawnpoint and disables pvp if active. + (note: previous name can still be used) +- 2.0 - Added protector placement tool (thanks to Shara) so that players can easily + stand on a protector, face in a direction and it places a new one at a set + distance to cover protection radius. Added /protector_show command (thanks agaran) + Protectors and chest cannot be moved by mesecon pistons or machines. +- 2.1 - Added 'protector_night_pvp' setting so night-time becomes a free for all and + players can hurt one another even inside protected areas (not spawn protected) +- 2.2 - Updated protector tool so that player only needs to stand nearby (2 block radius) + It can also place vertically (up and down) as well. New protector recipe added. +- 2.3 - Localise many of the protector functions and tidy code. +- 2.4 - Update to newer functions, Minetest 0.4.16 needed to run now. +- 2.5 - Added HUD text to show when player is inside a protected area (updates every 5 seconds) +- 2.6 - Add protection against CSM tampering, updated Intllib support (thanks codexp), tweaked block textures +- 2.7 - Remove protection field entity when protector has been dug +- 2.8 - Added 'protector_show_interval' setting to minetest.conf [default is 5], make protection field glow in dark. +- 2.9 - Added MineClone2 recipes for protection block but no official support as yet +- 3.0 - Added PlayerFactions support, 'protector_hud_interval' setting and listing in advanced settings for mod values. +- 3.1 - Ability to hide protection blocks using /protector_hide and /protector_show , italian local added (thanks Hamlet) +- 3.2 - Defaults to Minetest translation if found, otherwise intllib fallback if loaded, locale files updated for both. Added 'protector_msg' setting for player text. +- 3.3 - Added support for playerfactions new api (thanks louisroyer), added limiter to protection radius of 22. +- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj), added 'protector_crafts' setting, changed wood doors n chests to immediate_dig for mineclone2 fix. Upped protector radius limit to 30. +- 3.5 - Store settings in global, reduce screenshot, tweak door sounds, use node template, add name check to commands, add commands to add and remove member names, tweak & tidy code. + +Lucky Blocks: 10 + + +Usage: (requires server privelage) + +list names to remove + + /protector_remove + +remove specific user names + + /protector_remove name1 name2 + +reset names on remove list + + /protector_remove - + +Whenever a player is near any protectors with name1 or name2 then it will be +replaced by an air block. + + +show owner name to replace + + /protector_replace + +replace owner with new name + + /protector_replace owner new_owner + +reset names on replace list + + /protector_replace - + +show protected areas of your nearby protectors (max of 5) + + /protector_show_area + +A players own protection blocks can be hidden and shown using the following: + + /protector_hide + /protector_show + +Adding members to local protection can be done by using + + /protector_add_member + +Removing members from local protection can be done by using + + /protector_del_member + + +The following lines can be added to your minetest.conf file to configure specific features of the mod: + +protector_radius = 5 +- Sets the area around each protection node so that other players cannot dig, place or enter through protected doors or chests. + +protector_pvp = true +- true or false this setting disabled pvp inside of protected areas for all players apart from those listed on the protector node. + +protector_night_pvp = false +- when true this setting enables pvp at night time only, even inside protected areas, requires protector_pvp to be active to work. + +protector_spawn = 10 +- Sets an area 10 nodes around static spawnpoint that is protected. + +protector_hurt = 2 +- When set to above 0, players digging in protected areas will be hurt by 2 health points (or whichever number it's set to) + +protector_flip = true +- When true players who dig inside a protected area will flipped around to stop them using lag to grief into someone else's build + +protector_show_interval +- Number of seconds the protection field is visible, defaults to 5 seconds. + +protector_recipe = true +- When true allows players to craft protection blocks + +protector_msg = true +- When true shows protection messages in players chat when trying to interact in someone else's area + + +Protector Tool + +Can be crafted with a protector surrounded by steel ingots and is used to place new protectors at a set distance of protector.radius in all directions including up and down simply by looking in a direction. + +Use by standing near an existing protector, looking in a direction and using as a tool, hold sneak/shift to place new protector containing member list from inside nearest one. diff --git a/mods/protector/admin.lua b/mods/protector/admin.lua new file mode 100644 index 00000000..cc548c1a --- /dev/null +++ b/mods/protector/admin.lua @@ -0,0 +1,249 @@ + +-- translation and default name vars + +local S = core.get_translator("protector") +local removal_names = "" +local replace_names = "" + +-- remove protection command + +core.register_chatcommand("protector_remove", { + params = S(""), + description = S("Remove Protectors around players (separate names with spaces)"), + privs = {server = true}, + + func = function(name, param) + + if param == "-" then + + core.chat_send_player(name, S("Name List Reset")) + + removal_names = "" ; return + end + + if param ~= "" then + removal_names = param + end + + core.chat_send_player(name, + S("Protector Names to remove: @1", removal_names)) + end +}) + +-- replace protection command + +core.register_chatcommand("protector_replace", { + params = S(" "), + description = S("Replace Protector Owner with name provided"), + privs = {server = true}, + + func = function(name, param) + + -- reset list to empty + if param == "-" then + + core.chat_send_player(name, S("Name List Reset")) + + replace_names = "" ; return + end + + -- check and set replacement name + if param ~= "" then + + local names = param:split(" ") ; if not names[2] then return end + + if names[2] ~= string.match(names[2], "[%w_-]+") then + core.chat_send_player(name, S("Invalid player name!")) ; return + end + + if names[2]:len() > 25 then + core.chat_send_player(name, S("Player name too long")) ; return + end + + replace_names = param + end + + -- show name info + if replace_names ~= "" then + + local names = replace_names:split(" ") + + core.chat_send_player(name, S("Replacing Protector name @1 with @2", + names[1] or "", names[2] or "")) + end + end +}) + +-- Abm to remove or replace protectors within active player area + +core.register_abm({ + nodenames = {"protector:protect", "protector:protect2", "protector:protect_hidden"}, + interval = 5, + chance = 1, + catch_up = false, + + action = function(pos, node) + + if removal_names == "" and replace_names == "" then return end + + local meta = core.get_meta(pos) ; if not meta then return end + local owner = meta:get_string("owner") + + if removal_names ~= "" then + + local names = removal_names:split(" ") + + for _, n in pairs(names) do + + if n == owner then + core.set_node(pos, {name = "air"}) ; return + end + end + end + + if replace_names ~= "" then + + local names = replace_names:split(" ") + + if names[1] and names[2] and owner == names[1] then + + meta:set_string("owner", names[2]) + meta:set_string("infotext", S("Protection (owned by @1)", names[2])) + end + end + end +}) + +-- show protection areas of nearby protectors owned by you (thanks agaran) + +local r = protector.radius + +core.register_chatcommand("protector_show_area", { + params = "", + description = S("Show protected areas of your nearby protectors"), + privs = {}, + + func = function(name, param) + + local player = core.get_player_by_name(name) + local pos = player:get_pos() + + -- find the protector nodes + local pos = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect", "protector:protect2", "protector:protect_hidden"}) + + local meta, owner + + -- show a maximum of 5 protected areas only + for n = 1, math.min(#pos, 5) do + + meta = core.get_meta(pos[n]) + owner = meta:get_string("owner") or "" + + if owner == name + or core.check_player_privs(name, {protection_bypass = true}) then + core.add_entity(pos[n], "protector:display") + end + end + end +}) + +-- ability to hide protection blocks (borrowed from doors mod :) + +core.register_node("protector:protect_hidden", { + description = "Hidden Protector", + drawtype = "airlike", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + -- has to be walkable for falling nodes to stop falling + walkable = true, + pointable = false, + diggable = false, + buildable_to = false, + floodable = false, + drop = "", + groups = {not_in_creative_inventory = 1, unbreakable = 1}, + is_ground_content = false, + on_blast = function() end, + -- 1px block to stop falling nodes replacing protector + collision_box = { + type = "fixed", fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32} + } +}) + +-- make own protectors visible in area + +core.register_chatcommand("protector_show", { + params = "", + description = S("Show your nearby protection blocks"), + privs = {interact = true}, + + func = function(name, param) + + local player = core.get_player_by_name(name) + + if not player then + return false, S("Player not found.") + end + + local pos = player:get_pos() + + local a = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect_hidden"}) + + local meta, owner + + for _, row in pairs(a) do + + meta = core.get_meta(row) + owner = meta:get_string("owner") or "" + + if owner == name + or core.check_player_privs(name, {protection_bypass = true}) then + core.swap_node(row, {name = "protector:protect"}) + end + end + end +}) + +-- make own protectors invisible in area + +core.register_chatcommand("protector_hide", { + params = "", + description = S("Hide your nearby protection blocks"), + privs = {interact = true}, + + func = function(name, param) + + local player = core.get_player_by_name(name) + + if not player then + return false, S("Player not found.") + end + + local pos = player:get_pos() + + local a = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect", "protector:protect2"}) + + local meta, owner + + for _, row in pairs(a) do + + meta = core.get_meta(row) + owner = meta:get_string("owner") or "" + + if owner == name + or core.check_player_privs(name, {protection_bypass = true}) then + core.swap_node(row, {name = "protector:protect_hidden"}) + end + end + end +}) diff --git a/mods/protector/chest.lua b/mods/protector/chest.lua new file mode 100644 index 00000000..df1181ae --- /dev/null +++ b/mods/protector/chest.lua @@ -0,0 +1,253 @@ + +-- translation + +local S = core.get_translator("protector") +local F = core.formspec_escape + +-- MineClone support + +local mcl = core.get_modpath("mcl_core") +local mcf = core.get_modpath("mcl_formspec") + +-- Are crafts enabled? + +local protector_crafts = core.settings:get_bool("protector_crafts") ~= false + +-- Protected Chest + +local chest_size = mcl and (9 * 3) or (8 * 4) + +core.register_node("protector:chest", { + description = S("Protected Chest"), + tiles = { + "default_chest_top.png", "default_chest_top.png", + "default_chest_side.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_front.png^protector_logo.png" + }, + paramtype2 = "facedir", + groups = {dig_immediate = 2, unbreakable = 1}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + + local meta = core.get_meta(pos) + local inv = meta:get_inventory() + + meta:set_string("infotext", S("Protected Chest")) + meta:set_string("name", S("Protected Chest")) + inv:set_size("main", chest_size) + end, + + can_dig = function(pos,player) + + local meta = core.get_meta(pos) + local inv = meta:get_inventory() + + if inv:is_empty("main") then + + if not core.is_protected(pos, player:get_player_name()) then + return true + end + end + end, + + on_metadata_inventory_put = function(pos, listname, index, stack, player) + + core.log("action", player:get_player_name() + .. " moves stuff to protected chest at " .. core.pos_to_string(pos)) + end, + + on_metadata_inventory_take = function(pos, listname, index, stack, player) + + core.log("action", player:get_player_name() + .. " takes stuff from protected chest at " .. core.pos_to_string(pos)) + end, + + on_metadata_inventory_move = function( + pos, from_list, from_index, to_list, to_index, count, player) + + core.log("action", player:get_player_name() + .. " moves stuff inside protected chest at " .. core.pos_to_string(pos)) + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + + if core.is_protected(pos, player:get_player_name()) then + return 0 + end + + return stack:get_count() + end, + + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + + if core.is_protected(pos, player:get_player_name()) then + return 0 + end + + return stack:get_count() + end, + + allow_metadata_inventory_move = function( + pos, from_list, from_index, to_list, to_index, count, player) + + if core.is_protected(pos, player:get_player_name()) then + return 0 + end + + return count + end, + + on_rightclick = function(pos, node, clicker) + + if core.is_protected(pos, clicker:get_player_name()) then return end + + local meta = core.get_meta(pos) ; if not meta then return end + + local spos = pos.x .. "," .. pos.y .. "," ..pos.z + local formspec + + -- mineclone support + if mcl and mcf then + + formspec = "size[9,8.75]" + .. "label[0,0;" .. core.formspec_escape( + core.colorize("#313131", "Protected Chest")) .. "]" + .. "list[nodemeta:" .. spos .. ";main;0,0.5;9,3;]" + .. mcl_formspec.get_itemslot_bg(0,0.5,9,3) + .. "image_button[3.0,3.5;1.05,0.8;protector_up_icon.png;protect_up;]" + .. "image_button[4.0,3.5;1.05,0.8;protector_down_icon.png;protect_down;]" + .. "label[0,4.0;" .. core.formspec_escape( + core.colorize("#313131", "Inventory")) .. "]" + .. "list[current_player;main;0,4.5;9,3;9]" + .. mcl_formspec.get_itemslot_bg(0,4.5,9,3) + .. "list[current_player;main;0,7.74;9,1;]" + .. mcl_formspec.get_itemslot_bg(0,7.74,9,1) + .. "listring[nodemeta:" .. spos .. ";main]" + .. "listring[current_player;main]" + + else -- default formspec + + formspec = "size[8,9]" + .. "list[nodemeta:".. spos .. ";main;0,0.3;8,4;]" + + .. "image_button[-0.01,4.26;1.05,0.8;protector_up_icon.png;protect_up;]" + .. "image_button[0.98,4.26;1.05,0.8;protector_down_icon.png;protect_down;]" + .. "tooltip[protect_up;" .. S("To Chest") .. "]" + .. "tooltip[protect_down;" .. S("To Inventory") .. "]" + + .. "field[2.3,4.8;4,0.25;protect_name;;" + .. meta:get_string("name") .. "]" + .. "button[5.99,4.5;2.05,0.25;protect_rename;" .. S("Rename") .. "]" + + .. "list[current_player;main;0,5;8,1;]" + .. "list[current_player;main;0,6.08;8,3;8]" + .. "listring[nodemeta:" .. spos .. ";main]" + .. "listring[current_player;main]" + end + + core.show_formspec(clicker:get_player_name(), + "protector:chest_" .. core.pos_to_string(pos), formspec) + end, + + on_blast = function() end +}) + +-- Container transfer helper + +local function to_from(src, dst) + + local stack, item, leftover + local size = dst:get_size("main") + + for i = 1, size do + + stack = src:get_stack("main", i) + item = stack:get_name() + + if item ~= "" and dst:room_for_item("main", item) then + + leftover = dst:add_item("main", stack) + + if leftover and not leftover:is_empty() then + src:set_stack("main", i, leftover) + else + src:set_stack("main", i, nil) + end + end + end +end + +-- Protected Chest formspec buttons + +core.register_on_player_receive_fields(function(player, formname, fields) + + if string.sub(formname, 0, 16) ~= "protector:chest_" then return end + + local pos_s = string.sub(formname, 17) + local pos = core.string_to_pos(pos_s) + + if core.is_protected(pos, player:get_player_name()) then return end + + local meta = core.get_meta(pos) ; if not meta then return end + local chest_inv = meta:get_inventory() ; if not chest_inv then return end + local player_inv = player:get_inventory() + + -- copy contents of player inventory to chest + if fields.protect_up then + + to_from(player_inv, chest_inv) + + -- copy contents of chest to player inventory + elseif fields.protect_down then + + to_from(chest_inv, player_inv) + + elseif fields.protect_name or fields.protect_rename then + + -- change chest infotext to display name + if fields.protect_name ~= "" then + + if fields.protect_name ~= string.match(fields.protect_name, "[%w%s_-]+") + or fields.protect_name:len() > 35 then + return + end + + meta:set_string("name", fields.protect_name) + meta:set_string("infotext", fields.protect_name) + else + meta:set_string("name", S("Protected Chest")) + meta:set_string("infotext", S("Protected Chest")) + end + + end +end) + +-- Protected Chest recipes + +if protector_crafts then + + if mcl then + + core.register_craft({ + output = "protector:chest", + recipe = { {"mcl_chests:chest", "mcl_core:gold_ingot"} } + }) + else + core.register_craft({ + output = "protector:chest", + recipe = { + {"group:wood", "group:wood", "group:wood"}, + {"group:wood", "default:copper_ingot", "group:wood"}, + {"group:wood", "group:wood", "group:wood"} + } + }) + + core.register_craft({ + output = "protector:chest", + recipe = { {"default:chest", "default:copper_ingot"} } + }) + end +end diff --git a/mods/protector/doors.lua b/mods/protector/doors.lua new file mode 100644 index 00000000..5c751784 --- /dev/null +++ b/mods/protector/doors.lua @@ -0,0 +1,521 @@ + +-- doors code from an old client re-used + +local S = core.get_translator("protector") + +-- MineClone support + +local mcl = core.get_modpath("mcl_core") + +-- Are crafts enabled? + +local protector_crafts = core.settings:get_bool("protector_crafts") ~= false + +-- Registers a door + +local function register_door(name, def) + + def.groups.not_in_creative_inventory = 1 + def.groups.handy = 1 + def.groups.prot_door = 1 + + local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5 + 1.5/16}} + + def.node_box_bottom = box + def.node_box_top = box + def.selection_box_bottom = box + def.selection_box_top = box + + core.register_craftitem(name, { + description = def.description, + inventory_image = def.inventory_image, + + on_place = function(itemstack, placer, pointed_thing) + + if pointed_thing.type ~= "node" then return itemstack end + + local ptu = pointed_thing.under + local nu = core.get_node(ptu) + + if core.registered_nodes[nu.name] + and core.registered_nodes[nu.name].on_rightclick then + return core.registered_nodes[nu.name].on_rightclick( + ptu, nu, placer, itemstack) + end + + local pt = pointed_thing.above + local pt2 = {x = pt.x, y = pt.y, z = pt.z} + + pt2.y = pt2.y + 1 + + if not core.registered_nodes[core.get_node(pt).name].buildable_to + or not core.registered_nodes[core.get_node(pt2).name].buildable_to + or not placer or not placer:is_player() then + return itemstack + end + + if core.is_protected(pt, placer:get_player_name()) + or core.is_protected(pt2, placer:get_player_name()) then + core.record_protection_violation(pt, placer:get_player_name()) + return itemstack + end + + local p2 = core.dir_to_facedir(placer:get_look_dir()) + local pt3 = {x = pt.x, y = pt.y, z = pt.z} + + if p2 == 0 then pt3.x = pt3.x - 1 + elseif p2 == 1 then pt3.z = pt3.z + 1 + elseif p2 == 2 then pt3.x = pt3.x + 1 + elseif p2 == 3 then pt3.z = pt3.z - 1 + end + + if core.get_item_group(core.get_node(pt3).name, "prot_door") == 0 then + core.set_node(pt, {name = name .. "_b_1", param2 = p2}) + core.set_node(pt2, {name = name .. "_t_1", param2 = p2}) + else + core.set_node(pt, {name = name .. "_b_2", param2 = p2}) + core.set_node(pt2, {name = name .. "_t_2", param2 = p2}) + + core.get_meta(pt):set_int("right", 1) + core.get_meta(pt2):set_int("right", 1) + end + + if not core.settings:get_bool("creative_mode") then + itemstack:take_item() + end + + core.sound_play(def.sounds.place, {pos = pt2}, true) + + return itemstack + end + }) + + local tt = def.tiles_top + local tb = def.tiles_bottom + + local function after_dig_node(pos, name, digger) + + local node = core.get_node(pos) + + if node.name == name then + core.node_dig(pos, node, digger) + end + end + + local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) + + pos.y = pos.y + dir + + if core.get_node(pos).name ~= check_name then return end + + local p2 = core.get_node(pos).param2 + + p2 = params[p2 + 1] + + core.swap_node(pos, {name = replace_dir, param2 = p2}) + + pos.y = pos.y - dir + + core.swap_node(pos, {name = replace, param2=p2}) + + core.sound_play(def.open_sound, + {pos = pos, gain = 0.3, max_hear_distance = 10}, true) + end + + local function on_rotate(pos, node, dir, user, check_name, mode, new_param2) + + if mode ~= screwdriver.ROTATE_FACE then return false end + + pos.y = pos.y + dir + + if core.get_node(pos).name ~= check_name then return false end + + if core.is_protected(pos, user:get_player_name()) then + core.record_protection_violation(pos, user:get_player_name()) + return false + end + + local node2 = core.get_node(pos) + + node2.param2 = (node2.param2 + 1) % 4 + + core.swap_node(pos, node2) + + pos.y = pos.y - dir + + node.param2 = (node.param2 + 1) % 4 + + core.swap_node(pos, node) + + return true + end + + core.register_node(name .. "_b_1", { + tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1] .. "^[transformfx"}, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + is_ground_content = false, + node_dig_prediction = "", + drop = name, + drawtype = "nodebox", + node_box = {type = "fixed", fixed = def.node_box_bottom}, + selection_box = {type = "fixed", fixed = def.selection_box_bottom}, + groups = def.groups, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y + 1 + after_dig_node(pos, name.."_t_1", digger) + end, + + on_rightclick = function(pos, node, clicker) + + if not core.is_protected(pos, clicker:get_player_name()) then + on_rightclick(pos, 1, name .. "_t_1", name .. "_b_2", + name .. "_t_2", {1,2,3,0}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, 1, user, name .. "_t_1", mode) + end, + + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = function() end + }) + + core.register_node(name .. "_t_1", { + tiles = {tt[2], tt[2], tt[2], tt[2], tt[1], tt[1] .. "^[transformfx"}, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + is_ground_content = false, + node_dig_prediction = "", + drop = "", + drawtype = "nodebox", + node_box = {type = "fixed", fixed = def.node_box_top}, + selection_box = {type = "fixed", fixed = def.selection_box_top}, + groups = def.groups, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y - 1 + after_dig_node(pos, name .. "_b_1", digger) + end, + + on_rightclick = function(pos, node, clicker) + if not core.is_protected(pos, clicker:get_player_name()) then + on_rightclick(pos, -1, name .. "_b_1", name .. "_t_2", + name .. "_b_2", {1,2,3,0}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, -1, user, name .. "_b_1", mode) + end, + + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = function() end + }) + + core.register_node(name .. "_b_2", { + tiles = {tb[2], tb[2], tb[2], tb[2], tb[1] .. "^[transformfx", tb[1]}, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + is_ground_content = false, + node_dig_prediction = "", + drop = name, + drawtype = "nodebox", + node_box = {type = "fixed", fixed = def.node_box_bottom}, + selection_box = {type = "fixed", fixed = def.selection_box_bottom}, + groups = def.groups, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y + 1 + after_dig_node(pos, name .. "_t_2", digger) + end, + + on_rightclick = function(pos, node, clicker) + if not core.is_protected(pos, clicker:get_player_name()) then + on_rightclick(pos, 1, name .. "_t_2", name .. "_b_1", + name .. "_t_1", {3,0,1,2}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, 1, user, name .. "_t_2", mode) + end, + + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = function() end + }) + + core.register_node(name .. "_t_2", { + tiles = {tt[2], tt[2], tt[2], tt[2], tt[1] .. "^[transformfx", tt[1]}, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + is_ground_content = false, + node_dig_prediction = "", + drop = "", + drawtype = "nodebox", + node_box = {type = "fixed", fixed = def.node_box_top}, + selection_box = {type = "fixed", fixed = def.selection_box_top}, + groups = def.groups, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + pos.y = pos.y - 1 + after_dig_node(pos, name .. "_b_2", digger) + end, + + on_rightclick = function(pos, node, clicker) + if not core.is_protected(pos, clicker:get_player_name()) then + on_rightclick(pos, -1, name .. "_b_2", name .. "_t_1", + name .. "_b_1", {3,0,1,2}) + end + end, + + on_rotate = function(pos, node, user, mode, new_param2) + return on_rotate(pos, node, -1, user, name .. "_b_2", mode) + end, + + sounds = def.sounds, + sunlight_propagates = def.sunlight, + on_blast = function() end + }) +end + +-- Protected Wooden Door + +local name = "protector:door_wood" + +register_door(name, { + description = S("Protected Wooden Door"), + inventory_image = "doors_wood.png^protector_logo.png", + groups = { + snappy = 1, choppy = 2, dig_immediate = 2, unbreakable = 1, axey = 1, handy = 1 + }, + tiles_bottom = {"doors_wood_b.png^protector_logo.png", "doors_brown.png"}, + tiles_top = {"doors_wood_a.png", "doors_brown.png"}, + sounds = default.node_sound_wood_defaults(), + open_sound = "default_dug_node", + sunlight = false +}) + +if protector_crafts then + + if mcl then + + core.register_craft({ + output = name, + recipe = { {"mcl_doors:wooden_door", "mcl_core:gold_ingot"} } + }) + else + core.register_craft({ + output = name, + recipe = { + {"group:wood", "group:wood"}, + {"group:wood", "default:copper_ingot"}, + {"group:wood", "group:wood"} + } + }) + + core.register_craft({ + output = name, + recipe = { {"doors:door_wood", "default:copper_ingot"} } + }) + end +end + +-- Protected Steel Door + +local name = "protector:door_steel" + +register_door(name, { + description = S("Protected Steel Door"), + inventory_image = "doors_steel.png^protector_logo.png", + groups = { + snappy = 1, cracky = 1, handy = 1, + level = (mcl and 0 or 2), pickaxey = 2, unbreakable = 1 + }, + tiles_bottom = {"doors_steel_b.png^protector_logo.png", "doors_grey.png"}, + tiles_top = {"doors_steel_a.png", "doors_grey.png"}, + sounds = default.node_sound_metal_defaults(), + open_sound = "default_place_node_metal", + sunlight = false, +}) + +if protector_crafts then + + if mcl then + + core.register_craft({ + output = name, + recipe = { {"mcl_doors:iron_door", "mcl_core:gold_ingot"} } + }) + else + core.register_craft({ + output = name, + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:copper_ingot"}, + {"default:steel_ingot", "default:steel_ingot"} + } + }) + + core.register_craft({ + output = name, + recipe = { {"doors:door_steel", "default:copper_ingot"} } + }) + end +end + +----trapdoor---- + +local function register_trapdoor(name, def) + + local name_closed = name + local name_opened = name .. "_open" + + def.on_rightclick = function (pos, node, clicker, itemstack, pointed_thing) + + if core.is_protected(pos, clicker:get_player_name()) then return end + + local newname = node.name == name_closed and name_opened or name_closed + + core.sound_play(def.open_sound, + {pos = pos, gain = 0.3, max_hear_distance = 10}, true) + + core.swap_node(pos, + {name = newname, param1 = node.param1, param2 = node.param2}) + end + + -- Common trapdoor configuration + def.drawtype = "nodebox" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.use_texture_alpha = "clip" + def.is_ground_content = false + def.node_dig_prediction = "" + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_closed.node_box = { + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.selection_box = { + type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.tiles = { def.tile_front, def.tile_front, def.tile_side, def.tile_side, + def.tile_side, def.tile_side } + + def_opened.node_box = { + type = "fixed", fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.selection_box = { + type = "fixed", fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.tiles = { def.tile_side, def.tile_side, + def.tile_side .. "^[transform3", + def.tile_side .. "^[transform1", + def.tile_front, def.tile_front } + + def_opened.drop = name_closed + def_opened.groups.not_in_creative_inventory = 1 + + core.register_node(name_opened, def_opened) + core.register_node(name_closed, def_closed) +end + +-- Protected Wooden Trapdoor + +register_trapdoor("protector:trapdoor", { + description = S("Protected Trapdoor"), + inventory_image = "doors_trapdoor.png^protector_logo.png", + wield_image = "doors_trapdoor.png^protector_logo.png", + tile_front = "doors_trapdoor.png^protector_logo.png", + tile_side = "doors_trapdoor_side.png", + groups = {snappy = 1, choppy = 2, dig_immediate = 2, unbreakable = 1, axey = 1}, + _mcl_hardness = 0.8, + _mcl_blast_resistance = 1, + sounds = default.node_sound_wood_defaults(), + open_sound = "default_dug_node" +}) + +if protector_crafts then + + if mcl then + + core.register_craft({ + output = "protector:trapdoor", + recipe = { {"mcl_doors:trapdoor", "mcl_core:gold_ingot"} } + }) + else + core.register_craft({ + output = "protector:trapdoor 2", + recipe = { + {"group:wood", "default:copper_ingot", "group:wood"}, + {"group:wood", "group:wood", "group:wood"} + } + }) + + core.register_craft({ + output = "protector:trapdoor", + recipe = { {"doors:trapdoor", "default:copper_ingot"} } + }) + end +end + +-- Protected Steel Trapdoor + +register_trapdoor("protector:trapdoor_steel", { + description = S("Protected Steel Trapdoor"), + inventory_image = "doors_trapdoor_steel.png^protector_logo.png", + wield_image = "doors_trapdoor_steel.png^protector_logo.png", + tile_front = "doors_trapdoor_steel.png^protector_logo.png", + tile_side = "doors_trapdoor_steel_side.png", + groups = { + snappy = 1, bendy = 2, cracky = 1, level = (mcl and 0 or 2), + unbreakable = 1, pickaxey = 2, handy = 1 + }, + _mcl_hardness = 1, + _mcl_blast_resistance = 1, + sounds = default.node_sound_metal_defaults(), + open_sound = "default_place_node_metal" +}) + +if protector_crafts then + + if mcl then + + core.register_craft({ + output = "protector:trapdoor_steel", + recipe = { {"mcl_doors:iron_trapdoor", "mcl_core:gold_ingot"} } + }) + else + core.register_craft({ + output = "protector:trapdoor_steel", + recipe = { + {"default:copper_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"} + } + }) + + core.register_craft({ + output = "protector:trapdoor_steel", + recipe = { {"doors:trapdoor_steel", "default:copper_ingot"} } + }) + end +end diff --git a/mods/protector/hud.lua b/mods/protector/hud.lua new file mode 100644 index 00000000..1c8da003 --- /dev/null +++ b/mods/protector/hud.lua @@ -0,0 +1,82 @@ + +-- translation and protector radius + +local S = core.get_translator("protector") +local radius = protector.radius + +-- hud settings + +local hud = {} +local hud_timer = 0 +local hud_interval = (tonumber(core.settings:get("protector_hud_interval")) or 4) +local hud_style = core.has_feature("hud_def_type_field") + +if hud_interval > 0 then + +core.register_globalstep(function(dtime) + + hud_timer = hud_timer + dtime + + if hud_timer < hud_interval then return end + + hud_timer = 0 + + for _, player in pairs(core.get_connected_players()) do + + local name = player:get_player_name() + local pos = vector.round(player:get_pos()) + local hud_text = "" + + local protectors = core.find_nodes_in_area( + {x = pos.x - radius , y = pos.y - radius , z = pos.z - radius}, + {x = pos.x + radius , y = pos.y + radius , z = pos.z + radius}, + {"protector:protect","protector:protect2", "protector:protect_hidden"}) + + if #protectors > 0 then + + local npos = protectors[1] + local meta = core.get_meta(npos) + local nodeowner = meta:get_string("owner") + local members = meta:get_string("members"):split(" ") + + hud_text = S("Owner: @1", nodeowner) + + if #members > 0 then + hud_text = hud_text .. " [" .. #members .. "]" + end + end + + if not hud[name] then + + hud[name] = {} + + local hud_tab = { + name = "Protector Area", + number = 0xFFFF22, + position = {x = 0, y = 0.95}, + offset = {x = 8, y = -8}, + text = hud_text, + scale = {x = 200, y = 60}, + alignment = {x = 1, y = -1}, + } + + if hud_style then + hud_tab["type"] = "text" + else + hud_tab["hud_elem_type"] = "text" + end + + hud[name].id = player:hud_add(hud_tab) + + return + else + player:hud_change(hud[name].id, "text", hud_text) + end + end +end) + +core.register_on_leaveplayer(function(player) + hud[player:get_player_name()] = nil +end) + +end -- END hud_interval > 0 diff --git a/mods/protector/init.lua b/mods/protector/init.lua new file mode 100644 index 00000000..a281bba2 --- /dev/null +++ b/mods/protector/init.lua @@ -0,0 +1,808 @@ + +-- default support (for use with MineClone2 and other [games] + +if not core.global_exists("default") then + + default = { + node_sound_stone_defaults = function(table) return {} end, + node_sound_wood_defaults = function(table) return {} end, + node_sound_metal_defaults = function(table) return {} end, + gui_bg = "", gui_bg_img = "", gui_slots = "" + } +end + +if core.get_modpath("mcl_sounds") then + default.node_sound_stone_defaults = mcl_sounds.node_sound_stone_defaults + default.node_sound_wood_defaults = mcl_sounds.node_sound_wood_defaults + default.node_sound_metal_defaults = mcl_sounds.node_sound_metal_defaults +end + +-- modpath, formspec helper and translator + +local MP = core.get_modpath(core.get_current_modname()) +local F = core.formspec_escape +local S = core.get_translator("protector") + +-- global table + +protector = { + mod = "redo", + max_shares = 12, + radius = tonumber(core.settings:get("protector_radius")) or 5 +} + +-- radius limiter (minetest cannot handle node volume of more than 4096000) + +if protector.radius > 30 then protector.radius = 30 end + +-- playerfactions check + +local factions_available = core.global_exists("factions") + +if factions_available then protector.max_shares = 8 end + +-- localize math + +local math_floor, math_pi = math.floor, math.pi + +-- settings + +local protector_flip = core.settings:get_bool("protector_flip") or false +local protector_hurt = tonumber(core.settings:get("protector_hurt")) or 0 +local protector_spawn = tonumber(core.settings:get("protector_spawn") + or core.settings:get("protector_pvp_spawn")) or 0 +local protector_show = tonumber(core.settings:get("protector_show_interval")) or 5 +local protector_recipe = core.settings:get_bool("protector_recipe") ~= false +local protector_msg = core.settings:get_bool("protector_msg") ~= false + +-- get static spawn position + +local statspawn = core.string_to_pos(core.settings:get("static_spawnpoint")) + or {x = 0, y = 2, z = 0} + +-- return list of members as a table + +local function get_member_list(meta) + + return meta:get_string("members"):split(" ") +end + +-- write member list table in protector meta as string + +local function set_member_list(meta, list) + + meta:set_string("members", table.concat(list, " ")) +end + +-- check for owner name + +local function is_owner(meta, name) + + return name == meta:get_string("owner") +end + +-- check for member name + +local function is_member(meta, name) + + if factions_available and meta:get_int("faction_members") == 1 then + + if factions.version == nil then + + -- backward compatibility + if factions.get_player_faction(name) ~= nil + and factions.get_player_faction(meta:get_string("owner")) == + factions.get_player_faction(name) then + return true + end + else + -- is member if player and owner share at least one faction + local player_factions = factions.get_player_factions(name) + local owner = meta:get_string("owner") + + if player_factions ~= nil and player_factions ~= false then + + for _, f in ipairs(player_factions) do + + if factions.player_is_in_faction(f, owner) then return true end + end + end + end + end + + for _, n in pairs(get_member_list(meta)) do + + if n == name then return true end + end + + return false +end + +-- add player name to table as member + +local function add_member(meta, name) + + -- Validate player name for MT compliance + if name ~= string.match(name, "[%w_-]+") then return end + + -- Constant (20) defined by player.h + if name:len() > 25 then return end + + -- does name already exist? + if is_owner(meta, name) or is_member(meta, name) then return end + + local list = get_member_list(meta) + + if #list >= protector.max_shares then return end + + table.insert(list, name) + + set_member_list(meta, list) +end + +-- remove player name from table + +local function del_member(meta, name) + + local list = get_member_list(meta) + + for i, n in pairs(list) do + + if n == name then + table.remove(list, i) ; break + end + end + + set_member_list(meta, list) +end + +-- protector interface + +local function protector_formspec(meta) + + local formspec = "size[8,7]" + .. default.gui_bg + .. default.gui_bg_img + .. "label[2.5,0;" .. F(S("-- Protector interface --")) .. "]" + .. "label[0,1;" .. F(S("PUNCH node to show protected area")) .. "]" + .. "label[0,2;" .. F(S("Members:")) .. "]" + .. "button_exit[2.5,6.2;3,0.5;close_me;" .. F(S("Close")) .. "]" + .. "field_close_on_enter[protector_add_member;false]" + + local members = get_member_list(meta) + local i = 0 + local checkbox_faction = false + + -- Display the checkbox only if the owner is member of at least 1 faction + if factions_available then + + if factions.version == nil then + + -- backward compatibility + if factions.get_player_faction(meta:get_string("owner")) then + checkbox_faction = true + end + else + local player_factions = factions.get_player_factions(meta:get_string("owner")) + + if player_factions ~= nil and type(player_factions) == "table" + and #player_factions >= 1 then + checkbox_faction = true + end + end + end + + if checkbox_faction then + + formspec = formspec .. "checkbox[0,5;faction_members;" + .. F(S("Allow faction access")) + .. ";" .. (meta:get_int("faction_members") == 1 and + "true" or "false") .. "]" + end + + for n = 1, #members do + + if i < protector.max_shares then + + -- show username + formspec = formspec .. "button[" .. (i % 4 * 2) + .. "," .. math_floor(i / 4 + 3) + .. ";1.5,.5;protector_member;" .. F(members[n]) .. "]" + + -- username remove button + .. "button[" .. (i % 4 * 2 + 1.25) .. "," + .. math_floor(i / 4 + 3) + .. ";.75,.5;protector_del_member_" .. F(members[n]) .. ";X]" + end + + i = i + 1 + end + + if i < protector.max_shares then + + -- user name entry field + formspec = formspec .. "field[" .. (i % 4 * 2 + 1 / 3) .. "," + .. (math_floor(i / 4 + 3) + 1 / 3) + .. ";1.433,.5;protector_add_member;;]" + + -- username add button + .."button[" .. (i % 4 * 2 + 1.25) .. "," + .. math_floor(i / 4 + 3) .. ";.75,.5;protector_submit;+]" + end + + return formspec +end + +-- check if pos is inside a protected spawn area + +local function inside_spawn(pos, radius) + + if protector_spawn <= 0 then return false end + + if pos.x < statspawn.x + radius and pos.x > statspawn.x - radius + and pos.y < statspawn.y + radius and pos.y > statspawn.y - radius + and pos.z < statspawn.z + radius and pos.z > statspawn.z - radius then + + return true + end +end + +-- show protection message if enabled + +local function show_msg(player_name, msg) + + -- if messages disabled or no player name provided + if protector_msg == false or not player_name or player_name == "" then return end + + core.chat_send_player(player_name, msg) +end + +-- Infolevel: +-- 0 for no info +-- 1 for "This area is owned by !" if you can't dig +-- 2 for "This area is owned by . +-- 3 for checking protector overlaps + +function protector.can_dig(r, pos, digger, onlyowner, infolevel) + + if not digger or not pos then return false end + + -- protector_bypass privileged users can override protection + if infolevel == 1 + and core.check_player_privs(digger, {protection_bypass = true}) then + return true + end + + -- infolevel 3 is only used to bypass priv check, change to 1 now + if infolevel == 3 then infolevel = 1 end + + -- is spawn area protected ? + if inside_spawn(pos, protector_spawn) then + + show_msg(digger, S("Spawn @1 has been protected up to a @2 block radius.", + core.pos_to_string(statspawn), protector_spawn)) + + return false + end + + -- find the protector nodes + local pos = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect", "protector:protect2", "protector:protect_hidden"}) + + local meta, owner, members + + for n = 1, #pos do + + meta = core.get_meta(pos[n]) + owner = meta:get_string("owner") or "" + members = meta:get_string("members") or "" + + -- node change and digger isn't owner + if infolevel == 1 and owner ~= digger then + + -- and you aren't on the member list + if onlyowner or not is_member(meta, digger) then + + show_msg(digger, S("This area is owned by @1", owner) .. "!") + + return false + end + end + + -- when using protector as tool, show protector information + if infolevel == 2 then + + core.chat_send_player(digger, + S("This area is owned by @1", owner) .. ".") + + core.chat_send_player(digger, + S("Protection located at: @1", core.pos_to_string(pos[n]))) + + if members ~= "" then + core.chat_send_player(digger, S("Members: @1.", members)) + end + + return false + end + + end + + -- show when you can build on unprotected area + if infolevel == 2 then + + if #pos < 1 then + core.chat_send_player(digger, S("This area is not protected.")) + end + + core.chat_send_player(digger, S("You can build here.")) + end + + return true +end + +-- add protector hurt and flip to protection violation function + +core.register_on_protection_violation(function(pos, name) + + local player = core.get_player_by_name(name) + + if player and player:is_player() then + + -- hurt player if protection violated + if protector_hurt > 0 and player:get_hp() > 0 then + + -- This delay fixes item duplication bug (thanks luk3yx) + core.after(0.1, function(player) + player:set_hp(player:get_hp() - protector_hurt) + end, player) + end + + -- flip player when protection violated + if protector_flip then + + -- yaw + 180° + local yaw = player:get_look_horizontal() + math_pi + + if yaw > 2 * math_pi then + yaw = yaw - 2 * math_pi + end + + player:set_look_horizontal(yaw) + + -- invert pitch + player:set_look_vertical(-player:get_look_vertical()) + + -- if digging below player, move up to avoid falling through hole + local pla_pos = player:get_pos() + + if pos.y < pla_pos.y then + player:set_pos({x = pla_pos.x, y = pla_pos.y + 0.8, z = pla_pos.z}) + end + end + end +end) + +-- backup old is_protected function + +local old_is_protected = core.is_protected + +-- check for protected area, return true if protected and digger isn't on list + +function core.is_protected(pos, digger) + + digger = digger or "" -- nil check + + -- is area protected against digger? + if not protector.can_dig(protector.radius, pos, digger, false, 1) then + return true + end + + -- otherwise can dig or place + return old_is_protected(pos, digger) +end + +-- make sure protection block doesn't overlap another protector's area + +local function check_overlap(itemstack, placer, pointed_thing) + + if pointed_thing.type ~= "node" then return itemstack end + + local pos = pointed_thing.above + local name = placer:get_player_name() + + -- make sure protector doesn't overlap onto protected spawn area + if inside_spawn(pos, protector_spawn + protector.radius) then + + core.chat_send_player(name, + S("Spawn @1 has been protected up to a @2 block radius.", + core.pos_to_string(statspawn), protector_spawn)) + + return itemstack + end + + -- make sure protector doesn't overlap any other player's area + if not protector.can_dig(protector.radius * 2, pos, name, true, 3) then + + core.chat_send_player(name, + S("Overlaps into above players protected area")) + + return itemstack + end + + return core.item_place(itemstack, placer, pointed_thing) +end + +-- remove protector display entities + +local function del_display(pos) + + local objects = core.get_objects_inside_radius(pos, 0.5) + + for _, v in ipairs(objects) do + + if v and v:get_luaentity() and v:get_luaentity().name == "protector:display" then + v:remove() + end + end +end + +-- temporary position store + +local player_pos = {} + +-- stone texture + +local stone_tex = "default_stone.png" + +if core.get_modpath("nc_terrain") then + stone_tex = "nc_terrain_stone.png" +end + +-- protector default + +local def = { + + description = S("Protection Block") .. " (" .. S("USE for area check") .. ")", + tiles = { + stone_tex .. "^protector_overlay.png", + stone_tex .. "^protector_overlay.png", + stone_tex .. "^protector_overlay.png^protector_logo.png" + }, + drawtype = "nodebox", + node_box = {type = "fixed", fixed = {{-0.499 ,-0.499, -0.499, 0.499, 0.499, 0.499}}}, + sounds = default.node_sound_stone_defaults(), + groups = {dig_immediate = 2, unbreakable = 1}, + is_ground_content = false, + paramtype = "light", + light_source = 4, + walkable = true, + + on_place = check_overlap, + + after_place_node = function(pos, placer) + + local meta = core.get_meta(pos) + + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("members", "") + meta:set_string("infotext", + S("Protection (owned by @1)", meta:get_string("owner"))) + end, + + on_use = function(itemstack, user, pointed_thing) + + if pointed_thing.type ~= "node" then return end + + protector.can_dig(protector.radius, pointed_thing.under, + user:get_player_name(), false, 2) + end, + + on_rightclick = function(pos, node, clicker, itemstack) + + local meta = core.get_meta(pos) + local name = clicker:get_player_name() + + if meta and protector.can_dig(1, pos, name, true, 1) then + + player_pos[name] = pos + + core.show_formspec(name, "protector:node", protector_formspec(meta)) + end + end, + + on_punch = function(pos, node, puncher) + + if core.is_protected(pos, puncher:get_player_name()) then return end + + core.add_entity(pos, "protector:display") + end, + + can_dig = function(pos, player) + + return player and protector.can_dig(1, pos, player:get_player_name(), true, 1) + end, + + on_blast = function() end, + + after_destruct = del_display +} + +-- protection node + +core.register_node("protector:protect", table.copy(def)) + +-- default recipe and alternative for MineClone2 + +if protector_recipe then + + local item_gold = "default:gold_ingot" + local item_stone = "default:stone" + + if core.get_modpath("mcl_core") then + item_gold = "mcl_core:gold_ingot" + item_stone = "mcl_core:stone" + end + + core.register_craft({ + output = "protector:protect", + recipe = { + {item_stone, item_stone, item_stone}, + {item_stone, item_gold, item_stone}, + {item_stone, item_stone, item_stone} + } + }) +end + +-- protection logo + +def.description = S("Protection Logo") .. " (" .. S("USE for area check") .. ")" +def.tiles = {"protector_logo.png"} +def.wield_image = "protector_logo.png" +def.inventory_image = "protector_logo.png" +def.use_texture_alpha = "clip" +def.paramtype2 = "wallmounted" +def.legacy_wallmounted = true +def.sunlight_propagates = true +def.node_box = { + type = "wallmounted", + wall_top = {-0.375, 0.4375, -0.5, 0.375, 0.5, 0.5}, + wall_bottom = {-0.375, -0.5, -0.5, 0.375, -0.4375, 0.5}, + wall_side = {-0.5, -0.5, -0.375, -0.4375, 0.5, 0.375} +} +def.selection_box = {type = "wallmounted"} + +core.register_node("protector:protect2", table.copy(def)) + +-- recipes to switch between protectors + +core.register_craft({ + output = "protector:protect", recipe = {{"protector:protect2"}} +}) + +core.register_craft({ + output = "protector:protect2", recipe = {{"protector:protect"}} +}) + +-- check formspec buttons or when name entered + +core.register_on_player_receive_fields(function(player, formname, fields) + + if formname ~= "protector:node" then return end + + local name = player:get_player_name() + local pos = player_pos[name] + + if not name or not pos then return end + + local add_member_input = fields.protector_add_member + + -- reset formspec until close button pressed + if (fields.close_me or fields.quit) + and (not add_member_input or add_member_input == "") then + player_pos[name] = nil + return + end + + -- only owner can add names + if not protector.can_dig(1, pos, player:get_player_name(), true, 1) then + return + end + + -- are we adding member to a protection node ? (csm protection) + local nod = core.get_node(pos).name + + if nod ~= "protector:protect" and nod ~= "protector:protect2" then + player_pos[name] = nil + return + end + + local meta = core.get_meta(pos) ; if not meta then return end + + -- add faction members + if factions_available and fields.faction_members ~= nil then + meta:set_int("faction_members", fields.faction_members == "true" and 1 or 0) + end + + -- add member [+] + if add_member_input then + + for _, i in pairs(add_member_input:split(" ")) do + add_member(meta, i) + end + end + + -- remove member [x] + for field, value in pairs(fields) do + + if string.sub(field, 0, + string.len("protector_del_member_")) == "protector_del_member_" then + + del_member(meta, string.sub(field,string.len("protector_del_member_") + 1)) + end + end + + core.show_formspec(name, formname, protector_formspec(meta)) +end) + +-- display entity shown when protector node is punched + +core.register_entity("protector:display", { + + initial_properties = { + physical = false, + collisionbox = {0, 0, 0, 0, 0, 0}, + visual = "wielditem", + -- wielditem seems to be scaled to 1.5 times original node size + visual_size = {x = 0.67, y = 0.67}, + textures = {"protector:display_node"}, + glow = 10 + }, + + timer = 0, + + on_step = function(self, dtime) + + self.timer = self.timer + dtime + + -- remove after set number of seconds + if self.timer > protector_show then self.object:remove() end + end +}) + +-- Display-zone node, Do NOT place the display as a node, +-- it is made to be used as an entity (see above) + +local r = protector.radius + +core.register_node("protector:display_node", { + tiles = {"protector_display.png"}, + use_texture_alpha = "clip", + walkable = false, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-(r+.55), -(r+.55), -(r+.55), -(r+.45), (r+.55), (r+.55)}, -- sides + {-(r+.55), -(r+.55), (r+.45), (r+.55), (r+.55), (r+.55)}, + {(r+.45), -(r+.55), -(r+.55), (r+.55), (r+.55), (r+.55)}, + {-(r+.55), -(r+.55), -(r+.55), (r+.55), (r+.55), -(r+.45)}, + {-(r+.55), (r+.45), -(r+.55), (r+.55), (r+.55), (r+.55)}, -- top + {-(r+.55), -(r+.55), -(r+.55), (r+.55), -(r+.45), (r+.55)}, -- bottom + {-.55,-.55,-.55, .55,.55,.55} -- middle (surrounding protector) + } + }, + selection_box = {type = "regular"}, + paramtype = "light", + groups = {dig_immediate = 3, not_in_creative_inventory = 1}, + drop = "", + on_blast = function() end +}) + +-- load mod sections + +dofile(MP .. "/doors.lua") +dofile(MP .. "/chest.lua") +dofile(MP .. "/pvp.lua") +dofile(MP .. "/admin.lua") +dofile(MP .. "/tool.lua") +dofile(MP .. "/hud.lua") + +if core.get_modpath("lucky_block") then + dofile(MP .. "/lucky_block.lua") +end + +-- stop mesecon pistons from pushing protectors + +if core.get_modpath("mesecons_mvps") then + mesecon.register_mvps_stopper("protector:protect") + mesecon.register_mvps_stopper("protector:protect2") + mesecon.register_mvps_stopper("protector:protect_hidden") + mesecon.register_mvps_stopper("protector:chest") +end + +-- player command to add member names to local protection + +core.register_chatcommand("protector_add_member", { + params = "", + description = S("Add member names to local protection"), + privs = {interact = true}, + + func = function(name, param) + + if param == "" then return end + + local to_add = param:split(" ") + local player = core.get_player_by_name(name) + local pos = player:get_pos() + + -- find the protector nodes + local pos = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect", "protector:protect2", "protector:protect_hidden"}) + + local meta, owner + + for n = 1, #pos do + + meta = core.get_meta(pos[n]) + owner = meta:get_string("owner") or "" + + if owner == name + or core.check_player_privs(name, {protection_bypass = true}) then + + for m = 1, #to_add do + add_member(meta, to_add[m]) + end + + core.add_entity(pos[n], "protector:display") + end + end + end +}) + +-- player command to remove member names from local protection + +core.register_chatcommand("protector_del_member", { + params = "", + description = S("Remove member names from local protection"), + privs = {interact = true}, + + func = function(name, param) + + if param == "" then return end + + local to_del = param:split(" ") + local player = core.get_player_by_name(name) + local pos = player:get_pos() + + -- find the protector nodes + local pos = core.find_nodes_in_area( + {x = pos.x - r, y = pos.y - r, z = pos.z - r}, + {x = pos.x + r, y = pos.y + r, z = pos.z + r}, + {"protector:protect", "protector:protect2", "protector:protect_hidden"}) + + local meta, owner + + for n = 1, #pos do + + meta = core.get_meta(pos[n]) + owner = meta:get_string("owner") or "" + + if owner == name + or core.check_player_privs(name, {protection_bypass = true}) then + + for m = 1, #to_del do + del_member(meta, to_del[m]) + end + + core.add_entity(pos[n], "protector:display") + end + end + end +}) + + +print ("[MOD] Protector Redo loaded") diff --git a/mods/protector/license.txt b/mods/protector/license.txt new file mode 100644 index 00000000..c3380e06 --- /dev/null +++ b/mods/protector/license.txt @@ -0,0 +1,33 @@ +The MIT License (MIT) + +Copyright (c) 2025 TenPlus1 + +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. + + +Original doors mod code (WTFPL license) + +Textures by TenPlus1 (CC0) unless mentioned below + +Textures from original Minetest doors mod (CC-BY-SA 3.0) + doors_*.png +..default_chest*.png + +Textures by Sirrobzeroone (CC0) + protector_tool.png diff --git a/mods/protector/locale/protector.de.tr b/mods/protector/locale/protector.de.tr new file mode 100644 index 00000000..ccf59fe4 --- /dev/null +++ b/mods/protector/locale/protector.de.tr @@ -0,0 +1,57 @@ +# textdomain: protector +# author: Xanthin and CodeXP +# last update: 2020/Jul/12 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Entferne Störschützer von bestimmten Namen in der Nähe von Spielern (trenne Namen durch Leerzeichen) += +Replace Protector Owner with name provided=Ersetze Besitzer der Störschützer mit neuem Besitzer + = +Replacing Protector name '@1' with '@2'=Ersetze Besitzer der Störschützer von '@1' mit '@2' +Show protected areas of your nearby protectors=Zeige geschützte Bereiche der Störschützer in der Nähe +Protector Names to remove: @1=Störschutznamen zum Entfernen: @1 +Name List Reset=Namensliste zurückgesetzt +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door=Geschützte Holztür +Protected Steel Door=Geschützte Stahltür +Protected Trapdoor=Geschützte Falltür +Protected Steel Trapdoor=Geschützte Stahlfalltür +Protected Chest=Geschützte Truhe +To Chest=Zur Truhe +To Inventory=Zum Inventar +Protected Chest (@1)=Geschützte Truhe (@1) + +### init.lua ### +-- Protector interface --=-- Störschutz-Interface -- +PUNCH node to show protected area=SCHLAGE Node, um geschützten Bereich anzuzeigen oder +USE for area check=BENUTZE für Bereichsprüfung +Members:=Mitglieder: +Close=Schließen +Protection located at: @1=Störschutz befindet sich bei: @1 +Members: @1.=Mitglieder: @1. +Allow faction access= +This area is not protected.=Dieser Bereich ist nicht geschützt. +You can build here.=Du kannst hier bauen. +Overlaps into above players protected area=Überlappung im geschützen Bereich eines Spielers +Protection Block=Störschutzblock +Protection (owned by @1)=Störschutz (gehört @1) +Protection Logo=Störschutzlogo +[MOD] Protector Redo loaded=[MOD] Protector Redo geladen +Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ist geschützt mit einem Radius von @2 Blöcke. +This area is owned by @1=Dieser Bereich gehört @1 + +### hud.lua ### +Owner: @1=Besitzer: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Störschutz Platzier-Werkzeug (stehe neben Störschutz, schaue in die gewünschte Richtung und anwenden) +Protector already in place!=Störschutz is bereits platziert! +No protectors available to place!=Keine Störschützer mehr im Inventar! +"Protector placed at @1"=Störschutz befindet sich bei: @1 +Out of bounds!= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= \ No newline at end of file diff --git a/mods/protector/locale/protector.es.tr b/mods/protector/locale/protector.es.tr new file mode 100644 index 00000000..45891652 --- /dev/null +++ b/mods/protector/locale/protector.es.tr @@ -0,0 +1,57 @@ +# textdomain: protector +# author: universales +# last update: 2020-02-27 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Eliminar protectores alrededor de los jugadores (nombres separados con espacios) += +Replace Protector Owner with name provided=Reemplace el propietario del protector con el nombre proporcionado + = +Replacing Protector name '@1' with '@2'=Reemplazando el nombre del protector '@1' a '@2' +Show protected areas of your nearby protectors=Mostrar áreas protegidas de sus protectores cercanos +Protector Names to remove: @1=Nombres de protectores para eliminar: @1 +Name List Reset=Restablecer lista de nombres +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door=Puerta de madera protegida +Protected Steel Door=Puerta de hierro protegida +Protected Trapdoor=Trampilla Protegida +Protected Steel Trapdoor=Trampilla de hierro protegida +Protected Chest=Cofre protegido +To Chest=Al cofre +To Inventory=Al inventario +Protected Chest (@1)=Cofre protegido (@1) + +### init.lua ### +-- Protector interface --=-- Interfaz del protector -- +PUNCH node to show protected area=nodo de perforación para mostrar el área protegida +USE for area check=Usar para chequeo del área +Members:=Miembros: +Close=Cerrar +Protection located at: @1=Protección ubicada en: @1 +Members: @1.=Miembros: @1. +Allow faction access= +This area is not protected.=Esta área no está protegida. +You can build here.=Puedes construir aquí. +Overlaps into above players protected area=Se superpone en el área protegida de los jugadores anteriores +Protection Block=Bloque de protección +Protection (owned by @1)=Protegido (Propiedad de @1) +Protection Logo=Logotipo de la protección +[MOD] Protector Redo loaded=[MOD] Protector recargado +Spawn @1 has been protected up to a @2 block radius.=Spawn @1 ha sido protegido hasta un radio de bloque @2. +This area is owned by @1=Esta área es propiedad de @1 + +### hud.lua ### +Owner: @1=Propietario: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Herramienta de colocación del protector (pararse cerca del protector, dirección de la cara y uso) +Protector already in place!=¡El protector ya está en este lugar! +No protectors available to place!=¡No hay protectores disponibles para colocar! +Protector placed at @1=Protector colocado en @1 +Out of bounds!= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= \ No newline at end of file diff --git a/mods/protector/locale/protector.fr.tr b/mods/protector/locale/protector.fr.tr new file mode 100644 index 00000000..38361e57 --- /dev/null +++ b/mods/protector/locale/protector.fr.tr @@ -0,0 +1,57 @@ +# textdomain: protector +# author: CodeXP and TenPlus1 +# last update: 2020/Jul/12 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Retirer les protecteurs près des joueurs avec les noms fournis (noms séparés avec des espaces) += +Replace Protector Owner with name provided=Remplacer le propriétaire du protecteur par le nom fourni + = +Replacing Protector name '@1' with '@2'= +Show protected areas of your nearby protectors=Affichez les zones protégées de vos protecteurs à proximité +Protector Names to remove: @1=Noms de protecteurs à supprimer: @1 +Name List Reset=Liste de noms réinitialiser +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door=Porte en bois protégée +Protected Steel Door=Porte en acier protégée +Protected Trapdoor=Trappe protégé +Protected Steel Trapdoor=Trap en acier protégé +Protected Chest=Coffre protégé +To Chest=Vers le coffre +To Inventory=Vers l'inventaire +Protected Chest (@1)=Coffre protégé (@1) + +### init.lua ### +-- Protector interface --=-- Interface Protector -- +PUNCH node to show protected area=TAPÉ le bloc pour afficher la zone protégée +USE for area check=UTILISER pour vérifier la zone +Members:=Membres: +Close=Fermer +Protection located at: @1=Protection située à: @1 +Members: @1.=Membres: @1. +Allow faction access= +This area is not protected.=msgstr "Cette zone n'est pas protégée. +You can build here.=Vous pouvez construire ici. +Overlaps into above players protected area=Vous chevauché une zone protégé. +Protection Block=Bloc de protection +Protection (owned by @1)=Protection (détenue par @1) +Protection Logo=Logo de protection +[MOD] Protector Redo loaded=[MOD] Protector Redo chargé +Spawn @1 has been protected up to a @2 block radius.= +This area is owned by @1=Cette zone appartient à @1! + +### hud.lua ### +Owner: @1=Propriétaire: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Outil de placement du protecteur (se tenir près du protecteur, direction du visage et utilisation) +Protector already in place!=Protecteur déjà en place! +No protectors available to place!=Aucun protecteur disponible à placer! +Protector placed at @1=Protection située à: @1 +Out of bounds!= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= \ No newline at end of file diff --git a/mods/protector/locale/protector.it.tr b/mods/protector/locale/protector.it.tr new file mode 100644 index 00000000..4c202649 --- /dev/null +++ b/mods/protector/locale/protector.it.tr @@ -0,0 +1,57 @@ +# textdomain: protector +# author: Xanthin and CodeXP +# last update: 2018/Jul/10 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Elimina i protettori attorno ai giocatori (separa i nomi con gli spazi) += +Replace Protector Owner with name provided=Sostituisci il proprietario del protettore col nome fornito + = +Replacing Protector name '@1' with '@2'=Sostituzione del nome del protettore '@1' con '@2' +Show protected areas of your nearby protectors=Mostra le aree protette dei protettori vicino a te +Protector Names to remove: @1=Nomi dei protettori da eliminare: @1 +Name List Reset=Azzera l'elenco dei nomi +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door=Porta di legno protetta +Protected Steel Door=Porta d'acciaio protetta +Protected Trapdoor=Botola protetta +Protected Steel Trapdoor=Botola d'acciaio protetta +Protected Chest=Baule protetto +To Chest=Al baule +To Inventory=All'inventario +Protected Chest (@1)=Baule protetto (@1) + +### init.lua ### +-- Protector interface --=-- Interfaccia protettore -- +PUNCH node to show protected area=COLPISCI il nodo per mostrare l'area protetta +USE for area check=USA per controllare l'area +Members:=Membri: +Close=Chiudi +Protection located at: @1=Protezione collocata a: @1 +Members: @1.=Membri: @1. +Allow faction access= +This area is not protected.=Quest'area non è protetta. +You can build here.=Qui puoi costruire. +Overlaps into above players protected area=Si sovrappone ad un'area sovrastante protetta dai giocatori +Protection Block=Blocco di protezione +Protection (owned by @1)=Protezione (di proprietà di @1) +Protection Logo=Logo di protezione +[MOD] Protector Redo loaded=[MOD] Protector Redo caricato +Spawn @1 has been protected up to a @2 block radius.=Lo spawn @1 è stato protetto fino a un raggio di @2 blocchi. +This area is owned by @1=Quest'area è di proprietà di @1 + +### hud.lua ### +Owner: @1=Proprietario: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Strumento di posizionamento protettore (stai vicino al protettore, guarda la direzione e usa) +Protector already in place!=Protettore già presente! +No protectors available to place!=Nessun protettore disponibile da posizionare! +Protector placed at @1=Protettore posizionato a @1 +Out of bounds!= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= \ No newline at end of file diff --git a/mods/protector/locale/protector.ru.tr b/mods/protector/locale/protector.ru.tr new file mode 100644 index 00000000..2c6c9049 --- /dev/null +++ b/mods/protector/locale/protector.ru.tr @@ -0,0 +1,62 @@ +# textdomain: protector +# author: SkyBuilder1717 +# last update: 2025/Jan/27 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Удалить Защитников вокруг игроков (отделяйте имена с помощью пробела) +=<игроки> +Replace Protector Owner with name provided=Заменить Владельца Защитника с доставленным именем + =<владелец> <новый владелец> +Replacing Protector name '@1' with '@2'=Замена Имени Защитника '@1' с '@2' +Show protected areas of your nearby protectors=Показать защищённые зоны Защитниками с вами неподалёку +Protector Names to remove: @1=Имена Защитников чтобы удалить: @1 +Name List Reset=Сброс Список Имён +Invalid player name!=Неправильное имя игрока! +Player name too long=Имя игрока слишком длинное +Player not found.=Игрок не найден. + +### doors_chest.lua ### +Protected Wooden Door=Защищённая Деревянная Дверь +Protected Steel Door=Защищённая Стальная Дверь +Protected Trapdoor=Защищённый Люк +Protected Steel Trapdoor=Защищённый Стальной Люк +Protected Chest=Защищённый Сундук +To Chest=В Сундук +To Inventory=В Инвентарь +Protected Chest (@1)=Защищённый Сундук (@1) + +### init.lua ### +-- Protector interface --=-- Интерфейс Защитника -- +PUNCH node to show protected area=УДАРЬТЕ по блоку чтобы показать защищённую зону +USE for area check=ИСПОЛЬЗУЙТЕ для проверки зоны +Members:=Участники: +Close=Закрыть +Allow faction access=Разрешить частичный доступ +Protection located at: @1=Защитник расположен на: @1 +Members: @1.=Участники: @1. +This area is not protected.=Эта зона не защищена. +You can build here.=Вы можете здесь строить. +Overlaps into above players protected area=Перекрывает защищенную зону вышеперечисленных игроков +Protection Block=Блок Защиты +Protection (owned by @1)=Защита (владелец: @1) +Protection Logo=Логотип Защиты +[MOD] Protector Redo loaded=[MOD] Protector Redo загружен +Spawn @1 has been protected up to a @2 block radius.=Спавн @1 был защищён радиусом в блоках @2. +This area is owned by @1=Эта зона принадлежит @1. + +### pvp.lua ### +[Protector] on_punchplayer called with nil objects=on_punchplayer вызван на нулевом объекте +[Protector] pvp_protect not active, update your version of Luanti=[Protector] pvp_protect не активен, обновите версию Luanti +[Protector] pvp_protect is disabled=[Protector] pvp_protect выключен + +### hud.lua ### +Owner: @1=Владелец: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Инструмент Размещения Защитника (встаньте рядом с Защитником, повернитесь к нему и используйте предмет) +Protector already in place!=Защитник уже стоит на этом месте! +No protectors available to place!=Нет доступных Защитников чтобы поставить! +Out of bounds!=За пределами! +Protector placed at @1=Защитник размещён на @1 +Cannot place protector, already protected at @1=Нельзя поставить Защитник, другой Защитник уже на @1 +Cannot place protector, container at @1=Нельзя поставить Защитник, контейнер на @1 \ No newline at end of file diff --git a/mods/protector/locale/protector.tr.tr b/mods/protector/locale/protector.tr.tr new file mode 100644 index 00000000..97a0d84d --- /dev/null +++ b/mods/protector/locale/protector.tr.tr @@ -0,0 +1,57 @@ +# textdomain: protector +# author: CodeXP and TenPlus1 +# last update: 2020/Jul/12 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Ismi verilen oyuncuların yanındaki korumaları kaldır. (İsimleri boşlukla ayır) += +Replace Protector Owner with name provided=Koruyucu Sahibini belirtilen adla değiştirin + = +Replacing Protector name '@1' with '@2'='@1' Koruyucu adını '@2' ile değiştirin +Show protected areas of your nearby protectors=Yakındaki koruyucuların korunan alanlarını göster +Protector Names to remove: @1=Silinecek korumaların isimleri: @1 +Name List Reset=İsim listesini sıfırla +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door=Korumalı ahşap kapı +Protected Steel Door=Korumalı çelik kapı +Protected Trapdoor=Korumalı tuzak kapısı +Protected Steel Trapdoor=Korumalı çelik tuzak kapısı +Protected Chest=Korumalı sandık +To Chest=Sandığa +To Inventory=Envantere +Protected Chest (@1)=Korumalı sandık (@1) + +### init.lua ### +-- Protector interface --=-- Koruyucu arayüz -- +PUNCH node to show protected area=Korunan alanı göstermek için yumruk +USE for area check=Bölge kontrolü için kullan +Members:=Üyeler +Close=Kapat +Protection located at: @1=Korumanın bulunduğu yer @1 +Members: @1.=Üyeler @1. +Allow faction access= +This area is not protected.=Bu alan korumalı değildir. +You can build here.=Buraya inşaa edebilirsiniz. +Overlaps into above players protected area=Yukarıdaki oyuncuların koruma alanı ile çakışıyor +Protection Block=Koruma kutusu +Protection (owned by @1)=Koruma (@1 sahibidir) +Protection Logo=Koruma arması +[MOD] Protector Redo loaded=[MOD] Protector Redo yüklendi +Spawn @1 has been protected up to a @2 block radius.=Spawn @1, @2 blok yarıçapa kadar korunur. +This area is owned by @1=Burasının sahibi @1! + +### hud.lua ### +Owner: @1=Sahip: @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Koruyucu Yerleştirme Aleti (koruyucunun yanında durun, yüz yönü ve kullanım) +Protector already in place!=Koruyucu zaten yerinde! +No protectors available to place!=Yerleştirilecek koruyucu yok! +Protector placed at @1=Korumanın bulunduğu yer @1 +Out of bounds!= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= \ No newline at end of file diff --git a/mods/protector/locale/protector.uk.tr b/mods/protector/locale/protector.uk.tr new file mode 100644 index 00000000..fffab3a1 --- /dev/null +++ b/mods/protector/locale/protector.uk.tr @@ -0,0 +1,56 @@ +# textdomain: protector + +Protector Redo=Захист +Lets players craft special blocks to protect their builds or disable PVP in areas.=Дозволяє гравцям створювати спеціальні блоки для захисту їхніх споруд або вимкнення PVP на певних територіях. + +### admin.lua ### +Remove Protectors around players (separate names with spaces)=Видалити захист поряд із гравцями (перечислити імена, розділяючи пробілами) +=<список імен> +Replace Protector Owner with name provided=Замінити власника захисту новим власником + =<ім'я власника> <ім'я нового власника> +Replacing Protector name '@1' with '@2'=Заміняється власник захисту із '@1' на '@2' +Show protected areas of your nearby protectors=Показати найближчі захищені території +Protector Names to remove: @1=Імена, які будуть видалені: @1 +Name List Reset=Очистити список імен + +### doors_chest.lua ### +Protected Wooden Door=Захищені дерев'яні двері +Protected Steel Door=Захищені сталеві двері +Protected Trapdoor=Захищений дерев'яний люк +Protected Steel Trapdoor=Захищений сталевий люк +Protected Chest=Захищена скриня +To Chest=В скриню +To Inventory=В інвентар +Protected Chest (@1)=Захищена скриня (@1) + +### init.lua ### +-- Protector interface --=-- Налаштування захисту -- +PUNCH node to show protected area=ВДАРИТИ блок для підсвітки захищеної території +USE for area check=ЛКМ для перевірки захищеної території +Members:=Учасники: +Close=Закрити +Protection located at: @1=Захист знаходиться на координатах: @1 +Members: @1.=Учасники: @1. +This area is not protected.=Територія вільна. +You can build here.=Тут можна будувати. +Overlaps into above players protected area=Блок захисту не може бути встановлений тут, десь поруч є територія іншого гравця +Protection Block=Блок захисту території +Protection (owned by @1)=Захист території гравця @1 +Protection Logo=Захисний знак +[MOD] Protector Redo loaded=[МОД] Protector Redo завантажено +Spawn @1 has been protected up to a @2 block radius.=Спавн @1 захищений у радіусі @2 блока. +This area is owned by @1=Ця територія належить гравцю @1 + +### pvp.lua ### +[Protector] on_punchplayer called with nil objects=[Захист] on_punchplayer викликана із нульовими об'єктами +[Protector] pvp_protect not active, update your version of Minetest=[Захист] pvp_protect неактивний, оновіть версію Luanti +[Protector] pvp_protect is disabled=[Защита] pvp_protect вимкнений + +### hud.lua ### +Owner: @1=Територія належить @1 + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)=Інструмент встановлення захисту (встаньте поруч із захистом, поверніться в потрібному напрямку і використайте) +Protector already in place!=Захист уже встановлено! +No protectors available to place!=У вас немає блоків захисту території в інвентарю! +Protector placed at @1=Захист знаходиться на координатах @1 diff --git a/mods/protector/locale/template.txt b/mods/protector/locale/template.txt new file mode 100644 index 00000000..90ea1fcc --- /dev/null +++ b/mods/protector/locale/template.txt @@ -0,0 +1,59 @@ +# textdomain: protector +# author: ? +# last update: 2020/Jul/12 + +### admin.lua ### +Remove Protectors around players (separate names with spaces)= += +Replace Protector Owner with name provided= + = +Replacing Protector name '@1' with '@2'= +Show protected areas of your nearby protectors= +Protector Names to remove: @1= +Name List Reset= +Invalid player name!= +Player name too long= +Player not found.= + +### doors_chest.lua ### +Protected Wooden Door= +Protected Steel Door= +Protected Trapdoor= +Protected Steel Trapdoor= +Protected Chest= +To Chest= +To Inventory= +Protected Chest (@1)= + +### init.lua ### +-- Protector interface --= +PUNCH node to show protected area= +USE for area check= +Members:= +Close= +Protection located at: @1= +Members: @1.= +Allow faction access= +This area is not protected.= +You can build here.= +Overlaps into above players protected area= +Protection Block= +Protection (owned by @1)= +Protection Logo= +[MOD] Protector Redo loaded= +Spawn @1 has been protected up to a @2 block radius.= +This area is owned by @1= +Add member names to local protection +Remove member names from local protection + +### hud.lua ### +Owner: @1= + +### tool.lua ### +Protector Placer Tool (stand near protector, face direction and use)= +Protector already in place!= +Out of bounds!= +No protectors available to place!= +Protector placed at @1= +Cannot place protector, already protected at @1= +Cannot place protector, container at @1= diff --git a/mods/protector/lucky_block.lua b/mods/protector/lucky_block.lua new file mode 100644 index 00000000..7a69e816 --- /dev/null +++ b/mods/protector/lucky_block.lua @@ -0,0 +1,15 @@ + +-- add lucky blocks + +lucky_block:add_blocks({ + {"dro", {"protector:protect"}, 2}, + {"dro", {"protector:protect2"}, 2}, + {"dro", {"protector:door_wood"}, 2}, + {"dro", {"protector:door_steel"}, 2}, + {"exp", 5, true}, + {"dro", {"protector:trapdoor"}, 2}, + {"dro", {"protector:trapdoor_steel"}, 2}, + {"dro", {"protector:tool"}, 1}, + {"dro", {"protector:chest"}, 1}, + {"exp"} +}) diff --git a/mods/protector/mod.conf b/mods/protector/mod.conf new file mode 100644 index 00000000..9f877321 --- /dev/null +++ b/mods/protector/mod.conf @@ -0,0 +1,7 @@ +name = protector +description = Lets players craft special blocks to protect their builds or disable PVP in areas. +optional_depends = default, lucky_block, mesecons_mvps, playerfactions, mcl_core, mcl_formspec, mcl_sounds +min_minetest_version = 5.0 +release = 30961 +author = TenPlus1 +title = Protector Redo diff --git a/mods/protector/pvp.lua b/mods/protector/pvp.lua new file mode 100644 index 00000000..5d222506 --- /dev/null +++ b/mods/protector/pvp.lua @@ -0,0 +1,70 @@ + +-- get static spawn position + +local statspawn = core.string_to_pos(core.settings:get("static_spawnpoint")) + or {x = 0, y = 2, z = 0} + +-- is spawn protected + +local protector_spawn = tonumber(core.settings:get("protector_spawn") + or core.settings:get("protector_pvp_spawn")) or 0 + +-- is night-only pvp enabled + +local protector_night_pvp = core.settings:get_bool("protector_night_pvp") + +-- disables PVP in your own protected areas + +if core.settings:get_bool("enable_pvp") +and core.settings:get_bool("protector_pvp") then + + if core.register_on_punchplayer then + + core.register_on_punchplayer(function(player, hitter, + time_from_last_punch, tool_capabilities, dir, damage) + + if not player or not hitter then + print("[MOD] Protector - on_punchplayer called with nil objects") + return false + end + + if not hitter:is_player() then return false end + + -- no pvp at spawn area + local pos = player:get_pos() + + if pos.x < statspawn.x + protector_spawn + and pos.x > statspawn.x - protector_spawn + and pos.y < statspawn.y + protector_spawn + and pos.y > statspawn.y - protector_spawn + and pos.z < statspawn.z + protector_spawn + and pos.z > statspawn.z - protector_spawn then + return true + end + + -- do we enable pvp at night time only ? + if protector_night_pvp then + + -- get time of day + local tod = core.get_timeofday() or 0 + + if tod > 0.2 and tod < 0.8 then + -- + else + return false + end + end + + -- is player being punched inside a protected area ? + if core.is_protected(pos, hitter:get_player_name()) then + return true + end + + return false + end) + else + print("[MOD] Protector - pvp_protect not active, update your version of Minetest") + end +else + print("[MOD] Protector - pvp_protect is disabled") +end diff --git a/mods/protector/screenshot.jpg b/mods/protector/screenshot.jpg new file mode 100644 index 00000000..07cefc03 Binary files /dev/null and b/mods/protector/screenshot.jpg differ diff --git a/mods/protector/settingtypes.txt b/mods/protector/settingtypes.txt new file mode 100644 index 00000000..7cd6b559 --- /dev/null +++ b/mods/protector/settingtypes.txt @@ -0,0 +1,35 @@ +# Size of protected area around protection node limiting player interaction +protector_radius (Protector Radius [max 30]) int 5 + +# Flips player around when accessing protected area to stop lag griefing +protector_flip (Protector Flip) bool false + +# Hurts player by amount entered when accessing protected area, 0 to disable +protector_hurt (Protector Hurt) int 0 + +# Sets a protected area around spawn by node radius given +protector_spawn (Protector Spawn) int 0 + +# Enables PVP inside of protected areas +protector_pvp (Protector PVP) bool false + +# When true will allow PVP inside protected spawn area +protector_pvp_spawn (Protector PVP Spawn) int 0 + +# When true will allow PVP inside all protected areas at night time only +protector_night_pvp (Protector Night PVP) bool false + +# Interval in seconds that protection field is shown +protector_show_interval (Protector Show Interval) int 5 + +# Interval in seconds that HUD ownership text is updated, 0 to disable +protector_hud_interval (Protector HUD Interval) int 5 + +# Enables craft recipe for protection block +protector_recipe (Enable Protector recipe) bool true + +# Enables craft recipes for protected doors and chest +protector_crafts (Enable Protector door/chest recipes) bool true + +# Enables protection messages in player chat +protector_msg (Enable Protector Messages) bool true diff --git a/mods/protector/textures/default_chest_front.png b/mods/protector/textures/default_chest_front.png new file mode 100644 index 00000000..f4132794 Binary files /dev/null and b/mods/protector/textures/default_chest_front.png differ diff --git a/mods/protector/textures/default_chest_side.png b/mods/protector/textures/default_chest_side.png new file mode 100644 index 00000000..44a65a43 Binary files /dev/null and b/mods/protector/textures/default_chest_side.png differ diff --git a/mods/protector/textures/default_chest_top.png b/mods/protector/textures/default_chest_top.png new file mode 100644 index 00000000..1fbdbb94 Binary files /dev/null and b/mods/protector/textures/default_chest_top.png differ diff --git a/mods/protector/textures/doors_brown.png b/mods/protector/textures/doors_brown.png new file mode 100644 index 00000000..8c8e3d89 Binary files /dev/null and b/mods/protector/textures/doors_brown.png differ diff --git a/mods/protector/textures/doors_grey.png b/mods/protector/textures/doors_grey.png new file mode 100644 index 00000000..ad110c7d Binary files /dev/null and b/mods/protector/textures/doors_grey.png differ diff --git a/mods/protector/textures/doors_steel.png b/mods/protector/textures/doors_steel.png new file mode 100644 index 00000000..042a1bc0 Binary files /dev/null and b/mods/protector/textures/doors_steel.png differ diff --git a/mods/protector/textures/doors_steel_a.png b/mods/protector/textures/doors_steel_a.png new file mode 100644 index 00000000..84ff11d8 Binary files /dev/null and b/mods/protector/textures/doors_steel_a.png differ diff --git a/mods/protector/textures/doors_steel_b.png b/mods/protector/textures/doors_steel_b.png new file mode 100644 index 00000000..77ffbe3a Binary files /dev/null and b/mods/protector/textures/doors_steel_b.png differ diff --git a/mods/protector/textures/doors_trapdoor.png b/mods/protector/textures/doors_trapdoor.png new file mode 100644 index 00000000..e92c8b2e Binary files /dev/null and b/mods/protector/textures/doors_trapdoor.png differ diff --git a/mods/protector/textures/doors_trapdoor_side.png b/mods/protector/textures/doors_trapdoor_side.png new file mode 100644 index 00000000..c45d870d Binary files /dev/null and b/mods/protector/textures/doors_trapdoor_side.png differ diff --git a/mods/protector/textures/doors_trapdoor_steel.png b/mods/protector/textures/doors_trapdoor_steel.png new file mode 100644 index 00000000..4ba507d6 Binary files /dev/null and b/mods/protector/textures/doors_trapdoor_steel.png differ diff --git a/mods/protector/textures/doors_trapdoor_steel_side.png b/mods/protector/textures/doors_trapdoor_steel_side.png new file mode 100644 index 00000000..44c4344b Binary files /dev/null and b/mods/protector/textures/doors_trapdoor_steel_side.png differ diff --git a/mods/protector/textures/doors_wood.png b/mods/protector/textures/doors_wood.png new file mode 100644 index 00000000..d3a62ab1 Binary files /dev/null and b/mods/protector/textures/doors_wood.png differ diff --git a/mods/protector/textures/doors_wood_a.png b/mods/protector/textures/doors_wood_a.png new file mode 100644 index 00000000..86a747aa Binary files /dev/null and b/mods/protector/textures/doors_wood_a.png differ diff --git a/mods/protector/textures/doors_wood_b.png b/mods/protector/textures/doors_wood_b.png new file mode 100644 index 00000000..96650982 Binary files /dev/null and b/mods/protector/textures/doors_wood_b.png differ diff --git a/mods/protector/textures/johnsmith/protector_logo.png b/mods/protector/textures/johnsmith/protector_logo.png new file mode 100644 index 00000000..b9ac3d67 Binary files /dev/null and b/mods/protector/textures/johnsmith/protector_logo.png differ diff --git a/mods/protector/textures/license.txt b/mods/protector/textures/license.txt new file mode 100644 index 00000000..acf64235 --- /dev/null +++ b/mods/protector/textures/license.txt @@ -0,0 +1,34 @@ + +following Textures created by Fernando Zapata (CC BY-SA 3.0): + doors_wood.png + doors_wood_a.png + doors_wood_b.png + doors_brown.png + +following Textures created by BlockMen (WTFPL): + doors_trapdoor.png + +following textures created by celeron55 (CC BY-SA 3.0): + doors_trapdoor_side.png + +following textures created by PilzAdam (WTFPL): + doors_steel.png + doors_steel_a.png + doors_steel_b.png + doors_grey.png + doors_trapdoor_steel.png + doors_trapdoor_steel_side.png + +following textures by Cisoun (WTFPL): + default_chest_front.png + default_chest_side.png + default_chest_top.png + +following textures by TenPlus1 (CC BY-SA 3.0): + protector_logo.png + protector_display.png + protector_overlay.png + +following textures by Kilbith (CC BY-SA 3.0): + protector_up_icon.png + protector_down_icon.png (both rotated) diff --git a/mods/protector/textures/protector_display.png b/mods/protector/textures/protector_display.png new file mode 100644 index 00000000..6d7ec7d9 Binary files /dev/null and b/mods/protector/textures/protector_display.png differ diff --git a/mods/protector/textures/protector_down_icon.png b/mods/protector/textures/protector_down_icon.png new file mode 100644 index 00000000..f1161a2f Binary files /dev/null and b/mods/protector/textures/protector_down_icon.png differ diff --git a/mods/protector/textures/protector_logo.png b/mods/protector/textures/protector_logo.png new file mode 100644 index 00000000..c6f6f51b Binary files /dev/null and b/mods/protector/textures/protector_logo.png differ diff --git a/mods/protector/textures/protector_overlay.png b/mods/protector/textures/protector_overlay.png new file mode 100644 index 00000000..00261da0 Binary files /dev/null and b/mods/protector/textures/protector_overlay.png differ diff --git a/mods/protector/textures/protector_tool.png b/mods/protector/textures/protector_tool.png new file mode 100644 index 00000000..d2112d67 Binary files /dev/null and b/mods/protector/textures/protector_tool.png differ diff --git a/mods/protector/textures/protector_up_icon.png b/mods/protector/textures/protector_up_icon.png new file mode 100644 index 00000000..4c475929 Binary files /dev/null and b/mods/protector/textures/protector_up_icon.png differ diff --git a/mods/protector/tool.lua b/mods/protector/tool.lua new file mode 100644 index 00000000..113f143e --- /dev/null +++ b/mods/protector/tool.lua @@ -0,0 +1,164 @@ + +-- protector placement tool (thanks to Shara for code and idea) + +local S = core.get_translator("protector") + +-- get protection radius + +local r = protector.radius + +-- protector placement tool + +core.register_craftitem("protector:tool", { + description = S("Protector Placer Tool (stand near protector, face direction and use)"), + inventory_image = "protector_tool.png", + stack_max = 1, + + on_use = function(itemstack, user, pointed_thing) + + local name = user:get_player_name() + + -- check for protector near player (2 block radius) + local pos = user:get_pos() + local pp = core.find_nodes_in_area( + vector.subtract(pos, 2), vector.add(pos, 2), + {"protector:protect", "protector:protect2", "protector:protect_hidden"}) + + if #pp == 0 then return end -- none found + + pos = pp[1] -- take position of first protector found + + -- get members on protector + local meta = core.get_meta(pos) + local members = meta:get_string("members") or "" + + -- get direction player is facing + local dir = core.dir_to_facedir( user:get_look_dir() ) + local vec = {x = 0, y = 0, z = 0} + local gap = (r * 2) + 1 + local pit = user:get_look_vertical() + + -- set placement coords + if pit > 1.2 then vec.y = -gap -- up + elseif pit < -1.2 then vec.y = gap -- down + elseif dir == 0 then vec.z = gap -- north + elseif dir == 1 then vec.x = gap -- east + elseif dir == 2 then vec.z = -gap -- south + elseif dir == 3 then vec.x = -gap -- west + end + + -- new position + pos.x = pos.x + vec.x + pos.y = pos.y + vec.y + pos.z = pos.z + vec.z + + -- does placing a protector overlap existing area + if not protector.can_dig(r * 2, pos, user:get_player_name(), true, 3) then + + core.chat_send_player(name, + S("Overlaps into above players protected area")) + + return + end + + -- does a protector already exist ? + if #core.find_nodes_in_area(vector.subtract(pos, 1), vector.add(pos, 1), + {"protector:protect", "protector:protect2", + "protector:protect_hidden"}) > 0 then + + core.chat_send_player(name, S("Protector already in place!")) + + return + end + + -- do not place protector out of map bounds or replace bedrock + if #core.find_nodes_in_area(pos, pos, {"ignore", "mcl_core:bedrock"}) > 0 then + + core.chat_send_player(name, S("Out of bounds!")) + + return + end + + -- do we have protectors to use ? + local nod + local inv = user:get_inventory() + + if not inv:contains_item("main", "protector:protect") + and not inv:contains_item("main", "protector:protect2") then + + core.chat_send_player(name, + S("No protectors available to place!")) + + return + end + + -- take protector (block first then logo) + if inv:contains_item("main", "protector:protect") then + + inv:remove_item("main", "protector:protect") + + nod = "protector:protect" + + elseif inv:contains_item("main", "protector:protect2") then + + inv:remove_item("main", "protector:protect2") + + nod = "protector:protect2" + end + + -- do not replace containers with inventory space + local inv = core.get_inventory({type = "node", pos = pos}) + + if inv then + core.chat_send_player(name, + S("Cannot place protector, container at @1", + core.pos_to_string(pos))) + return + end + + -- protection check for other mods like Areas + if core.is_protected(pos, name) then + + core.chat_send_player(name, + S("Cannot place protector, already protected at @1", + core.pos_to_string(pos))) + return + end + + -- place protector + core.set_node(pos, {name = nod, param2 = 1}) + + -- set protector metadata + local meta = core.get_meta(pos) + + meta:set_string("owner", name) + meta:set_string("infotext", "Protection (owned by " .. name .. ")") + + -- copy members across if holding sneak when using tool + if user:get_player_control().sneak then + meta:set_string("members", members) + else + meta:set_string("members", "") + end + + core.chat_send_player(name, + S("Protector placed at @1", core.pos_to_string(pos))) + end +}) + +-- tool recipe + +local df = "default:steel_ingot" + +if core.get_modpath("mcl_core") then + df = "mcl_core:iron_ingot" +end + +core.register_craft({ + output = "protector:tool", + recipe = { + {df, df, df}, + {df, "protector:protect", df}, + {df, df, df} + } +}) diff --git a/mods/ropes/LICENSE.md b/mods/ropes/LICENSE.md new file mode 100644 index 00000000..368b3328 --- /dev/null +++ b/mods/ropes/LICENSE.md @@ -0,0 +1,19 @@ +## MIT License + +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. diff --git a/mods/ropes/README.md b/mods/ropes/README.md new file mode 100644 index 00000000..b9a0663a --- /dev/null +++ b/mods/ropes/README.md @@ -0,0 +1,17 @@ +# Ropes + +This mod adds "rope boxes", blocks that when placed in world will automatically lower a rope at 1 meter per second until it reaches a fixed maximum length. The basic rope box produces 50m of rope by default and there are up to eight additional rope box types that produce multiples of that rope length - 100m, 150m, and so forth up to 450m. The number of rope boxes and the length of a standard rope length can be configured via the settings menu. + +The rope stops lowering if it reaches an obstruction. Ropes can be cut using an axe or other choppy tool at any location and when they're cut the bottom half of the rope will disappear, dropping any climbers. The same happens to the entire rope if the rope box at the top of the rope is removed. Cutting the rope doesn't reduce the maximum length of rope the rope box will produce if it's removed and rebuilt again. Ropes are flammable. They respect protection settings - if the player that placed the rope box isn't permitted to build in an area then the rope descending from that box will treat it as an obstruction. + +Also included is a rope ladder that behaves similarly, though it only comes in one standard maximum length - 50m by default, again changeable in settings. + +This mod will also enhance default wood ladders and steel ladders to make them "extendable", capable of building upward independent of support to a setting-defined limit (defaulting to 5 nodes for wood and 15 nodes for steel ladders). This can be disabled if undesired. + +This mod retains optional backward compatibility with the crafting items from the vines mod (anything with group "vines" can be used to make rope boxes and rope ladders). Ropes can also be made from cotton, available via an optional dependency on the farming mod. + +In-game documentation is provided via an optional dependency on the doc mod. + +## Interaction with other mods + +By default ropes and rope ladders only extend downward into "air" nodes. Other mods can modify this behaviour to add other nodes as valid targets for ropes to extend into using either of two mechanisms: either add `ropes_can_extend_into = 1` to the node definition's groups list or add a dependency on the ropes mod to your mod and then set `ropes.can_extend_into_nodes[target_node_name] = true`. There is also a configuration setting, `ropes_can_extend_into_airlike`, that will allow ropes to extend into any node with `drawtype = "airlike"` in its definition. Note that in cases where ropes extend into non-air nodes the rope will still be replaced with an "air" node when it's eventually destroyed. \ No newline at end of file diff --git a/mods/ropes/bridge.lua b/mods/ropes/bridge.lua new file mode 100644 index 00000000..78489aa5 --- /dev/null +++ b/mods/ropes/bridge.lua @@ -0,0 +1,88 @@ +local S = ropes.S + +if ropes.bridges_enabled then + +local bridge_on_place = function(itemstack, placer, pointed_thing) + -- Shall place item and return the leftover itemstack. + -- The placer may be any ObjectRef or nil. + -- default: minetest.item_place + if placer == nil then + return minetest.item_place(itemstack, placer, pointed_thing) + end + + local above = pointed_thing.above + local under = pointed_thing.under + + if above.x == under.x and above.z == under.z and above.y > under.y then + -- we're aimed downward at a buildable node from above. + -- determine the direction the placer lies relative to this node. + local new_under = vector.new(under) + local placer_pos = placer:get_pos() + local diff_x = placer_pos.x - under.x + local diff_z = placer_pos.z - under.z + if math.abs(diff_x) > math.abs(diff_z) then + -- placer is displaced along the X axis relative to the target + if diff_x > 0 then + new_under.x = under.x - 1 + else + new_under.x = under.x + 1 + end + else + -- placer is displaced along the Z axis relative to the target + if diff_z > 0 then + new_under.z = under.z - 1 + else + new_under.z = under.z + 1 + end + end + if minetest.registered_nodes[minetest.get_node(new_under).name].buildable_to then + local new_pointed_thing = {type="node", under=new_under, above={x=new_under.x, y=new_under.y+1, z=new_under.z}} + return minetest.item_place(itemstack, placer, new_pointed_thing) + end + end + + return minetest.item_place(itemstack, placer, pointed_thing) +end + +minetest.register_node("ropes:wood_bridge", { + description = S("Wooden Bridge"), + _doc_items_longdesc = ropes.doc.wooden_bridge_longdesc, + _doc_items_usagehelp = ropes.doc.wooden_bridge_usagehelp, + tiles = { + "default_wood.png", "default_wood.png", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 1, flow_through = 1, fence = 1, wall = 1}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- Platform + {-0.375, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- x beam4 + {-0.375, -0.5, 0.4375, 0.375, -0.375, 0.5}, -- x beam3 + {0.375, -0.5, -0.4375, 0.5, -0.375, 0.4375}, -- z beam2 + {-0.5, -0.5, -0.4375, -0.375, -0.375, 0.4375}, -- z beam1 + {0.375, -0.5, -0.5, 0.5, 0.375, -0.4375}, -- upright4 + {0.375, -0.5, 0.4375, 0.5, 0.375, 0.5}, -- upright3 + {-0.5, -0.5, -0.5, -0.375, 0.375, -0.4375}, -- upright2 + {-0.5, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- upright1 + } + }, + on_place = bridge_on_place, +}) + +minetest.register_craft({ + output = "ropes:wood_bridge 5", + recipe = { + {"group:stick", "stairs:slab_wood", "group:stick"}, + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + } +}) + +end diff --git a/mods/ropes/crafts.lua b/mods/ropes/crafts.lua new file mode 100644 index 00000000..e09bc16e --- /dev/null +++ b/mods/ropes/crafts.lua @@ -0,0 +1,90 @@ +local S = ropes.S + +if minetest.get_modpath("farming") then +-- this doesn't work reliably due to side effects of https://github.com/minetest/minetest/issues/5518 +-- local old_def = minetest.registered_craftitems["farming:cotton"] +-- if old_def then +-- old_def.groups["thread"] = 1 +-- minetest.override_item("farming:cotton", { +-- groups = old_def.groups +-- }) +-- end + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'farming:cotton','farming:cotton'}, + {'farming:cotton','farming:cotton'}, + {'farming:cotton','farming:cotton'}, + } + }) + + if farming.mod == "redo" or farming.mod == "undo" then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'farming:hemp_rope'}, + {'farming:hemp_rope'}, + } + }) + end +end + +if minetest.get_modpath("hemp") then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'hemp:hemp_rope'}, + {'hemp:hemp_rope'}, + } + }) +end + +if minetest.get_modpath("cottages") then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'cottages:rope'}, + {'cottages:rope'}, + } + }) +end + +if minetest.get_modpath("moreblocks") then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'moreblocks:rope','moreblocks:rope'}, + {'moreblocks:rope','moreblocks:rope'}, + {'moreblocks:rope','moreblocks:rope'}, + } + }) +end + +minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + } +}) + +minetest.register_craftitem("ropes:ropesegment", { + description = S("Rope Segment"), + _doc_items_longdesc = ropes.doc.ropesegment_longdesc, + _doc_items_usagehelp = ropes.doc.ropesegment_usage, + groups = {vines = 1}, + inventory_image = "ropes_item.png", +}) + +local cotton_burn_time = 1 +ropes.wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:wood")}}).time +ropes.rope_burn_time = cotton_burn_time * 6 +local stick_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:stick")}}).time +ropes.ladder_burn_time = ropes.rope_burn_time * 2 + stick_burn_time * 3 + +minetest.register_craft({ + type = "fuel", + recipe = "ropes:ropesegment", + burntime = ropes.rope_burn_time, +}) \ No newline at end of file diff --git a/mods/ropes/depends.txt b/mods/ropes/depends.txt new file mode 100644 index 00000000..0df1ec96 --- /dev/null +++ b/mods/ropes/depends.txt @@ -0,0 +1,7 @@ +default +farming? +vines? +doc? +loot? +hemp? +cottages? diff --git a/mods/ropes/description.txt b/mods/ropes/description.txt new file mode 100644 index 00000000..846f150d --- /dev/null +++ b/mods/ropes/description.txt @@ -0,0 +1 @@ +Adds rope boxes of various lengths and also rope ladders. \ No newline at end of file diff --git a/mods/ropes/doc.lua b/mods/ropes/doc.lua new file mode 100644 index 00000000..11033885 --- /dev/null +++ b/mods/ropes/doc.lua @@ -0,0 +1,53 @@ +ropes.doc = {} + +if not minetest.get_modpath("doc") then + return +end + +local S = ropes.S + +ropes.doc.ropesegment_longdesc = S("Rope segments are bundles of fibre twisted into robust cables.") +ropes.doc.ropesegment_usage = S("This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon.") + +ropes.doc.ropeladder_longdesc = S("A hanging rope ladder that automatically extends downward.") +ropes.doc.ropeladder_usage = S("After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (@1 meters). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before.", ropes.ropeLadderLength) + +local rope_length_doc = S("Rope boxes have a certain amount of rope contained within them specified in the name of the node, and have a limit to how much rope they can support that depends on the material they're made of. The different lengths can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @1m rope box by putting a @2m rope box and a rope segment in the crafting grid, or a @3m rope box and two rope segments in the crafting grid. Two rope segments can be recovered by putting the @4m rope box in the crafting grid by itself.", ropes.ropeLength*3, ropes.ropeLength*2, ropes.ropeLength, ropes.ropeLength*3) .. "\n" + +if ropes.woodRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Wood") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.woodRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Wood") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.woodRopeBoxMaxMultiple) +end + +if ropes.copperRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Copper") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.copperRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Copper") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.copperRopeBoxMaxMultiple) +end + +if ropes.steelRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Steel") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.steelRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Steel") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.steelRopeBoxMaxMultiple) +end + +ropes.doc.ropebox_longdesc = S("Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut.") +ropes.doc.ropebox_usage = rope_length_doc .. "\n\n" .. + S("When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.") .. "\n\n" .. + S("A rope can be severed midway using an axe or other similar tool. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope \"remembers\" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permanently lost when a rope is severed like this.") + +if ropes.extending_ladder_enabled then + ropes.doc.ladder_longdesc = S("A ladder for climbing. It can reach greater heights when placed against a supporting block.") + ropes.doc.ladder_usagehelp = S("Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.") +end + +ropes.doc.wooden_bridge_longdesc = S("A wooden platform with support struts useful for bridging gaps.") +ropes.doc.wooden_bridge_usagehelp = S("This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.") + +doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder") +doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom") +doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_falling") + +doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_bottom") +doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_top") diff --git a/mods/ropes/extendingladder.lua b/mods/ropes/extendingladder.lua new file mode 100644 index 00000000..4999f4f1 --- /dev/null +++ b/mods/ropes/extendingladder.lua @@ -0,0 +1,251 @@ +local S = ropes.S + +if ropes.extending_ladder_enabled then + +local wood_recipe = { + {"group:stick", "", "group:stick"}, + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + } +local wood_name = S("Wooden Extendable Ladder") + +local steel_recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + } +local steel_name = S("Steel Extendable Ladder") + +-- Overlay texture: by 1F616EMO, CC0 +local texture_overlay = "^ropes_ropeladder_overlay.png" + +if ropes.replace_default_ladders then + +minetest.unregister_item("default:ladder_wood") +minetest.unregister_item("default:ladder_steel") +minetest.clear_craft({output = "default:ladder_wood"}) +minetest.clear_craft({output = "default:ladder_steel"}) + +local wallmounted_to_facedir = +{[0] = 15, -- ceiling +[1] = 13, -- floor +[2] = 1, -- +X +[3] = 3, -- -X +[4] = 0, -- +Z +[5] = 2, -- -Z +} + +minetest.register_lbm({ + label = "Switch from wallmounted default ladders to rope mod extending ladders", + name = "ropes:wallmounted_ladder_to_facedir_ladder", + nodenames = {"default:ladder_wood", "default:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = wallmounted_to_facedir[node.param2]} + if (node.name == "default:ladder_wood") then + new_node.name = "ropes:ladder_wood" + else + new_node.name = "ropes:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +wood_recipe = { + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + {"group:stick", "", "group:stick"}, + } +wood_name = S("Wooden Ladder") + +steel_recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +steel_name = S("Steel Ladder") + +texture_overlay = "" + +else + -- Swap between normal and extendable ladders + minetest.register_craft({ + type = "shapeless", + output = "ropes:ladder_wood", + recipe = {"default:ladder_wood"}, + }) + + minetest.register_craft({ + type = "shapeless", + output = "ropes:ladder_steel", + recipe = {"default:ladder_steel"}, + }) +end + +minetest.register_craft({ + output = "ropes:ladder_wood 5", + recipe = wood_recipe, +}) + +minetest.register_craft({ + output = 'ropes:ladder_steel 15', + recipe = steel_recipe, +}) + +local ladder_extender = function(pos, node, clicker, itemstack, pointed_thing, ladder_node, standing_limit) + -- on_rightclick can be called by other mods, make sure we have all the parameters we need + if pointed_thing == nil or itemstack == nil then + return itemstack + end + + local clicked_stack = ItemStack(itemstack) + + -- true if we're pointing up at the ladder from below and there's a buildable space below it + -- this check allows us to extend ladders downward + local pointing_directly_below = + pointed_thing.above.x == pos.x and + pointed_thing.above.z == pos.z and + pointed_thing.above.y == pos.y - 1 and + minetest.registered_nodes[minetest.get_node(pointed_thing.above).name].buildable_to + + if clicked_stack:get_name() == ladder_node and not pointing_directly_below then + local param2 = minetest.get_node(pos).param2 + local dir = minetest.facedir_to_dir(param2) + local scan_limit = pos.y + 6 -- Only add ladder segments up to five nodes above the one clicked on + pos.y = pos.y + 1 + while pos.y < scan_limit and minetest.get_node(pos).name == ladder_node do + param2 = minetest.get_node(pos).param2 + pos.y = pos.y + 1 + end + if pos.y < scan_limit and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then + + -- scan downward behind the ladder to find support + local behind_pos = vector.add(pos, minetest.facedir_to_dir(param2)) + local target_height = pos.y - standing_limit - 1 + while behind_pos.y > target_height and minetest.registered_nodes[minetest.get_node(behind_pos).name].buildable_to do + behind_pos.y = behind_pos.y - 1 + end + + -- If there's enough support, build a new ladder segment + if behind_pos.y > target_height then + if minetest.is_protected(pos, clicker:get_player_name()) then + minetest.record_protection_violation(pos, clicker:get_player_name()) + else + minetest.set_node(pos, {name=ladder_node, param2=param2}) + if not minetest.settings:get_bool("creative_mode") then + clicked_stack:take_item(1) + end + end + end + end + elseif clicked_stack:get_definition().type == "node" then + return minetest.item_place_node(itemstack, clicker, pointed_thing) + end + return clicked_stack +end + +minetest.register_node("ropes:ladder_wood", { + description = wood_name, + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_wood.png","default_wood.png","default_wood.png^[transformR270","default_wood.png^[transformR270","default_ladder_wood.png"}, + use_texture_alpha = "clip", + inventory_image = "default_ladder_wood.png" .. texture_overlay, + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.375, -0.5, 0.375, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Upright2 + {-0.4375, 0.3125, 0.4375, 0.4375, 0.4375, 0.5}, -- Rung_4 + {-0.4375, -0.1875, 0.4375, 0.4375, -0.0625, 0.5}, -- Rung_2 + {-0.4375, -0.4375, 0.4375, 0.4375, -0.3125, 0.5}, -- Rung_1 + {-0.4375, 0.0625, 0.4375, 0.4375, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2, flow_through = 1}, + sounds = default.node_sound_wood_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_wood", ropes.extending_wood_ladder_limit) + end, +}) + +minetest.register_node("ropes:ladder_steel", { + description = steel_name, + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_steel_block.png","default_steel_block.png","default_steel_block.png","default_steel_block.png","default_ladder_steel.png"}, + use_texture_alpha = "clip", + inventory_image = "default_ladder_steel.png" .. texture_overlay, + wield_image = "default_ladder_steel.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4375, -0.5, 0.3125, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.3125, 0.4375, 0.5, 0.5}, -- Upright2 + {-0.25, 0.3125, 0.375, 0.25, 0.4375, 0.5}, -- Rung_4 + {-0.25, -0.1875, 0.375, 0.25, -0.0625, 0.5}, -- Rung_2 + {-0.25, -0.4375, 0.375, 0.25, -0.3125, 0.5}, -- Rung_1 + {-0.25, 0.0625, 0.375, 0.25, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {cracky = 2, flow_through = 1}, + sounds = default.node_sound_metal_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_steel", ropes.extending_steel_ladder_limit) + end, +}) + +else + +-- Table of possible wallmounted values +local facedir_to_wallmounted = { + 4, -- +Z + 2, -- +X + 5, -- -Z + 3, -- -X + 1, -- -Y + 0, -- +Y +} +-- Mapping from facedir value to index in facedir_to_dir. +local facedir_to_wallmounted_map = { + [0]=1, 2, 3, 4, + 5, 2, 6, 4, + 6, 2, 5, 4, + 1, 5, 3, 6, + 1, 6, 3, 5, + 1, 4, 3, 2, +} + +minetest.register_lbm({ + label = "Switch from ropes ladders to wallmounted default ladders", + name = "ropes:facedir_ladder_to_wallmounted_ladder", + nodenames = {"ropes:ladder_wood", "ropes:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = facedir_to_wallmounted[facedir_to_wallmounted_map[node.param2 % 32]]} + if (node.name == "ropes:ladder_wood") then + new_node.name = "default:ladder_wood" + else + new_node.name = "default:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +end diff --git a/mods/ropes/functions.lua b/mods/ropes/functions.lua new file mode 100644 index 00000000..6a366f9e --- /dev/null +++ b/mods/ropes/functions.lua @@ -0,0 +1,115 @@ +ropes.can_place_rope_in_node = function(target_node_name) + if ropes.can_extend_into_nodes[target_node_name] == true then + return true + end + local target_def = minetest.registered_nodes[target_node_name] + if target_def then + if target_def.drawtype == "airlike" and ropes.can_extend_into_airlike then + return true + end + if target_def.groups and target_def.groups.ropes_can_extend_into then + return true + end + end + return false +end + +ropes.make_rope_on_timer = function(rope_node_name) + return function(pos, elapsed) + local currentend = minetest.get_node(pos) + local currentmeta = minetest.get_meta(pos) + local currentlength = currentmeta:get_int("length_remaining") + local placer_name = currentmeta:get_string("placer") + local newpos = {x=pos.x, y=pos.y-1, z=pos.z} + local newnode = minetest.get_node(newpos) + local oldnode = minetest.get_node(pos) + if currentlength > 1 and (not minetest.is_protected(newpos, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then + if ropes.can_place_rope_in_node(newnode.name) then + minetest.add_node(newpos, {name=currentend.name, param2=oldnode.param2}) + local newmeta = minetest.get_meta(newpos) + newmeta:set_int("length_remaining", currentlength-1) + newmeta:set_string("placer", placer_name) + minetest.set_node(pos, {name=rope_node_name, param2=oldnode.param2}) + ropes.move_players_down(pos, 1) + else + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end + end + end +end + +local data = {} +local c_air = minetest.get_content_id("air") + +ropes.destroy_rope = function(pos, nodes) + local top = pos.y + local bottom = pos.y-15 + local voxel_manip = minetest.get_voxel_manip() + + local finished = false + local ids_to_destroy = {} + for _, node in pairs(nodes) do + if minetest.registered_nodes[node] then + ids_to_destroy[minetest.get_content_id(node)] = true + end + end + + while not finished do + local emin, emax = voxel_manip:read_from_map({x=pos.x, y=bottom, z=pos.z}, {x=pos.x, y=top, z=pos.z}) + voxel_manip:get_data(data) + local voxel_area = VoxelArea:new{MinEdge=emin, MaxEdge=emax} + bottom = emin.y + for y = top, bottom, -1 do + local index = voxel_area:index(pos.x, y, pos.z) + if ids_to_destroy[data[index]] then + data[index] = c_air + else + finished = true + break + end + end + voxel_manip:set_data(data) + voxel_manip:write_to_map() + voxel_manip:update_map() + top = bottom - 1 + bottom = bottom - 15 + end +end + + +ropes.hanging_after_destruct = function(pos, top_node, middle_node, bottom_node) + local node = minetest.get_node(pos) + if node.name == top_node or node.name == middle_node or node.name == bottom_node then + return -- this was done by another ladder or rope node changing this one, don't react + end + + pos.y = pos.y + 1 -- one up + local node_above = minetest.get_node(pos) + if node_above.name == middle_node then + minetest.swap_node(pos, {name=bottom_node, param2=node_above.param2}) + end + + pos.y = pos.y - 2 -- one down + local node_below = minetest.get_node(pos) + if node_below.name == middle_node then + ropes.destroy_rope(pos, {middle_node, bottom_node}) + elseif node_below.name == bottom_node then + minetest.swap_node(pos, {name="air"}) + end +end + +ropes.move_players_down = function(pos, radius) + local all_objects = minetest.get_objects_inside_radius({x=pos.x, y=pos.y+radius, z=pos.z}, radius) + local players = {} + local _,obj + for _,obj in pairs(all_objects) do + if obj:is_player() then + local obj_pos = obj:get_pos() + if math.abs(obj_pos.x-pos.x) < 0.5 and math.abs(obj_pos.z-pos.z) < 0.5 then + obj:set_pos({x=obj_pos.x, y=obj_pos.y-1, z=obj_pos.z}, true) + end + end + end +end diff --git a/mods/ropes/i18n.py b/mods/ropes/i18n.py new file mode 100644 index 00000000..d33bbb04 --- /dev/null +++ b/mods/ropes/i18n.py @@ -0,0 +1,418 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Script to generate the template file and update the translation files. +# Copy the script into the mod or modpack root folder and run it there. +# +# Copyright (C) 2019 Joachim Stolberg, 2020 FaceDeer, 2020 Louis Royer +# LGPLv2.1+ + +from __future__ import print_function +import os, fnmatch, re, shutil, errno +from sys import argv as _argv + +# Running params +params = {"recursive": False, + "help": False, + "mods": False, + "verbose": False, + "folders": [] +} +# Available CLI options +options = {"recursive": ['--recursive', '-r'], + "help": ['--help', '-h'], + "mods": ['--installed-mods'], + "verbose": ['--verbose', '-v'] +} + +# Strings longer than this will have extra space added between +# them in the translation files to make it easier to distinguish their +# beginnings and endings at a glance +doublespace_threshold = 60 + +def set_params_folders(tab: list): + '''Initialize params["folders"] from CLI arguments.''' + # Discarding argument 0 (tool name) + for param in tab[1:]: + stop_param = False + for option in options: + if param in options[option]: + stop_param = True + break + if not stop_param: + params["folders"].append(os.path.abspath(param)) + +def set_params(tab: list): + '''Initialize params from CLI arguments.''' + for option in options: + for option_name in options[option]: + if option_name in tab: + params[option] = True + break + +def print_help(name): + '''Prints some help message.''' + print(f'''SYNOPSIS + {name} [OPTIONS] [PATHS...] +DESCRIPTION + {', '.join(options["help"])} + prints this help message + {', '.join(options["recursive"])} + run on all subfolders of paths given + {', '.join(options["mods"])} + run on locally installed modules + {', '.join(options["verbose"])} + add output information +''') + + +def main(): + '''Main function''' + set_params(_argv) + set_params_folders(_argv) + if params["help"]: + print_help(_argv[0]) + elif params["recursive"] and params["mods"]: + print("Option --installed-mods is incompatible with --recursive") + else: + # Add recursivity message + print("Running ", end='') + if params["recursive"]: + print("recursively ", end='') + # Running + if params["mods"]: + print(f"on all locally installed modules in {os.path.abspath('~/.minetest/mods/')}") + run_all_subfolders("~/.minetest/mods") + elif len(params["folders"]) >= 2: + print("on folder list:", params["folders"]) + for f in params["folders"]: + if params["recursive"]: + run_all_subfolders(f) + else: + update_folder(f) + elif len(params["folders"]) == 1: + print("on folder", params["folders"][0]) + if params["recursive"]: + run_all_subfolders(params["folders"][0]) + else: + update_folder(params["folders"][0]) + else: + print("on folder", os.path.abspath("./")) + if params["recursive"]: + run_all_subfolders(os.path.abspath("./")) + else: + update_folder(os.path.abspath("./")) + +#group 2 will be the string, groups 1 and 3 will be the delimiters (" or ') +#See https://stackoverflow.com/questions/46967465/regex-match-text-in-either-single-or-double-quote +pattern_lua = re.compile(r'[\.=^\t,{\(\s]N?S\(\s*(["\'])((?:\\\1|(?:(?!\1)).)*)(\1)[\s,\)]', re.DOTALL) +pattern_lua_bracketed = re.compile(r'[\.=^\t,{\(\s]N?S\(\s*\[\[(.*?)\]\][\s,\)]', re.DOTALL) + +# Handles "concatenation" .. " of strings" +pattern_concat = re.compile(r'["\'][\s]*\.\.[\s]*["\']', re.DOTALL) + +pattern_tr = re.compile(r'(.+?[^@])=(.*)') +pattern_name = re.compile(r'^name[ ]*=[ ]*([^ \n]*)') +pattern_tr_filename = re.compile(r'\.tr$') +pattern_po_language_code = re.compile(r'(.*)\.po$') + +#attempt to read the mod's name from the mod.conf file. Returns None on failure +def get_modname(folder): + try: + with open(os.path.join(folder, "mod.conf"), "r", encoding='utf-8') as mod_conf: + for line in mod_conf: + match = pattern_name.match(line) + if match: + return match.group(1) + except FileNotFoundError: + pass + return None + +#If there are already .tr files in /locale, returns a list of their names +def get_existing_tr_files(folder): + out = [] + for root, dirs, files in os.walk(os.path.join(folder, 'locale/')): + for name in files: + if pattern_tr_filename.search(name): + out.append(name) + return out + +# A series of search and replaces that massage a .po file's contents into +# a .tr file's equivalent +def process_po_file(text): + # The first three items are for unused matches + text = re.sub(r'#~ msgid "', "", text) + text = re.sub(r'"\n#~ msgstr ""\n"', "=", text) + text = re.sub(r'"\n#~ msgstr "', "=", text) + # comment lines + text = re.sub(r'#.*\n', "", text) + # converting msg pairs into "=" pairs + text = re.sub(r'msgid "', "", text) + text = re.sub(r'"\nmsgstr ""\n"', "=", text) + text = re.sub(r'"\nmsgstr "', "=", text) + # various line breaks and escape codes + text = re.sub(r'"\n"', "", text) + text = re.sub(r'"\n', "\n", text) + text = re.sub(r'\\"', '"', text) + text = re.sub(r'\\n', '@n', text) + # remove header text + text = re.sub(r'=Project-Id-Version:.*\n', "", text) + # remove double-spaced lines + text = re.sub(r'\n\n', '\n', text) + return text + +# Go through existing .po files and, if a .tr file for that language +# *doesn't* exist, convert it and create it. +# The .tr file that results will subsequently be reprocessed so +# any "no longer used" strings will be preserved. +# Note that "fuzzy" tags will be lost in this process. +def process_po_files(folder, modname): + for root, dirs, files in os.walk(os.path.join(folder, 'locale/')): + for name in files: + code_match = pattern_po_language_code.match(name) + if code_match == None: + continue + language_code = code_match.group(1) + tr_name = modname + "." + language_code + ".tr" + tr_file = os.path.join(root, tr_name) + if os.path.exists(tr_file): + if params["verbose"]: + print(f"{tr_name} already exists, ignoring {name}") + continue + fname = os.path.join(root, name) + with open(fname, "r", encoding='utf-8') as po_file: + if params["verbose"]: + print(f"Importing translations from {name}") + text = process_po_file(po_file.read()) + with open(tr_file, "wt", encoding='utf-8') as tr_out: + tr_out.write(text) + +# from https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python/600612#600612 +# Creates a directory if it doesn't exist, silently does +# nothing if it already exists +def mkdir_p(path): + try: + os.makedirs(path) + except OSError as exc: # Python >2.5 + if exc.errno == errno.EEXIST and os.path.isdir(path): + pass + else: raise + +# Converts the template dictionary to a text to be written as a file +# dKeyStrings is a dictionary of localized string to source file sets +# dOld is a dictionary of existing translations and comments from +# the previous version of this text +def strings_to_text(dkeyStrings, dOld, mod_name): + lOut = [f"# textdomain: {mod_name}\n"] + + dGroupedBySource = {} + + for key in dkeyStrings: + sourceList = list(dkeyStrings[key]) + sourceList.sort() + sourceString = "\n".join(sourceList) + listForSource = dGroupedBySource.get(sourceString, []) + listForSource.append(key) + dGroupedBySource[sourceString] = listForSource + + lSourceKeys = list(dGroupedBySource.keys()) + lSourceKeys.sort() + for source in lSourceKeys: + localizedStrings = dGroupedBySource[source] + localizedStrings.sort() + lOut.append("") + lOut.append(source) + lOut.append("") + for localizedString in localizedStrings: + val = dOld.get(localizedString, {}) + translation = val.get("translation", "") + comment = val.get("comment") + if len(localizedString) > doublespace_threshold and not lOut[-1] == "": + lOut.append("") + if comment != None: + lOut.append(comment) + lOut.append(f"{localizedString}={translation}") + if len(localizedString) > doublespace_threshold: + lOut.append("") + + + unusedExist = False + for key in dOld: + if key not in dkeyStrings: + val = dOld[key] + translation = val.get("translation") + comment = val.get("comment") + # only keep an unused translation if there was translated + # text or a comment associated with it + if translation != None and (translation != "" or comment): + if not unusedExist: + unusedExist = True + lOut.append("\n\n##### not used anymore #####\n") + if len(key) > doublespace_threshold and not lOut[-1] == "": + lOut.append("") + if comment != None: + lOut.append(comment) + lOut.append(f"{key}={translation}") + if len(key) > doublespace_threshold: + lOut.append("") + return "\n".join(lOut) + '\n' + +# Writes a template.txt file +# dkeyStrings is the dictionary returned by generate_template +def write_template(templ_file, dkeyStrings, mod_name): + # read existing template file to preserve comments + existing_template = import_tr_file(templ_file) + + text = strings_to_text(dkeyStrings, existing_template[0], mod_name) + mkdir_p(os.path.dirname(templ_file)) + with open(templ_file, "wt", encoding='utf-8') as template_file: + template_file.write(text) + + +# Gets all translatable strings from a lua file +def read_lua_file_strings(lua_file): + lOut = [] + with open(lua_file, encoding='utf-8') as text_file: + text = text_file.read() + #TODO remove comments here + + text = re.sub(pattern_concat, "", text) + + strings = [] + for s in pattern_lua.findall(text): + strings.append(s[1]) + for s in pattern_lua_bracketed.findall(text): + strings.append(s) + + for s in strings: + s = re.sub(r'"\.\.\s+"', "", s) + s = re.sub("@[^@=0-9]", "@@", s) + s = s.replace('\\"', '"') + s = s.replace("\\'", "'") + s = s.replace("\n", "@n") + s = s.replace("\\n", "@n") + s = s.replace("=", "@=") + lOut.append(s) + return lOut + +# Gets strings from an existing translation file +# returns both a dictionary of translations +# and the full original source text so that the new text +# can be compared to it for changes. +def import_tr_file(tr_file): + dOut = {} + text = None + if os.path.exists(tr_file): + with open(tr_file, "r", encoding='utf-8') as existing_file : + # save the full text to allow for comparison + # of the old version with the new output + text = existing_file.read() + existing_file.seek(0) + # a running record of the current comment block + # we're inside, to allow preceeding multi-line comments + # to be retained for a translation line + latest_comment_block = None + for line in existing_file.readlines(): + line = line.rstrip('\n') + if line[:3] == "###": + # Reset comment block if we hit a header + latest_comment_block = None + continue + if line[:1] == "#": + # Save the comment we're inside + if not latest_comment_block: + latest_comment_block = line + else: + latest_comment_block = latest_comment_block + "\n" + line + continue + match = pattern_tr.match(line) + if match: + # this line is a translated line + outval = {} + outval["translation"] = match.group(2) + if latest_comment_block: + # if there was a comment, record that. + outval["comment"] = latest_comment_block + latest_comment_block = None + dOut[match.group(1)] = outval + return (dOut, text) + +# Walks all lua files in the mod folder, collects translatable strings, +# and writes it to a template.txt file +# Returns a dictionary of localized strings to source file sets +# that can be used with the strings_to_text function. +def generate_template(folder, mod_name): + dOut = {} + for root, dirs, files in os.walk(folder): + for name in files: + if fnmatch.fnmatch(name, "*.lua"): + fname = os.path.join(root, name) + found = read_lua_file_strings(fname) + if params["verbose"]: + print(f"{fname}: {str(len(found))} translatable strings") + + for s in found: + sources = dOut.get(s, set()) + sources.add(f"### {os.path.basename(fname)} ###") + dOut[s] = sources + + if len(dOut) == 0: + return None + templ_file = os.path.join(folder, "locale/template.txt") + write_template(templ_file, dOut, mod_name) + return dOut + +# Updates an existing .tr file, copying the old one to a ".old" file +# if any changes have happened +# dNew is the data used to generate the template, it has all the +# currently-existing localized strings +def update_tr_file(dNew, mod_name, tr_file): + if params["verbose"]: + print(f"updating {tr_file}") + + tr_import = import_tr_file(tr_file) + dOld = tr_import[0] + textOld = tr_import[1] + + textNew = strings_to_text(dNew, dOld, mod_name) + + if textOld and textOld != textNew: + print(f"{tr_file} has changed.") + shutil.copyfile(tr_file, f"{tr_file}.old") + + with open(tr_file, "w", encoding='utf-8') as new_tr_file: + new_tr_file.write(textNew) + +# Updates translation files for the mod in the given folder +def update_mod(folder): + modname = get_modname(folder) + if modname is not None: + process_po_files(folder, modname) + print(f"Updating translations for {modname}") + data = generate_template(folder, modname) + if data == None: + print(f"No translatable strings found in {modname}") + else: + for tr_file in get_existing_tr_files(folder): + update_tr_file(data, modname, os.path.join(folder, "locale/", tr_file)) + else: + print("Unable to find modname in folder " + folder) + +# Determines if the folder being pointed to is a mod or a mod pack +# and then runs update_mod accordingly +def update_folder(folder): + is_modpack = os.path.exists(os.path.join(folder, "modpack.txt")) or os.path.exists(os.path.join(folder, "modpack.conf")) + if is_modpack: + subfolders = [f.path for f in os.scandir(folder) if f.is_dir()] + for subfolder in subfolders: + update_mod(subfolder + "/") + else: + update_mod(folder) + print("Done.") + +def run_all_subfolders(folder): + for modfolder in [f.path for f in os.scandir(folder) if f.is_dir()]: + update_folder(modfolder + "/") + + +main() diff --git a/mods/ropes/init.lua b/mods/ropes/init.lua new file mode 100644 index 00000000..c3c4fe89 --- /dev/null +++ b/mods/ropes/init.lua @@ -0,0 +1,66 @@ +ropes = { + name = 'ropes', +} + +-- internationalization boilerplate +local modname = minetest.get_current_modname() +local MP = minetest.get_modpath(modname) +ropes.S = minetest.get_translator(modname) + +ropes.ropeLength = tonumber(minetest.settings:get("ropes_rope_length")) or 50 +ropes.woodRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_wood_rope_box_max_multiple")) or 2 +ropes.copperRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_copper_rope_box_max_multiple")) or 5 +ropes.steelRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_steel_rope_box_max_multiple")) or 9 +ropes.create_all_definitions = minetest.settings:get_bool("ropes_create_all_definitions") + +ropes.ropeLadderLength = tonumber(minetest.settings:get("ropes_rope_ladder_length")) or 50 + +ropes.extending_ladder_enabled = minetest.settings:get_bool("ropes_extending_ladder_enabled") +if ropes.extending_ladder_enabled == nil then + ropes.extending_ladder_enabled = true +end +ropes.replace_default_ladders = minetest.settings:get_bool("ropes_replace_default_ladders") + +ropes.extending_wood_ladder_limit = tonumber(minetest.settings:get("ropes_extending_wood_ladder_limit")) or 5 +ropes.extending_steel_ladder_limit = tonumber(minetest.settings:get("ropes_extending_steel_ladder_limit")) or 15 + +ropes.bridges_enabled = minetest.settings:get_bool("ropes_bridges_enabled") +if ropes.bridges_enabled == nil then + ropes.bridges_enabled = true +end + +ropes.can_extend_into_airlike = minetest.settings:get_bool("ropes_can_extend_into_airlike") +ropes.can_extend_into_nodes = {["air"] = true} +if minetest.get_modpath("nether") then + ropes.can_extend_into_nodes["nether:fumes"] = true +end + +dofile( MP .. "/doc.lua" ) +dofile( MP .. "/functions.lua" ) +dofile( MP .. "/crafts.lua" ) +dofile( MP .. "/ropeboxes.lua" ) +dofile( MP .. "/ropeladder.lua" ) +dofile( MP .. "/extendingladder.lua" ) +dofile( MP .. "/bridge.lua" ) +dofile( MP .. "/loot.lua" ) + +for i=1,5 do + minetest.register_alias(string.format("vines:%irope_block", i), string.format("ropes:%irope_block", i)) +end +minetest.register_alias("vines:rope", "ropes:rope") +minetest.register_alias("vines:rope_bottom", "ropes:rope_bottom") +minetest.register_alias("vines:rope_end", "ropes:rope_bottom") +minetest.register_alias("vines:rope_top", "ropes:rope_top") +minetest.register_alias("vines:ropeladder_top", "ropes:ropeladder_top") +minetest.register_alias("vines:ropeladder", "ropes:ropeladder") +minetest.register_alias("vines:ropeladder_bottom", "ropes:ropeladder_bottom") +minetest.register_alias("vines:ropeladder_falling", "ropes:ropeladder_falling") +minetest.register_alias("vines:rope_block", "ropes:steel5rope_block") +for i=1,9 do + minetest.register_alias(string.format("ropes:%irope_block", i), string.format("ropes:steel%irope_block", i)) +end +minetest.register_alias("castle:ropes", "ropes:rope") +minetest.register_alias("castle:ropebox", "ropes:steel1rope_block") +minetest.register_alias("castle:box_rope", "ropes:rope") + +print("[Ropes] Loaded!") diff --git a/mods/ropes/locale/ropes.es.tr b/mods/ropes/locale/ropes.es.tr new file mode 100644 index 00000000..fee2e594 --- /dev/null +++ b/mods/ropes/locale/ropes.es.tr @@ -0,0 +1,71 @@ +# textdomain: ropes + + +### bridge.lua ### + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Bridge=Puente de madera + +### crafts.lua ### + +Rope Segment=Segmento de cuerda + +### doc.lua ### + +A hanging rope ladder that automatically extends downward.=Una escalera de cuerda colgante que se extiende automáticamente hacia abajo. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +A ladder for climbing. It can reach greater heights when placed against a supporting block.=Una escalera para subir. Puede alcanzar mayores alturas cuando se coloca contra un bloque de soporte. + +A rope can be severed midway using an axe or other similar tool. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope "remembers" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permanently lost when a rope is severed like this.=Una cuerda puede ser cortada a mitad de camino usando un hacha u otra herramienta similar. La sección de la cuerda debajo del corte se colapsará y desaparecerá, lo que puede causar que los jugadores que estaban colgados de ella se caigan. El resto de la cuerda no volverá a descender por sí sola, pero la caja de la cuerda en la parte superior de la cuerda "recuerda" la longitud de la cuerda y si es deconstruida y reemplazada tendrá la misma longitud máxima de cuerda que antes - ninguna cuerda se pierde permanentemente cuando una cuerda es cortada de esta manera. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +A wooden platform with support struts useful for bridging gaps.=Una plataforma de madera con puntales de soporte útil para salvar huecos. + +After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (@1 meters). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before.=Después de colocar una escalera de cuerda en una pared vertical, comenzará a extenderse hacia abajo hasta que alcance su longitud máxima (@1 metro). Si se retira la escalera de cuerda, desaparecerá toda la escalera por debajo del punto de extracción. Una escalera de cuerda puede ser cortada hasta la mitad usando un hacha o una herramienta similar, y la escalera por debajo del punto donde es cortada colapsará. Sin embargo, no se pierde ninguna cuerda en el proceso, y si la sección superior de la escalera se retira y se reemplaza, la escalera se volverá a extender a la misma longitud máxima que antes. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.=Al hacer clic con el botón derecho en una escalera con una pila de elementos de escalera idénticos, se agregarán automáticamente nuevos segmentos de escalera a la parte superior, siempre que no se haya extendido demasiado más allá del último bloque detrás de ella que brinda soporte. + +Rope boxes have a certain amount of rope contained within them specified in the name of the node, and have a limit to how much rope they can support that depends on the material they're made of. The different lengths can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @1m rope box by putting a @2m rope box and a rope segment in the crafting grid, or a @3m rope box and two rope segments in the crafting grid. Two rope segments can be recovered by putting the @4m rope box in the crafting grid by itself.=Las cajas de cuerdas tienen una cierta cantidad de cuerda contenida dentro de ellas especificada en el nombre del nodo, y tienen un límite en la cantidad de cuerda que pueden soportar que depende del material del que están hechas. Las diferentes longitudes se pueden realizar combinando y dividiendo las cajas de cuerda en la rejilla de elaboración. Por ejemplo, puedes crear una caja de cuerda de @1m poniendo una caja de cuerda de @2m y un segmento de cuerda en la rejilla de artesanía, o una caja de cuerda de @3m y dos segmentos de cuerda en la rejilla de artesanía. Se pueden recuperar dos segmentos de cable colocando solo la caja de cable de @4m en la rejilla de fabricación. + +Rope segments are bundles of fibre twisted into robust cables.=Los segmentos de cable son haces de fibras trenzadas en cables robustos. + +Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut.=Las cuerdas se cuelgan colocando cajas de cuerda, que bajan automáticamente una cuerda de longitud fija por debajo de ellas. Se pueden escalar y cortar. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.=Esto se comporta como la mayoría de los bloques estructurales, excepto en una circunstancia: cuando se coloca encima de un bloque con un espacio edificable en el lado que mira hacia afuera, este bloque no se construirá en la parte superior, sino que se extenderá desde ese lado más alejado del bloque objetivo. . Esto permite construir fácilmente una plataforma que sobresale del lugar en el que se encuentra. + +This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon.=Esta objeto es útil para crear escaleras de cuerda, o para enrollar en husillos de madera para colgar y trepar. + +When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.=Cuando se coloca una caja de cuerda, la cuerda comienza a descender inmediatamente a un metro por segundo. La cuerda sólo descenderá cuando su final esté cerca de un jugador activo, suspendiendo su viaje cuando no haya jugadores cerca, por lo que un largo descenso puede requerir que el jugador baje por la cuerda a medida que avanza. Si estás cerca del extremo inferior de una cuerda que se está extendiendo, serás arrastrado automáticamente hacia abajo con ella. La cuerda se detendrá cuando se encuentre con una obstrucción, pero volverá a bajar si se retira la obstrucción. + +rope boxes can hold @1m of rope.=Las cajas de cuerdas pueden mantener @1m de cuerda. +rope boxes can hold rope lengths from @1m to @2m.=Las cajas de cuerda pueden contener longitudes de cuerda de @1m a @2m. + +### doc.lua ### +### ropeboxes.lua ### + +Copper=cobre +Steel=acero +Wood=madera + +### extendingladder.lua ### + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Steel Extendable Ladder=Escalera extensible de acero +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Steel Ladder=Escalera de acero +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Extendable Ladder=Escalera extensible de madera +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Ladder=Escalera de madera + +### ropeboxes.lua ### + +@1 Ropebox @2m=Caja de cuerda de @1 de @2m +Rope=Cuerda + +### ropeladder.lua ### + +Rope Ladder=Escalera de cuerda diff --git a/mods/ropes/locale/ropes.ru.tr b/mods/ropes/locale/ropes.ru.tr new file mode 100644 index 00000000..67e4b8ef --- /dev/null +++ b/mods/ropes/locale/ropes.ru.tr @@ -0,0 +1,70 @@ +# textdomain: ropes + +### bridge.lua ### + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Bridge=Деревянный мост + +### crafts.lua ### + +Rope Segment=Сегмент каната + +### doc.lua ### + +A hanging rope ladder that automatically extends downward.=Подвесная веревочная лестница, которая автоматически выдвигается вниз. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +A ladder for climbing. It can reach greater heights when placed against a supporting block.=Лестница для подъема. Она может достигать большей высоты, если ее приставить к опорному блоку. + +A rope can be severed midway using an axe or other similar tool. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope "remembers" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permanently lost when a rope is severed like this.=Веревку можно перерезать на полпути с помощью топора или другого похожего инструмента. Часть веревки в месте разреза разрушится и исчезнет, ​​что может привести к падению игроков, которые на ней висели. Оставшаяся веревка не возобновит спуск сама по себе, но коробка для веревок наверху «помнит», какой длины была веревка, и если ее разобрать и заменить, она все равно будет иметь ту же максимальную длину веревки, что и раньше — ни одна веревка не теряется навсегда, когда веревка перерезана таким образом. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +A wooden platform with support struts useful for bridging gaps.=Деревянная платформа с опорными стойками, используемая для перекрытия щелей. + +After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (@1 meters). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before.=После того, как веревочная лестница будет размещена на вертикальной стене, она начнет удлиняться вниз, пока не достигнет своей максимальной длины (@1 метр). Если веревочную лестницу убрать, вся лестница ниже точки удаления исчезнет. Веревочную лестницу можно перерезать наполовину с помощью топора или подобного инструмента, и лестница ниже точки, где она перерезана, рухнет. Однако в этом процессе веревка фактически не теряется, и если снять и заменить самую верхнюю часть лестницы, лестница снова удлинится до той же максимальной длины, что и раньше. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.=Щелчок правой кнопкой мыши по лестнице со стопкой идентичных элементов лестницы автоматически добавит новые сегменты лестницы наверх, при условии, что она не выступает слишком далеко за пределы последнего блока позади нее, обеспечивающего поддержку. + +Rope boxes have a certain amount of rope contained within them specified in the name of the node, and have a limit to how much rope they can support that depends on the material they're made of. The different lengths can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @1m rope box by putting a @2m rope box and a rope segment in the crafting grid, or a @3m rope box and two rope segments in the crafting grid. Two rope segments can be recovered by putting the @4m rope box in the crafting grid by itself.=Ящики для веревок содержат определенное количество веревки, указанное в названии узла, и имеют ограничение на то, сколько веревки они могут поддерживать, в зависимости от материала, из которого они сделаны. Различные длины могут быть созданы путем объединения и разделения ящиков для веревок в сетке крафта. Например, вы можете создать ящик для веревки @1m, поместив ящик для веревки @2m и сегмент веревки в сетку крафта, или ящик для веревки @3m и два сегмента веревки в сетку крафта. Два сегмента веревки можно получить, поместив ящик для веревки @4m в сетку крафта отдельно. + +Rope segments are bundles of fibre twisted into robust cables.=Сегменты каната представляют собой пучки волокон, скрученные в прочные тросы. + +Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut.=Канаты подвешиваются путем размещения ящиков для канатов, которые автоматически опускают под ними канат фиксированной длины. По ним можно лазить и резать. + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.=Он ведет себя как большинство структурных блоков, за исключением одного обстоятельства: при размещении на блоке с пространством для строительства на стороне, обращенной от вас, этот блок не будет построен сверху, а вместо этого будет выступать из дальней стороны целевого блока. Это позволяет легко построить платформу, которая выступает из того места, где вы стоите. + +This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon.=Этот предмет ручной работы пригодится для создания веревочных лестниц или для наматывания на деревянные стержни, чтобы можно было повесить веревку или залезть на нее. + +When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.=Когда вы размещаете ящик с веревкой, веревка немедленно начнет опускаться с него со скоростью один метр в секунду. Веревка будет опускаться только тогда, когда ее конец находится в непосредственной близости от активного игрока, приостанавливая свое движение, когда поблизости нет игроков, поэтому для длительного спуска игроку может потребоваться спускаться по веревке по мере ее движения. Если вы находитесь около нижнего конца удлиняющейся веревки, вы автоматически будете унесены ею вниз. Веревка остановится, когда столкнется с препятствием, но возобновит спуск, если препятствие будет устранено. + +rope boxes can hold @1m of rope.=Ящики для веревок вмещают до 1 м веревки. +rope boxes can hold rope lengths from @1m to @2m.=Ящики для веревок могут вмещать веревки длиной от @1 до @2 метров. + +### doc.lua ### +### ropeboxes.lua ### + +Copper=Медный +Steel=Стальной +Wood=Древесный + +### extendingladder.lua ### + +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Steel Extendable Ladder=Стальная раздвижная лестница +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Steel Ladder=Стальная лестница +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Extendable Ladder=Деревянная раздвижная лестница +#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE +Wooden Ladder=Деревянная лестница + +### ropeboxes.lua ### + +@1 Ropebox @2m=@1 веревочный ящик @2м +Rope=Веревка + +### ropeladder.lua ### + +Rope Ladder=Веревочная лестница diff --git a/mods/ropes/locale/template.txt b/mods/ropes/locale/template.txt new file mode 100644 index 00000000..620d0ee3 --- /dev/null +++ b/mods/ropes/locale/template.txt @@ -0,0 +1,62 @@ +# textdomain: ropes + + +### bridge.lua ### + +Wooden Bridge= + +### crafts.lua ### + +Rope Segment= + +### doc.lua ### + +A hanging rope ladder that automatically extends downward.= + +A ladder for climbing. It can reach greater heights when placed against a supporting block.= + +A rope can be severed midway using an axe or other similar tool. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope "remembers" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permanently lost when a rope is severed like this.= + +A wooden platform with support struts useful for bridging gaps.= + +After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (@1 meters). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before.= + +Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.= + +Rope boxes have a certain amount of rope contained within them specified in the name of the node, and have a limit to how much rope they can support that depends on the material they're made of. The different lengths can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @1m rope box by putting a @2m rope box and a rope segment in the crafting grid, or a @3m rope box and two rope segments in the crafting grid. Two rope segments can be recovered by putting the @4m rope box in the crafting grid by itself.= + +Rope segments are bundles of fibre twisted into robust cables.= + +Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut.= + +This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.= + +This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon.= + +When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.= + +rope boxes can hold @1m of rope.= +rope boxes can hold rope lengths from @1m to @2m.= + +### doc.lua ### +### ropeboxes.lua ### + +Copper= +Steel= +Wood= + +### extendingladder.lua ### + +Steel Extendable Ladder= +Steel Ladder= +Wooden Extendable Ladder= +Wooden Ladder= + +### ropeboxes.lua ### + +@1 Ropebox @2m= +Rope= + +### ropeladder.lua ### + +Rope Ladder= diff --git a/mods/ropes/loot.lua b/mods/ropes/loot.lua new file mode 100644 index 00000000..ed512be2 --- /dev/null +++ b/mods/ropes/loot.lua @@ -0,0 +1,56 @@ +if not minetest.get_modpath("loot") then + return +end + +loot.register_loot({ + weights = { generic = 300 }, + payload = { + stack = ItemStack("ropes:ropesegment"), + min_size = 1, + max_size = 50, + }, +}) + +if ropes.ropeLadderLength > 0 then +loot.register_loot({ + weights = { generic = 150 }, + payload = { + stack = ItemStack("ropes:ropeladder_top"), + min_size = 1, + max_size = 20, + }, +}) +end + +if ropes.woodRopeBoxMaxMultiple > 0 then +loot.register_loot({ + weights = { generic = 100 }, + payload = { + stack = ItemStack("ropes:wood1rope_block"), + min_size = 1, + max_size = 20, + }, +}) +end + +if ropes.copperRopeBoxMaxMultiple > 0 then +loot.register_loot({ + weights = { generic = 75 }, + payload = { + stack = ItemStack("ropes:copper1rope_block"), + min_size = 1, + max_size = 15, + }, +}) +end + +if ropes.steelRopeBoxMaxMultiple > 0 then +loot.register_loot({ + weights = { generic = 50 }, + payload = { + stack = ItemStack("ropes:steel1rope_block"), + min_size = 1, + max_size = 10, + }, +}) +end \ No newline at end of file diff --git a/mods/ropes/mod.conf b/mods/ropes/mod.conf new file mode 100644 index 00000000..5ca16dc2 --- /dev/null +++ b/mods/ropes/mod.conf @@ -0,0 +1,7 @@ +name = ropes +description = Adds rope boxes and ladders +depends = default +optional_depends = cottages, doc, farming, hemp, loot, vines +release = 29152 +author = FaceDeer +title = Ropes diff --git a/mods/ropes/ropeboxes.lua b/mods/ropes/ropeboxes.lua new file mode 100644 index 00000000..79d60724 --- /dev/null +++ b/mods/ropes/ropeboxes.lua @@ -0,0 +1,363 @@ +-- internationalization boilerplate +local S = ropes.S + +local function rope_box_tiles(count, tint) + return { + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint), + string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + } +end + +local rope_box_data = { +{ + node={ + {-0.125, -0.125, -0.25, 0.125, 0.125, 0.25}, -- pulley + {-0.125, -0.25, -0.125, 0.125, 0.25, 0.125}, -- pulley + {-0.125, -0.1875, -0.1875, 0.125, 0.1875, 0.1875}, -- pulley_core + {-0.1875, -0.5, -0.125, -0.125, 0.125, 0.125}, -- support + {0.125, -0.5, -0.125, 0.1875, 0.125, 0.125}, -- support + }, + --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection + tiles = 1, +}, +{ + node={ + {-0.1875, -0.125, -0.25, 0.1875, 0.125, 0.25}, -- pulley + {-0.1875, -0.25, -0.125, 0.1875, 0.25, 0.125}, -- pulley + {-0.1875, -0.1875, -0.1875, 0.1875, 0.1875, 0.1875}, -- pulley_core + {-0.25, -0.5, -0.125, -0.1875, 0.125, 0.125}, -- support + {0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support + }, + --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection + tiles = 2, +}, +{ + node={ + {-0.25, -0.125, -0.25, 0.25, 0.125, 0.25}, -- pulley + {-0.25, -0.25, -0.125, 0.25, 0.25, 0.125}, -- pulley + {-0.25, -0.1875, -0.1875, 0.25, 0.1875, 0.1875}, -- pulley_core + {-0.3125, -0.5, -0.125, -0.25, 0.125, 0.125}, -- support + {0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support + }, + --selection = {-0.3125, -0.5, -0.25, 0.3125, 0.25, 0.25}, -- selection + tiles = 3, +}, +{ + node={ + {-0.3125, -0.125, -0.25, 0.3125, 0.125, 0.25}, -- pulley + {-0.3125, -0.25, -0.125, 0.3125, 0.25, 0.125}, -- pulley + {-0.3125, -0.1875, -0.1875, 0.3125, 0.1875, 0.1875}, -- pulley_core + {-0.375, -0.5, -0.125, -0.3125, 0.125, 0.125}, -- support + {0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support + }, + --selection = {-0.375, -0.5, -0.25, 0.375, 0.25, 0.25}, -- selection + tiles = 4, +}, +{ + node={ + {-0.375, -0.125, -0.25, 0.375, 0.125, 0.25}, -- pulley + {-0.375, -0.25, -0.125, 0.375, 0.25, 0.125}, -- pulley + {-0.375, -0.1875, -0.1875, 0.375, 0.1875, 0.1875}, -- pulley_core + {-0.4375, -0.5, -0.125, -0.375, 0.125, 0.125}, -- support + {0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support + }, + --selection = {-0.4375, -0.5, -0.25, 0.4375, 0.25, 0.25}, -- selection + tiles = 5, +}, +{ + node={ + {-0.1875, -0.1875, -0.3125, 0.1875, 0.1875, 0.3125}, -- pulley + {-0.1875, -0.3125, -0.1875, 0.1875, 0.3125, 0.1875}, -- pulley + {-0.1875, -0.25, -0.25, 0.1875, 0.25, 0.25}, -- pulley_core + {-0.25, -0.5, -0.125, -0.1875, 0.125, 0.125}, -- support + {0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support + }, + --selection = {-0.1875, -0.5, -0.3125, 0.1875, 0.3125, 0.3125}, -- selection + tiles = 2, +}, +{ + node={ + {-0.25, -0.1875, -0.3125, 0.25, 0.1875, 0.3125}, -- pulley + {-0.25, -0.3125, -0.1875, 0.25, 0.3125, 0.1875}, -- pulley + {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, -- pulley_core + {-0.3125, -0.5, -0.125, -0.25, 0.125, 0.125}, -- support + {0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support + }, + --selection = {-0.3125, -0.5, -0.3125, 0.3125, 0.3125, 0.3125}, -- selection + tiles = 3, +}, +{ + node={ + {-0.3125, -0.1875, -0.3125, 0.3125, 0.1875, 0.3125}, -- pulley + {-0.3125, -0.3125, -0.1875, 0.3125, 0.3125, 0.1875}, -- pulley + {-0.3125, -0.25, -0.25, 0.3125, 0.25, 0.25}, -- pulley_core + {-0.375, -0.5, -0.125, -0.3125, 0.125, 0.125}, -- support + {0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support + }, + --selection = {-0.375, -0.5, -0.3125, 0.375, 0.3125, 0.3125}, -- selection + tiles = 4, +}, +{ + node={ + {-0.375, -0.1875, -0.3125, 0.375, 0.1875, 0.3125}, -- pulley + {-0.375, -0.3125, -0.1875, 0.375, 0.3125, 0.1875}, -- pulley + {-0.375, -0.25, -0.25, 0.375, 0.25, 0.25}, -- pulley_core + {-0.4375, -0.5, -0.125, -0.375, 0.125, 0.125}, -- support + {0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support + }, + --selection_bottom = {-0.4375, -0.5, -0.3125, 0.4375, 0.3125, 0.3125}, -- selection + tiles = 5, +} +} + +local function register_rope_block(multiple, max_multiple, name_prefix, node_prefix, tint, flammable) + local node_name = string.format("ropes:%s%irope_block", node_prefix, multiple) + local rope_block_def = { + description = S("@1 Ropebox @2m", name_prefix, ropes.ropeLength*multiple), + _doc_items_create_entry = false, + drawtype="nodebox", + sunlight_propagates = true, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + tiles = rope_box_tiles(rope_box_data[multiple].tiles, tint), + use_texture_alpha = "clip", + is_ground_content = false, + node_box = { + type = "fixed", + fixed = rope_box_data[multiple].node + }, + selection_box = {type="regular"}, + collision_box = {type="regular"}, + groups = {attached_node = 1, choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, + + after_place_node = function(pos, placer) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + local placer_name = placer:get_player_name() + + if minetest.is_protected(pos_below, placer_name) and not minetest.check_player_privs(placer, "protection_bypass") then + return + end + + local node_below = minetest.get_node(pos_below) + if ropes.can_place_rope_in_node(node_below.name) then + minetest.add_node(pos_below, {name="ropes:rope_bottom"}) + local meta = minetest.get_meta(pos_below) + meta:set_int("length_remaining", ropes.ropeLength*multiple) + meta:set_string("placer", placer:get_player_name()) + end + end, + + after_destruct = function(pos) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + ropes.destroy_rope(pos_below, {'ropes:rope', 'ropes:rope_bottom'}) + end + } + + -- If this number is higher than permitted, we still want to register the block (in case + -- some were already placed in-world) but we want to hide it from creative inventory + -- and if someone digs it we want to disintegrate it into its component parts to prevent + -- reuse. + if multiple > max_multiple then + rope_block_def.groups.not_in_creative_inventory = 1 + rope_block_def.drop = string.format("ropes:%s1rope_block %i", node_prefix, multiple) + end + + if flammable then + rope_block_def.groups.flammable = flammable + + minetest.register_craft({ + type = "fuel", + recipe = node_name, + burntime = ropes.rope_burn_time * multiple + ropes.wood_burn_time, + }) + end + + minetest.register_node(node_name, rope_block_def) + + if (multiple ~= 1) then + -- Only register a recipe to craft this if it's within the permitted multiple range + if multiple <= max_multiple then + for i = 1, multiple-1 do + local rec = {string.format("ropes:%s%irope_block", node_prefix, i)} + for n = 1, multiple-i do + table.insert(rec, "ropes:ropesegment") + end + minetest.register_craft({ + output = node_name, + type = "shapeless", + recipe = rec + }) + end + end + + -- Always allow players to disintegrate this into component parts, in case + -- there were some in inventory and the setting was changed. + minetest.register_craft({ + output = "ropes:ropesegment", + type = "shapeless", + recipe = { + node_name + }, + replacements = { + {node_name, string.format('ropes:%s%irope_block', node_prefix, multiple-1)}, + }, + }) + end + + if minetest.get_modpath("doc") then + doc.add_entry_alias("nodes", "ropes:rope", "nodes", node_name) + end +end + +local rope_def = { + description = S("Rope"), + _doc_items_longdesc = ropes.doc.ropebox_longdesc, + _doc_items_usagehelp = ropes.doc.ropebox_usage, + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + drop = "", + tiles = { "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_5.png", "ropes_5.png" }, + use_texture_alpha = "clip", + is_ground_content = false, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = { + footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6}, + dig = "__group", + dug = "__group", + }, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {-1/16, -1/2, -1/16, 1/16, 1/2, 1/16}, + connect_top = {-1/16, 1/2, -1/16, 1/16, 3/4, 1/16} + }, + connects_to = {"group:rope_block"}, + connect_sides = {"top"}, + selection_box = { + type = "fixed", + fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}, + }, + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:rope_top", "ropes:rope", "ropes:rope_bottom") + end, +} + +local rope_extension_timer = ropes.make_rope_on_timer("ropes:rope") + +local rope_bottom_def = { + description = S("Rope"), + _doc_items_create_entry = false, + walkable = false, + climbable = true, + sunlight_propagates = true, + paramtype = "light", + drop = "", + tiles = { "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_5.png", "ropes_5.png" }, + use_texture_alpha = "clip", + is_ground_content = false, + drawtype = "nodebox", + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = { + footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6}, + dig = "__group", + dug = "__group", + }, + node_box = { + type = "connected", + fixed = { + {-1/16, -3/8, -1/16, 1/16, 1/2, 1/16}, + {-2/16, -5/16, -2/16, 2/16, -1/16, 2/16}, + }, + connect_top = {-1/16, 1/2, -1/16, 1/16, 3/4, 1/16} + }, + connects_to = {"group:rope_block"}, + connect_sides = {"top"}, + selection_box = { + type = "fixed", + fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}, + }, + + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + + on_timer = rope_extension_timer, + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:rope_top", "ropes:rope", "ropes:rope_bottom") + end, +} + +minetest.register_node("ropes:rope", rope_def) +minetest.register_node("ropes:rope_bottom", rope_bottom_def) + +if ropes.woodRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.woodRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:wood1rope_block", + recipe = { + {'group:wood'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.woodRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.woodRopeBoxMaxMultiple, S("Wood"), "wood", "#86683a", 2) + end + end +end + +if ropes.copperRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.copperRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:copper1rope_block", + recipe = { + {'default:copper_ingot'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.copperRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.copperRopeBoxMaxMultiple, S("Copper"), "copper", "#c88648") + end + end +end + +if ropes.steelRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.steelRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:steel1rope_block", + recipe = { + {'default:steel_ingot'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.steelRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.steelRopeBoxMaxMultiple, S("Steel"), "steel", "#ffffff") + end + end +end diff --git a/mods/ropes/ropeladder.lua b/mods/ropes/ropeladder.lua new file mode 100644 index 00000000..d805a16c --- /dev/null +++ b/mods/ropes/ropeladder.lua @@ -0,0 +1,193 @@ +if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then + return +end + +local S = ropes.S + +if ropes.ropeLadderLength > 0 then + minetest.register_craft({ + output = "ropes:ropeladder_top", + recipe = { + {'','group:stick',''}, + {'group:vines','group:stick','group:vines'}, + {'','group:stick',''}, + } + }) +end + +minetest.register_craft({ + type = "fuel", + recipe = "ropes:ropeladder_top", + burntime = ropes.ladder_burn_time, +}) + +local rope_ladder_top_def = { + description = S("Rope Ladder"), + _doc_items_longdesc = ropes.doc.ropeladder_longdesc, + _doc_items_usagehelp = ropes.doc.ropeladder_usage, + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"}, + use_texture_alpha = "clip", + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder_top.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder_top.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, + + after_place_node = function(pos, placer) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + local node_below = minetest.get_node(pos_below) + local this_node = minetest.get_node(pos) + local placer_name = placer:get_player_name() + -- param2 holds the facing direction of this node. If it's 0 or 1 the node is "flat" and we don't want the ladder to extend. + if ropes.can_place_rope_in_node(node_below.name) and this_node.param2 > 1 + and (not minetest.is_protected(pos_below, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then + minetest.add_node(pos_below, {name="ropes:ropeladder_bottom", param2=this_node.param2}) + local meta = minetest.get_meta(pos_below) + meta:set_int("length_remaining", ropes.ropeLadderLength) + meta:set_string("placer", placer_name) + end + end, + after_destruct = function(pos) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"}) + end, +} + +if ropes.ropeLadderLength == 0 then + rope_ladder_top_def.groups.not_in_creative_inventory = 1 +end + +minetest.register_node("ropes:ropeladder_top", rope_ladder_top_def) + +minetest.register_node("ropes:ropeladder", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + use_texture_alpha = "clip", + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +local ladder_extender = ropes.make_rope_on_timer("ropes:ropeladder") + +minetest.register_node("ropes:ropeladder_bottom", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"}, + use_texture_alpha = "clip", + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = ladder_extender, + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +minetest.register_node("ropes:ropeladder_falling", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + use_texture_alpha = "clip", + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = function( pos, elapsed ) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + local node_below = minetest.get_node(pos_below) + + if (node_below.name ~= "ignore") then + ropes.destroy_rope(pos_below, {'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling'}) + minetest.swap_node(pos, {name="air"}) + else + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end + end +}) diff --git a/mods/ropes/screenshot.png b/mods/ropes/screenshot.png new file mode 100644 index 00000000..1366a4f2 Binary files /dev/null and b/mods/ropes/screenshot.png differ diff --git a/mods/ropes/settingtypes.txt b/mods/ropes/settingtypes.txt new file mode 100644 index 00000000..87faf737 --- /dev/null +++ b/mods/ropes/settingtypes.txt @@ -0,0 +1,58 @@ +#The shortest rope will extend for this many meters. Longer ropes come in +#multiples of this length. +#Changing this value will not affect ropes that already exist in-world. +ropes_rope_length (Rope length) int 50 1 30000 + +#Rope ladders will extend this far at maximum. +#Changing this value will not affect rope ladders that already exist in-world. +#Setting this to 0 disables rope ladders. +ropes_rope_ladder_length (Rope ladder length) int 50 0 30000 + +#Sets the maximum length multiple wooden rope box permitted to be crafted. +#So for example if the rope length is set to 50 and this is set to 2, +#the longest possible wooden rope box a player can craft has 100 meters of rope. +#Allowed values run from 0 to 9. 0 disables wood rope boxes. +ropes_wood_rope_box_max_multiple (Maximum wood_rope box multiple) int 2 0 9 + +#Sets the maximum length multiple copper rope box permitted to be crafted. +#So for example if the rope length is set to 50 and this is set to 5, +#the longest possible copper rope box a player can craft has 250 meters of rope. +#Allowed values run from 0 to 9. 0 disables copper rope boxes. +ropes_copper_rope_box_max_multiple (Maximum copper rope box multiple) int 5 0 9 + +#Sets the maximum length multiple steel rope box permitted to be crafted. +#So for example if the rope length is set to 50 and this is set to 9, +#the longest possible steel rope box a player can craft has 450 meters of rope. +#Allowed values run from 0 to 9. 0 disables steel rope boxes. +ropes_steel_rope_box_max_multiple (Maximum steel rope box multiple) int 9 0 9 + +#If this is set to true, then the mod will generate definitions for the rope boxes +#that are otherwise not permitted by the settings above. These rope boxes +#will not be craftable and will not be available in the creative inventory, +#but they will continue to exist if they were placed "in world" and a player +#can deconstruct them to retrieve their rope components. This setting is +#intended for the situation where you have an established world and you want +#to reduce the number of rope boxes available to players without turning +#existing rope boxes into "unknown node"s. +ropes_create_all_definitions (Create all rope box definitions) bool false + +#Extending ladders are capable of standing on their own, to a defined limit. +#A ladder can extend to its unsupported limit before needing another node +#behind it to provide a new point of support. Right-clicking on an existing +#ladder with a stack of ladders will add new ladder segments to its top. +ropes_extending_ladder_enabled (Enable extendable ladders) bool true + +#If extending ladders are enabled, this setting will cause them to replace +#the default ladders entirely. +ropes_replace_default_ladders (Replace default ladders with extendable ladders) bool false + +ropes_extending_wood_ladder_limit (Unsupported limit of wooden ladders) int 5 +ropes_extending_steel_ladder_limit (Unsupported limit of steel ladders) int 15 + +#These nodes make it easier to build bridges by extending out away +#from the player as they're placed +ropes_bridges_enabled (Enable bridges) bool true + +#Allows ropes and rope ladders to extend into all "airlike" nodes. +#Note that ropes will leave "air" nodes behind when destroyed. +ropes_can_extend_into_airlike (Ropes can extend into all nodes with drawtype airlike) bool false \ No newline at end of file diff --git a/mods/ropes/sounds/license.txt b/mods/ropes/sounds/license.txt new file mode 100644 index 00000000..c5f29d02 --- /dev/null +++ b/mods/ropes/sounds/license.txt @@ -0,0 +1 @@ +ropes_creak.ogg - by jergonda from https://www.freesound.org/people/jergonda/sounds/254735/ under public domain via CC 0 \ No newline at end of file diff --git a/mods/ropes/sounds/ropes_creak.1.ogg b/mods/ropes/sounds/ropes_creak.1.ogg new file mode 100644 index 00000000..c6f1b688 Binary files /dev/null and b/mods/ropes/sounds/ropes_creak.1.ogg differ diff --git a/mods/ropes/sounds/ropes_creak.2.ogg b/mods/ropes/sounds/ropes_creak.2.ogg new file mode 100644 index 00000000..c0b13599 Binary files /dev/null and b/mods/ropes/sounds/ropes_creak.2.ogg differ diff --git a/mods/ropes/sounds/ropes_creak.3.ogg b/mods/ropes/sounds/ropes_creak.3.ogg new file mode 100644 index 00000000..d7a4c964 Binary files /dev/null and b/mods/ropes/sounds/ropes_creak.3.ogg differ diff --git a/mods/ropes/textures/ropes_1.png b/mods/ropes/textures/ropes_1.png new file mode 100644 index 00000000..7529284d Binary files /dev/null and b/mods/ropes/textures/ropes_1.png differ diff --git a/mods/ropes/textures/ropes_2.png b/mods/ropes/textures/ropes_2.png new file mode 100644 index 00000000..c414df8e Binary files /dev/null and b/mods/ropes/textures/ropes_2.png differ diff --git a/mods/ropes/textures/ropes_3.png b/mods/ropes/textures/ropes_3.png new file mode 100644 index 00000000..c24ddc92 Binary files /dev/null and b/mods/ropes/textures/ropes_3.png differ diff --git a/mods/ropes/textures/ropes_4.png b/mods/ropes/textures/ropes_4.png new file mode 100644 index 00000000..ff3febe7 Binary files /dev/null and b/mods/ropes/textures/ropes_4.png differ diff --git a/mods/ropes/textures/ropes_5.png b/mods/ropes/textures/ropes_5.png new file mode 100644 index 00000000..85b045b2 Binary files /dev/null and b/mods/ropes/textures/ropes_5.png differ diff --git a/mods/ropes/textures/ropes_item.png b/mods/ropes/textures/ropes_item.png new file mode 100644 index 00000000..6f53f82e Binary files /dev/null and b/mods/ropes/textures/ropes_item.png differ diff --git a/mods/ropes/textures/ropes_ropebox_front_1.png b/mods/ropes/textures/ropes_ropebox_front_1.png new file mode 100644 index 00000000..4d8e5a0d Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_front_1.png differ diff --git a/mods/ropes/textures/ropes_ropebox_front_2.png b/mods/ropes/textures/ropes_ropebox_front_2.png new file mode 100644 index 00000000..0350bf8b Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_front_2.png differ diff --git a/mods/ropes/textures/ropes_ropebox_front_3.png b/mods/ropes/textures/ropes_ropebox_front_3.png new file mode 100644 index 00000000..c20de2f9 Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_front_3.png differ diff --git a/mods/ropes/textures/ropes_ropebox_front_4.png b/mods/ropes/textures/ropes_ropebox_front_4.png new file mode 100644 index 00000000..32ebe460 Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_front_4.png differ diff --git a/mods/ropes/textures/ropes_ropebox_front_5.png b/mods/ropes/textures/ropes_ropebox_front_5.png new file mode 100644 index 00000000..bb8305f4 Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_front_5.png differ diff --git a/mods/ropes/textures/ropes_ropebox_side.png b/mods/ropes/textures/ropes_ropebox_side.png new file mode 100644 index 00000000..fda8d543 Binary files /dev/null and b/mods/ropes/textures/ropes_ropebox_side.png differ diff --git a/mods/ropes/textures/ropes_ropeladder.png b/mods/ropes/textures/ropes_ropeladder.png new file mode 100644 index 00000000..e27a55c4 Binary files /dev/null and b/mods/ropes/textures/ropes_ropeladder.png differ diff --git a/mods/ropes/textures/ropes_ropeladder_bottom.png b/mods/ropes/textures/ropes_ropeladder_bottom.png new file mode 100644 index 00000000..71f91b0f Binary files /dev/null and b/mods/ropes/textures/ropes_ropeladder_bottom.png differ diff --git a/mods/ropes/textures/ropes_ropeladder_overlay.png b/mods/ropes/textures/ropes_ropeladder_overlay.png new file mode 100644 index 00000000..7fd285f6 Binary files /dev/null and b/mods/ropes/textures/ropes_ropeladder_overlay.png differ diff --git a/mods/ropes/textures/ropes_ropeladder_top.png b/mods/ropes/textures/ropes_ropeladder_top.png new file mode 100644 index 00000000..81a31ce8 Binary files /dev/null and b/mods/ropes/textures/ropes_ropeladder_top.png differ diff --git a/mods/sandwiches/init.lua b/mods/sandwiches/init.lua index d322f41c..ac9f2b51 100644 --- a/mods/sandwiches/init.lua +++ b/mods/sandwiches/init.lua @@ -115,7 +115,6 @@ if minetest.get_modpath("moretrees") and sandwiches.ingredient_support.choco the dofile(sandwiches.path .. "/luas/nutella.lua") end - if minetest.get_modpath("bushes_classic") or sandwiches.ingredient_support.berry then -- BREAD PUDDING -- diff --git a/mods/sandwiches/luas/bbq.lua b/mods/sandwiches/luas/bbq.lua index b38a661f..7abec8d7 100644 --- a/mods/sandwiches/luas/bbq.lua +++ b/mods/sandwiches/luas/bbq.lua @@ -4,7 +4,7 @@ if minetest.global_exists("farming") and farming.mod == "redo" then -- need pe minetest.register_craftitem("sandwiches:hamwich", { description = "Hamwich", on_use = minetest.item_eat(11, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 11}, inventory_image = "hamwich.png" }) minetest.register_craft({ @@ -21,7 +21,7 @@ end minetest.register_craftitem("sandwiches:jerky_sandwich", { description = "Jerky sandwich", on_use = minetest.item_eat(11, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 11}, inventory_image = "jerky_sandwich.png" }) minetest.register_craft({ diff --git a/mods/sandwiches/luas/cucina_vegana.lua b/mods/sandwiches/luas/cucina_vegana.lua index cf1b59ca..731023ef 100644 --- a/mods/sandwiches/luas/cucina_vegana.lua +++ b/mods/sandwiches/luas/cucina_vegana.lua @@ -10,7 +10,7 @@ end minetest.register_craftitem("sandwiches:tasty_asparagus_sandwich", { description = "Tasty asparagus sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food = 7, food_sandwich = 1, food_vegan = 1}, + groups = {food = 7, food_sandwich = 1, food_vegan = 1, eatable = 7}, inventory_image = "tasty_asparagus_sandwich.png" }) minetest.register_craft({ @@ -27,7 +27,7 @@ if sandwiches.ingredient_support.meat then minetest.register_craftitem("sandwiches:ham_and_asparagus_sandwich", { description = "Ham and asparagus sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food = 7, food_sandwich = 1}, + groups = {food = 7, food_sandwich = 1, eatable = 7}, inventory_image = "ham_and_asparagus_sandwich.png" }) minetest.register_craft({ @@ -42,7 +42,7 @@ if sandwiches.ingredient_support.meat then minetest.register_craftitem("sandwiches:club_sandwich", { description = "Club sandwich", on_use = minetest.item_eat(18, "sandwiches:bread_crumbs"), - groups = {food = 18, food_sandwich = 1, }, + groups = {food = 18, food_sandwich = 1, eatable = 18}, inventory_image = "club_sandwich.png" }) minetest.register_craft({ @@ -60,7 +60,7 @@ end -- if ham is present minetest.register_craftitem("sandwiches:tasty_tofu_sandwich", { description = "Tofu and asparagus sandwich", on_use = minetest.item_eat(8, "sandwiches:bread_crumbs"), - groups = {food = 8, food_sandwich = 1, food_vegan = 1}, + groups = {food = 8, food_sandwich = 1, food_vegan = 1, eatable = 8}, inventory_image = "tasty_tofu_sandwich.png" }) minetest.register_craft({ @@ -75,7 +75,7 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:tofu_sandwich", { description = "Tofu sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food = 7, food_sandwich = 1, food_vegan = 1}, + groups = {food = 7, food_sandwich = 1, food_vegan = 1, eatable = 7}, inventory_image = "tofu_sandwich.png" }) @@ -91,7 +91,7 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:gourmet_sandwich", { description = "Gourmet sandwich", on_use = minetest.item_eat(12, "sandwiches:bread_crumbs"), - groups = {food = 12, food_sandwich = 1}, + groups = {food = 12, food_sandwich = 1, eatable = 12}, inventory_image = "gourmet_vegan_sandwich.png" }) minetest.register_alias("sandwiches:gourmet_meat_sandwich", "sandwiches:gourmet_sandwich") diff --git a/mods/sandwiches/luas/ethereal.lua b/mods/sandwiches/luas/ethereal.lua index 4e82c7fa..919664f9 100644 --- a/mods/sandwiches/luas/ethereal.lua +++ b/mods/sandwiches/luas/ethereal.lua @@ -3,28 +3,28 @@ minetest.register_craftitem("sandwiches:strawberry_jam", { description = "Strawberry jam", on_use = minetest.item_eat(2), - groups = {food_jam = 1, }, + groups = {food_jam = 1, eatable = 2}, inventory_image = "strawberry_jam.png" }) minetest.register_craftitem("sandwiches:strawberry_jam_sandwich", { description = "Strawberry Jam Sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 7}, inventory_image = "strawberry_jam_sandwich.png" }) minetest.register_craftitem("sandwiches:banana_and_chocolate_sandwich", { description = "Banana and chocolate sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 7}, inventory_image = "banana_and_chocolate_sandwich.png" }) minetest.register_craftitem("sandwiches:elvis_sandwich", { description = "Elvis sandwich", on_use = minetest.item_eat(8, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 8}, inventory_image = "elvis_sandwich.png" }) diff --git a/mods/sandwiches/luas/fish.lua b/mods/sandwiches/luas/fish.lua index f0eecb51..497f66d0 100644 --- a/mods/sandwiches/luas/fish.lua +++ b/mods/sandwiches/luas/fish.lua @@ -1,7 +1,7 @@ minetest.register_craftitem("sandwiches:cooked_salmon", { description = "Cooked Salmon", on_use = minetest.item_eat(4), - groups = {food = 4, food_fish_cooked = 1, food_salmon = 1, flammable = 1}, + groups = {food = 4, food_fish_cooked = 1, food_salmon = 1, flammable = 1, eatable = 4}, inventory_image = "sandwiches_salmon_cooked.png" }) minetest.register_craft({ @@ -21,7 +21,7 @@ if minetest.global_exists("farming") and farming.mod == "redo" then minetest.register_craftitem("sandwiches:lox_sandwich", { description = "Lox sandwich", on_use = minetest.item_eat(12, "sandwiches:bread_crumbs"), - groups = {food = 12, food_sandwich = 1, flammable = 1}, + groups = {food = 12, food_sandwich = 1, flammable = 1, eatable = 12}, inventory_image = "lox_sandwich.png" }) minetest.register_craft({ @@ -40,7 +40,7 @@ if sandwiches.ingredient_support.meat then minetest.register_craftitem("sandwiches:cooked_trout", { description = "Cooked Trout", on_use = minetest.item_eat(4), - groups = {food = 4, food_fish_cooked = 1, food_trout = 1, flammable = 1}, + groups = {food = 4, food_fish_cooked = 1, food_trout = 1, flammable = 1, eatable = 4}, inventory_image = "sandwiches_trout_cooked.png" }) minetest.register_craft({ @@ -53,7 +53,7 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:trout_sandwich", { description = "Trout sandwich", on_use = minetest.item_eat(13, "sandwiches:bread_crumbs"), - groups = {food = 13, food_sandwich = 1, flammable = 1}, + groups = {food = 13, food_sandwich = 1, flammable = 1, eatable = 13}, inventory_image = "trout_sandwich.png" }) minetest.register_craft({ diff --git a/mods/sandwiches/luas/meat.lua b/mods/sandwiches/luas/meat.lua index cadf0958..09c08b84 100644 --- a/mods/sandwiches/luas/meat.lua +++ b/mods/sandwiches/luas/meat.lua @@ -6,14 +6,14 @@ end minetest.register_craftitem("sandwiches:ham", { description = "Ham", on_use = minetest.item_eat(3), - groups = {food = 3, food_ham = 1, food_meat = 1, flammable = 1}, + groups = {food = 3, food_ham = 1, food_meat = 1, flammable = 1, eatable = 3}, inventory_image = "sandwiches_ham.png" }) minetest.register_craftitem("sandwiches:chicken_strips", { description = "Chicken strips", on_use = minetest.item_eat(2), - groups = {food = 2, food_chicken_strips = 1, food_meat = 1, flammable = 1}, + groups = {food = 2, food_chicken_strips = 1, food_meat = 1, flammable = 1, eatable = 2}, inventory_image = "sandwiches_chicken_strips.png" }) minetest.register_craft({ @@ -26,13 +26,13 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:raw_bacon", { description = "Raw Bacon", on_use = minetest.item_eat(1), - groups = {food = 1, food_bacon_raw = 1, food_meat = 1, flammable = 1}, + groups = {food = 1, food_bacon_raw = 1, food_meat = 1, flammable = 1, eatable = 1}, inventory_image = "sandwiches_raw_bacon.png" }) minetest.register_craftitem("sandwiches:crispy_bacon", { description = "Crispy Bacon", on_use = minetest.item_eat(3), - groups = {food = 3, food_bacon = 1, food_meat = 1, flammable = 1}, + groups = {food = 3, food_bacon = 1, food_meat = 1, flammable = 1, eatable = 3}, inventory_image = "sandwiches_crispy_bacon.png" }) minetest.register_craft({ diff --git a/mods/sandwiches/luas/nutella.lua b/mods/sandwiches/luas/nutella.lua index 125a8fd1..1c2a7d08 100644 --- a/mods/sandwiches/luas/nutella.lua +++ b/mods/sandwiches/luas/nutella.lua @@ -15,14 +15,14 @@ minetest.register_node("sandwiches:noyella_block", { minetest.register_craftitem("sandwiches:noyella_sandwich", { description = "noyella sandwich", on_use = minetest.item_eat(8, "sandwiches:bread_crumbs"), - groups = {food_sandwich = 1}, + groups = {food_sandwich = 1, eatable = 8}, inventory_image = "noyella_sandwich.png" }) minetest.register_craftitem("sandwiches:noyella_spread", { description = "Noyella spread", on_use = minetest.item_eat(2), - groups = {food_nutella = 1, food_noyella = 1, food_chocolate_spead = 1, flammable = 1}, + groups = {food_nutella = 1, food_noyella = 1, food_chocolate_spead = 1, flammable = 1, eatable = 2}, inventory_image = "noyella_spread.png" }) diff --git a/mods/sandwiches/luas/toasts.lua b/mods/sandwiches/luas/toasts.lua index bb4b2e96..68c4aa1e 100644 --- a/mods/sandwiches/luas/toasts.lua +++ b/mods/sandwiches/luas/toasts.lua @@ -10,7 +10,7 @@ end minetest.register_craftitem("sandwiches:grilled_hot_cheesy_sandwich", { description = "Grilled hot cheese sandwich", on_use = minetest.item_eat(10, "sandwiches:bread_crumbs"), - groups = {food = 10, food_sandwich = 1, food_toasted = 1}, + groups = {food = 10, food_sandwich = 1, food_toasted = 1, eatable = 10}, inventory_image = "grilled_hot_cheesy_sandwich.png" }) minetest.register_craft({ @@ -27,7 +27,7 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:garlic_bread", { description = "Garlic bread", on_use = minetest.item_eat(4, "sandwiches:bread_crumbs"), - groups = {food = 4, food_garlic_bread = 1}, + groups = {food = 4, food_garlic_bread = 1, eatable = 4}, inventory_image = "sandwiches_garlic_bread_slice.png" }) minetest.register_craft({ @@ -43,9 +43,10 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:tasty_garlic_sandwich", { description = "Tasty garlic sandwich", on_use = minetest.item_eat(16, "sandwiches:bread_crumbs"), - groups = {food = 16, food_sandwich = 1, food_toasted = 1}, + groups = {food = 16, food_sandwich = 1, food_toasted = 1, eatable = 16}, inventory_image = "tasty_garlic_sandwich.png" }) + minetest.register_craft({ output = "sandwiches:tasty_garlic_sandwich", recipe = { @@ -58,7 +59,7 @@ minetest.register_craft({ minetest.register_craftitem("sandwiches:fancy_garlic_sandwich", { description = "Fancy garlic sandwich", on_use = minetest.item_eat(18, "sandwiches:bread_crumbs"), - groups = {food = 18, food_sandwich = 1, food_toasted = 1}, + groups = {food = 18, food_sandwich = 1, food_toasted = 1, eatable = 18}, inventory_image = "fancy_garlic_sandwich.png" }) minetest.register_craft({ @@ -81,7 +82,7 @@ if minetest.registered_items["sandwiches:ham"] then minetest.register_craftitem("sandwiches:croque_monsieur", { description = "Croque Monsier", on_use = minetest.item_eat(13, "sandwiches:bread_crumbs"), - groups = {food = 13, food_sandwich = 1, food_toasted = 1}, + groups = {food = 13, food_sandwich = 1, food_toasted = 1, eatable = 13}, inventory_image = "croque_monsieur.png" }) minetest.register_craft({ @@ -101,7 +102,7 @@ if minetest.registered_items["sandwiches:chicken_strips"] then minetest.register_craftitem("sandwiches:croque_madame", { description = "Croque madame", on_use = minetest.item_eat(16, "sandwiches:bread_crumbs"), - groups = {food = 16, food_sandwich = 1, food_toasted = 1}, + groups = {food = 16, food_sandwich = 1, food_toasted = 1, eatable = 16}, inventory_image = "croque_madame.png" }) minetest.register_craft({ diff --git a/mods/sandwiches/luas/xfarming.lua b/mods/sandwiches/luas/xfarming.lua index 9017aacb..1522d0fc 100644 --- a/mods/sandwiches/luas/xfarming.lua +++ b/mods/sandwiches/luas/xfarming.lua @@ -18,7 +18,7 @@ minetest.register_craftitem("sandwiches:po_boy_sandwich", { description = "Po\'boy sandwich", on_use = minetest.item_eat(7, "sandwiches:bread_crumbs"), - groups = {food = 7, food_sandwich = 1}, + groups = {food = 7, food_sandwich = 1, eatable = 7}, inventory_image = "po_boy_sandwich.png" }) minetest.register_craft({ diff --git a/mods/x_farming/nodes.lua b/mods/x_farming/nodes.lua index d00d9d3b..d470c16d 100644 --- a/mods/x_farming/nodes.lua +++ b/mods/x_farming/nodes.lua @@ -55,7 +55,7 @@ local donut_def = { destroy_by_lava_flow = 1, compostability = 85, food = 2, - eatable = 1, + eatable = 3, -- ALL flammable = 2, attached_node = 1, @@ -109,7 +109,7 @@ local donut_chocolate_def = { destroy_by_lava_flow = 1, compostability = 85, food = 2, - eatable = 1, + eatable = 4, -- ALL flammable = 2, attached_node = 1, @@ -165,7 +165,7 @@ local fries_def = { destroy_by_lava_flow = 1, compostability = 85, food = 2, - eatable = 1, + eatable = 6, -- ALL flammable = 2, attached_node = 1, @@ -221,7 +221,7 @@ local pumpkin_pie_def = { destroy_by_lava_flow = 1, compostability = 100, food = 2, - eatable = 1, + eatable = 6, -- ALL flammable = 2, attached_node = 1, @@ -327,7 +327,7 @@ local fish_stew_def = { compost = 100, -- MCL food = 3, - eatable = 6, + eatable = 8, compostability = 100, handy = 1, deco_block = 1, diff --git a/mods/x_farming/pumpkin.lua b/mods/x_farming/pumpkin.lua index 08eb1b26..5541feec 100644 --- a/mods/x_farming/pumpkin.lua +++ b/mods/x_farming/pumpkin.lua @@ -222,7 +222,7 @@ if minetest.get_modpath('farming') then minetest.register_craftitem("x_farming:pumpkin_slice", { description = S("Pumpkin Slice"), inventory_image = "farming_pumpkin_slice.png", - groups = {compostability = 48, food_pumpkin_slice = 1}, + groups = {compostability = 48, food_pumpkin_slice = 1, eatable = 2}, on_use = minetest.item_eat(2), })