diff --git a/LICENSE.txt b/LICENSE.txt index 1683e48..94b244d 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,11 +1,10 @@ - --------------------------------------- +BlockColor Game (2018-2019) -Blockcolor (Game) +--- --------------------------------------- +Licenses : GNU LGPL 3.0 for code and Cc By SA 3.0 for medias (http://creativecommons.org/licenses/by-sa/3.0/) -Licenses : GNU LGPL 2.1 for code and Cc By SA 3.0 for medias. +--- Game Creator : MrChiantos @@ -34,526 +33,67 @@ ComboBlock & ComboStair Model : Nathan (MinetestVideo)  Header and Logo : LMD, azekill_DIABLO & MrChiantos Inventory Icons : Xenon (xenonca) -Minetest_Game and Others Mods : Minetest Team (Look readme or license in mod directory). +Minetest : Copyright © 2010-2019 celeron55, Perttu Ahola +Multicraft : Copyright © 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua & MultiCraft Development Team. --------------------------------------- - -Minetest (Engine) - --------------------------------------- - -License of media (textures and sounds) --------------------------------------- -Copyright (C) 2010-2012 celeron55, Perttu Ahola See README.txt in each mod directory for information about other authors. -Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -http://creativecommons.org/licenses/by-sa/3.0/ +------ -License of source code ----------------------- -Copyright (C) 2010-2012 celeron55, Perttu Ahola -See README.txt in each mod directory for information about other authors. +GNU LESSER GENERAL PUBLIC LICENSE +======== +Version 3, 29 June 2007 - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 +Copyright (C) 2007 Free Software Foundation, Inc. - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +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.] +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. - Preamble +0. Additional Definitions. +As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License. - 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. +“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. - 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. +An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. - 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. +A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”. - 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. +The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. - 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. +The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. - 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. +1. Exception to Section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. - 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. +2. Conveying Modified Versions. +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: - 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. +a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or +b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. +3. Object Code Incorporating Material from Library Header Files. +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: - 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. +a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the object code with a copy of the GNU GPL and this license document. +4. Combined Works. +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: - 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. +a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the Combined Work with a copy of the GNU GPL and this license document. +c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. +d) Do one of the following: +0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. +1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. +e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) +5. Combined Libraries. +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 that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: - 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. +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. +b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +6. Revised Versions of the GNU Lesser General Public License. +The Free Software Foundation may publish revised and/or new versions of the GNU 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. - 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. +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. \ No newline at end of file diff --git a/README.md b/README.md index 6e12fd9..57e848e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # BlockColor - BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination. (Made with Minetest Engine) + BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination. (Made with Minetest Engine) \ No newline at end of file diff --git a/bin/blockcolor.exe b/bin/blockcolor.exe index c300378..cf07b6f 100644 Binary files a/bin/blockcolor.exe and b/bin/blockcolor.exe differ diff --git a/bin/libgcc_s_sjlj-1.dll b/bin/libgcc_s_sjlj-1.dll new file mode 100644 index 0000000..578cac1 Binary files /dev/null and b/bin/libgcc_s_sjlj-1.dll differ diff --git a/bin/screenshot_20190712_171610.png b/bin/screenshot_20190712_171610.png deleted file mode 100644 index 6c22345..0000000 Binary files a/bin/screenshot_20190712_171610.png and /dev/null differ diff --git a/bin/screenshot_20190712_171723.png b/bin/screenshot_20190712_171723.png deleted file mode 100644 index 6c2b3cd..0000000 Binary files a/bin/screenshot_20190712_171723.png and /dev/null differ diff --git a/minetest.conf b/blockcolor.conf similarity index 100% rename from minetest.conf rename to blockcolor.conf diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 201ca4a..2b8cc4a 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -1,7 +1,7 @@ -- Minetest: builtin/client/chatcommands.lua -core.register_on_sending_chat_message(function(message) +core.register_on_sending_chat_messages(function(message) if message:sub(1,2) == ".." then return false end @@ -40,13 +40,8 @@ end) core.register_chatcommand("list_players", { description = core.gettext("List online players"), func = function(param) - local player_names = core.get_player_names() - if not player_names then - return false, core.gettext("This command is disabled by server.") - end - - local players = table.concat(player_names, ", ") - return true, core.gettext("Online players: ") .. players + local players = table.concat(core.get_player_names(), ", ") + core.display_chat_message(core.gettext("Online players: ") .. players) end }) diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua deleted file mode 100644 index e755ac5..0000000 --- a/builtin/client/death_formspec.lua +++ /dev/null @@ -1,16 +0,0 @@ --- CSM death formspec. Only used when clientside modding is enabled, otherwise --- handled by the engine. - -core.register_on_death(function() - core.display_chat_message("You died.") - local formspec = "size[11,5.5]bgcolor[#320000b4;true]" .. - "label[4.85,1.35;" .. fgettext("You died") .. - "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]" - core.show_formspec("bultin:death", formspec) -end) - -core.register_on_formspec_input(function(formname, fields) - if formname == "bultin:death" then - core.send_respawn() - end -end) diff --git a/builtin/client/init.lua b/builtin/client/init.lua index 9633a7c..9bd0ce6 100644 --- a/builtin/client/init.lua +++ b/builtin/client/init.lua @@ -1,5 +1,5 @@ -- Minetest: builtin/client/init.lua -local scriptpath = core.get_builtin_path() +local scriptpath = core.get_builtin_path()..DIR_DELIM local clientpath = scriptpath.."client"..DIR_DELIM local commonpath = scriptpath.."common"..DIR_DELIM @@ -8,4 +8,16 @@ dofile(commonpath .. "after.lua") dofile(commonpath .. "chatcommands.lua") dofile(clientpath .. "chatcommands.lua") dofile(commonpath .. "vector.lua") -dofile(clientpath .. "death_formspec.lua") + +core.register_on_death(function() + core.display_chat_message("You died.") + local formspec = "size[11,5.5]bgcolor[#320000b4;true]" .. + "label[5,2;" .. fgettext("You died.") .. "]button_exit[3.5,3;4,0.5;btn_respawn;".. fgettext("Respawn") .."]" + core.show_formspec("bultin:death", formspec) +end) + +core.register_on_formspec_input(function(formname, fields) + if formname == "bultin:death" then + core.send_respawn() + end +end) diff --git a/builtin/client/register.lua b/builtin/client/register.lua index c1b4965..6b12dde 100644 --- a/builtin/client/register.lua +++ b/builtin/client/register.lua @@ -59,10 +59,10 @@ local function make_registration() end core.registered_globalsteps, core.register_globalstep = make_registration() -core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration() core.registered_on_shutdown, core.register_on_shutdown = make_registration() -core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration() -core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration() +core.registered_on_connect, core.register_on_connect = make_registration() +core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration() +core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration() core.registered_on_death, core.register_on_death = make_registration() core.registered_on_hp_modification, core.register_on_hp_modification = make_registration() core.registered_on_damage_taken, core.register_on_damage_taken = make_registration() @@ -71,6 +71,3 @@ core.registered_on_dignode, core.register_on_dignode = make_registration() core.registered_on_punchnode, core.register_on_punchnode = make_registration() core.registered_on_placenode, core.register_on_placenode = make_registration() core.registered_on_item_use, core.register_on_item_use = make_registration() -core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration() -core.registered_on_modchannel_signal, core.register_on_modchannel_signal = make_registration() -core.registered_on_inventory_open, core.register_on_inventory_open = make_registration() diff --git a/builtin/common/after.lua b/builtin/common/after.lua index cdfaaab..41533ed 100644 --- a/builtin/common/after.lua +++ b/builtin/common/after.lua @@ -1,33 +1,41 @@ local jobs = {} local time = 0.0 +local time_next = math.huge core.register_globalstep(function(dtime) time = time + dtime - if #jobs < 1 then + if time < time_next then return end + time_next = math.huge + -- Iterate backwards so that we miss any new timers added by - -- a timer callback, and so that we don't skip the next timer - -- in the list if we remove one. + -- a timer callback. for i = #jobs, 1, -1 do local job = jobs[i] if time >= job.expire then core.set_last_run_mod(job.mod_origin) job.func(unpack(job.arg)) - table.remove(jobs, i) + local jobs_l = #jobs + jobs[i] = jobs[jobs_l] + jobs[jobs_l] = nil + elseif job.expire < time_next then + time_next = job.expire end end end) function core.after(after, func, ...) assert(tonumber(after) and type(func) == "function", - "Invalid core.after invocation") + "Invalid minetest.after invocation") + local expire = time + after jobs[#jobs + 1] = { func = func, - expire = time + after, + expire = expire, arg = {...}, mod_origin = core.get_last_run_mod() } -end + time_next = math.min(time_next, expire) +end \ No newline at end of file diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua index 52edda6..e8955c6 100644 --- a/builtin/common/chatcommands.lua +++ b/builtin/common/chatcommands.lua @@ -97,7 +97,7 @@ end if INIT == "client" then core.register_chatcommand("help", { - params = gettext("[all | ]"), + params = gettext("[all/]"), description = gettext("Get help for commands"), func = function(param) return do_help_cmd(nil, param) @@ -105,7 +105,7 @@ if INIT == "client" then }) else core.register_chatcommand("help", { - params = "[all | privs | ]", + params = "[all/privs/]", description = "Get help for commands or list privileges", func = do_help_cmd, }) diff --git a/builtin/common/filterlist.lua b/builtin/common/filterlist.lua index 1ba1d87..93bb09c 100644 --- a/builtin/common/filterlist.lua +++ b/builtin/common/filterlist.lua @@ -3,7 +3,7 @@ -- --This program 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 +--the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, @@ -47,17 +47,17 @@ function filterlist.create(raw_fct,compare_fct,uid_match_fct,filter_fct,fetch_pa assert((raw_fct ~= nil) and (type(raw_fct) == "function")) assert((compare_fct ~= nil) and (type(compare_fct) == "function")) - + local self = {} - + self.m_raw_list_fct = raw_fct self.m_compare_fct = compare_fct self.m_filter_fct = filter_fct self.m_uid_match_fct = uid_match_fct - + self.m_filtercriteria = nil self.m_fetch_param = fetch_param - + self.m_sortmode = "none" self.m_sort_list = {} @@ -79,7 +79,7 @@ function filterlist.create(raw_fct,compare_fct,uid_match_fct,filter_fct,fetch_pa self.refresh = filterlist.refresh filterlist.process(self) - + return self end @@ -128,49 +128,49 @@ function filterlist.get_raw_element(self,idx) if type(idx) ~= "number" then idx = tonumber(idx) end - + if idx ~= nil and idx > 0 and idx <= #self.m_raw_list then return self.m_raw_list[idx] end - + return nil end -------------------------------------------------------------------------------- function filterlist.get_raw_index(self,listindex) assert(self.m_processed_list ~= nil) - + if listindex ~= nil and listindex > 0 and listindex <= #self.m_processed_list then local entry = self.m_processed_list[listindex] - + for i,v in ipairs(self.m_raw_list) do - + if self.m_compare_fct(v,entry) then return i end end end - + return 0 end -------------------------------------------------------------------------------- function filterlist.get_current_index(self,listindex) assert(self.m_processed_list ~= nil) - + if listindex ~= nil and listindex > 0 and listindex <= #self.m_raw_list then local entry = self.m_raw_list[listindex] - + for i,v in ipairs(self.m_processed_list) do - + if self.m_compare_fct(v,entry) then return i end end end - + return 0 end @@ -183,23 +183,23 @@ function filterlist.process(self) self.m_processed_list = self.m_raw_list return end - + self.m_processed_list = {} - + for k,v in pairs(self.m_raw_list) do if self.m_filtercriteria == nil or self.m_filter_fct(v,self.m_filtercriteria) then self.m_processed_list[#self.m_processed_list + 1] = v end end - + if self.m_sortmode == "none" then return end - + if self.m_sort_list[self.m_sortmode] ~= nil and type(self.m_sort_list[self.m_sortmode]) == "function" then - + self.m_sort_list[self.m_sortmode](self) end end @@ -209,7 +209,7 @@ function filterlist.size(self) if self.m_processed_list == nil then return 0 end - + return #self.m_processed_list end @@ -233,8 +233,8 @@ function filterlist.raw_index_by_uid(self, uid) elementidx = i end end - - + + -- If there are more elements than one with same name uid can't decide which -- one is meant. self shouldn't be possible but just for sure. if elementcount > 1 then @@ -254,11 +254,11 @@ function compare_worlds(world1,world2) if world1.path ~= world2.path then return false end - + if world1.name ~= world2.name then return false end - + if world1.gameid ~= world2.gameid then return false end @@ -288,11 +288,11 @@ function sort_mod_list(self) table.sort(self.m_processed_list, function(a, b) -- Show game mods at bottom - if a.type ~= b.type or a.loc ~= b.loc then - if b.type == "game" then - return a.loc ~= "game" + if a.typ ~= b.typ then + if b.typ == "game" then + return a.typ ~= "game_mod" end - return b.loc == "game" + return b.typ == "game_mod" end -- If in same or no modpack, sort by name if a.modpack == b.modpack then @@ -308,7 +308,7 @@ function sort_mod_list(self) elseif b.name == a.modpack then return false end - + local name_a = a.modpack or a.name local name_b = b.modpack or b.name if name_a:lower() == name_b:lower() then diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index e250b0e..aad5f2d 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -166,9 +166,9 @@ end -------------------------------------------------------------------------------- function string.split(str, delim, include_empty, max_splits, sep_is_pattern) delim = delim or "," - max_splits = max_splits or -2 + max_splits = max_splits or -1 local items = {} - local pos, len = 1, #str + local pos, len, seplen = 1, #str, #delim local plain = not sep_is_pattern max_splits = max_splits + 1 repeat @@ -382,7 +382,7 @@ if INIT == "game" then param2 = dirs1[fdir + 1] elseif isceiling then if orient_flags.force_facedir then - param2 = 20 + cparam2 = 20 else param2 = dirs2[fdir + 1] end @@ -462,12 +462,6 @@ function core.explode_scrollbar_event(evt) return retval end --------------------------------------------------------------------------------- -function core.rgba(r, g, b, a) - return a and string.format("#%02X%02X%02X%02X", r, g, b, a) or - string.format("#%02X%02X%02X", r, g, b) -end - -------------------------------------------------------------------------------- function core.pos_to_string(pos, decimal_places) local x = pos.x @@ -495,7 +489,7 @@ function core.string_to_pos(value) p.z = tonumber(p.z) return p end - p = {} + local p = {} p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$") if p.x and p.y and p.z then p.x = tonumber(p.x) @@ -551,22 +545,12 @@ function table.copy(t, seen) end return n end - - -function table.insert_all(t, other) - for i=1, #other do - t[#t + 1] = other[i] - end - return t -end - - -------------------------------------------------------------------------------- -- mainmenu only functions -------------------------------------------------------------------------------- if INIT == "mainmenu" then function core.get_game(index) - local games = core.get_games() + local games = game.get_games() if index > 0 and index <= #games then return games[index] @@ -641,57 +625,10 @@ function core.strip_colors(str) return (str:gsub(ESCAPE_CHAR .. "%([bc]@[^)]+%)", "")) end -function core.translate(textdomain, str, ...) - local start_seq - if textdomain == "" then - start_seq = ESCAPE_CHAR .. "T" - else - start_seq = ESCAPE_CHAR .. "(T@" .. textdomain .. ")" - end - local arg = {n=select('#', ...), ...} - local end_seq = ESCAPE_CHAR .. "E" - local arg_index = 1 - local translated = str:gsub("@(.)", function(matched) - local c = string.byte(matched) - if string.byte("1") <= c and c <= string.byte("9") then - local a = c - string.byte("0") - if a ~= arg_index then - error("Escape sequences in string given to core.translate " .. - "are not in the correct order: got @" .. matched .. - "but expected @" .. tostring(arg_index)) - end - if a > arg.n then - error("Not enough arguments provided to core.translate") - end - arg_index = arg_index + 1 - return ESCAPE_CHAR .. "F" .. arg[a] .. ESCAPE_CHAR .. "E" - elseif matched == "n" then - return "\n" - else - return matched - end - end) - if arg_index < arg.n + 1 then - error("Too many arguments provided to core.translate") - end - return start_seq .. translated .. end_seq -end - -function core.get_translator(textdomain) - return function(str, ...) return core.translate(textdomain or "", str, ...) end -end - -------------------------------------------------------------------------------- -- Returns the exact coordinate of a pointed surface -------------------------------------------------------------------------------- function core.pointed_thing_to_face_pos(placer, pointed_thing) - -- Avoid crash in some situations when player is inside a node, causing - -- 'above' to equal 'under'. - if vector.equals(pointed_thing.above, pointed_thing.under) then - return pointed_thing.under - end - - local eye_height = placer:get_properties().eye_height local eye_offset_first = placer:get_eye_offset() local node_pos = pointed_thing.under local camera_pos = placer:get_pos() @@ -711,7 +648,7 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing) end local fine_pos = {[nc] = node_pos[nc] + offset} - camera_pos.y = camera_pos.y + eye_height + eye_offset_first.y / 10 + camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10 local f = (node_pos[nc] + offset - camera_pos[nc]) / look_dir[nc] for i = 1, #oc do @@ -719,28 +656,3 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing) end return fine_pos end - -function core.string_to_privs(str, delim) - assert(type(str) == "string") - delim = delim or ',' - local privs = {} - for _, priv in pairs(string.split(str, delim)) do - privs[priv:trim()] = true - end - return privs -end - -function core.privs_to_string(privs, delim) - assert(type(privs) == "table") - delim = delim or ',' - local list = {} - for priv, bool in pairs(privs) do - if bool then - list[#list + 1] = priv - end - end - return table.concat(list, delim) -end - -assert(core.string_to_privs("a,b").b == true) -assert(core.privs_to_string({a=true,b=true}) == "a,b") diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index c3d380e..0549f9a 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -63,13 +63,34 @@ function vector.distance(a, b) end function vector.direction(pos1, pos2) - return vector.normalize({ - x = pos2.x - pos1.x, - y = pos2.y - pos1.y, - z = pos2.z - pos1.z - }) + local x_raw = pos2.x - pos1.x + local y_raw = pos2.y - pos1.y + local z_raw = pos2.z - pos1.z + local x_abs = math.abs(x_raw) + local y_abs = math.abs(y_raw) + local z_abs = math.abs(z_raw) + if x_abs >= y_abs and + x_abs >= z_abs then + y_raw = y_raw * (1 / x_abs) + z_raw = z_raw * (1 / x_abs) + x_raw = x_raw / x_abs + end + if y_abs >= x_abs and + y_abs >= z_abs then + x_raw = x_raw * (1 / y_abs) + z_raw = z_raw * (1 / y_abs) + y_raw = y_raw / y_abs + end + if z_abs >= y_abs and + z_abs >= x_abs then + x_raw = x_raw * (1 / z_abs) + y_raw = y_raw * (1 / z_abs) + z_raw = z_raw / z_abs + end + return {x=x_raw, y=y_raw, z=z_raw} end + function vector.add(a, b) if type(b) == "table" then return {x = a.x + b.x, diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua index 7aedfc8..753684a 100644 --- a/builtin/game/auth.lua +++ b/builtin/game/auth.lua @@ -1,25 +1,99 @@ -- Minetest: builtin/auth.lua -- --- Builtin authentication handler +-- Authentication handler -- --- Make the auth object private, deny access to mods -local core_auth = core.auth -core.auth = nil +function core.string_to_privs(str, delim) + assert(type(str) == "string") + delim = delim or ',' + local privs = {} + for _, priv in pairs(string.split(str, delim)) do + privs[priv:trim()] = true + end + return privs +end + +function core.privs_to_string(privs, delim) + assert(type(privs) == "table") + delim = delim or ',' + local list = {} + for priv, bool in pairs(privs) do + if bool then + list[#list + 1] = priv + end + end + return table.concat(list, delim) +end + +assert(core.string_to_privs("a,b").b == true) +assert(core.privs_to_string({a=true,b=true}) == "a,b") + +core.auth_file_path = core.get_worldpath().."/auth.txt" +core.auth_table = {} + +local function read_auth_file() + local newtable = {} + local file, errmsg = io.open(core.auth_file_path, 'rb') + if not file then + core.log("info", core.auth_file_path.." could not be opened for reading ("..errmsg.."); assuming new world") + return + end + for line in file:lines() do + if line ~= "" then + local fields = line:split(":", true) + local name, password, privilege_string, last_login = unpack(fields) + last_login = tonumber(last_login) + if not (name and password and privilege_string) then + error("Invalid line in auth.txt: "..dump(line)) + end + local privileges = core.string_to_privs(privilege_string) + newtable[name] = {password=password, privileges=privileges, last_login=last_login} + end + end + io.close(file) + core.auth_table = newtable + core.notify_authentication_modified() +end + +local function save_auth_file() + local newtable = {} + -- Check table for validness before attempting to save + for name, stuff in pairs(core.auth_table) do + assert(type(name) == "string") + assert(name ~= "") + assert(type(stuff) == "table") + assert(type(stuff.password) == "string") + assert(type(stuff.privileges) == "table") + assert(stuff.last_login == nil or type(stuff.last_login) == "number") + end + local file, errmsg = io.open(core.auth_file_path, 'w+b') + if not file then + error(core.auth_file_path.." could not be opened for writing: "..errmsg) + end + for name, stuff in pairs(core.auth_table) do + local priv_string = core.privs_to_string(stuff.privileges) + local parts = {name, stuff.password, priv_string, stuff.last_login or ""} + file:write(table.concat(parts, ":").."\n") + end + io.close(file) +end core.builtin_auth_handler = { get_auth = function(name) assert(type(name) == "string") - local auth_entry = core_auth.read(name) - -- If no such auth found, return nil - if not auth_entry then + -- Figure out what password to use for a new player (singleplayer + -- always has an empty password, otherwise use default, which is + -- usually empty too) + local new_password_hash = "" + -- If not in authentication table, return nil + if not core.auth_table[name] then return nil end -- Figure out what privileges the player should have. -- Take a copy of the privilege table local privileges = {} - for priv, _ in pairs(auth_entry.privileges) do + for priv, _ in pairs(core.auth_table[name].privileges) do privileges[priv] = true end -- If singleplayer, give all privileges except those marked as give_to_singleplayer = false @@ -32,125 +106,67 @@ core.builtin_auth_handler = { -- For the admin, give everything elseif name == core.settings:get("name") then for priv, def in pairs(core.registered_privileges) do - if def.give_to_admin then - privileges[priv] = true - end + privileges[priv] = true end end -- All done return { - password = auth_entry.password, + password = core.auth_table[name].password, privileges = privileges, -- Is set to nil if unknown - last_login = auth_entry.last_login, + last_login = core.auth_table[name].last_login, } end, create_auth = function(name, password) + core.log("action", "[AUTH] Adding password entry for player " .. name) assert(type(name) == "string") assert(type(password) == "string") - core.log('info', "Built-in authentication handler adding player '"..name.."'") - return core_auth.create({ - name = name, + core.auth_table[name] = { password = password, privileges = core.string_to_privs(core.settings:get("default_privs")), last_login = os.time(), - }) - end, - delete_auth = function(name) - assert(type(name) == "string") - local auth_entry = core_auth.read(name) - if not auth_entry then - return false - end - core.log('info', "Built-in authentication handler deleting player '"..name.."'") - return core_auth.delete(name) + } end, set_password = function(name, password) assert(type(name) == "string") assert(type(password) == "string") - local auth_entry = core_auth.read(name) - if not auth_entry then + if not core.auth_table[name] then + core.log("action", "[AUTH] Setting password for new player " .. name) core.builtin_auth_handler.create_auth(name, password) else - core.log('info', "Built-in authentication handler setting password of player '"..name.."'") - auth_entry.password = password - core_auth.save(auth_entry) + core.log("action", "[AUTH] Setting password for existing player " .. name) + core.auth_table[name].password = password end return true end, set_privileges = function(name, privileges) + core.log("action", "[AUTH] Setting privileges for player " .. name) assert(type(name) == "string") assert(type(privileges) == "table") - local auth_entry = core_auth.read(name) - if not auth_entry then - auth_entry = core.builtin_auth_handler.create_auth(name, + if not core.auth_table[name] then + core.builtin_auth_handler.create_auth(name, core.get_password_hash(name, core.settings:get("default_password"))) end - - -- Run grant callbacks - for priv, _ in pairs(privileges) do - if not auth_entry.privileges[priv] then - core.run_priv_callbacks(name, priv, nil, "grant") - end - end - - -- Run revoke callbacks - for priv, _ in pairs(auth_entry.privileges) do - if not privileges[priv] then - core.run_priv_callbacks(name, priv, nil, "revoke") - end - end - - auth_entry.privileges = privileges - core_auth.save(auth_entry) + core.auth_table[name].privileges = privileges core.notify_authentication_modified(name) end, reload = function() - core_auth.reload() + core.log("action", "[AUTH] Reading authentication data from disk") + read_auth_file() + return true + end, + commit = function() + core.log("action", "[AUTH] Writing authentication data to disk") + save_auth_file() return true end, record_login = function(name) assert(type(name) == "string") - local auth_entry = core_auth.read(name) - assert(auth_entry) - auth_entry.last_login = os.time() - core_auth.save(auth_entry) - end, - iterate = function() - local names = {} - local nameslist = core_auth.list_names() - for k,v in pairs(nameslist) do - names[v] = true - end - return pairs(names) + assert(core.auth_table[name]).last_login = os.time() end, } -core.register_on_prejoinplayer(function(name, ip) - if core.registered_auth_handler ~= nil then - return -- Don't do anything if custom auth handler registered - end - local auth_entry = core_auth.read(name) - if auth_entry ~= nil then - return - end - - local name_lower = name:lower() - for k in core.builtin_auth_handler.iterate() do - if k:lower() == name_lower then - return string.format("\nCannot create new player called '%s'. ".. - "Another account called '%s' is already registered. ".. - "Please check the spelling if it's your account ".. - "or use a different nickname.", name, k) - end - end -end) - --- --- Authentication API --- - function core.register_authentication_handler(handler) if core.registered_auth_handler then error("Add-on authentication handler already registered by "..core.registered_auth_handler_modname) @@ -176,10 +192,44 @@ end core.set_player_password = auth_pass("set_password") core.set_player_privs = auth_pass("set_privileges") -core.remove_player_auth = auth_pass("delete_auth") core.auth_reload = auth_pass("reload") +core.auth_commit = auth_pass("commit") + +core.auth_reload() local record_login = auth_pass("record_login") + core.register_on_joinplayer(function(player) record_login(player:get_player_name()) end) + +core.register_on_shutdown(function() + core.auth_commit() +end) + +core.register_on_prejoinplayer(function(name, ip) + local auth = core.auth_table + if auth[name] ~= nil then + return + end + + local name_lower = name:lower() + for k in pairs(auth) do + if k:lower() == name_lower then + return string.format("\nYou can not register as '%s'! ".. + "Another player called '%s' is already registered. ".. + "Please check the spelling if it's your account ".. + "or use a different name.", name, k) + end + end +end) + +-- Autosave +if not core.is_singleplayer() then + local save_interval = 600 + local function auto_save() + core.auth_commit() + core.after(save_interval, auto_save) + end + core.after(save_interval, auto_save) +end diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 60d5d47..5c62c9f 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -41,7 +41,7 @@ end) if core.settings:get_bool("profiler.load") then -- Run after register_chatcommand and its register_on_chat_message - -- Before any chatcommands that should be profiled + -- Before any chattcommands that should be profiled profiler.init_chatcommand() end @@ -71,7 +71,7 @@ end -- core.register_chatcommand("me", { params = "", - description = "Show chat action (e.g., '/me orders a pizza' displays" + description = "Display chat action (e.g., '/me orders a pizza' displays" .. " ' orders a pizza')", privs = {shout=true}, func = function(name, param) @@ -84,7 +84,7 @@ core.register_chatcommand("admin", { func = function(name) local admin = core.settings:get("name") if admin then - return true, "The administrator of this server is " .. admin .. "." + return true, "The administrator of this server is "..admin.."." else return false, "There's no administrator named in the config file." end @@ -93,44 +93,16 @@ core.register_chatcommand("admin", { core.register_chatcommand("privs", { params = "[]", - description = "Show privileges of yourself or another player", + description = "Print privileges of player", func = function(caller, param) param = param:trim() local name = (param ~= "" and param or caller) - if not core.player_exists(name) then - return false, "Player " .. name .. " does not exist." - end return true, "Privileges of " .. name .. ": " .. core.privs_to_string( core.get_player_privs(name), ' ') end, }) -core.register_chatcommand("haspriv", { - params = "", - description = "Return list of all online players with privilege.", - privs = {basic_privs = true}, - func = function(caller, param) - param = param:trim() - if param == "" then - return false, "Invalid parameters (see /help haspriv)" - end - if not core.registered_privileges[param] then - return false, "Unknown privilege!" - end - local privs = core.string_to_privs(param) - local players_with_priv = {} - for _, player in pairs(core.get_connected_players()) do - local player_name = player:get_player_name() - if core.check_player_privs(player_name, privs) then - table.insert(players_with_priv, player_name) - end - end - return true, "Players online with the \"" .. param .. "\" privilege: " .. - table.concat(players_with_priv, ", ") - end -}) - local function handle_grant_command(caller, grantname, grantprivstr) local caller_privs = core.get_player_privs(caller) if not (caller_privs.privs or caller_privs.basic_privs) then @@ -160,9 +132,6 @@ local function handle_grant_command(caller, grantname, grantprivstr) if privs_unknown ~= "" then return false, privs_unknown end - for priv, _ in pairs(grantprivs) do - core.run_priv_callbacks(grantname, priv, caller, "grant") - end core.set_player_privs(grantname, privs) core.log("action", caller..' granted ('..core.privs_to_string(grantprivs, ', ')..') privileges to '..grantname) if grantname ~= caller then @@ -177,7 +146,7 @@ end core.register_chatcommand("grant", { params = " ( | all)", - description = "Give privileges to player", + description = "Give privilege to player", func = function(name, param) local grantname, grantprivstr = string.match(param, "([^ ]+) (.+)") if not grantname or not grantprivstr then @@ -188,7 +157,7 @@ core.register_chatcommand("grant", { }) core.register_chatcommand("grantme", { - params = " | all", + params = "|all", description = "Grant privileges to yourself", func = function(name, param) if param == "" then @@ -200,7 +169,7 @@ core.register_chatcommand("grantme", { core.register_chatcommand("revoke", { params = " ( | all)", - description = "Remove privileges from player", + description = "Remove privilege from player", privs = {}, func = function(name, param) if not core.check_player_privs(name, {privs=true}) and @@ -224,18 +193,12 @@ core.register_chatcommand("revoke", { end end if revoke_priv_str == "all" then - revoke_privs = privs privs = {} else for priv, _ in pairs(revoke_privs) do privs[priv] = nil end end - - for priv, _ in pairs(revoke_privs) do - core.run_priv_callbacks(revoke_name, priv, name, "revoke") - end - core.set_player_privs(revoke_name, privs) core.log("action", name..' revoked (' ..core.privs_to_string(revoke_privs, ', ') @@ -291,7 +254,7 @@ core.register_chatcommand("setpassword", { core.register_chatcommand("clearpassword", { params = "", - description = "Set empty password for a player", + description = "Set empty password", privs = {password=true}, func = function(name, param) local toname = param @@ -318,7 +281,7 @@ core.register_chatcommand("auth_reload", { core.register_chatcommand("remove_player", { params = "", - description = "Remove a player's data", + description = "Remove player data", privs = {server=true}, func = function(name, param) local toname = param @@ -341,9 +304,19 @@ core.register_chatcommand("remove_player", { end, }) +core.register_chatcommand("auth_save", { + params = "", + description = "Write authentication data to disk", + privs = {server=true}, + func = function(name, param) + local done = core.auth_save() + return done, (done and "Authentication data successfully saved to disk." or "Failed to write the auth.txt file.") + end, +}) + core.register_chatcommand("teleport", { params = ",, | | ( ,,) | ( )", - description = "Teleport to position or player", + description = "Teleport to player or position", privs = {teleport=true}, func = function(name, param) -- Returns (pos, true) if found, otherwise (pos, false) @@ -585,11 +558,8 @@ local function handle_give_command(cmd, giver, receiver, stackstring) local itemstack = ItemStack(stackstring) if itemstack:is_empty() then return false, "Cannot give an empty item" - elseif (not itemstack:is_known()) or (itemstack:get_name() == "unknown") then + elseif not itemstack:is_known() then return false, "Cannot give an unknown item" - -- Forbid giving 'ignore' due to unwanted side effects - elseif itemstack:get_name() == "ignore" then - return false, "Giving 'ignore' is not allowed" end local receiverref = core.get_player_by_name(receiver) if receiverref == nil then @@ -608,18 +578,18 @@ local function handle_give_command(cmd, giver, receiver, stackstring) -- entered (e.g. big numbers are always interpreted as 2^16-1). stackstring = itemstack:to_string() if giver == receiver then - local msg = "%q %sadded to inventory." - return true, msg:format(stackstring, partiality) + return true, ("%q %sadded to inventory.") + :format(stackstring, partiality) else core.chat_send_player(receiver, ("%q %sadded to inventory.") :format(stackstring, partiality)) - local msg = "%q %sadded to %s's inventory." - return true, msg:format(stackstring, partiality, receiver) + return true, ("%q %sadded to %s's inventory.") + :format(stackstring, partiality, receiver) end end core.register_chatcommand("give", { - params = " [ []]", + params = " ", description = "Give item to player", privs = {give=true}, func = function(name, param) @@ -632,7 +602,7 @@ core.register_chatcommand("give", { }) core.register_chatcommand("giveme", { - params = " [ []]", + params = "", description = "Give item to yourself", privs = {give=true}, func = function(name, param) @@ -660,9 +630,6 @@ core.register_chatcommand("spawnentity", { core.log("error", "Unable to spawn entity, player is nil") return false, "Unable to spawn entity, player is nil" end - if not core.registered_entities[entityname] then - return false, "Cannot spawn an unknown entity" - end if p == "" then p = player:get_pos() else @@ -686,13 +653,10 @@ core.register_chatcommand("pulverize", { core.log("error", "Unable to pulverize, no player.") return false, "Unable to pulverize, no player." end - local wielded_item = player:get_wielded_item() - if wielded_item:is_empty() then + if player:get_wielded_item():is_empty() then return false, "Unable to pulverize, no item in hand." end - core.log("action", name .. " pulverized \"" .. - wielded_item:get_name() .. " " .. wielded_item:get_count() .. "\"") - player:set_wielded_item(nil) + player:set_wielded_item(nil) return true, "An item was pulverized." end, }) @@ -701,8 +665,8 @@ core.register_chatcommand("pulverize", { core.rollback_punch_callbacks = {} core.register_on_punchnode(function(pos, node, puncher) - local name = puncher and puncher:get_player_name() - if name and core.rollback_punch_callbacks[name] then + local name = puncher:get_player_name() + if core.rollback_punch_callbacks[name] then core.rollback_punch_callbacks[name](pos, node, puncher) core.rollback_punch_callbacks[name] = nil end @@ -800,19 +764,16 @@ core.register_chatcommand("rollback", { }) core.register_chatcommand("status", { - description = "Show server status", + description = "Print server status", + privs = {server=true}, func = function(name, param) - local status = core.get_server_status(name, false) - if status and status ~= "" then - return true, status - end - return false, "This command was disabled by a mod or game" + return true, core.get_server_status() end, }) core.register_chatcommand("time", { - params = "[<0..23>:<0..59> | <0..24000>]", - description = "Show or set time of day", + params = "<0..23>:<0..59> | <0..24000>", + description = "Set time of day", privs = {}, func = function(name, param) if param == "" then @@ -851,7 +812,7 @@ core.register_chatcommand("time", { }) core.register_chatcommand("days", { - description = "Show day count since world creation", + description = "Display day count", func = function(name, param) return true, "Current day is " .. core.get_day_count() end @@ -862,15 +823,13 @@ core.register_chatcommand("shutdown", { description = "Shutdown server (-1 cancels a delayed shutdown)", privs = {server=true}, func = function(name, param) - local delay, reconnect, message - delay, param = param:match("^%s*(%S+)(.*)") - if param then - reconnect, param = param:match("^%s*(%S+)(.*)") - end - message = param and param:match("^%s*(.+)") or "" - delay = tonumber(delay) or 0 + local delay, reconnect, message = param:match("([^ ][-]?[0-9]+)([^ ]+)(.*)") + message = message or "" - if delay == 0 then + if delay ~= "" then + delay = tonumber(param) or 0 + else + delay = 0 core.log("action", name .. " shuts down server") core.chat_send_all("*** Server shutting down (operator request).") end @@ -879,17 +838,12 @@ core.register_chatcommand("shutdown", { }) core.register_chatcommand("ban", { - params = "[ | ]", - description = "Ban player or show ban list", + params = "", + description = "Ban IP of player", privs = {ban=true}, func = function(name, param) if param == "" then - local ban_list = core.get_ban_list() - if ban_list == "" then - return true, "The ban list is empty." - else - return true, "Ban list: " .. ban_list - end + return true, "Ban list: " .. core.get_ban_list() end if not core.get_player_by_name(param) then return false, "No such player." @@ -905,7 +859,7 @@ core.register_chatcommand("ban", { core.register_chatcommand("unban", { params = " | ", - description = "Remove player ban", + description = "Remove IP ban", privs = {ban=true}, func = function(name, param) if not core.unban_player_or_ip(param) then @@ -936,7 +890,7 @@ core.register_chatcommand("kick", { }) core.register_chatcommand("clearobjects", { - params = "[full | quick]", + params = "[full|quick]", description = "Clear all objects in world", privs = {server=true}, func = function(name, param) @@ -983,7 +937,7 @@ core.register_chatcommand("msg", { core.register_chatcommand("last-login", { params = "[]", - description = "Get the last login time of a player or yourself", + description = "Get the last login time of a player", func = function(name, param) if param == "" then param = name @@ -1006,7 +960,7 @@ core.register_chatcommand("clearinv", { if param and param ~= "" and param ~= name then if not core.check_player_privs(name, {server=true}) then return false, "You don't have permission" - .. " to clear another player's inventory (missing privilege: server)" + .. " to run this command (missing privilege: server)" end player = core.get_player_by_name(param) core.chat_send_player(param, name.." cleared your inventory.") @@ -1056,3 +1010,40 @@ core.register_chatcommand("kill", { return handle_kill_command(name, param == "" and name or param) end, }) + +core.register_chatcommand("spawn", { + params = "", + description = "Teleport to the spawn point", + func = function(name, param) + local player = core.get_player_by_name(name) + if not player then + return false, "Command called by invalid player" + end + if core.setting_get_pos("static_spawnpoint") then + player:set_pos(core.setting_get_pos("static_spawnpoint")) + return true, "Teleporting to spawn..." + else + return false, "The spawn point is not set!" + end + end, +}) + +core.register_chatcommand("setspawn", { + params = "", + description = "Sets the spawn point to your current position", + privs = {server = true}, + func = function(name, param) + local player = core.get_player_by_name(name) + if not player then + return false, "Command called by invalid player" + end + local pos = vector.round(player:get_pos()) + local x = pos.x + local y = pos.y + local z = pos.z + local pos_to_string = x..","..y..","..z + core.setting_set("static_spawnpoint", pos_to_string) + core.setting_save() + return true, "Setting spawn point to ("..x..", "..y..", "..z..")" + end, +}) diff --git a/builtin/game/constants.lua b/builtin/game/constants.lua index 0ee2a72..50c515b 100644 --- a/builtin/game/constants.lua +++ b/builtin/game/constants.lua @@ -21,10 +21,6 @@ core.EMERGE_GENERATED = 4 -- constants.h -- Size of mapblocks in nodes core.MAP_BLOCKSIZE = 16 --- Default maximal HP of a player -core.PLAYER_MAX_HP_DEFAULT = 20 --- Default maximal breath of a player -core.PLAYER_MAX_BREATH_DEFAULT = 11 -- light.h -- Maximum value for node 'light_source' parameter diff --git a/builtin/game/detached_inventory.lua b/builtin/game/detached_inventory.lua index 2e27168..420e89f 100644 --- a/builtin/game/detached_inventory.lua +++ b/builtin/game/detached_inventory.lua @@ -18,7 +18,3 @@ function core.create_detached_inventory(name, callbacks, player_name) return core.create_detached_inventory_raw(name, player_name) end -function core.remove_detached_inventory(name) - core.detached_inventories[name] = nil - return core.remove_detached_inventory_raw(name) -end diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 62b6973..053153f 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -19,6 +19,7 @@ core.register_entity(":__builtin:falling_node", { node = {}, meta = {}, + timer = 0, set_node = function(self, node, meta) self.node = node @@ -53,8 +54,9 @@ core.register_entity(":__builtin:falling_node", { on_step = function(self, dtime) -- Set gravity local acceleration = self.object:get_acceleration() - if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then - self.object:set_acceleration({x = 0, y = -10, z = 0}) + local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 + if not vector.equals(acceleration, {x = 0, y = -gravity, z = 0}) then + self.object:setacceleration({x = 0, y = -gravity, z = 0}) end -- Turn to actual node when colliding with ground, or continue to move local pos = self.object:get_pos() @@ -129,21 +131,20 @@ core.register_entity(":__builtin:falling_node", { local npos = self.object:get_pos() self.object:set_pos(vector.round(npos)) end + -- Drop node if does not fall within 5 seconds + self.timer = self.timer + dtime + if self.timer > 5 then + core.add_item(pos, self.node) + self.object:remove() + end end }) -local function convert_to_falling_node(pos, node) - local obj = core.add_entity(pos, "__builtin:falling_node") - if not obj then - return false +local function spawn_falling_node(p, node, meta) + local obj = core.add_entity(p, "__builtin:falling_node") + if obj then + obj:get_luaentity():set_node(node, meta) end - node.level = core.get_node_level(pos) - local meta = core.get_meta(pos) - local metatable = meta and meta:to_table() or {} - - obj:get_luaentity():set_node(node, metatable) - core.remove_node(pos) - return true end function core.spawn_falling_node(pos) @@ -151,27 +152,19 @@ function core.spawn_falling_node(pos) if node.name == "air" or node.name == "ignore" then return false end - return convert_to_falling_node(pos, node) + local obj = core.add_entity(pos, "__builtin:falling_node") + if obj then + obj:get_luaentity():set_node(node) + core.remove_node(pos) + return true + end + return false end local function drop_attached_node(p) local n = core.get_node(p) - local drops = core.get_node_drops(n, "") - local def = core.registered_items[n.name] - if def and def.preserve_metadata then - local oldmeta = core.get_meta(p):to_table().fields - -- Copy pos and node because the callback can modify them. - local pos_copy = {x=p.x, y=p.y, z=p.z} - local node_copy = {name=n.name, param1=n.param1, param2=n.param2} - local drop_stacks = {} - for k, v in pairs(drops) do - drop_stacks[k] = ItemStack(v) - end - drops = drop_stacks - def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) - end core.remove_node(p) - for _, item in pairs(drops) do + for _, item in pairs(core.get_node_drops(n, "")) do local pos = { x = p.x + math.random()/2 - 0.25, y = p.y + math.random()/2 - 0.25, @@ -209,7 +202,7 @@ end function core.check_single_for_falling(p) local n = core.get_node(p) - if core.get_item_group(n.name, "falling_node") ~= 0 then + if core.get_item_group(n.name, "falling_node") ~= 0 and core.is_singleplayer() then local p_bottom = {x = p.x, y = p.y - 1, z = p.z} -- Only spawn falling node if node below is loaded local n_bottom = core.get_node_or_nil(p_bottom) @@ -224,7 +217,21 @@ function core.check_single_for_falling(p) core.get_node_max_level(p_bottom))) and (not d_bottom.walkable or d_bottom.buildable_to) then - convert_to_falling_node(p, n) + n.level = core.get_node_level(p) + local meta = core.get_meta(p) + local metatable = {} + if meta ~= nil then + metatable = meta:to_table() + end + core.remove_node(p) + spawn_falling_node(p, n, metatable) + return true + end + end + + if core.get_item_group(n.name, "falling_node") ~= 0 and not core.is_singleplayer() then + if not builtin_shared.check_attached_node(p, n) then + drop_attached_node(p) return true end end diff --git a/builtin/game/features.lua b/builtin/game/features.lua index 8e51048..ef85fbb 100644 --- a/builtin/game/features.lua +++ b/builtin/game/features.lua @@ -3,6 +3,7 @@ core.features = { glasslike_framed = true, nodebox_as_selectionbox = true, + chat_send_player_param3 = true, get_all_craft_recipes_works = true, use_texture_alpha = true, no_legacy_abms = true, @@ -10,8 +11,6 @@ core.features = { area_store_custom_ids = true, add_entity_with_staticdata = true, no_chat_message_prediction = true, - object_use_texture_alpha = true, - object_independent_selectionbox = true, } function core.has_feature(arg) diff --git a/builtin/game/hud.lua b/builtin/game/hud.lua new file mode 100644 index 0000000..5c005eb --- /dev/null +++ b/builtin/game/hud.lua @@ -0,0 +1,168 @@ +--From Better HUD mod +--Copyright (C) BlockMen (2013-2016) + +--This program 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 3.0 of the License, or +--(at your option) any later version. +-- +--This program 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 program; if not, write to the Free Software Foundation, Inc., +--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +hud, hud_id = {}, {} + +-- keep id handling internal +local sb_bg = {} -- statbar background ids + +-- localize often used table +local items = {} + +local function throw_error(msg) + core.log("error", "HUD[error]: " .. msg) +end + +-- +-- API +-- + +function hud.register(name, def) + if not name or not def then + throw_error("not enough parameters given") + return false + end + + if items[name] ~= nil then + throw_error("A statbar with that name already exists") + return false + end + + -- actually register + -- add background first since draworder is based on id :\ + if --[[def.hud_elem_type == "statbar" and]] def.background ~= nil then + sb_bg[name] = table.copy(def) + sb_bg[name].text = def.background + if not def.autohide_bg and def.max then + sb_bg[name].number = def.max + end + end + -- add item itself + items[name] = def + + -- no error so far, return success + return true +end + +function hud.change_item(player, name, def) + if not player or not player:is_player() or not name or not def then + throw_error("Not enough parameters given to change HUD item") + return false + end + local i_name = player:get_player_name().."_"..name + local elem = hud_id[i_name] + if not elem then + throw_error("Given HUD element " .. dump(name) .. " does not exist") + return false + end + + -- Only update if values supported and value actually changed + -- update supported values (currently number and text only) + if def.number and elem.number then + if def.number ~= elem.number then + if elem.max and def.number > elem.max and not def.max then + def.number = elem.max + end + if def.max then + elem.max = def.max + end + player:hud_change(elem.id, "number", def.number) + elem.number = def.number + -- hide background when set + local bg = hud_id[i_name.."_bg"] + if elem.autohide_bg then + if def.number < 1 then + player:hud_change(bg.id, "number", 0) + else + local num = bg.number + if bg.max then + num = bg.max + end + player:hud_change(bg.id, "number", num) + end + else + if bg and bg.max and bg.max < 1 and def.max and def.max > bg.max then + player:hud_change(bg.id, "number", def.max) + bg.max = def.max + bg.number = def.max + end + end + end + end + if def.text and elem.text then + if def.text ~= elem.text then + player:hud_change(elem.id, "text", def.text) + elem.text = def.text + end + end + + if def.offset and elem.offset then + if def.item_name and def.offset == "item" then + -- for legacy reasons + --[[if def.item_name then + hud.swap_statbar(player, name, def.item_name) + end]] + else + player:hud_change(elem.id, "offset", def.offset) + elem.offset = def.offset + end + end + + return true +end + +function hud.remove_item(player, name) + if not player or not name then + throw_error("Not enough parameters given") + return false + end + local i_name = player:get_player_name().."_"..name + if hud_id[i_name] == nil then + throw_error("Given HUD element " .. dump(name) .. " does not exist") + return false + end + player:hud_remove(hud_id[i_name].id) + hud_id[i_name] = nil + + return true +end + +-- +-- Add registered HUD items to joining players +-- + +-- Following code is placed here to keep HUD ids internal +local function add_hud_item(player, name, def) + if not player or not name or not def then + throw_error("not enough parameters given") + return false + end + local i_name = player:get_player_name().."_"..name + hud_id[i_name] = def + hud_id[i_name].id = player:hud_add(def) +end + +core.register_on_joinplayer(function(player) + -- add the backgrounds for statbars + for _,item in pairs(sb_bg) do + add_hud_item(player, _.."_bg", item) + end + -- and finally the actual HUD items + for _,item in pairs(items) do + add_hud_item(player, _, item) + end +end) diff --git a/builtin/game/init.lua b/builtin/game/init.lua index ab1503d..f8bdaad 100644 --- a/builtin/game/init.lua +++ b/builtin/game/init.lua @@ -1,5 +1,5 @@ -local scriptpath = core.get_builtin_path() +local scriptpath = core.get_builtin_path()..DIR_DELIM local commonpath = scriptpath.."common"..DIR_DELIM local gamepath = scriptpath.."game"..DIR_DELIM @@ -31,6 +31,7 @@ assert(loadfile(gamepath.."falling.lua"))(builtin_shared) dofile(gamepath.."features.lua") dofile(gamepath.."voxelarea.lua") dofile(gamepath.."forceloading.lua") +dofile(gamepath.."hud.lua") dofile(gamepath.."statbars.lua") profiler = nil diff --git a/builtin/game/item.lua b/builtin/game/item.lua index ced2877..5c06658 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -435,23 +435,123 @@ function core.item_secondary_use(itemstack, placer) return itemstack end +local function item_throw_step(entity, dtime) + entity.throw_timer = entity.throw_timer + dtime + if entity.throw_timer > 20 then + entity.object:remove() + return + end + if not entity.thrower then + return + end + local pos = entity.object:get_pos() + if not core.is_valid_pos(pos) then + entity.object:remove() + return + end + local hit_object = nil + local dir = vector.normalize(entity.object:get_velocity()) + local pos2 = vector.add(pos, vector.multiply(dir, 3)) + local _, node_pos = minetest.line_of_sight(pos, pos2) + if node_pos then + local def = minetest.get_node(node_pos) + if def then + pos = vector.subtract(node_pos, vector.multiply(dir, 1.5)) + entity.object:move_to(pos) + else + node_pos = nil + end + end + local objs = minetest.get_objects_inside_radius(pos, 1.5) + for _, obj in pairs(objs) do + if obj:is_player() then + local name = obj:get_player_name() + if name ~= entity.thrower then + hit_object = obj + end + elseif obj:get_luaentity() ~= nil and + obj:get_luaentity().name ~= entity.name then + hit_object = obj + end + end + if hit_object or node_pos then + local player = core.get_player_by_name(entity.thrower) + entity.on_impact(player, pos, entity.throw_direction, hit_object) + entity.object:remove() + end +end + +function core.item_throw(name, thrower, speed, accel, on_impact) + if not thrower or not thrower:is_player() then + return + end + local pos = thrower:get_pos() + if not core.is_valid_pos(pos) then + return + end + pos.y = pos.y + 1.5 + local obj = nil + local properties = {is_visible=true} + if core.registered_entities[name] then + obj = core.add_entity(pos, name) + elseif core.registered_items[name] then + obj = core.add_entity(pos, "__builtin:throwing_item") + properties.textures = {name} + else + return + end + if obj then + local ent = obj:get_luaentity() + if ent then + local s = speed or 19 -- default speed + local a = accel or -3 -- default acceleration + local dir = thrower:get_look_dir() + local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 + ent.thrower = thrower:get_player_name() + ent.throw_timer = 0 + ent.throw_direction = dir + ent.on_step = item_throw_step + ent.on_impact = on_impact and on_impact or function() end + obj:set_properties(properties) + obj:set_velocity({x=dir.x * s, y=dir.y * s, z=dir.z * s}) + obj:set_acceleration({x=dir.x * a, y=-gravity, z=dir.z * a}) + return obj + else + obj:remove() + end + end +end + function core.item_drop(itemstack, dropper, pos) local dropper_is_player = dropper and dropper:is_player() local p = table.copy(pos) local cnt = itemstack:get_count() + if not core.is_valid_pos(p) then + return + end if dropper_is_player then p.y = p.y + 1.2 + if not dropper:get_player_control().sneak then + cnt = 1 + end end local item = itemstack:take_item(cnt) local obj = core.add_item(p, item) if obj then if dropper_is_player then + local vel = dropper:get_player_velocity() local dir = dropper:get_look_dir() - dir.x = dir.x * 2.9 - dir.y = dir.y * 2.9 + 2 - dir.z = dir.z * 2.9 + dir.x = vel.x + dir.x * 4 + dir.y = vel.y + dir.y * 4 + 2 + dir.z = vel.z + dir.z * 4 obj:set_velocity(dir) obj:get_luaentity().dropped_by = dropper:get_player_name() + else + obj:set_velocity({ + x = math.random(-2, 2), + y = math.random(2, 4), + z = math.random(-2, 2) + }) end return itemstack end @@ -469,11 +569,6 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed if itemstack:take_item() ~= nil then user:set_hp(user:get_hp() + hp_change) - local def = itemstack:get_definition() - if def and def.sound and def.sound.eat then - minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 }) - end - if replace_with_item then if itemstack:is_empty() then itemstack:add_item(replace_with_item) @@ -496,6 +591,28 @@ end function core.item_eat(hp_change, replace_with_item) return function(itemstack, user, pointed_thing) -- closure if user then + local pos = user:get_pos() + pos.y = pos.y + 1.3 + local itemname = itemstack:get_name() + local texture = core.registered_items[itemname].inventory_image + local dir = user:get_look_dir() + core.add_particlespawner({ + amount = 20, + time = 0.1, + minpos = pos, + maxpos = pos, + minvel = {x = dir.x - 1, y = 2, z = dir.z - 1}, + maxvel = {x = dir.x + 1, y = 2, z = dir.z + 1}, + minacc = {x = 0, y = -5, z = 0}, + maxacc = {x = 0, y = -9, z = 0}, + minexptime = 1, + maxexptime = 1, + minsize = 1, + maxsize = 1, + vertical = false, + texture = texture, + }) + core.sound_play("player_eat", {pos = pos, max_hear_distance = 10, gain = 0.3}) return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing) end end @@ -516,7 +633,7 @@ function core.handle_node_drops(pos, drops, digger) -- Add dropped items to object's inventory local inv = digger and digger:get_inventory() local give_item - if inv then + if inv and core.settings:get_bool("creative_mode") then give_item = function(item) return inv:add_item("main", item) end @@ -530,12 +647,7 @@ function core.handle_node_drops(pos, drops, digger) for _, dropped_item in pairs(drops) do local left = give_item(dropped_item) if not left:is_empty() then - local p = { - x = pos.x + math.random()/2-0.25, - y = pos.y + math.random()/2-0.25, - z = pos.z + math.random()/2-0.25, - } - core.add_item(p, left) + core.item_drop(left, nil, pos) end end end @@ -585,20 +697,6 @@ function core.node_dig(pos, node, digger) digger:set_wielded_item(wielded) end - -- Check to see if metadata should be preserved. - if def and def.preserve_metadata then - local oldmeta = core.get_meta(pos):to_table().fields - -- Copy pos and node because the callback can modify them. - local pos_copy = {x=pos.x, y=pos.y, z=pos.z} - local node_copy = {name=node.name, param1=node.param1, param2=node.param2} - local drop_stacks = {} - for k, v in pairs(drops) do - drop_stacks[k] = ItemStack(v) - end - drops = drop_stacks - def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) - end - -- Handle drops core.handle_node_drops(pos, drops, digger) @@ -637,18 +735,6 @@ function core.node_dig(pos, node, digger) end end -function core.itemstring_with_palette(item, palette_index) - local stack = ItemStack(item) -- convert to ItemStack - stack:get_meta():set_int("palette_index", palette_index) - return stack:to_string() -end - -function core.itemstring_with_color(item, colorstring) - local stack = ItemStack(item) -- convert to ItemStack - stack:get_meta():set_string("color", colorstring) - return stack:to_string() -end - -- This is used to allow mods to redefine core.item_place and so on -- NOTE: This is not the preferred way. Preferred way is to provide enough -- callbacks to not require redefining global functions. -celeron55 @@ -671,7 +757,7 @@ core.nodedef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = 64, usable = false, liquids_pointable = false, tool_capabilities = nil, @@ -735,7 +821,7 @@ core.craftitemdef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = 64, liquids_pointable = false, tool_capabilities = nil, @@ -773,7 +859,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = 64, liquids_pointable = false, tool_capabilities = nil, diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index a330e87..fe17393 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -14,9 +14,82 @@ end -- If item_entity_ttl is not set, enity will have default life time -- Setting it to -1 disables the feature -local time_to_live = tonumber(core.settings:get("item_entity_ttl")) or 900 +local time_to_live = tonumber(core.settings:get("item_entity_ttl")) or 600 local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 +-- Water flow functions by QwertyMine3 (WTFPL), and TenPlus1 (MIT) +local function to_unit_vector(dir_vector) + local inv_roots = { + [0] = 1, + [1] = 1, + [2] = 0.70710678118655, + [4] = 0.5, + [5] = 0.44721359549996, + [8] = 0.35355339059327 + } + local sum = dir_vector.x * dir_vector.x + dir_vector.z * dir_vector.z + return { + x = dir_vector.x * inv_roots[sum], + y = dir_vector.y, + z = dir_vector.z * inv_roots[sum] + } +end + +local function quick_flow_logic(node, pos_testing, direction) + local node_testing = core.get_node_or_nil(pos_testing) + if not node_testing then + node_testing = core.registered_nodes["default:dirt"] + end + if core.registered_nodes[node_testing.name].liquidtype ~= "flowing" + and core.registered_nodes[node_testing.name].liquidtype ~= "source" then + return 0 + end + local param2_testing = node_testing.param2 + if param2_testing < node.param2 then + if (node.param2 - param2_testing) > 6 then + return -direction + else + return direction + end + elseif param2_testing > node.param2 then + + if (param2_testing - node.param2) > 6 then + return direction + else + return -direction + end + end + return 0 +end + +local function quick_flow(pos, node) + if not core.registered_nodes[node.name].groups.liquid then + return {x = 0, y = 0, z = 0} + end + local x, z = 0, 0 + x = x + quick_flow_logic(node, {x = pos.x - 1, y = pos.y, z = pos.z},-1) + x = x + quick_flow_logic(node, {x = pos.x + 1, y = pos.y, z = pos.z}, 1) + z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z - 1},-1) + z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z + 1}, 1) + return to_unit_vector({x = x, y = 0, z = z}) +end + +core.register_entity(":__builtin:throwing_item", { + physical = false, + visual = "wielditem", + collisionbox = {0,0,0, 0,0,0}, + textures = {""}, + visual_size = {x=0.4, y=0.4}, + is_visible = false, + on_activate = function(self, staticdata) + if staticdata == "expired" then + self.object:remove() + end + end, + get_staticdata = function() + return "expired" + end, +}) core.register_entity(":__builtin:item", { initial_properties = { @@ -62,7 +135,7 @@ core.register_entity(":__builtin:item", { collisionbox = {-size, -coll_height, -size, size, coll_height, size}, selectionbox = {-size, -size, -size, size, size, size}, - automatic_rotate = math.pi * 0.5 * 0.2 / size, + automatic_rotate = math.pi * 0.5 * 0.15 / size, wield_item = self.itemstring, }) @@ -87,7 +160,7 @@ core.register_entity(":__builtin:item", { else self.itemstring = staticdata end - self.object:set_armor_groups({immortal = 1}) + self.object:set_armor_groups({immortal = 1, silent = 1}) self.object:set_velocity({x = 0, y = 2, z = 0}) self.object:set_acceleration({x = 0, y = -gravity, z = 0}) self:set_item() @@ -140,11 +213,18 @@ core.register_entity(":__builtin:item", { end local pos = self.object:get_pos() - local node = core.get_node_or_nil({ + self.node_inside = core.get_node_or_nil(pos) + self.def_inside = self.node_inside + and core.registered_nodes[self.node_inside.name] + self.node_under = core.get_node_or_nil({ x = pos.x, y = pos.y + self.object:get_properties().collisionbox[2] - 0.05, z = pos.z }) + self.def_under = self.node_under + and core.registered_nodes[self.node_under.name] + + local node = self.node_inside -- Delete in 'ignore' nodes if node and node.name == "ignore" then self.itemstring = "" @@ -153,11 +233,42 @@ core.register_entity(":__builtin:item", { end local vel = self.object:get_velocity() - local def = node and core.registered_nodes[node.name] + local def = self.def_inside local is_moving = (def and not def.walkable) or vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0 local is_slippery = false + -- Destroy item when dropped into lava + if def and def.groups and def.groups.lava then + core.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 10}) + self.object:remove() + core.add_particlespawner({ + amount = 3, + time = 0.1, + minpos = {x = pos.x - 0.1, y = pos.y + 0.1, z = pos.z - 0.1 }, + maxpos = {x = pos.x + 0.1, y = pos.y + 0.2, z = pos.z + 0.1 }, + minvel = {x = 0, y = 2.5, z = 0}, + maxvel = {x = 0, y = 2.5, z = 0}, + minacc = {x = -0.15, y = -0.02, z = -0.15}, + maxacc = {x = 0.15, y = -0.01, z = 0.15}, + minexptime = 4, + maxexptime = 6, + minsize = 2, + maxsize = 4, + texture = "item_smoke.png" + }) + return + end + + -- Moving items in the water flow + if def and def.liquidtype == "flowing" then + local vec = quick_flow(pos, node) + self.object:set_velocity({x = vec.x, y = vel.y, z = vec.z}) + return + end + + node = self.node_under + def = self.def_under if def and def.walkable then local slippery = core.get_item_group(node.name, "slippery") is_slippery = slippery ~= 0 @@ -190,16 +301,17 @@ core.register_entity(":__builtin:item", { self.object:set_velocity({x = 0, y = 0, z = 0}) end - --Only collect items if not moving + -- Only collect items if not moving if is_moving then return end + -- Collect the items around to merge with local own_stack = ItemStack(self.itemstring) if own_stack:get_free_space() == 0 then return end - local objects = core.get_objects_inside_radius(pos, 1.0) + local objects = core.get_objects_inside_radius(pos, 0.25) for k, obj in pairs(objects) do local entity = obj:get_luaentity() if entity and entity.name == "__builtin:item" then diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index e6d16dd..fa98814 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -39,46 +39,26 @@ function core.check_player_privs(name, ...) return true, "" end - local player_list = {} - -function core.send_join_message(player_name) - if not core.is_singleplayer() then - core.chat_send_all("*** " .. player_name .. " joined the game.") - end -end - - -function core.send_leave_message(player_name, timed_out) - local announcement = "*** " .. player_name .. " left the game." - if timed_out then - announcement = announcement .. " (timed out)" - end - core.chat_send_all(announcement) -end - - core.register_on_joinplayer(function(player) local player_name = player:get_player_name() player_list[player_name] = player - if not minetest.is_singleplayer() then - local status = core.get_server_status(player_name, true) - if status and status ~= "" then - core.chat_send_player(player_name, status) - end + if not core.is_singleplayer() then + core.chat_send_all("=> " .. player_name .. " has joined the server") end - core.send_join_message(player_name) end) - core.register_on_leaveplayer(function(player, timed_out) local player_name = player:get_player_name() player_list[player_name] = nil - core.send_leave_message(player_name, timed_out) + local announcement = "<= " .. player_name .. " left the server" + if timed_out then + announcement = announcement .. " (timed out)" + end + core.chat_send_all(announcement) end) - function core.get_connected_players() local temp_table = {} for index, value in pairs(player_list) do @@ -103,10 +83,8 @@ function core.player_exists(name) return core.get_auth_handler().get_auth(name) ~= nil end - -- Returns two position vectors representing a box of `radius` in each -- direction centered around the player corresponding to `player_name` - function core.get_player_radius_area(player_name, radius) local player = core.get_player_by_name(player_name) if player == nil then @@ -124,25 +102,32 @@ function core.get_player_radius_area(player_name, radius) return p1, p2 end - -function core.hash_node_position(pos) - return (pos.z + 32768) * 65536 * 65536 - + (pos.y + 32768) * 65536 - + pos.x + 32768 +local mapgen_limit = tonumber(core.settings:get("mapgen_limit")) +function core.is_valid_pos(pos) + if pos then + for _, v in pairs({"x", "y", "z"}) do + if not pos[v] or pos[v] < -mapgen_limit or pos[v] > mapgen_limit then + return + end + end + return true + end end +function core.hash_node_position(pos) + return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768 +end function core.get_position_from_hash(hash) local pos = {} - pos.x = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.y = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.z = (hash % 65536) - 32768 + pos.x = (hash%65536) - 32768 + hash = math.floor(hash/65536) + pos.y = (hash%65536) - 32768 + hash = math.floor(hash/65536) + pos.z = (hash%65536) - 32768 return pos end - function core.get_item_group(name, group) if not core.registered_items[name] or not core.registered_items[name].groups[group] then @@ -151,13 +136,11 @@ function core.get_item_group(name, group) return core.registered_items[name].groups[group] end - function core.get_node_group(name, group) core.log("deprecated", "Deprecated usage of get_node_group, use get_item_group instead") return core.get_item_group(name, group) end - function core.setting_get_pos(name) local value = core.settings:get(name) if not value then @@ -166,22 +149,19 @@ function core.setting_get_pos(name) return core.string_to_pos(value) end - -- To be overriden by protection mods - function core.is_protected(pos, name) return false end - function core.record_protection_violation(pos, name) for _, func in pairs(core.registered_on_protection_violation) do func(pos, name) end end - -- Checks if specified volume intersects a protected volume +-- Backport from Minetest 5.0 function core.is_area_protected(minp, maxp, player_name, interval) -- 'interval' is the largest allowed interval for the 3D lattice of checks. @@ -227,7 +207,6 @@ function core.is_area_protected(minp, maxp, player_name, interval) return false end - local raillike_ids = {} local raillike_cur_id = 0 function core.raillike_group(name) @@ -240,9 +219,7 @@ function core.raillike_group(name) return id end - -- HTTP callback interface - function core.http_add_fetch(httpenv) httpenv.fetch = function(req, callback) local handle = httpenv.fetch_async(req) @@ -261,12 +238,10 @@ function core.http_add_fetch(httpenv) return httpenv end - function core.close_formspec(player_name, formname) return core.show_formspec(player_name, formname, "") end - function core.cancel_shutdown_requests() core.request_shutdown("", false, -1) end diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua index d77a481..56e090f 100644 --- a/builtin/game/privileges.lua +++ b/builtin/game/privileges.lua @@ -11,9 +11,6 @@ function core.register_privilege(name, param) if def.give_to_singleplayer == nil then def.give_to_singleplayer = true end - if def.give_to_admin == nil then - def.give_to_admin = def.give_to_singleplayer - end if def.description == nil then def.description = "(no description)" end @@ -34,7 +31,7 @@ core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privil core.register_privilege("privs", "Can modify privileges") core.register_privilege("teleport", { - description = "Can teleport self", + description = "Can use /teleport command", give_to_singleplayer = false, }) core.register_privilege("bring", { @@ -42,13 +39,12 @@ core.register_privilege("bring", { give_to_singleplayer = false, }) core.register_privilege("settime", { - description = "Can set the time of day using /time", + description = "Can use /time", give_to_singleplayer = false, }) core.register_privilege("server", { description = "Can do server maintenance stuff", give_to_singleplayer = false, - give_to_admin = true, }) core.register_privilege("protection_bypass", { description = "Can bypass node protection in the world", @@ -57,12 +53,10 @@ core.register_privilege("protection_bypass", { core.register_privilege("ban", { description = "Can ban and unban players", give_to_singleplayer = false, - give_to_admin = true, }) core.register_privilege("kick", { description = "Can kick players", give_to_singleplayer = false, - give_to_admin = true, }) core.register_privilege("give", { description = "Can use /give and /giveme", @@ -71,31 +65,28 @@ core.register_privilege("give", { core.register_privilege("password", { description = "Can use /setpassword and /clearpassword", give_to_singleplayer = false, - give_to_admin = true, }) core.register_privilege("fly", { - description = "Can use fly mode", + description = "Can fly using the free_move mode", give_to_singleplayer = false, }) core.register_privilege("fast", { - description = "Can use fast mode", + description = "Can walk fast using the fast_move mode", give_to_singleplayer = false, }) core.register_privilege("noclip", { - description = "Can fly through solid nodes using noclip mode", + description = "Can fly through walls", give_to_singleplayer = false, }) core.register_privilege("rollback", { description = "Can use the rollback functionality", give_to_singleplayer = false, }) +core.register_privilege("zoom", { + description = "Can zoom the camera", + give_to_singleplayer = false, +}) core.register_privilege("debug", { description = "Allows enabling various debug options that may affect gameplay", give_to_singleplayer = false, - give_to_admin = true, }) - -core.register_can_bypass_userlimit(function(name, ip) - local privs = core.get_player_privs(name) - return privs["server"] or privs["ban"] or privs["privs"] or privs["password"] -end) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 3edab04..9bb4439 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -65,14 +65,14 @@ local function check_modname_prefix(name) error("Name " .. name .. " does not follow naming conventions: " .. "\"" .. expected_prefix .. "\" or \":\" prefix required") end - + -- Enforce that the name only contains letters, numbers and underscores. local subname = name:sub(#expected_prefix+1) if subname:find("[^%w_]") then error("Name " .. name .. " does not follow naming conventions: " .. "contains unallowed characters") end - + return name end end @@ -177,7 +177,7 @@ function core.register_item(name, itemdef) --core.log("Registering item: " .. itemdef.name) core.registered_items[itemdef.name] = itemdef core.registered_aliases[itemdef.name] = nil - register_item_raw(itemdef) + register_item_raw(itemdef) end function core.unregister_item(name) @@ -331,8 +331,8 @@ core.register_item(":unknown", { core.register_node(":air", { description = "Air", - inventory_image = "air.png", - wield_image = "air.png", + inventory_image = "blank.png", + wield_image = "blank.png", drawtype = "airlike", paramtype = "light", sunlight_propagates = true, @@ -343,11 +343,12 @@ core.register_node(":air", { floodable = true, air_equivalent = true, drop = "", + drowning = 0, groups = {not_in_creative_inventory=1}, }) core.register_node(":ignore", { - description = "Ignore", + description = "Ignore (you hacker you!)", inventory_image = "ignore.png", wield_image = "ignore.png", drawtype = "airlike", @@ -359,14 +360,8 @@ core.register_node(":ignore", { buildable_to = true, -- A way to remove accidentally placed ignores air_equivalent = true, drop = "", + drowning = 0, groups = {not_in_creative_inventory=1}, - on_place = function(itemstack, placer, pointed_thing) - minetest.chat_send_player( - placer:get_player_name(), - minetest.colorize("#FF0000", - "You can't place 'ignore' nodes!")) - return "" - end, }) -- The hand (bare definition) @@ -394,6 +389,16 @@ function core.override_item(name, redefinition) end +function core.add_group(name, adding) + local addgroup = {} + addgroup = table.copy(core.registered_items[name].groups) + for k, v in pairs(adding) do + addgroup[k] = v + end + core.override_item(name, {groups = addgroup}) +end + + core.callback_origins = {} function core.run_callbacks(callbacks, mode, ...) @@ -442,18 +447,6 @@ function core.run_callbacks(callbacks, mode, ...) return ret end -function core.run_priv_callbacks(name, priv, caller, method) - local def = core.registered_privileges[priv] - if not def or not def["on_" .. method] or - not def["on_" .. method](name, caller) then - for _, func in ipairs(core["registered_on_priv_" .. method]) do - if not func(name, caller, priv) then - break - end - end - end -end - -- -- Callback registration -- @@ -513,26 +506,13 @@ local function make_registration_wrap(reg_fn_name, clear_fn_name) return list end -local function make_wrap_deregistration(reg_fn, clear_fn, list) - local unregister = function (unregistered_key) - local temporary_list = table.copy(list) - clear_fn() - for k,v in pairs(temporary_list) do - if unregistered_key ~= k then - reg_fn(v) - end - end - end - return unregister -end - core.registered_on_player_hpchanges = { modifiers = { }, loggers = { } } -function core.registered_on_player_hpchange(player, hp_change, reason) +function core.registered_on_player_hpchange(player, hp_change) local last = false for i = #core.registered_on_player_hpchanges.modifiers, 1, -1 do local func = core.registered_on_player_hpchanges.modifiers[i] - hp_change, last = func(player, hp_change, reason) + hp_change, last = func(player, hp_change) if type(hp_change) ~= "number" then local debuginfo = debug.getinfo(func) error("The register_on_hp_changes function has to return a number at " .. @@ -543,7 +523,7 @@ function core.registered_on_player_hpchange(player, hp_change, reason) end end for i, func in ipairs(core.registered_on_player_hpchanges.loggers) do - func(player, hp_change, reason) + func(player, hp_change) end return hp_change end @@ -564,12 +544,9 @@ core.registered_biomes = make_registration_wrap("register_biome", "cle core.registered_ores = make_registration_wrap("register_ore", "clear_registered_ores") core.registered_decorations = make_registration_wrap("register_decoration", "clear_registered_decorations") -core.unregister_biome = make_wrap_deregistration(core.register_biome, core.clear_registered_biomes, core.registered_biomes) - core.registered_on_chat_messages, core.register_on_chat_message = make_registration() core.registered_globalsteps, core.register_globalstep = make_registration() core.registered_playerevents, core.register_playerevent = make_registration() -core.registered_on_mods_loaded, core.register_on_mods_loaded = make_registration() core.registered_on_shutdown, core.register_on_shutdown = make_registration() core.registered_on_punchnodes, core.register_on_punchnode = make_registration() core.registered_on_placenodes, core.register_on_placenode = make_registration() @@ -588,16 +565,103 @@ core.registered_craft_predicts, core.register_craft_predict = make_registration( core.registered_on_protection_violation, core.register_on_protection_violation = make_registration() core.registered_on_item_eats, core.register_on_item_eat = make_registration() core.registered_on_punchplayers, core.register_on_punchplayer = make_registration() -core.registered_on_priv_grant, core.register_on_priv_grant = make_registration() -core.registered_on_priv_revoke, core.register_on_priv_revoke = make_registration() -core.registered_can_bypass_userlimit, core.register_can_bypass_userlimit = make_registration() -core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration() -core.registered_on_auth_fail, core.register_on_auth_fail = make_registration() -core.registered_on_player_inventory_actions, core.register_on_player_inventory_action = make_registration() -core.registered_allow_player_inventory_actions, core.register_allow_player_inventory_action = make_registration() + +-- Player step iteration + +players_per_step = core.settings:get("players_per_globalstep") +players_per_step = players_per_step and tonumber(players_per_step) or 20 + +local player_iter = nil +local player_iter_forced = nil +local playerstep_iter = nil +local playerstep_funcs = {} +local playerstep_funcs_forced = {} +local playernames = {} +local playernames_forced = {} + +core.register_playerstep = function(func, force) + local funcs = force and playerstep_funcs_forced or playerstep_funcs + funcs[#funcs + 1] = func +end + +local function table_iter(t) + local i = 0 + local n = table.getn(t) + return function () + i = i + 1 + if i <= n then + return t[i] + end + end +end + +function core.get_player_iter() + local names = {} + for player in table_iter(core.get_connected_players()) do + local name = player:get_player_name() + if name then + names[#names + 1] = name + end + end + return table_iter(names) +end + +local function get_playerstep_func() + if playerstep_iter == nil then + playerstep_iter = table_iter(playerstep_funcs) + playernames = {} + for _ = 1, players_per_step do + if player_iter == nil then + player_iter = core.get_player_iter() + end + local name = player_iter() + if not name then + player_iter = nil + break + end + playernames[#playernames + 1] = name + end + end + local func = playerstep_iter() + playerstep_iter = func and playerstep_iter + return func or get_playerstep_func() +end + +-- Run playerstep callbacks + +core.register_globalstep(function(dtime) + -- Run forced callbacks + if #playerstep_funcs_forced ~= 0 then + playernames_forced = {} + for _ = 1, players_per_step do + if player_iter_forced == nil then + player_iter_forced = core.get_player_iter() + end + local name = player_iter_forced() + if not name then + player_iter_forced = nil + break + end + playernames_forced[#playernames_forced + 1] = name + end + for func in table_iter(playerstep_funcs_forced) do + if type(func) == "function" then + func(dtime, playernames_forced) + end + end + end + if #playerstep_funcs ~= 0 then + -- Run single step callbacks + local func = get_playerstep_func() + if type(func) == "function" then + func(dtime, playernames) + end + end +end) -- -- Compatibility for on_mapgen_init() -- core.register_on_mapgen_init = function(func) func(core.get_mapgen_params()) end + diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index da924d6..db9d7e1 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -1,87 +1,85 @@ -- cache setting local enable_damage = core.settings:get_bool("enable_damage") -local health_bar_definition = -{ +local health_bar_definition = { hud_elem_type = "statbar", - position = { x=0.5, y=1 }, - text = "heart.png", - number = core.PLAYER_MAX_HP_DEFAULT, - direction = 0, - size = { x=24, y=24 }, - offset = { x=(-10*24)-25, y=-(48+24+16)}, + position = {x = 0.5, y = 1}, + alignment = {x = -1, y = -1}, + offset = {x = -247, y = -108}, + size = {x = 24, y = 24}, + text = "heart.png", + background = "heart_bg.png", + number = 20 } -local breath_bar_definition = -{ +local breath_bar_definition = { hud_elem_type = "statbar", - position = { x=0.5, y=1 }, - text = "bubble.png", - number = core.PLAYER_MAX_BREATH_DEFAULT, - direction = 0, - size = { x=24, y=24 }, - offset = {x=25,y=-(48+24+16)}, + position = {x = 0.5, y = 1}, + alignment = {x = -1, y = -1}, + offset = {x = 8, y = -134}, + size = {x = 24, y = 24}, + text = "bubble.png", + number = 20 } local hud_ids = {} -local function scaleToDefault(player, field) - -- Scale "hp" or "breath" to the default dimensions - local current = player["get_" .. field](player) - local nominal = core["PLAYER_MAX_".. field:upper() .. "_DEFAULT"] - local max_display = math.max(nominal, - math.max(player:get_properties()[field .. "_max"], current)) - return current / max_display * nominal -end +local function initialize_builtin_statbars(player) + + if not player:is_player() then + return + end -local function update_builtin_statbars(player) local name = player:get_player_name() if name == "" then return end - local flags = player:hud_get_flags() - if not hud_ids[name] then + if (hud_ids[name] == nil) then hud_ids[name] = {} -- flags are not transmitted to client on connect, we need to make sure -- our current flags are transmitted by sending them actively - player:hud_set_flags(flags) - end - local hud = hud_ids[name] - - if flags.healthbar and enable_damage then - local number = scaleToDefault(player, "hp") - if hud.id_healthbar == nil then - local hud_def = table.copy(health_bar_definition) - hud_def.number = number - hud.id_healthbar = player:hud_add(hud_def) - else - player:hud_change(hud.id_healthbar, "number", number) - end - elseif hud.id_healthbar then - player:hud_remove(hud.id_healthbar) - hud.id_healthbar = nil + player:hud_set_flags(player:hud_get_flags()) end - local breath_max = player:get_properties().breath_max - if flags.breathbar and enable_damage and - player:get_breath() < breath_max then - local number = 2 * scaleToDefault(player, "breath") - if hud.id_breathbar == nil then - local hud_def = table.copy(breath_bar_definition) - hud_def.number = number - hud.id_breathbar = player:hud_add(hud_def) - else - player:hud_change(hud.id_breathbar, "number", number) + if player:hud_get_flags().healthbar and enable_damage then + if hud_ids[name].id_healthbar == nil then + hud_ids[name].id_healthbar = hud.register("health", health_bar_definition) + minetest.after(0, function() + hud.change_item(player, "health", {number = player:get_hp()}) + end) end - elseif hud.id_breathbar then - player:hud_remove(hud.id_breathbar) - hud.id_breathbar = nil + else + if hud_ids[name].id_healthbar ~= nil then + player:hud_remove(hud_ids[name].id_healthbar) + hud_ids[name].id_healthbar = nil + end + end + + if (player:get_breath() < 11) then + if player:hud_get_flags().breathbar and enable_damage then + if hud_ids[name].id_breathbar == nil then + hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition) + end + else + if hud_ids[name].id_breathbar ~= nil then + player:hud_remove(hud_ids[name].id_breathbar) + hud_ids[name].id_breathbar = nil + end + end + elseif hud_ids[name].id_breathbar ~= nil then + player:hud_remove(hud_ids[name].id_breathbar) + hud_ids[name].id_breathbar = nil end end local function cleanup_builtin_statbars(player) + + if not player:is_player() then + return + end + local name = player:get_player_name() if name == "" then @@ -91,55 +89,57 @@ local function cleanup_builtin_statbars(player) hud_ids[name] = nil end -local function player_event_handler(player,eventname) +local function player_event_handler(player, eventname) assert(player:is_player()) local name = player:get_player_name() - if name == "" or not hud_ids[name] then + if name == "" then return end if eventname == "health_changed" then - update_builtin_statbars(player) + initialize_builtin_statbars(player) - if hud_ids[name].id_healthbar then + if hud_id[name.."_".."health"] ~= nil then + hud.change_item(player, "health", {number = player:get_hp()}) return true end end if eventname == "breath_changed" then - update_builtin_statbars(player) + initialize_builtin_statbars(player) - if hud_ids[name].id_breathbar then + if hud_ids[name].id_breathbar ~= nil then + player:hud_change(hud_ids[name].id_breathbar,"number",player:get_breath()*2) return true end end if eventname == "hud_changed" then - update_builtin_statbars(player) + initialize_builtin_statbars(player) return true end return false end -function core.hud_replace_builtin(name, definition) +--[[function core.hud_replace_builtin(name, definition) - if type(definition) ~= "table" or - definition.hud_elem_type ~= "statbar" then + if definition == nil or + type(definition) ~= "table" or + definition.hud_elem_type ~= "statbar" then return false end if name == "health" then health_bar_definition = definition - for name, ids in pairs(hud_ids) do + for name,ids in pairs(hud_ids) do local player = core.get_player_by_name(name) - if player and ids.id_healthbar then - player:hud_remove(ids.id_healthbar) - ids.id_healthbar = nil - update_builtin_statbars(player) + if player and hud_ids[name].id_healthbar then + player:hud_remove(hud_ids[name].id_healthbar) + initialize_builtin_statbars(player) end end return true @@ -148,24 +148,68 @@ function core.hud_replace_builtin(name, definition) if name == "breath" then breath_bar_definition = definition - for name, ids in pairs(hud_ids) do + for name,ids in pairs(hud_ids) do local player = core.get_player_by_name(name) - if player and ids.id_breathbar then - player:hud_remove(ids.id_breathbar) - ids.id_breathbar = nil - update_builtin_statbars(player) + if player and hud_ids[name].id_breathbar then + player:hud_remove(hud_ids[name].id_breathbar) + initialize_builtin_statbars(player) end end return true end return false +end]] + +if enable_damage then + core.register_on_joinplayer(initialize_builtin_statbars) + core.register_on_leaveplayer(cleanup_builtin_statbars) + core.register_playerevent(player_event_handler) end --- Append "update_builtin_statbars" as late as possible --- This ensures that the HUD is hidden when the flags are updated in this callback -core.register_on_mods_loaded(function() - core.register_on_joinplayer(update_builtin_statbars) -end) -core.register_on_leaveplayer(cleanup_builtin_statbars) -core.register_playerevent(player_event_handler) +-- Hud Item name +local timer, wield = {}, {} +local timeout = 2 + +hud.register("itemname", { + hud_elem_type = "text", + position = {x = 0.5, y = 1}, + alignment = {x = 0, y = -10}, + offset = {x = 0, y = -25}, + number = 0xFFFFFF, + text = "" +}) + +minetest.register_playerstep(function(dtime, playernames) + for _, name in pairs(playernames) do + local player = minetest.get_player_by_name(name) + if player and player:is_player() then + local wielded_item = player:get_wielded_item() + local wielded_item_name = wielded_item:get_name() + + timer[player] = timer[player] and timer[player] + dtime or 0 + wield[player] = wield[player] or "" + + if timer[player] > timeout then + hud.change_item(player, "itemname", {text = ""}) + timer[player] = 0 + return + end + + if player and wielded_item_name ~= wield[player] then + wield[player] = wielded_item_name + timer[player] = 0 + + local def = core.registered_items[wielded_item_name] + local meta = wielded_item:get_meta() + local meta_desc = meta:get_string("description") + meta_desc = meta_desc:gsub("\27", ""):gsub("%(c@#%w%w%w%w%w%w%)", "") + + local description = meta_desc ~= "" and meta_desc or + (def and (def.description:match("(.-)\n") or def.description) or "") + + hud.change_item(player, "itemname", {text = description}) + end + end + end +end, minetest.is_singleplayer()) -- Force step in singlplayer mode only diff --git a/builtin/game/static_spawn.lua b/builtin/game/static_spawn.lua index fae23ea..06cd36a 100644 --- a/builtin/game/static_spawn.lua +++ b/builtin/game/static_spawn.lua @@ -1,12 +1,12 @@ -- Minetest: builtin/static_spawn.lua local static_spawnpoint_string = core.settings:get("static_spawnpoint") -if static_spawnpoint_string and + if static_spawnpoint_string and static_spawnpoint_string ~= "" and - not core.setting_get_pos("static_spawnpoint") then + not core.setting_get_pos("static_spawnpoint") then error('The static_spawnpoint setting is invalid: "' .. static_spawnpoint_string .. '"') -end + end local function put_player_in_spawn(player_obj) local static_spawnpoint = core.setting_get_pos("static_spawnpoint") diff --git a/builtin/init.lua b/builtin/init.lua index f76174b..73ab5cf 100644 --- a/builtin/init.lua +++ b/builtin/init.lua @@ -24,7 +24,7 @@ math.randomseed(os.time()) minetest = core -- Load other files -local scriptdir = core.get_builtin_path() +local scriptdir = core.get_builtin_path() .. DIR_DELIM local gamepath = scriptdir .. "game" .. DIR_DELIM local clientpath = scriptdir .. "client" .. DIR_DELIM local commonpath = scriptdir .. "common" .. DIR_DELIM diff --git a/builtin/mainmenu/tab_server.lua b/builtin/mainmenu/tab_server.lua new file mode 100644 index 0000000..21b83a1 --- /dev/null +++ b/builtin/mainmenu/tab_server.lua @@ -0,0 +1,200 @@ +--Minetest +--Copyright (C) 2014 sapier +-- +--This program 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 3.0 of the License, or +--(at your option) any later version. +-- +--This program 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 program; if not, write to the Free Software Foundation, Inc., +--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +-------------------------------------------------------------------------------- +local function get_formspec(tabview, name, tabdata) + + local index = menudata.worldlist:get_current_index( + tonumber(core.setting_get("mainmenu_last_selected_world")) + ) + + local retval = + "button[4,4.15;2.6,0.5;world_delete;" .. fgettext("Delete") .. "]" .. + "button[6.5,4.15;2.8,0.5;world_create;" .. fgettext("New") .. "]" .. +-- "button[9.2,4.15;2.55,0.5;world_configure;" .. fgettext("Configure") .. "]" .. + "button[8.5,4.95;3.25,0.5;start_server;" .. fgettext("Start Game") .. "]" .. + "label[4,-0.25;" .. fgettext("Select World:") .. "]" .. + "checkbox[0.25,0.25;cb_creative_mode;" .. fgettext("Creative Inventory") .. ";" .. + dump(core.setting_getbool("creative_mode")) .. "]" .. + "checkbox[0.25,0.7;cb_enable_damage;" .. fgettext("Survival Mode") .. ";" .. + dump(core.setting_getbool("enable_damage")) .. "]" .. + dump(core.setting_getbool("server_announce")) .. "]" .. + "label[0.25,2.2;" .. fgettext("Name/Password") .. "]" .. + "field[0.55,3.2;3.5,0.5;te_playername;;" .. + core.formspec_escape(core.setting_get("name")) .. "]" .. + "pwdfield[0.55,4;3.5,0.5;te_passwd;]" + + if PLATFORM ~= "Android" and PLATFORM ~= "iOS" then + retval = retval .. + "checkbox[0.25,1.15;cb_server_announce;" .. fgettext("Public") .. ";" + return retval + end + + local bind_addr = core.setting_get("bind_address") + if bind_addr ~= nil and bind_addr ~= "" then + retval = retval .. + "field[0.55,5.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" .. + core.formspec_escape(core.setting_get("bind_address")) .. "]" .. + "field[2.8,5.2;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" .. + core.formspec_escape(core.setting_get("port")) .. "]" + else + retval = retval .. + "field[0.55,5.2;3.5,0.5;te_serverport;" .. fgettext("Server Port") .. ";" .. + core.formspec_escape(core.setting_get("port")) .. "]" + end + + retval = retval .. + "textlist[4,0.25;7.5,3.7;srv_worlds;" .. + menu_render_worldlist() .. + ";" .. index .. ";true]" + + return retval +end + +-------------------------------------------------------------------------------- +local function main_button_handler(this, fields, name, tabdata) + + local world_doubleclick = false + + if fields["srv_worlds"] ~= nil then + local event = core.explode_textlist_event(fields["srv_worlds"]) + local selected = core.get_textlist_index("srv_worlds") + + menu_worldmt_legacy(selected) + + if event.type == "DCL" then + world_doubleclick = true + end + if event.type == "CHG" then + core.settings:set("mainmenu_last_selected_world", + menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds"))) + return true + end + end + + if menu_handle_key_up_down(fields,"srv_worlds","mainmenu_last_selected_world") then + return true + end + + if fields["cb_creative_mode"] then + core.settings:set("creative_mode", fields["cb_creative_mode"]) + local selected = core.get_textlist_index("srv_worlds") + menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"]) + + return true + end + + if fields["cb_enable_damage"] then + core.settings:set("enable_damage", fields["cb_enable_damage"]) + local selected = core.get_textlist_index("srv_worlds") + menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"]) + + return true + end + + if fields["cb_server_announce"] then + core.settings:set("server_announce", fields["cb_server_announce"]) + local selected = core.get_textlist_index("srv_worlds") + menu_worldmt(selected, "server_announce", fields["cb_server_announce"]) + + return true + end + + if fields["start_server"] ~= nil or + world_doubleclick or + fields["key_enter"] then + local selected = core.get_textlist_index("srv_worlds") + gamedata.selected_world = menudata.worldlist:get_raw_index(selected) + if selected ~= nil and gamedata.selected_world ~= 0 then + gamedata.playername = fields["te_playername"] + gamedata.password = fields["te_passwd"] + gamedata.port = fields["te_serverport"] + gamedata.address = "" + + core.settings:set("port",gamedata.port) + if fields["te_serveraddr"] ~= nil then + core.settings:set("bind_address",fields["te_serveraddr"]) + end + + --update last game + local world = menudata.worldlist:get_raw_element(gamedata.selected_world) + if world then + local game, index = gamemgr.find_by_gameid(world.gameid) + core.settings:set("menu_last_game", game.id) + end + + core.start() + else + gamedata.errormessage = + fgettext("No world created or selected!") + end + return true + end + + if fields["world_create"] ~= nil then + local create_world_dlg = create_create_world_dlg(true) + create_world_dlg:set_parent(this) + create_world_dlg:show() + this:hide() + return true + end + + if fields["world_delete"] ~= nil then + local selected = core.get_textlist_index("srv_worlds") + if selected ~= nil and + selected <= menudata.worldlist:size() then + local world = menudata.worldlist:get_list()[selected] + if world ~= nil and + world.name ~= nil and + world.name ~= "" then + local index = menudata.worldlist:get_raw_index(selected) + local delete_world_dlg = create_delete_world_dlg(world.name,index) + delete_world_dlg:set_parent(this) + delete_world_dlg:show() + this:hide() + end + end + + return true + end + + if fields["world_configure"] ~= nil then + local selected = core.get_textlist_index("srv_worlds") + if selected ~= nil then + local configdialog = + create_configure_world_dlg( + menudata.worldlist:get_raw_index(selected)) + + if (configdialog ~= nil) then + configdialog:set_parent(this) + configdialog:show() + this:hide() + end + end + return true + end + return false +end + +-------------------------------------------------------------------------------- +return { + name = "server", + caption = fgettext("Create Server"), + cbf_formspec = get_formspec, + cbf_button_handler = main_button_handler, + on_change = nil +} diff --git a/builtin/profiler/init.lua b/builtin/profiler/init.lua index a0033d7..e0aaa9b 100644 --- a/builtin/profiler/init.lua +++ b/builtin/profiler/init.lua @@ -3,7 +3,7 @@ -- --This program 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 +--the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, @@ -23,7 +23,7 @@ local function get_bool_default(name, default) return val end -local profiler_path = core.get_builtin_path().."profiler"..DIR_DELIM +local profiler_path = core.get_builtin_path()..DIR_DELIM.."profiler"..DIR_DELIM local profiler = {} local sampler = assert(loadfile(profiler_path .. "sampling.lua"))(profiler) local instrumentation = assert(loadfile(profiler_path .. "instrumentation.lua"))(profiler, sampler, get_bool_default) diff --git a/builtin/profiler/instrumentation.lua b/builtin/profiler/instrumentation.lua index 2ab658b..5c23a59 100644 --- a/builtin/profiler/instrumentation.lua +++ b/builtin/profiler/instrumentation.lua @@ -3,7 +3,7 @@ -- --This program 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 +--the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, @@ -88,7 +88,7 @@ local function instrument(def) if not def or not def.func then return end - def.mod = def.mod or get_current_modname() or "??" + def.mod = def.mod or get_current_modname() local modname = def.mod local instrument_name = generate_name(def) local func = def.func diff --git a/builtin/profiler/reporter.lua b/builtin/profiler/reporter.lua index fed47a3..f06e7f1 100644 --- a/builtin/profiler/reporter.lua +++ b/builtin/profiler/reporter.lua @@ -3,7 +3,7 @@ -- --This program 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 +--the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, @@ -73,7 +73,7 @@ local Formatter = { end } -local widths = { 55, 9, 9, 9, 5, 5, 5 } +local widths = { 50, 8, 8, 8, 5, 5, 5 } local txt_row_format = sprintf(" %%-%ds | %%%ds | %%%ds | %%%ds | %%%ds | %%%ds | %%%ds", unpack(widths)) local HR = {} diff --git a/builtin/profiler/sampling.lua b/builtin/profiler/sampling.lua index 4b53399..60b71ba 100644 --- a/builtin/profiler/sampling.lua +++ b/builtin/profiler/sampling.lua @@ -3,7 +3,7 @@ -- --This program 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 +--the Free Software Foundation; either version 3.0 of the License, or --(at your option) any later version. -- --This program is distributed in the hope that it will be useful, diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 5d68007..4e29523 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -12,12 +12,9 @@ # - float # - enum # - path -# - filepath # - key (will be ignored in GUI, since a special key change dialog exists) # - flags -# - noise_params_2d -# - noise_params_3d -# - v3f +# - noise_params # # `type_args` can be: # * int: @@ -34,22 +31,13 @@ # - default value1,value2,... # * path: # - default (if default is not specified then "" is set) -# * filepath: -# - default (if default is not specified then "" is set) # * key: # - default # * flags: # Flags are always separated by comma without spaces. # - default possible_flags -# * noise_params_2d: -# Format is , , (, , ), , , , [, ] -# - default -# * noise_params_3d: -# Format is , , (, , ), , , , [, ] -# - default -# * v3f: -# Format is (, , ) -# - default +# * noise_params: +# TODO: these are currently treated like strings # # Comments directly above a setting are bound to this setting. # All other comments are ignored. @@ -63,7 +51,9 @@ # There shouldn't be too much settings per category; settings that shouldn't be # modified by the "average user" should be in (sub-)categories called "Advanced". -[Controls] +[Client] + +[*Controls] # If enabled, you can place blocks at the position (feet + eye level) where you stand. # This is helpful when working with nodeboxes in small areas. enable_build_where_you_stand (Build inside player) bool false @@ -72,10 +62,7 @@ enable_build_where_you_stand (Build inside player) bool false # This requires the "fly" privilege on the server. free_move (Flying) bool false -# If enabled, makes move directions relative to the player's pitch when flying or swimming. -pitch_move (Pitch move mode) bool false - -# Fast movement (via the "special" key). +# Fast movement (via use key). # This requires the "fast" privilege on the server. fast_move (Fast movement) bool false @@ -99,54 +86,32 @@ invert_mouse (Invert mouse) bool false # Mouse sensitivity multiplier. mouse_sensitivity (Mouse sensitivity) float 0.2 -# If enabled, "special" key instead of "sneak" key is used for climbing down and -# descending. -aux1_descends (Special key for climbing/descending) bool false +# If enabled, "use" key instead of "sneak" key is used for climbing down and descending. +aux1_descends (Key use for climbing/descending) bool false # Double-tapping the jump key toggles fly mode. doubletap_jump (Double tap jump for fly) bool false -# If disabled, "special" key is used to fly fast if both fly and fast mode are -# enabled. +# If disabled "use" key is used to fly fast if both fly and fast mode are enabled. always_fly_fast (Always fly and fast) bool true -# The time in seconds it takes between repeated right clicks when holding the right -# mouse button. +# The time in seconds it takes between repeated right clicks when holding the right mouse button. repeat_rightclick_time (Rightclick repetition interval) float 0.25 -# Automatically jump up single-node obstacles. -autojump (Automatic jumping) bool false - -# Prevent digging and placing from repeating when holding the mouse buttons. -# Enable this when you dig or place too often by accident. -safe_dig_and_place (Safe digging and placing) bool false - # Enable random user input (only used for testing). random_input (Random input) bool false -# Continuous forward movement, toggled by autoforward key. -# Press the autoforward key again or the backwards movement to disable. +# Continuous forward movement (only used for testing). continuous_forward (Continuous forward) bool false -# The length in pixels it takes for touch screen interaction to start. -touchscreen_threshold (Touch screen threshold) int 20 0 100 - -# (Android) Fixes the position of virtual joystick. -# If disabled, virtual joystick will center to first-touch's position. -fixed_virtual_joystick (Fixed virtual joystick) bool false - -# (Android) Use virtual joystick to trigger "aux" button. -# If enabled, virtual joystick will also tap "aux" button when out of main circle. -virtual_joystick_triggers_aux (Virtual joystick triggers aux button) bool false - -# Enable joysticks -enable_joysticks (Enable joysticks) bool false +# Enable Joysticks +enable_joysticks (Enable Joysticks) bool false # The identifier of the joystick to use joystick_id (Joystick ID) int 0 # The type of joystick -joystick_type (Joystick type) enum auto auto,generic,xbox +joystick_type (Joystick Type) enum auto auto,generic,xbox # The time in seconds it takes between repeated events # when holding down a joystick button combination. @@ -161,7 +126,6 @@ joystick_frustum_sensitivity (Joystick frustum sensitivity) float 170 keymap_forward (Forward key) key KEY_KEY_W # Key for moving the player backward. -# Will also disable autoforward, when active. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_backward (Backward key) key KEY_KEY_S @@ -188,7 +152,7 @@ keymap_inventory (Inventory key) key KEY_KEY_I # Key for moving fast in fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_special1 (Special key) key KEY_KEY_E +keymap_special1 (Use key) key KEY_KEY_E # Key for opening the chat window. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 @@ -210,10 +174,6 @@ keymap_rangeselect (Range select key) key KEY_KEY_R # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_freemove (Fly key) key KEY_KEY_K -# Key for toggling pitch move mode. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_pitchmove (Pitch move key) key KEY_KEY_L - # Key for toggling fast mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_fastmove (Fast key) key KEY_KEY_J @@ -242,9 +202,9 @@ keymap_increase_volume (Inc. volume key) key # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_decrease_volume (Dec. volume key) key -# Key for toggling autoforward. +# Key for toggling autorun. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_autoforward (Automatic forward key) key +keymap_autorun (Autorun key) key # Key for toggling cinematic mode. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 @@ -266,139 +226,11 @@ keymap_drop (Drop item key) key KEY_KEY_Q # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_zoom (View zoom key) key KEY_KEY_Z -# Key for selecting the first hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot1 (Hotbar slot 1 key) key KEY_KEY_1 - -# Key for selecting the second hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot2 (Hotbar slot 2 key) key KEY_KEY_2 - -# Key for selecting the third hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot3 (Hotbar slot 3 key) key KEY_KEY_3 - -# Key for selecting the fourth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot4 (Hotbar slot 4 key) key KEY_KEY_4 - -# Key for selecting the fifth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot5 (Hotbar slot 5 key) key KEY_KEY_5 - -# Key for selecting the sixth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot6 (Hotbar slot 6 key) key KEY_KEY_6 - -# Key for selecting the seventh hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot7 (Hotbar slot 7 key) key KEY_KEY_7 - -# Key for selecting the eighth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot8 (Hotbar slot 8 key) key KEY_KEY_8 - -# Key for selecting the ninth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot9 (Hotbar slot 9 key) key KEY_KEY_9 - -# Key for selecting the tenth hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot10 (Hotbar slot 10 key) key KEY_KEY_0 - -# Key for selecting the 11th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot11 (Hotbar slot 11 key) key - -# Key for selecting the 12th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot12 (Hotbar slot 12 key) key - -# Key for selecting the 13th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot13 (Hotbar slot 13 key) key - -# Key for selecting the 14th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot14 (Hotbar slot 14 key) key - -# Key for selecting the 15th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot15 (Hotbar slot 15 key) key - -# Key for selecting the 16th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot16 (Hotbar slot 16 key) key - -# Key for selecting the 17th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot17 (Hotbar slot 17 key) key - -# Key for selecting the 18th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot18 (Hotbar slot 18 key) key - -# Key for selecting the 19th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot19 (Hotbar slot 19 key) key - -# Key for selecting the 20th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot20 (Hotbar slot 20 key) key - -# Key for selecting the 21st hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot21 (Hotbar slot 21 key) key - -# Key for selecting the 22nd hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot22 (Hotbar slot 22 key) key - -# Key for selecting the 23rd hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot23 (Hotbar slot 23 key) key - -# Key for selecting the 24th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot24 (Hotbar slot 24 key) key - -# Key for selecting the 25th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot25 (Hotbar slot 25 key) key - -# Key for selecting the 26th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot26 (Hotbar slot 26 key) key - -# Key for selecting the 27th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot27 (Hotbar slot 27 key) key - -# Key for selecting the 28th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot28 (Hotbar slot 28 key) key - -# Key for selecting the 29th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot29 (Hotbar slot 29 key) key - -# Key for selecting the 30th hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot30 (Hotbar slot 30 key) key - -# Key for selecting the 31st hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot31 (Hotbar slot 31 key) key - -# Key for selecting the 32nd hotbar slot. -# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 -keymap_slot32 (Hotbar slot 32 key) key - # Key for toggling the display of the HUD. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_hud (HUD toggle key) key KEY_F1 -# Key for toggling the display of chat. +# Key for toggling the display of the chat. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_chat (Chat toggle key) key KEY_F2 @@ -406,7 +238,7 @@ keymap_toggle_chat (Chat toggle key) key KEY_F2 # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_console (Large chat console key) key KEY_F10 -# Key for toggling the display of fog. +# Key for toggling the display of the fog. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3 @@ -434,11 +266,56 @@ keymap_increase_viewing_range_min (View range increase key) key + # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_decrease_viewing_range_min (View range decrease key) key - -[Graphics] +# Key for printing debug stacks. Used for development. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_print_debug_stacks (Print stacks) key KEY_KEY_P -[*In-Game] +[*Network] -[**Basic] +# Address to connect to. +# Leave this blank to start a local server. +# Note that the address field in the main menu overrides this setting. +address (Server address) string + +# Port to connect to (UDP). +# Note that the port field in the main menu overrides this setting. +remote_port (Remote port) int 30000 1 65535 + +# Whether to support older servers before protocol version 25. +# Enable if you want to connect to 0.4.12 servers and before. +# Servers starting with 0.4.13 will work, 0.4.12-dev servers may work. +# Disabling this option will protect your password better. +send_pre_v25_init (Support older servers) bool false + +# Save the map received by the client on disk. +enable_local_map_saving (Saving map received from server) bool false + +# Show entity selection boxes +show_entity_selectionbox (Show entity selection boxes) bool true + +# Enable usage of remote media server (if provided by server). +# Remote servers offer a significantly faster way to download media (e.g. textures) +# when connecting to the server. +enable_remote_media_server (Connect to external media server) bool true + +# Enable Lua modding support on client. +# This support is experimental and API can change. +enable_client_modding (Client modding) bool false + +# URL to the server list displayed in the Multiplayer Tab. +serverlist_url (Serverlist URL) string servers.minetest.net + +# File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab. +serverlist_file (Serverlist file) string favoriteservers.txt + +# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited +max_out_chat_queue_size (Maximum size of the out chat queue) int 20 + +[*Graphics] + +[**In-Game] + +[***Basic] # Enable VBO enable_vbo (VBO) bool true @@ -471,11 +348,9 @@ node_highlighting (Node highlighting) enum box box,halo,none # Adds particles when digging a node. enable_particles (Digging particles) bool true -[**Filtering] +[***Filtering] -# Use mip mapping to scale textures. May slightly increase performance, -# especially when using a high resolution texture pack. -# Gamma correct downscaling is not supported. +# Use mip mapping to scale textures. May slightly increase performance. mip_map (Mipmapping) bool false # Use anisotropic filtering when viewing at textures from an angle. @@ -489,20 +364,18 @@ trilinear_filter (Trilinear filtering) bool false # Filtered textures can blend RGB values with fully-transparent neighbors, # which PNG optimizers usually discard, sometimes resulting in a dark or -# light edge to transparent textures. Apply this filter to clean that up +# light edge to transparent textures. Apply this filter to clean that up # at texture load time. texture_clean_transparent (Clean transparent textures) bool false # When using bilinear/trilinear/anisotropic filters, low-resolution textures # can be blurred, so automatically upscale them with nearest-neighbor -# interpolation to preserve crisp pixels. This sets the minimum texture size +# interpolation to preserve crisp pixels. This sets the minimum texture size # for the upscaled textures; higher values look sharper, but require more -# memory. Powers of 2 are recommended. Setting this higher than 1 may not +# memory. Powers of 2 are recommended. Setting this higher than 1 may not # have a visible effect unless bilinear/trilinear/anisotropic filtering is # enabled. -# This is also used as the base node texture size for world-aligned -# texture autoscaling. -texture_min_size (Minimum texture size) int 64 +texture_min_size (Minimum texture size for filters) int 64 # Experimental option, might cause visible spaces between blocks # when set to higher number than 0. @@ -513,22 +386,21 @@ fsaa (FSAA) enum 0 0,1,2,4,8,16 # It should give significant performance boost at the cost of less detailed image. undersampling (Undersampling) enum 0 0,2,3,4 -[**Shaders] +[***Shaders] -# Shaders allow advanced visual effects and may increase performance on some video -# cards. +# Shaders allow advanced visual effects and may increase performance on some video cards. # This only works with the OpenGL video backend. enable_shaders (Shaders) bool true # Path to shader directory. If no path is defined, default location will be used. shader_path (Shader path) path -[***Tone Mapping] +[****Tone Mapping] # Enables filmic tone mapping tone_mapping (Filmic tone mapping) bool false -[***Bumpmapping] +[****Bumpmapping] # Enables bumpmapping for textures. Normalmaps need to be supplied by the texture pack # or need to be auto-generated. @@ -546,7 +418,7 @@ normalmaps_strength (Normalmaps strength) float 0.6 # A higher value results in smoother normal maps. normalmaps_smooth (Normalmaps sampling) int 0 0 2 -[***Parallax Occlusion] +[****Parallax Occlusion] # Enables parallax occlusion mapping. # Requires shaders to be enabled. @@ -563,12 +435,12 @@ parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1 parallax_occlusion_iterations (Parallax occlusion iterations) int 4 # Overall scale of parallax occlusion effect. -parallax_occlusion_scale (Parallax occlusion scale) float 0.08 +parallax_occlusion_scale (Parallax occlusion Scale) float 0.08 # Overall bias of parallax occlusion effect, usually scale/2. parallax_occlusion_bias (Parallax occlusion bias) float 0.04 -[***Waving Nodes] +[****Waving Nodes] # Set to true enables waving water. # Requires shaders to be enabled. @@ -588,11 +460,7 @@ enable_waving_leaves (Waving leaves) bool false # Requires shaders to be enabled. enable_waving_plants (Waving plants) bool false -[**Advanced] - -# Arm inertia, gives a more realistic movement of -# the arm when the camera moves. -arm_inertia (Arm inertia) bool true +[***Advanced] # If FPS would go higher than this, limit it by sleeping # to not waste CPU power for no benefit. @@ -601,10 +469,6 @@ fps_max (Maximum FPS) int 60 # Maximum FPS when game is paused. pause_fps_max (FPS in pause menu) int 20 -# Open the pause menu when the window's focus is lost. Does not pause if a formspec is -# open. -pause_on_lost_focus (Pause on lost window focus) bool false - # View distance in nodes. viewing_range (Viewing range) int 100 20 4000 @@ -615,13 +479,13 @@ viewing_range (Viewing range) int 100 20 4000 near_plane (Near plane) float 0.1 0 0.5 # Width component of the initial window size. -screen_w (Screen width) int 1024 +screenW (Screen width) int 800 # Height component of the initial window size. -screen_h (Screen height) int 600 +screenH (Screen height) int 600 # Save window size automatically when modified. -autosave_screensize (Autosave screen size) bool true +autosave_screensize (Autosave Screen Size) bool true # Fullscreen mode. fullscreen (Full screen) bool false @@ -630,40 +494,27 @@ fullscreen (Full screen) bool false fullscreen_bpp (Full screen BPP) int 24 # Vertical screen synchronization. -vsync (VSync) bool false +vsync (V-Sync) bool false # Field of view in degrees. -fov (Field of view) int 72 45 160 +fov (Field of view) int 72 30 160 + +# Field of view while zooming in degrees. +# This requires the "zoom" privilege on the server. +zoom_fov (Field of view for zoom) int 15 7 160 # Adjust the gamma encoding for the light tables. Higher numbers are brighter. # This setting is for the client only and is ignored by the server. -display_gamma (Gamma) float 1.0 0.5 3.0 - -# Gradient of light curve at minimum light level. -lighting_alpha (Darkness sharpness) float 0.0 0.0 4.0 - -# Gradient of light curve at maximum light level. -lighting_beta (Lightness sharpness) float 1.5 0.0 4.0 - -# Strength of light curve mid-boost. -lighting_boost (Light curve mid boost) float 0.2 0.0 1.0 - -# Center of light curve mid-boost. -lighting_boost_center (Light curve mid boost center) float 0.5 0.0 1.0 - -# Spread of light curve mid-boost. -# Standard deviation of the mid-boost gaussian. -lighting_boost_spread (Light curve mid boost spread) float 0.2 0.0 1.0 +display_gamma (Gamma) float 2.2 1.0 3.0 # Path to texture directory. All textures are first searched from here. texture_path (Texture path) path # The rendering back-end for Irrlicht. -# A restart is required after changing this. -# Note: On Android, stick with OGLES1 if unsure! App may fail to start otherwise. -# On other platforms, OpenGL is recommended, and it’s the only driver with -# shader support currently. -video_driver (Video driver) enum opengl null,software,burningsvideo,direct3d8,direct3d9,opengl,ogles1,ogles2 +video_driver (Video driver) enum opengl null,software,burningsvideo,direct3d8,direct3d9,opengl + +# Height on which clouds are appearing. +cloud_height (Cloud height) int 120 # Radius of cloud area stated in number of 64 node cloud squares. # Values larger than 26 will start to produce sharp cutoffs at cloud area corners. @@ -675,7 +526,7 @@ view_bobbing_amount (View bobbing factor) float 1.0 # Multiplier for fall bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. -fall_bobbing_amount (Fall bobbing factor) float 0.03 +fall_bobbing_amount (Fall bobbing factor) float 0.0 # 3D support. # Currently supported: @@ -684,13 +535,10 @@ fall_bobbing_amount (Fall bobbing factor) float 0.03 # - interlaced: odd/even line based polarisation screen support. # - topbottom: split screen top/bottom. # - sidebyside: split screen side by side. -# - crossview: Cross-eyed 3d -# - pageflip: quadbuffer based 3d. -# Note that the interlaced mode requires shaders to be enabled. -3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,crossview,pageflip +3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside # In-game chat console height, between 0.1 (10%) and 1.0 (100%). -console_height (Console height) float 0.6 0.1 1.0 +console_height (Console height) float 1.0 0.1 1.0 # In-game chat console background color (R,G,B). console_color (Console color) string (0,0,0) @@ -698,22 +546,10 @@ console_color (Console color) string (0,0,0) # In-game chat console background alpha (opaqueness, between 0 and 255). console_alpha (Console alpha) int 200 0 255 -# Formspec full-screen background opacity (between 0 and 255). -formspec_fullscreen_bg_opacity (Formspec Full-Screen Background Opacity) int 140 0 255 - -# Formspec full-screen background color (R,G,B). -formspec_fullscreen_bg_color (Formspec Full-Screen Background Color) string (0,0,0) - -# Formspec default background opacity (between 0 and 255). -formspec_default_bg_opacity (Formspec Default Background Opacity) int 140 0 255 - -# Formspec default background color (R,G,B). -formspec_default_bg_color (Formspec Default Background Color) string (0,0,0) - # Selection box border color (R,G,B). selectionbox_color (Selection box color) string (0,0,0) -# Width of the selection box lines around nodes. +# Width of the selectionbox's lines around nodes. selectionbox_width (Selection box width) int 2 1 5 # Crosshair color (R,G,B). @@ -722,9 +558,6 @@ crosshair_color (Crosshair color) string (255,255,255) # Crosshair alpha (opaqueness, between 0 and 255). crosshair_alpha (Crosshair alpha) int 255 0 255 -# Maximum number of recent chat messages to show -recent_chat_messages (Recent Chat Messages) int 6 2 20 - # Whether node texture animations should be desynchronized per mapblock. desynchronize_mapblock_texture_animation (Desynchronize block animation) bool true @@ -745,7 +578,7 @@ mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50 # Size of the MapBlock cache of the mesh generator. Increasing this will # increase the cache hit %, reducing the data being copied from the main # thread, thus reducing jitter. -meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size in MB) int 20 0 1000 +meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size MB) int 20 0 1000 # Enables minimap. enable_minimap (Minimap) bool true @@ -770,37 +603,22 @@ ambient_occlusion_gamma (Ambient occlusion gamma) float 2.2 0.25 4.0 # Enables animation of inventory items. inventory_items_animations (Inventory items animations) bool false +# Android systems only: Tries to create inventory textures from meshes +# when no supported render was found. +inventory_image_hack (Inventory image hack) bool false + # Fraction of the visible distance at which fog starts to be rendered -fog_start (Fog start) float 0.4 0.0 0.99 +fog_start (Fog Start) float 0.4 0.0 0.99 # Makes all liquids opaque opaque_water (Opaque liquids) bool false -# Textures on a node may be aligned either to the node or to the world. -# The former mode suits better things like machines, furniture, etc., while -# the latter makes stairs and microblocks fit surroundings better. -# However, as this possibility is new, thus may not be used by older servers, -# this option allows enforcing it for certain node types. Note though that -# that is considered EXPERIMENTAL and may not work properly. -world_aligned_mode (World-aligned textures mode) enum enable disable,enable,force_solid,force_nodebox - -# World-aligned textures may be scaled to span several nodes. However, -# the server may not send the scale you want, especially if you use -# a specially-designed texture pack; with this option, the client tries -# to determine the scale automatically basing on the texture size. -# See also texture_min_size. -# Warning: This option is EXPERIMENTAL! -autoscale_mode (Autoscaling mode) enum disable disable,enable,force - -# Show entity selection boxes -show_entity_selectionbox (Show entity selection boxes) bool true - -[*Menus] +[**Menus] # Use a cloud animation for the main menu background. menu_clouds (Clouds in menu) bool true -# Scale GUI by a user specified value. +# Scale gui by a user specified value. # Use a nearest-neighbor-anti-alias filter to scale the GUI. # This will smooth over some of the rough edges, and blend # pixels when scaling down, at the cost of blurring some @@ -821,14 +639,11 @@ gui_scaling_filter_txr2img (GUI scaling filter txr2img) bool true # Delay showing tooltips, stated in milliseconds. tooltip_show_delay (Tooltip delay) int 400 -# Append item name to tooltip. -tooltip_append_itemname (Append item name) bool false - -# Whether FreeType fonts are used, requires FreeType support to be compiled in. -freetype (FreeType fonts) bool true +# Whether freetype fonts are used, requires freetype support to be compiled in. +freetype (Freetype fonts) bool true # Path to TrueTypeFont or bitmap. -font_path (Font path) filepath fonts/liberationsans.ttf +font_path (Font path) path fonts/liberationsans.ttf font_size (Font size) int 16 @@ -838,12 +653,12 @@ font_shadow (Font shadow) int 1 # Font shadow alpha (opaqueness, between 0 and 255). font_shadow_alpha (Font shadow alpha) int 127 0 255 -mono_font_path (Monospace font path) filepath fonts/liberationmono.ttf +mono_font_path (Monospace font path) path fonts/Cousine-Regular.ttf mono_font_size (Monospace font size) int 15 # This font will be used for certain languages. -fallback_font_path (Fallback font) filepath fonts/DroidSansFallbackFull.ttf +fallback_font_path (Fallback font) path fonts/DroidSansFallbackFull.ttf fallback_font_size (Fallback font size) int 15 fallback_font_shadow (Fallback font shadow) int 1 fallback_font_shadow_alpha (Fallback font shadow alpha) int 128 0 255 @@ -859,7 +674,7 @@ screenshot_format (Screenshot format) enum png png,jpg,bmp,pcx,ppm,tga # Use 0 for default quality. screenshot_quality (Screenshot quality) int 0 0 100 -[*Advanced] +[**Advanced] # Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens. screen_dpi (DPI) int 72 @@ -868,54 +683,12 @@ screen_dpi (DPI) int 72 # Contains the same information as the file debug.txt (default name). enable_console (Enable console window) bool false -[Sound] +[*Sound] enable_sound (Sound) bool true sound_volume (Volume) float 0.7 0.0 1.0 -mute_sound (Mute sound) bool false - -[Client] - -[*Network] - -# Address to connect to. -# Leave this blank to start a local server. -# Note that the address field in the main menu overrides this setting. -address (Server address) string - -# Port to connect to (UDP). -# Note that the port field in the main menu overrides this setting. -remote_port (Remote port) int 30000 1 65535 - -# Save the map received by the client on disk. -enable_local_map_saving (Saving map received from server) bool false - -# Enable usage of remote media server (if provided by server). -# Remote servers offer a significantly faster way to download media (e.g. textures) -# when connecting to the server. -enable_remote_media_server (Connect to external media server) bool true - -# Enable Lua modding support on client. -# This support is experimental and API can change. -enable_client_modding (Client modding) bool false - -# URL to the server list displayed in the Multiplayer Tab. -serverlist_url (Serverlist URL) string servers.minetest.net - -# File in client/serverlist/ that contains your favorite servers displayed in the -# Multiplayer Tab. -serverlist_file (Serverlist file) string favoriteservers.txt - -# Maximum size of the out chat queue. -# 0 to disable queueing and -1 to make the queue size unlimited. -max_out_chat_queue_size (Maximum size of the out chat queue) int 20 - -# Enable register confirmation when connecting to server. -# If disabled, new account will be registered automatically. -enable_register_confirmation (Enable register confirmation) bool true - [*Advanced] # Timeout for client to remove unused map data from memory. @@ -940,16 +713,17 @@ server_description (Server description) string mine here server_address (Server address) string game.minetest.net # Homepage of server, to be displayed in the serverlist. -server_url (Server URL) string https://minetest.net +server_url (Server URL) string http://minetest.net -# Automatically report to the serverlist. +# Automaticaly report to the serverlist. server_announce (Announce server) bool false # Announce to this serverlist. +# If you want to announce your ipv6 address, use serverlist_url = v6.servers.minetest.net. serverlist_url (Serverlist URL) string servers.minetest.net -# Remove color codes from incoming chat messages -# Use this to stop players from being able to use color in their messages +# Remove color codes from incoming chat messages +# Use this to stop players from being able to use color in their messages strip_color_codes (Strip color codes) bool false [*Network] @@ -972,16 +746,18 @@ strict_protocol_version_checking (Strict protocol checking) bool false # Files that are not present will be fetched the usual way. remote_media (Remote media) string -# Enable/disable running an IPv6 server. +# Enable/disable running an IPv6 server. An IPv6 server may be restricted +# to IPv6 clients, depending on system configuration. # Ignored if bind_address is set. ipv6_server (IPv6 server) bool false [**Advanced] # Maximum number of blocks that are simultaneously sent per client. -# The maximum total count is calculated dynamically: -# max_total = ceil((#clients + max_users) * per_client / 4) -max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 40 +max_simultaneous_block_sends_per_client (Maximum simultaneous block sends per client) int 10 + +# Maximum number of blocks that are simultaneously sent in total. +max_simultaneous_block_sends_server_total (Maximum simultaneous block sends total) int 40 # To reduce lag, block transfers are slowed down when a player is building something. # This determines how long they are slowed down after placing or removing a node. @@ -1001,7 +777,7 @@ default_game (Default game) string minetest # Message of the day displayed to players connecting. motd (Message of the day) string -# Maximum number of players that can be connected simultaneously. +# Maximum number of players that can connect simultaneously. max_users (Maximum users) int 15 # World directory (everything in the world is stored here). @@ -1012,6 +788,9 @@ map-dir (Map directory) path # Setting it to -1 disables the feature. item_entity_ttl (Item entity TTL) int 900 +# If enabled, show the server status message on player connection. +show_statusline_on_connect (Status message on connection) bool true + # Enable players getting damage and dying. enable_damage (Damage) bool false @@ -1030,7 +809,7 @@ default_password (Default password) string default_privs (Default privileges) string interact, shout # Privileges that players with basic_privs can grant -basic_privs (Basic privileges) string interact, shout +basic_privs (Basic Privileges) string interact, shout # Whether players are shown to clients without any range limit. # Deprecated, use the setting player_transfer_distance instead. @@ -1040,10 +819,7 @@ unlimited_player_transfer_distance (Unlimited player transfer distance) bool tru player_transfer_distance (Player transfer distance) int 0 # Whether to allow players to damage and kill each other. -enable_pvp (Player versus player) bool true - -# Enable mod channels support. -enable_mod_channels (Mod channels) bool false +enable_pvp (Player versus Player) bool true # If this is set, players will always (re)spawn at the given position. static_spawnpoint (Static spawnpoint) string @@ -1069,17 +845,10 @@ kick_msg_crash (Crash message) string This server has experienced an internal er ask_reconnect_on_crash (Ask to reconnect after crash) bool false # From how far clients know about objects, stated in mapblocks (16 nodes). -# -# Setting this larger than active_block_range will also cause the server -# to maintain active objects up to this distance in the direction the -# player is looking. (This can avoid mobs suddenly disappearing from view) -active_object_send_range_blocks (Active object send range) int 4 +active_object_send_range_blocks (Active object send range) int 3 -# The radius of the volume of blocks around every player that is subject to the -# active block stuff, stated in mapblocks (16 nodes). +# How large area of blocks are subject to the active block stuff, stated in mapblocks (16 nodes). # In active blocks objects are loaded and ABMs run. -# This is also the minimum range in which active objects (mobs) are maintained. -# This should be configured together with active_object_range. active_block_range (Active block range) int 3 # From how far blocks are sent to clients, stated in mapblocks (16 nodes). @@ -1092,24 +861,20 @@ max_forceloaded_blocks (Maximum forceloaded blocks) int 16 time_send_interval (Time send interval) int 5 # Controls length of day/night cycle. -# Examples: -# 72 = 20min, 360 = 4min, 1 = 24hour, 0 = day/night/whatever stays unchanged. +# Examples: 72 = 20min, 360 = 4min, 1 = 24hour, 0 = day/night/whatever stays unchanged. time_speed (Time speed) int 72 -# Time of day when a new world is started, in millihours (0-23999). -world_start_time (World start time) int 5250 0 23999 - # Interval of saving important changes in the world, stated in seconds. server_map_save_interval (Map save interval) float 5.3 # Set the maximum character length of a chat message sent by clients. -chat_message_max_size (Chat message max length) int 500 +# chat_message_max_size int 500 -# Amount of messages a player may send per 10 seconds. -chat_message_limit_per_10sec (Chat message count limit) float 10.0 +# Limit a single player to send X messages per 10 seconds. +# chat_message_limit_per_10sec float 10.0 -# Kick players who sent more than X messages per 10 seconds. -chat_message_limit_trigger_kick (Chat message kick threshold) int 50 +# Kick player if send more than X messages per 10 seconds. +# chat_message_limit_trigger_kick int 50 [**Physics] @@ -1117,13 +882,13 @@ movement_acceleration_default (Default acceleration) float 3 movement_acceleration_air (Acceleration in air) float 2 movement_acceleration_fast (Fast mode acceleration) float 10 movement_speed_walk (Walking speed) float 4 -movement_speed_crouch (Sneaking speed) float 1.35 +movement_speed_crouch (Crouch speed) float 1.35 movement_speed_fast (Fast mode speed) float 20 movement_speed_climb (Climbing speed) float 3 movement_speed_jump (Jumping speed) float 6.5 movement_liquid_fluidity (Liquid fluidity) float 1 movement_liquid_fluidity_smooth (Liquid fluidity smoothing) float 0.5 -movement_liquid_sink (Liquid sinking speed) float 10 +movement_liquid_sink (Liquid sink) float 10 movement_gravity (Gravity) float 9.81 [**Advanced] @@ -1146,18 +911,17 @@ server_unload_unused_data_timeout (Unload unused server data) int 29 # Maximum number of statically stored objects in a block. max_objects_per_block (Maximum objects per block) int 64 -# See https://www.sqlite.org/pragma.html#pragma_synchronous +# See http://www.sqlite.org/pragma.html#pragma_synchronous sqlite_synchronous (Synchronous SQLite) enum 2 0,1,2 -# Length of a server tick and the interval at which objects are generally updated over -# network. -dedicated_server_step (Dedicated server step) float 0.09 +# Length of a server tick and the interval at which objects are generally updated over network. +dedicated_server_step (Dedicated server step) float 0.1 -# Length of time between active block management cycles -active_block_mgmt_interval (Active block management interval) float 2.0 +# Time in between active block management cycles +active_block_mgmt_interval (Active Block Management interval) float 2.0 -# Length of time between Active Block Modifier (ABM) execution cycles -abm_interval (ABM interval) float 1.0 +# Length of time between ABM execution cycles +abm_interval (Active Block Modifier interval) float 1.0 # Length of time between NodeTimer execution cycles nodetimer_interval (NodeTimer interval) float 0.2 @@ -1177,15 +941,12 @@ liquid_queue_purge_time (Liquid queue purge time) int 0 # Liquid update interval in seconds. liquid_update (Liquid update tick) float 1.0 -# At this distance the server will aggressively optimize which blocks are sent to -# clients. -# Small values potentially improve performance a lot, at the expense of visible -# rendering glitches (some blocks will not be rendered under water and in caves, -# as well as sometimes on land). -# Setting this to a value greater than max_block_send_distance disables this -# optimization. -# Stated in mapblocks (16 nodes). -block_send_optimize_distance (Block send optimize distance) int 4 2 +# At this distance the server will aggressively optimize which blocks are sent to clients. +# Small values potentially improve performance a lot, at the expense of visible rendering glitches. +# (some blocks will not be rendered under water and in caves, as well as sometimes on land) +# Setting this to a value greater than max_block_send_distance disables this optimization. +# Stated in mapblocks (16 nodes) +block_send_optimize_distance (block send optimize distance) int 4 2 # If enabled the server will perform map block occlusion culling based on # on the eye position of the player. This can reduce the number of blocks @@ -1193,21 +954,445 @@ block_send_optimize_distance (Block send optimize distance) int 4 2 # so that the utility of noclip mode is reduced. server_side_occlusion_culling (Server side occlusion culling) bool true -# Restricts the access of certain client-side functions on servers. -# Combine the byteflags below to restrict client-side features, or set to 0 -# for no restrictions: -# LOAD_CLIENT_MODS: 1 (disable loading client-provided mods) -# CHAT_MESSAGES: 2 (disable send_chat_message call client-side) -# READ_ITEMDEFS: 4 (disable get_item_def call client-side) -# READ_NODEDEFS: 8 (disable get_node_def call client-side) -# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to -# csm_restriction_noderange) -# READ_PLAYERINFO: 32 (disable get_player_names call client-side) -csm_restriction_flags (Client side modding restrictions) int 62 +[*Mapgen] -# If the CSM restriction for node range is enabled, get_node calls are limited -# to this distance from the player to the node. -csm_restriction_noderange (Client side node lookup range restriction) int 0 +# Name of map generator to be used when creating a new world. +# Creating a world in the main menu will override this. +mg_name (Mapgen name) enum v7 v5,v6,v7,flat,valleys,fractal,singlenode + +# Water surface level of the world. +water_level (Water level) int 1 + +# From how far blocks are generated for clients, stated in mapblocks (16 nodes). +max_block_generate_distance (Max block generate distance) int 6 + +# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). +# Only mapchunks completely within the mapgen limit are generated. +# Value is stored per-world. +mapgen_limit (Map generation limit) int 31000 0 31000 + +# Global map generation attributes. +# In Mapgen v6 the 'decorations' flag controls all decorations except trees +# and junglegrass, in all other mapgens this flag controls all decorations. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mg_flags (Mapgen flags) flags caves,dungeons,light,decorations caves,dungeons,light,decorations,nocaves,nodungeons,nolight,nodecorations + +# Whether dungeons occasionally project from the terrain. +projecting_dungeons (Projecting dungeons) bool true + +[**Advanced] + +# Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes). +chunksize (Chunk size) int 5 + +# Dump the mapgen debug infos. +enable_mapgen_debug_info (Mapgen debug) bool false + +# Maximum number of blocks that can be queued for loading. +emergequeue_limit_total (Absolute limit of emerge queues) int 256 + +# Maximum number of blocks to be queued that are to be loaded from file. +# Set to blank for an appropriate amount to be chosen automatically. +emergequeue_limit_diskonly (Limit of emerge queues on disk) int 32 + +# Maximum number of blocks to be queued that are to be generated. +# Set to blank for an appropriate amount to be chosen automatically. +emergequeue_limit_generate (Limit of emerge queues to generate) int 32 + +# Number of emerge threads to use. Make this field blank, or increase this number +# to use multiple threads. On multiprocessor systems, this will improve mapgen speed greatly +# at the cost of slightly buggy caves. +num_emerge_threads (Number of emerge threads) int 1 + +[***Biome API temperature and humidity noise parameters] + +# Temperature variation for biomes. +mg_biome_np_heat (Heat noise) noise_params 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0 + +# Small-scale temperature variation for blending biomes on borders. +mg_biome_np_heat_blend (Heat blend noise) noise_params 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0 + +# Humidity variation for biomes. +mg_biome_np_humidity (Humidity noise) noise_params 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0 + +# Small-scale humidity variation for blending biomes on borders. +mg_biome_np_humidity_blend (Humidity blend noise) noise_params 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0 + +[***Mapgen v5] + +# Map generation attributes specific to Mapgen v5. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mgv5_spflags (Mapgen v5 specific flags) flags caverns caverns,nocaverns + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgv5_cave_width (Cave width) float 0.125 + +# Y-level of cavern upper limit. +mgv5_cavern_limit (Cavern limit) int -256 + +# Y-distance over which caverns expand to full size. +mgv5_cavern_taper (Cavern taper) int 256 + +# Defines full size of caverns, smaller values create larger caverns. +mgv5_cavern_threshold (Cavern threshold) float 0.7 + +# Variation of biome filler depth. +mgv5_np_filler_depth (Filler depth noise) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0 + +# Variation of terrain vertical scale. +# When noise is < -0.55 terrain is near-flat. +mgv5_np_factor (Factor noise) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0 + +# Y-level of average terrain surface. +mgv5_np_height (Height noise) noise_params 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0 + +# First of 2 3D noises that together define tunnels. +mgv5_np_cave1 (Cave1 noise) noise_params 0, 12, (50, 50, 50), 52534, 4, 0.5, 2.0 + +# Second of 2 3D noises that together define tunnels. +mgv5_np_cave2 (Cave2 noise) noise_params 0, 12, (50, 50, 50), 10325, 4, 0.5, 2.0 + +# 3D noise defining giant caverns. +mgv5_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 + +# TODO +# Noise parameters in group format, unsupported by advanced settings +# menu but settable in minetest.conf. +# See documentation of noise parameter formats in minetest.conf.example. +# 3D noise defining terrain. +#mgv5_np_ground = { +# offset = 0 +# scale = 40 +# spread = (80, 80, 80) +# seed = 983240 +# octaves = 4 +# persistence = 0.55 +# lacunarity = 2.0 +# flags = "eased" +#} + +[***Mapgen v6] + +# Map generation attributes specific to Mapgen v6. +# The 'snowbiomes' flag enables the new 5 biome system. +# When the new biome system is enabled jungles are automatically enabled and +# the 'jungles' flag is ignored. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mgv6_spflags (Mapgen v6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees + +# Deserts occur when np_biome exceeds this value. +# When the new biome system is enabled, this is ignored. +mgv6_freq_desert (Desert noise threshold) float 0.45 + +# Sandy beaches occur when np_beach exceeds this value. +mgv6_freq_beach (Beach noise threshold) float 0.15 + +# Y-level of lower terrain and lakebeds. +mgv6_np_terrain_base (Terrain base noise) noise_params -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0 + +# Y-level of higher (cliff-top) terrain. +mgv6_np_terrain_higher (Terrain higher noise) noise_params 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0 + +# Varies steepness of cliffs. +mgv6_np_steepness (Steepness noise) noise_params 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0 + +# Defines areas of 'terrain_higher' (cliff-top terrain). +mgv6_np_height_select (Height select noise) noise_params 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0 + +# Varies depth of biome surface nodes. +mgv6_np_mud (Mud noise) noise_params 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0 + +# Defines areas with sandy beaches. +mgv6_np_beach (Beach noise) noise_params 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0 + +# Temperature variation for biomes. +mgv6_np_biome (Biome noise) noise_params 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0 + +# Variation of number of caves. +mgv6_np_cave (Cave noise) noise_params 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0 + +# Humidity variation for biomes. +mgv6_np_humidity (Humidity noise) noise_params 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0 + +# Defines tree areas and tree density. +mgv6_np_trees (Trees noise) noise_params 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0 + +# Defines areas where trees have apples. +mgv6_np_apple_trees (Apple trees noise) noise_params 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0 + +[***Mapgen v7] + +# Map generation attributes specific to Mapgen v7. +# The 'ridges' flag enables the rivers. +# Floatlands are currently experimental and subject to change. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgv7_cave_width (Cave width) float 0.09 + +# Controls the density of floatland mountain terrain. +# Is an offset added to the 'np_mountain' noise value. +mgv7_float_mount_density (Floatland mountain density) float 0.6 + +# Typical maximum height, above and below midpoint, of floatland mountain terrain. +mgv7_float_mount_height (Floatland mountain height) float 128.0 + +# Y-level of floatland midpoint and lake surface. +mgv7_floatland_level (Floatland level) int 1280 + +# Y-level to which floatland shadows extend. +mgv7_shadow_limit (Shadow limit) int 1024 + +# Y-level of cavern upper limit. +mgv7_cavern_limit (Cavern limit) int -256 + +# Y-distance over which caverns expand to full size. +mgv7_cavern_taper (Cavern taper) int 256 + +# Defines full size of caverns, smaller values create larger caverns. +mgv7_cavern_threshold (Cavern threshold) float 0.7 + +# Y-level of higher (cliff-top) terrain. +mgv7_np_terrain_base (Terrain base noise) noise_params 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0 + +# Y-level of lower terrain and lakebeds. +mgv7_np_terrain_alt (Terrain alt noise) noise_params 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0 + +# Varies roughness of terrain. +# Defines the 'persistence' value for terrain_base and terrain_alt noises. +mgv7_np_terrain_persist (Terrain persistence noise) noise_params 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0 + +# Defines areas of higher (cliff-top) terrain and affects steepness of cliffs. +mgv7_np_height_select (Height select noise) noise_params -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0 + +# Variation of biome filler depth. +mgv7_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 + +# Variation of maximum mountain height (in nodes). +mgv7_np_mount_height (Mountain height noise) noise_params 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0 + +# Defines large-scale river channel structure. +mgv7_np_ridge_uwater (Ridge underwater noise) noise_params 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0 + +# Defines areas of floatland smooth terrain. +# Smooth floatlands occur when noise > 0. +mgv7_np_floatland_base (Floatland base noise) noise_params -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0 + +# Variation of hill height and lake depth on floatland smooth terrain. +mgv7_np_float_base_height (Floatland base height noise) noise_params 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0 + +# 3D noise defining mountain structure and height. +# Also defines structure of floatland mountain terrain. +mgv7_np_mountain (Mountain noise) noise_params -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0 + +# 3D noise defining structure of river canyon walls. +mgv7_np_ridge (Ridge noise) noise_params 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0 + +# 3D noise defining giant caverns. +mgv7_np_cavern (Cavern noise) noise_params 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 + +# First of 2 3D noises that together define tunnels. +mgv7_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of 2 3D noises that together define tunnels. +mgv7_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +[***Mapgen flat] + +# Map generation attributes specific to Mapgen flat. +# Occasional lakes and hills can be added to the flat world. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mgflat_spflags (Mapgen flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills + +# Y of flat ground. +mgflat_ground_level (Ground level) int 8 + +# Y of upper limit of large pseudorandom caves. +mgflat_large_cave_depth (Large cave depth) int -33 + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgflat_cave_width (Cave width) float 0.09 + +# Terrain noise threshold for lakes. +# Controls proportion of world area covered by lakes. +# Adjust towards 0.0 for a larger proportion. +mgflat_lake_threshold (Lake threshold) float -0.45 + +# Controls steepness/depth of lake depressions. +mgflat_lake_steepness (Lake steepness) float 48.0 + +# Terrain noise threshold for hills. +# Controls proportion of world area covered by hills. +# Adjust towards 0.0 for a larger proportion. +mgflat_hill_threshold (Hill threshold) float 0.45 + +# Controls steepness/height of hills. +mgflat_hill_steepness (Hill steepness) float 64.0 + +# Defines location and terrain of optional hills and lakes. +mgflat_np_terrain (Terrain noise) noise_params 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0 + +# Variation of biome filler depth. +mgflat_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 + +# First of 2 3D noises that together define tunnels. +mgflat_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of 2 3D noises that together define tunnels. +mgflat_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +[***Mapgen fractal] + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgfractal_cave_width (Cave width) float 0.09 + +# Choice of 18 fractals from 9 formulas. +# 1 = 4D "Roundy" mandelbrot set. +# 2 = 4D "Roundy" julia set. +# 3 = 4D "Squarry" mandelbrot set. +# 4 = 4D "Squarry" julia set. +# 5 = 4D "Mandy Cousin" mandelbrot set. +# 6 = 4D "Mandy Cousin" julia set. +# 7 = 4D "Variation" mandelbrot set. +# 8 = 4D "Variation" julia set. +# 9 = 3D "Mandelbrot/Mandelbar" mandelbrot set. +# 10 = 3D "Mandelbrot/Mandelbar" julia set. +# 11 = 3D "Christmas Tree" mandelbrot set. +# 12 = 3D "Christmas Tree" julia set. +# 13 = 3D "Mandelbulb" mandelbrot set. +# 14 = 3D "Mandelbulb" julia set. +# 15 = 3D "Cosine Mandelbulb" mandelbrot set. +# 16 = 3D "Cosine Mandelbulb" julia set. +# 17 = 4D "Mandelbulb" mandelbrot set. +# 18 = 4D "Mandelbulb" julia set. +mgfractal_fractal (Fractal type) int 1 1 18 + +# Iterations of the recursive function. +# Controls the amount of fine detail. +mgfractal_iterations (Iterations) int 11 + +# Approximate (X,Y,Z) scale of fractal in nodes. +mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0) + +# (X,Y,Z) offset of fractal from world centre in units of 'scale'. +# Used to move a suitable spawn area of low land close to (0, 0). +# The default is suitable for mandelbrot sets, it needs to be edited for julia sets. +# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes. +mgfractal_offset (Offset) v3f (1.79, 0.0, 0.0) + +# W co-ordinate of the generated 3D slice of a 4D fractal. +# Determines which 3D slice of the 4D shape is generated. +# Has no effect on 3D fractals. +# Range roughly -2 to 2. +mgfractal_slice_w (Slice w) float 0.0 + +# Julia set only: X component of hypercomplex constant determining julia shape. +# Range roughly -2 to 2. +mgfractal_julia_x (Julia x) float 0.33 + +# Julia set only: Y component of hypercomplex constant determining julia shape. +# Range roughly -2 to 2. +mgfractal_julia_y (Julia y) float 0.33 + +# Julia set only: Z component of hypercomplex constant determining julia shape. +# Range roughly -2 to 2. +mgfractal_julia_z (Julia z) float 0.33 + +# Julia set only: W component of hypercomplex constant determining julia shape. +# Has no effect on 3D fractals. +# Range roughly -2 to 2. +mgfractal_julia_w (Julia w) float 0.33 + +# Y-level of seabed. +mgfractal_np_seabed (Seabed noise) noise_params -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0 + +# Variation of biome filler depth. +mgfractal_np_filler_depth (Filler depth noise) noise_params 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0 + +# First of 2 3D noises that together define tunnels. +mgfractal_np_cave1 (Cave1 noise) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Second of 2 3D noises that together define tunnels. +mgfractal_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +# Mapgen Valleys parameters +[***Mapgen Valleys] + +# General parameters +[****General] + +# Map generation attributes specific to Mapgen Valleys. +# 'altitude_chill' makes higher elevations colder, which may cause biome issues. +# 'humid_rivers' modifies the humidity around rivers and in areas where water would tend to pool, +# it may interfere with delicately adjusted biomes. +# Flags that are not specified in the flag string are not modified from the default. +# Flags starting with 'no' are used to explicitly disable them. +mg_valleys_spflags (Valleys C Flags) flags altitude_chill,humid_rivers altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers + +# The altitude at which temperature drops by 20C +mgvalleys_altitude_chill (Altitude Chill) int 90 + +# Depth below which you'll find large caves. +mgvalleys_large_cave_depth (Large cave depth) int -33 + +# Creates unpredictable lava features in caves. +# These can make mining difficult. Zero disables them. (0-10) +mgvalleys_lava_features (Lava Features) int 0 + +# Depth below which you'll find massive caves. +mgvalleys_massive_cave_depth (Massive cave depth) int -256 + +# How deep to make rivers +mgvalleys_river_depth (River Depth) int 4 + +# How wide to make rivers +mgvalleys_river_size (River Size) int 5 + +# Creates unpredictable water features in caves. +# These can make mining difficult. Zero disables them. (0-10) +mgvalleys_water_features (Water Features) int 0 + +# Controls width of tunnels, a smaller value creates wider tunnels. +mgvalleys_cave_width (Cave width) float 0.09 + +# Noise parameters +[****Noises] + +# Caves and tunnels form at the intersection of the two noises +mgvalleys_np_cave1 (Cave noise #1) noise_params 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 + +# Caves and tunnels form at the intersection of the two noises +mgvalleys_np_cave2 (Cave noise #2) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 + +# The depth of dirt or other filler +mgvalleys_np_filler_depth (Filler Depth) noise_params 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0 + +# Massive caves form here. +mgvalleys_np_massive_caves (Massive cave noise) noise_params 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 + +# River noise -- rivers occur close to zero +mgvalleys_np_rivers (River Noise) noise_params 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0 + +# Base terrain height +mgvalleys_np_terrain_height (Terrain Height) noise_params -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0 + +# Raises terrain to make valleys around the rivers +mgvalleys_np_valley_depth (Valley Depth) noise_params 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0 + +# Slope and fill work together to modify the heights +mgvalleys_np_inter_valley_fill (Valley Fill) noise_params 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 + +# Amplifies the valleys +mgvalleys_np_valley_profile (Valley Profile) noise_params 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0 + +# Slope and fill work together to modify the heights +mgvalleys_np_inter_valley_slope (Valley Slope) noise_params 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0 [*Security] @@ -1218,9 +1403,9 @@ secure.enable_security (Enable mod security) bool true # functions even when mod security is on (via request_insecure_environment()). secure.trusted_mods (Trusted mods) string -# Comma-separated list of mods that are allowed to access HTTP APIs, which -# allow them to upload and download data to/from the internet. -secure.http_mods (HTTP mods) string +# Comma-separated list of mods that are allowed to access HTTP APIs, which +# allow them to upload and download data to/from the internet. +secure.http_mods (HTTP Mods) string [*Advanced] @@ -1275,8 +1460,7 @@ name (Player name) string # Set the language. Leave empty to use the system language. # A restart is required after changing this. -language (Language) enum ,be,ca,cs,da,de,dv,en,eo,es,et,fr,he,hu,id,it,ja,jbo,ko,ky,lt,ms,nb,nl,pl,pt,pt_BR,ro,ru,sl,sr_Cyrl,sv,sw,tr,uk,zh_CN,zh_TW - +language (Language) enum ,be,ca,cs,da,de,en,eo,es,et,fr,he,hu,id,it,ja,jbo,ko,ky,lt,nb,nl,pl,pt,pt_BR,ro,ru,sr_Cyrl,tr,uk,zh_CN,zh_TW # Level of logging to be written to debug.txt: # - (no logging) @@ -1310,634 +1494,18 @@ curl_file_download_timeout (cURL file download timeout) int 300000 # Makes DirectX work with LuaJIT. Disable if it causes troubles. high_precision_fpu (High-precision FPU) bool true -# Changes the main menu UI: -# - Full: Multiple singleplayer worlds, game choice, texture pack chooser, etc. -# - Simple: One singleplayer world, no game or texture pack choosers. May be -# necessary for smaller screens. -main_menu_style (Main menu style) enum full full,simple - # Replaces the default main menu with a custom one. main_menu_script (Main menu script) string -# Print the engine's profiling data in regular intervals (in seconds). -# 0 = disable. Useful for developers. +main_menu_game_mgr (Main menu game manager) int 0 + +main_menu_mod_mgr (Main menu mod manager) int 1 + +modstore_download_url (Modstore download URL) string https://forum.minetest.net/media/ + +modstore_listmods_url (Modstore mods list URL) string https://forum.minetest.net/mmdb/mods/ + +modstore_details_url (Modstore details URL) string https://forum.minetest.net/mmdb/mod/*/ + +# Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. profiler_print_interval (Engine profiling data print interval) int 0 - -[Mapgen] - -# Name of map generator to be used when creating a new world. -# Creating a world in the main menu will override this. -# Current stable mapgens: -# v5, v6, v7 (except floatlands), singlenode. -# 'stable' means the terrain shape in an existing world will not be changed -# in the future. Note that biomes are defined by games and may still change. -mg_name (Mapgen name) enum v7 v5,v6,v7,valleys,carpathian,fractal,flat,singlenode - -# Water surface level of the world. -water_level (Water level) int 1 - -# From how far blocks are generated for clients, stated in mapblocks (16 nodes). -max_block_generate_distance (Max block generate distance) int 8 - -# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). -# Only mapchunks completely within the mapgen limit are generated. -# Value is stored per-world. -mapgen_limit (Map generation limit) int 31000 0 31000 - -# Global map generation attributes. -# In Mapgen v6 the 'decorations' flag controls all decorations except trees -# and junglegrass, in all other mapgens this flag controls all decorations. -mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes caves,dungeons,light,decorations,biomes,nocaves,nodungeons,nolight,nodecorations,nobiomes - -# Whether dungeons occasionally project from the terrain. -projecting_dungeons (Projecting dungeons) bool true - -[*Biome API temperature and humidity noise parameters] - -# Temperature variation for biomes. -mg_biome_np_heat (Heat noise) noise_params_2d 50, 50, (1000, 1000, 1000), 5349, 3, 0.5, 2.0, eased - -# Small-scale temperature variation for blending biomes on borders. -mg_biome_np_heat_blend (Heat blend noise) noise_params_2d 0, 1.5, (8, 8, 8), 13, 2, 1.0, 2.0, eased - -# Humidity variation for biomes. -mg_biome_np_humidity (Humidity noise) noise_params_2d 50, 50, (1000, 1000, 1000), 842, 3, 0.5, 2.0, eased - -# Small-scale humidity variation for blending biomes on borders. -mg_biome_np_humidity_blend (Humidity blend noise) noise_params_2d 0, 1.5, (8, 8, 8), 90003, 2, 1.0, 2.0, eased - -[*Mapgen V5] - -# Map generation attributes specific to Mapgen v5. -mgv5_spflags (Mapgen V5 specific flags) flags caverns caverns,nocaverns - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgv5_cave_width (Cave width) float 0.09 - -# Y of upper limit of large caves. -mgv5_large_cave_depth (Large cave depth) int -256 - -# Y of upper limit of lava in large caves. -mgv5_lava_depth (Lava depth) int -256 - -# Y-level of cavern upper limit. -mgv5_cavern_limit (Cavern limit) int -256 - -# Y-distance over which caverns expand to full size. -mgv5_cavern_taper (Cavern taper) int 256 - -# Defines full size of caverns, smaller values create larger caverns. -mgv5_cavern_threshold (Cavern threshold) float 0.7 - -# Lower Y limit of dungeons. -mgv5_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgv5_dungeon_ymax (Dungeon maximum Y) int 31000 - -[**Noises] - -# Variation of biome filler depth. -mgv5_np_filler_depth (Filler depth noise) noise_params_2d 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0, eased - -# Variation of terrain vertical scale. -# When noise is < -0.55 terrain is near-flat. -mgv5_np_factor (Factor noise) noise_params_2d 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0, eased - -# Y-level of average terrain surface. -mgv5_np_height (Height noise) noise_params_2d 0, 10, (250, 250, 250), 84174, 4, 0.5, 2.0, eased - -# First of two 3D noises that together define tunnels. -mgv5_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgv5_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -# 3D noise defining giant caverns. -mgv5_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 - -# 3D noise defining terrain. -mgv5_np_ground (Ground noise) noise_params_3d 0, 40, (80, 80, 80), 983240, 4, 0.55, 2.0, eased - -[*Mapgen V6] - -# Map generation attributes specific to Mapgen v6. -# The 'snowbiomes' flag enables the new 5 biome system. -# When the new biome system is enabled jungles are automatically enabled and -# the 'jungles' flag is ignored. -mgv6_spflags (Mapgen V6 specific flags) flags jungles,biomeblend,mudflow,snowbiomes,trees jungles,biomeblend,mudflow,snowbiomes,flat,trees,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat,notrees - -# Deserts occur when np_biome exceeds this value. -# When the new biome system is enabled, this is ignored. -mgv6_freq_desert (Desert noise threshold) float 0.45 - -# Sandy beaches occur when np_beach exceeds this value. -mgv6_freq_beach (Beach noise threshold) float 0.15 - -# Lower Y limit of dungeons. -mgv6_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgv6_dungeon_ymax (Dungeon maximum Y) int 31000 - -[**Noises] - -# Y-level of lower terrain and seabed. -mgv6_np_terrain_base (Terrain base noise) noise_params_2d -4, 20, (250, 250, 250), 82341, 5, 0.6, 2.0, eased - -# Y-level of higher terrain that creates cliffs. -mgv6_np_terrain_higher (Terrain higher noise) noise_params_2d 20, 16, (500, 500, 500), 85039, 5, 0.6, 2.0, eased - -# Varies steepness of cliffs. -mgv6_np_steepness (Steepness noise) noise_params_2d 0.85, 0.5, (125, 125, 125), -932, 5, 0.7, 2.0, eased - -# Defines distribution of higher terrain. -mgv6_np_height_select (Height select noise) noise_params_2d 0.5, 1, (250, 250, 250), 4213, 5, 0.69, 2.0, eased - -# Varies depth of biome surface nodes. -mgv6_np_mud (Mud noise) noise_params_2d 4, 2, (200, 200, 200), 91013, 3, 0.55, 2.0, eased - -# Defines areas with sandy beaches. -mgv6_np_beach (Beach noise) noise_params_2d 0, 1, (250, 250, 250), 59420, 3, 0.50, 2.0, eased - -# Temperature variation for biomes. -mgv6_np_biome (Biome noise) noise_params_2d 0, 1, (500, 500, 500), 9130, 3, 0.50, 2.0, eased - -# Variation of number of caves. -mgv6_np_cave (Cave noise) noise_params_2d 6, 6, (250, 250, 250), 34329, 3, 0.50, 2.0, eased - -# Humidity variation for biomes. -mgv6_np_humidity (Humidity noise) noise_params_2d 0.5, 0.5, (500, 500, 500), 72384, 3, 0.50, 2.0, eased - -# Defines tree areas and tree density. -mgv6_np_trees (Trees noise) noise_params_2d 0, 1, (125, 125, 125), 2, 4, 0.66, 2.0, eased - -# Defines areas where trees have apples. -mgv6_np_apple_trees (Apple trees noise) noise_params_2d 0, 1, (100, 100, 100), 342902, 3, 0.45, 2.0, eased - -[*Mapgen V7] - -# Map generation attributes specific to Mapgen v7. -# 'ridges' enables the rivers. -mgv7_spflags (Mapgen V7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns - -# Y of mountain density gradient zero level. Used to shift mountains vertically. -mgv7_mount_zero_level (Mountain zero level) int 0 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgv7_cave_width (Cave width) float 0.09 - -# Y of upper limit of large caves. -mgv7_large_cave_depth (Large cave depth) int -33 - -# Y of upper limit of lava in large caves. -mgv7_lava_depth (Lava depth) int -256 - -# Controls the density of mountain-type floatlands. -# Is a noise offset added to the 'mgv7_np_mountain' noise value. -mgv7_float_mount_density (Floatland mountain density) float 0.6 - -# Typical maximum height, above and below midpoint, of floatland mountains. -mgv7_float_mount_height (Floatland mountain height) float 128.0 - -# Alters how mountain-type floatlands taper above and below midpoint. -mgv7_float_mount_exponent (Floatland mountain exponent) float 0.75 - -# Y-level of floatland midpoint and lake surface. -mgv7_floatland_level (Floatland level) int 1280 - -# Y-level to which floatland shadows extend. -mgv7_shadow_limit (Shadow limit) int 1024 - -# Y-level of cavern upper limit. -mgv7_cavern_limit (Cavern limit) int -256 - -# Y-distance over which caverns expand to full size. -mgv7_cavern_taper (Cavern taper) int 256 - -# Defines full size of caverns, smaller values create larger caverns. -mgv7_cavern_threshold (Cavern threshold) float 0.7 - -# Lower Y limit of dungeons. -mgv7_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgv7_dungeon_ymax (Dungeon maximum Y) int 31000 - -[**Noises] - -# Y-level of higher terrain that creates cliffs. -mgv7_np_terrain_base (Terrain base noise) noise_params_2d 4, 70, (600, 600, 600), 82341, 5, 0.6, 2.0, eased - -# Y-level of lower terrain and seabed. -mgv7_np_terrain_alt (Terrain alternative noise) noise_params_2d 4, 25, (600, 600, 600), 5934, 5, 0.6, 2.0, eased - -# Varies roughness of terrain. -# Defines the 'persistence' value for terrain_base and terrain_alt noises. -mgv7_np_terrain_persist (Terrain persistence noise) noise_params_2d 0.6, 0.1, (2000, 2000, 2000), 539, 3, 0.6, 2.0, eased - -# Defines distribution of higher terrain and steepness of cliffs. -mgv7_np_height_select (Height select noise) noise_params_2d -8, 16, (500, 500, 500), 4213, 6, 0.7, 2.0, eased - -# Variation of biome filler depth. -mgv7_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased - -# Variation of maximum mountain height (in nodes). -mgv7_np_mount_height (Mountain height noise) noise_params_2d 256, 112, (1000, 1000, 1000), 72449, 3, 0.6, 2.0, eased - -# Defines large-scale river channel structure. -mgv7_np_ridge_uwater (Ridge underwater noise) noise_params_2d 0, 1, (1000, 1000, 1000), 85039, 5, 0.6, 2.0, eased - -# Defines areas of floatland smooth terrain. -# Smooth floatlands occur when noise > 0. -mgv7_np_floatland_base (Floatland base noise) noise_params_2d -0.6, 1.5, (600, 600, 600), 114, 5, 0.6, 2.0, eased - -# Variation of hill height and lake depth on floatland smooth terrain. -mgv7_np_float_base_height (Floatland base height noise) noise_params_2d 48, 24, (300, 300, 300), 907, 4, 0.7, 2.0, eased - -# 3D noise defining mountain structure and height. -# Also defines structure of floatland mountain terrain. -mgv7_np_mountain (Mountain noise) noise_params_3d -0.6, 1, (250, 350, 250), 5333, 5, 0.63, 2.0 - -# 3D noise defining structure of river canyon walls. -mgv7_np_ridge (Ridge noise) noise_params_3d 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0 - -# 3D noise defining giant caverns. -mgv7_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 - -# First of two 3D noises that together define tunnels. -mgv7_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgv7_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -[*Mapgen Carpathian] - -# Map generation attributes specific to Mapgen Carpathian. -mgcarpathian_spflags (Mapgen Carpathian specific flags) flags caverns caverns,nocaverns - -# Defines the base ground level. -mgcarpathian_base_level (Base ground level) float 12.0 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgcarpathian_cave_width (Cave width) float 0.09 - -# Y of upper limit of large caves. -mgcarpathian_large_cave_depth (Large cave depth) int -33 - -# Y of upper limit of lava in large caves. -mgcarpathian_lava_depth (Lava depth) int -256 - -# Y-level of cavern upper limit. -mgcarpathian_cavern_limit (Cavern limit) int -256 - -# Y-distance over which caverns expand to full size. -mgcarpathian_cavern_taper (Cavern taper) int 256 - -# Defines full size of caverns, smaller values create larger caverns. -mgcarpathian_cavern_threshold (Cavern threshold) float 0.7 - -# Lower Y limit of dungeons. -mgcarpathian_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgcarpathian_dungeon_ymax (Dungeon maximum Y) int 31000 - -[**Noises] - -# Variation of biome filler depth. -mgcarpathian_np_filler_depth (Filler depth noise) noise_params_2d 0, 1, (128, 128, 128), 261, 3, 0.7, 2.0, eased - -# First of 4 2D noises that together define hill/mountain range height. -mgcarpathian_np_height1 (Hilliness1 noise) noise_params_2d 0, 5, (251, 251, 251), 9613, 5, 0.5, 2.0, eased - -# Second of 4 2D noises that together define hill/mountain range height. -mgcarpathian_np_height2 (Hilliness2 noise) noise_params_2d 0, 5, (383, 383, 383), 1949, 5, 0.5, 2.0, eased - -# Third of 4 2D noises that together define hill/mountain range height. -mgcarpathian_np_height3 (Hilliness3 noise) noise_params_2d 0, 5, (509, 509, 509), 3211, 5, 0.5, 2.0, eased - -# Fourth of 4 2D noises that together define hill/mountain range height. -mgcarpathian_np_height4 (Hilliness4 noise) noise_params_2d 0, 5, (631, 631, 631), 1583, 5, 0.5, 2.0, eased - -# 2D noise that controls the size/occurrence of rolling hills. -mgcarpathian_np_hills_terrain (Rolling hills spread noise) noise_params_2d 1, 1, (1301, 1301, 1301), 1692, 3, 0.5, 2.0, eased - -# 2D noise that controls the size/occurrence of ridged mountain ranges. -mgcarpathian_np_ridge_terrain (Ridge mountain spread noise) noise_params_2d 1, 1, (1889, 1889, 1889), 3568, 3, 0.5, 2.0, eased - -# 2D noise that controls the size/occurrence of step mountain ranges. -mgcarpathian_np_step_terrain (Step mountain spread noise) noise_params_2d 1, 1, (1889, 1889, 1889), 4157, 3, 0.5, 2.0, eased - -# 2D noise that controls the shape/size of rolling hills. -mgcarpathian_np_hills (Rolling hill size noise) noise_params_2d 0, 3, (257, 257, 257), 6604, 6, 0.5, 2.0, eased - -# 2D noise that controls the shape/size of ridged mountains. -mgcarpathian_np_ridge_mnt (Ridged mountain size noise) noise_params_2d 0, 12, (743, 743, 743), 5520, 6, 0.7, 2.0, eased - -# 2D noise that controls the shape/size of step mountains. -mgcarpathian_np_step_mnt (Step mountain size noise) noise_params_2d 0, 8, (509, 509, 509), 2590, 6, 0.6, 2.0, eased - -# 3D noise for mountain overhangs, cliffs, etc. Usually small variations. -mgcarpathian_np_mnt_var (Mountain variation noise) noise_params_3d 0, 1, (499, 499, 499), 2490, 5, 0.55, 2.0 - -# First of two 3D noises that together define tunnels. -mgcarpathian_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgcarpathian_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -# 3D noise defining giant caverns. -mgcarpathian_np_cavern (Cavern noise) noise_params_3d 0, 1, (384, 128, 384), 723, 5, 0.63, 2.0 - -[*Mapgen Flat] - -# Map generation attributes specific to Mapgen flat. -# Occasional lakes and hills can be added to the flat world. -mgflat_spflags (Mapgen Flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills - -# Y of flat ground. -mgflat_ground_level (Ground level) int 8 - -# Y of upper limit of large caves. -mgflat_large_cave_depth (Large cave depth) int -33 - -# Y of upper limit of lava in large caves. -mgflat_lava_depth (Lava depth) int -256 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgflat_cave_width (Cave width) float 0.09 - -# Terrain noise threshold for lakes. -# Controls proportion of world area covered by lakes. -# Adjust towards 0.0 for a larger proportion. -mgflat_lake_threshold (Lake threshold) float -0.45 - -# Controls steepness/depth of lake depressions. -mgflat_lake_steepness (Lake steepness) float 48.0 - -# Terrain noise threshold for hills. -# Controls proportion of world area covered by hills. -# Adjust towards 0.0 for a larger proportion. -mgflat_hill_threshold (Hill threshold) float 0.45 - -# Controls steepness/height of hills. -mgflat_hill_steepness (Hill steepness) float 64.0 - -# Lower Y limit of dungeons. -mgflat_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgflat_dungeon_ymax (Dungeon maximum Y) int 31000 - -[**Noises] - -# Defines location and terrain of optional hills and lakes. -mgflat_np_terrain (Terrain noise) noise_params_2d 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0, eased - -# Variation of biome filler depth. -mgflat_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased - -# First of two 3D noises that together define tunnels. -mgflat_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgflat_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -[*Mapgen Fractal] - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgfractal_cave_width (Cave width) float 0.09 - -# Y of upper limit of large caves. -mgfractal_large_cave_depth (Large cave depth) int -33 - -# Y of upper limit of lava in large caves. -mgfractal_lava_depth (Lava depth) int -256 - -# Lower Y limit of dungeons. -mgfractal_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgfractal_dungeon_ymax (Dungeon maximum Y) int 31000 - -# Selects one of 18 fractal types. -# 1 = 4D "Roundy" mandelbrot set. -# 2 = 4D "Roundy" julia set. -# 3 = 4D "Squarry" mandelbrot set. -# 4 = 4D "Squarry" julia set. -# 5 = 4D "Mandy Cousin" mandelbrot set. -# 6 = 4D "Mandy Cousin" julia set. -# 7 = 4D "Variation" mandelbrot set. -# 8 = 4D "Variation" julia set. -# 9 = 3D "Mandelbrot/Mandelbar" mandelbrot set. -# 10 = 3D "Mandelbrot/Mandelbar" julia set. -# 11 = 3D "Christmas Tree" mandelbrot set. -# 12 = 3D "Christmas Tree" julia set. -# 13 = 3D "Mandelbulb" mandelbrot set. -# 14 = 3D "Mandelbulb" julia set. -# 15 = 3D "Cosine Mandelbulb" mandelbrot set. -# 16 = 3D "Cosine Mandelbulb" julia set. -# 17 = 4D "Mandelbulb" mandelbrot set. -# 18 = 4D "Mandelbulb" julia set. -mgfractal_fractal (Fractal type) int 1 1 18 - -# Iterations of the recursive function. -# Increasing this increases the amount of fine detail, but also -# increases processing load. -# At iterations = 20 this mapgen has a similar load to mapgen V7. -mgfractal_iterations (Iterations) int 11 - -# (X,Y,Z) scale of fractal in nodes. -# Actual fractal size will be 2 to 3 times larger. -# These numbers can be made very large, the fractal does -# not have to fit inside the world. -# Increase these to 'zoom' into the detail of the fractal. -# Default is for a vertically-squashed shape suitable for -# an island, set all 3 numbers equal for the raw shape. -mgfractal_scale (Scale) v3f (4096.0, 1024.0, 4096.0) - -# (X,Y,Z) offset of fractal from world center in units of 'scale'. -# Can be used to move a desired point to (0, 0) to create a -# suitable spawn point, or to allow 'zooming in' on a desired -# point by increasing 'scale'. -# The default is tuned for a suitable spawn point for mandelbrot -# sets with default parameters, it may need altering in other -# situations. -# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes. -mgfractal_offset (Offset) v3f (1.79, 0.0, 0.0) - -# W coordinate of the generated 3D slice of a 4D fractal. -# Determines which 3D slice of the 4D shape is generated. -# Alters the shape of the fractal. -# Has no effect on 3D fractals. -# Range roughly -2 to 2. -mgfractal_slice_w (Slice w) float 0.0 - -# Julia set only. -# X component of hypercomplex constant. -# Alters the shape of the fractal. -# Range roughly -2 to 2. -mgfractal_julia_x (Julia x) float 0.33 - -# Julia set only. -# Y component of hypercomplex constant. -# Alters the shape of the fractal. -# Range roughly -2 to 2. -mgfractal_julia_y (Julia y) float 0.33 - -# Julia set only. -# Z component of hypercomplex constant. -# Alters the shape of the fractal. -# Range roughly -2 to 2. -mgfractal_julia_z (Julia z) float 0.33 - -# Julia set only. -# W component of hypercomplex constant. -# Alters the shape of the fractal. -# Has no effect on 3D fractals. -# Range roughly -2 to 2. -mgfractal_julia_w (Julia w) float 0.33 - -[**Noises] - -# Y-level of seabed. -mgfractal_np_seabed (Seabed noise) noise_params_2d -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0, eased - -# Variation of biome filler depth. -mgfractal_np_filler_depth (Filler depth noise) noise_params_2d 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0, eased - -# First of two 3D noises that together define tunnels. -mgfractal_np_cave1 (Cave1 noise) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgfractal_np_cave2 (Cave2 noise) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -[*Mapgen Valleys] - -# Map generation attributes specific to Mapgen Valleys. -# 'altitude_chill': Reduces heat with altitude. -# 'humid_rivers': Increases humidity around rivers. -# 'vary_river_depth': If enabled, low humidity and high heat causes rivers -# to become shallower and occasionally dry. -# 'altitude_dry': Reduces humidity with altitude. -mgvalleys_spflags (Mapgen Valleys specific flags) flags altitude_chill,humid_rivers,vary_river_depth,altitude_dry altitude_chill,noaltitude_chill,humid_rivers,nohumid_rivers,vary_river_depth,novary_river_depth,altitude_dry,noaltitude_dry - -# The vertical distance over which heat drops by 20 if 'altitude_chill' is -# enabled. Also the vertical distance over which humidity drops by 10 if -# 'altitude_dry' is enabled. -mgvalleys_altitude_chill (Altitude chill) int 90 - -# Depth below which you'll find large caves. -mgvalleys_large_cave_depth (Large cave depth) int -33 - -# Y of upper limit of lava in large caves. -mgvalleys_lava_depth (Lava depth) int 1 - -# Depth below which you'll find giant caverns. -mgvalleys_cavern_limit (Cavern upper limit) int -256 - -# Y-distance over which caverns expand to full size. -mgvalleys_cavern_taper (Cavern taper) int 192 - -# Defines full size of caverns, smaller values create larger caverns. -mgvalleys_cavern_threshold (Cavern threshold) float 0.6 - -# How deep to make rivers. -mgvalleys_river_depth (River depth) int 4 - -# How wide to make rivers. -mgvalleys_river_size (River size) int 5 - -# Controls width of tunnels, a smaller value creates wider tunnels. -mgvalleys_cave_width (Cave width) float 0.09 - -# Lower Y limit of dungeons. -mgvalleys_dungeon_ymin (Dungeon minimum Y) int -31000 - -# Upper Y limit of dungeons. -mgvalleys_dungeon_ymax (Dungeon maximum Y) int 63 - -[**Noises] - -# First of two 3D noises that together define tunnels. -mgvalleys_np_cave1 (Cave noise #1) noise_params_3d 0, 12, (61, 61, 61), 52534, 3, 0.5, 2.0 - -# Second of two 3D noises that together define tunnels. -mgvalleys_np_cave2 (Cave noise #2) noise_params_3d 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 - -# The depth of dirt or other biome filler node. -mgvalleys_np_filler_depth (Filler depth) noise_params_2d 0, 1.2, (256, 256, 256), 1605, 3, 0.5, 2.0, eased - -# 3D noise defining giant caverns. -mgvalleys_np_cavern (Cavern noise) noise_params_3d 0, 1, (768, 256, 768), 59033, 6, 0.63, 2.0 - -# Defines large-scale river channel structure. -mgvalleys_np_rivers (River noise) noise_params_2d 0, 1, (256, 256, 256), -6050, 5, 0.6, 2.0, eased - -# Base terrain height. -mgvalleys_np_terrain_height (Terrain height) noise_params_2d -10, 50, (1024, 1024, 1024), 5202, 6, 0.4, 2.0, eased - -# Raises terrain to make valleys around the rivers. -mgvalleys_np_valley_depth (Valley depth) noise_params_2d 5, 4, (512, 512, 512), -1914, 1, 1.0, 2.0, eased - -# Slope and fill work together to modify the heights. -mgvalleys_np_inter_valley_fill (Valley fill) noise_params_3d 0, 1, (256, 512, 256), 1993, 6, 0.8, 2.0 - -# Amplifies the valleys. -mgvalleys_np_valley_profile (Valley profile) noise_params_2d 0.6, 0.5, (512, 512, 512), 777, 1, 1.0, 2.0, eased - -# Slope and fill work together to modify the heights. -mgvalleys_np_inter_valley_slope (Valley slope) noise_params_2d 0.5, 0.5, (128, 128, 128), 746, 1, 1.0, 2.0, eased - -[*Advanced] - -# Size of mapchunks generated by mapgen, stated in mapblocks (16 nodes). -# WARNING!: There is no benefit, and there are several dangers, in -# increasing this value above 5. -# Reducing this value increases cave and dungeon density. -# Altering this value is for special usage, leaving it unchanged is -# recommended. -chunksize (Chunk size) int 5 - -# Dump the mapgen debug information. -enable_mapgen_debug_info (Mapgen debug) bool false - -# Maximum number of blocks that can be queued for loading. -emergequeue_limit_total (Absolute limit of emerge queues) int 512 - -# Maximum number of blocks to be queued that are to be loaded from file. -# Set to blank for an appropriate amount to be chosen automatically. -emergequeue_limit_diskonly (Limit of emerge queues on disk) int 64 - -# Maximum number of blocks to be queued that are to be generated. -# Set to blank for an appropriate amount to be chosen automatically. -emergequeue_limit_generate (Limit of emerge queues to generate) int 64 - -# Number of emerge threads to use. -# WARNING: Currently there are multiple bugs that may cause crashes when -# 'num_emerge_threads' is larger than 1. Until this warning is removed it is -# strongly recommended this value is set to the default '1'. -# Value 0: -# - Automatic selection. The number of emerge threads will be -# - 'number of processors - 2', with a lower limit of 1. -# Any other value: -# - Specifies the number of emerge threads, with a lower limit of 1. -# WARNING: Increasing the number of emerge threads increases engine mapgen -# speed, but this may harm game performance by interfering with other -# processes, especially in singleplayer and/or when running Lua code in -# 'on_generated'. For many users the optimum setting may be '1'. -num_emerge_threads (Number of emerge threads) int 1 - -[Online Content Repository] - -# The URL for the content repository -contentdb_url (ContentDB URL) string https://content.minetest.net - -# Comma-separated list of flags to hide in the content repository. -# "nonfree" can be used to hide packages which do not qualify as 'free software', -# as defined by the Free Software Foundation. -# You can also specify content ratings. -# These flags are independent from Minetest versions, -# so see a full list at https://content.minetest.net/help/content_flags/ -contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default diff --git a/client/serverlist/favoriteservers.txt b/client/serverlist/favoriteservers.txt index b2945a4..f94112e 100644 --- a/client/serverlist/favoriteservers.txt +++ b/client/serverlist/favoriteservers.txt @@ -1,6 +1,6 @@ [server] -BlockColor Server + blockcolor.net 30000 -BlockColor is a creative sandbox with only 8 colors. Only a limit : Your Imagination - http://blockcolor.net/ + diff --git a/client/shaders/3d_interlaced_merge/opengl_fragment.glsl b/client/shaders/3d_interlaced_merge/opengl_fragment.glsl deleted file mode 100644 index 25945ad..0000000 --- a/client/shaders/3d_interlaced_merge/opengl_fragment.glsl +++ /dev/null @@ -1,21 +0,0 @@ -uniform sampler2D baseTexture; -uniform sampler2D normalTexture; -uniform sampler2D textureFlags; - -#define leftImage baseTexture -#define rightImage normalTexture -#define maskImage textureFlags - -void main(void) -{ - vec2 uv = gl_TexCoord[0].st; - vec4 left = texture2D(leftImage, uv).rgba; - vec4 right = texture2D(rightImage, uv).rgba; - vec4 mask = texture2D(maskImage, uv).rgba; - vec4 color; - if (mask.r > 0.5) - color = right; - else - color = left; - gl_FragColor = color; -} diff --git a/client/shaders/3d_interlaced_merge/opengl_vertex.glsl b/client/shaders/3d_interlaced_merge/opengl_vertex.glsl deleted file mode 100644 index 4e0b2b1..0000000 --- a/client/shaders/3d_interlaced_merge/opengl_vertex.glsl +++ /dev/null @@ -1,6 +0,0 @@ -void main(void) -{ - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_Position = gl_Vertex; - gl_FrontColor = gl_BackColor = gl_Color; -} diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index 54b569c..3ac79c2 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -135,7 +135,7 @@ float disp_z; color.a = 1; // Emphase blue a bit in darker places - // See C++ implementation in mapblock_mesh.cpp final_color_blend() + // See C++ implementation in mapblock_mesh.cpp finalColorBlend() float brightness = (color.r + color.g + color.b) / 3; color.b += max(0.0, 0.021 - abs(0.2 * brightness - 0.021) + 0.07 * brightness); diff --git a/clientmods/preview/example.lua b/clientmods/preview/example.lua deleted file mode 100644 index 2f661c0..0000000 --- a/clientmods/preview/example.lua +++ /dev/null @@ -1,2 +0,0 @@ -print("Loaded example file!, loading more examples") -dofile("preview:examples/first.lua") diff --git a/clientmods/preview/examples/first.lua b/clientmods/preview/examples/first.lua deleted file mode 100644 index c24f461..0000000 --- a/clientmods/preview/examples/first.lua +++ /dev/null @@ -1 +0,0 @@ -print("loaded first.lua example file") diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua index bb8d1d6..f399261 100644 --- a/clientmods/preview/init.lua +++ b/clientmods/preview/init.lua @@ -1,57 +1,18 @@ local modname = core.get_current_modname() or "??" local modstorage = core.get_mod_storage() -local mod_channel -dofile("preview:example.lua") -- This is an example function to ensure it's working properly, should be removed before merge core.register_on_shutdown(function() print("[PREVIEW] shutdown client") end) -local id = nil -local server_info = core.get_server_info() -print("Server version: " .. server_info.protocol_version) -print("Server ip: " .. server_info.ip) -print("Server address: " .. server_info.address) -print("Server port: " .. server_info.port) -mod_channel = core.mod_channel_join("experimental_preview") - -core.after(4, function() - if mod_channel:is_writeable() then - mod_channel:send_all("preview talk to experimental") - end -end) - -core.after(1, function() - id = core.localplayer:hud_add({ - hud_elem_type = "text", - name = "example", - number = 0xff0000, - position = {x=0, y=1}, - offset = {x=8, y=-8}, - text = "You are using the preview mod", - scale = {x=200, y=60}, - alignment = {x=1, y=-1}, - }) -end) - -core.register_on_modchannel_message(function(channel, sender, message) - print("[PREVIEW][modchannels] Received message `" .. message .. "` on channel `" - .. channel .. "` from sender `" .. sender .. "`") - core.after(1, function() - mod_channel:send_all("CSM preview received " .. message) - end) -end) - -core.register_on_modchannel_signal(function(channel, signal) - print("[PREVIEW][modchannels] Received signal id `" .. signal .. "` on channel `" - .. channel) -end) - -core.register_on_inventory_open(function(inventory) - print("INVENTORY OPEN") - print(dump(inventory)) - return false +core.register_on_connect(function() + print("[PREVIEW] Player connection completed") + local server_info = core.get_server_info() + print("Server version: " .. server_info.protocol_version) + print("Server ip: " .. server_info.ip) + print("Server address: " .. server_info.address) + print("Server port: " .. server_info.port) end) core.register_on_placenode(function(pointed_thing, node) @@ -69,13 +30,13 @@ core.register_on_item_use(function(itemstack, pointed_thing) end) -- This is an example function to ensure it's working properly, should be removed before merge -core.register_on_receiving_chat_message(function(message) +core.register_on_receiving_chat_messages(function(message) print("[PREVIEW] Received message " .. message) return false end) -- This is an example function to ensure it's working properly, should be removed before merge -core.register_on_sending_chat_message(function(message) +core.register_on_sending_chat_messages(function(message) print("[PREVIEW] Sending message " .. message) return false end) @@ -189,19 +150,3 @@ core.register_on_punchnode(function(pos, node) return false end) -core.register_chatcommand("privs", { - func = function(param) - return true, core.privs_to_string(minetest.get_privilege_list()) - end, -}) - -core.register_chatcommand("text", { - func = function(param) - return core.localplayer:hud_change(id, "text", param) - end, -}) - - -core.register_on_mods_loaded(function() - core.log("Yeah preview mod is loaded with other CSM mods.") -end) diff --git a/doc/README.md b/doc/README.md index 8be6ecc..a8d69f8 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,500 +1,45 @@ -Minetest -======== +Blockcolor Open Source Project +============================== -[![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest) -[![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget) -[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) +Blockcolor is an Open Source sandbox creative game with 8 Colors. (https://blockcolor.net/). -Minetest is a free open-source voxel game engine with easy modding and game creation. +Blockcolor is based on Multicraft/Minetest projects - Copyright © 2018-2019 - MrChiantos & BlockColor Community. -Copyright (C) 2010-2018 Perttu Ahola -and contributors (see source file comments and the version control log) +GNU LGPL 3.0 for code and Cc By SA 3.0 for medias (http://creativecommons.org/licenses/by-sa/3.0/) -In case you downloaded the source code: ---------------------------------------- -If you downloaded the Minetest Engine source code in which this file is -contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/) -project too. See its README.txt for more information. +--- -Table of Contents ------------------- +__Game Creator__ : MrChiantos -1. [Further Documentation](#further-documentation) -2. [Default Controls](#default-controls) -3. [Paths](#paths) -4. [Configuration File](#configuration-file) -5. [Command-line Options](#command-line-options) -6. [Compiling](#compiling) -7. [Docker](#docker) -8. [Version Scheme](#version-scheme) +Helpers or others Creators : +__Animal Model :__ AspireMint +__Ships Spawn Mod :__ SokoMine +__Furnitures Mod :__ Gerold55 +__Slope Simple :__ Nigel +__Awards :__ Ruben +__SurfBoard :__ Archfan7411 +__Airboat :__ Paramat +__DriftCar :__ Paramat +__Spaceship :__ Paramat (Code) & SpaceShip'Model (Viktor Hahn ) +__Textures 16px :__ Peak (Since 1.46.4b) +__Trampoline :__ hkzorman +__Mobs mod :__ TenPlus1 +__Player Model :__ Quaternius (Human Low Poly / Since 1.53) +__Player Model b3d :__ Kroukuk +__Trees :__ Kenney.nl (Since 1.53) +__Hdb Model (Homedecor) :__ Vanessa +__Hovercraft :__ Stuart Jones +__HotAirBallons :__ Me Me and Me // mbb (Flying Carpet - Wuzzy) +__ComboBlock :__ Pithydon +__ComboBlock & ComboStair Model :__ Nathan (MinetestVideo) +__Header and Logo :__ LMD, azekill_DIABLO & MrChiantos +__Inventory Icons :__ Xenon (xenonca) -Further documentation ----------------------- -- Website: http://minetest.net/ -- Wiki: http://wiki.minetest.net/ -- Developer wiki: http://dev.minetest.net/ -- Forum: http://forum.minetest.net/ -- GitHub: https://github.com/minetest/minetest/ -- [doc/](doc/) directory of source distribution +Minetest : Copyright © 2010-2019 celeron55, Perttu Ahola & Minetest Community and Devs. -Default controls ----------------- -All controls are re-bindable using settings. -Some can be changed in the key config dialog in the settings tab. +Multicraft : Copyright © 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua & MultiCraft Development Team. -| Button | Action | -|-------------------------------|----------------------------------------------------------------| -| Move mouse | Look around | -| W, A, S, D | Move | -| Space | Jump/move up | -| Shift | Sneak/move down | -| Q | Drop itemstack | -| Shift + Q | Drop single item | -| Left mouse button | Dig/punch/take item | -| Right mouse button | Place/use | -| Shift + right mouse button | Build (without using) | -| I | Inventory menu | -| Mouse wheel | Select item | -| 0-9 | Select item | -| Z | Zoom (needs zoom privilege) | -| T | Chat | -| / | Command | -| Esc | Pause menu/abort/exit (pauses only singleplayer game) | -| R | Enable/disable full range view | -| + | Increase view range | -| - | Decrease view range | -| K | Enable/disable fly mode (needs fly privilege) | -| L | Enable/disable pitch move mode | -| J | Enable/disable fast mode (needs fast privilege) | -| H | Enable/disable noclip mode (needs noclip privilege) | -| E | Move fast in fast mode | -| F1 | Hide/show HUD | -| F2 | Hide/show chat | -| F3 | Disable/enable fog | -| F4 | Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds) | -| F5 | Cycle through debug information screens | -| F6 | Cycle through profiler info screens | -| F7 | Cycle through camera modes | -| F9 | Cycle through minimap modes | -| Shift + F9 | Change minimap orientation | -| F10 | Show/hide console | -| F12 | Take screenshot | +--- -Paths ------ -Locations: - -* `bin` - Compiled binaries -* `share` - Distributed read-only data -* `user` - User-created modifiable data - -Where each location is on each platform: - -* Windows .zip / RUN_IN_PLACE source: - * bin = `bin` - * share = `.` - * user = `.` -* Windows installed: - * $bin = `C:\Program Files\Minetest\bin (Depends on the install location)` - * $share = `C:\Program Files\Minetest (Depends on the install location)` - * $user = `%Appdata%\Minetest` -* Linux installed: - * `bin` = `/usr/bin` - * `share` = `/usr/share/minetest` - * `user` = `~/.minetest` -* macOS: - * `bin` = `Contents/MacOS` - * `share` = `Contents/Resources` - * `user` = `Contents/User OR ~/Library/Application Support/minetest` - -Worlds can be found as separate folders in: `user/worlds/` - -Configuration file: -------------------- -- Default location: - `user/minetest.conf` -- It is created by Minetest when it is ran the first time. -- A specific file can be specified on the command line: - `--config ` -- A run-in-place build will look for the configuration file in - `location_of_exe/../minetest.conf` and also `location_of_exe/../../minetest.conf` - -Command-line options: ---------------------- -- Use `--help` - -Compiling ---------- -### Compiling on GNU/Linux - -#### Dependencies - -| Dependency | Version | Commentary | -|------------|---------|------------| -| GCC | 4.9+ | Can be replaced with Clang 3.4+ | -| CMake | 2.6+ | | -| Irrlicht | 1.7.3+ | | -| SQLite3 | 3.0+ | | -| LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present | -| GMP | 5.0.0+ | Bundled mini-GMP is used if not present | -| JsonCPP | 1.0.0+ | Bundled JsonCPP is used if not present | - -For Debian/Ubuntu: - - sudo apt install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev - -For Fedora users: - - sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel - -#### Download - -You can install Git for easily keeping your copy up to date. -If you don’t want Git, read below on how to get the source without Git. -This is an example for installing Git on Debian/Ubuntu: - - sudo apt install git - -For Fedora users: - - sudo dnf install git - -Download source (this is the URL to the latest of source repository, which might not work at all times) using Git: - - git clone --depth 1 https://github.com/minetest/minetest.git - cd minetest - -Download minetest_game (otherwise only the "Minimal development test" game is available) using Git: - - git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game - -Download source, without using Git: - - wget https://github.com/minetest/minetest/archive/master.tar.gz - tar xf master.tar.gz - cd minetest-master - -Download minetest_game, without using Git: - - cd games/ - wget https://github.com/minetest/minetest_game/archive/master.tar.gz - tar xf master.tar.gz - mv minetest_game-master minetest_game - cd .. - -#### Build - -Build a version that runs directly from the source directory: - - cmake . -DRUN_IN_PLACE=TRUE - make -j - -Run it: - - ./bin/minetest - -- Use `cmake . -LH` to see all CMake options and their current state -- If you want to install it system-wide (or are making a distribution package), - you will want to use `-DRUN_IN_PLACE=FALSE` -- You can build a bare server by specifying `-DBUILD_SERVER=TRUE` -- You can disable the client build by specifying `-DBUILD_CLIENT=FALSE` -- You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=` - - Debug build is slower, but gives much more useful output in a debugger -- If you build a bare server, you don't need to have Irrlicht installed. - - In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source` - -### CMake options - -General options and their default values: - - BUILD_CLIENT=TRUE - Build Minetest client - BUILD_SERVER=FALSE - Build Minetest server - CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug) - Release - Release build - Debug - Debug build - SemiDebug - Partially optimized debug build - RelWithDebInfo - Release build with debug information - MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible - ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http - ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal) - ENABLE_FREETYPE=ON - Build with FreeType2; Allows using TTF fonts - ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations - ENABLE_GLES=OFF - Search for Open GLES headers & libraries and use them - ENABLE_LEVELDB=ON - Build with LevelDB; Enables use of LevelDB map backend - ENABLE_POSTGRESQL=ON - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended) - ENABLE_REDIS=ON - Build with libhiredis; Enables use of Redis map backend - ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores - ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds - ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua) - ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp) - ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system - OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference - RUN_IN_PLACE=FALSE - Create a portable install (worlds, settings etc. in current directory) - USE_GPROF=FALSE - Enable profiling using GProf - VERSION_EXTRA= - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar) - -Library specific options: - - BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located - BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so - CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll - CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located - CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib - EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h - EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so - FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it - FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h - FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib - FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll - GETTEXT_DLL - Only when building with gettext on Windows; path to libintl3.dll - GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll - GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h - GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a - GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe - IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll - IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h - IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib - LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h - LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a - LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll - PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h - POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so - REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h - REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so - SPATIAL_INCLUDE_DIR - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h - SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib - LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located - LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so - MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll - OGG_DLL - Only if building with sound on Windows; path to libogg.dll - OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h - OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a - OPENAL_DLL - Only if building with sound on Windows; path to OpenAL32.dll - OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located - OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib - OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h - OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so - SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h - SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib - VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll - VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a - VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll - VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside - VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a - XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so - ZLIB_DLL - Only on Windows; path to zlib1.dll - ZLIBWAPI_DLL - Only on Windows; path to zlibwapi.dll - ZLIB_INCLUDE_DIR - Directory that contains zlib.h - ZLIB_LIBRARY - Path to libz.a/libz.so/zlibwapi.lib - -### Compiling on Windows - -* This section is outdated. In addition to what is described here: - * In addition to minetest, you need to download [minetest_game](https://github.com/minetest/minetest_game). - * If you wish to have sound support, you need libogg, libvorbis and libopenal - -* You need: - * CMake: - http://www.cmake.org/cmake/resources/software.html - * A compiler - * MinGW: http://www.mingw.org/ - * or Visual Studio: http://msdn.microsoft.com/en-us/vstudio/default - * Irrlicht SDK 1.7: - http://irrlicht.sourceforge.net/downloads.html - * Zlib headers (zlib125.zip) - http://www.winimage.com/zLibDll/index.html - * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): - http://www.winimage.com/zLibDll/index.html - * SQLite3 headers and library - https://www.sqlite.org/download.html - * Optional: gettext library and tools: - http://gnuwin32.sourceforge.net/downlinks/gettext.php - * This is used for other UI languages. Feel free to leave it out. - * And, of course, Minetest: - http://minetest.net/download -* Steps: - * Select a directory called DIR hereafter in which you will operate. - * Make sure you have CMake and a compiler installed. - * Download all the other stuff to DIR and extract them into there. - ("extract here", not "extract to packagename/") - * NOTE: zlib125dll.zip needs to be extracted into zlib125dll - * NOTE: You need to extract sqlite3.h & sqlite3ext.h from the SQLite 3 - source and sqlite3.dll & sqlite3.def from the SQLite 3 precompiled - binaries into "sqlite3" directory, and generate sqlite3.lib using - command "LIB /DEF:sqlite3.def /OUT:sqlite3.lib" - * All those packages contain a nice base directory in them, which - should end up being the direct subdirectories of DIR. - * You will end up with a directory structure like this (+=dir, -=file): - ----------------- - + DIR - * zlib-1.2.5.tar.gz - * zlib125dll.zip - * irrlicht-1.8.3.zip - * sqlite-amalgamation-3130000.zip (SQLite3 headers) - * sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system) - * 110214175330.zip (or whatever, this is the minetest source) - + zlib-1.2.5 - * zlib.h - + win32 - ... - + zlib125dll - * readme.txt - + dll32 - ... - + irrlicht-1.8.3 - + lib - + include - ... - + sqlite3 - sqlite3.h - sqlite3ext.h - sqlite3.lib - sqlite3.dll - + gettext (optional) - +bin - +include - +lib - + minetest - + src - + doc - * CMakeLists.txt - ... - ----------------- - * Start up the CMake GUI - * Select "Browse Source..." and select DIR/minetest - * Now, if using MSVC: - * Select "Browse Build..." and select DIR/minetest-build - * Else if using MinGW: - * Select "Browse Build..." and select DIR/minetest - * Select "Configure" - * Select your compiler - * It will warn about missing stuff, ignore that at this point. (later don't) - * Make sure the configuration is as follows - (note that the versions may differ for you): - - BUILD_CLIENT [X] - BUILD_SERVER [ ] - CMAKE_BUILD_TYPE Release - CMAKE_INSTALL_PREFIX DIR/minetest-install - IRRLICHT_SOURCE_DIR DIR/irrlicht-1.8.3 - RUN_IN_PLACE [X] - WARN_ALL [ ] - ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll - ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 - ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib - GETTEXT_BIN_DIR DIR/gettext/bin - GETTEXT_INCLUDE_DIR DIR/gettext/include - GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib - GETTEXT_MSGFMT DIR/gettext/bin/msgfmt - - * If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the - right top corner, then specify the location of SQLITE3_INCLUDE_DIR and - SQLITE3_LIBRARY manually. - * If you want to build 64-bit minetest, you will need to build 64-bit version - of irrlicht engine manually, as only 32-bit pre-built library is provided. - * Hit "Configure" - * Hit "Configure" once again 8) - * If something is still coloured red, you have a problem. - * Hit "Generate" - If using MSVC: - * Open the generated minetest.sln - * The project defaults to the "Debug" configuration. Make very sure to - select "Release", unless you want to debug some stuff (it's slower - and might not even work at all) - * Build the ALL_BUILD project - * Build the INSTALL project - * You should now have a working game with the executable in - DIR/minetest-install/bin/minetest.exe - * Additionally you may create a zip package by building the PACKAGE - project. - If using MinGW: - * Using the command line, browse to the build directory and run 'make' - (or mingw32-make or whatever it happens to be) - * You may need to copy some of the downloaded DLLs into bin/, see what - running the produced executable tells you it doesn't have. - * You should now have a working game with the executable in - DIR/minetest/bin/minetest.exe - -### Bat script to build Windows releases of Minetest - -This is how we build Windows releases. - - set sourcedir=%CD% - set installpath="C:\tmp\minetest_install" - set irrlichtpath="C:\tmp\irrlicht-1.7.2" - - set builddir=%sourcedir%\bvc10 - mkdir %builddir% - pushd %builddir% - cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath% - if %errorlevel% neq 0 goto fail - "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release - if %errorlevel% neq 0 goto fail - "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release - if %errorlevel% neq 0 goto fail - "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release - if %errorlevel% neq 0 goto fail - popd - echo Finished. - exit /b 0 - - :fail - popd - echo Failed. - exit /b 1 - -### Windows Installer using WIX Toolset - -Requirements: -* Visual Studio 2017 -* Wix Toolset - -In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset" - -Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE". - -Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate". -It may take some minutes to generate the installer. - - -Docker ------- -We provide Minetest server docker images using the Gitlab mirror registry. - -Images are built on each commit and available using the following tag scheme: - -* `registry.gitlab.com/minetest/minetest/server:latest` (latest build) -* `registry.gitlab.com/minetest/minetest/server:` (current branch or current tag) -* `registry.gitlab.com/minetest/minetest/server:` (current commit id) - -If you want to test it on a docker server, you can easily run: - - sudo docker run registry.gitlab.com/minetest/minetest/server: - -If you want to use it in a production environment you should use volumes bound to the docker host -to persist data and modify the configuration: - - sudo docker create -v /home/minetest/data/:/var/lib/minetest/ -v /home/minetest/conf/:/etc/minetest/ registry.gitlab.com/minetest/minetest/server:master - -Data will be written to `/home/minetest/data` on the host, and configuration will be read from `/home/minetest/conf/minetest.conf`. - -Note: If you don't understand the previous commands, please read the official Docker documentation before use. - -You can also host your minetest server inside a Kubernetes cluster. See our example implementation in `misc/kubernetes.yml`. - - -Version scheme --------------- -We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`. - -- Major is incremented when the release contains breaking changes, all other -numbers are set to 0. -- Minor is incremented when the release contains new non-breaking features, -patch is set to 0. -- Patch is incremented when the release only contains bugfixes and very -minor/trivial features considered necessary. - -Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release, -i.e.: 5.0.0-dev is the development version leading to 5.0.0. -Prior to that we used `previous_version-dev`. +If I forgot you, thank you to contact me via the forum of minetest, I could add you to the list of names. diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 2edd0d9..c4991ee 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,232 +1,192 @@ -Minetest Lua Modding API Reference -================================== - +Minetest Lua Modding API Reference 0.4.17 +========================================= * More information at * Developer Wiki: - Introduction -============ - -Content and functionality can be added to Minetest using Lua scripting -in run-time loaded mods. +------------ +Content and functionality can be added to Minetest 0.4 by using Lua +scripting in run-time loaded mods. A mod is a self-contained bunch of scripts, textures and other related -things, which is loaded by and interfaces with Minetest. +things that is loaded by and interfaces with Minetest. Mods are contained and ran solely on the server side. Definitions and media files are automatically transferred to the client. If you see a deficiency in the API, feel free to attempt to add the -functionality in the engine and API, and to document it here. +functionality in the engine and API. You can send such improvements as +source code patches to . Programming in Lua ------------------ - If you have any difficulty in understanding this, please read [Programming in Lua](http://www.lua.org/pil/). Startup ------- - Mods are loaded during server startup from the mod load paths by running the `init.lua` scripts in a shared environment. Paths ----- - * `RUN_IN_PLACE=1` (Windows release, local build) - * `$path_user`: `` - * `$path_share`: `` + * `$path_user`: + * Linux: `` + * Windows: `` + * `$path_share` + * Linux: `` + * Windows: `` * `RUN_IN_PLACE=0`: (Linux release) - * `$path_share`: + * `$path_share` * Linux: `/usr/share/minetest` * Windows: `/minetest-0.4.x` * `$path_user`: * Linux: `$HOME/.minetest` * Windows: `C:/users//AppData/minetest` (maybe) - - - Games -===== - +----- Games are looked up from: -* `$path_share/games//` -* `$path_user/games//` +* `$path_share/games/gameid/` +* `$path_user/games/gameid/` -Where `` is unique to each game. +where `gameid` is unique to each game. -The game directory can contain the following files: +The game directory contains the file `game.conf`, which contains these fields: -* `game.conf`, with the following keys: - * `name`: Required, human readable name e.g. `name = Minetest` - * `description`: Short description to be shown in the content tab - * `disallowed_mapgens = ` - e.g. `disallowed_mapgens = v5,v6,flat` - These mapgens are removed from the list of mapgens for the game. -* `minetest.conf`: - Used to set default settings when running this game. -* `settingtypes.txt`: - In the same format as the one in builtin. - This settingtypes.txt will be parsed by the menu and the settings will be - displayed in the "Games" category in the advanced settings tab. -* If the game contains a folder called `textures` the server will load it as a - texturepack, overriding mod textures. - Any server texturepack will override mod textures and the game texturepack. + name = -Menu images ------------ +e.g. -Games can provide custom main menu images. They are put inside a `menu` -directory inside the game directory. + name = Minetest -The images are named `$identifier.png`, where `$identifier` is one of -`overlay`, `background`, `footer`, `header`. -If you want to specify multiple images for one identifier, add additional -images named like `$identifier.$n.png`, with an ascending number $n starting -with 1, and a random image will be chosen from the provided ones. +The game directory can contain the file minetest.conf, which will be used +to set default settings when running the particular game. +It can also contain a settingtypes.txt in the same format as the one in builtin. +This settingtypes.txt will be parsed by the menu and the settings will be displayed +in the "Games" category in the settings tab. +### Menu images +Games can provide custom main menu images. They are put inside a `menu` directory +inside the game directory. +The images are named `$identifier.png`, where `$identifier` is +one of `overlay,background,footer,header`. +If you want to specify multiple images for one identifier, add additional images named +like `$identifier.$n.png`, with an ascending number $n starting with 1, and a random +image will be chosen from the provided ones. -Mods -==== Mod load path ------------- +Generic: -Paths are relative to the directories listed in the [Paths] section above. +* `$path_share/games/gameid/mods/` +* `$path_share/mods/` +* `$path_user/games/gameid/mods/` +* `$path_user/mods/` (User-installed mods) +* `$worldpath/worldmods/` -* `games//mods/` -* `mods/` -* `worlds//worldmods/` +In a run-in-place version (e.g. the distributed windows version): -World-specific games --------------------- +* `minetest-0.4.x/games/gameid/mods/` +* `minetest-0.4.x/mods/` (User-installed mods) +* `minetest-0.4.x/worlds/worldname/worldmods/` +On an installed version on Linux: + +* `/usr/share/minetest/games/gameid/mods/` +* `$HOME/.minetest/mods/` (User-installed mods) +* `$HOME/.minetest/worlds/worldname/worldmods` + +Mod load path for world-specific games +-------------------------------------- It is possible to include a game in a world; in this case, no mods or games are loaded or checked from anywhere else. -This is useful for e.g. adventure worlds and happens if the `/game/` -directory exists. +This is useful for e.g. adventure worlds. -Mods should then be placed in `/game/mods/`. +This happens if the following directory exists: -Modpacks --------- + $world/game/ +Mods should be then be placed in: + + $world/game/mods/ + +Modpack support +---------------- Mods can be put in a subdirectory, if the parent directory, which otherwise -should be a mod, contains a file named `modpack.conf`. -The file is a key-value store of modpack details. - -* `name`: The modpack name. -* `description`: Description of mod to be shown in the Mods tab of the main - menu. - -Note: to support 0.4.x, please also create an empty modpack.txt file. +should be a mod, contains a file named `modpack.txt`. This file shall be +empty, except for lines starting with `#`, which are comments. Mod directory structure ------------------------ +------------------------ mods - ├── modname - │   ├── mod.conf - │   ├── screenshot.png - │   ├── settingtypes.txt - │   ├── init.lua - │   ├── models - │   ├── textures - │   │   ├── modname_stuff.png - │   │   └── modname_something_else.png - │   ├── sounds - │   ├── media - │   ├── locale - │   └── - └── another + |-- modname + | |-- depends.txt + | |-- screenshot.png + | |-- description.txt + | |-- settingtypes.txt + | |-- init.lua + | |-- models + | |-- textures + | | |-- modname_stuff.png + | | `-- modname_something_else.png + | |-- sounds + | |-- media + | `-- + `-- another + ### modname - The location of this directory can be fetched by using `minetest.get_modpath(modname)`. -### mod.conf - -A key-value store of mod details. - -* `name`: The mod name. Allows Minetest to determine the mod name even if the - folder is wrongly named. -* `description`: Description of mod to be shown in the Mods tab of the main - menu. -* `depends`: A comma separated list of dependencies. These are mods that must be - loaded before this mod. -* `optional_depends`: A comma separated list of optional dependencies. - Like a dependency, but no error if the mod doesn't exist. - -Note: to support 0.4.x, please also provide depends.txt. - -### `screenshot.png` - -A screenshot shown in the mod manager within the main menu. It should -have an aspect ratio of 3:2 and a minimum size of 300×200 pixels. - ### `depends.txt` - -**Deprecated:** you should use mod.conf instead. - -This file is used if there are no dependencies in mod.conf. - List of mods that have to be loaded before loading this mod. A single line contains a single modname. Optional dependencies can be defined by appending a question mark -to a single modname. This means that if the specified mod -is missing, it does not prevent this mod from being loaded. +to a single modname. Their meaning is that if the specified mod +is missing, that does not prevent this mod from being loaded. + +### `screenshot.png` +A screenshot shown in the mod manager within the main menu. It should +have an aspect ratio of 3:2 and a minimum size of 300×200 pixels. ### `description.txt` - -**Deprecated:** you should use mod.conf instead. - -This file is used if there is no description in mod.conf. - -A file containing a description to be shown in the Mods tab of the main menu. +A File containing description to be shown within mainmenu. ### `settingtypes.txt` - A file in the same format as the one in builtin. It will be parsed by the settings menu and the settings will be displayed in the "Mods" category. ### `init.lua` - The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the registered callbacks. `minetest.settings` can be used to read custom or existing settings at load -time, if necessary. (See [`Settings`]) +time, if necessary. (See `Settings`) ### `models` - Models for entities or meshnodes. ### `textures`, `sounds`, `media` - Media files (textures, sounds, whatever) that will be transferred to the client and will be available for use by the mod. -### `locale` - -Translation files for the clients. (See [Translations]) - -Naming conventions ------------------- - +Naming convention for registered textual names +---------------------------------------------- Registered names should generally be in this format: - modname: + `modname:` `` can have these characters: @@ -235,44 +195,38 @@ Registered names should generally be in this format: This is to prevent conflicting names from corrupting maps and is enforced by the mod loader. -Registered names can be overridden by prefixing the name with `:`. This can -be used for overriding the registrations of some other mod. - -The `:` prefix can also be used for maintaining backwards compatibility. - ### Example - In the mod `experimental`, there is the ideal item/node/entity name `tnt`. So the name should be `experimental:tnt`. -Any mod can redefine `experimental:tnt` by using the name +Enforcement can be overridden by prefixing the name with `:`. This can +be used for overriding the registrations of some other mod. + +Example: Any mod can redefine `experimental:tnt` by using the name :experimental:tnt -when registering it. That mod is required to have `experimental` as a -dependency. - - +when registering it. +(also that mod is required to have `experimental` as a dependency) +The `:` prefix can also be used for maintaining backwards compatibility. Aliases -======= +------- +Aliases can be added by using `minetest.register_alias(name, convert_to)` or +`minetest.register_alias_force(name, convert_to)`. -Aliases of itemnames can be added by using -`minetest.register_alias(alias, original_name)` or -`minetest.register_alias_force(alias, original_name)`. - -This adds an alias `alias` for the item called `original_name`. -From now on, you can use `alias` to refer to the item `original_name`. +This will make Minetest to convert things called name to things called +`convert_to`. The only difference between `minetest.register_alias` and -`minetest.register_alias_force` is that if an item named `alias` already exists, +`minetest.register_alias_force` is that if an item called `name` exists, `minetest.register_alias` will do nothing while `minetest.register_alias_force` will unregister it. This can be used for maintaining backwards compatibility. -This can also set quick access names for things, e.g. if +This can be also used for setting quick access names for things, e.g. if you have an item called `epiclylongmodname:stuff`, you could do minetest.register_alias("stuff", "epiclylongmodname:stuff") @@ -281,88 +235,75 @@ and be able to use `/giveme stuff`. Mapgen aliases -------------- - In a game, a certain number of these must be set to tell core mapgens which of the game's nodes are to be used by the core mapgens. For example: minetest.register_alias("mapgen_stone", "default:stone") -### Aliases needed for all mapgens except Mapgen V6 +### Aliases needed for all mapgens except Mapgen v6 -#### Base terrain +Base terrain: -* mapgen_stone -* mapgen_water_source -* mapgen_river_water_source +"mapgen_stone" +"mapgen_water_source" +"mapgen_river_water_source" -#### Caves +Caves: -Not required if cave liquid nodes are set in biome definitions. +"mapgen_lava_source" -* mapgen_lava_source +Dungeons: -#### Dungeons +Only needed for registered biomes where 'node_stone' is stone: +"mapgen_cobble" +"mapgen_stair_cobble" +"mapgen_mossycobble" +Only needed for registered biomes where 'node_stone' is desert stone: +"mapgen_desert_stone" +"mapgen_stair_desert_stone" +Only needed for registered biomes where 'node_stone' is sandstone: +"mapgen_sandstone" +"mapgen_sandstonebrick" +"mapgen_stair_sandstone_block" -Not required if dungeon nodes are set in biome definitions. +### Aliases needed for Mapgen v6 -* mapgen_cobble -* mapgen_stair_cobble -* mapgen_mossycobble -* mapgen_desert_stone -* mapgen_stair_desert_stone -* mapgen_sandstone -* mapgen_sandstonebrick -* mapgen_stair_sandstone_block +Terrain and biomes: -### Aliases needed for Mapgen V6 +"mapgen_stone" +"mapgen_water_source" +"mapgen_lava_source" +"mapgen_dirt" +"mapgen_dirt_with_grass" +"mapgen_sand" +"mapgen_gravel" +"mapgen_desert_stone" +"mapgen_desert_sand" +"mapgen_dirt_with_snow" +"mapgen_snowblock" +"mapgen_snow" +"mapgen_ice" -#### Terrain and biomes - -* mapgen_stone -* mapgen_water_source -* mapgen_lava_source -* mapgen_dirt -* mapgen_dirt_with_grass -* mapgen_sand -* mapgen_gravel -* mapgen_desert_stone -* mapgen_desert_sand -* mapgen_dirt_with_snow -* mapgen_snowblock -* mapgen_snow -* mapgen_ice - -#### Flora - -* mapgen_tree -* mapgen_leaves -* mapgen_apple -* mapgen_jungletree -* mapgen_jungleleaves -* mapgen_junglegrass -* mapgen_pine_tree -* mapgen_pine_needles - -#### Dungeons - -* mapgen_cobble -* mapgen_stair_cobble -* mapgen_mossycobble -* mapgen_stair_desert_stone - -### Setting the node used in Mapgen Singlenode - -By default the world is filled with air nodes. To set a different node use, for -example: - - minetest.register_alias("mapgen_singlenode", "default:stone") +Flora: +"mapgen_tree" +"mapgen_leaves" +"mapgen_apple" +"mapgen_jungletree" +"mapgen_jungleleaves" +"mapgen_junglegrass" +"mapgen_pine_tree" +"mapgen_pine_needles" +Dungeons: +"mapgen_cobble" +"mapgen_stair_cobble" +"mapgen_mossycobble" +"mapgen_stair_desert_stone" Textures -======== - +-------- Mods should generally prefix their textures with `modname_`, e.g. given the mod name `foomod`, a texture could be called: @@ -376,24 +317,21 @@ stripping out the file extension: Texture modifiers ----------------- - There are various texture modifiers that can be used to generate textures on-the-fly. ### Texture overlaying - Textures can be overlaid by putting a `^` between them. Example: default_dirt.png^default_grass_side.png -`default_grass_side.png` is overlaid over `default_dirt.png`. +`default_grass_side.png` is overlayed over `default_dirt.png`. The texture with the lower resolution will be automatically upscaled to the higher resolution texture. ### Texture grouping - Textures can be grouped together by enclosing them in `(` and `)`. Example: `cobble.png^(thing1.png^thing2.png)` @@ -402,7 +340,6 @@ A texture for `thing1.png^thing2.png` is created and the resulting texture is overlaid on top of `cobble.png`. ### Escaping - Modifiers that accept texture names (e.g. `[combine`) accept escaping to allow passing complex texture names as arguments. Escaping is done with backslash and is required for `^` and `:`. @@ -414,34 +351,22 @@ on top of `cobble.png`. ### Advanced texture modifiers -#### Crack - -* `[crack::

` -* `[cracko::

` -* `[crack:::

` -* `[cracko:::

` - -Parameters: - -* ``: tile count (in each direction) -* ``: animation frame count -* `

`: current animation frame +#### `[crack::

` +* `` = animation frame count +* `

` = current animation frame Draw a step of the crack animation on the texture. -`crack` draws it normally, while `cracko` lays it over, keeping transparent -pixels intact. Example: default_cobble.png^[crack:10:1 #### `[combine:x:,=:,=:...` - -* ``: width -* ``: height -* ``: x position -* ``: y position -* ``: texture to combine +* `` = width +* `` = height +* `` = x position +* `` = y position +* `` = texture to combine Creates a texture of size `` times `` and blits the listed files to their specified coordinates. @@ -451,7 +376,6 @@ Example: [combine:16x32:0,0=default_cobble.png:0,16=default_wood.png #### `[resize:x` - Resizes the texture to the given dimensions. Example: @@ -459,27 +383,25 @@ Example: default_sandstone.png^[resize:16x16 #### `[opacity:` - Makes the base image transparent according to the given ratio. -`r` must be between 0 (transparent) and 255 (opaque). +`r` must be between 0 and 255. +0 means totally transparent. 255 means totally opaque. Example: default_sandstone.png^[opacity:127 #### `[invert:` - Inverts the given channels of the base image. Mode may contain the characters "r", "g", "b", "a". Only the channels that are mentioned in the mode string will be inverted. Example: - default_apple.png^[invert:rgb + default_apple.png^[invert:rgb #### `[brighten` - Brightens the texture. Example: @@ -487,7 +409,6 @@ Example: tnt_tnt_side.png^[brighten #### `[noalpha` - Makes the texture completely opaque. Example: @@ -495,7 +416,6 @@ Example: default_leaves.png^[noalpha #### `[makealpha:,,` - Convert one color to transparency. Example: @@ -503,8 +423,7 @@ Example: default_cobble.png^[makealpha:128,128,128 #### `[transform` - -* ``: transformation(s) to apply +* `` = transformation(s) to apply Rotates and/or flips the image. @@ -525,9 +444,7 @@ Example: default_stone.png^[transformFXR90 #### `[inventorycube{{{` - -Escaping does not apply here and `^` is replaced by `&` in texture names -instead. +Escaping does not apply here and `^` is replaced by `&` in texture names instead. Create an inventory cube texture using the side textures. @@ -539,7 +456,6 @@ Creates an inventorycube with `grass.png`, `dirt.png^grass_side.png` and `dirt.png^grass_side.png` textures #### `[lowpart::` - Blit the lower ``% part of `` on the texture. Example: @@ -547,9 +463,8 @@ Example: base.png^[lowpart:25:overlay.png #### `[verticalframe::` - -* ``: animation frame count -* ``: current animation frame +* `` = animation frame count +* `` = current animation frame Crops the texture to a frame of a vertical animation. @@ -558,18 +473,16 @@ Example: default_torch_animated.png^[verticalframe:16:8 #### `[mask:` - Apply a mask to the base image. The mask is applied using binary AND. #### `[sheet:x:,` - Retrieves a tile at position x,y from the base image which it assumes to be a tilesheet with dimensions w,h. -#### `[colorize::` +#### `[colorize::` Colorize the textures with the given color. `` is specified as a `ColorString`. `` is an int ranging from 0 to 255 or the word "`alpha`". If @@ -581,16 +494,14 @@ the word "`alpha`", then each texture pixel will contain the RGB of texture pixel. #### `[multiply:` - Multiplies texture colors with the given color. `` is specified as a `ColorString`. Result is more like what you'd expect if you put a color on top of another -color, meaning white surfaces get a lot of your new color while black parts -don't change very much. +color. Meaning white surfaces get a lot of your new color while black parts don't +change very much. Hardware coloring ----------------- - The goal of hardware coloring is to simplify the creation of colorful nodes. If your textures use the same pattern, and they only differ in their color (like colored wool blocks), you can use hardware @@ -599,35 +510,30 @@ All of these methods use color multiplication (so a white-black texture with red coloring will result in red-black color). ### Static coloring - This method is useful if you wish to create nodes/items with the same texture, in different colors, each in a new node/item definition. #### Global color - When you register an item or node, set its `color` field (which accepts a `ColorSpec`) to the desired color. -An `ItemStack`'s static color can be overwritten by the `color` metadata +An `ItemStack`s static color can be overwritten by the `color` metadata field. If you set that field to a `ColorString`, that color will be used. #### Tile color - Each tile may have an individual static color, which overwrites every -other coloring method. To disable the coloring of a face, +other coloring methods. To disable the coloring of a face, set its color to white (because multiplying with white does nothing). You can set the `color` property of the tiles in the node's definition if the tile is in table format. ### Palettes - For nodes and items which can have many colors, a palette is more suitable. A palette is a texture, which can contain up to 256 pixels. Each pixel is one possible color for the node/item. You can register one node/item, which can have up to 256 colors. #### Palette indexing - When using palettes, you always provide a pixel index for the given node or `ItemStack`. The palette is read from left to right and from top to bottom. If the palette has less than 256 pixels, then it is @@ -635,20 +541,18 @@ stretched to contain exactly 256 pixels (after arranging the pixels to one line). The indexing starts from 0. Examples: - * 16x16 palette, index = 0: the top left corner * 16x16 palette, index = 4: the fifth pixel in the first row * 16x16 palette, index = 16: the pixel below the top left corner * 16x16 palette, index = 255: the bottom right corner -* 2 (width) x 4 (height) palette, index = 31: the top left corner. +* 2 (width)x4 (height) palette, index=31: the top left corner. The palette has 8 pixels, so each pixel is stretched to 32 pixels, to ensure the total 256 pixels. -* 2x4 palette, index = 32: the top right corner -* 2x4 palette, index = 63: the top right corner -* 2x4 palette, index = 64: the pixel below the top left corner +* 2x4 palette, index=32: the top right corner +* 2x4 palette, index=63: the top right corner +* 2x4 palette, index=64: the pixel below the top left corner #### Using palettes with items - When registering an item, set the item definition's `palette` field to a texture. You can also use texture modifiers. @@ -657,43 +561,40 @@ stack's metadata. `palette_index` is an integer, which specifies the index of the pixel to use. #### Linking palettes with nodes - When registering a node, set the item definition's `palette` field to a texture. You can also use texture modifiers. The node's color depends on its `param2`, so you also must set an -appropriate `paramtype2`: - -* `paramtype2 = "color"` for nodes which use their full `param2` for +appropriate `drawtype`: +* `drawtype = "color"` for nodes which use their full `param2` for palette indexing. These nodes can have 256 different colors. The palette should contain 256 pixels. -* `paramtype2 = "colorwallmounted"` for nodes which use the first +* `drawtype = "colorwallmounted"` for nodes which use the first five bits (most significant) of `param2` for palette indexing. The remaining three bits are describing rotation, as in `wallmounted` - paramtype2. Division by 8 yields the palette index (without stretching the + draw type. Division by 8 yields the palette index (without stretching the palette). These nodes can have 32 different colors, and the palette should contain 32 pixels. Examples: - * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) - pixel will be picked from the palette. - * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) - pixel will be picked from the palette. -* `paramtype2 = "colorfacedir"` for nodes which use the first + * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) + pixel will be picked from the palette. + * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) + pixel will be picked from the palette. +* `drawtype = "colorfacedir"` for nodes which use the first three bits of `param2` for palette indexing. The remaining - five bits are describing rotation, as in `facedir` paramtype2. + five bits are describing rotation, as in `facedir` draw type. Division by 32 yields the palette index (without stretching the palette). These nodes can have 8 different colors, and the palette should contain 8 pixels. Examples: - * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the - first (= 0 + 1) pixel will be picked from the palette. - * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the - second (= 1 + 1) pixel will be picked from the palette. + * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the + first (= 0 + 1) pixel will be picked from the palette. + * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the + second (= 1 + 1) pixel will be picked from the palette. To colorize a node on the map, set its `param2` value (according -to the node's paramtype2). - -### Conversion between nodes in the inventory and on the map +to the node's draw type). +### Conversion between nodes in the inventory and the on the map Static coloring is the same for both cases, there is no need for conversion. @@ -706,7 +607,6 @@ when a player digs or places a colored node. You can disable this feature by setting the `drop` field of the node to itself (without metadata). To transfer the color to a special drop, you need a drop table. - Example: minetest.register_node("mod:stone", { @@ -723,12 +623,13 @@ Example: }) ### Colored items in craft recipes - Craft recipes only support item strings, but fortunately item strings can also contain metadata. Example craft recipe registration: + local stack = ItemStack("wool:block") + dyed:get_meta():set_int("palette_index", 3) -- add index minetest.register_craft({ - output = minetest.itemstring_with_palette("wool:block", 3), + output = dyed:to_string(), -- convert to string type = "shapeless", recipe = { "wool:block", @@ -736,14 +637,11 @@ can also contain metadata. Example craft recipe registration: }, }) -To set the `color` field, you can use `minetest.itemstring_with_color`. - Metadata field filtering in the `recipe` field are not supported yet, so the craft output is independent of the color of the ingredients. Soft texture overlay -------------------- - Sometimes hardware coloring is not enough, because it affects the whole tile. Soft texture overlays were added to Minetest to allow the dynamic coloring of only specific parts of the node's texture. @@ -756,11 +654,7 @@ other. This allows different hardware coloring, but also means that tiles with overlays are drawn slower. Using too much overlays might cause FPS loss. -For inventory and wield images you can specify overlays which -hardware coloring does not modify. You have to set `inventory_overlay` -and `wield_overlay` fields to an image name. - -To define a node overlay, simply set the `overlay_tiles` field of the node +To define an overlay, simply set the `overlay_tiles` field of the node definition. These tiles are defined in the same way as plain tiles: they can have a texture name, color etc. To skip one face, set that overlay tile to an empty string. @@ -784,12 +678,8 @@ Example (colored grass block): palette = "default_foilage.png", }) - - - Sounds -====== - +------ Only Ogg Vorbis files are supported. For positional playing of sounds, only single-channel (mono) files are @@ -817,72 +707,108 @@ Examples of sound parameter tables: -- Play locationless on all clients { - gain = 1.0, -- default - fade = 0.0, -- default, change to a value > 0 to fade the sound in - pitch = 1.0, -- default + gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in } -- Play locationless to one player { to_player = name, - gain = 1.0, -- default - fade = 0.0, -- default, change to a value > 0 to fade the sound in - pitch = 1.0, -- default + gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in } -- Play locationless to one player, looped { to_player = name, - gain = 1.0, -- default + gain = 1.0, -- default loop = true, } -- Play in a location { pos = {x = 1, y = 2, z = 3}, - gain = 1.0, -- default - max_hear_distance = 32, -- default, uses an euclidean metric + gain = 1.0, -- default + max_hear_distance = 32, -- default, uses an euclidean metric } -- Play connected to an object, looped { object = , - gain = 1.0, -- default - max_hear_distance = 32, -- default, uses an euclidean metric + gain = 1.0, -- default + max_hear_distance = 32, -- default, uses an euclidean metric loop = true, } Looped sounds must either be connected to an object or played locationless to -one player using `to_player = name,`. - -A positional sound will only be heard by players that are within -`max_hear_distance` of the sound position, at the start of the sound. - -`SimpleSoundSpec` ------------------ +one player using `to_player = name,` +### `SimpleSoundSpec` * e.g. `""` * e.g. `"default_place_node"` * e.g. `{}` * e.g. `{name = "default_place_node"}` * e.g. `{name = "default_place_node", gain = 1.0}` -* e.g. `{name = "default_place_node", gain = 1.0, pitch = 1.0}` +Registered definitions of stuff +------------------------------- +Anything added using certain `minetest.register_*` functions get added to +the global `minetest.registered_*` tables. +* `minetest.register_entity(name, prototype table)` + * added to `minetest.registered_entities[name]` +* `minetest.register_node(name, node definition)` + * added to `minetest.registered_items[name]` + * added to `minetest.registered_nodes[name]` -Registered definitions -====================== +* `minetest.register_tool(name, item definition)` + * added to `minetest.registered_items[name]` -Anything added using certain [Registration functions] gets added to one or more -of the global [Registered definition tables]. +* `minetest.register_craftitem(name, item definition)` + * added to `minetest.registered_items[name]` + +* `minetest.unregister_item(name)` + * Unregisters the item name from engine, and deletes the entry with key + * `name` from `minetest.registered_items` and from the associated item + * table according to its nature: `minetest.registered_nodes[]` etc + +* `minetest.register_biome(biome definition)` + * returns an integer uniquely identifying the registered biome + * added to `minetest.registered_biome` with the key of `biome.name` + * if `biome.name` is nil, the key is the returned ID + +* `minetest.register_ore(ore definition)` + * returns an integer uniquely identifying the registered ore + * added to `minetest.registered_ores` with the key of `ore.name` + * if `ore.name` is nil, the key is the returned ID + +* `minetest.register_decoration(decoration definition)` + * returns an integer uniquely identifying the registered decoration + * added to `minetest.registered_decorations` with the key of `decoration.name` + * if `decoration.name` is nil, the key is the returned ID + +* `minetest.register_schematic(schematic definition)` + * returns an integer uniquely identifying the registered schematic + * added to `minetest.registered_schematic` with the key of `schematic.name` + * if `schematic.name` is nil, the key is the returned ID + * if the schematic is loaded from a file, schematic.name is set to the filename + * if the function is called when loading the mod, and schematic.name is a relative + path, then the current mod path will be prepended to the schematic filename + +* `minetest.clear_registered_biomes()` + * clears all biomes currently registered + +* `minetest.clear_registered_ores()` + * clears all ores currently registered + +* `minetest.clear_registered_decorations()` + * clears all decorations currently registered + +* `minetest.clear_registered_schematics()` + * clears all schematics currently registered Note that in some cases you will stumble upon things that are not contained in these tables (e.g. when a mod has been removed). Always check for existence before trying to access the fields. -Example: - -All nodes register with `minetest.register_node` get added to the table -`minetest.registered_nodes`. - -If you want to check the drawtype of a node, you could do: +Example: If you want to check the drawtype of a node, you could do: local function get_nodedef_field(nodename, fieldname) if not minetest.registered_nodes[nodename] then @@ -892,21 +818,27 @@ If you want to check the drawtype of a node, you could do: end local drawtype = get_nodedef_field(nodename, "drawtype") +Example: `minetest.get_item_group(name, group)` has been implemented as: - + function minetest.get_item_group(name, group) + if not minetest.registered_items[name] or not + minetest.registered_items[name].groups[group] then + return 0 + end + return minetest.registered_items[name].groups[group] + end Nodes -===== - +----- Nodes are the bulk data of the world: cubes and other things that take the space of a cube. Huge amounts of them are handled efficiently, but they are quite static. -The definition of a node is stored and can be accessed by using +The definition of a node is stored and can be accessed by name in minetest.registered_nodes[node.name] -See [Registered definitions]. +See "Registered definitions of stuff". Nodes are passed by value between Lua and the engine. They are represented by a table: @@ -917,196 +849,117 @@ They are represented by a table: them for certain automated functions. If you don't use these functions, you can use them to store arbitrary values. -Node paramtypes ---------------- - The functions of `param1` and `param2` are determined by certain fields in the -node definition. +node definition: `param1` is reserved for the engine when `paramtype != "none"`: -* `paramtype = "light"` - * The value stores light with and without sun in its upper and lower 4 bits - respectively. - * Required by a light source node to enable spreading its light. - * Required by the following drawtypes as they determine their visual - brightness from their internal light value: - * torchlike - * signlike - * firelike - * fencelike - * raillike - * nodebox - * mesh - * plantlike - * plantlike_rooted + paramtype = "light" + ^ The value stores light with and without sun in its upper and lower 4 bits + respectively. Allows light to propagate from or through the node with + light value falling by 1 per node. This is essential for a light source + node to spread its light. `param2` is reserved for the engine when any of these are used: -* `liquidtype = "flowing"` - * The level and some flags of the liquid is stored in `param2` -* `drawtype = "flowingliquid"` - * The drawn liquid level is read from `param2` -* `drawtype = "torchlike"` -* `drawtype = "signlike"` -* `paramtype2 = "wallmounted"` - * The rotation of the node is stored in `param2`. You can make this value - by using `minetest.dir_to_wallmounted()`. -* `paramtype2 = "facedir"` - * The rotation of the node is stored in `param2`. Furnaces and chests are - rotated this way. Can be made by using `minetest.dir_to_facedir()`. - * Values range 0 - 23 - * facedir / 4 = axis direction: - 0 = y+, 1 = z+, 2 = z-, 3 = x+, 4 = x-, 5 = y- - * facedir modulo 4 = rotation around that axis -* `paramtype2 = "leveled"` - * Only valid for "nodebox" with 'type = "leveled"', and "plantlike_rooted". - * Leveled nodebox: - * The level of the top face of the nodebox is stored in `param2`. - * The other faces are defined by 'fixed = {}' like 'type = "fixed"' - nodeboxes. - * The nodebox height is (`param2` / 64) nodes. - * The maximum accepted value of `param2` is 127. - * Rooted plantlike: - * The height of the 'plantlike' section is stored in `param2`. - * The height is (`param2` / 16) nodes. -* `paramtype2 = "degrotate"` - * Only valid for "plantlike". The rotation of the node is stored in - `param2`. - * Values range 0 - 179. The value stored in `param2` is multiplied by two to - get the actual rotation in degrees of the node. -* `paramtype2 = "meshoptions"` - * Only valid for "plantlike". The value of `param2` becomes a bitfield which - can be used to change how the client draws plantlike nodes. - * Bits 0, 1 and 2 form a mesh selector. - Currently the following meshes are choosable: - * 0 = a "x" shaped plant (ordinary plant) - * 1 = a "+" shaped plant (just rotated 45 degrees) - * 2 = a "*" shaped plant with 3 faces instead of 2 - * 3 = a "#" shaped plant with 4 faces instead of 2 - * 4 = a "#" shaped plant with 4 faces that lean outwards - * 5-7 are unused and reserved for future meshes. - * Bits 3 through 7 are optional flags that can be combined and give these + liquidtype == "flowing" + ^ The level and some flags of the liquid is stored in param2 + drawtype == "flowingliquid" + ^ The drawn liquid level is read from param2 + drawtype == "torchlike" + drawtype == "signlike" + paramtype2 == "wallmounted" + ^ The rotation of the node is stored in param2. You can make this value + by using minetest.dir_to_wallmounted(). + paramtype2 == "facedir" + ^ The rotation of the node is stored in param2. Furnaces and chests are + rotated this way. Can be made by using minetest.dir_to_facedir(). + Values range 0 - 23 + facedir / 4 = axis direction: + 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- + facedir modulo 4 = rotation around that axis + paramtype2 == "leveled" + ^ Only valid for "nodebox" with type = "leveled". + The level of the top face of the nodebox is stored in param2. + The other faces are defined by 'fixed = {}' like 'type = "fixed"' nodeboxes. + The nodebox height is param2 / 64 nodes. + The maximum accepted value of param2 is 127. + paramtype2 == "degrotate" + ^ The rotation of this node is stored in param2. Plants are rotated this way. + Values range 0 - 179. The value stored in param2 is multiplied by two to + get the actual rotation of the node. + paramtype2 == "meshoptions" + ^ Only valid for "plantlike". The value of param2 becomes a bitfield which can + be used to change how the client draws plantlike nodes. Bits 0, 1 and 2 form + a mesh selector. Currently the following meshes are choosable: + 0 = a "x" shaped plant (ordinary plant) + 1 = a "+" shaped plant (just rotated 45 degrees) + 2 = a "*" shaped plant with 3 faces instead of 2 + 3 = a "#" shaped plant with 4 faces instead of 2 + 4 = a "#" shaped plant with 4 faces that lean outwards + 5-7 are unused and reserved for future meshes. + Bits 3 through 7 are optional flags that can be combined and give these effects: - * bit 3 (0x08) - Makes the plant slightly vary placement horizontally - * bit 4 (0x10) - Makes the plant mesh 1.4x larger - * bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max) - * bits 6-7 are reserved for future use. -* `paramtype2 = "color"` - * `param2` tells which color is picked from the palette. + bit 3 (0x08) - Makes the plant slightly vary placement horizontally + bit 4 (0x10) - Makes the plant mesh 1.4x larger + bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max) + bits 6-7 are reserved for future use. + paramtype2 == "color" + ^ `param2` tells which color is picked from the palette. The palette should have 256 pixels. -* `paramtype2 = "colorfacedir"` - * Same as `facedir`, but with colors. - * The first three bits of `param2` tells which color is picked from the - palette. The palette should have 8 pixels. -* `paramtype2 = "colorwallmounted"` - * Same as `wallmounted`, but with colors. - * The first five bits of `param2` tells which color is picked from the - palette. The palette should have 32 pixels. -* `paramtype2 = "glasslikeliquidlevel"` - * Only valid for "glasslike_framed" or "glasslike_framed_optional" - drawtypes. - * `param2` values 0-63 define 64 levels of internal liquid, 0 being empty - and 63 being full. - * Liquid texture is defined using `special_tiles = {"modname_tilename.png"}` + paramtype2 == "colorfacedir" + ^ Same as `facedir`, but with colors. + The first three bits of `param2` tells which color + is picked from the palette. + The palette should have 8 pixels. + paramtype2 == "colorwallmounted" + ^ Same as `wallmounted`, but with colors. + The first five bits of `param2` tells which color + is picked from the palette. + The palette should have 32 pixels. + paramtype2 == "glasslikeliquidlevel" + ^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes. + param2 defines 64 levels of internal liquid. + Liquid texture is defined using `special_tiles = {"modname_tilename.png"},` -Nodes can also contain extra data. See [Node Metadata]. +Nodes can also contain extra data. See "Node Metadata". Node drawtypes --------------- - +--------------- There are a bunch of different looking node types. Look for examples in `games/minimal` or `games/minetest_game`. * `normal` - * A node-sized cube. * `airlike` - * Invisible, uses no texture. * `liquid` - * The cubic source node for a liquid. * `flowingliquid` - * The flowing version of a liquid, appears with various heights and slopes. * `glasslike` - * Often used for partially-transparent nodes. - * Only external sides of textures are visible. * `glasslike_framed` - * All face-connected nodes are drawn as one volume within a surrounding - frame. - * The frame appearance is generated from the edges of the first texture - specified in `tiles`. The width of the edges used are 1/16th of texture - size: 1 pixel for 16x16, 2 pixels for 32x32 etc. - * The glass 'shine' (or other desired detail) on each node face is supplied - by the second texture specified in `tiles`. * `glasslike_framed_optional` - * This switches between the above 2 drawtypes according to the menu setting - 'Connected Glass'. * `allfaces` - * Often used for partially-transparent nodes. - * External and internal sides of textures are visible. * `allfaces_optional` - * Often used for leaves nodes. - * This switches between `normal`, `glasslike` and `allfaces` according to - the menu setting: Opaque Leaves / Simple Leaves / Fancy Leaves. - * With 'Simple Leaves' selected, the texture specified in `special_tiles` - is used instead, if present. This allows a visually thicker texture to be - used to compensate for how `glasslike` reduces visual thickness. * `torchlike` - * A single vertical texture. - * If placed on top of a node, uses the first texture specified in `tiles`. - * If placed against the underside of a node, uses the second texture - specified in `tiles`. - * If placed on the side of a node, uses the third texture specified in - `tiles` and is perpendicular to that node. * `signlike` - * A single texture parallel to, and mounted against, the top, underside or - side of a node. * `plantlike` - * Two vertical and diagonal textures at right-angles to each other. - * See `paramtype2 = "meshoptions"` above for other options. * `firelike` - * When above a flat surface, appears as 6 textures, the central 2 as - `plantlike` plus 4 more surrounding those. - * If not above a surface the central 2 do not appear, but the texture - appears against the faces of surrounding nodes if they are present. * `fencelike` - * A 3D model suitable for a wooden fence. - * One placed node appears as a single vertical post. - * Adjacently-placed nodes cause horizontal bars to appear between them. * `raillike` - * Often used for tracks for mining carts. - * Requires 4 textures to be specified in `tiles`, in order: Straight, - curved, t-junction, crossing. - * Each placed node automatically switches to a suitable rotated texture - determined by the adjacent `raillike` nodes, in order to create a - continuous track network. - * Becomes a sloping node if placed against stepped nodes. -* `nodebox` - * Often used for stairs and slabs. - * Allows defining nodes consisting of an arbitrary number of boxes. - * See [Node boxes] below for more information. -* `mesh` - * Uses models for nodes. - * Tiles should hold model materials textures. - * Only static meshes are implemented. - * For supported model formats see Irrlicht engine documentation. -* `plantlike_rooted` - * Enables underwater `plantlike` without air bubbles around the nodes. - * Consists of a base cube at the co-ordinates of the node plus a - `plantlike` extension above with a height of `param2 / 16` nodes. - * The `plantlike` extension visually passes through any nodes above the - base cube without affecting them. - * The base cube texture tiles are defined as normal, the `plantlike` - extension uses the defined special tile, for example: - `special_tiles = {{name = "default_papyrus.png", tileable_vertical = true}},` +* `nodebox` -- See below. (**Experimental!**) +* `mesh` -- use models for nodes -`*_optional` drawtypes need less rendering time if deactivated -(always client-side). +`*_optional` drawtypes need less rendering time if deactivated (always client side). Node boxes ----------- +----------- +Node selection boxes are defined using "node boxes" -Node selection boxes are defined using "node boxes". +The `nodebox` node drawtype allows defining visual of nodes consisting of +arbitrary number of boxes. It allows defining stuff like stairs. Only the +`fixed` and `leveled` box type is supported for these. + +Please note that this is still experimental, and may be incompatibly +changed in the future. A nodebox is defined as any of: @@ -1115,18 +968,10 @@ A nodebox is defined as any of: type = "regular" } { - -- A fixed box (or boxes) (facedir param2 is used, if applicable) + -- A fixed box (facedir param2 is used, if applicable) type = "fixed", fixed = box OR {box1, box2, ...} } - { - -- A variable height box (or boxes) with the top face position defined - -- by the node parameter 'leveled = ', or if 'paramtype2 == "leveled"' - -- by param2. - -- Other faces are defined by 'fixed = {}' as with 'type = "fixed"'. - type = "leveled", - fixed = box OR {box1, box2, ...} - } { -- A box like the selection box for torches -- (wallmounted param2 is used, if applicable) @@ -1146,18 +991,6 @@ A nodebox is defined as any of: connect_left = box OR {box1, box2, ...} connect_back = box OR {box1, box2, ...} connect_right = box OR {box1, box2, ...} - -- The following `disconnected_*` boxes are the opposites of the - -- `connect_*` ones above, i.e. when a node has no suitable neighbour - -- on the respective side, the corresponding disconnected box is drawn. - disconnected_top = box OR {box1, box2, ...} - disconnected_bottom = box OR {box1, box2, ...} - disconnected_front = box OR {box1, box2, ...} - disconnected_left = box OR {box1, box2, ...} - disconnected_back = box OR {box1, box2, ...} - disconnected_right = box OR {box1, box2, ...} - disconnected = box OR {box1, box2, ...} -- when there is *no* neighbour - disconnected_sides = box OR {box1, box2, ...} -- when there are *no* - -- neighbours to the sides } A `box` is defined as: @@ -1168,19 +1001,251 @@ A box of a regular node would look like: {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +`type = "leveled"` is same as `type = "fixed"`, but `y2` will be automatically +set to level from `param2`. +Meshes +------ +If drawtype `mesh` is used, tiles should hold model materials textures. +Only static meshes are implemented. +For supported model formats see Irrlicht engine documentation. + + +Noise Parameters +---------------- +Noise Parameters, or commonly called "`NoiseParams`", define the properties of +perlin noise. + +### `offset` +Offset that the noise is translated by (i.e. added) after calculation. + +### `scale` +Factor that the noise is scaled by (i.e. multiplied) after calculation. + +### `spread` +Vector containing values by which each coordinate is divided by before calculation. +Higher spread values result in larger noise features. + +A value of `{x=250, y=250, z=250}` is common. + +### `seed` +Random seed for the noise. Add the world seed to a seed offset for world-unique noise. +In the case of `minetest.get_perlin()`, this value has the world seed automatically added. + +### `octaves` +Number of times the noise gradient is accumulated into the noise. + +Increase this number to increase the amount of detail in the resulting noise. + +A value of `6` is common. + +### `persistence` +Factor by which the effect of the noise gradient function changes with each successive octave. + +Values less than `1` make the details of successive octaves' noise diminish, while values +greater than `1` make successive octaves stronger. + +A value of `0.6` is common. + +### `lacunarity` +Factor by which the noise feature sizes change with each successive octave. + +A value of `2.0` is common. + +### `flags` +Leave this field unset for no special handling. + +Currently supported are `defaults`, `eased` and `absvalue`. + +#### `defaults` +Specify this if you would like to keep auto-selection of eased/not-eased while specifying +some other flags. + +#### `eased` +Maps noise gradient values onto a quintic S-curve before performing interpolation. +This results in smooth, rolling noise. Disable this (`noeased`) for sharp-looking noise. +If no flags are specified (or defaults is), 2D noise is eased and 3D noise is not eased. + +#### `absvalue` +Accumulates the absolute value of each noise gradient result. + +Noise parameters format example for 2D or 3D perlin noise or perlin noise maps: + + np_terrain = { + offset = 0, + scale = 1, + spread = {x=500, y=500, z=500}, + seed = 571347, + octaves = 5, + persist = 0.63, + lacunarity = 2.0, + flags = "defaults, absvalue" + } + ^ A single noise parameter table can be used to get 2D or 3D noise, + when getting 2D noise spread.z is ignored. + + +Ore types +--------- +These tell in what manner the ore is generated. + +All default ores are of the uniformly-distributed scatter type. + +### `scatter` +Randomly chooses a location and generates a cluster of ore. + +If `noise_params` is specified, the ore will be placed if the 3D perlin noise at +that point is greater than the `noise_threshold`, giving the ability to create +a non-equal distribution of ore. + +### `sheet` +Creates a sheet of ore in a blob shape according to the 2D perlin noise +described by `noise_params` and `noise_threshold`. This is essentially an +improved version of the so-called "stratus" ore seen in some unofficial mods. + +This sheet consists of vertical columns of uniform randomly distributed height, +varying between the inclusive range `column_height_min` and `column_height_max`. +If `column_height_min` is not specified, this parameter defaults to 1. +If `column_height_max` is not specified, this parameter defaults to `clust_size` +for reverse compatibility. New code should prefer `column_height_max`. + +The `column_midpoint_factor` parameter controls the position of the column at which +ore eminates from. If 1, columns grow upward. If 0, columns grow downward. If 0.5, +columns grow equally starting from each direction. `column_midpoint_factor` is a +decimal number ranging in value from 0 to 1. If this parameter is not specified, +the default is 0.5. + +The ore parameters `clust_scarcity` and `clust_num_ores` are ignored for this ore type. + +### `puff` +Creates a sheet of ore in a cloud-like puff shape. + +As with the `sheet` ore type, the size and shape of puffs are described by +`noise_params` and `noise_threshold` and are placed at random vertical positions +within the currently generated chunk. + +The vertical top and bottom displacement of each puff are determined by the noise +parameters `np_puff_top` and `np_puff_bottom`, respectively. + + +### `blob` +Creates a deformed sphere of ore according to 3d perlin noise described by +`noise_params`. The maximum size of the blob is `clust_size`, and +`clust_scarcity` has the same meaning as with the `scatter` type. + +### `vein` +Creates veins of ore varying in density by according to the intersection of two +instances of 3d perlin noise with diffferent seeds, both described by +`noise_params`. `random_factor` varies the influence random chance has on +placement of an ore inside the vein, which is `1` by default. Note that +modifying this parameter may require adjusting `noise_threshold`. +The parameters `clust_scarcity`, `clust_num_ores`, and `clust_size` are ignored +by this ore type. This ore type is difficult to control since it is sensitive +to small changes. The following is a decent set of parameters to work from: + + noise_params = { + offset = 0, + scale = 3, + spread = {x=200, y=200, z=200}, + seed = 5390, + octaves = 4, + persist = 0.5, + flags = "eased", + }, + noise_threshold = 1.6 + +**WARNING**: Use this ore type *very* sparingly since it is ~200x more +computationally expensive than any other ore. + +Ore attributes +-------------- +See section "Flag Specifier Format". + +Currently supported flags: +`absheight`, `puff_cliffs`, `puff_additive_composition`. + +### `absheight` +Also produce this same ore between the height range of `-y_max` and `-y_min`. + +Useful for having ore in sky realms without having to duplicate ore entries. + +### `puff_cliffs` +If set, puff ore generation will not taper down large differences in displacement +when approaching the edge of a puff. This flag has no effect for ore types other +than `puff`. + +### `puff_additive_composition` +By default, when noise described by `np_puff_top` or `np_puff_bottom` results in a +negative displacement, the sub-column at that point is not generated. With this +attribute set, puff ore generation will instead generate the absolute difference in +noise displacement values. This flag has no effect for ore types other than `puff`. + +Decoration types +---------------- +The varying types of decorations that can be placed. + +### `simple` +Creates a 1 times `H` times 1 column of a specified node (or a random node from +a list, if a decoration list is specified). Can specify a certain node it must +spawn next to, such as water or lava, for example. Can also generate a +decoration of random height between a specified lower and upper bound. +This type of decoration is intended for placement of grass, flowers, cacti, +papyri, waterlilies and so on. + +### `schematic` +Copies a box of `MapNodes` from a specified schematic file (or raw description). +Can specify a probability of a node randomly appearing when placed. +This decoration type is intended to be used for multi-node sized discrete +structures, such as trees, cave spikes, rocks, and so on. + + +Schematic specifier +-------------------- +A schematic specifier identifies a schematic by either a filename to a +Minetest Schematic file (`.mts`) or through raw data supplied through Lua, +in the form of a table. This table specifies the following fields: + +* The `size` field is a 3D vector containing the dimensions of the provided schematic. (required) +* The `yslice_prob` field is a table of {ypos, prob} which sets the `ypos`th vertical slice + of the schematic to have a `prob / 256 * 100` chance of occuring. (default: 255) +* The `data` field is a flat table of MapNode tables making up the schematic, + in the order of `[z [y [x]]]`. (required) + Each MapNode table contains: + * `name`: the name of the map node to place (required) + * `prob` (alias `param1`): the probability of this node being placed (default: 255) + * `param2`: the raw param2 value of the node being placed onto the map (default: 0) + * `force_place`: boolean representing if the node should forcibly overwrite any + previous contents (default: false) + +About probability values: + +* A probability value of `0` or `1` means that node will never appear (0% chance). +* A probability value of `254` or `255` means the node will always appear (100% chance). +* If the probability value `p` is greater than `1`, then there is a + `(p / 256 * 100)` percent chance that node will appear when the schematic is + placed on the map. + + +Schematic attributes +-------------------- +See section "Flag Specifier Format". + +Currently supported flags: `place_center_x`, `place_center_y`, `place_center_z`, + `force_placement`. + +* `place_center_x`: Placement of this decoration is centered along the X axis. +* `place_center_y`: Placement of this decoration is centered along the Y axis. +* `place_center_z`: Placement of this decoration is centered along the Z axis. +* `force_placement`: Schematic nodes other than "ignore" will replace existing nodes. -HUD -=== HUD element types ----------------- - The position field is used for all element types. -To account for differing resolutions, the position coordinates are the -percentage of the screen, ranging in value from `0` to `1`. +To account for differing resolutions, the position coordinates are the percentage +of the screen, ranging in value from `0` to `1`. The name field is not yet used, but should contain a description of what the HUD element represents. The direction field is the direction in which something @@ -1189,23 +1254,22 @@ is drawn. `0` draws from left to right, `1` draws from right to left, `2` draws from top to bottom, and `3` draws from bottom to top. -The `alignment` field specifies how the item will be aligned. It is a table -where `x` and `y` range from `-1` to `1`, with `0` being central. `-1` is -moved to the left/up, and `1` is to the right/down. Fractional values can be -used. +The `alignment` field specifies how the item will be aligned. It ranges from `-1` to `1`, +with `0` being the center, `-1` is moved to the left/up, and `1` is to the right/down. +Fractional values can be used. -The `offset` field specifies a pixel offset from the position. Contrary to -position, the offset is not scaled to screen size. This allows for some -precisely positioned items in the HUD. +The `offset` field specifies a pixel offset from the position. Contrary to position, +the offset is not scaled to screen size. This allows for some precisely-positioned +items in the HUD. -**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling -factor! +**Note**: `offset` _will_ adapt to screen DPI as well as user defined scaling factor! -Below are the specific uses for fields in each type; fields not listed for that -type are ignored. +Below are the specific uses for fields in each type; fields not listed for that type are ignored. + +**Note**: Future revisions to the HUD API may be incompatible; the HUD API is still +in the experimental stages. ### `image` - Displays an image on the HUD. * `scale`: The scale of the image, with 1 being the original texture size. @@ -1217,19 +1281,17 @@ Displays an image on the HUD. * `offset`: offset in pixels from position. ### `text` - Displays text on the HUD. * `scale`: Defines the bounding rectangle of the text. A value such as `{x=100, y=100}` should work. * `text`: The text to be displayed in the HUD element. -* `number`: An integer containing the RGB value of the color used to draw the - text. Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. +* `number`: An integer containing the RGB value of the color used to draw the text. + Specify `0xFFFFFF` for white text, `0xFF0000` for red, and so on. * `alignment`: The alignment of the text. * `offset`: offset in pixels from position. ### `statbar` - Displays a horizontal bar made up of half-images. * `text`: The name of the texture that is used. @@ -1237,11 +1299,9 @@ Displays a horizontal bar made up of half-images. If odd, will end with a vertically center-split texture. * `direction` * `offset`: offset in pixels from position. -* `size`: If used, will force full-image size to this value (override texture - pack image size) +* `size`: If used, will force full-image size to this value (override texture pack image size) ### `inventory` - * `text`: The name of the inventory list to be displayed. * `number`: Number of items in the inventory to be displayed. * `item`: Position of item that is selected. @@ -1249,55 +1309,31 @@ Displays a horizontal bar made up of half-images. * `offset`: offset in pixels from position. ### `waypoint` - Displays distance to selected world position. * `name`: The name of the waypoint. * `text`: Distance suffix. Can be blank. -* `number:` An integer containing the RGB value of the color used to draw the - text. +* `number:` An integer containing the RGB value of the color used to draw the text. * `world_pos`: World position of the waypoint. - - - Representations of simple things -================================ +-------------------------------- -Position/vector ---------------- +### Position/vector {x=num, y=num, z=num} -For helper functions see [Spatial Vectors]. - -`pointed_thing` ---------------- +For helper functions see "Vector helpers". +### `pointed_thing` * `{type="nothing"}` * `{type="node", under=pos, above=pos}` * `{type="object", ref=ObjectRef}` -Exact pointing location (currently only `Raycast` supports these fields): - -* `pointed_thing.intersection_point`: The absolute world coordinates of the - point on the selection box which is pointed at. May be in the selection box - if the pointer is in the box too. -* `pointed_thing.box_id`: The ID of the pointed selection box (counting starts - from 1). -* `pointed_thing.intersection_normal`: Unit vector, points outwards of the - selected selection box. This specifies which face is pointed at. - Is a null vector `{x = 0, y = 0, z = 0}` when the pointer is inside the - selection box. - - - - Flag Specifier Format -===================== - -Flags using the standardized flag specifier format can be specified in either -of two ways, by string or table. +--------------------- +Flags using the standardized flag specifier format can be specified in either of +two ways, by string or table. The string format is a comma-delimited set of flag names; whitespace and unrecognized flag fields are ignored. Specifying a flag in the string sets the @@ -1327,44 +1363,31 @@ or even since, by default, no schematic attributes are set. - - - Items -===== - -Item types ----------- +----- +### Item types There are three kinds of items: nodes, tools and craftitems. -* Node: Can be placed in the world's voxel grid -* Tool: Has a wear property but cannot be stacked. The default use action is to - dig nodes or hit objects according to its tool capabilities. -* Craftitem: Cannot dig nodes or be placed +* Node (`register_node`): A node from the world. +* Tool (`register_tool`): A tool/weapon that can dig and damage + things according to `tool_capabilities`. +* Craftitem (`register_craftitem`): A miscellaneous item. -Amount and wear ---------------- - -All item stacks have an amount between 0 and 65535. It is 1 by +### Amount and wear +All item stacks have an amount between 0 to 65535. It is 1 by default. Tool item stacks can not have an amount greater than 1. -Tools use a wear (damage) value ranging from 0 to 65535. The -value 0 is the default and is used for unworn tools. The values +Tools use a wear (=damage) value ranging from 0 to 65535. The +value 0 is the default and used is for unworn tools. The values 1 to 65535 are used for worn tools, where a higher value stands for a higher wear. Non-tools always have a wear value of 0. -Item formats ------------- - +### Item formats Items and item stacks can exist in three formats: Serializes, table format and `ItemStack`. -When an item must be passed to a function, it can usually be in any of -these formats. - -### Serialized - +#### Serialized This is called "stackstring" or "itemstring". It is a simple string with 1-3 components: the full item identifier, an optional amount and an optional wear value. Syntax: @@ -1378,8 +1401,7 @@ Examples: * `'default:pick_stone'`: a new stone pickaxe * `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out -### Table format - +#### Table format Examples: 5 dirt nodes: @@ -1394,33 +1416,30 @@ An apple: {name="default:apple", count=1, wear=0, metadata=""} -### `ItemStack` - +#### `ItemStack` A native C++ format with many helper methods. Useful for converting -between formats. See the [Class reference] section for details. - +between formats. See the Class reference section for details. +When an item must be passed to a function, it can usually be in any of +these formats. Groups -====== - +------ In a number of places, there is a group table. Groups define the properties of a thing (item, node, armor of entity, capabilities of tool) in such a way that the engine and other mods can can interact with the thing without actually knowing what the thing is. -Usage ------ - +### Usage Groups are stored in a table, having the group names with keys and the group ratings as values. For example: - -- Default dirt groups = {crumbly=3, soil=1} + -- ^ Default dirt - -- A more special dirt-kind of thing groups = {crumbly=2, soil=1, level=2, outerspace=1} + -- ^ A more special dirt-kind of thing Groups always have a rating associated with them. If there is no useful meaning for a rating for an enabled group, it shall be `1`. @@ -1432,36 +1451,26 @@ You can read the rating of a group for an item or a node by using minetest.get_item_group(itemname, groupname) -Groups of items ---------------- - +### Groups of items Groups of items can define what kind of an item it is (e.g. wool). -Groups of nodes ---------------- - +### Groups of nodes In addition to the general item things, groups are used to define whether a node is destroyable and how long it takes to destroy by a tool. -Groups of entities ------------------- - +### Groups of entities For entities, groups are, as of now, used only for calculating damage. The rating is the percentage of damage caused by tools with this damage group. -See [Entity damage mechanism]. +See "Entity damage mechanism". object.get_armor_groups() --> a group-rating table (e.g. {fleshy=100}) object.set_armor_groups({fleshy=30, cracky=80}) -Groups of tools ---------------- - +### Groups of tools Groups in tools define which groups of nodes and entities they are effective towards. -Groups in crafting recipes --------------------------- - +### Groups in crafting recipes An example: Make meat soup from any meat, any water and any bowl: { @@ -1482,9 +1491,7 @@ Another example: Make red wool from white wool and red dye: recipe = {'wool:white', 'group:dye,basecolor_red'}, } -Special groups --------------- - +### Special groups * `immortal`: Disables the group damage system for an entity * `punch_operable`: For entities; disables the regular damage mechanism for players punching it by hand or a non-tool item, so that it can do something @@ -1495,7 +1502,7 @@ Special groups from destroyed nodes. * `0` is something that is directly accessible at the start of gameplay * There is no upper limit -* `dig_immediate`: Player can always pick up node without reducing tool wear +* `dig_immediate`: (player can always pick up node without reducing tool wear) * `2`: the node always gets the digging time 0.5 seconds (rail, sign) * `3`: the node always gets the digging time 0 seconds (torch) * `disable_jump`: Player (and possibly other things) cannot jump from node @@ -1505,16 +1512,16 @@ Special groups * `attached_node`: if the node under it is not a walkable block the node will be dropped as an item. If the node is wallmounted the wallmounted direction is checked. +* `soil`: saplings will grow on nodes in this group * `connect_to_raillike`: makes nodes of raillike drawtype with same group value connect to each other * `slippery`: Players and items will slide on the node. - Slipperiness rises steadily with `slippery` value, starting at 1. -* `disable_repair`: If set to 1 for a tool, it cannot be repaired using the - `"toolrepair"` crafting recipe - -Known damage and digging time defining groups ---------------------------------------------- + Only use `slippery = 3` for now to ensure forwards compatibility. + * `speed`: Changes movement speed for players and items will moving on the node in percents. + * `speed = -10`: to slow down the movement (min. -99%) + * `speed = 10`: to speed up the movement (max. 1000%) +### Known damage and digging time defining groups * `crumbly`: dirt, sand * `cracky`: tough but crackable stuff like stone. * `snappy`: something that can be cut using fine tools; e.g. leaves, small @@ -1530,9 +1537,7 @@ Known damage and digging time defining groups speed of a tool if the tool can dig at a faster speed than this suggests for the hand. -Examples of custom groups -------------------------- - +### Examples of custom groups Item groups are often used for defining, well, _groups of items_. * `meat`: any meat-kind of a thing (rating might define the size or healing @@ -1546,9 +1551,7 @@ Item groups are often used for defining, well, _groups of items_. * `weapon`: any weapon * `heavy`: anything considerably heavy -Digging time calculation specifics ----------------------------------- - +### Digging time calculation specifics Groups such as `crumbly`, `cracky` and `snappy` are used for this purpose. Rating is `1`, `2` or `3`. A higher rating for such a group implies faster digging time. @@ -1563,15 +1566,7 @@ Tools define their properties by a list of parameters for groups. They cannot dig other groups; thus it is important to use a standard bunch of groups to enable interaction with tools. - - - -Tools -===== - -Tools definition ----------------- - +#### Tools definition Tools define: * Full punch interval @@ -1582,22 +1577,19 @@ Tools define: * Digging times * Damage groups -### Full punch interval - +#### Full punch interval When used as a weapon, the tool will do full damage if this time is spent between punches. If e.g. half the time is spent, the tool will do half damage. -### Maximum drop level - +#### Maximum drop level Suggests the maximum level of node, when dug with the tool, that will drop it's useful item. (e.g. iron ore to drop a lump of iron). This is not automated; it is the responsibility of the node definition to implement this. -### Uses - +#### Uses Determines how many uses the tool has when it is used for digging a node, of this group, of the maximum level. For lower leveled nodes, the use count is multiplied by `3^leveldiff`. @@ -1606,13 +1598,11 @@ is multiplied by `3^leveldiff`. * `uses=10, leveldiff=1`: actual uses: 30 * `uses=10, leveldiff=2`: actual uses: 90 -### Maximum level - +#### Maximum level Tells what is the maximum level of a node of this group that the tool will be able to dig. -### Digging times - +#### Digging times List of digging times for different ratings of the group, for nodes of the maximum level. @@ -1625,12 +1615,10 @@ If the result digging time is 0, a delay of 0.15 seconds is added between digging nodes; If the player releases LMB after digging, this delay is set to 0, i.e. players can more quickly click the nodes away instead of holding LMB. -### Damage groups +#### Damage groups +List of damage for groups of entities. See "Entity damage mechanism". -List of damage for groups of entities. See [Entity damage mechanism]. - -Example definition of the capabilities of a tool ------------------------------------------------- +#### Example definition of the capabilities of a tool tool_capabilities = { full_punch_interval=1.5, @@ -1670,18 +1658,14 @@ Table of resulting tool uses: easy nodes to be quickly breakable. * At `level > 2`, the node is not diggable, because it's `level > maxlevel` - - - Entity damage mechanism -======================= - +----------------------- Damage calculation: damage = 0 foreach group in cap.damage_groups: - damage += cap.damage_groups[group] - * limit(actual_interval / cap.full_punch_interval, 0.0, 1.0) + damage += cap.damage_groups[group] * limit(actual_interval / + cap.full_punch_interval, 0.0, 1.0) * (object.armor_groups[group] / 100.0) -- Where object.armor_groups[group] is 0 for inexistent values return damage @@ -1700,8 +1684,7 @@ a non-tool item, so that it can do something else than take damage. On the Lua side, every punch calls: - entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, - damage) + entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage) This should never be called directly, because damage is usually not handled by the entity itself. @@ -1713,30 +1696,23 @@ the entity itself. * `direction` is a unit vector, pointing from the source of the punch to the punched object. * `damage` damage that will be done to entity -Return value of this function will determine if damage is done by this function +Return value of this function will determin if damage is done by this function (retval true) or shall be done by engine (retval false) To punch an entity/object in Lua, call: - object:punch(puncher, time_from_last_punch, tool_capabilities, direction) + object:punch(puncher, time_from_last_punch, tool_capabilities, direction) * Return value is tool wear. * Parameters are equal to the above callback. -* If `direction` equals `nil` and `puncher` does not equal `nil`, `direction` - will be automatically filled in based on the location of `puncher`. - - - - -Metadata -======== +* If `direction` equals `nil` and `puncher` does not equal `nil`, + `direction` will be automatically filled in based on the location of `puncher`. Node Metadata ------------- - The instance of a node in the world normally only contains the three values -mentioned in [Nodes]. However, it is possible to insert extra data into a node. -It is called "node metadata"; See `NodeMetaRef`. +mentioned in "Nodes". However, it is possible to insert extra data into a +node. It is called "node metadata"; See `NodeMetaRef`. Node metadata contains two things: @@ -1745,10 +1721,10 @@ Node metadata contains two things: Some of the values in the key-value store are handled specially: -* `formspec`: Defines a right-click inventory menu. See [Formspec]. +* `formspec`: Defines a right-click inventory menu. See "Formspec". * `infotext`: Text shown on the screen when the node is pointed at -Example: +Example stuff: local meta = minetest.get_meta(pos) meta:set_string("formspec", @@ -1778,69 +1754,40 @@ Example: Item Metadata ------------- - -Item stacks can store metadata too. See [`ItemStackMetaRef`]. +Item stacks can store metadata too. See `ItemStackMetaRef`. Item metadata only contains a key-value store. Some of the values in the key-value store are handled specially: -* `description`: Set the item stack's description. Defaults to - `idef.description`. +* `description`: Set the item stack's description. Defaults to `idef.description` * `color`: A `ColorString`, which sets the stack's color. * `palette_index`: If the item has a palette, this is used to get the - current color from the palette. + current color from the palette. -Example: +Example stuff: local meta = stack:get_meta() meta:set_string("key", "value") print(dump(meta:to_table())) - - - Formspec -======== - -Formspec defines a menu. This supports inventories and some of the -typical widgets like buttons, checkboxes, text input fields, etc. -It is a string, with a somewhat strange format. - -A formspec is made out of formspec elements, which includes widgets -like buttons but also can be used to set stuff like background color. - -Many formspec elements have a `name`, which is a unique identifier which -is used when the server receives user input. You must not use the name -"quit" for formspec elements. +-------- +Formspec defines a menu. Currently not much else than inventories are +supported. It is a string, with a somewhat strange format. Spaces and newlines can be inserted between the blocks, as is used in the examples. -Position and size units are inventory slots, `X` and `Y` position the formspec -element relative to the top left of the menu or container. `W` and `H` are its -width and height values. -Inventories with a `player:` inventory location are only sent to the -player named ``. +### Examples -When displaying text which can contain formspec code, e.g. text set by a player, -use `minetest.formspec_escape`. -For coloured text you can use `minetest.colorize`. - -WARNING: Minetest allows you to add elements to every single formspec instance -using `player:set_formspec_prepend()`, which may be the reason backgrounds are -appearing when you don't expect them to. See [`no_prepend[]`]. - -Examples --------- - -### Chest +#### Chest size[8,9] list[context;main;0,0;8,4;] list[current_player;main;0,5;8,4;] -### Furnace +#### Furnace size[8,9] list[context;fuel;2,3;1,1;] @@ -1848,7 +1795,7 @@ Examples list[context;dst;5,1;2,2;] list[current_player;main;0,5;8,4;] -### Minecraft-like player inventory +#### Minecraft-like player inventory size[8,7.5] image[1,0.6;1,2;player.png] @@ -1856,337 +1803,284 @@ Examples list[current_player;craft;3,0;3,3;] list[current_player;craftpreview;7,1;1,1;] -Elements --------- - -### `size[,,]` +### Elements +#### `size[,,]` * Define the size of the menu in inventory slots * `fixed_size`: `true`/`false` (optional) * deprecated: `invsize[,;]` -### `position[,]` +#### `position[,]` +* Define the position of the formspec +* A value between 0.0 and 1.0 represents a position inside the screen +* The default value is the center of the screen (0.5, 0.5) -* Must be used after `size` element. -* Defines the position on the game window of the formspec's `anchor` point. -* For X and Y, 0.0 and 1.0 represent opposite edges of the game window, - for example: - * [0.0, 0.0] sets the position to the top left corner of the game window. - * [1.0, 1.0] sets the position to the bottom right of the game window. -* Defaults to the center of the game window [0.5, 0.5]. +#### `anchor[,]` +* Define the anchor of the formspec +* A value between 0.0 and 1.0 represents an anchor inside the formspec +* The default value is the center of the formspec (0.5, 0.5) -### `anchor[,]` - -* Must be used after both `size` and `position` (if present) elements. -* Defines the location of the anchor point within the formspec. -* For X and Y, 0.0 and 1.0 represent opposite edges of the formspec, - for example: - * [0.0, 1.0] sets the anchor to the bottom left corner of the formspec. - * [1.0, 0.0] sets the anchor to the top right of the formspec. -* Defaults to the center of the formspec [0.5, 0.5]. - -* `position` and `anchor` elements need suitable values to avoid a formspec - extending off the game window due to particular game window sizes. - -### `no_prepend[]` - -* Must be used after the `size`, `position`, and `anchor` elements (if present). -* Disables player:set_formspec_prepend() from applying to this formspec. - -### `container[,]` - -* Start of a container block, moves all physical elements in the container by - (X, Y). +#### `container[,]` +* Start of a container block, moves all physical elements in the container by (X, Y) * Must have matching `container_end` * Containers can be nested, in which case the offsets are added (child containers are relative to parent containers) -### `container_end[]` +#### `container_end[]` +* End of a container, following elements are no longer relative to this container -* End of a container, following elements are no longer relative to this - container. +#### `list[;;,;,;]` +* Show an inventory list -### `list[;;,;,;]` - -* Show an inventory list if it has been sent to the client. Nothing will - be shown if the inventory list is of size 0. - -### `list[;;,;,;]` - -* Show an inventory list if it has been sent to the client. Nothing will - be shown if the inventory list is of size 0. - -### `listring[;]` +#### `list[;;,;,;]` +* Show an inventory list +#### `listring[;]` * Allows to create a ring of inventory lists * Shift-clicking on items in one element of the ring will send them to the next inventory list inside the ring * The first occurrence of an element inside the ring will determine the inventory where items will be sent to -### `listring[]` - +#### `listring[]` * Shorthand for doing `listring[;]` for the last two inventory lists added by list[...] -### `listcolors[;]` - +#### `listcolors[;]` * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering -### `listcolors[;;]` - +#### `listcolors[;;]` * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering * Sets color of slots border -### `listcolors[;;;;]` - +#### `listcolors[;;;;]` * Sets background color of slots as `ColorString` * Sets background color of slots on mouse hovering * Sets color of slots border * Sets default background color of tooltips * Sets default font color of tooltips -### `tooltip[;;;]` - +#### `tooltip[;;;]` * Adds tooltip for an element * `` tooltip background color as `ColorString` (optional) * `` tooltip font color as `ColorString` (optional) -### `tooltip[,;,;;;]` - -* Adds tooltip for an area. Other tooltips will take priority when present. -* `` tooltip background color as `ColorString` (optional) -* `` tooltip font color as `ColorString` (optional) - -### `image[,;,;]` - +#### `image[,;,;]` * Show an image +* Position and size units are inventory slots -### `item_image[,;,;]` - +#### `item_image[,;,;]` * Show an inventory image of registered item/node +* Position and size units are inventory slots -### `bgcolor[;]` - +#### `bgcolor[;]` * Sets background color of formspec as `ColorString` -* If `true`, the background color is drawn fullscreen (does not affect the size - of the formspec). - -### `background[,;,;]` +* If `true`, the background color is drawn fullscreen (does not effect the size of the formspec) +#### `background[,;,;]` * Use a background. Inventory rectangles are not drawn then. +* Position and size units are inventory slots * Example for formspec 8x4 in 16x resolution: image shall be sized 8 times 16px times 4 times 16px. -### `background[,;,;;]` - +#### `background[,;,;;]` * Use a background. Inventory rectangles are not drawn then. +* Position and size units are inventory slots * Example for formspec 8x4 in 16x resolution: image shall be sized 8 times 16px times 4 times 16px -* If `auto_clip` is `true`, the background is clipped to the formspec size +* If `true` the background is clipped to formspec size (`x` and `y` are used as offset values, `w` and `h` are ignored) -### `pwdfield[,;,;;