diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..48f0b8d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,519 @@ +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 menu/header.png +Copyright (C) 2015 paramat CC 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 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..97ad70a --- /dev/null +++ b/README.txt @@ -0,0 +1,28 @@ +Minetest Game [minetest_game] +============================= +The main subgame for the Minetest engine +======================================== + +To use this subgame with the Minetest engine, insert this repository as + /games/minetest_game + +The Minetest engine can be found in: + https://github.com/minetest/minetest/ + +Compatibility +-------------- +The Minetest Game github master HEAD is generally compatible with the github +master HEAD of the Minetest engine. + +Additionally, when the Minetest engine is tagged to be a certain version (eg. +0.4.10), Minetest Game is tagged with the version too. + +When stable releases are made, Minetest Game is packaged and made available in + http://minetest.net/download +and in case the repository has grown too much, it may be reset. In that sense, +this is not a "real" git repository. (Package maintainers please note!) + +Licensing +--------- + +See LICENSE.txt diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..1d63f59 --- /dev/null +++ b/game.conf @@ -0,0 +1 @@ +name = Capitalism Game diff --git a/game_api.txt b/game_api.txt new file mode 100644 index 0000000..0d518f1 --- /dev/null +++ b/game_api.txt @@ -0,0 +1,852 @@ +Minetest Game API +================= +GitHub Repo: https://github.com/minetest/minetest_game + +Introduction +------------ + +The Minetest Game subgame offers multiple new possibilities in addition to the Minetest engine's built-in API, +allowing you to add new plants to farming mod, buckets for new liquids, new stairs and custom panes. +For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt +Please note: + + * [XYZ] refers to a section the Minetest API + * [#ABC] refers to a section in this document + * [pos] refers to a position table `{x = -5, y = 0, z = 200}` + +Bucket API +---------- + +The bucket API allows registering new types of buckets for non-default liquids. + + bucket.register_liquid( + "default:lava_source", -- name of the source node + "default:lava_flowing", -- name of the flowing node + "bucket:bucket_lava", -- name of the new bucket item (or nil if liquid is not takeable) + "bucket_lava.png", -- texture of the new bucket item (ignored if itemname == nil) + "Lava Bucket", -- text description of the bucket item + {lava_bucket = 1}, -- groups of the bucket item, OPTIONAL + false -- force-renew, OPTIONAL. Force the liquid source to renew if it has + -- a source neighbour, even if defined as 'liquid_renewable = false'. + -- Needed to avoid creating holes in sloping rivers. + ) + +The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source. +When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered. + +Beds API +-------- + + beds.register_bed( + "beds:bed", -- Bed name + def -- See [#Bed definition] + ) + + * `beds.read_spawns() ` Returns a table containing players respawn positions + * `beds.kick_players()` Forces all players to leave bed + * `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping + +### Bed definition + + { + description = "Simple Bed", + inventory_image = "beds_bed.png", + wield_image = "beds_bed.png", + tiles = { + bottom = {'Tile definition'}, -- the tiles of the bottom part of the bed. + top = {Tile definition} -- the tiles of the bottom part of the bed. + }, + nodebox = { + bottom = 'regular nodebox', -- bottom part of bed (see [Node boxes]) + top = 'regular nodebox', -- top part of bed (see [Node boxes]) + }, + selectionbox = 'regular nodebox', -- for both nodeboxes (see [Node boxes]) + recipe = { -- Craft recipe + {"group:wool", "group:wool", "group:wool"}, + {"group:wood", "group:wood", "group:wood"} + } + } + +Creative API +------------ + +Use `creative.register_tab(name, title, items)` to add a tab with filtered items. +For example, + + creative.register_tab("tools", "Tools", minetest.registered_tools) + +is used to show all tools. Name is used in the sfinv page name, title is the +human readable title. + +`is_enabled_for` is used to check whether a player is in creative mode: + + creative.is_enabled_for(name) + +Override this to allow per-player game modes. + +The contents of `creative.formspec_add` is appended to every creative inventory +page. Mods can use it to add additional formspec elements onto the default +creative inventory formspec to be drawn after each update. + +Doors API +--------- + +The doors mod allows modders to register custom doors and trapdoors. + +`doors.register_door(name, def)` + + * Registers new door + * `name` Name for door + * `def` See [#Door definition] + +`doors.register_trapdoor(name, def)` + + * Registers new trapdoor + * `name` Name for trapdoor + * `def` See [#Trapdoor definition] + +`doors.register_fencegate(name, def)` + + * Registers new fence gate + * `name` Name for fence gate + * `def` See [#Fence gate definition] + +`doors.get(pos)` + + * `pos` A position as a table, e.g `{x = 1, y = 1, z = 1}` + * Returns an ObjectRef to a door, or nil if the position does not contain a door + + ### Methods + + :open(player) -- Open the door object, returns if door was opened + :close(player) -- Close the door object, returns if door was closed + :toggle(player) -- Toggle the door state, returns if state was toggled + :state() -- returns the door state, true = open, false = closed + + the "player" parameter can be omitted in all methods. If passed then + the usual permission checks will be performed to make sure the player + has the permissions needed to open this door. If omitted then no + permission checks are performed. + +### Door definition + + description = "Door description", + inventory_image = "mod_door_inv.png", + groups = {choppy = 2}, + tiles = {"mod_door.png"}, -- UV map. + recipe = craftrecipe, + sounds = default.node_sound_wood_defaults(), -- optional + sound_open = sound play for open door, -- optional + sound_close = sound play for close door, -- optional + protected = false, -- If true, only placer can open the door (locked for others) + +### Trapdoor definition + + description = "Trapdoor description", + inventory_image = "mod_trapdoor_inv.png", + groups = {choppy = 2}, + tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor + tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor + sounds = default.node_sound_wood_defaults(), -- optional + sound_open = sound play for open door, -- optional + sound_close = sound play for close door, -- optional + protected = false, -- If true, only placer can open the door (locked for others) + +### Fence gate definition + + description = "Wooden Fence Gate", + texture = "default_wood.png", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults(), -- optional + +Fence API +--------- + +Allows creation of new fences with "fencelike" drawtype. + +`default.register_fence(name, item definition)` + + Registers a new fence. Custom fields texture and material are required, as + are name and description. The rest is optional. You can pass most normal + nodedef fields here except drawtype. The fence group will always be added + for this node. + +### fence definition + + name = "default:fence_wood", + description = "Wooden Fence", + texture = "default_wood.png", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + +Walls API +--------- + +The walls API allows easy addition of stone auto-connecting wall nodes. + +walls.register(name, desc, texture, mat, sounds) +^ name = "walls:stone_wall". Node name. +^ desc = "A Stone wall" +^ texture = "default_stone.png" +^ mat = "default:stone". Used to auto-generate crafting recipe. +^ sounds = sounds: see [#Default sounds] + +Farming API +----------- + +The farming API allows you to easily register plants and hoes. + +`farming.register_hoe(name, hoe definition)` + * Register a new hoe, see [#hoe definition] + +`farming.register_plant(name, Plant definition)` + * Register a new growing plant, see [#Plant definition] + +`farming.registered_plants[name] = definition` + * Table of registered plants, indexed by plant name + +### Hoe Definition + + + { + description = "", -- Description for tooltip + inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image + max_uses = 30, -- Uses until destroyed + material = "", -- Material for recipes + recipe = { -- Craft recipe, if material isn't used + {"air", "air", "air"}, + {"", "group:stick"}, + {"", "group:stick"}, + } + } + +### Plant definition + + { + description = "", -- Description of seed item + inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image + steps = 8, -- How many steps the plant has to grow, until it can be harvested + -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) + minlight = 13, -- Minimum light to grow + maxlight = default.LIGHT_MAX -- Maximum light to grow + } + +Fire API +-------- + +New node def property: + +`on_burn(pos)` + + * Called when fire attempts to remove a burning node. + * `pos` Position of the burning node. + + `on_ignite(pos, igniter)` + + * Called when Flint and steel (or a mod defined ignitor) is used on a node. + Defining it may prevent the default action (spawning flames) from triggering. + * `pos` Position of the ignited node. + * `igniter` Player that used the tool, when available. + + +Give Initial Stuff API +---------------------- + +`give_initial_stuff.give(player)` + +^ Give initial stuff to "player" + +`give_initial_stuff.add(stack)` + +^ Add item to the initial stuff +^ Stack can be an ItemStack or a item name eg: "default:dirt 99" +^ Can be called after the game has loaded + +`give_initial_stuff.clear()` + +^ Removes all items from the initial stuff +^ Can be called after the game has loaded + +`give_initial_stuff.get_list()` + +^ returns list of item stacks + +`give_initial_stuff.set_list(list)` + +^ List of initial items with numeric indices. + +`give_initial_stuff.add_from_csv(str)` + +^ str is a comma separated list of initial stuff +^ Adds items to the list of items to be given + +Nyancat API +----------- + +`nyancat.place(pos, facedir, length)` + +^ Place a cat at `pos` facing `facedir` with tail length `length` + Only accepts facedir 0-3, if facedir > 3 then it will be interpreted as facedir = 0 + +`nyancat.generate(minp, maxp, seed)` + +^ Called by `minetest.register_on_generated`. To disable nyancat generation, + you can redefine nyancat.generate() to be an empty function + +TNT API +---------- + +`tnt.register_tnt(definition)` + +^ Register a new type of tnt. + + * `name` The name of the node. If no prefix is given `tnt` is used. + * `description` A description for your TNT. + * `radius` The radius within which the TNT can destroy nodes. The default is 3. + * `damage_radius` The radius within which the TNT can damage players and mobs. By default it is twice the `radius`. + * `disable_drops` Disable drops. By default it is set to false. + * `ignore_protection` Don't check `minetest.is_protected` before removing a node. + * `ignore_on_blast` Don't call `on_blast` even if a node has one. + * `tiles` Textures for node + * `side` Side tiles. By default the name of the tnt with a suffix of `_side.png`. + * `top` Top tile. By default the name of the tnt with a suffix of `_top.png`. + * `bottom` Bottom tile. By default the name of the tnt with a suffix of `_bottom.png`. + * `burning` Top tile when lit. By default the name of the tnt with a suffix of `_top_burning_animated.png". + +`tnt.boom(position, definition)` + +^ Create an explosion. + +* `position` The center of explosion. +* `definition` The TNT definion as passed to `tnt.register` + +`tnt.burn(position, [nodename])` + +^ Ignite TNT at position, nodename isn't required unless already known. + + +To make dropping items from node inventories easier, you can use the +following helper function from 'default': + +default.get_inventory_drops(pos, inventory, drops) + +^ Return drops from node inventory "inventory" in drops. + +* `pos` - the node position +* `inventory` - the name of the inventory (string) +* `drops` - an initialized list + +The function returns no values. The drops are returned in the `drops` +parameter, and drops is not reinitialized so you can call it several +times in a row to add more inventory items to it. + + +`on_blast` callbacks: + +Both nodedefs and entitydefs can provide an `on_blast()` callback + +`nodedef.on_blast(pos, intensity)` +^ Allow drop and node removal overriding +* `pos` - node position +* `intensity` - TNT explosion measure. larger or equal to 1.0 +^ Should return a list of drops (e.g. {"default:stone"}) +^ Should perform node removal itself. If callback exists in the nodedef +^ then the TNT code will not destroy this node. + +`entitydef.on_blast(luaobj, damage)` +^ Allow TNT effects on entities to be overridden +* `luaobj` - LuaEntityRef of the entity +* `damage` - suggested HP damage value +^ Should return a list of (bool do_damage, bool do_knockback, table drops) +* `do_damage` - if true then TNT mod wil damage the entity +* `do_knockback` - if true then TNT mod will knock the entity away +* `drops` - a list of drops, e.g. {"wool:red"} + + +Screwdriver API +--------------- + +The screwdriver API allows you to control a node's behaviour when a screwdriver is used on it. +To use it, add the `on_screwdriver` function to the node definition. + +`on_rotate(pos, node, user, mode, new_param2)` + + * `pos` Position of the node that the screwdriver is being used on + * `node` that node + * `user` The player who used the screwdriver + * `mode` screwdriver.ROTATE_FACE or screwdriver.ROTATE_AXIS + * `new_param2` the new value of param2 that would have been set if on_rotate wasn't there + * return value: false to disallow rotation, nil to keep default behaviour, true to allow + it but to indicate that changed have already been made (so the screwdriver will wear out) + * use `on_rotate = false` to always disallow rotation + * use `on_rotate = screwdriver.rotate_simple` to allow only face rotation + + +Sethome API +----------- + +The sethome API adds three global functions to allow mods to read a players home position, +set a players home position and teleport a player to home position. + +`sethome.get(name)` + + * `name` Player who's home position you wish to get + * return value: false if no player home coords exist, position table if true + +`sethome.set(name, pos)` + + * `name` Player who's home position you wish to set + * `pos` Position table containing coords of home position + * return value: false if unable to set and save new home position, otherwise true + +`sethome.go(name)` + + * `name` Player you wish to teleport to their home position + * return value: false if player cannot be sent home, otherwise true + + +Sfinv API +--------- + +### sfinv Methods + +**Pages** + +* sfinv.set_page(player, pagename) - changes the page +* sfinv.get_homepage_name(player) - get the page name of the first page to show to a player +* sfinv.register_page(name, def) - register a page, see section below +* sfinv.override_page(name, def) - overrides fields of an page registered with register_page. + * Note: Page must already be defined, (opt)depend on the mod defining it. +* sfinv.set_player_inventory_formspec(player) - (re)builds page formspec + and calls set_inventory_formspec(). +* sfinv.get_formspec(player, context) - builds current page's formspec + +**Contexts** + +* sfinv.get_or_create_context(player) - gets the player's context +* sfinv.set_context(player, context) + +**Theming** + +* sfinv.make_formspec(player, context, content, show_inv, size) - adds a theme to a formspec + * show_inv, defaults to false. Whether to show the player's main inventory + * size, defaults to `size[8,8.6]` if not specified +* sfinv.get_nav_fs(player, context, nav, current_idx) - creates tabheader or "" + +### sfinv Members + +* pages - table of pages[pagename] = def +* pages_unordered - array table of pages in order of addition (used to build navigation tabs). +* contexts - contexts[playername] = player_context +* enabled - set to false to disable. Good for inventory rehaul mods like unified inventory + +### Context + +A table with these keys: + +* page - current page name +* nav - a list of page names +* nav_titles - a list of page titles +* nav_idx - current nav index (in nav and nav_titles) +* any thing you want to store + * sfinv will clear the stored data on log out / log in + +### sfinv.register_page + +sfinv.register_page(name, def) + +def is a table containing: + +* `title` - human readable page name (required) +* `get(self, player, context)` - returns a formspec string. See formspec variables. (required) +* `is_in_nav(self, player, context)` - return true to show in the navigation (the tab header, by default) +* `on_player_receive_fields(self, player, context, fields)` - on formspec submit. +* `on_enter(self, player, context)` - called when the player changes pages, usually using the tabs. +* `on_leave(self, player, context)` - when leaving this page to go to another, called before other's on_enter + +### get formspec + +Use sfinv.make_formspec to apply a layout: + + return sfinv.make_formspec(player, context, [[ + list[current_player;craft;1.75,0.5;3,3;] + list[current_player;craftpreview;5.75,1.5;1,1;] + image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270] + listring[current_player;main] + listring[current_player;craft] + image[0,4.25;1,1;gui_hb_bg.png] + image[1,4.25;1,1;gui_hb_bg.png] + image[2,4.25;1,1;gui_hb_bg.png] + image[3,4.25;1,1;gui_hb_bg.png] + image[4,4.25;1,1;gui_hb_bg.png] + image[5,4.25;1,1;gui_hb_bg.png] + image[6,4.25;1,1;gui_hb_bg.png] + image[7,4.25;1,1;gui_hb_bg.png] + ]], true) + +See above (methods section) for more options. + +### Customising themes + +Simply override this function to change the navigation: + + function sfinv.get_nav_fs(player, context, nav, current_idx) + return "navformspec" + end + +And override this function to change the layout: + + function sfinv.make_formspec(player, context, content, show_inv, size) + local tmp = { + size or "size[8,8.6]", + theme_main, + sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx), + content + } + if show_inv then + tmp[4] = theme_inv + end + return table.concat(tmp, "") + end + +Stairs API +---------- + +The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those +delivered with Minetest Game, to keep them compatible with other mods. + +`stairs.register_stair(subname, recipeitem, groups, images, description, sounds)` + + * Registers a stair. + * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" + * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil` + * `groups`: see [Known damage and digging time defining groups] + * `images`: see [Tile definition] + * `description`: used for the description field in the stair's definition + * `sounds`: see [#Default sounds] + +`stairs.register_slab(subname, recipeitem, groups, images, description, sounds)` + + * Registers a slabs + * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" + * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble" + * `groups`: see [Known damage and digging time defining groups] + * `images`: see [Tile definition] + * `description`: used for the description field in the stair's definition + * `sounds`: see [#Default sounds] + +`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)` + + * A wrapper for stairs.register_stair and stairs.register_slab + * Uses almost the same arguments as stairs.register_stair + * `desc_stair`: Description for stair node + * `desc_slab`: Description for slab node + +Xpanes API +---------- + +Creates panes that automatically connect to each other + +`xpanes.register_pane(subname, def)` + + * `subname`: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}" + * `def`: See [#Pane definition] + +### Pane definition + + { + textures = {"texture for sides", (unused), "texture for top and bottom"}, -- More tiles aren't supported + groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups] + sounds = SoundSpec, -- See [#Default sounds] + recipe = {{"","","","","","","","",""}}, -- Recipe field only + } + +Raillike definitions +-------------------- + +The following nodes use the group `connect_to_raillike` and will only connect to +raillike nodes within this group and the same group value. +Use `minetest.raillike_group()` to get the group value. + +| Node type | Raillike group name +|-----------------------|--------------------- +| default:rail | "rail" +| tnt:gunpowder | "gunpowder" +| tnt:gunpowder_burning | "gunpowder" + +Example: +If you want to add a new rail type and want it to connect with default:rail, +add `connect_to_raillike=minetest.raillike_group("rail")` into the `groups` table +of your node. + + +Default sounds +-------------- + +Sounds inside the default table can be used within the sounds field of node definitions. + + * `default.node_sound_defaults()` + * `default.node_sound_stone_defaults()` + * `default.node_sound_dirt_defaults()` + * `default.node_sound_sand_defaults()` + * `default.node_sound_wood_defaults()` + * `default.node_sound_leaves_defaults()` + * `default.node_sound_glass_defaults()` + * `default.node_sound_metal_defaults()` + +Default constants +----------------- + +`default.LIGHT_MAX` The maximum light level (see [Node definition] light_source) + +Player API +---------- + +The player API can register player models and update the player's appearence + +`default.player_register_model(name, def)` + + * Register a new model to be used by players. + * name: model filename such as "character.x", "foo.b3d", etc. + * def: See [#Model definition] + +`default.registered_player_models[name]` + + * Get a model's definition + * see [#Model definition] + +`default.player_set_model(player, model_name)` + + * Change a player's model + * `player`: PlayerRef + * `model_name`: model registered with player_register_model() + +`default.player_set_animation(player, anim_name [, speed])` + + * Applies an animation to a player + * anim_name: name of the animation. + * speed: frames per second. If nil, default from the model is used + +`default.player_set_textures(player, textures)` + + * Sets player textures + * `player`: PlayerRef + * `textures`: array of textures, If `textures` is nil, the default textures from the model def are used + +default.player_get_animation(player) + + * Returns a table containing fields `model`, `textures` and `animation`. + * Any of the fields of the returned table may be nil. + * player: PlayerRef + +### Model Definition + + { + animation_speed = 30, -- Default animation speed, in FPS. + textures = {"character.png", }, -- Default array of textures. + visual_size = {x = 1, y = 1}, -- Used to scale the model. + animations = { + -- = {x = , y = }, + foo = {x = 0, y = 19}, + bar = {x = 20, y = 39}, + -- ... + }, + } + +Leafdecay +--------- + +To enable leaf decay for a node, add it to the `leafdecay` group. + +The rating of the group determines how far from a node in the group `tree` +the node can be without decaying. + +If `param2` of the node is ~= 0, the node will always be preserved. Thus, if +the player places a node of that kind, you will want to set `param2 = 1` or so. + +The function `default.after_place_leaves` can be set as `after_place_node of a node` +to set param2 to 1 if the player places the node (should not be used for nodes +that use param2 otherwise (e.g. facedir)). + +If the node is in the `leafdecay_drop` group then it will always be dropped as an +item. + +Dyes +---- + +To make recipes that will work with any dye ever made by anybody, define +them based on groups. You can select any group of groups, based on your need for +amount of colors. + +### Color groups + +Base color groups: + + * `basecolor_white` + * `basecolor_grey` + * `basecolor_black` + * `basecolor_red` + * `basecolor_yellow` + * `basecolor_green` + * `basecolor_cyan` + * `basecolor_blue` + * `basecolor_magenta` + +Extended color groups ( * means also base color ) + + * `excolor_white` * + * `excolor_lightgrey` + * `excolor_grey` * + * `excolor_darkgrey` + * `excolor_black` * + * `excolor_red` * + * `excolor_orange` + * `excolor_yellow` * + * `excolor_lime` + * `excolor_green` * + * `excolor_aqua` + * `excolor_cyan` * + * `excolor_sky_blue` + * `excolor_blue` * + * `excolor_violet` + * `excolor_magenta` * + * `excolor_red_violet` + +The whole unifieddyes palette as groups: + + * `unicolor_` + +For the following, no white/grey/black is allowed: + + * `unicolor_medium_` + * `unicolor_dark_` + * `unicolor_light_` + * `unicolor__s50` + * `unicolor_medium__s50` + * `unicolor_dark__s50` + +Example of one shapeless recipe using a color group: + + minetest.register_craft({ + type = "shapeless", + output = ':item_yellow', + recipe = {':item_no_color', 'group:basecolor_yellow'}, + }) + +### Color lists + + * `dye.basecolors` are an array containing the names of available base colors + + * `dye.excolors` are an array containing the names of the available extended colors + +Trees +----- + + * `default.grow_tree(pos, is_apple_tree)` + * Grows a mgv6 tree or apple tree at pos + + * `default.grow_jungle_tree(pos)` + * Grows a mgv6 jungletree at pos + + * `default.grow_pine_tree(pos)` + * Grows a mgv6 pinetree at pos + + * `default.grow_new_apple_tree(pos)` + * Grows a new design apple tree at pos + + * `default.grow_new_jungle_tree(pos)` + * Grows a new design jungle tree at pos + + * `default.grow_new_pine_tree(pos)` + * Grows a new design pine tree at pos + + * `default.grow_new_acacia_tree(pos)` + * Grows a new design acacia tree at pos + + * `default.grow_new_aspen_tree(pos)` + * Grows a new design aspen tree at pos + + * `default.grow_new_snowy_pine_tree(pos)` + * Grows a new design snowy pine tree at pos + +Carts +----- + + carts.register_rail( + "mycarts:myrail", -- Rail name + nodedef, -- standard nodedef + railparams -- rail parameter struct (optional) + ) + + railparams = { + on_step(obj, dtime), -- Event handler called when + -- cart is on rail + acceleration, -- integer acceleration factor (negative + -- values to brake) + } + + The event handler is called after all default calculations + are made, so the custom on_step handler can override things + like speed, acceleration, player attachment. The handler will + likely be called many times per second, so the function needs + to make sure that the event is handled properly. + +Key API +------- + +The key API allows mods to add key functionality to nodes that have +ownership or specific permissions. Using the API will make it so +that a node owner can use skeleton keys on their nodes to create keys +for that node in that location, and give that key to other players, +allowing them some sort of access that they otherwise would not have +due to node protection. + +To make your new nodes work with the key API, you need to register +two callback functions in each nodedef: + + +`on_key_use(pos, player)` + * Is called when a player right-clicks (uses) a normal key on your + * node. + * `pos` - position of the node + * `player` - PlayerRef + * return value: none, ignored + +The `on_key_use` callback should validate that the player is wielding +a key item with the right key meta secret. If needed the code should +deny access to the node functionality. + +If formspecs are used, the formspec callbacks should duplicate these +checks in the metadata callback functions. + + +`on_skeleton_key_use(pos, player, newsecret)` + + * Is called when a player right-clicks (uses) a skeleton key on your + * node. + * `pos` - position of the node + * `player` - PlayerRef + * `newsecret` - a secret value(string) + * return values: + * `secret` - `nil` or the secret value that unlocks the door + * `name` - a string description of the node ("a locked chest") + * `owner` - name of the node owner + +The `on_skeleton_key_use` function should validate that the player has +the right permissions to make a new key for the item. The newsecret +value is useful if the node has no secret value. The function should +store this secret value somewhere so that in the future it may compare +key secrets and match them to allow access. If a node already has a +secret value, the function should return that secret value instead +of the newsecret value. The secret value stored for the node should +not be overwritten, as this would invalidate existing keys. + +Aside from the secret value, the function should retun a descriptive +name for the node and the owner name. The return values are all +encoded in the key that will be given to the player in replacement +for the wielded skeleton key. + +if `nil` is returned, it is assumed that the wielder did not have +permissions to create a key for this node, and no key is created. diff --git a/menu/header.png b/menu/header.png new file mode 100644 index 0000000..2ecda83 Binary files /dev/null and b/menu/header.png differ diff --git a/menu/icon.png b/menu/icon.png new file mode 100644 index 0000000..bf90c82 Binary files /dev/null and b/menu/icon.png differ diff --git a/modpack.txt b/minetest.conf similarity index 100% rename from modpack.txt rename to minetest.conf diff --git a/minetest.conf.example b/minetest.conf.example new file mode 100644 index 0000000..3f20eb7 --- /dev/null +++ b/minetest.conf.example @@ -0,0 +1,50 @@ +# This file contains settings of Minetest Game that can be changed in minetest.conf +# By default, all the settings are commented and not functional. +# Uncomment settings by removing the preceding #. + +# Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled +#creative_mode = false + +# Sets the behaviour of the inventory items when a player dies. +# "bones": Store all items inside a bone node but drop items if inside protected area +# "drop": Drop all items on the ground +# "keep": Player keeps all items +#bones_mode = "bones" + +# The time in seconds after which the bones of a dead player can be looted by everyone +# 0 to disable +#share_bones_time = 1200 + +# How much earlier the bones of a dead player can be looted by +# everyone if the player dies in a protected area they don't own. +# 0 to disable. By default it is "share_bones_time" divide by four. +#share_bones_time_early = 300 + +# Whether fire should be enabled. If disabled, 'basic flame' nodes will disappear. +# 'permanent flame' nodes will remain with either setting. +#enable_fire = true + +# Enable flame sound. +#flame_sound = true + +# Whether the stuff in initial_stuff should be given to new players +#give_initial_stuff = false +#initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 99,default:cobble 99 + +# Whether the TNT mod should be enabled +#enable_tnt = + +# The radius of a TNT explosion +#tnt_radius = 3 + +# Enable the stairs mod ABM that replaces the old 'upside down' +# stair and slab nodes in old maps with the new param2 versions. +#enable_stairs_replace_abm = false + +# Whether you allow respawning in beds +# Default value is true +#enable_bed_respawn = true + +# Whether players can skip night by sleeping +# Default value is true +#enable_bed_night_skip = true diff --git a/cash/api.lua b/mods/capitalism/cash/api.lua similarity index 100% rename from cash/api.lua rename to mods/capitalism/cash/api.lua diff --git a/cash/init.lua b/mods/capitalism/cash/init.lua similarity index 100% rename from cash/init.lua rename to mods/capitalism/cash/init.lua diff --git a/cash/items.lua b/mods/capitalism/cash/items.lua similarity index 100% rename from cash/items.lua rename to mods/capitalism/cash/items.lua diff --git a/cash/tests/api_spec.lua b/mods/capitalism/cash/tests/api_spec.lua similarity index 90% rename from cash/tests/api_spec.lua rename to mods/capitalism/cash/tests/api_spec.lua index a473afe..0aef800 100644 --- a/cash/tests/api_spec.lua +++ b/mods/capitalism/cash/tests/api_spec.lua @@ -1,5 +1,5 @@ -package.path = "cash/tests/?.lua;" .. -- tests root - "cash/?.lua;" .. -- mod root +package.path = "mods/capitalism/cash/tests/?.lua;" .. -- tests root + "mods/capitalism/cash/?.lua;" .. -- mod root package.path function _G.ItemStack(name) diff --git a/companies/init.lua b/mods/capitalism/companies/init.lua similarity index 100% rename from companies/init.lua rename to mods/capitalism/companies/init.lua diff --git a/mods/capitalism/modpack.txt b/mods/capitalism/modpack.txt new file mode 100644 index 0000000..e69de29 diff --git a/networks/depends.txt b/mods/capitalism/networks/depends.txt similarity index 100% rename from networks/depends.txt rename to mods/capitalism/networks/depends.txt diff --git a/networks/init.lua b/mods/capitalism/networks/init.lua similarity index 100% rename from networks/init.lua rename to mods/capitalism/networks/init.lua diff --git a/mods/creative/README.txt b/mods/creative/README.txt new file mode 100644 index 0000000..82357f3 --- /dev/null +++ b/mods/creative/README.txt @@ -0,0 +1,12 @@ +Minetest Game mod: creative +=========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Jean-Patrick G. (kilbith) (MIT) + +Author of media (textures) +-------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0) diff --git a/mods/creative/depends.txt b/mods/creative/depends.txt new file mode 100644 index 0000000..975e652 --- /dev/null +++ b/mods/creative/depends.txt @@ -0,0 +1,2 @@ +default +sfinv diff --git a/mods/creative/init.lua b/mods/creative/init.lua new file mode 100644 index 0000000..7471e60 --- /dev/null +++ b/mods/creative/init.lua @@ -0,0 +1,64 @@ +creative = {} + +local creative_mode_cache = minetest.setting_getbool("creative_mode") + +function creative.is_enabled_for(name) + return creative_mode_cache +end + +dofile(minetest.get_modpath("creative") .. "/inventory.lua") + +if minetest.setting_getbool("creative_mode") then + -- Dig time is modified according to difference (leveldiff) between tool + -- 'maxlevel' and node 'level'. Digtime is divided by the larger of + -- leveldiff and 1. + -- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been + -- increased such that nodes of differing levels have an insignificant + -- effect on digtime. + local digtime = 42 + local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256} + + minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x = 1, y = 1, z = 2.5}, + range = 10, + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level = 3, + groupcaps = { + crumbly = caps, + cracky = caps, + snappy = caps, + choppy = caps, + oddly_breakable_by_hand = caps, + }, + damage_groups = {fleshy = 10}, + } + }) +end + +-- Unlimited node placement +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + return creative.is_enabled_for(placer:get_player_name()) +end) + +-- Don't pick up if the item is already in the inventory +local old_handle_node_drops = minetest.handle_node_drops +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() then + return + end + if not creative.is_enabled_for(digger:get_player_name()) then + return old_handle_node_drops(pos, drops, digger) + end + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + item = ItemStack(item):get_name() + if not inv:contains_item("main", item) then + inv:add_item("main", item) + end + end + end +end diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua new file mode 100644 index 0000000..1363e29 --- /dev/null +++ b/mods/creative/inventory.lua @@ -0,0 +1,179 @@ +local player_inventory = {} + +function creative.init_creative_inventory(player) + local player_name = player:get_player_name() + player_inventory[player_name] = { + size = 0, + filter = "", + start_i = 0 + } + + minetest.create_detached_inventory("creative_" .. player_name, { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + if not to_list == "main" then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player2) + return 0 + end, + allow_take = function(inv, listname, index, stack, player2) + return -1 + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + end, + on_put = function(inv, listname, index, stack, player2) + end, + on_take = function(inv, listname, index, stack, player2) + if stack and stack:get_count() > 0 then + minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory") + end + end, + }, player_name) + + creative.update_creative_inventory(player_name, minetest.registered_items) +end + +function creative.update_creative_inventory(player_name, tab_content) + local creative_list = {} + local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) + local inv = player_inventory[player_name] + if not inv then + creative.init_creative_inventory(minetest.get_player_by_name(player_name)) + end + + for name, def in pairs(tab_content) do + if not (def.groups.not_in_creative_inventory == 1) and + def.description and def.description ~= "" and + (def.name:find(inv.filter, 1, true) or + def.description:lower():find(inv.filter, 1, true)) then + creative_list[#creative_list+1] = name + end + end + + table.sort(creative_list) + player_inv:set_size("main", #creative_list) + player_inv:set_list("main", creative_list) + inv.size = #creative_list +end + +-- Create the trash field +local trash = minetest.create_detached_inventory("creative_trash", { + -- Allow the stack to be placed and remove it in on_put() + -- This allows the creative inventory to restore the stack + allow_put = function(inv, listname, index, stack, player) + return stack:get_count() + end, + on_put = function(inv, listname) + inv:set_list(listname, {}) + end, +}) +trash:set_size("main", 1) + +creative.formspec_add = "" + +function creative.register_tab(name, title, items) + sfinv.register_page("creative:" .. name, { + title = title, + is_in_nav = function(self, player, context) + return creative.is_enabled_for(player:get_player_name()) + end, + get = function(self, player, context) + local player_name = player:get_player_name() + creative.update_creative_inventory(player_name, items) + local inv = player_inventory[player_name] + local start_i = inv.start_i or 0 + local pagenum = math.floor(start_i / (3*8) + 1) + local pagemax = math.ceil(inv.size / (3*8)) + return sfinv.make_formspec(player, context, + "label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. + [[ + image[4.06,3.4;0.8,0.8;creative_trash_icon.png] + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + list[detached:creative_trash;main;4,3.3;1,1;] + listring[] + button[5.4,3.2;0.8,0.9;creative_prev;<] + button[7.25,3.2;0.8,0.9;creative_next;>] + button[2.1,3.4;0.8,0.5;creative_search;?] + button[2.75,3.4;0.8,0.5;creative_clear;X] + tooltip[creative_search;Search] + tooltip[creative_clear;Reset] + listring[current_player;main] + field_close_on_enter[creative_filter;false] + ]] .. + "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. + "listring[detached:creative_" .. player_name .. ";main]" .. + "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. + default.get_hotbar_bg(0,4.7) .. + default.gui_bg .. default.gui_bg_img .. default.gui_slots + .. creative.formspec_add, false) + end, + on_enter = function(self, player, context) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + if inv then + inv.start_i = 0 + end + end, + on_player_receive_fields = function(self, player, context, fields) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + assert(inv) + + if fields.creative_clear then + inv.start_i = 0 + inv.filter = "" + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif fields.creative_search or + fields.key_enter_field == "creative_filter" then + inv.start_i = 0 + inv.filter = fields.creative_filter:lower() + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif not fields.quit then + local start_i = inv.start_i or 0 + + if fields.creative_prev then + start_i = start_i - 3*8 + if start_i < 0 then + start_i = inv.size - (inv.size % (3*8)) + if inv.size == start_i then + start_i = math.max(0, inv.size - (3*8)) + end + end + elseif fields.creative_next then + start_i = start_i + 3*8 + if start_i >= inv.size then + start_i = 0 + end + end + + inv.start_i = start_i + sfinv.set_player_inventory_formspec(player, context) + end + end + }) +end + +minetest.register_on_joinplayer(function(player) + creative.init_creative_inventory(player) +end) + +creative.register_tab("all", "All", minetest.registered_items) +creative.register_tab("nodes", "Nodes", minetest.registered_nodes) +creative.register_tab("tools", "Tools", minetest.registered_tools) +creative.register_tab("craftitems", "Items", minetest.registered_craftitems) + +local old_homepage_name = sfinv.get_homepage_name +function sfinv.get_homepage_name(player) + if creative.is_enabled_for(player:get_player_name()) then + return "creative:all" + else + return old_homepage_name(player) + end +end diff --git a/mods/creative/license.txt b/mods/creative/license.txt new file mode 100644 index 0000000..4ad1d5f --- /dev/null +++ b/mods/creative/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2016 Jean-Patrick G. (kilbith) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/creative/textures/creative_trash_icon.png b/mods/creative/textures/creative_trash_icon.png new file mode 100644 index 0000000..e789ad6 Binary files /dev/null and b/mods/creative/textures/creative_trash_icon.png differ diff --git a/mods/default/README.txt b/mods/default/README.txt new file mode 100644 index 0000000..d261b6b --- /dev/null +++ b/mods/default/README.txt @@ -0,0 +1,264 @@ +Minetest Game mod: default +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures, models and sounds) +---------------------------------------------- +Everything not listed in here: +celeron55, Perttu Ahola (CC BY-SA 3.0) + +Cisoun's texture pack (CC BY-SA 3.0): + default_jungletree.png + default_lava.png + default_leaves.png + default_sapling.png + default_stone.png + default_tree.png + default_tree_top.png + default_water.png + +Cisoun's conifers mod (CC BY-SA 3.0): + default_pine_needles.png + +Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0): + default_torch.png + default_torch_on_ceiling.png + default_torch_on_floor.png + +VanessaE's animated torches (CC BY-SA 3.0): + default_torch_animated.png + default_torch_on_ceiling_animated.png + default_torch_on_floor_animated.png + default_torch_on_floor.png + +RealBadAngel's animated water (CC BY-SA 3.0): + default_water_source_animated.png + default_water_flowing_animated.png + +VanessaE (CC BY-SA 3.0): + default_desert_sand.png + default_desert_stone.png + default_sand.png + default_mese_crystal.png + default_mese_crystal_fragment.png + +Calinou (CC BY-SA 3.0): + default_brick.png + default_papyrus.png + default_mineral_copper.png + default_glass_detail.png + +MirceaKitsune (CC BY-SA 3.0): + character.x + +Jordach (CC BY-SA 3.0): + character.png + +PilzAdam (CC BY-SA 3.0): + default_jungleleaves.png + default_junglesapling.png + default_obsidian_glass.png + default_obsidian_shard.png + default_mineral_gold.png + +jojoa1997 (CC BY-SA 3.0): + default_obsidian.png + +InfinityProject (CC BY-SA 3.0): + default_mineral_diamond.png + +Splizard (CC BY-SA 3.0): + default_pine_sapling.png + +Zeg9 (CC BY-SA 3.0): + default_coal_block.png + default_steel_block.png + default_copper_block.png + default_bronze_block.png + default_gold_block.png + +paramat (CC BY-SA 3.0): + wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0) + default_pinetree.png + default_pinetree_top.png + default_pinewood.png + default_acacia_leaves.png + default_acacia_leaves_simple.png + default_acacia_sapling.png + default_acacia_tree.png + default_acacia_tree_top.png + default_acacia_wood.png + default_acacia_bush_stem.png + default_bush_stem.png + default_junglewood.png + default_jungletree_top.png + default_sandstone_brick.png + default_obsidian_brick.png + default_stone_brick.png + default_desert_stone_brick.png + default_sandstone_block.png + default_obsidian_block.png + default_stone_block.png + default_desert_stone_block.png + default_river_water.png + default_river_water_source_animated.png + default_river_water_flowing_animated.png + default_dry_grass.png + default_dry_grass_side.png + default_dry_grass_*.png + default_grass.png + default_grass_side.png + default_mese_block.png + default_silver_sand.png + +brunob.santos (CC BY-SA 4.0): + default_desert_cobble.png + +BlockMen (CC BY-SA 3.0): + default_wood.png + default_clay_brick.png + default_iron_ingot.png + default_gold_ingot.png + default_tool_steelsword.png + default_diamond.png + default_book.png + default_tool_*.png + default_lava_source_animated.png + default_lava_flowing_animated.png + default_stick.png + default_chest_front.png + default_chest_lock.png + default_chest_side.png + default_chest_top.png + default_mineral_mese.png + default_meselamp.png + bubble.png + gui_*.png + +Wuzzy (CC BY-SA 3.0): + default_bookshelf_slot.png (based on default_book.png) + +sofar (CC BY-SA 3.0): + default_book_written.png, based on default_book.png + default_aspen_sapling + default_aspen_leaves + default_aspen_tree + default_aspen_tree_top, derived from default_pine_tree_top (by paramat) + default_aspen_wood, derived from default_pine_wood (by paramat) + default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel + +Neuromancer (CC BY-SA 2.0): + default_cobble.png, based on texture by Brane praefect + default_mossycobble.png, based on texture by Brane praefect + +Neuromancer (CC BY-SA 3.0): + default_dirt.png + default_furnace_*.png + +Gambit (CC BY-SA 3.0): + default_bronze_ingot.png + default_copper_ingot.png + default_copper_lump.png + default_iron_lump.png + default_gold_lump.png + default_clay_lump.png + default_coal.png + default_grass_*.png + default_paper.png + default_diamond_block.png + default_ladder_steel.png + default_sign_wall_wood.png + default_flint.png + default_snow.png + default_snow_side.png + default_snowball.png + default_key.png + default_key_skeleton.png + +asl97 (CC BY-SA 3.0): + default_ice.png + +KevDoy (CC BY-SA 3.0) + heart.png + +Pithydon (CC BY-SA 3.0) + default_coral_brown.png + default_coral_orange.png + default_coral_skeleton.png + +Ferk (CC0 1.0) + default_item_smoke.png + default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart + +Glass breaking sounds (CC BY 3.0): + 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ + 2: http://www.freesound.org/people/Tomlija/sounds/97669/ + 3: http://www.freesound.org/people/lsprice/sounds/88808/ + +sonictechtonic (CC BY 3.0): +https://www.freesound.org/people/sonictechtonic/sounds/241872/ + player_damage.ogg + +Mito551 (sounds) (CC BY-SA 3.0): + default_dig_choppy.ogg + default_dig_cracky.ogg + default_dig_crumbly.1.ogg + default_dig_crumbly.2.ogg + default_dig_dig_immediate.ogg + default_dig_oddly_breakable_by_hand.ogg + default_dug_node.1.ogg + default_dug_node.2.ogg + default_grass_footstep.1.ogg + default_grass_footstep.2.ogg + default_grass_footstep.3.ogg + default_gravel_footstep.1.ogg + default_gravel_footstep.2.ogg + default_gravel_footstep.3.ogg + default_gravel_footstep.4.ogg + default_grass_footstep.1.ogg + default_place_node.1.ogg + default_place_node.2.ogg + default_place_node.3.ogg + default_place_node_hard.1.ogg + default_place_node_hard.2.ogg + default_snow_footstep.1.ogg + default_snow_footstep.2.ogg + default_hard_footstep.1.ogg + default_hard_footstep.2.ogg + default_hard_footstep.3.ogg + default_sand_footstep.1.ogg + default_sand_footstep.2.ogg + default_wood_footstep.1.ogg + default_wood_footstep.2.ogg + default_dirt_footstep.1.ogg + default_dirt_footstep.2.ogg + default_glass_footstep.ogg + +Metal sounds: + default_dig_metal.ogg - yadronoff - CC-BY-3.0 + - https://www.freesound.org/people/yadronoff/sounds/320397/ + default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0 + - http://opengameart.org/users/qubodup + default_metal_footstep.*.ogg - Ottomaani138 - CC0 + - https://www.freesound.org/people/Ottomaani138/sounds/232692/ + default_place_node_metal.*.ogg - Ogrebane - CC0 + - http://opengameart.org/content/wood-and-metal-sound-effects-volume-2 + +Tool breaking sounds added by sofar: CC-BY-3.0 + default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/ + +AGFX (CC BY 3.0) +https://www.freesound.org/people/AGFX/packs/1253/ + default_water_footstep.1.ogg + default_water_footstep.2.ogg + default_water_footstep.3.ogg +(default_water_footstep.4.ogg is silent) + +blukotek (CC0 1.0) +https://www.freesound.org/people/blukotek/sounds/251660/ + default_dig_snappy.ogg diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua new file mode 100644 index 0000000..6db3fc8 --- /dev/null +++ b/mods/default/aliases.lua @@ -0,0 +1,77 @@ +-- mods/default/aliases.lua + +-- Aliases to support loading worlds using nodes following the old naming convention +-- These can also be helpful when using chat commands, for example /giveme +minetest.register_alias("stone", "default:stone") +minetest.register_alias("stone_with_coal", "default:stone_with_coal") +minetest.register_alias("stone_with_iron", "default:stone_with_iron") +minetest.register_alias("dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps") +minetest.register_alias("dirt", "default:dirt") +minetest.register_alias("sand", "default:sand") +minetest.register_alias("gravel", "default:gravel") +minetest.register_alias("sandstone", "default:sandstone") +minetest.register_alias("clay", "default:clay") +minetest.register_alias("brick", "default:brick") +minetest.register_alias("tree", "default:tree") +minetest.register_alias("jungletree", "default:jungletree") +minetest.register_alias("junglegrass", "default:junglegrass") +minetest.register_alias("leaves", "default:leaves") +minetest.register_alias("cactus", "default:cactus") +minetest.register_alias("papyrus", "default:papyrus") +minetest.register_alias("bookshelf", "default:bookshelf") +minetest.register_alias("glass", "default:glass") +minetest.register_alias("wooden_fence", "default:fence_wood") +minetest.register_alias("rail", "carts:rail") +minetest.register_alias("ladder", "default:ladder_wood") +minetest.register_alias("wood", "default:wood") +minetest.register_alias("mese", "default:mese") +minetest.register_alias("cloud", "default:cloud") +minetest.register_alias("water_flowing", "default:water_flowing") +minetest.register_alias("water_source", "default:water_source") +minetest.register_alias("lava_flowing", "default:lava_flowing") +minetest.register_alias("lava_source", "default:lava_source") +minetest.register_alias("torch", "default:torch") +minetest.register_alias("sign_wall", "default:sign_wall_wood") +minetest.register_alias("furnace", "default:furnace") +minetest.register_alias("chest", "default:chest") +minetest.register_alias("locked_chest", "default:chest_locked") +minetest.register_alias("cobble", "default:cobble") +minetest.register_alias("mossycobble", "default:mossycobble") +minetest.register_alias("steelblock", "default:steelblock") +minetest.register_alias("sapling", "default:sapling") +minetest.register_alias("apple", "default:apple") + +minetest.register_alias("WPick", "default:pick_wood") +minetest.register_alias("STPick", "default:pick_stone") +minetest.register_alias("SteelPick", "default:pick_steel") +minetest.register_alias("MesePick", "default:pick_mese") +minetest.register_alias("WShovel", "default:shovel_wood") +minetest.register_alias("STShovel", "default:shovel_stone") +minetest.register_alias("SteelShovel", "default:shovel_steel") +minetest.register_alias("WAxe", "default:axe_wood") +minetest.register_alias("STAxe", "default:axe_stone") +minetest.register_alias("SteelAxe", "default:axe_steel") +minetest.register_alias("WSword", "default:sword_wood") +minetest.register_alias("STSword", "default:sword_stone") +minetest.register_alias("SteelSword", "default:sword_steel") + +minetest.register_alias("Stick", "default:stick") +minetest.register_alias("paper", "default:paper") +minetest.register_alias("book", "default:book") +minetest.register_alias("lump_of_coal", "default:coal_lump") +minetest.register_alias("lump_of_iron", "default:iron_lump") +minetest.register_alias("lump_of_clay", "default:clay_lump") +minetest.register_alias("steel_ingot", "default:steel_ingot") +minetest.register_alias("clay_brick", "default:clay_brick") +minetest.register_alias("snow", "default:snow") + +-- 'mese_block' was used for a while for the block form of mese +minetest.register_alias("default:mese_block", "default:mese") + +-- Aliases for corrected pine node names +minetest.register_alias("default:pinetree", "default:pine_tree") +minetest.register_alias("default:pinewood", "default:pine_wood") + +minetest.register_alias("default:ladder", "default:ladder_wood") +minetest.register_alias("default:sign_wall", "default:sign_wall_wood") diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua new file mode 100644 index 0000000..f82b071 --- /dev/null +++ b/mods/default/crafting.lua @@ -0,0 +1,1119 @@ +-- mods/default/crafting.lua + +minetest.register_craft({ + output = 'default:wood 4', + recipe = { + {'default:tree'}, + } +}) + +minetest.register_craft({ + output = 'default:junglewood 4', + recipe = { + {'default:jungletree'}, + } +}) + +minetest.register_craft({ + output = 'default:pine_wood 4', + recipe = { + {'default:pine_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood 4', + recipe = { + {'default:acacia_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:aspen_wood 4', + recipe = { + {'default:aspen_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:wood', + recipe = { + {'default:bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood', + recipe = { + {'default:acacia_bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:stick 4', + recipe = { + {'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall_steel 3', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall_wood 3', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:torch 4', + recipe = { + {'default:coal_lump'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:pick_wood', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_stone', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_diamond', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_wood', + recipe = { + {'group:wood'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_stone', + recipe = { + {'group:stone'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_steel', + recipe = { + {'default:steel_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_bronze', + recipe = { + {'default:bronze_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_mese', + recipe = { + {'default:mese_crystal'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_diamond', + recipe = { + {'default:diamond'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:wood', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stone', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'default:diamond', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:stick', 'group:wood'}, + {'group:stick',''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stick', 'group:stone'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'group:stick', 'default:steel_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'group:stick', 'default:bronze_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'group:stick', 'default:mese_crystal'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'group:stick', 'default:diamond'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:sword_wood', + recipe = { + {'group:wood'}, + {'group:wood'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_stone', + recipe = { + {'group:stone'}, + {'group:stone'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_steel', + recipe = { + {'default:steel_ingot'}, + {'default:steel_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_bronze', + recipe = { + {'default:bronze_ingot'}, + {'default:bronze_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_mese', + recipe = { + {'default:mese_crystal'}, + {'default:mese_crystal'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_diamond', + recipe = { + {'default:diamond'}, + {'default:diamond'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:skeleton_key', + recipe = { + {'default:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:chest', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', '', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:chest_locked', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'default:steel_ingot', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft( { + type = "shapeless", + output = "default:chest_locked", + recipe = {"default:chest", "default:steel_ingot"}, +}) + +minetest.register_craft({ + output = 'default:furnace', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'group:stone', '', 'group:stone'}, + {'group:stone', 'group:stone', 'group:stone'}, + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "default:bronze_ingot", + recipe = {"default:steel_ingot", "default:copper_ingot"}, +}) + +minetest.register_craft({ + output = 'default:coalblock', + recipe = { + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:coal_lump 9', + recipe = { + {'default:coalblock'}, + } +}) + +minetest.register_craft({ + output = 'default:steelblock', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:steel_ingot 9', + recipe = { + {'default:steelblock'}, + } +}) + +minetest.register_craft({ + output = 'default:copperblock', + recipe = { + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:copper_ingot 9', + recipe = { + {'default:copperblock'}, + } +}) + +minetest.register_craft({ + output = 'default:bronzeblock', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:bronze_ingot 9', + recipe = { + {'default:bronzeblock'}, + } +}) + +minetest.register_craft({ + output = 'default:goldblock', + recipe = { + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:gold_ingot 9', + recipe = { + {'default:goldblock'}, + } +}) + +minetest.register_craft({ + output = 'default:diamondblock', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + } +}) + +minetest.register_craft({ + output = 'default:diamond 9', + recipe = { + {'default:diamondblock'}, + } +}) + +minetest.register_craft({ + output = "default:sandstone", + recipe = { + {"default:sand", "default:sand"}, + {"default:sand", "default:sand"}, + } +}) + +minetest.register_craft({ + output = 'default:sand 4', + recipe = { + {'default:sandstone'}, + } +}) + +minetest.register_craft({ + output = 'default:sandstonebrick 4', + recipe = { + {'default:sandstone', 'default:sandstone'}, + {'default:sandstone', 'default:sandstone'}, + } +}) + +minetest.register_craft({ + output = 'default:sandstone_block 9', + recipe = { + {'default:sandstone', 'default:sandstone', 'default:sandstone'}, + {'default:sandstone', 'default:sandstone', 'default:sandstone'}, + {'default:sandstone', 'default:sandstone', 'default:sandstone'}, + } +}) + +minetest.register_craft({ + output = 'default:clay', + recipe = { + {'default:clay_lump', 'default:clay_lump'}, + {'default:clay_lump', 'default:clay_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:clay_lump 4', + recipe = { + {'default:clay'}, + } +}) + +minetest.register_craft({ + output = 'default:brick', + recipe = { + {'default:clay_brick', 'default:clay_brick'}, + {'default:clay_brick', 'default:clay_brick'}, + } +}) + +minetest.register_craft({ + output = 'default:clay_brick 4', + recipe = { + {'default:brick'}, + } +}) + +minetest.register_craft({ + output = 'default:paper', + recipe = { + {'default:papyrus', 'default:papyrus', 'default:papyrus'}, + } +}) + +minetest.register_craft({ + output = 'default:book', + recipe = { + {'default:paper'}, + {'default:paper'}, + {'default:paper'}, + } +}) + +minetest.register_craft({ + output = 'default:bookshelf', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'default:book', 'default:book', 'default:book'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:ladder_wood 3', + recipe = { + {'group:stick', '', 'group:stick'}, + {'group:stick', 'group:stick', 'group:stick'}, + {'group:stick', '', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:ladder_steel 15', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal 9', + recipe = { + {'default:mese'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal_fragment 9', + recipe = { + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = "default:mese_crystal", + recipe = { + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + } +}) + +minetest.register_craft({ + output = 'default:meselamp', + recipe = { + {'default:glass'}, + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:obsidian_shard 9', + recipe = { + {'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:obsidian', + recipe = { + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + } +}) + +minetest.register_craft({ + output = 'default:obsidianbrick 4', + recipe = { + {'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:obsidian_block 9', + recipe = { + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + } +}) + +minetest.register_craft({ + output = 'default:stonebrick 4', + recipe = { + {'default:stone', 'default:stone'}, + {'default:stone', 'default:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:stone_block 9', + recipe = { + {'default:stone', 'default:stone', 'default:stone'}, + {'default:stone', 'default:stone', 'default:stone'}, + {'default:stone', 'default:stone', 'default:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:desert_stonebrick 4', + recipe = { + {'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone'}, + } +}) + +minetest.register_craft({ + output = 'default:desert_stone_block 9', + recipe = { + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + } +}) + +minetest.register_craft({ + output = 'default:snowblock', + recipe = { + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + } +}) + +minetest.register_craft({ + output = 'default:snow 9', + recipe = { + {'default:snowblock'}, + } +}) + +-- +-- Crafting (tool repair) +-- +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.02, +}) + +-- +-- Cooking recipes +-- + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "group:sand", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:obsidian_glass", + recipe = "default:obsidian_shard", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:mossycobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:desert_stone", + recipe = "default:desert_cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:steel_ingot", + recipe = "default:iron_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:copper_ingot", + recipe = "default:copper_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:gold_ingot", + recipe = "default:gold_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:clay_brick", + recipe = "default:clay_lump", +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:skeleton_key', + cooktime = 5, +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:key', + cooktime = 5, +}) + +-- +-- Fuels +-- + +-- Support use of group:tree +minetest.register_craft({ + type = "fuel", + recipe = "group:tree", + burntime = 30, +}) + +-- Burn time for all woods are in order of wood density, +-- which is also the order of wood colour darkness: +-- aspen, pine, apple, acacia, jungle + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_tree", + burntime = 22, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_tree", + burntime = 26, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:tree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_tree", + burntime = 34, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:jungletree", + burntime = 38, +}) + + +-- Support use of group:wood +minetest.register_craft({ + type = "fuel", + recipe = "group:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglewood", + burntime = 9, +}) + + +-- Support use of group:sapling +minetest.register_craft({ + type = "fuel", + recipe = "group:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_sapling", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_sapling", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_sapling", + burntime = 11, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglesapling", + burntime = 12, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_junglewood", + burntime = 9, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_stem", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_stem", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglegrass", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:leaves", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:cactus", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:papyrus", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bookshelf", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:ladder_wood", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:lava_source", + burntime = 60, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:torch", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sign_wall_wood", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest_locked", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:apple", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coal_lump", + burntime = 40, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coalblock", + burntime = 370, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:grass_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_grass_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:paper", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book_written", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_shrub", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:stick", + burntime = 1, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:pick_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:shovel_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:axe_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sword_wood", + burntime = 5, +}) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua new file mode 100644 index 0000000..0c51c71 --- /dev/null +++ b/mods/default/craftitems.lua @@ -0,0 +1,252 @@ +-- mods/default/craftitems.lua + +minetest.register_craftitem("default:stick", { + description = "Stick", + inventory_image = "default_stick.png", + groups = {stick = 1, flammable = 2}, +}) + +minetest.register_craftitem("default:paper", { + description = "Paper", + inventory_image = "default_paper.png", + groups = {flammable = 3}, +}) + +local lpp = 14 -- Lines per book's page +local function book_on_use(itemstack, user) + local player_name = user:get_player_name() + local data = minetest.deserialize(itemstack:get_metadata()) + local title, text, owner = "", "", player_name + local page, page_max, lines, string = 1, 1, {}, "" + + if data then + title = data.title + text = data.text + owner = data.owner + + for str in (text .. "\n"):gmatch("([^\n]*)[\n]") do + lines[#lines+1] = str + end + + if data.page then + page = data.page + page_max = data.page_max + + for i = ((lpp * page) - lpp) + 1, lpp * page do + if not lines[i] then break end + string = string .. lines[i] .. "\n" + end + end + end + + local formspec + if owner == player_name then + formspec = "size[8,8]" .. default.gui_bg .. + default.gui_bg_img .. + "field[0.5,1;7.5,0;title;Title:;" .. + minetest.formspec_escape(title) .. "]" .. + "textarea[0.5,1.5;7.5,7;text;Contents:;" .. + minetest.formspec_escape(text) .. "]" .. + "button_exit[2.5,7.5;3,1;save;Save]" + else + formspec = "size[8,8]" .. default.gui_bg .. + default.gui_bg_img .. + "label[0.5,0.5;by " .. owner .. "]" .. + "tablecolumns[color;text]" .. + "tableoptions[background=#00000000;highlight=#00000000;border=false]" .. + "table[0.4,0;7,0.5;title;#FFFF00," .. minetest.formspec_escape(title) .. "]" .. + "textarea[0.5,1.5;7.5,7;;" .. + minetest.formspec_escape(string ~= "" and string or text) .. ";]" .. + "button[2.4,7.6;0.8,0.8;book_prev;<]" .. + "label[3.2,7.7;Page " .. page .. " of " .. page_max .. "]" .. + "button[4.9,7.6;0.8,0.8;book_next;>]" + end + + minetest.show_formspec(player_name, "default:book", formspec) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "default:book" then return end + local inv = player:get_inventory() + local stack = player:get_wielded_item() + + if fields.save and fields.title ~= "" and fields.text ~= "" then + local new_stack, data + if stack:get_name() ~= "default:book_written" then + local count = stack:get_count() + if count == 1 then + stack:set_name("default:book_written") + else + stack:set_count(count - 1) + new_stack = ItemStack("default:book_written") + end + else + data = minetest.deserialize(stack:get_metadata()) + end + + if not data then data = {} end + data.title = fields.title + data.text = fields.text + data.text_len = #data.text + data.page = 1 + data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) + data.owner = player:get_player_name() + local data_str = minetest.serialize(data) + + if new_stack then + new_stack:set_metadata(data_str) + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(player:getpos(), new_stack) + end + else + stack:set_metadata(data_str) + end + + elseif fields.book_next or fields.book_prev then + local data = minetest.deserialize(stack:get_metadata()) + if not data or not data.page then + return + end + + if fields.book_next then + data.page = data.page + 1 + if data.page > data.page_max then + data.page = 1 + end + else + data.page = data.page - 1 + if data.page == 0 then + data.page = data.page_max + end + end + + local data_str = minetest.serialize(data) + stack:set_metadata(data_str) + book_on_use(stack, player) + end + + player:set_wielded_item(stack) +end) + +minetest.register_craftitem("default:book", { + description = "Book", + inventory_image = "default_book.png", + groups = {book = 1, flammable = 3}, + on_use = book_on_use, +}) + +minetest.register_craftitem("default:book_written", { + description = "Book With Text", + inventory_image = "default_book_written.png", + groups = {book = 1, not_in_creative_inventory = 1, flammable = 3}, + stack_max = 1, + on_use = book_on_use, +}) + +minetest.register_craft({ + type = "shapeless", + output = "default:book_written", + recipe = {"default:book", "default:book_written"} +}) + +minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) + if itemstack:get_name() ~= "default:book_written" then + return + end + + local original + local index + for i = 1, player:get_inventory():get_size("craft") do + if old_craft_grid[i]:get_name() == "default:book_written" then + original = old_craft_grid[i] + index = i + end + end + if not original then + return + end + local copymeta = original:get_metadata() + -- copy of the book held by player's mouse cursor + itemstack:set_metadata(copymeta) + -- put the book with metadata back in the craft grid + craft_inv:set_stack("craft", index, original) +end) + +minetest.register_craftitem("default:coal_lump", { + description = "Coal Lump", + inventory_image = "default_coal_lump.png", + groups = {coal = 1, flammable = 1} +}) + +minetest.register_craftitem("default:iron_lump", { + description = "Iron Lump", + inventory_image = "default_iron_lump.png", +}) + +minetest.register_craftitem("default:copper_lump", { + description = "Copper Lump", + inventory_image = "default_copper_lump.png", +}) + +minetest.register_craftitem("default:mese_crystal", { + description = "Mese Crystal", + inventory_image = "default_mese_crystal.png", +}) + +minetest.register_craftitem("default:gold_lump", { + description = "Gold Lump", + inventory_image = "default_gold_lump.png", +}) + +minetest.register_craftitem("default:diamond", { + description = "Diamond", + inventory_image = "default_diamond.png", +}) + +minetest.register_craftitem("default:clay_lump", { + description = "Clay Lump", + inventory_image = "default_clay_lump.png", +}) + +minetest.register_craftitem("default:steel_ingot", { + description = "Steel Ingot", + inventory_image = "default_steel_ingot.png", +}) + +minetest.register_craftitem("default:copper_ingot", { + description = "Copper Ingot", + inventory_image = "default_copper_ingot.png", +}) + +minetest.register_craftitem("default:bronze_ingot", { + description = "Bronze Ingot", + inventory_image = "default_bronze_ingot.png", +}) + +minetest.register_craftitem("default:gold_ingot", { + description = "Gold Ingot", + inventory_image = "default_gold_ingot.png" +}) + +minetest.register_craftitem("default:mese_crystal_fragment", { + description = "Mese Crystal Fragment", + inventory_image = "default_mese_crystal_fragment.png", +}) + +minetest.register_craftitem("default:clay_brick", { + description = "Clay Brick", + inventory_image = "default_clay_brick.png", +}) + +minetest.register_craftitem("default:obsidian_shard", { + description = "Obsidian Shard", + inventory_image = "default_obsidian_shard.png", +}) + +minetest.register_craftitem("default:flint", { + description = "Flint", + inventory_image = "default_flint.png" +}) + diff --git a/mods/default/functions.lua b/mods/default/functions.lua new file mode 100644 index 0000000..957bce6 --- /dev/null +++ b/mods/default/functions.lua @@ -0,0 +1,518 @@ +-- mods/default/functions.lua + +-- +-- Sounds +-- + +function default.node_sound_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "", gain = 1.0} + table.dug = table.dug or + {name = "default_dug_node", gain = 0.25} + table.place = table.place or + {name = "default_place_node_hard", gain = 1.0} + return table +end + +function default.node_sound_stone_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_hard_footstep", gain = 0.3} + table.dug = table.dug or + {name = "default_hard_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_dirt_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_dirt_footstep", gain = 0.4} + table.dug = table.dug or + {name = "default_dirt_footstep", gain = 1.0} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_sand_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_sand_footstep", gain = 0.12} + table.dug = table.dug or + {name = "default_sand_footstep", gain = 0.24} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_gravel_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_gravel_footstep", gain = 0.4} + table.dug = table.dug or + {name = "default_gravel_footstep", gain = 1.0} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_wood_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_wood_footstep", gain = 0.3} + table.dug = table.dug or + {name = "default_wood_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_leaves_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_grass_footstep", gain = 0.45} + table.dug = table.dug or + {name = "default_grass_footstep", gain = 0.7} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_glass_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_glass_footstep", gain = 0.3} + table.dig = table.dig or + {name = "default_glass_footstep", gain = 0.5} + table.dug = table.dug or + {name = "default_break_glass", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_metal_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_metal_footstep", gain = 0.4} + table.dig = table.dig or + {name = "default_dig_metal", gain = 0.5} + table.dug = table.dug or + {name = "default_dug_metal", gain = 0.5} + table.place = table.place or + {name = "default_place_node_metal", gain = 0.5} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_water_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_water_footstep", gain = 0.2} + default.node_sound_defaults(table) + return table +end + +-- +-- Lavacooling +-- + +default.cool_lava = function(pos, node) + if node.name == "default:lava_source" then + minetest.set_node(pos, {name = "default:obsidian"}) + else -- Lava flowing + minetest.set_node(pos, {name = "default:stone"}) + end + minetest.sound_play("default_cool_lava", + {pos = pos, max_hear_distance = 16, gain = 0.25}) +end + +minetest.register_abm({ + label = "Lava cooling", + nodenames = {"default:lava_source", "default:lava_flowing"}, + neighbors = {"group:cools_lava", "group:water"}, + interval = 1, + chance = 1, + catch_up = false, + action = function(...) + default.cool_lava(...) + end, +}) + + +-- +-- optimized helper to put all items in an inventory into a drops list +-- + +function default.get_inventory_drops(pos, inventory, drops) + local inv = minetest.get_meta(pos):get_inventory() + local n = #drops + for i = 1, inv:get_size(inventory) do + local stack = inv:get_stack(inventory, i) + if stack:get_count() > 0 then + drops[n+1] = stack:to_table() + n = n + 1 + end + end +end + +-- +-- Papyrus and cactus growing +-- + +-- wrapping the functions in abm action is necessary to make overriding them possible + +function default.grow_cactus(pos, node) + if node.param2 >= 4 then + return + end + pos.y = pos.y - 1 + if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:cactus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + if minetest.get_node_light(pos) < 13 then + return + end + minetest.set_node(pos, {name = "default:cactus"}) + return true +end + +function default.grow_papyrus(pos, node) + pos.y = pos.y - 1 + local name = minetest.get_node(pos).name + if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then + return + end + if not minetest.find_node_near(pos, 3, {"group:water"}) then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:papyrus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + if minetest.get_node_light(pos) < 13 then + return + end + minetest.set_node(pos, {name = "default:papyrus"}) + return true +end + +minetest.register_abm({ + label = "Grow cactus", + nodenames = {"default:cactus"}, + neighbors = {"group:sand"}, + interval = 12, + chance = 83, + action = function(...) + default.grow_cactus(...) + end +}) + +minetest.register_abm({ + label = "Grow papyrus", + nodenames = {"default:papyrus"}, + neighbors = {"default:dirt", "default:dirt_with_grass"}, + interval = 14, + chance = 71, + action = function(...) + default.grow_papyrus(...) + end +}) + + +-- +-- dig upwards +-- + +function default.dig_up(pos, node, digger) + if digger == nil then return end + local np = {x = pos.x, y = pos.y + 1, z = pos.z} + local nn = minetest.get_node(np) + if nn.name == node.name then + minetest.node_dig(np, nn, digger) + end +end + + +-- +-- Fence registration helper +-- + +function default.register_fence(name, def) + minetest.register_craft({ + output = name .. " 4", + recipe = { + { def.material, 'group:stick', def.material }, + { def.material, 'group:stick', def.material }, + } + }) + + local fence_texture = "default_fence_overlay.png^" .. def.texture .. + "^default_fence_overlay.png^[makealpha:255,126,126" + -- Allow almost everything to be overridden + local default_fields = { + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}}, + -- connect_top = + -- connect_bottom = + connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8}, + {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}}, + connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16}, + {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}}, + connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2}, + {-1/16,-5/16,1/8,1/16,-3/16,1/2}}, + connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, + {1/8,-5/16,-1/16,1/2,-3/16,1/16}}, + }, + connects_to = {"group:fence", "group:wood", "group:tree"}, + inventory_image = fence_texture, + wield_image = fence_texture, + tiles = {def.texture}, + sunlight_propagates = true, + is_ground_content = false, + groups = {}, + } + for k, v in pairs(default_fields) do + if not def[k] then + def[k] = v + end + end + + -- Always add to the fence group, even if no group provided + def.groups.fence = 1 + + def.texture = nil + def.material = nil + + minetest.register_node(name, def) +end + + +-- +-- Leafdecay +-- + +-- Prevent decay of placed leaves + +default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) + if placer and not placer:get_player_control().sneak then + local node = minetest.get_node(pos) + node.param2 = 1 + minetest.set_node(pos, node) + end +end + +-- Leafdecay ABM + +minetest.register_abm({ + label = "Leaf decay", + nodenames = {"group:leafdecay"}, + neighbors = {"air"}, + interval = 2, + chance = 10, + catch_up = false, + + action = function(pos, node, _, _) + -- Check if leaf is placed + if node.param2 ~= 0 then + return + end + + local rad = minetest.registered_nodes[node.name].groups.leafdecay + -- Assume ignore is a trunk, to make this + -- work at the border of a loaded area + if minetest.find_node_near(pos, rad, {"ignore", "group:tree"}) then + return + end + -- Drop stuff + local itemstacks = minetest.get_node_drops(node.name) + for _, itemname in ipairs(itemstacks) do + if itemname ~= node.name or + minetest.get_item_group(node.name, "leafdecay_drop") ~= 0 then + local p_drop = { + x = pos.x - 0.5 + math.random(), + y = pos.y - 0.5 + math.random(), + z = pos.z - 0.5 + math.random(), + } + minetest.add_item(p_drop, itemname) + end + end + -- Remove node + minetest.remove_node(pos) + minetest.check_for_falling(pos) + end +}) + + +-- +-- Convert dirt to something that fits the environment +-- + +minetest.register_abm({ + label = "Grass spread", + nodenames = {"default:dirt"}, + neighbors = { + "air", + "group:grass", + "group:dry_grass", + "default:snow", + }, + interval = 6, + chance = 50, + catch_up = false, + action = function(pos, node) + -- Check for darkness: night, shadow or under a light-blocking node + -- Returns if ignore above + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + if (minetest.get_node_light(above) or 0) < 13 then + return + end + + -- Look for spreading dirt-type neighbours + local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type") + if p2 then + local n3 = minetest.get_node(p2) + minetest.set_node(pos, {name = n3.name}) + return + end + + -- Else, any seeding nodes on top? + local name = minetest.get_node(above).name + -- Snow check is cheapest, so comes first + if name == "default:snow" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + -- Most likely case first + elseif minetest.get_item_group(name, "grass") ~= 0 then + minetest.set_node(pos, {name = "default:dirt_with_grass"}) + elseif minetest.get_item_group(name, "dry_grass") ~= 0 then + minetest.set_node(pos, {name = "default:dirt_with_dry_grass"}) + end + end +}) + + +-- +-- Grass and dry grass removed in darkness +-- + +minetest.register_abm({ + label = "Grass covered", + nodenames = {"group:spreading_dirt_type"}, + interval = 8, + chance = 50, + catch_up = false, + action = function(pos, node) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local name = minetest.get_node(above).name + local nodedef = minetest.registered_nodes[name] + if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or + nodedef.paramtype == "light") and + nodedef.liquidtype == "none") then + minetest.set_node(pos, {name = "default:dirt"}) + end + end +}) + + +-- +-- Moss growth on cobble near water +-- + +minetest.register_abm({ + label = "Moss growth", + nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"}, + neighbors = {"group:water"}, + interval = 16, + chance = 200, + catch_up = false, + action = function(pos, node) + if node.name == "default:cobble" then + minetest.set_node(pos, {name = "default:mossycobble"}) + elseif node.name == "stairs:slab_cobble" then + minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2}) + elseif node.name == "stairs:stair_cobble" then + minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2}) + elseif node.name == "walls:cobble" then + minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2}) + end + end +}) + + +-- +-- Checks if specified volume intersects a protected volume +-- + +function default.intersects_protection(minp, maxp, player_name, interval) + -- 'interval' is the largest allowed interval for the 3D lattice of checks + + -- Compute the optimal float step 'd' for each axis so that all corners and + -- borders are checked. 'd' will be smaller or equal to 'interval'. + -- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the + -- for loop (which might otherwise not be the case due to rounding errors). + local d = {} + for _, c in pairs({"x", "y", "z"}) do + if maxp[c] > minp[c] then + d[c] = (maxp[c] - minp[c]) / math.ceil((maxp[c] - minp[c]) / interval) - 1e-4 + elseif maxp[c] == minp[c] then + d[c] = 1 -- Any value larger than 0 to avoid division by zero + else -- maxp[c] < minp[c], print error and treat as protection intersected + minetest.log("error", "maxp < minp in 'default.intersects_protection()'") + return true + end + end + + for zf = minp.z, maxp.z, d.z do + local z = math.floor(zf + 0.5) + for yf = minp.y, maxp.y, d.y do + local y = math.floor(yf + 0.5) + for xf = minp.x, maxp.x, d.x do + local x = math.floor(xf + 0.5) + if minetest.is_protected({x = x, y = y, z = z}, player_name) then + return true + end + end + end + end + + return false +end + + +-- +-- Coral death near air +-- + +minetest.register_abm({ + nodenames = {"default:coral_brown", "default:coral_orange"}, + neighbors = {"air"}, + interval = 17, + chance = 5, + catch_up = false, + action = function(pos, node) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua new file mode 100644 index 0000000..4b82205 --- /dev/null +++ b/mods/default/furnace.lua @@ -0,0 +1,330 @@ + +-- +-- Formspecs +-- + +local function active_formspec(fuel_percent, item_percent) + local formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. + (100-fuel_percent)..":default_furnace_fire_fg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:".. + (item_percent)..":gui_furnace_arrow_fg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + return formspec +end + +local inactive_formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + +-- +-- Node callback functions that are the same for active and inactive furnace +-- + +local function can_dig(pos, player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") +end + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if listname == "fuel" then + if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then + if inv:is_empty("src") then + meta:set_string("infotext", "Furnace is empty") + end + return stack:get_count() + else + return 0 + end + elseif listname == "src" then + return stack:get_count() + elseif listname == "dst" then + return 0 + end +end + +local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack(from_list, from_index) + return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) +end + +local function allow_metadata_inventory_take(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +end + +local function swap_node(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +local function furnace_node_timer(pos, elapsed) + -- + -- Inizialize metadata + -- + local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 + local src_time = meta:get_float("src_time") or 0 + local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + + local inv = meta:get_inventory() + local srclist, fuellist + + local cookable, cooked + local fuel + + local update = true + while update do + update = false + + srclist = inv:get_list("src") + fuellist = inv:get_list("fuel") + + -- + -- Cooking + -- + + -- Check if we have cookable content + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + cookable = cooked.time ~= 0 + + -- Check if we have enough fuel to burn + if fuel_time < fuel_totaltime then + -- The furnace is currently active and has enough fuel + fuel_time = fuel_time + elapsed + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + elapsed + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = src_time - cooked.time + update = true + end + end + end + else + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local afterfuel + fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + src_time = src_time + elapsed + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + src_time = 0 + end + fuel_time = 0 + end + + elapsed = 0 + end + + if fuel and fuel_totaltime > fuel.time then + fuel_totaltime = fuel.time + end + if srclist[1]:is_empty() then + src_time = 0 + end + + -- + -- Update formspec, infotext and node + -- + local formspec = inactive_formspec + local item_state + local item_percent = 0 + if cookable then + item_percent = math.floor(src_time / cooked.time * 100) + if item_percent > 100 then + item_state = "100% (output full)" + else + item_state = item_percent .. "%" + end + else + if srclist[1]:is_empty() then + item_state = "Empty" + else + item_state = "Not cookable" + end + end + + local fuel_state = "Empty" + local active = "inactive " + local result = false + + if fuel_totaltime ~= 0 then + active = "active " + local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) + fuel_state = fuel_percent .. "%" + formspec = active_formspec(fuel_percent, item_percent) + swap_node(pos, "default:furnace_active") + -- make sure timer restarts automatically + result = true + else + if not fuellist[1]:is_empty() then + fuel_state = "0%" + end + swap_node(pos, "default:furnace") + -- stop timer on the inactive furnace + minetest.get_node_timer(pos):stop() + end + + local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" + + -- + -- Set meta values + -- + meta:set_float("fuel_totaltime", fuel_totaltime) + meta:set_float("fuel_time", fuel_time) + meta:set_float("src_time", src_time) + meta:set_string("formspec", formspec) + meta:set_string("infotext", infotext) + + return result +end + +-- +-- Node definitions +-- + +minetest.register_node("default:furnace", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", "default_furnace_front.png" + }, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + can_dig = can_dig, + + on_timer = furnace_node_timer, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", inactive_formspec) + local inv = meta:get_inventory() + inv:set_size('src', 1) + inv:set_size('fuel', 1) + inv:set_size('dst', 4) + end, + + on_metadata_inventory_move = function(pos) + minetest.get_node_timer(pos):start(1.0) + end, + on_metadata_inventory_put = function(pos) + -- start timer function, it will sort out whether furnace can burn or not. + minetest.get_node_timer(pos):start(1.0) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "src", drops) + default.get_inventory_drops(pos, "fuel", drops) + default.get_inventory_drops(pos, "dst", drops) + drops[#drops+1] = "default:furnace" + minetest.remove_node(pos) + return drops + end, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + +minetest.register_node("default:furnace_active", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", + { + image = "default_furnace_front_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + } + }, + paramtype2 = "facedir", + light_source = 8, + drop = "default:furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + on_timer = furnace_node_timer, + + can_dig = can_dig, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + diff --git a/mods/default/init.lua b/mods/default/init.lua new file mode 100644 index 0000000..7b5f62f --- /dev/null +++ b/mods/default/init.lua @@ -0,0 +1,52 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + +-- The API documentation in here was moved into game_api.txt + +-- Definitions made by this mod that other mods can use too +default = {} + +default.LIGHT_MAX = 14 + +-- GUI related stuff +default.gui_bg = "bgcolor[#080808BB;true]" +default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" +default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + +function default.get_hotbar_bg(x,y) + local out = "" + for i=0,7,1 do + out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" + end + return out +end + +default.gui_survival_form = "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "list[current_player;craft;1.75,0.5;3,3;]".. + "list[current_player;craftpreview;5.75,1.5;1,1;]".. + "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "listring[current_player;main]".. + "listring[current_player;craft]".. + default.get_hotbar_bg(0,4.25) + +-- Load files +local default_path = minetest.get_modpath("default") + +dofile(default_path.."/functions.lua") +dofile(default_path.."/trees.lua") +dofile(default_path.."/nodes.lua") +dofile(default_path.."/furnace.lua") +dofile(default_path.."/torch.lua") +dofile(default_path.."/tools.lua") +dofile(default_path.."/item_entity.lua") +dofile(default_path.."/craftitems.lua") +dofile(default_path.."/crafting.lua") +dofile(default_path.."/mapgen.lua") +dofile(default_path.."/player.lua") +dofile(default_path.."/aliases.lua") +dofile(default_path.."/legacy.lua") diff --git a/mods/default/item_entity.lua b/mods/default/item_entity.lua new file mode 100644 index 0000000..c34e60e --- /dev/null +++ b/mods/default/item_entity.lua @@ -0,0 +1,74 @@ +-- mods/default/item_entity.lua + +local builtin_item = minetest.registered_entities["__builtin:item"] + +local item = { + set_item = function(self, itemstring) + builtin_item.set_item(self, itemstring) + + local stack = ItemStack(itemstring) + local itemdef = minetest.registered_items[stack:get_name()] + if itemdef and itemdef.groups.flammable ~= 0 then + self.flammable = itemdef.groups.flammable + end + end, + + burn_up = function(self) + -- disappear in a smoke puff + self.object:remove() + local p = self.object:getpos() + minetest.sound_play("default_item_smoke", { + pos = p, + max_hear_distance = 8, + }) + minetest.add_particlespawner({ + amount = 3, + time = 0.1, + minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 }, + maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.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 = 5, + maxsize = 5, + collisiondetection = true, + texture = "default_item_smoke.png" + }) + end, + + on_step = function(self, dtime) + builtin_item.on_step(self, dtime) + + if self.flammable then + -- flammable, check for igniters + self.ignite_timer = (self.ignite_timer or 0) + dtime + if self.ignite_timer > 10 then + self.ignite_timer = 0 + + local node = minetest.get_node_or_nil(self.object:getpos()) + if not node then + return + end + + -- Immediately burn up flammable items in lava + if minetest.get_item_group(node.name, "lava") > 0 then + self:burn_up() + else + -- otherwise there'll be a chance based on its igniter value + local burn_chance = self.flammable + * minetest.get_item_group(node.name, "igniter") + if burn_chance > 0 and math.random(0, burn_chance) ~= 0 then + self:burn_up() + end + end + end + end + end, +} + +-- set defined item as new __builtin:item, with the old one as fallback table +setmetatable(item, builtin_item) +minetest.register_entity(":__builtin:item", item) diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua new file mode 100644 index 0000000..a8c8ad5 --- /dev/null +++ b/mods/default/legacy.lua @@ -0,0 +1,25 @@ +-- mods/default/legacy.lua + +-- Horrible stuff to support old code registering falling nodes +-- Don't use this and never do what this does, it's completely wrong! +-- (More specifically, the client and the C++ code doesn't get the group) +function default.register_falling_node(nodename, texture) + minetest.log("error", debug.traceback()) + minetest.log('error', "WARNING: default.register_falling_node is deprecated") + if minetest.registered_nodes[nodename] then + minetest.registered_nodes[nodename].groups.falling_node = 1 + end +end + +function default.spawn_falling_node(p, nodename) + spawn_falling_node(p, nodename) +end + +-- Liquids +WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha +WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity +LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity +LIGHT_MAX = default.LIGHT_MAX + +-- Formspecs +default.gui_suvival_form = default.gui_survival_form diff --git a/mods/default/license.txt b/mods/default/license.txt new file mode 100644 index 0000000..e926736 --- /dev/null +++ b/mods/default/license.txt @@ -0,0 +1,174 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2010-2016: + celeron55, Perttu Ahola + Cisoun + G4JC + VanessaE + RealBadAngel + Calinou + MirceaKitsune + Jordach + PilzAdam + jojoa1997 + InfinityProject + Splizard + Zeg9 + paramat + BlockMen + sofar + Neuromancer + Gambit + asl97 + KevDoy + Mito551 + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 brunob.santos + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/4.0/ + +----------------------- + +Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) +Copyright (C) 2014-2016 Neuromancer + + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/2.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2009 cmusounddesign +Copyright (C) 2010 Tomlija +Copyright (C) 2010 lsprice +Copyright (C) 2014 sonictechtonic +Copyright (C) 2015 yadronoff +Copyright (C) 2007 HerbertBoland +Copyright (C) 2006 AGFX + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua new file mode 100644 index 0000000..14e1fc6 --- /dev/null +++ b/mods/default/mapgen.lua @@ -0,0 +1,1674 @@ +-- +-- Aliases for map generators +-- + +minetest.register_alias("mapgen_stone", "default:stone") +minetest.register_alias("mapgen_dirt", "default:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("mapgen_sand", "default:sand") +minetest.register_alias("mapgen_water_source", "default:water_source") +minetest.register_alias("mapgen_river_water_source", "default:river_water_source") +minetest.register_alias("mapgen_lava_source", "default:lava_source") +minetest.register_alias("mapgen_gravel", "default:gravel") +minetest.register_alias("mapgen_desert_stone", "default:desert_stone") +minetest.register_alias("mapgen_desert_sand", "default:desert_sand") +minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow") +minetest.register_alias("mapgen_snowblock", "default:snowblock") +minetest.register_alias("mapgen_snow", "default:snow") +minetest.register_alias("mapgen_ice", "default:ice") +minetest.register_alias("mapgen_sandstone", "default:sandstone") + +-- Flora + +minetest.register_alias("mapgen_tree", "default:tree") +minetest.register_alias("mapgen_leaves", "default:leaves") +minetest.register_alias("mapgen_apple", "default:apple") +minetest.register_alias("mapgen_jungletree", "default:jungletree") +minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves") +minetest.register_alias("mapgen_junglegrass", "default:junglegrass") +minetest.register_alias("mapgen_pine_tree", "default:pine_tree") +minetest.register_alias("mapgen_pine_needles", "default:pine_needles") + +-- Dungeons + +minetest.register_alias("mapgen_cobble", "default:cobble") +minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") +minetest.register_alias("mapgen_mossycobble", "default:mossycobble") +minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") +minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") +minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstonebrick") + + +-- +-- Register ores +-- + +-- Blob ores +-- These first to avoid other ores in blobs + +-- Mgv6 + +function default.register_mgv6_blob_ores() + + -- Clay + -- This first to avoid clay in sand blobs + + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -15, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Sand + + minetest.register_ore({ + ore_type = "blob", + ore = "default:sand", + wherein = {"default:stone", "default:desert_stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Dirt + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.0 + }, + }) + + -- Gravel + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.0 + }, + }) +end + + +-- All mapgens except mgv6 + +function default.register_blob_ores() + + -- Clay + + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -15, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Silver sand + + minetest.register_ore({ + ore_type = "blob", + ore = "default:silver_sand", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground"} + }) + + -- Dirt + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.0 + }, + biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest", + "deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore", + "rainforest", "rainforest_swamp"} + }) + + -- Gravel + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground"} + }) +end + + +-- Scatter ores +-- All mapgens + +function default.register_ores() + + -- Coal + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8 * 8 * 8, + clust_num_ores = 9, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8 * 8 * 8, + clust_num_ores = 8, + clust_size = 3, + y_min = -31000, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 27, + clust_size = 6, + y_min = -31000, + y_max = 0, + }) + + -- Iron + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 12, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 7 * 7 * 7, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = 0, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 27, + clust_size = 6, + y_min = -31000, + y_max = -64, + }) + + -- Copper + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 12 * 12 * 12, + clust_num_ores = 4, + clust_size = 3, + y_min = -63, + y_max = -16, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -64, + }) + + -- Gold + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Mese crystal + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 18 * 18 * 18, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Diamond + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 4, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 4, + clust_size = 3, + y_min = -255, + y_max = -128, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 4, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Mese block + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 36 * 36 * 36, + clust_num_ores = 3, + clust_size = 2, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 36 * 36 * 36, + clust_num_ores = 3, + clust_size = 2, + y_min = -31000, + y_max = -1024, + }) +end + + +-- +-- Register biomes +-- + +-- All mapgens except mgv6 + +function default.register_biomes() + + -- Icesheet + + minetest.register_biome({ + name = "icesheet", + node_dust = "default:snowblock", + node_top = "default:snowblock", + depth_top = 1, + node_filler = "default:snowblock", + depth_filler = 3, + node_stone = "default:ice", + node_water_top = "default:ice", + depth_water_top = 10, + --node_water = "", + node_river_water = "default:ice", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -8, + y_max = 31000, + heat_point = 0, + humidity_point = 73, + }) + + minetest.register_biome({ + name = "icesheet_ocean", + node_dust = "default:snowblock", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + node_water_top = "default:ice", + depth_water_top = 10, + --node_water = "", + --node_river_water = "", + y_min = -112, + y_max = -9, + heat_point = 0, + humidity_point = 73, + }) + + -- Tundra + + minetest.register_biome({ + name = "tundra", + node_dust = "default:snowblock", + --node_top = , + --depth_top = , + --node_filler = , + --depth_filler = , + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = 2, + y_max = 31000, + heat_point = 0, + humidity_point = 40, + }) + + minetest.register_biome({ + name = "tundra_beach", + --node_dust = "", + node_top = "default:gravel", + depth_top = 1, + node_filler = "default:gravel", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -3, + y_max = 1, + heat_point = 0, + humidity_point = 40, + }) + + minetest.register_biome({ + name = "tundra_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -112, + y_max = -4, + heat_point = 0, + humidity_point = 40, + }) + + -- Taiga + + minetest.register_biome({ + name = "taiga", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 2, + y_max = 31000, + heat_point = 25, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "taiga_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 1, + heat_point = 25, + humidity_point = 70, + }) + + -- Snowy grassland + + minetest.register_biome({ + name = "snowy_grassland", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 20, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "snowy_grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 20, + humidity_point = 35, + }) + + -- Grassland + + minetest.register_biome({ + name = "grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = 31000, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 50, + humidity_point = 35, + }) + + -- Coniferous forest + + minetest.register_biome({ + name = "coniferous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = 31000, + heat_point = 45, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "coniferous_forest_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 45, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "coniferous_forest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 45, + humidity_point = 70, + }) + + -- Deciduous forest + + minetest.register_biome({ + name = "deciduous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = 31000, + heat_point = 60, + humidity_point = 68, + }) + + minetest.register_biome({ + name = "deciduous_forest_shore", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 60, + humidity_point = 68, + }) + + minetest.register_biome({ + name = "deciduous_forest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 60, + humidity_point = 68, + }) + + -- Desert + + minetest.register_biome({ + name = "desert", + --node_dust = "", + node_top = "default:desert_sand", + depth_top = 1, + node_filler = "default:desert_sand", + depth_filler = 1, + node_stone = "default:desert_stone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 92, + humidity_point = 16, + }) + + minetest.register_biome({ + name = "desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:desert_stone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 92, + humidity_point = 16, + }) + + -- Sandstone desert + + minetest.register_biome({ + name = "sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 0, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 60, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "sandstone_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 60, + humidity_point = 0, + }) + + -- Cold desert + + minetest.register_biome({ + name = "cold_desert", + --node_dust = "", + node_top = "default:silver_sand", + depth_top = 1, + node_filler = "default:silver_sand", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 31000, + heat_point = 40, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "cold_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 40, + humidity_point = 0, + }) + + -- Savanna + + minetest.register_biome({ + name = "savanna", + --node_dust = "", + node_top = "default:dirt_with_dry_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = 31000, + heat_point = 89, + humidity_point = 42, + }) + + minetest.register_biome({ + name = "savanna_shore", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 89, + humidity_point = 42, + }) + + minetest.register_biome({ + name = "savanna_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 89, + humidity_point = 42, + }) + + -- Rainforest + + minetest.register_biome({ + name = "rainforest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = 31000, + heat_point = 86, + humidity_point = 65, + }) + + minetest.register_biome({ + name = "rainforest_swamp", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 86, + humidity_point = 65, + }) + + minetest.register_biome({ + name = "rainforest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 86, + humidity_point = 65, + }) + + -- Underground + + minetest.register_biome({ + name = "underground", + --node_dust = "", + --node_top = "", + --depth_top = , + --node_filler = "", + --depth_filler = , + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + y_min = -31000, + y_max = -113, + heat_point = 50, + humidity_point = 50, + }) +end + + +-- +-- Register decorations +-- + +-- Mgv6 + +function default.register_mgv6_decorations() + + -- Papyrus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x = 100, y = 100, z = 100}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + y_min = 1, + y_max = 1, + decoration = "default:papyrus", + height = 2, + height_max = 4, + spawn_by = "default:water_source", + num_spawn_by = 1, + }) + + -- Cacti + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.012, + scale = 0.024, + spread = {x = 100, y = 100, z = 100}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:cactus", + height = 3, + height_max = 4, + }) + + -- Long grasses + + for length = 1, 5 do + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.007, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:grass_"..length, + }) + end + + -- Dry shrubs + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.035, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:dry_shrub", + }) +end + + +-- All mapgens except mgv6 + +local function register_grass_decoration(offset, scale, length) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:sand"}, + sidelen = 16, + noise_params = { + offset = offset, + scale = scale, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"grassland", "grassland_dunes", "deciduous_forest", + "coniferous_forest", "coniferous_forest_dunes"}, + y_min = 1, + y_max = 31000, + decoration = "default:grass_" .. length, + }) +end + +local function register_dry_grass_decoration(offset, scale, length) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = offset, + scale = scale, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + decoration = "default:dry_grass_" .. length, + }) +end + + +function default.register_decorations() + + -- Apple tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.036, + scale = 0.022, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0018, + scale = 0.0011, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Jungle tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt"}, + sidelen = 80, + fill_ratio = 0.1, + biomes = {"rainforest", "rainforest_swamp"}, + y_min = -1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt"}, + sidelen = 80, + fill_ratio = 0.005, + biomes = {"rainforest", "rainforest_swamp"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Taiga and temperate coniferous forest pine tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.036, + scale = 0.022, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"taiga", "coniferous_forest"}, + y_min = 2, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, + sidelen = 80, + noise_params = { + offset = 0.0018, + scale = 0.0011, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"taiga", "coniferous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Acacia tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.002, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Aspen tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0, + scale = -0.015, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0, + scale = -0.0008, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Large cactus + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.0003, + scale = 0.0009, + spread = {x = 200, y = 200, z = 200}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert"}, + y_min = 5, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Cactus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.0003, + scale = 0.0009, + spread = {x = 200, y = 200, z = 200}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert"}, + y_min = 5, + y_max = 31000, + decoration = "default:cactus", + height = 2, + height_max = 5, + }) + + -- Papyrus + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x = 200, y = 200, z = 200}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + biomes = {"savanna_shore"}, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", + }) + + -- Bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"snowy_grassland", "grassland", "deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Acacia bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 90155, + octaves = 3, + persist = 0.7, + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Grasses + + register_grass_decoration(-0.03, 0.09, 5) + register_grass_decoration(-0.015, 0.075, 4) + register_grass_decoration(0, 0.06, 3) + register_grass_decoration(0.015, 0.045, 2) + register_grass_decoration(0.03, 0.03, 1) + + -- Dry grasses + + register_dry_grass_decoration(0.01, 0.05, 5) + register_dry_grass_decoration(0.03, 0.03, 4) + register_dry_grass_decoration(0.05, 0.01, 3) + register_dry_grass_decoration(0.07, -0.01, 2) + register_dry_grass_decoration(0.09, -0.03, 1) + + -- Junglegrass + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 80, + fill_ratio = 0.1, + biomes = {"rainforest"}, + y_min = 1, + y_max = 31000, + decoration = "default:junglegrass", + }) + + -- Dry shrub + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", + "default:sand", "default:silver_sand"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.02, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert", "sandstone_desert", "cold_desert"}, + y_min = 2, + y_max = 31000, + decoration = "default:dry_shrub", + }) + + -- Coral reef + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:sand"}, + noise_params = { + offset = -0.1, + scale = 0.1, + spread = {x = 200, y = 200, z = 200}, + seed = 7013, + octaves = 3, + persist = 1, + }, + biomes = { + "desert_ocean", + "savanna_ocean", + "rainforest_ocean", + }, + y_min = -8, + y_max = -2, + schematic = minetest.get_modpath("default") .. "/schematics/corals.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) +end + + +-- +-- Detect mapgen to select functions +-- + +minetest.clear_registered_biomes() +minetest.clear_registered_ores() +minetest.clear_registered_decorations() + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then + default.register_mgv6_blob_ores() + default.register_ores() + default.register_mgv6_decorations() +else + default.register_biomes() + default.register_blob_ores() + default.register_ores() + default.register_decorations() +end diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d new file mode 100644 index 0000000..9ab4543 Binary files /dev/null and b/mods/default/models/character.b3d differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend new file mode 100644 index 0000000..fca9f65 Binary files /dev/null and b/mods/default/models/character.blend differ diff --git a/mods/default/models/character.png b/mods/default/models/character.png new file mode 100644 index 0000000..0502178 Binary files /dev/null and b/mods/default/models/character.png differ diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua new file mode 100644 index 0000000..572c604 --- /dev/null +++ b/mods/default/nodes.lua @@ -0,0 +1,2091 @@ +-- mods/default/nodes.lua + + +--[[ Node name convention: + +Although many node names are in combined-word form, the required form for new +node names is words separated by underscores. If both forms are used in written +language (for example pinewood and pine wood) the underscore form should be used. + +--]] + + +--[[ Index: + +Stone +----- +(1. Material 2. Cobble variant 3. Brick variant 4. Modified forms) + +default:stone +default:cobble +default:stonebrick +default:stone_block +default:mossycobble + +default:desert_stone +default:desert_cobble +default:desert_stonebrick +default:desert_stone_block + +default:sandstone +default:sandstonebrick +default:sandstone_block + +default:obsidian +default:obsidianbrick +default:obsidian_block + +Soft / Non-Stone +---------------- +(1. Material 2. Modified forms) + +default:dirt +default:dirt_with_grass +default:dirt_with_grass_footsteps +default:dirt_with_dry_grass +default:dirt_with_snow + +default:sand +default:desert_sand +default:silver_sand + +default:gravel + +default:clay + +default:snow +default:snowblock + +default:ice + +Trees +----- +(1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits) + +default:tree +default:wood +default:leaves +default:sapling +default:apple + +default:jungletree +default:junglewood +default:jungleleaves +default:junglesapling + +default:pine_tree +default:pine_wood +default:pine_needles +default:pine_sapling + +default:acacia_tree +default:acacia_wood +default:acacia_leaves +default:acacia_sapling + +default:aspen_tree +default:aspen_wood +default:aspen_leaves +default:aspen_sapling + +Ores +---- +(1. In stone 2. Blocks) + +default:stone_with_coal +default:coalblock + +default:stone_with_iron +default:steelblock + +default:stone_with_copper +default:copperblock +default:bronzeblock + +default:stone_with_gold +default:goldblock + +default:stone_with_mese +default:mese + +default:stone_with_diamond +default:diamondblock + +Plantlife +--------- + +default:cactus +default:papyrus +default:dry_shrub +default:junglegrass + +default:grass_1 +default:grass_2 +default:grass_3 +default:grass_4 +default:grass_5 + +default:dry_grass_1 +default:dry_grass_2 +default:dry_grass_3 +default:dry_grass_4 +default:dry_grass_5 + +default:bush_stem +default:bush_leaves +default:acacia_bush_stem +default:acacia_bush_leaves + +Corals +------ + +default:coral_brown +default:coral_orange +default:coral_skeleton + +Liquids +------- +(1. Source 2. Flowing) + +default:water_source +default:water_flowing + +default:river_water_source +default:river_water_flowing + +default:lava_source +default:lava_flowing + +Tools / "Advanced" crafting / Non-"natural" +------------------------------------------- + +default:chest +default:chest_locked + +default:bookshelf + +default:sign_wall_wood +default:sign_wall_steel + +default:ladder_wood +default:ladder_steel + +default:fence_wood +default:fence_acacia_wood +default:fence_junglewood +default:fence_pine_wood +default:fence_aspen_wood + +default:glass +default:obsidian_glass + +default:brick + +default:meselamp + +Misc +---- + +default:cloud + +--]] + +-- +-- Stone +-- + +minetest.register_node("default:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + groups = {cracky = 3, stone = 1}, + drop = 'default:cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:cobble", { + description = "Cobblestone", + tiles = {"default_cobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stonebrick", { + description = "Stone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_stone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stone_block", { + description = "Stone Block", + tiles = {"default_stone_block.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mossycobble", { + description = "Mossy Cobblestone", + tiles = {"default_mossycobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + groups = {cracky = 3, stone = 1}, + drop = 'default:desert_cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_cobble", { + description = "Desert Cobblestone", + tiles = {"default_desert_cobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stonebrick", { + description = "Desert Stone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_desert_stone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stone_block", { + description = "Desert Stone Block", + tiles = {"default_desert_stone_block.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:sandstone", { + description = "Sandstone", + tiles = {"default_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstonebrick", { + description = "Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstone_block", { + description = "Sandstone Block", + tiles = {"default_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:obsidian", { + description = "Obsidian", + tiles = {"default_obsidian.png"}, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +minetest.register_node("default:obsidianbrick", { + description = "Obsidian Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_obsidian_brick.png"}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +minetest.register_node("default:obsidian_block", { + description = "Obsidian Block", + tiles = {"default_obsidian_block.png"}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +-- +-- Soft / Non-Stone +-- + +minetest.register_node("default:dirt", { + description = "Dirt", + tiles = {"default_dirt.png"}, + groups = {crumbly = 3, soil = 1}, + sounds = default.node_sound_dirt_defaults(), +}) + +minetest.register_node("default:dirt_with_grass", { + description = "Dirt with Grass", + tiles = {"default_grass.png", "default_dirt.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.25}, + }), +}) + +minetest.register_node("default:dirt_with_grass_footsteps", { + description = "Dirt with Grass and Footsteps", + tiles = {"default_grass.png^default_footprint.png", "default_dirt.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.25}, + }), +}) + +minetest.register_node("default:dirt_with_dry_grass", { + description = "Dirt with Dry Grass", + tiles = {"default_dry_grass.png", + "default_dirt.png", + {name = "default_dirt.png^default_dry_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.4}, + }), +}) + +minetest.register_node("default:dirt_with_snow", { + description = "Dirt with Snow", + tiles = {"default_snow.png", "default_dirt.png", + {name = "default_dirt.png^default_snow_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1, snowy = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + }), +}) + +minetest.register_node("default:sand", { + description = "Sand", + tiles = {"default_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:desert_sand", { + description = "Desert Sand", + tiles = {"default_desert_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:silver_sand", { + description = "Silver Sand", + tiles = {"default_silver_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + + +minetest.register_node("default:gravel", { + description = "Gravel", + tiles = {"default_gravel.png"}, + groups = {crumbly = 2, falling_node = 1}, + sounds = default.node_sound_gravel_defaults(), + drop = { + max_items = 1, + items = { + {items = {'default:flint'}, rarity = 16}, + {items = {'default:gravel'}} + } + } +}) + +minetest.register_node("default:clay", { + description = "Clay", + tiles = {"default_clay.png"}, + groups = {crumbly = 3}, + drop = 'default:clay_lump 4', + sounds = default.node_sound_dirt_defaults(), +}) + + +minetest.register_node("default:snow", { + description = "Snow", + tiles = {"default_snow.png"}, + inventory_image = "default_snowball.png", + wield_image = "default_snowball.png", + paramtype = "light", + buildable_to = true, + floodable = true, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + }, + groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + dug = {name = "default_snow_footstep", gain = 0.2}, + dig = {name = "default_snow_footstep", gain = 0.2} + }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, +}) + +minetest.register_node("default:snowblock", { + description = "Snow Block", + tiles = {"default_snow.png"}, + groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + dug = {name = "default_snow_footstep", gain = 0.2}, + dig = {name = "default_snow_footstep", gain = 0.2} + }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, +}) + +minetest.register_node("default:ice", { + description = "Ice", + tiles = {"default_ice.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- +-- Trees +-- + +minetest.register_node("default:tree", { + description = "Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:wood", { + description = "Wooden Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_wood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:sapling", { + description = "Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_sapling.png"}, + inventory_image = "default_sapling.png", + wield_image = "default_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 6, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +minetest.register_node("default:leaves", { + description = "Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves.png"}, + special_tiles = {"default_leaves_simple.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'default:sapling'}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {'default:leaves'}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:apple", { + description = "Apple", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16} + }, + groups = {fleshy = 3, dig_immediate = 3, flammable = 2, + leafdecay = 3, leafdecay_drop = 1}, + on_use = minetest.item_eat(2), + sounds = default.node_sound_leaves_defaults(), + + after_place_node = function(pos, placer, itemstack) + if placer:is_player() then + minetest.set_node(pos, {name = "default:apple", param2 = 1}) + end + end, +}) + + +minetest.register_node("default:jungletree", { + description = "Jungle Tree", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", + "default_jungletree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:junglewood", { + description = "Junglewood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_junglewood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:jungleleaves", { + description = "Jungle Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_jungleleaves.png"}, + special_tiles = {"default_jungleleaves_simple.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {'default:junglesapling'}, rarity = 20}, + {items = {'default:jungleleaves'}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:junglesapling", { + description = "Jungle Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_junglesapling.png"}, + inventory_image = "default_junglesapling.png", + wield_image = "default_junglesapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:junglesapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 15, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + + +minetest.register_node("default:pine_tree", { + description = "Pine Tree", + tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", + "default_pine_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:pine_wood", { + description = "Pine Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_pine_wood.png"}, + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:pine_needles",{ + description = "Pine Needles", + drawtype = "allfaces_optional", + tiles = {"default_pine_needles.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:pine_sapling"}, rarity = 20}, + {items = {"default:pine_needles"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_sapling", { + description = "Pine Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_pine_sapling.png"}, + inventory_image = "default_pine_sapling.png", + wield_image = "default_pine_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 3, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:pine_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 12, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + + +minetest.register_node("default:acacia_tree", { + description = "Acacia Tree", + tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png", + "default_acacia_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:acacia_wood", { + description = "Acacia Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_acacia_wood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:acacia_leaves", { + description = "Acacia Leaves", + drawtype = "allfaces_optional", + tiles = {"default_acacia_leaves.png"}, + special_tiles = {"default_acacia_leaves_simple.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:acacia_sapling"}, rarity = 20}, + {items = {"default:acacia_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:acacia_sapling", { + description = "Acacia Tree Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_acacia_sapling.png"}, + inventory_image = "default_acacia_sapling.png", + wield_image = "default_acacia_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:acacia_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -4, y = 1, z = -4}, + {x = 4, y = 6, z = 4}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +minetest.register_node("default:aspen_tree", { + description = "Aspen Tree", + tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png", + "default_aspen_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:aspen_wood", { + description = "Aspen Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_aspen_wood.png"}, + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:aspen_leaves", { + description = "Aspen Leaves", + drawtype = "allfaces_optional", + tiles = {"default_aspen_leaves.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:aspen_sapling"}, rarity = 20}, + {items = {"default:aspen_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:aspen_sapling", { + description = "Aspen Tree Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_aspen_sapling.png"}, + inventory_image = "default_aspen_sapling.png", + wield_image = "default_aspen_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 3, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:aspen_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 12, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +-- +-- Ores +-- + +minetest.register_node("default:stone_with_coal", { + description = "Coal Ore", + tiles = {"default_stone.png^default_mineral_coal.png"}, + groups = {cracky = 3}, + drop = 'default:coal_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coalblock", { + description = "Coal Block", + tiles = {"default_coal_block.png"}, + is_ground_content = false, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:stone_with_iron", { + description = "Iron Ore", + tiles = {"default_stone.png^default_mineral_iron.png"}, + groups = {cracky = 2}, + drop = 'default:iron_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:steelblock", { + description = "Steel Block", + tiles = {"default_steel_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_copper", { + description = "Copper Ore", + tiles = {"default_stone.png^default_mineral_copper.png"}, + groups = {cracky = 2}, + drop = 'default:copper_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:copperblock", { + description = "Copper Block", + tiles = {"default_copper_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("default:bronzeblock", { + description = "Bronze Block", + tiles = {"default_bronze_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_mese", { + description = "Mese Ore", + tiles = {"default_stone.png^default_mineral_mese.png"}, + groups = {cracky = 1}, + drop = "default:mese_crystal", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mese", { + description = "Mese Block", + tiles = {"default_mese_block.png"}, + paramtype = "light", + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_stone_defaults(), + light_source = 3, +}) + + +minetest.register_node("default:stone_with_gold", { + description = "Gold Ore", + tiles = {"default_stone.png^default_mineral_gold.png"}, + groups = {cracky = 2}, + drop = "default:gold_lump", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:goldblock", { + description = "Gold Block", + tiles = {"default_gold_block.png"}, + is_ground_content = false, + groups = {cracky = 1}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_diamond", { + description = "Diamond Ore", + tiles = {"default_stone.png^default_mineral_diamond.png"}, + groups = {cracky = 1}, + drop = "default:diamond", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:diamondblock", { + description = "Diamond Block", + tiles = {"default_diamond_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +-- +-- Plantlife (non-cubic) +-- + +minetest.register_node("default:cactus", { + description = "Cactus", + tiles = {"default_cactus_top.png", "default_cactus_top.png", + "default_cactus_side.png"}, + paramtype2 = "facedir", + groups = {choppy = 3}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node, +}) + +minetest.register_node("default:papyrus", { + description = "Papyrus", + drawtype = "plantlike", + tiles = {"default_papyrus.png"}, + inventory_image = "default_papyrus.png", + wield_image = "default_papyrus.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, + }, + groups = {snappy = 3, flammable = 2}, + sounds = default.node_sound_leaves_defaults(), + + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, +}) + +minetest.register_node("default:dry_shrub", { + description = "Dry Shrub", + drawtype = "plantlike", + waving = 1, + visual_scale = 1.0, + tiles = {"default_dry_shrub.png"}, + inventory_image = "default_dry_shrub.png", + wield_image = "default_dry_shrub.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16}, + }, +}) + +minetest.register_node("default:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + waving = 1, + visual_scale = 1.3, + tiles = {"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16}, + }, +}) + + +minetest.register_node("default:grass_1", { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_1.png"}, + -- Use texture of a taller grass stage in inventory + inventory_image = "default_grass_3.png", + wield_image = "default_grass_3.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random grass node + local stack = ItemStack("default:grass_" .. math.random(1,5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:grass_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 5 do + minetest.register_node("default:grass_" .. i, { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_" .. i .. ".png"}, + inventory_image = "default_grass_" .. i .. ".png", + wield_image = "default_grass_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "default:grass_1", + groups = {snappy = 3, flora = 1, attached_node = 1, + not_in_creative_inventory = 1, grass = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, + }, + }) +end + + +minetest.register_node("default:dry_grass_1", { + description = "Dry Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_dry_grass_1.png"}, + inventory_image = "default_dry_grass_3.png", + wield_image = "default_dry_grass_3.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, + attached_node = 1, dry_grass = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random dry grass node + local stack = ItemStack("default:dry_grass_" .. math.random(1, 5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:dry_grass_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 5 do + minetest.register_node("default:dry_grass_" .. i, { + description = "Dry Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_dry_grass_" .. i .. ".png"}, + inventory_image = "default_dry_grass_" .. i .. ".png", + wield_image = "default_dry_grass_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1, + not_in_creative_inventory=1, dry_grass = 1}, + drop = "default:dry_grass_1", + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16}, + }, + }) +end + + +minetest.register_node("default:bush_stem", { + description = "Bush Stem", + drawtype = "plantlike", + visual_scale = 1.18, + tiles = {"default_bush_stem.png"}, + inventory_image = "default_bush_stem.png", + wield_image = "default_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16}, + }, +}) + +minetest.register_node("default:bush_leaves", { + description = "Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:acacia_bush_stem", { + description = "Acacia Bush Stem", + drawtype = "plantlike", + visual_scale = 1.18, + tiles = {"default_acacia_bush_stem.png"}, + inventory_image = "default_acacia_bush_stem.png", + wield_image = "default_acacia_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.54, 7 / 16}, + }, +}) + +minetest.register_node("default:acacia_bush_leaves", { + description = "Acacia Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_acacia_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + sounds = default.node_sound_leaves_defaults(), +}) + + +-- +-- Corals +-- + +minetest.register_node("default:coral_brown", { + description = "Brown Coral", + tiles = {"default_coral_brown.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_orange", { + description = "Orange Coral", + tiles = {"default_coral_orange.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_skeleton", { + description = "Coral Skeleton", + tiles = {"default_coral_skeleton.png"}, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +-- +-- Liquids +-- + +minetest.register_node("default:water_source", { + description = "Water Source", + drawtype = "liquid", + tiles = { + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + -- New-style water source material (mostly unused) + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a = 103, r = 30, g = 60, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + +minetest.register_node("default:water_flowing", { + description = "Flowing Water", + drawtype = "flowingliquid", + tiles = {"default_water.png"}, + special_tiles = { + { + name = "default_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a = 103, r = 30, g = 60, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + + +minetest.register_node("default:river_water_source", { + description = "River Water Source", + drawtype = "liquid", + tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + +minetest.register_node("default:river_water_flowing", { + description = "Flowing River Water", + drawtype = "flowingliquid", + tiles = {"default_river_water.png"}, + special_tiles = { + { + name = "default_river_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_river_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + + +minetest.register_node("default:lava_source", { + description = "Lava Source", + drawtype = "liquid", + tiles = { + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + }, + }, + special_tiles = { + -- New-style lava source material (mostly unused) + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + backface_culling = false, + }, + }, + paramtype = "light", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a = 191, r = 255, g = 64, b = 0}, + groups = {lava = 3, liquid = 2, igniter = 1}, +}) + +minetest.register_node("default:lava_flowing", { + description = "Flowing Lava", + drawtype = "flowingliquid", + tiles = {"default_lava.png"}, + special_tiles = { + { + name = "default_lava_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + { + name = "default_lava_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + }, + paramtype = "light", + paramtype2 = "flowingliquid", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a = 191, r = 255, g = 64, b = 0}, + groups = {lava = 3, liquid = 2, igniter = 1, + not_in_creative_inventory = 1}, +}) + +-- +-- Tools / "Advanced" crafting / Non-"natural" +-- + +local chest_formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + +local function get_locked_chest_formspec(pos) + local spos = pos.x .. "," .. pos.y .. "," .. pos.z + local formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[nodemeta:" .. spos .. ";main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + return formspec +end + +local function has_locked_chest_privilege(meta, player) + if player then + if minetest.check_player_privs(player, "protection_bypass") then + return true + end + else + return false + end + + -- is player wielding the right key? + local item = player:get_wielded_item() + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + return true + end + + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + + return true +end + +minetest.register_node("default:chest", { + description = "Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + paramtype2 = "facedir", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", chest_formspec) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from chest at " .. minetest.pos_to_string(pos)) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "main", drops) + drops[#drops+1] = "default:chest" + minetest.remove_node(pos) + return drops + end, +}) + +minetest.register_node("default:chest_locked", { + description = "Locked Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"}, + paramtype2 = "facedir", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by " .. + meta:get_string("owner") .. ")") + end, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8 * 4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and has_locked_chest_privilege(meta, player) + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to locked chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from locked chest at " .. minetest.pos_to_string(pos)) + end, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local meta = minetest.get_meta(pos) + if has_locked_chest_privilege(meta, clicker) then + minetest.show_formspec( + clicker:get_player_name(), + "default:chest_locked", + get_locked_chest_formspec(pos) + ) + end + return itemstack + end, + on_blast = function() end, + on_key_use = function(pos, player) + local secret = minetest.get_meta(pos):get_string("key_lock_secret") + local itemstack = player:get_wielded_item() + local key_meta = minetest.parse_json(itemstack:get_metadata()) + + if secret ~= key_meta.secret then + return + end + + minetest.show_formspec( + player:get_player_name(), + "default:chest_locked", + get_locked_chest_formspec(pos) + ) + end, + on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local name = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= name then + minetest.record_protection_violation(pos, name) + minetest.chat_send_player(name, "You do not own this chest.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked chest", owner + end, +}) + + +local bookshelf_formspec = + "size[8,7;]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[context;books;0,0.3;8,2;]" .. + "list[current_player;main;0,2.85;8,1;]" .. + "list[current_player;main;0,4.08;8,3;8]" .. + "listring[context;books]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,2.85) + +local function get_bookshelf_formspec(inv) + local formspec = bookshelf_formspec + local invlist = inv and inv:get_list("books") + -- Inventory slots overlay + local bx, by = 0, 0.3 + for i = 1, 16 do + if i == 9 then + bx = 0 + by = by + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]" + end + bx = bx + 1 + end + return formspec +end + +minetest.register_node("default:bookshelf", { + description = "Bookshelf", + tiles = {"default_wood.png", "default_wood.png", "default_wood.png", + "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(nil)) + local inv = meta:get_inventory() + inv:set_size("books", 8 * 2) + end, + can_dig = function(pos,player) + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("books") + end, + allow_metadata_inventory_put = function(pos, listname, index, stack) + if minetest.get_item_group(stack:get_name(), "book") ~= 0 then + return stack:get_count() + end + return 0 + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves stuff to bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes stuff from bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "books", drops) + drops[#drops+1] = "default:bookshelf" + minetest.remove_node(pos) + return drops + end, +}) + +local function register_sign(material, desc, def) + minetest.register_node("default:sign_wall_" .. material, { + description = desc .. " Sign", + drawtype = "nodebox", + tiles = {"default_sign_wall_" .. material .. ".png"}, + inventory_image = "default_sign_" .. material .. ".png", + wield_image = "default_sign_" .. material .. ".png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + node_box = { + type = "wallmounted", + wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, + wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}, + wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}, + }, + groups = def.groups, + legacy_wallmounted = true, + sounds = def.sounds, + + on_construct = function(pos) + --local n = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[text;;${text}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) + local player_name = sender:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) + return + end + local meta = minetest.get_meta(pos) + if not fields.text then return end + minetest.log("action", (player_name or "") .. " wrote \"" .. + fields.text .. "\" to sign at " .. minetest.pos_to_string(pos)) + meta:set_string("text", fields.text) + meta:set_string("infotext", '"' .. fields.text .. '"') + end, + }) +end + +register_sign("wood", "Wooden", { + sounds = default.node_sound_wood_defaults(), + groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3} +}) + +register_sign("steel", "Steel", { + sounds = default.node_sound_metal_defaults(), + groups = {cracky = 2, attached_node = 1} +}) + +minetest.register_node("default:ladder_wood", { + description = "Wooden Ladder", + drawtype = "signlike", + tiles = {"default_ladder_wood.png"}, + inventory_image = "default_ladder_wood.png", + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:ladder_steel", { + description = "Steel Ladder", + drawtype = "signlike", + tiles = {"default_ladder_steel.png"}, + inventory_image = "default_ladder_steel.png", + wield_image = "default_ladder_steel.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), +}) + +default.register_fence("default:fence_wood", { + description = "Wooden Fence", + texture = "default_fence_wood.png", + inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_acacia_wood", { + description = "Acacia Fence", + texture = "default_fence_acacia_wood.png", + inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_junglewood", { + description = "Junglewood Fence", + texture = "default_fence_junglewood.png", + inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_pine_wood", { + description = "Pine Fence", + texture = "default_fence_pine_wood.png", + inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_aspen_wood", { + description = "Aspen Fence", + texture = "default_fence_aspen_wood.png", + inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +minetest.register_node("default:glass", { + description = "Glass", + drawtype = "glasslike_framed_optional", + tiles = {"default_glass.png", "default_glass_detail.png"}, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("default:obsidian_glass", { + description = "Obsidian Glass", + drawtype = "glasslike_framed_optional", + tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + sounds = default.node_sound_glass_defaults(), + groups = {cracky = 3}, +}) + + +minetest.register_node("default:brick", { + description = "Brick Block", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_brick.png"}, + is_ground_content = false, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:meselamp", { + description = "Mese Lamp", + drawtype = "glasslike", + tiles = {"default_meselamp.png"}, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_glass_defaults(), + light_source = default.LIGHT_MAX, +}) + +-- +-- Misc +-- + +minetest.register_node("default:cloud", { + description = "Cloud", + tiles = {"default_cloud.png"}, + is_ground_content = false, + sounds = default.node_sound_defaults(), + groups = {not_in_creative_inventory = 1}, +}) diff --git a/mods/default/player.lua b/mods/default/player.lua new file mode 100644 index 0000000..fd7341f --- /dev/null +++ b/mods/default/player.lua @@ -0,0 +1,158 @@ +-- Minetest 0.4 mod: player +-- See README.txt for licensing and other information. + +-- Player animation blending +-- Note: This is currently broken due to a bug in Irrlicht, leave at 0 +local animation_blend = 0 + +default.registered_player_models = { } + +-- Local for speed. +local models = default.registered_player_models + +function default.player_register_model(name, def) + models[name] = def +end + +-- Default player appearance +default.player_register_model("character.b3d", { + animation_speed = 30, + textures = {"character.png", }, + animations = { + -- Standard animations. + stand = { x= 0, y= 79, }, + lay = { x=162, y=166, }, + walk = { x=168, y=187, }, + mine = { x=189, y=198, }, + walk_mine = { x=200, y=219, }, + sit = { x= 81, y=160, }, + }, +}) + +-- Player stats and animations +local player_model = {} +local player_textures = {} +local player_anim = {} +local player_sneak = {} +default.player_attached = {} + +function default.player_get_animation(player) + local name = player:get_player_name() + return { + model = player_model[name], + textures = player_textures[name], + animation = player_anim[name], + } +end + +-- Called when a player's appearance needs to be updated +function default.player_set_model(player, model_name) + local name = player:get_player_name() + local model = models[model_name] + if model then + if player_model[name] == model_name then + return + end + player:set_properties({ + mesh = model_name, + textures = player_textures[name] or model.textures, + visual = "mesh", + visual_size = model.visual_size or {x=1, y=1}, + }) + default.player_set_animation(player, "stand") + else + player:set_properties({ + textures = { "player.png", "player_back.png", }, + visual = "upright_sprite", + }) + end + player_model[name] = model_name +end + +function default.player_set_textures(player, textures) + local name = player:get_player_name() + player_textures[name] = textures + player:set_properties({textures = textures,}) +end + +function default.player_set_animation(player, anim_name, speed) + local name = player:get_player_name() + if player_anim[name] == anim_name then + return + end + local model = player_model[name] and models[player_model[name]] + if not (model and model.animations[anim_name]) then + return + end + local anim = model.animations[anim_name] + player_anim[name] = anim_name + player:set_animation(anim, speed or model.animation_speed, animation_blend) +end + +-- Update appearance when the player joins +minetest.register_on_joinplayer(function(player) + default.player_attached[player:get_player_name()] = false + default.player_set_model(player, "character.b3d") + player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) + + -- set GUI + if not minetest.setting_getbool("creative_mode") then + player:set_inventory_formspec(default.gui_survival_form) + end + player:hud_set_hotbar_image("gui_hotbar.png") + player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") +end) + +minetest.register_on_leaveplayer(function(player) + local name = player:get_player_name() + player_model[name] = nil + player_anim[name] = nil + player_textures[name] = nil +end) + +-- Localize for better performance. +local player_set_animation = default.player_set_animation +local player_attached = default.player_attached + +-- Check each player and apply animations +minetest.register_globalstep(function(dtime) + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + local model_name = player_model[name] + local model = model_name and models[model_name] + if model and not player_attached[name] then + local controls = player:get_player_control() + local walking = false + local animation_speed_mod = model.animation_speed or 30 + + -- Determine if the player is walking + if controls.up or controls.down or controls.left or controls.right then + walking = true + end + + -- Determine if the player is sneaking, and reduce animation speed if so + if controls.sneak then + animation_speed_mod = animation_speed_mod / 2 + end + + -- Apply animations based on what the player is doing + if player:get_hp() == 0 then + player_set_animation(player, "lay") + elseif walking then + if player_sneak[name] ~= controls.sneak then + player_anim[name] = nil + player_sneak[name] = controls.sneak + end + if controls.LMB then + player_set_animation(player, "walk_mine", animation_speed_mod) + else + player_set_animation(player, "walk", animation_speed_mod) + end + elseif controls.LMB then + player_set_animation(player, "mine") + else + player_set_animation(player, "stand", animation_speed_mod) + end + end + end +end) diff --git a/mods/default/schematics/acacia_bush.mts b/mods/default/schematics/acacia_bush.mts new file mode 100644 index 0000000..df95586 Binary files /dev/null and b/mods/default/schematics/acacia_bush.mts differ diff --git a/mods/default/schematics/acacia_log.mts b/mods/default/schematics/acacia_log.mts new file mode 100644 index 0000000..037bca8 Binary files /dev/null and b/mods/default/schematics/acacia_log.mts differ diff --git a/mods/default/schematics/acacia_tree.mts b/mods/default/schematics/acacia_tree.mts new file mode 100644 index 0000000..4732ade Binary files /dev/null and b/mods/default/schematics/acacia_tree.mts differ diff --git a/mods/default/schematics/acacia_tree_from_sapling.mts b/mods/default/schematics/acacia_tree_from_sapling.mts new file mode 100644 index 0000000..23e8e4b Binary files /dev/null and b/mods/default/schematics/acacia_tree_from_sapling.mts differ diff --git a/mods/default/schematics/apple_log.mts b/mods/default/schematics/apple_log.mts new file mode 100644 index 0000000..e7ee8f2 Binary files /dev/null and b/mods/default/schematics/apple_log.mts differ diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts new file mode 100644 index 0000000..ac09b46 Binary files /dev/null and b/mods/default/schematics/apple_tree.mts differ diff --git a/mods/default/schematics/apple_tree_from_sapling.mts b/mods/default/schematics/apple_tree_from_sapling.mts new file mode 100644 index 0000000..5d35a15 Binary files /dev/null and b/mods/default/schematics/apple_tree_from_sapling.mts differ diff --git a/mods/default/schematics/aspen_log.mts b/mods/default/schematics/aspen_log.mts new file mode 100644 index 0000000..180e6fd Binary files /dev/null and b/mods/default/schematics/aspen_log.mts differ diff --git a/mods/default/schematics/aspen_tree.mts b/mods/default/schematics/aspen_tree.mts new file mode 100644 index 0000000..724aae0 Binary files /dev/null and b/mods/default/schematics/aspen_tree.mts differ diff --git a/mods/default/schematics/aspen_tree_from_sapling.mts b/mods/default/schematics/aspen_tree_from_sapling.mts new file mode 100644 index 0000000..b7ca161 Binary files /dev/null and b/mods/default/schematics/aspen_tree_from_sapling.mts differ diff --git a/mods/default/schematics/bush.mts b/mods/default/schematics/bush.mts new file mode 100644 index 0000000..d08cf5f Binary files /dev/null and b/mods/default/schematics/bush.mts differ diff --git a/mods/default/schematics/corals.mts b/mods/default/schematics/corals.mts new file mode 100644 index 0000000..e1bd7de Binary files /dev/null and b/mods/default/schematics/corals.mts differ diff --git a/mods/default/schematics/jungle_log.mts b/mods/default/schematics/jungle_log.mts new file mode 100644 index 0000000..54fa16d Binary files /dev/null and b/mods/default/schematics/jungle_log.mts differ diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts new file mode 100644 index 0000000..329364a Binary files /dev/null and b/mods/default/schematics/jungle_tree.mts differ diff --git a/mods/default/schematics/jungle_tree_from_sapling.mts b/mods/default/schematics/jungle_tree_from_sapling.mts new file mode 100644 index 0000000..babaa45 Binary files /dev/null and b/mods/default/schematics/jungle_tree_from_sapling.mts differ diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts new file mode 100644 index 0000000..b71077b Binary files /dev/null and b/mods/default/schematics/large_cactus.mts differ diff --git a/mods/default/schematics/papyrus.mts b/mods/default/schematics/papyrus.mts new file mode 100644 index 0000000..1333a7c Binary files /dev/null and b/mods/default/schematics/papyrus.mts differ diff --git a/mods/default/schematics/pine_log.mts b/mods/default/schematics/pine_log.mts new file mode 100644 index 0000000..744c38b Binary files /dev/null and b/mods/default/schematics/pine_log.mts differ diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts new file mode 100644 index 0000000..3a3fa7a Binary files /dev/null and b/mods/default/schematics/pine_tree.mts differ diff --git a/mods/default/schematics/pine_tree_from_sapling.mts b/mods/default/schematics/pine_tree_from_sapling.mts new file mode 100644 index 0000000..629c5da Binary files /dev/null and b/mods/default/schematics/pine_tree_from_sapling.mts differ diff --git a/mods/default/schematics/snowy_pine_tree_from_sapling.mts b/mods/default/schematics/snowy_pine_tree_from_sapling.mts new file mode 100644 index 0000000..0692049 Binary files /dev/null and b/mods/default/schematics/snowy_pine_tree_from_sapling.mts differ diff --git a/mods/default/sounds/default_break_glass.1.ogg b/mods/default/sounds/default_break_glass.1.ogg new file mode 100644 index 0000000..b1ccc5f Binary files /dev/null and b/mods/default/sounds/default_break_glass.1.ogg differ diff --git a/mods/default/sounds/default_break_glass.2.ogg b/mods/default/sounds/default_break_glass.2.ogg new file mode 100644 index 0000000..b6cc9e8 Binary files /dev/null and b/mods/default/sounds/default_break_glass.2.ogg differ diff --git a/mods/default/sounds/default_break_glass.3.ogg b/mods/default/sounds/default_break_glass.3.ogg new file mode 100644 index 0000000..ae6a6bf Binary files /dev/null and b/mods/default/sounds/default_break_glass.3.ogg differ diff --git a/mods/default/sounds/default_cool_lava.1.ogg b/mods/default/sounds/default_cool_lava.1.ogg new file mode 100644 index 0000000..42506dd Binary files /dev/null and b/mods/default/sounds/default_cool_lava.1.ogg differ diff --git a/mods/default/sounds/default_cool_lava.2.ogg b/mods/default/sounds/default_cool_lava.2.ogg new file mode 100644 index 0000000..2747ab8 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.2.ogg differ diff --git a/mods/default/sounds/default_cool_lava.3.ogg b/mods/default/sounds/default_cool_lava.3.ogg new file mode 100644 index 0000000..8baeac3 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.3.ogg differ diff --git a/mods/default/sounds/default_dig_choppy.ogg b/mods/default/sounds/default_dig_choppy.ogg new file mode 100644 index 0000000..e2ecd84 Binary files /dev/null and b/mods/default/sounds/default_dig_choppy.ogg differ diff --git a/mods/default/sounds/default_dig_cracky.ogg b/mods/default/sounds/default_dig_cracky.ogg new file mode 100644 index 0000000..da11679 Binary files /dev/null and b/mods/default/sounds/default_dig_cracky.ogg differ diff --git a/mods/default/sounds/default_dig_crumbly.ogg b/mods/default/sounds/default_dig_crumbly.ogg new file mode 100644 index 0000000..a0b2a1f Binary files /dev/null and b/mods/default/sounds/default_dig_crumbly.ogg differ diff --git a/mods/default/sounds/default_dig_dig_immediate.ogg b/mods/default/sounds/default_dig_dig_immediate.ogg new file mode 100644 index 0000000..e65d766 Binary files /dev/null and b/mods/default/sounds/default_dig_dig_immediate.ogg differ diff --git a/mods/default/sounds/default_dig_metal.ogg b/mods/default/sounds/default_dig_metal.ogg new file mode 100644 index 0000000..0b58509 Binary files /dev/null and b/mods/default/sounds/default_dig_metal.ogg differ diff --git a/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg new file mode 100644 index 0000000..ef4d7b1 Binary files /dev/null and b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg differ diff --git a/mods/default/sounds/default_dig_snappy.ogg b/mods/default/sounds/default_dig_snappy.ogg new file mode 100644 index 0000000..3686fcd Binary files /dev/null and b/mods/default/sounds/default_dig_snappy.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.1.ogg b/mods/default/sounds/default_dirt_footstep.1.ogg new file mode 100644 index 0000000..84a197d Binary files /dev/null and b/mods/default/sounds/default_dirt_footstep.1.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.2.ogg b/mods/default/sounds/default_dirt_footstep.2.ogg new file mode 100644 index 0000000..2e23b8a Binary files /dev/null and b/mods/default/sounds/default_dirt_footstep.2.ogg differ diff --git a/mods/default/sounds/default_dug_metal.1.ogg b/mods/default/sounds/default_dug_metal.1.ogg new file mode 100644 index 0000000..5d6cb5b Binary files /dev/null and b/mods/default/sounds/default_dug_metal.1.ogg differ diff --git a/mods/default/sounds/default_dug_metal.2.ogg b/mods/default/sounds/default_dug_metal.2.ogg new file mode 100644 index 0000000..63567fc Binary files /dev/null and b/mods/default/sounds/default_dug_metal.2.ogg differ diff --git a/mods/default/sounds/default_dug_node.1.ogg b/mods/default/sounds/default_dug_node.1.ogg new file mode 100644 index 0000000..c04975d Binary files /dev/null and b/mods/default/sounds/default_dug_node.1.ogg differ diff --git a/mods/default/sounds/default_dug_node.2.ogg b/mods/default/sounds/default_dug_node.2.ogg new file mode 100644 index 0000000..9f20926 Binary files /dev/null and b/mods/default/sounds/default_dug_node.2.ogg differ diff --git a/mods/default/sounds/default_glass_footstep.ogg b/mods/default/sounds/default_glass_footstep.ogg new file mode 100644 index 0000000..191287a Binary files /dev/null and b/mods/default/sounds/default_glass_footstep.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.1.ogg b/mods/default/sounds/default_grass_footstep.1.ogg new file mode 100644 index 0000000..22d1ad6 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.1.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.2.ogg b/mods/default/sounds/default_grass_footstep.2.ogg new file mode 100644 index 0000000..4ccd8a0 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.2.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.3.ogg b/mods/default/sounds/default_grass_footstep.3.ogg new file mode 100644 index 0000000..20db84e Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.1.ogg b/mods/default/sounds/default_gravel_footstep.1.ogg new file mode 100644 index 0000000..8d260ce Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.1.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.2.ogg b/mods/default/sounds/default_gravel_footstep.2.ogg new file mode 100644 index 0000000..2aba2c6 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.2.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.3.ogg b/mods/default/sounds/default_gravel_footstep.3.ogg new file mode 100644 index 0000000..1bcd8a1 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.4.ogg b/mods/default/sounds/default_gravel_footstep.4.ogg new file mode 100644 index 0000000..696c9ff Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.4.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.1.ogg b/mods/default/sounds/default_hard_footstep.1.ogg new file mode 100644 index 0000000..1748bc5 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.1.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.2.ogg b/mods/default/sounds/default_hard_footstep.2.ogg new file mode 100644 index 0000000..fe39fd7 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.2.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.3.ogg b/mods/default/sounds/default_hard_footstep.3.ogg new file mode 100644 index 0000000..5030e06 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.3.ogg differ diff --git a/mods/default/sounds/default_item_smoke.ogg b/mods/default/sounds/default_item_smoke.ogg new file mode 100644 index 0000000..038a46e Binary files /dev/null and b/mods/default/sounds/default_item_smoke.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.1.ogg b/mods/default/sounds/default_metal_footstep.1.ogg new file mode 100644 index 0000000..841286b Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.1.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.2.ogg b/mods/default/sounds/default_metal_footstep.2.ogg new file mode 100644 index 0000000..aa61ed3 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.2.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.3.ogg b/mods/default/sounds/default_metal_footstep.3.ogg new file mode 100644 index 0000000..4cc1ca4 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.3.ogg differ diff --git a/mods/default/sounds/default_place_node.1.ogg b/mods/default/sounds/default_place_node.1.ogg new file mode 100644 index 0000000..46b9756 Binary files /dev/null and b/mods/default/sounds/default_place_node.1.ogg differ diff --git a/mods/default/sounds/default_place_node.2.ogg b/mods/default/sounds/default_place_node.2.ogg new file mode 100644 index 0000000..d34c01a Binary files /dev/null and b/mods/default/sounds/default_place_node.2.ogg differ diff --git a/mods/default/sounds/default_place_node.3.ogg b/mods/default/sounds/default_place_node.3.ogg new file mode 100644 index 0000000..fc29365 Binary files /dev/null and b/mods/default/sounds/default_place_node.3.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.1.ogg b/mods/default/sounds/default_place_node_hard.1.ogg new file mode 100644 index 0000000..9f97fac Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.1.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.2.ogg b/mods/default/sounds/default_place_node_hard.2.ogg new file mode 100644 index 0000000..1d3b3de Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.2.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.1.ogg b/mods/default/sounds/default_place_node_metal.1.ogg new file mode 100644 index 0000000..5da085e Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.1.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.2.ogg b/mods/default/sounds/default_place_node_metal.2.ogg new file mode 100644 index 0000000..5ee67fc Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.2.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.1.ogg b/mods/default/sounds/default_sand_footstep.1.ogg new file mode 100644 index 0000000..65b68c7 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.1.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.2.ogg b/mods/default/sounds/default_sand_footstep.2.ogg new file mode 100644 index 0000000..57f35f3 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.1.ogg b/mods/default/sounds/default_snow_footstep.1.ogg new file mode 100644 index 0000000..3260b91 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.1.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.2.ogg b/mods/default/sounds/default_snow_footstep.2.ogg new file mode 100644 index 0000000..4aac1e7 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.3.ogg b/mods/default/sounds/default_snow_footstep.3.ogg new file mode 100644 index 0000000..cf4235b Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.3.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.1.ogg b/mods/default/sounds/default_tool_breaks.1.ogg new file mode 100644 index 0000000..2a571ae Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.1.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.2.ogg b/mods/default/sounds/default_tool_breaks.2.ogg new file mode 100644 index 0000000..1789352 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.2.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.3.ogg b/mods/default/sounds/default_tool_breaks.3.ogg new file mode 100644 index 0000000..a99c4b7 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.1.ogg b/mods/default/sounds/default_water_footstep.1.ogg new file mode 100644 index 0000000..63b9744 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.1.ogg differ diff --git a/mods/default/sounds/default_water_footstep.2.ogg b/mods/default/sounds/default_water_footstep.2.ogg new file mode 100644 index 0000000..8d79c1f Binary files /dev/null and b/mods/default/sounds/default_water_footstep.2.ogg differ diff --git a/mods/default/sounds/default_water_footstep.3.ogg b/mods/default/sounds/default_water_footstep.3.ogg new file mode 100644 index 0000000..f889150 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.4.ogg b/mods/default/sounds/default_water_footstep.4.ogg new file mode 100644 index 0000000..6f1eab8 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.4.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.1.ogg b/mods/default/sounds/default_wood_footstep.1.ogg new file mode 100644 index 0000000..34f63a1 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.1.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.2.ogg b/mods/default/sounds/default_wood_footstep.2.ogg new file mode 100644 index 0000000..124fc29 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.2.ogg differ diff --git a/mods/default/sounds/player_damage.ogg b/mods/default/sounds/player_damage.ogg new file mode 100644 index 0000000..7888087 Binary files /dev/null and b/mods/default/sounds/player_damage.ogg differ diff --git a/mods/default/textures/bubble.png b/mods/default/textures/bubble.png new file mode 100644 index 0000000..100fe15 Binary files /dev/null and b/mods/default/textures/bubble.png differ diff --git a/mods/default/textures/crack_anylength.png b/mods/default/textures/crack_anylength.png new file mode 100644 index 0000000..297eced Binary files /dev/null and b/mods/default/textures/crack_anylength.png differ diff --git a/mods/default/textures/default_acacia_bush_stem.png b/mods/default/textures/default_acacia_bush_stem.png new file mode 100644 index 0000000..2903915 Binary files /dev/null and b/mods/default/textures/default_acacia_bush_stem.png differ diff --git a/mods/default/textures/default_acacia_leaves.png b/mods/default/textures/default_acacia_leaves.png new file mode 100644 index 0000000..626e1b3 Binary files /dev/null and b/mods/default/textures/default_acacia_leaves.png differ diff --git a/mods/default/textures/default_acacia_leaves_simple.png b/mods/default/textures/default_acacia_leaves_simple.png new file mode 100644 index 0000000..3c7015b Binary files /dev/null and b/mods/default/textures/default_acacia_leaves_simple.png differ diff --git a/mods/default/textures/default_acacia_sapling.png b/mods/default/textures/default_acacia_sapling.png new file mode 100644 index 0000000..07170a0 Binary files /dev/null and b/mods/default/textures/default_acacia_sapling.png differ diff --git a/mods/default/textures/default_acacia_tree.png b/mods/default/textures/default_acacia_tree.png new file mode 100644 index 0000000..58bb3c4 Binary files /dev/null and b/mods/default/textures/default_acacia_tree.png differ diff --git a/mods/default/textures/default_acacia_tree_top.png b/mods/default/textures/default_acacia_tree_top.png new file mode 100644 index 0000000..a8a0ce0 Binary files /dev/null and b/mods/default/textures/default_acacia_tree_top.png differ diff --git a/mods/default/textures/default_acacia_wood.png b/mods/default/textures/default_acacia_wood.png new file mode 100644 index 0000000..b5abf1e Binary files /dev/null and b/mods/default/textures/default_acacia_wood.png differ diff --git a/mods/default/textures/default_apple.png b/mods/default/textures/default_apple.png new file mode 100644 index 0000000..7549bfd Binary files /dev/null and b/mods/default/textures/default_apple.png differ diff --git a/mods/default/textures/default_aspen_leaves.png b/mods/default/textures/default_aspen_leaves.png new file mode 100644 index 0000000..17a708d Binary files /dev/null and b/mods/default/textures/default_aspen_leaves.png differ diff --git a/mods/default/textures/default_aspen_sapling.png b/mods/default/textures/default_aspen_sapling.png new file mode 100644 index 0000000..f8d9136 Binary files /dev/null and b/mods/default/textures/default_aspen_sapling.png differ diff --git a/mods/default/textures/default_aspen_tree.png b/mods/default/textures/default_aspen_tree.png new file mode 100644 index 0000000..cfb05fc Binary files /dev/null and b/mods/default/textures/default_aspen_tree.png differ diff --git a/mods/default/textures/default_aspen_tree_top.png b/mods/default/textures/default_aspen_tree_top.png new file mode 100644 index 0000000..fcca038 Binary files /dev/null and b/mods/default/textures/default_aspen_tree_top.png differ diff --git a/mods/default/textures/default_aspen_wood.png b/mods/default/textures/default_aspen_wood.png new file mode 100644 index 0000000..2b584b3 Binary files /dev/null and b/mods/default/textures/default_aspen_wood.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png new file mode 100644 index 0000000..15af2b6 Binary files /dev/null and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_book_written.png b/mods/default/textures/default_book_written.png new file mode 100644 index 0000000..d843e5f Binary files /dev/null and b/mods/default/textures/default_book_written.png differ diff --git a/mods/default/textures/default_bookshelf.png b/mods/default/textures/default_bookshelf.png new file mode 100644 index 0000000..10d6483 Binary files /dev/null and b/mods/default/textures/default_bookshelf.png differ diff --git a/mods/default/textures/default_bookshelf_slot.png b/mods/default/textures/default_bookshelf_slot.png new file mode 100644 index 0000000..31c4eb5 Binary files /dev/null and b/mods/default/textures/default_bookshelf_slot.png differ diff --git a/mods/default/textures/default_brick.png b/mods/default/textures/default_brick.png new file mode 100644 index 0000000..ab19121 Binary files /dev/null and b/mods/default/textures/default_brick.png differ diff --git a/mods/default/textures/default_bronze_block.png b/mods/default/textures/default_bronze_block.png new file mode 100644 index 0000000..1d0c9d5 Binary files /dev/null and b/mods/default/textures/default_bronze_block.png differ diff --git a/mods/default/textures/default_bronze_ingot.png b/mods/default/textures/default_bronze_ingot.png new file mode 100644 index 0000000..6cccdf6 Binary files /dev/null and b/mods/default/textures/default_bronze_ingot.png differ diff --git a/mods/default/textures/default_bush_stem.png b/mods/default/textures/default_bush_stem.png new file mode 100644 index 0000000..18b615f Binary files /dev/null and b/mods/default/textures/default_bush_stem.png differ diff --git a/mods/default/textures/default_cactus_side.png b/mods/default/textures/default_cactus_side.png new file mode 100644 index 0000000..8d6c40c Binary files /dev/null and b/mods/default/textures/default_cactus_side.png differ diff --git a/mods/default/textures/default_cactus_top.png b/mods/default/textures/default_cactus_top.png new file mode 100644 index 0000000..cf46aa2 Binary files /dev/null and b/mods/default/textures/default_cactus_top.png differ diff --git a/mods/default/textures/default_chest_front.png b/mods/default/textures/default_chest_front.png new file mode 100644 index 0000000..85227d8 Binary files /dev/null and b/mods/default/textures/default_chest_front.png differ diff --git a/mods/default/textures/default_chest_lock.png b/mods/default/textures/default_chest_lock.png new file mode 100644 index 0000000..73f46c7 Binary files /dev/null and b/mods/default/textures/default_chest_lock.png differ diff --git a/mods/default/textures/default_chest_side.png b/mods/default/textures/default_chest_side.png new file mode 100644 index 0000000..44a65a4 Binary files /dev/null and b/mods/default/textures/default_chest_side.png differ diff --git a/mods/default/textures/default_chest_top.png b/mods/default/textures/default_chest_top.png new file mode 100644 index 0000000..f1a5cb5 Binary files /dev/null and b/mods/default/textures/default_chest_top.png differ diff --git a/mods/default/textures/default_clay.png b/mods/default/textures/default_clay.png new file mode 100644 index 0000000..76e5a40 Binary files /dev/null and b/mods/default/textures/default_clay.png differ diff --git a/mods/default/textures/default_clay_brick.png b/mods/default/textures/default_clay_brick.png new file mode 100644 index 0000000..dc7a431 Binary files /dev/null and b/mods/default/textures/default_clay_brick.png differ diff --git a/mods/default/textures/default_clay_lump.png b/mods/default/textures/default_clay_lump.png new file mode 100644 index 0000000..c1d0220 Binary files /dev/null and b/mods/default/textures/default_clay_lump.png differ diff --git a/mods/default/textures/default_cloud.png b/mods/default/textures/default_cloud.png new file mode 100644 index 0000000..faf0ec1 Binary files /dev/null and b/mods/default/textures/default_cloud.png differ diff --git a/mods/default/textures/default_coal_block.png b/mods/default/textures/default_coal_block.png new file mode 100644 index 0000000..6fe9ed9 Binary files /dev/null and b/mods/default/textures/default_coal_block.png differ diff --git a/mods/default/textures/default_coal_lump.png b/mods/default/textures/default_coal_lump.png new file mode 100644 index 0000000..792961d Binary files /dev/null and b/mods/default/textures/default_coal_lump.png differ diff --git a/mods/default/textures/default_cobble.png b/mods/default/textures/default_cobble.png new file mode 100644 index 0000000..d379840 Binary files /dev/null and b/mods/default/textures/default_cobble.png differ diff --git a/mods/default/textures/default_copper_block.png b/mods/default/textures/default_copper_block.png new file mode 100644 index 0000000..8533754 Binary files /dev/null and b/mods/default/textures/default_copper_block.png differ diff --git a/mods/default/textures/default_copper_ingot.png b/mods/default/textures/default_copper_ingot.png new file mode 100644 index 0000000..bcad9c0 Binary files /dev/null and b/mods/default/textures/default_copper_ingot.png differ diff --git a/mods/default/textures/default_copper_lump.png b/mods/default/textures/default_copper_lump.png new file mode 100644 index 0000000..998c592 Binary files /dev/null and b/mods/default/textures/default_copper_lump.png differ diff --git a/mods/default/textures/default_coral_brown.png b/mods/default/textures/default_coral_brown.png new file mode 100644 index 0000000..8a775fe Binary files /dev/null and b/mods/default/textures/default_coral_brown.png differ diff --git a/mods/default/textures/default_coral_orange.png b/mods/default/textures/default_coral_orange.png new file mode 100644 index 0000000..cefac62 Binary files /dev/null and b/mods/default/textures/default_coral_orange.png differ diff --git a/mods/default/textures/default_coral_skeleton.png b/mods/default/textures/default_coral_skeleton.png new file mode 100644 index 0000000..fa48f15 Binary files /dev/null and b/mods/default/textures/default_coral_skeleton.png differ diff --git a/mods/default/textures/default_desert_cobble.png b/mods/default/textures/default_desert_cobble.png new file mode 100644 index 0000000..184a9d8 Binary files /dev/null and b/mods/default/textures/default_desert_cobble.png differ diff --git a/mods/default/textures/default_desert_sand.png b/mods/default/textures/default_desert_sand.png new file mode 100644 index 0000000..371b8c7 Binary files /dev/null and b/mods/default/textures/default_desert_sand.png differ diff --git a/mods/default/textures/default_desert_stone.png b/mods/default/textures/default_desert_stone.png new file mode 100644 index 0000000..5d3aded Binary files /dev/null and b/mods/default/textures/default_desert_stone.png differ diff --git a/mods/default/textures/default_desert_stone_block.png b/mods/default/textures/default_desert_stone_block.png new file mode 100644 index 0000000..9eb8e92 Binary files /dev/null and b/mods/default/textures/default_desert_stone_block.png differ diff --git a/mods/default/textures/default_desert_stone_brick.png b/mods/default/textures/default_desert_stone_brick.png new file mode 100644 index 0000000..a603d18 Binary files /dev/null and b/mods/default/textures/default_desert_stone_brick.png differ diff --git a/mods/default/textures/default_diamond.png b/mods/default/textures/default_diamond.png new file mode 100644 index 0000000..a8dac74 Binary files /dev/null and b/mods/default/textures/default_diamond.png differ diff --git a/mods/default/textures/default_diamond_block.png b/mods/default/textures/default_diamond_block.png new file mode 100644 index 0000000..20c33ed Binary files /dev/null and b/mods/default/textures/default_diamond_block.png differ diff --git a/mods/default/textures/default_dirt.png b/mods/default/textures/default_dirt.png new file mode 100644 index 0000000..ca7e4ae Binary files /dev/null and b/mods/default/textures/default_dirt.png differ diff --git a/mods/default/textures/default_dry_grass.png b/mods/default/textures/default_dry_grass.png new file mode 100644 index 0000000..03455c3 Binary files /dev/null and b/mods/default/textures/default_dry_grass.png differ diff --git a/mods/default/textures/default_dry_grass_1.png b/mods/default/textures/default_dry_grass_1.png new file mode 100644 index 0000000..5cf68a3 Binary files /dev/null and b/mods/default/textures/default_dry_grass_1.png differ diff --git a/mods/default/textures/default_dry_grass_2.png b/mods/default/textures/default_dry_grass_2.png new file mode 100644 index 0000000..c925ace Binary files /dev/null and b/mods/default/textures/default_dry_grass_2.png differ diff --git a/mods/default/textures/default_dry_grass_3.png b/mods/default/textures/default_dry_grass_3.png new file mode 100644 index 0000000..4e4d84e Binary files /dev/null and b/mods/default/textures/default_dry_grass_3.png differ diff --git a/mods/default/textures/default_dry_grass_4.png b/mods/default/textures/default_dry_grass_4.png new file mode 100644 index 0000000..d315849 Binary files /dev/null and b/mods/default/textures/default_dry_grass_4.png differ diff --git a/mods/default/textures/default_dry_grass_5.png b/mods/default/textures/default_dry_grass_5.png new file mode 100644 index 0000000..871d04c Binary files /dev/null and b/mods/default/textures/default_dry_grass_5.png differ diff --git a/mods/default/textures/default_dry_grass_side.png b/mods/default/textures/default_dry_grass_side.png new file mode 100644 index 0000000..ef375b7 Binary files /dev/null and b/mods/default/textures/default_dry_grass_side.png differ diff --git a/mods/default/textures/default_dry_shrub.png b/mods/default/textures/default_dry_shrub.png new file mode 100644 index 0000000..e8a7f27 Binary files /dev/null and b/mods/default/textures/default_dry_shrub.png differ diff --git a/mods/default/textures/default_fence_acacia_wood.png b/mods/default/textures/default_fence_acacia_wood.png new file mode 100644 index 0000000..3b973f3 Binary files /dev/null and b/mods/default/textures/default_fence_acacia_wood.png differ diff --git a/mods/default/textures/default_fence_aspen_wood.png b/mods/default/textures/default_fence_aspen_wood.png new file mode 100644 index 0000000..0a6558e Binary files /dev/null and b/mods/default/textures/default_fence_aspen_wood.png differ diff --git a/mods/default/textures/default_fence_junglewood.png b/mods/default/textures/default_fence_junglewood.png new file mode 100644 index 0000000..c390941 Binary files /dev/null and b/mods/default/textures/default_fence_junglewood.png differ diff --git a/mods/default/textures/default_fence_overlay.png b/mods/default/textures/default_fence_overlay.png new file mode 100644 index 0000000..718184c Binary files /dev/null and b/mods/default/textures/default_fence_overlay.png differ diff --git a/mods/default/textures/default_fence_pine_wood.png b/mods/default/textures/default_fence_pine_wood.png new file mode 100644 index 0000000..74609d9 Binary files /dev/null and b/mods/default/textures/default_fence_pine_wood.png differ diff --git a/mods/default/textures/default_fence_wood.png b/mods/default/textures/default_fence_wood.png new file mode 100644 index 0000000..1e76430 Binary files /dev/null and b/mods/default/textures/default_fence_wood.png differ diff --git a/mods/default/textures/default_flint.png b/mods/default/textures/default_flint.png new file mode 100644 index 0000000..226c740 Binary files /dev/null and b/mods/default/textures/default_flint.png differ diff --git a/mods/default/textures/default_footprint.png b/mods/default/textures/default_footprint.png new file mode 100644 index 0000000..41d9546 Binary files /dev/null and b/mods/default/textures/default_footprint.png differ diff --git a/mods/default/textures/default_furnace_bottom.png b/mods/default/textures/default_furnace_bottom.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_bottom.png differ diff --git a/mods/default/textures/default_furnace_fire_bg.png b/mods/default/textures/default_furnace_fire_bg.png new file mode 100644 index 0000000..126204a Binary files /dev/null and b/mods/default/textures/default_furnace_fire_bg.png differ diff --git a/mods/default/textures/default_furnace_fire_fg.png b/mods/default/textures/default_furnace_fire_fg.png new file mode 100644 index 0000000..63888f3 Binary files /dev/null and b/mods/default/textures/default_furnace_fire_fg.png differ diff --git a/mods/default/textures/default_furnace_front.png b/mods/default/textures/default_furnace_front.png new file mode 100644 index 0000000..8c1798e Binary files /dev/null and b/mods/default/textures/default_furnace_front.png differ diff --git a/mods/default/textures/default_furnace_front_active.png b/mods/default/textures/default_furnace_front_active.png new file mode 100644 index 0000000..ea43ed9 Binary files /dev/null and b/mods/default/textures/default_furnace_front_active.png differ diff --git a/mods/default/textures/default_furnace_side.png b/mods/default/textures/default_furnace_side.png new file mode 100644 index 0000000..33408cf Binary files /dev/null and b/mods/default/textures/default_furnace_side.png differ diff --git a/mods/default/textures/default_furnace_top.png b/mods/default/textures/default_furnace_top.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_top.png differ diff --git a/mods/default/textures/default_glass.png b/mods/default/textures/default_glass.png new file mode 100644 index 0000000..da25402 Binary files /dev/null and b/mods/default/textures/default_glass.png differ diff --git a/mods/default/textures/default_glass_detail.png b/mods/default/textures/default_glass_detail.png new file mode 100644 index 0000000..d38dbb7 Binary files /dev/null and b/mods/default/textures/default_glass_detail.png differ diff --git a/mods/default/textures/default_gold_block.png b/mods/default/textures/default_gold_block.png new file mode 100644 index 0000000..170d50b Binary files /dev/null and b/mods/default/textures/default_gold_block.png differ diff --git a/mods/default/textures/default_gold_ingot.png b/mods/default/textures/default_gold_ingot.png new file mode 100644 index 0000000..ba66471 Binary files /dev/null and b/mods/default/textures/default_gold_ingot.png differ diff --git a/mods/default/textures/default_gold_lump.png b/mods/default/textures/default_gold_lump.png new file mode 100644 index 0000000..d5a1be7 Binary files /dev/null and b/mods/default/textures/default_gold_lump.png differ diff --git a/mods/default/textures/default_grass.png b/mods/default/textures/default_grass.png new file mode 100644 index 0000000..0181fab Binary files /dev/null and b/mods/default/textures/default_grass.png differ diff --git a/mods/default/textures/default_grass_1.png b/mods/default/textures/default_grass_1.png new file mode 100644 index 0000000..e9faa2c Binary files /dev/null and b/mods/default/textures/default_grass_1.png differ diff --git a/mods/default/textures/default_grass_2.png b/mods/default/textures/default_grass_2.png new file mode 100644 index 0000000..03729a0 Binary files /dev/null and b/mods/default/textures/default_grass_2.png differ diff --git a/mods/default/textures/default_grass_3.png b/mods/default/textures/default_grass_3.png new file mode 100644 index 0000000..92ca1b5 Binary files /dev/null and b/mods/default/textures/default_grass_3.png differ diff --git a/mods/default/textures/default_grass_4.png b/mods/default/textures/default_grass_4.png new file mode 100644 index 0000000..c782a33 Binary files /dev/null and b/mods/default/textures/default_grass_4.png differ diff --git a/mods/default/textures/default_grass_5.png b/mods/default/textures/default_grass_5.png new file mode 100644 index 0000000..b727e9c Binary files /dev/null and b/mods/default/textures/default_grass_5.png differ diff --git a/mods/default/textures/default_grass_side.png b/mods/default/textures/default_grass_side.png new file mode 100644 index 0000000..bfd538d Binary files /dev/null and b/mods/default/textures/default_grass_side.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png new file mode 100644 index 0000000..8852d38 Binary files /dev/null and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_ice.png b/mods/default/textures/default_ice.png new file mode 100644 index 0000000..2874e1e Binary files /dev/null and b/mods/default/textures/default_ice.png differ diff --git a/mods/default/textures/default_iron_lump.png b/mods/default/textures/default_iron_lump.png new file mode 100644 index 0000000..db61a94 Binary files /dev/null and b/mods/default/textures/default_iron_lump.png differ diff --git a/mods/default/textures/default_item_smoke.png b/mods/default/textures/default_item_smoke.png new file mode 100644 index 0000000..d62fb3b Binary files /dev/null and b/mods/default/textures/default_item_smoke.png differ diff --git a/mods/default/textures/default_junglegrass.png b/mods/default/textures/default_junglegrass.png new file mode 100644 index 0000000..25abb71 Binary files /dev/null and b/mods/default/textures/default_junglegrass.png differ diff --git a/mods/default/textures/default_jungleleaves.png b/mods/default/textures/default_jungleleaves.png new file mode 100644 index 0000000..5afcc36 Binary files /dev/null and b/mods/default/textures/default_jungleleaves.png differ diff --git a/mods/default/textures/default_jungleleaves_simple.png b/mods/default/textures/default_jungleleaves_simple.png new file mode 100644 index 0000000..7165100 Binary files /dev/null and b/mods/default/textures/default_jungleleaves_simple.png differ diff --git a/mods/default/textures/default_junglesapling.png b/mods/default/textures/default_junglesapling.png new file mode 100644 index 0000000..05e1e50 Binary files /dev/null and b/mods/default/textures/default_junglesapling.png differ diff --git a/mods/default/textures/default_jungletree.png b/mods/default/textures/default_jungletree.png new file mode 100644 index 0000000..2cf77a6 Binary files /dev/null and b/mods/default/textures/default_jungletree.png differ diff --git a/mods/default/textures/default_jungletree_top.png b/mods/default/textures/default_jungletree_top.png new file mode 100644 index 0000000..439f078 Binary files /dev/null and b/mods/default/textures/default_jungletree_top.png differ diff --git a/mods/default/textures/default_junglewood.png b/mods/default/textures/default_junglewood.png new file mode 100644 index 0000000..8d17917 Binary files /dev/null and b/mods/default/textures/default_junglewood.png differ diff --git a/mods/default/textures/default_key.png b/mods/default/textures/default_key.png new file mode 100644 index 0000000..783d313 Binary files /dev/null and b/mods/default/textures/default_key.png differ diff --git a/mods/default/textures/default_key_skeleton.png b/mods/default/textures/default_key_skeleton.png new file mode 100644 index 0000000..2b3497d Binary files /dev/null and b/mods/default/textures/default_key_skeleton.png differ diff --git a/mods/default/textures/default_ladder_steel.png b/mods/default/textures/default_ladder_steel.png new file mode 100644 index 0000000..a312f3e Binary files /dev/null and b/mods/default/textures/default_ladder_steel.png differ diff --git a/mods/default/textures/default_ladder_wood.png b/mods/default/textures/default_ladder_wood.png new file mode 100644 index 0000000..c167fff Binary files /dev/null and b/mods/default/textures/default_ladder_wood.png differ diff --git a/mods/default/textures/default_lava.png b/mods/default/textures/default_lava.png new file mode 100644 index 0000000..e8958de Binary files /dev/null and b/mods/default/textures/default_lava.png differ diff --git a/mods/default/textures/default_lava_flowing_animated.png b/mods/default/textures/default_lava_flowing_animated.png new file mode 100644 index 0000000..2ec0746 Binary files /dev/null and b/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/mods/default/textures/default_lava_source_animated.png b/mods/default/textures/default_lava_source_animated.png new file mode 100644 index 0000000..32267a6 Binary files /dev/null and b/mods/default/textures/default_lava_source_animated.png differ diff --git a/mods/default/textures/default_leaves.png b/mods/default/textures/default_leaves.png new file mode 100644 index 0000000..ba09fe1 Binary files /dev/null and b/mods/default/textures/default_leaves.png differ diff --git a/mods/default/textures/default_leaves_simple.png b/mods/default/textures/default_leaves_simple.png new file mode 100644 index 0000000..eb60f9f Binary files /dev/null and b/mods/default/textures/default_leaves_simple.png differ diff --git a/mods/default/textures/default_mese_block.png b/mods/default/textures/default_mese_block.png new file mode 100644 index 0000000..e30994e Binary files /dev/null and b/mods/default/textures/default_mese_block.png differ diff --git a/mods/default/textures/default_mese_crystal.png b/mods/default/textures/default_mese_crystal.png new file mode 100644 index 0000000..f1d71f1 Binary files /dev/null and b/mods/default/textures/default_mese_crystal.png differ diff --git a/mods/default/textures/default_mese_crystal_fragment.png b/mods/default/textures/default_mese_crystal_fragment.png new file mode 100644 index 0000000..d5416ab Binary files /dev/null and b/mods/default/textures/default_mese_crystal_fragment.png differ diff --git a/mods/default/textures/default_meselamp.png b/mods/default/textures/default_meselamp.png new file mode 100644 index 0000000..0c3a1a1 Binary files /dev/null and b/mods/default/textures/default_meselamp.png differ diff --git a/mods/default/textures/default_mineral_coal.png b/mods/default/textures/default_mineral_coal.png new file mode 100644 index 0000000..6d1386b Binary files /dev/null and b/mods/default/textures/default_mineral_coal.png differ diff --git a/mods/default/textures/default_mineral_copper.png b/mods/default/textures/default_mineral_copper.png new file mode 100644 index 0000000..c4c518e Binary files /dev/null and b/mods/default/textures/default_mineral_copper.png differ diff --git a/mods/default/textures/default_mineral_diamond.png b/mods/default/textures/default_mineral_diamond.png new file mode 100644 index 0000000..39c0f83 Binary files /dev/null and b/mods/default/textures/default_mineral_diamond.png differ diff --git a/mods/default/textures/default_mineral_gold.png b/mods/default/textures/default_mineral_gold.png new file mode 100644 index 0000000..2220add Binary files /dev/null and b/mods/default/textures/default_mineral_gold.png differ diff --git a/mods/default/textures/default_mineral_iron.png b/mods/default/textures/default_mineral_iron.png new file mode 100644 index 0000000..bfec8b1 Binary files /dev/null and b/mods/default/textures/default_mineral_iron.png differ diff --git a/mods/default/textures/default_mineral_mese.png b/mods/default/textures/default_mineral_mese.png new file mode 100644 index 0000000..6952670 Binary files /dev/null and b/mods/default/textures/default_mineral_mese.png differ diff --git a/mods/default/textures/default_mossycobble.png b/mods/default/textures/default_mossycobble.png new file mode 100644 index 0000000..1ae7c91 Binary files /dev/null and b/mods/default/textures/default_mossycobble.png differ diff --git a/mods/default/textures/default_obsidian.png b/mods/default/textures/default_obsidian.png new file mode 100644 index 0000000..8f4a49c Binary files /dev/null and b/mods/default/textures/default_obsidian.png differ diff --git a/mods/default/textures/default_obsidian_block.png b/mods/default/textures/default_obsidian_block.png new file mode 100644 index 0000000..7e1d4d3 Binary files /dev/null and b/mods/default/textures/default_obsidian_block.png differ diff --git a/mods/default/textures/default_obsidian_brick.png b/mods/default/textures/default_obsidian_brick.png new file mode 100644 index 0000000..30c67ca Binary files /dev/null and b/mods/default/textures/default_obsidian_brick.png differ diff --git a/mods/default/textures/default_obsidian_glass.png b/mods/default/textures/default_obsidian_glass.png new file mode 100644 index 0000000..d5ac83d Binary files /dev/null and b/mods/default/textures/default_obsidian_glass.png differ diff --git a/mods/default/textures/default_obsidian_glass_detail.png b/mods/default/textures/default_obsidian_glass_detail.png new file mode 100644 index 0000000..a8bbec9 Binary files /dev/null and b/mods/default/textures/default_obsidian_glass_detail.png differ diff --git a/mods/default/textures/default_obsidian_shard.png b/mods/default/textures/default_obsidian_shard.png new file mode 100644 index 0000000..a988d8c Binary files /dev/null and b/mods/default/textures/default_obsidian_shard.png differ diff --git a/mods/default/textures/default_paper.png b/mods/default/textures/default_paper.png new file mode 100644 index 0000000..8f23924 Binary files /dev/null and b/mods/default/textures/default_paper.png differ diff --git a/mods/default/textures/default_papyrus.png b/mods/default/textures/default_papyrus.png new file mode 100644 index 0000000..a85e809 Binary files /dev/null and b/mods/default/textures/default_papyrus.png differ diff --git a/mods/default/textures/default_pine_needles.png b/mods/default/textures/default_pine_needles.png new file mode 100644 index 0000000..ad7373b Binary files /dev/null and b/mods/default/textures/default_pine_needles.png differ diff --git a/mods/default/textures/default_pine_sapling.png b/mods/default/textures/default_pine_sapling.png new file mode 100644 index 0000000..c30131d Binary files /dev/null and b/mods/default/textures/default_pine_sapling.png differ diff --git a/mods/default/textures/default_pine_tree.png b/mods/default/textures/default_pine_tree.png new file mode 100644 index 0000000..4a5328f Binary files /dev/null and b/mods/default/textures/default_pine_tree.png differ diff --git a/mods/default/textures/default_pine_tree_top.png b/mods/default/textures/default_pine_tree_top.png new file mode 100644 index 0000000..8705710 Binary files /dev/null and b/mods/default/textures/default_pine_tree_top.png differ diff --git a/mods/default/textures/default_pine_wood.png b/mods/default/textures/default_pine_wood.png new file mode 100644 index 0000000..6844ceb Binary files /dev/null and b/mods/default/textures/default_pine_wood.png differ diff --git a/mods/default/textures/default_river_water.png b/mods/default/textures/default_river_water.png new file mode 100644 index 0000000..3b55c5f Binary files /dev/null and b/mods/default/textures/default_river_water.png differ diff --git a/mods/default/textures/default_river_water_flowing_animated.png b/mods/default/textures/default_river_water_flowing_animated.png new file mode 100644 index 0000000..536acc5 Binary files /dev/null and b/mods/default/textures/default_river_water_flowing_animated.png differ diff --git a/mods/default/textures/default_river_water_source_animated.png b/mods/default/textures/default_river_water_source_animated.png new file mode 100644 index 0000000..daa5653 Binary files /dev/null and b/mods/default/textures/default_river_water_source_animated.png differ diff --git a/mods/default/textures/default_sand.png b/mods/default/textures/default_sand.png new file mode 100644 index 0000000..645a300 Binary files /dev/null and b/mods/default/textures/default_sand.png differ diff --git a/mods/default/textures/default_sandstone.png b/mods/default/textures/default_sandstone.png new file mode 100644 index 0000000..16e3d13 Binary files /dev/null and b/mods/default/textures/default_sandstone.png differ diff --git a/mods/default/textures/default_sandstone_block.png b/mods/default/textures/default_sandstone_block.png new file mode 100644 index 0000000..2e06491 Binary files /dev/null and b/mods/default/textures/default_sandstone_block.png differ diff --git a/mods/default/textures/default_sandstone_brick.png b/mods/default/textures/default_sandstone_brick.png new file mode 100644 index 0000000..e7150e5 Binary files /dev/null and b/mods/default/textures/default_sandstone_brick.png differ diff --git a/mods/default/textures/default_sapling.png b/mods/default/textures/default_sapling.png new file mode 100644 index 0000000..3fd64f0 Binary files /dev/null and b/mods/default/textures/default_sapling.png differ diff --git a/mods/default/textures/default_sign_steel.png b/mods/default/textures/default_sign_steel.png new file mode 100644 index 0000000..3ca0c59 Binary files /dev/null and b/mods/default/textures/default_sign_steel.png differ diff --git a/mods/default/textures/default_sign_wall_steel.png b/mods/default/textures/default_sign_wall_steel.png new file mode 100644 index 0000000..2227477 Binary files /dev/null and b/mods/default/textures/default_sign_wall_steel.png differ diff --git a/mods/default/textures/default_sign_wall_wood.png b/mods/default/textures/default_sign_wall_wood.png new file mode 100644 index 0000000..40552c7 Binary files /dev/null and b/mods/default/textures/default_sign_wall_wood.png differ diff --git a/mods/default/textures/default_sign_wood.png b/mods/default/textures/default_sign_wood.png new file mode 100644 index 0000000..d0559da Binary files /dev/null and b/mods/default/textures/default_sign_wood.png differ diff --git a/mods/default/textures/default_silver_sand.png b/mods/default/textures/default_silver_sand.png new file mode 100644 index 0000000..c4a8f73 Binary files /dev/null and b/mods/default/textures/default_silver_sand.png differ diff --git a/mods/default/textures/default_snow.png b/mods/default/textures/default_snow.png new file mode 100644 index 0000000..4ac3593 Binary files /dev/null and b/mods/default/textures/default_snow.png differ diff --git a/mods/default/textures/default_snow_side.png b/mods/default/textures/default_snow_side.png new file mode 100644 index 0000000..03456c8 Binary files /dev/null and b/mods/default/textures/default_snow_side.png differ diff --git a/mods/default/textures/default_snowball.png b/mods/default/textures/default_snowball.png new file mode 100644 index 0000000..3a4dc1f Binary files /dev/null and b/mods/default/textures/default_snowball.png differ diff --git a/mods/default/textures/default_steel_block.png b/mods/default/textures/default_steel_block.png new file mode 100644 index 0000000..7f49f61 Binary files /dev/null and b/mods/default/textures/default_steel_block.png differ diff --git a/mods/default/textures/default_steel_ingot.png b/mods/default/textures/default_steel_ingot.png new file mode 100644 index 0000000..8100b01 Binary files /dev/null and b/mods/default/textures/default_steel_ingot.png differ diff --git a/mods/default/textures/default_stick.png b/mods/default/textures/default_stick.png new file mode 100644 index 0000000..0378d07 Binary files /dev/null and b/mods/default/textures/default_stick.png differ diff --git a/mods/default/textures/default_stone.png b/mods/default/textures/default_stone.png new file mode 100644 index 0000000..63cb7c4 Binary files /dev/null and b/mods/default/textures/default_stone.png differ diff --git a/mods/default/textures/default_stone_block.png b/mods/default/textures/default_stone_block.png new file mode 100644 index 0000000..3b771e7 Binary files /dev/null and b/mods/default/textures/default_stone_block.png differ diff --git a/mods/default/textures/default_stone_brick.png b/mods/default/textures/default_stone_brick.png new file mode 100644 index 0000000..4dbb49d Binary files /dev/null and b/mods/default/textures/default_stone_brick.png differ diff --git a/mods/default/textures/default_tool_bronzeaxe.png b/mods/default/textures/default_tool_bronzeaxe.png new file mode 100644 index 0000000..8ae43b5 Binary files /dev/null and b/mods/default/textures/default_tool_bronzeaxe.png differ diff --git a/mods/default/textures/default_tool_bronzepick.png b/mods/default/textures/default_tool_bronzepick.png new file mode 100644 index 0000000..c88a5f0 Binary files /dev/null and b/mods/default/textures/default_tool_bronzepick.png differ diff --git a/mods/default/textures/default_tool_bronzeshovel.png b/mods/default/textures/default_tool_bronzeshovel.png new file mode 100644 index 0000000..d7d800e Binary files /dev/null and b/mods/default/textures/default_tool_bronzeshovel.png differ diff --git a/mods/default/textures/default_tool_bronzesword.png b/mods/default/textures/default_tool_bronzesword.png new file mode 100644 index 0000000..cdab898 Binary files /dev/null and b/mods/default/textures/default_tool_bronzesword.png differ diff --git a/mods/default/textures/default_tool_diamondaxe.png b/mods/default/textures/default_tool_diamondaxe.png new file mode 100644 index 0000000..e32a0bf Binary files /dev/null and b/mods/default/textures/default_tool_diamondaxe.png differ diff --git a/mods/default/textures/default_tool_diamondpick.png b/mods/default/textures/default_tool_diamondpick.png new file mode 100644 index 0000000..f9883c6 Binary files /dev/null and b/mods/default/textures/default_tool_diamondpick.png differ diff --git a/mods/default/textures/default_tool_diamondshovel.png b/mods/default/textures/default_tool_diamondshovel.png new file mode 100644 index 0000000..d0fe24d Binary files /dev/null and b/mods/default/textures/default_tool_diamondshovel.png differ diff --git a/mods/default/textures/default_tool_diamondsword.png b/mods/default/textures/default_tool_diamondsword.png new file mode 100644 index 0000000..dbccd0e Binary files /dev/null and b/mods/default/textures/default_tool_diamondsword.png differ diff --git a/mods/default/textures/default_tool_meseaxe.png b/mods/default/textures/default_tool_meseaxe.png new file mode 100644 index 0000000..c01fb4f Binary files /dev/null and b/mods/default/textures/default_tool_meseaxe.png differ diff --git a/mods/default/textures/default_tool_mesepick.png b/mods/default/textures/default_tool_mesepick.png new file mode 100644 index 0000000..1b2e25b Binary files /dev/null and b/mods/default/textures/default_tool_mesepick.png differ diff --git a/mods/default/textures/default_tool_meseshovel.png b/mods/default/textures/default_tool_meseshovel.png new file mode 100644 index 0000000..00813a2 Binary files /dev/null and b/mods/default/textures/default_tool_meseshovel.png differ diff --git a/mods/default/textures/default_tool_mesesword.png b/mods/default/textures/default_tool_mesesword.png new file mode 100644 index 0000000..d395d3a Binary files /dev/null and b/mods/default/textures/default_tool_mesesword.png differ diff --git a/mods/default/textures/default_tool_steelaxe.png b/mods/default/textures/default_tool_steelaxe.png new file mode 100644 index 0000000..1528cad Binary files /dev/null and b/mods/default/textures/default_tool_steelaxe.png differ diff --git a/mods/default/textures/default_tool_steelpick.png b/mods/default/textures/default_tool_steelpick.png new file mode 100644 index 0000000..a7543a1 Binary files /dev/null and b/mods/default/textures/default_tool_steelpick.png differ diff --git a/mods/default/textures/default_tool_steelshovel.png b/mods/default/textures/default_tool_steelshovel.png new file mode 100644 index 0000000..65e4045 Binary files /dev/null and b/mods/default/textures/default_tool_steelshovel.png differ diff --git a/mods/default/textures/default_tool_steelsword.png b/mods/default/textures/default_tool_steelsword.png new file mode 100644 index 0000000..630a339 Binary files /dev/null and b/mods/default/textures/default_tool_steelsword.png differ diff --git a/mods/default/textures/default_tool_stoneaxe.png b/mods/default/textures/default_tool_stoneaxe.png new file mode 100644 index 0000000..cc36054 Binary files /dev/null and b/mods/default/textures/default_tool_stoneaxe.png differ diff --git a/mods/default/textures/default_tool_stonepick.png b/mods/default/textures/default_tool_stonepick.png new file mode 100644 index 0000000..237d739 Binary files /dev/null and b/mods/default/textures/default_tool_stonepick.png differ diff --git a/mods/default/textures/default_tool_stoneshovel.png b/mods/default/textures/default_tool_stoneshovel.png new file mode 100644 index 0000000..11711bd Binary files /dev/null and b/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/mods/default/textures/default_tool_stonesword.png b/mods/default/textures/default_tool_stonesword.png new file mode 100644 index 0000000..1a493ac Binary files /dev/null and b/mods/default/textures/default_tool_stonesword.png differ diff --git a/mods/default/textures/default_tool_woodaxe.png b/mods/default/textures/default_tool_woodaxe.png new file mode 100644 index 0000000..68f1fd8 Binary files /dev/null and b/mods/default/textures/default_tool_woodaxe.png differ diff --git a/mods/default/textures/default_tool_woodpick.png b/mods/default/textures/default_tool_woodpick.png new file mode 100644 index 0000000..0aed583 Binary files /dev/null and b/mods/default/textures/default_tool_woodpick.png differ diff --git a/mods/default/textures/default_tool_woodshovel.png b/mods/default/textures/default_tool_woodshovel.png new file mode 100644 index 0000000..dcef2b5 Binary files /dev/null and b/mods/default/textures/default_tool_woodshovel.png differ diff --git a/mods/default/textures/default_tool_woodsword.png b/mods/default/textures/default_tool_woodsword.png new file mode 100644 index 0000000..c78ba50 Binary files /dev/null and b/mods/default/textures/default_tool_woodsword.png differ diff --git a/mods/default/textures/default_torch_animated.png b/mods/default/textures/default_torch_animated.png new file mode 100644 index 0000000..cdf33ef Binary files /dev/null and b/mods/default/textures/default_torch_animated.png differ diff --git a/mods/default/textures/default_torch_on_ceiling_animated.png b/mods/default/textures/default_torch_on_ceiling_animated.png new file mode 100644 index 0000000..3a8b5ad Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling_animated.png differ diff --git a/mods/default/textures/default_torch_on_floor.png b/mods/default/textures/default_torch_on_floor.png new file mode 100644 index 0000000..bc4bdd6 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor.png differ diff --git a/mods/default/textures/default_torch_on_floor_animated.png b/mods/default/textures/default_torch_on_floor_animated.png new file mode 100644 index 0000000..ad51c03 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor_animated.png differ diff --git a/mods/default/textures/default_tree.png b/mods/default/textures/default_tree.png new file mode 100644 index 0000000..10e297b Binary files /dev/null and b/mods/default/textures/default_tree.png differ diff --git a/mods/default/textures/default_tree_top.png b/mods/default/textures/default_tree_top.png new file mode 100644 index 0000000..da99bce Binary files /dev/null and b/mods/default/textures/default_tree_top.png differ diff --git a/mods/default/textures/default_water.png b/mods/default/textures/default_water.png new file mode 100644 index 0000000..00500e9 Binary files /dev/null and b/mods/default/textures/default_water.png differ diff --git a/mods/default/textures/default_water_flowing_animated.png b/mods/default/textures/default_water_flowing_animated.png new file mode 100644 index 0000000..070d797 Binary files /dev/null and b/mods/default/textures/default_water_flowing_animated.png differ diff --git a/mods/default/textures/default_water_source_animated.png b/mods/default/textures/default_water_source_animated.png new file mode 100644 index 0000000..7e7f9ff Binary files /dev/null and b/mods/default/textures/default_water_source_animated.png differ diff --git a/mods/default/textures/default_wood.png b/mods/default/textures/default_wood.png new file mode 100644 index 0000000..af56d6c Binary files /dev/null and b/mods/default/textures/default_wood.png differ diff --git a/mods/default/textures/gui_formbg.png b/mods/default/textures/gui_formbg.png new file mode 100644 index 0000000..c543466 Binary files /dev/null and b/mods/default/textures/gui_formbg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_bg.png b/mods/default/textures/gui_furnace_arrow_bg.png new file mode 100644 index 0000000..046d8cd Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_bg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_fg.png b/mods/default/textures/gui_furnace_arrow_fg.png new file mode 100644 index 0000000..8d3c396 Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_fg.png differ diff --git a/mods/default/textures/gui_hb_bg.png b/mods/default/textures/gui_hb_bg.png new file mode 100644 index 0000000..99248e1 Binary files /dev/null and b/mods/default/textures/gui_hb_bg.png differ diff --git a/mods/default/textures/gui_hotbar.png b/mods/default/textures/gui_hotbar.png new file mode 100644 index 0000000..73fb3ca Binary files /dev/null and b/mods/default/textures/gui_hotbar.png differ diff --git a/mods/default/textures/gui_hotbar_selected.png b/mods/default/textures/gui_hotbar_selected.png new file mode 100644 index 0000000..40bafe6 Binary files /dev/null and b/mods/default/textures/gui_hotbar_selected.png differ diff --git a/mods/default/textures/heart.png b/mods/default/textures/heart.png new file mode 100644 index 0000000..6d4e228 Binary files /dev/null and b/mods/default/textures/heart.png differ diff --git a/mods/default/textures/player.png b/mods/default/textures/player.png new file mode 100644 index 0000000..6d61c43 Binary files /dev/null and b/mods/default/textures/player.png differ diff --git a/mods/default/textures/player_back.png b/mods/default/textures/player_back.png new file mode 100644 index 0000000..5e9ef05 Binary files /dev/null and b/mods/default/textures/player_back.png differ diff --git a/mods/default/textures/wieldhand.png b/mods/default/textures/wieldhand.png new file mode 100644 index 0000000..69f4b7b Binary files /dev/null and b/mods/default/textures/wieldhand.png differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua new file mode 100644 index 0000000..9147f9b --- /dev/null +++ b/mods/default/tools.lua @@ -0,0 +1,452 @@ +-- mods/default/tools.lua + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, + snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0} + }, + damage_groups = {fleshy=1}, + } +}) + +-- +-- Picks +-- + +minetest.register_tool("default:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "default_tool_woodpick.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + cracky = {times={[3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "default_tool_stonepick.png", + tool_capabilities = { + full_punch_interval = 1.3, + max_drop_level=0, + groupcaps={ + cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "default_tool_steelpick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_bronze", { + description = "Bronze Pickaxe", + inventory_image = "default_tool_bronzepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "default_tool_mesepick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_diamond", { + description = "Diamond Pickaxe", + inventory_image = "default_tool_diamondpick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Shovels +-- + +minetest.register_tool("default:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "default_tool_woodshovel.png", + wield_image = "default_tool_woodshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_stone", { + description = "Stone Shovel", + inventory_image = "default_tool_stoneshovel.png", + wield_image = "default_tool_stoneshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.4, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_steel", { + description = "Steel Shovel", + inventory_image = "default_tool_steelshovel.png", + wield_image = "default_tool_steelshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_bronze", { + description = "Bronze Shovel", + inventory_image = "default_tool_bronzeshovel.png", + wield_image = "default_tool_bronzeshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_mese", { + description = "Mese Shovel", + inventory_image = "default_tool_meseshovel.png", + wield_image = "default_tool_meseshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_diamond", { + description = "Diamond Shovel", + inventory_image = "default_tool_diamondshovel.png", + wield_image = "default_tool_diamondshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Axes +-- + +minetest.register_tool("default:axe_wood", { + description = "Wooden Axe", + inventory_image = "default_tool_woodaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + groupcaps={ + choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_stone", { + description = "Stone Axe", + inventory_image = "default_tool_stoneaxe.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + choppy={times={[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_steel", { + description = "Steel Axe", + inventory_image = "default_tool_steelaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_bronze", { + description = "Bronze Axe", + inventory_image = "default_tool_bronzeaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_mese", { + description = "Mese Axe", + inventory_image = "default_tool_meseaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_diamond", { + description = "Diamond Axe", + inventory_image = "default_tool_diamondaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=7}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Swords +-- + +minetest.register_tool("default:sword_wood", { + description = "Wooden Sword", + inventory_image = "default_tool_woodsword.png", + tool_capabilities = { + full_punch_interval = 1, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_stone", { + description = "Stone Sword", + inventory_image = "default_tool_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_steel", { + description = "Steel Sword", + inventory_image = "default_tool_steelsword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_bronze", { + description = "Bronze Sword", + inventory_image = "default_tool_bronzesword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_mese", { + description = "Mese Sword", + inventory_image = "default_tool_mesesword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=7}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_diamond", { + description = "Diamond Sword", + inventory_image = "default_tool_diamondsword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, + }, + damage_groups = {fleshy=8}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:skeleton_key", { + description = "Skeleton Key", + inventory_image = "default_key_skeleton.png", + groups = {key = 1}, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node then + return itemstack + end + + local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use + if on_skeleton_key_use then + -- make a new key secret in case the node callback needs it + local random = math.random + local newsecret = string.format( + "%04x%04x%04x%04x", + random(2^16) - 1, random(2^16) - 1, + random(2^16) - 1, random(2^16) - 1) + + local secret, _, _ = on_skeleton_key_use(pos, placer, newsecret) + + if secret then + -- finish and return the new key + itemstack:take_item() + itemstack:add_item("default:key") + itemstack:set_metadata(minetest.write_json({ + secret = secret + })) + return itemstack + end + end + return nil + end +}) + +minetest.register_tool("default:key", { + description = "Key", + inventory_image = "default_key.png", + groups = {key = 1, not_in_creative_inventory = 1}, + stack_max = 1, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node or node.name == "ignore" then + return itemstack + end + + local ndef = minetest.registered_nodes[node.name] + if not ndef then + return itemstack + end + + local on_key_use = ndef.on_key_use + if on_key_use then + on_key_use(pos, placer) + end + + return nil + end +}) diff --git a/mods/default/torch.lua b/mods/default/torch.lua new file mode 100644 index 0000000..e94c5bd --- /dev/null +++ b/mods/default/torch.lua @@ -0,0 +1,147 @@ + +--[[ + +Torch mod - formerly mod "Torches" +====================== + +(c) Copyright BlockMen (2013-2015) +(C) Copyright sofar (2016) + +This mod changes the default torch drawtype from "torchlike" to "mesh", +giving the torch a three dimensional appearance. The mesh contains the +proper pixel mapping to make the animation appear as a particle above +the torch, while in fact the animation is just the texture of the mesh. + + +License: +~~~~~~~~ +(c) Copyright BlockMen (2013-2015) + +Textures and Meshes/Models: +CC-BY 3.0 BlockMen +Note that the models were entirely done from scratch by sofar. + +Code: +Licensed under the GNU LGPL version 2.1 or higher. +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; + +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 + +See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt + +--]] + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "mesh", + mesh = "torch_floor.obj", + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + liquids_pointable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + ((not placer) or (placer and not placer:get_player_control().sneak)) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + local above = pointed_thing.above + local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above)) + local fakestack = itemstack + if wdir == 0 then + fakestack:set_name("default:torch_ceiling") + elseif wdir == 1 then + fakestack:set_name("default:torch") + else + fakestack:set_name("default:torch_wall") + end + + itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) + itemstack:set_name("default:torch") + + return itemstack + end +}) + +minetest.register_node("default:torch_wall", { + drawtype = "mesh", + mesh = "torch_wall.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:torch_ceiling", { + drawtype = "mesh", + mesh = "torch_ceiling.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 13, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_lbm({ + name = "default:3dtorch", + nodenames = {"default:torch", "torches:floor", "torches:wall"}, + action = function(pos, node) + if node.param2 == 0 then + minetest.set_node(pos, {name = "default:torch_ceiling", + param2 = node.param2}) + elseif node.param2 == 1 then + minetest.set_node(pos, {name = "default:torch", + param2 = node.param2}) + else + minetest.set_node(pos, {name = "default:torch_wall", + param2 = node.param2}) + end + end +}) + diff --git a/mods/default/trees.lua b/mods/default/trees.lua new file mode 100644 index 0000000..2b676e7 --- /dev/null +++ b/mods/default/trees.lua @@ -0,0 +1,476 @@ +local random = math.random + +-- +-- Grow trees from saplings +-- + +-- 'can grow' function + +function default.can_grow(pos) + local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) + if not node_under then + return false + end + local name_under = node_under.name + local is_soil = minetest.get_item_group(name_under, "soil") + if is_soil == 0 then + return false + end + local light_level = minetest.get_node_light(pos) + if not light_level or light_level < 13 then + return false + end + return true +end + + +-- 'is snow nearby' function + +local function is_snow_nearby(pos) + return minetest.find_node_near(pos, 1, {"group:snowy"}) +end + + +-- Sapling ABM + +function default.grow_sapling(pos) + if not default.can_grow(pos) then + -- try a bit later again + minetest.get_node_timer(pos):start(math.random(240, 600)) + return + end + + local mg_name = minetest.get_mapgen_setting("mg_name") + local node = minetest.get_node(pos) + if node.name == "default:sapling" then + minetest.log("action", "A sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + if mg_name == "v6" then + default.grow_tree(pos, random(1, 4) == 1) + else + default.grow_new_apple_tree(pos) + end + elseif node.name == "default:junglesapling" then + minetest.log("action", "A jungle sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + if mg_name == "v6" then + default.grow_jungle_tree(pos) + else + default.grow_new_jungle_tree(pos) + end + elseif node.name == "default:pine_sapling" then + minetest.log("action", "A pine sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + local snow = is_snow_nearby(pos) + if mg_name == "v6" then + default.grow_pine_tree(pos, snow) + elseif snow then + default.grow_new_snowy_pine_tree(pos) + else + default.grow_new_pine_tree(pos) + end + elseif node.name == "default:acacia_sapling" then + minetest.log("action", "An acacia sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_acacia_tree(pos) + elseif node.name == "default:aspen_sapling" then + minetest.log("action", "An aspen sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_aspen_tree(pos) + end +end + +minetest.register_lbm({ + name = "default:convert_saplings_to_node_timer", + nodenames = {"default:sapling", "default:junglesapling", + "default:pine_sapling", "default:acacia_sapling", + "default:aspen_sapling"}, + action = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end +}) + +-- +-- Tree generation +-- + +-- Apple tree and jungle tree trunk and leaves function + +local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, + height, size, iters, is_apple_tree) + local x, y, z = pos.x, pos.y, pos.z + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_apple = minetest.get_content_id("default:apple") + + -- Trunk + data[a:index(x, y, z)] = tree_cid -- Force-place lowest trunk node to replace sapling + for yy = y + 1, y + height - 1 do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == leaves_cid then + data[vi] = tree_cid + end + end + + -- Force leaves near the trunk + for z_dist = -1, 1 do + for y_dist = -size, 1 do + local vi = a:index(x - 1, y + height + y_dist, z + z_dist) + for x_dist = -1, 1 do + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + vi = vi + 1 + end + end + end + + -- Randomly add leaves in 2x2x2 clusters. + for i = 1, iters do + local clust_x = x + random(-size, size - 1) + local clust_y = y + height + random(-size, 0) + local clust_z = z + random(-size, size - 1) + + for xi = 0, 1 do + for yi = 0, 1 do + for zi = 0, 1 do + local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + end + end + end + end +end + + +-- Apple tree + +function default.grow_tree(pos, is_apple_tree, bad) + --[[ + NOTE: Tree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(4, 5) + local c_tree = minetest.get_content_id("default:tree") + local c_leaves = minetest.get_content_id("default:leaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 2, y = y, z = z - 2}, + {x = x + 2, y = y + height + 1, z = z + 2} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree) + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- Jungle tree + +function default.grow_jungle_tree(pos, bad) + --[[ + NOTE: Jungletree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_jungle_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(8, 12) + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_jungletree = minetest.get_content_id("default:jungletree") + local c_jungleleaves = minetest.get_content_id("default:jungleleaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 3, y = y - 1, z = z - 3}, + {x = x + 3, y = y + height + 1, z = z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, + height, 3, 30, false) + + -- Roots + for z_dist = -1, 1 do + local vi_1 = a:index(x - 1, y - 1, z + z_dist) + local vi_2 = a:index(x - 1, y, z + z_dist) + for x_dist = -1, 1 do + if random(1, 3) >= 2 then + if data[vi_1] == c_air or data[vi_1] == c_ignore then + data[vi_1] = c_jungletree + elseif data[vi_2] == c_air or data[vi_2] == c_ignore then + data[vi_2] = c_jungletree + end + end + vi_1 = vi_1 + 1 + vi_2 = vi_2 + 1 + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- Pine tree from mg mapgen mod, design by sfan5, pointy top added by paramat + +local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == c_snow then + data[vi] = c_pine_needles + end +end + +local function add_snow(data, vi, c_air, c_ignore, c_snow) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore then + data[vi] = c_snow + end +end + +function default.grow_pine_tree(pos, snow) + local x, y, z = pos.x, pos.y, pos.z + local maxy = y + random(9, 13) -- Trunk top + + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_pine_tree = minetest.get_content_id("default:pine_tree") + local c_pine_needles = minetest.get_content_id("default:pine_needles") + local c_snow = minetest.get_content_id("default:snow") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 3, y = y, z = z - 3}, + {x = x + 3, y = maxy + 3, z = z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + -- Upper branches layer + local dev = 3 + for yy = maxy - 1, maxy + 1 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Centre top nodes + add_pine_needles(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, + c_pine_needles) + add_pine_needles(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, + c_pine_needles) -- Paramat added a pointy top node + if snow then + add_snow(data, a:index(x, maxy + 3, z), c_air, c_ignore, c_snow) + end + + -- Lower branches layer + local my = 0 + for i = 1, 20 do -- Random 2x2 squares of needles + local xi = x + random(-3, 2) + local yy = maxy + random(-6, -5) + local zi = z + random(-3, 2) + if yy > my then + my = yy + end + for zz = zi, zi+1 do + local vi = a:index(xi, yy, zz) + local via = a:index(xi, yy + 1, zz) + for xx = xi, xi + 1 do + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + vi = vi + 1 + via = via + 1 + end + end + end + + dev = 2 + for yy = my + 1, my + 2 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Trunk + -- Force-place lowest trunk node to replace sapling + data[a:index(x, y, z)] = c_pine_tree + for yy = y + 1, maxy do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or + node_id == c_pine_needles or node_id == c_snow then + data[vi] = c_pine_tree + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- New apple tree + +function default.grow_new_apple_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/apple_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "0", nil, false) +end + + +-- New jungle tree + +function default.grow_new_jungle_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/jungle_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + +-- New pine tree + +function default.grow_new_pine_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/pine_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "0", nil, false) +end + + +-- New snowy pine tree + +function default.grow_new_snowy_pine_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/snowy_pine_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + +-- New acacia tree + +function default.grow_new_acacia_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/acacia_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4}, + path, "random", nil, false) +end + + +-- New aspen tree + +function default.grow_new_aspen_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/aspen_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "0", nil, false) +end + + +-- +-- Sapling 'on place' function to check protection of node and resulting tree volume +-- + +function default.sapling_on_place(itemstack, placer, pointed_thing, + sapling_name, minp_relative, maxp_relative, interval) + -- Position of sapling + local pos = pointed_thing.under + local node = minetest.get_node_or_nil(pos) + local pdef = node and minetest.registered_nodes[node.name] + + if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then + return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) + end + + if not pdef or not pdef.buildable_to then + pos = pointed_thing.above + node = minetest.get_node_or_nil(pos) + pdef = node and minetest.registered_nodes[node.name] + if not pdef or not pdef.buildable_to then + return itemstack + end + end + + local player_name = placer:get_player_name() + -- Check sapling position for protection + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) + return itemstack + end + -- Check tree volume for protection + if not default.intersects_protection( + vector.add(pos, minp_relative), + vector.add(pos, maxp_relative), + player_name, + interval) then + minetest.set_node(pos, {name = sapling_name}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + else + minetest.record_protection_violation(pos, player_name) + -- Print extra information to explain + minetest.chat_send_player(player_name, "Tree will intersect protection") + end + + return itemstack +end diff --git a/mods/doors/README.txt b/mods/doors/README.txt new file mode 100644 index 0000000..9ad7093 --- /dev/null +++ b/mods/doors/README.txt @@ -0,0 +1,84 @@ +Minetest Game mod: doors +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) + +Modified by BlockMen (MIT): Added sounds, glass doors (glass, obsidian glass) and trapdoor. + +Modified by sofar (sofar@foo-projects.org) (MIT): +Added Steel trapdoor. +Re-implemented most of the door algorithms, added meshes, UV wrapped texture. +Added doors API to facilitate coding mods accessing and operating doors. +Added Fence Gate model, code, and sounds. + +Various Minetest developers and contributors (MIT) + + +Authors of media (textures) +--------------------------- +Following textures created by Fernando Zapata (CC BY-SA 3.0): + door_wood.png + door_wood_a.png + door_wood_a_r.png + door_wood_b.png + door_wood_b_r.png + +Following textures created by BlockMen (CC BY-SA 3.0): + door_trapdoor.png + door_obsidian_glass_side.png + +Following textures created by celeron55 (CC BY-SA 3.0): + door_glass_a.png + door_glass_b.png + +Following textures created by PenguinDad (CC BY-SA 4.0): + door_glass.png + door_obsidian_glass.png + +Following textures created by sofar (CC-BY-SA-3.0): + doors_trapdoor_steel.png + doors_trapdoor_steel_side.png + door_trapdoor_side.png + +Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0): + door_obsidian_glass.png + +Glass door textures by red-001 based on textures by celeron55 (CC BY-SA 3.0): + door_glass.png + +All other textures (created by PilzAdam) (CC BY-SA 3.0): + +Door textures were converted to the new texture map by sofar, paramat and +red-001, under the same license as the originals. + + +Authors of media (models) +------------------------- +Door 3d models by sofar (CC-BY-SA-3.0) + - door_a.obj + - door_b.obj +Fence gate models by sofar (CC-BY-SA-3.0) + - fencegate_open.obj + - fencegate_closed.obj + + +Authors of media (sounds) +------------------------- +Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen + door_open.ogg +Closing-Sound created by bennstir (CC BY 3.0) + door_close.ogg +fencegate_open.ogg: + http://www.freesound.org/people/mhtaylor67/sounds/126041/ - (CC0 1.0) +fencegate_close.ogg: + http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - (CC-BY-3.0) + http://www.freesound.org/people/rivernile7/sounds/249573/ - (CC-BY-3.0) +Steel door sounds open & close (CC-BY-3.0) by HazMatt + - http://www.freesound.org/people/HazMattt/sounds/187283/ + doors_steel_door_open.ogg + doors_steel_door_close.ogg +doors_glass_door_open.ogg, doors_glass_door_close.ogg: + https://www.freesound.org/people/SkeetMasterFunk69/sounds/235546/ (CC0 1.0) diff --git a/mods/doors/depends.txt b/mods/doors/depends.txt new file mode 100644 index 0000000..5e28bee --- /dev/null +++ b/mods/doors/depends.txt @@ -0,0 +1,2 @@ +default +screwdriver? diff --git a/mods/doors/init.lua b/mods/doors/init.lua new file mode 100644 index 0000000..61d48c1 --- /dev/null +++ b/mods/doors/init.lua @@ -0,0 +1,861 @@ +-- our API object +doors = {} + +-- private data +local _doors = {} +_doors.registered_doors = {} +_doors.registered_trapdoors = {} + +-- returns an object to a door object or nil +function doors.get(pos) + local node_name = minetest.get_node(pos).name + if _doors.registered_doors[node_name] then + -- A normal upright door + return { + pos = pos, + open = function(self, player) + if self:state() then + return false + end + return _doors.door_toggle(self.pos, nil, player) + end, + close = function(self, player) + if not self:state() then + return false + end + return _doors.door_toggle(self.pos, nil, player) + end, + toggle = function(self, player) + return _doors.door_toggle(self.pos, nil, player) + end, + state = function(self) + local state = minetest.get_meta(self.pos):get_int("state") + return state %2 == 1 + end + } + elseif _doors.registered_trapdoors[node_name] then + -- A trapdoor + return { + pos = pos, + open = function(self, player) + if self:state() then + return false + end + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + close = function(self, player) + if not self:state() then + return false + end + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + toggle = function(self, player) + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + state = function(self) + return minetest.get_node(self.pos).name:sub(-5) == "_open" + end + } + else + return nil + end +end + +-- this hidden node is placed on top of the bottom, and prevents +-- nodes from being placed in the top half of the door. +minetest.register_node("doors:hidden", { + description = "Hidden Door Segment", + -- can't use airlike otherwise falling nodes will turn to entities + -- and will be forever stuck until door is removed. + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + -- has to be walkable for falling nodes to stop falling. + walkable = true, + pointable = false, + diggable = false, + buildable_to = false, + floodable = false, + drop = "", + groups = {not_in_creative_inventory = 1}, + on_blast = function() end, + tiles = {"doors_blank.png"}, + -- 1px transparent block inside door hinge near node top. + nodebox = { + type = "fixed", + fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, + }, + -- collision_box needed otherise selection box would be full node size + collision_box = { + type = "fixed", + fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, + }, +}) + +-- table used to aid door opening/closing +local transform = { + { + {v = "_a", param2 = 3}, + {v = "_a", param2 = 0}, + {v = "_a", param2 = 1}, + {v = "_a", param2 = 2}, + }, + { + {v = "_b", param2 = 1}, + {v = "_b", param2 = 2}, + {v = "_b", param2 = 3}, + {v = "_b", param2 = 0}, + }, + { + {v = "_b", param2 = 1}, + {v = "_b", param2 = 2}, + {v = "_b", param2 = 3}, + {v = "_b", param2 = 0}, + }, + { + {v = "_a", param2 = 3}, + {v = "_a", param2 = 0}, + {v = "_a", param2 = 1}, + {v = "_a", param2 = 2}, + }, +} + +function _doors.door_toggle(pos, node, clicker) + local meta = minetest.get_meta(pos) + node = node or minetest.get_node(pos) + local def = minetest.registered_nodes[node.name] + local name = def.door.name + + local state = meta:get_string("state") + if state == "" then + -- fix up lvm-placed right-hinged doors, default closed + if node.name:sub(-2) == "_b" then + state = 2 + else + state = 0 + end + else + state = tonumber(state) + end + + if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then + -- is player wielding the right key? + local item = clicker:get_wielded_item() + local owner = meta:get_string("doors_owner") + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + elseif owner ~= "" then + if clicker:get_player_name() ~= owner then + return false + end + end + end + + -- until Lua-5.2 we have no bitwise operators :( + if state % 2 == 1 then + state = state - 1 + else + state = state + 1 + end + + local dir = node.param2 + if state % 2 == 0 then + minetest.sound_play(def.door.sounds[1], + {pos = pos, gain = 0.3, max_hear_distance = 10}) + else + minetest.sound_play(def.door.sounds[2], + {pos = pos, gain = 0.3, max_hear_distance = 10}) + end + + minetest.swap_node(pos, { + name = name .. transform[state + 1][dir+1].v, + param2 = transform[state + 1][dir+1].param2 + }) + meta:set_int("state", state) + + return true +end + + +local function on_place_node(place_to, newnode, + placer, oldnode, itemstack, pointed_thing) + -- Run script hook + for _, callback in ipairs(minetest.registered_on_placenodes) do + -- Deepcopy pos, node and pointed_thing because callback can modify them + local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z} + local newnode_copy = + {name = newnode.name, param1 = newnode.param1, param2 = newnode.param2} + local oldnode_copy = + {name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2} + local pointed_thing_copy = { + type = pointed_thing.type, + above = vector.new(pointed_thing.above), + under = vector.new(pointed_thing.under), + ref = pointed_thing.ref, + } + callback(place_to_copy, newnode_copy, placer, + oldnode_copy, itemstack, pointed_thing_copy) + end +end + +local function can_dig_door(pos, digger) + local digger_name = digger and digger:get_player_name() + if digger_name and minetest.get_player_privs(digger_name).protection_bypass then + return true + end + return minetest.get_meta(pos):get_string("doors_owner") == digger_name +end + +function doors.register(name, def) + if not name:find(":") then + name = "doors:" .. name + end + + -- replace old doors of this type automatically + minetest.register_lbm({ + name = ":doors:replace_" .. name:gsub(":", "_"), + nodenames = {name.."_b_1", name.."_b_2"}, + action = function(pos, node) + local l = tonumber(node.name:sub(-1)) + local meta = minetest.get_meta(pos) + local h = meta:get_int("right") + 1 + local p2 = node.param2 + local replace = { + {{type = "a", state = 0}, {type = "a", state = 3}}, + {{type = "b", state = 1}, {type = "b", state = 2}} + } + local new = replace[l][h] + -- retain infotext and doors_owner fields + minetest.swap_node(pos, {name = name .. "_" .. new.type, param2 = p2}) + meta:set_int("state", new.state) + -- properly place doors:hidden at the right spot + local p3 = p2 + if new.state >= 2 then + p3 = (p3 + 3) % 4 + end + if new.state % 2 == 1 then + if new.state >= 2 then + p3 = (p3 + 1) % 4 + else + p3 = (p3 + 3) % 4 + end + end + -- wipe meta on top node as it's unused + minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, + {name = "doors:hidden", param2 = p3}) + end + }) + + minetest.register_craftitem(":" .. name, { + description = def.description, + inventory_image = def.inventory_image, + + on_place = function(itemstack, placer, pointed_thing) + local pos + + if not pointed_thing.type == "node" then + return itemstack + end + + local node = minetest.get_node(pointed_thing.under) + local pdef = minetest.registered_nodes[node.name] + if pdef and pdef.on_rightclick and + not placer:get_player_control().sneak then + return pdef.on_rightclick(pointed_thing.under, + node, placer, itemstack, pointed_thing) + end + + if pdef and pdef.buildable_to then + pos = pointed_thing.under + else + pos = pointed_thing.above + node = minetest.get_node(pos) + pdef = minetest.registered_nodes[node.name] + if not pdef or not pdef.buildable_to then + return itemstack + end + end + + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local top_node = minetest.get_node_or_nil(above) + local topdef = top_node and minetest.registered_nodes[top_node.name] + + if not topdef or not topdef.buildable_to then + return itemstack + end + + local pn = placer:get_player_name() + if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then + return itemstack + end + + local dir = minetest.dir_to_facedir(placer:get_look_dir()) + + local ref = { + {x = -1, y = 0, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}, + } + + local aside = { + x = pos.x + ref[dir + 1].x, + y = pos.y + ref[dir + 1].y, + z = pos.z + ref[dir + 1].z, + } + + local state = 0 + if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then + state = state + 2 + minetest.set_node(pos, {name = name .. "_b", param2 = dir}) + minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4}) + else + minetest.set_node(pos, {name = name .. "_a", param2 = dir}) + minetest.set_node(above, {name = "doors:hidden", param2 = dir}) + end + + local meta = minetest.get_meta(pos) + meta:set_int("state", state) + + if def.protected then + meta:set_string("doors_owner", pn) + meta:set_string("infotext", "Owned by " .. pn) + end + + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + + on_place_node(pos, minetest.get_node(pos), + placer, node, itemstack, pointed_thing) + + return itemstack + end + }) + def.inventory_image = nil + + if def.recipe then + minetest.register_craft({ + output = name, + recipe = def.recipe, + }) + end + def.recipe = nil + + if not def.sounds then + def.sounds = default.node_sound_wood_defaults() + end + + if not def.sound_open then + def.sound_open = "doors_door_open" + end + + if not def.sound_close then + def.sound_close = "doors_door_close" + end + + def.groups.not_in_creative_inventory = 1 + def.groups.door = 1 + def.drop = name + def.door = { + name = name, + sounds = { def.sound_close, def.sound_open }, + } + + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + _doors.door_toggle(pos, node, clicker) + return itemstack + end + def.after_dig_node = function(pos, node, meta, digger) + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z}) + end + def.on_rotate = function(pos, node, user, mode, new_param2) + return false + end + + if def.protected then + def.can_dig = can_dig_door + def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this locked door.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked door", owner + end + else + def.on_blast = function(pos, intensity) + minetest.remove_node(pos) + -- hidden node doesn't get blasted away. + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + return {name} + end + end + + def.on_destruct = function(pos) + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + end + + def.drawtype = "mesh" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.sunlight_propagates = true + def.walkable = true + def.is_ground_content = false + def.buildable_to = false + def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}} + def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}} + + def.mesh = "door_a.obj" + minetest.register_node(":" .. name .. "_a", def) + + def.mesh = "door_b.obj" + minetest.register_node(":" .. name .. "_b", def) + + _doors.registered_doors[name .. "_a"] = true + _doors.registered_doors[name .. "_b"] = true +end + +doors.register("door_wood", { + tiles = {{ name = "doors_door_wood.png", backface_culling = true }}, + description = "Wooden Door", + inventory_image = "doors_item_wood.png", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + recipe = { + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"}, + } +}) + +doors.register("door_steel", { + tiles = {{name = "doors_door_steel.png", backface_culling = true}}, + description = "Steel Door", + inventory_image = "doors_item_steel.png", + protected = true, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), + sound_open = "doors_steel_door_open", + sound_close = "doors_steel_door_close", + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"}, + } +}) + +doors.register("door_glass", { + tiles = {"doors_door_glass.png"}, + description = "Glass Door", + inventory_image = "doors_item_glass.png", + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), + sound_open = "doors_glass_door_open", + sound_close = "doors_glass_door_close", + recipe = { + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"}, + } +}) + +doors.register("door_obsidian_glass", { + tiles = {"doors_door_obsidian_glass.png"}, + description = "Obsidian Glass Door", + inventory_image = "doors_item_obsidian_glass.png", + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), + sound_open = "doors_glass_door_open", + sound_close = "doors_glass_door_close", + recipe = { + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"}, + }, +}) + +-- Capture mods using the old API as best as possible. +function doors.register_door(name, def) + if def.only_placer_can_open then + def.protected = true + end + def.only_placer_can_open = nil + + local i = name:find(":") + local modname = name:sub(1, i - 1) + if not def.tiles then + if def.protected then + def.tiles = {{name = "doors_door_steel.png", backface_culling = true}} + else + def.tiles = {{name = "doors_door_wood.png", backface_culling = true}} + end + minetest.log("warning", modname .. " registered door \"" .. name .. "\" " .. + "using deprecated API method \"doors.register_door()\" but " .. + "did not provide the \"tiles\" parameter. A fallback tiledef " .. + "will be used instead.") + end + + doors.register(name, def) +end + +----trapdoor---- + +function _doors.trapdoor_toggle(pos, node, clicker) + node = node or minetest.get_node(pos) + if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then + -- is player wielding the right key? + local item = clicker:get_wielded_item() + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + if item:get_name() == "default:key" then + local key_meta = minetest.parse_json(item:get_metadata()) + local secret = meta:get_string("key_lock_secret") + if secret ~= key_meta.secret then + return false + end + + elseif owner ~= "" then + if clicker:get_player_name() ~= owner then + return false + end + end + end + + local def = minetest.registered_nodes[node.name] + + if string.sub(node.name, -5) == "_open" then + minetest.sound_play(def.sound_close, + {pos = pos, gain = 0.3, max_hear_distance = 10}) + minetest.swap_node(pos, {name = string.sub(node.name, 1, + string.len(node.name) - 5), param1 = node.param1, param2 = node.param2}) + else + minetest.sound_play(def.sound_open, + {pos = pos, gain = 0.3, max_hear_distance = 10}) + minetest.swap_node(pos, {name = node.name .. "_open", + param1 = node.param1, param2 = node.param2}) + end +end + +function doors.register_trapdoor(name, def) + if not name:find(":") then + name = "doors:" .. name + end + + local name_closed = name + local name_opened = name.."_open" + + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + _doors.trapdoor_toggle(pos, node, clicker) + return itemstack + end + + -- Common trapdoor configuration + def.drawtype = "nodebox" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.is_ground_content = false + + if def.protected then + def.can_dig = can_dig_door + def.after_place_node = function(pos, placer, itemstack, pointed_thing) + local pn = placer:get_player_name() + local meta = minetest.get_meta(pos) + meta:set_string("doors_owner", pn) + meta:set_string("infotext", "Owned by "..pn) + + return minetest.setting_getbool("creative_mode") + end + + def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this trapdoor.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked trapdoor", owner + end + else + def.on_blast = function(pos, intensity) + minetest.remove_node(pos) + return {name} + end + end + + if not def.sounds then + def.sounds = default.node_sound_wood_defaults() + end + + if not def.sound_open then + def.sound_open = "doors_door_open" + end + + if not def.sound_close then + def.sound_close = "doors_door_close" + end + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_closed.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.tiles = {def.tile_front, + def.tile_front .. '^[transformFY', + def.tile_side, def.tile_side, + def.tile_side, def.tile_side} + + def_opened.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.tiles = {def.tile_side, def.tile_side, + def.tile_side .. '^[transform3', + def.tile_side .. '^[transform1', + def.tile_front .. '^[transform46', + def.tile_front .. '^[transform6'} + + def_opened.drop = name_closed + def_opened.groups.not_in_creative_inventory = 1 + + minetest.register_node(name_opened, def_opened) + minetest.register_node(name_closed, def_closed) + + _doors.registered_trapdoors[name_opened] = true + _doors.registered_trapdoors[name_closed] = true +end + +doors.register_trapdoor("doors:trapdoor", { + description = "Trapdoor", + inventory_image = "doors_trapdoor.png", + wield_image = "doors_trapdoor.png", + tile_front = "doors_trapdoor.png", + tile_side = "doors_trapdoor_side.png", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, door = 1}, +}) + +doors.register_trapdoor("doors:trapdoor_steel", { + description = "Steel Trapdoor", + inventory_image = "doors_trapdoor_steel.png", + wield_image = "doors_trapdoor_steel.png", + tile_front = "doors_trapdoor_steel.png", + tile_side = "doors_trapdoor_steel_side.png", + protected = true, + sounds = default.node_sound_metal_defaults(), + sound_open = "doors_steel_door_open", + sound_close = "doors_steel_door_close", + groups = {cracky = 1, level = 2, door = 1}, +}) + +minetest.register_craft({ + output = 'doors:trapdoor 2', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'doors:trapdoor_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot'}, + } +}) + + +----fence gate---- + +function doors.register_fencegate(name, def) + local fence = { + description = def.description, + drawtype = "mesh", + tiles = {def.texture}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + drop = name .. "_closed", + connect_sides = {"left", "right"}, + groups = def.groups, + sounds = def.sounds, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local node_def = minetest.registered_nodes[node.name] + minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2}) + minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3, + max_hear_distance = 8}) + return itemstack + end, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}, + }, + } + + if not fence.sounds then + fence.sounds = default.node_sound_wood_defaults() + end + + fence.groups.fence = 1 + + local fence_closed = table.copy(fence) + fence_closed.mesh = "doors_fencegate_closed.obj" + fence_closed.gate = name .. "_open" + fence_closed.sound = "doors_fencegate_open" + fence_closed.collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}, + } + + local fence_open = table.copy(fence) + fence_open.mesh = "doors_fencegate_open.obj" + fence_open.gate = name .. "_closed" + fence_open.sound = "doors_fencegate_close" + fence_open.groups.not_in_creative_inventory = 1 + fence_open.collision_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4}, + {-1/2, -3/8, -1/2, -3/8, 3/8, 0}}, + } + + minetest.register_node(":" .. name .. "_closed", fence_closed) + minetest.register_node(":" .. name .. "_open", fence_open) + + minetest.register_craft({ + output = name .. "_closed", + recipe = { + {"default:stick", def.material, "default:stick"}, + {"default:stick", def.material, "default:stick"} + } + }) +end + +doors.register_fencegate("doors:gate_wood", { + description = "Wooden Fence Gate", + texture = "default_wood.png", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_acacia_wood", { + description = "Acacia Fence Gate", + texture = "default_acacia_wood.png", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_junglewood", { + description = "Junglewood Fence Gate", + texture = "default_junglewood.png", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_pine_wood", { + description = "Pine Fence Gate", + texture = "default_pine_wood.png", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} +}) + +doors.register_fencegate("doors:gate_aspen_wood", { + description = "Aspen Fence Gate", + texture = "default_aspen_wood.png", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} +}) + + +----fuels---- + +minetest.register_craft({ + type = "fuel", + recipe = "doors:trapdoor", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:door_wood", + burntime = 14, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_wood_closed", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_acacia_wood_closed", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_junglewood_closed", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_pine_wood_closed", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_aspen_wood_closed", + burntime = 5, +}) diff --git a/mods/doors/license.txt b/mods/doors/license.txt new file mode 100644 index 0000000..8ce73c4 --- /dev/null +++ b/mods/doors/license.txt @@ -0,0 +1,164 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar (sofar@foo-projects.org) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2011-2016 Fernando Zapata +Copyright (C) 2014-2016 celeron55 +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar +Copyright (C) 2016 red-001 +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 PenguinDad + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/4.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2014 CGEffex +Copyright (C) 2014 bennstir +Copyright (C) 2016 BarkersPinhead +Copyright (C) 2016 rivernile7 +Copyright (C) 2016 HazMatt + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ + +----------------------- + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication +mhtaylor67 +SkeetMasterFunk69 + +No Copyright + +The person who associated a work with this deed has dedicated the work to the public +domain by waiving all of his or her rights to the work worldwide under copyright law, +including all related and neighboring rights, to the extent allowed by law. + +You can copy, modify, distribute and perform the work, even for commercial purposes, all +without asking permission. See Other Information below. + +Other Information + +In no way are the patent or trademark rights of any person affected by CC0, nor are the +rights that other persons may have in the work or in how the work is used, such as +publicity or privacy rights. +Unless expressly stated otherwise, the person who associated a work with this deed makes +no warranties about the work, and disclaims liability for all uses of the work, to the +fullest extent permitted by applicable law. +When using or citing the work, you should not imply endorsement by the author or the +affirmer. + +For more details: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/mods/doors/sounds/doors_door_close.ogg b/mods/doors/sounds/doors_door_close.ogg new file mode 100644 index 0000000..fede4af Binary files /dev/null and b/mods/doors/sounds/doors_door_close.ogg differ diff --git a/mods/doors/sounds/doors_door_open.ogg b/mods/doors/sounds/doors_door_open.ogg new file mode 100644 index 0000000..9a4c4f1 Binary files /dev/null and b/mods/doors/sounds/doors_door_open.ogg differ diff --git a/mods/doors/sounds/doors_fencegate_close.ogg b/mods/doors/sounds/doors_fencegate_close.ogg new file mode 100644 index 0000000..d42590f Binary files /dev/null and b/mods/doors/sounds/doors_fencegate_close.ogg differ diff --git a/mods/doors/sounds/doors_fencegate_open.ogg b/mods/doors/sounds/doors_fencegate_open.ogg new file mode 100644 index 0000000..f6dfd1d Binary files /dev/null and b/mods/doors/sounds/doors_fencegate_open.ogg differ diff --git a/mods/doors/sounds/doors_glass_door_close.ogg b/mods/doors/sounds/doors_glass_door_close.ogg new file mode 100644 index 0000000..b3c1355 Binary files /dev/null and b/mods/doors/sounds/doors_glass_door_close.ogg differ diff --git a/mods/doors/sounds/doors_glass_door_open.ogg b/mods/doors/sounds/doors_glass_door_open.ogg new file mode 100644 index 0000000..66e6812 Binary files /dev/null and b/mods/doors/sounds/doors_glass_door_open.ogg differ diff --git a/mods/doors/sounds/doors_steel_door_close.ogg b/mods/doors/sounds/doors_steel_door_close.ogg new file mode 100644 index 0000000..aea7be6 Binary files /dev/null and b/mods/doors/sounds/doors_steel_door_close.ogg differ diff --git a/mods/doors/sounds/doors_steel_door_open.ogg b/mods/doors/sounds/doors_steel_door_open.ogg new file mode 100644 index 0000000..de87477 Binary files /dev/null and b/mods/doors/sounds/doors_steel_door_open.ogg differ diff --git a/mods/doors/textures/doors_blank.png b/mods/doors/textures/doors_blank.png new file mode 100644 index 0000000..1914264 Binary files /dev/null and b/mods/doors/textures/doors_blank.png differ diff --git a/mods/doors/textures/doors_door_glass.png b/mods/doors/textures/doors_door_glass.png new file mode 100644 index 0000000..26c427b Binary files /dev/null and b/mods/doors/textures/doors_door_glass.png differ diff --git a/mods/doors/textures/doors_door_obsidian_glass.png b/mods/doors/textures/doors_door_obsidian_glass.png new file mode 100644 index 0000000..07ac5b2 Binary files /dev/null and b/mods/doors/textures/doors_door_obsidian_glass.png differ diff --git a/mods/doors/textures/doors_door_steel.png b/mods/doors/textures/doors_door_steel.png new file mode 100644 index 0000000..f42f335 Binary files /dev/null and b/mods/doors/textures/doors_door_steel.png differ diff --git a/mods/doors/textures/doors_door_wood.png b/mods/doors/textures/doors_door_wood.png new file mode 100644 index 0000000..7b18203 Binary files /dev/null and b/mods/doors/textures/doors_door_wood.png differ diff --git a/mods/doors/textures/doors_item_glass.png b/mods/doors/textures/doors_item_glass.png new file mode 100644 index 0000000..791a58a Binary files /dev/null and b/mods/doors/textures/doors_item_glass.png differ diff --git a/mods/doors/textures/doors_item_obsidian_glass.png b/mods/doors/textures/doors_item_obsidian_glass.png new file mode 100644 index 0000000..1026d43 Binary files /dev/null and b/mods/doors/textures/doors_item_obsidian_glass.png differ diff --git a/mods/doors/textures/doors_item_steel.png b/mods/doors/textures/doors_item_steel.png new file mode 100644 index 0000000..dd99e13 Binary files /dev/null and b/mods/doors/textures/doors_item_steel.png differ diff --git a/mods/doors/textures/doors_item_wood.png b/mods/doors/textures/doors_item_wood.png new file mode 100644 index 0000000..d3a62ab Binary files /dev/null and b/mods/doors/textures/doors_item_wood.png differ diff --git a/mods/doors/textures/doors_trapdoor.png b/mods/doors/textures/doors_trapdoor.png new file mode 100644 index 0000000..e92c8b2 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor.png differ diff --git a/mods/doors/textures/doors_trapdoor_side.png b/mods/doors/textures/doors_trapdoor_side.png new file mode 100644 index 0000000..c45d870 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_side.png differ diff --git a/mods/doors/textures/doors_trapdoor_steel.png b/mods/doors/textures/doors_trapdoor_steel.png new file mode 100644 index 0000000..4ba507d Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_steel.png differ diff --git a/mods/doors/textures/doors_trapdoor_steel_side.png b/mods/doors/textures/doors_trapdoor_steel_side.png new file mode 100644 index 0000000..44c4344 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_steel_side.png differ diff --git a/mods/dye/README.txt b/mods/dye/README.txt new file mode 100644 index 0000000..a2fbdd2 --- /dev/null +++ b/mods/dye/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: dye +====================== +See license.txt for license information. +See init.lua for documentation. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Perttu Ahola (celeron55) (CC BY-SA 3.0) diff --git a/mods/dye/depends.txt b/mods/dye/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/dye/init.lua b/mods/dye/init.lua new file mode 100644 index 0000000..87f31d1 --- /dev/null +++ b/mods/dye/init.lua @@ -0,0 +1,113 @@ +-- Other mods can use these for looping through available colors + +dye = {} +dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} +dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", + "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} + +-- Make dye names and descriptions available globally + +dye.dyes = { + {"white", "White"}, + {"grey", "Grey"}, + {"dark_grey", "Dark grey"}, + {"black", "Black"}, + {"violet", "Violet"}, + {"blue", "Blue"}, + {"cyan", "Cyan"}, + {"dark_green", "Dark green"}, + {"green", "Green"}, + {"yellow", "Yellow"}, + {"brown", "Brown"}, + {"orange", "Orange"}, + {"red", "Red"}, + {"magenta", "Magenta"}, + {"pink", "Pink"}, +} + +-- This collection of colors is partly a historic thing, partly something else + +local dyes = { + {"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}}, + {"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, + {"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, + {"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}}, + {"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}}, + {"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}}, + {"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}}, + {"dark_green", "Dark green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}}, + {"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}}, + {"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}}, + {"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}}, + {"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}}, + {"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}}, + {"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1, unicolor_red_violet=1}}, + {"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}}, +} + +-- Define items + +for _, row in ipairs(dyes) do + local name = row[1] + local description = row[2] + local groups = row[3] + local item_name = "dye:" .. name + local item_image = "dye_" .. name .. ".png" + minetest.register_craftitem(item_name, { + inventory_image = item_image, + description = description, + groups = groups + }) + minetest.register_craft({ + type = "shapeless", + output = item_name .. " 4", + recipe = {"group:flower,color_" .. name}, + }) +end + +-- Manually add coal->black dye + +minetest.register_craft({ + type = "shapeless", + output = "dye:black 4", + recipe = {"group:coal"}, +}) + +-- Mix recipes +local dye_recipes = { + -- src1, src2, dst + -- RYB mixes + {"red", "blue", "violet"}, -- "purple" + {"yellow", "red", "orange"}, + {"yellow", "blue", "green"}, + -- RYB complementary mixes + {"red", "green", "dark_grey"}, + {"yellow", "violet", "dark_grey"}, + {"blue", "orange", "dark_grey"}, + -- CMY mixes - approximation + {"cyan", "yellow", "green"}, + {"cyan", "magenta", "blue"}, + {"yellow", "magenta", "red"}, + -- other mixes that result in a color we have + {"red", "green", "brown"}, + {"magenta", "blue", "violet"}, + {"green", "blue", "cyan"}, + {"pink", "violet", "magenta"}, + -- mixes with black + {"white", "black", "grey"}, + {"grey", "black", "dark_grey"}, + {"green", "black", "dark_green"}, + {"orange", "black", "brown"}, + -- mixes with white + {"white", "red", "pink"}, + {"white", "dark_grey", "grey"}, + {"white", "dark_green", "green"}, +} + +for _, mix in pairs(dye_recipes) do + minetest.register_craft({ + type = "shapeless", + output = 'dye:' .. mix[3] .. ' 2', + recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]}, + }) +end diff --git a/mods/dye/license.txt b/mods/dye/license.txt new file mode 100644 index 0000000..bf9d350 --- /dev/null +++ b/mods/dye/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/dye/textures/dye_black.png b/mods/dye/textures/dye_black.png new file mode 100644 index 0000000..1055b6c Binary files /dev/null and b/mods/dye/textures/dye_black.png differ diff --git a/mods/dye/textures/dye_blue.png b/mods/dye/textures/dye_blue.png new file mode 100644 index 0000000..d1377c6 Binary files /dev/null and b/mods/dye/textures/dye_blue.png differ diff --git a/mods/dye/textures/dye_brown.png b/mods/dye/textures/dye_brown.png new file mode 100644 index 0000000..77d475c Binary files /dev/null and b/mods/dye/textures/dye_brown.png differ diff --git a/mods/dye/textures/dye_cyan.png b/mods/dye/textures/dye_cyan.png new file mode 100644 index 0000000..239d66c Binary files /dev/null and b/mods/dye/textures/dye_cyan.png differ diff --git a/mods/dye/textures/dye_dark_green.png b/mods/dye/textures/dye_dark_green.png new file mode 100644 index 0000000..9606ccf Binary files /dev/null and b/mods/dye/textures/dye_dark_green.png differ diff --git a/mods/dye/textures/dye_dark_grey.png b/mods/dye/textures/dye_dark_grey.png new file mode 100644 index 0000000..060737b Binary files /dev/null and b/mods/dye/textures/dye_dark_grey.png differ diff --git a/mods/dye/textures/dye_green.png b/mods/dye/textures/dye_green.png new file mode 100644 index 0000000..0d99ee1 Binary files /dev/null and b/mods/dye/textures/dye_green.png differ diff --git a/mods/dye/textures/dye_grey.png b/mods/dye/textures/dye_grey.png new file mode 100644 index 0000000..5efb028 Binary files /dev/null and b/mods/dye/textures/dye_grey.png differ diff --git a/mods/dye/textures/dye_magenta.png b/mods/dye/textures/dye_magenta.png new file mode 100644 index 0000000..c84df62 Binary files /dev/null and b/mods/dye/textures/dye_magenta.png differ diff --git a/mods/dye/textures/dye_orange.png b/mods/dye/textures/dye_orange.png new file mode 100644 index 0000000..0844907 Binary files /dev/null and b/mods/dye/textures/dye_orange.png differ diff --git a/mods/dye/textures/dye_pink.png b/mods/dye/textures/dye_pink.png new file mode 100644 index 0000000..c3dec22 Binary files /dev/null and b/mods/dye/textures/dye_pink.png differ diff --git a/mods/dye/textures/dye_red.png b/mods/dye/textures/dye_red.png new file mode 100644 index 0000000..14eafbf Binary files /dev/null and b/mods/dye/textures/dye_red.png differ diff --git a/mods/dye/textures/dye_violet.png b/mods/dye/textures/dye_violet.png new file mode 100644 index 0000000..600cbb4 Binary files /dev/null and b/mods/dye/textures/dye_violet.png differ diff --git a/mods/dye/textures/dye_white.png b/mods/dye/textures/dye_white.png new file mode 100644 index 0000000..2a840a4 Binary files /dev/null and b/mods/dye/textures/dye_white.png differ diff --git a/mods/dye/textures/dye_yellow.png b/mods/dye/textures/dye_yellow.png new file mode 100644 index 0000000..fe75775 Binary files /dev/null and b/mods/dye/textures/dye_yellow.png differ diff --git a/mods/farming/README.txt b/mods/farming/README.txt new file mode 100644 index 0000000..3ccd8c3 --- /dev/null +++ b/mods/farming/README.txt @@ -0,0 +1,37 @@ +Minetest Game mod: farming +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) +webdesigner97 (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Created by PilzAdam (CC BY 3.0): + farming_bread.png + farming_soil.png + farming_soil_wet.png + farming_soil_wet_side.png + farming_string.png + +Created by BlockMen (CC BY 3.0): + farming_tool_diamondhoe.png + farming_tool_mesehoe.png + farming_tool_bronzehoe.png + farming_tool_steelhoe.png + farming_tool_stonehoe.png + farming_tool_woodhoe.png + +Created by MasterGollum (CC BY 3.0): + farming_straw.png + +Created by Gambit (CC BY 3.0): + farming_wheat.png + farming_wheat_*.png + farming_cotton_*.png + farming_flour.png + farming_cotton_seed.png + farming_wheat_seed.png diff --git a/mods/farming/api.lua b/mods/farming/api.lua new file mode 100644 index 0000000..182e1b2 --- /dev/null +++ b/mods/farming/api.lua @@ -0,0 +1,389 @@ + +-- Wear out hoes, place soil +-- TODO Ignore group:flower +farming.registered_plants = {} + +farming.hoe_on_use = function(itemstack, user, pointed_thing, uses) + local pt = pointed_thing + -- check if pointing at a node + if not pt then + return + end + if pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} + local above = minetest.get_node(p) + + -- return if any of the nodes is not registered + if not minetest.registered_nodes[under.name] then + return + end + if not minetest.registered_nodes[above.name] then + return + end + + -- check if the node above the pointed thing is air + if above.name ~= "air" then + return + end + + -- check if pointing at soil + if minetest.get_item_group(under.name, "soil") ~= 1 then + return + end + + -- check if (wet) soil defined + local regN = minetest.registered_nodes + if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then + return + end + + if minetest.is_protected(pt.under, user:get_player_name()) then + minetest.record_protection_violation(pt.under, user:get_player_name()) + return + end + if minetest.is_protected(pt.above, user:get_player_name()) then + minetest.record_protection_violation(pt.above, user:get_player_name()) + return + end + + -- turn the node into soil and play sound + minetest.set_node(pt.under, {name = regN[under.name].soil.dry}) + minetest.sound_play("default_dig_crumbly", { + pos = pt.under, + gain = 0.5, + }) + + if not minetest.setting_getbool("creative_mode") then + -- wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(65535/(uses-1)) + -- tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) + end + end + return itemstack +end + +-- Register new hoes +farming.register_hoe = function(name, def) + -- Check for : prefix (register new hoes in your mod's namespace) + if name:sub(1,1) ~= ":" then + name = ":" .. name + end + -- Check def table + if def.description == nil then + def.description = "Hoe" + end + if def.inventory_image == nil then + def.inventory_image = "unknown_item.png" + end + if def.recipe == nil then + def.recipe = { + {"air","air",""}, + {"","group:stick",""}, + {"","group:stick",""} + } + end + if def.max_uses == nil then + def.max_uses = 30 + end + -- Register the tool + minetest.register_tool(name, { + description = def.description, + inventory_image = def.inventory_image, + on_use = function(itemstack, user, pointed_thing) + return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses) + end, + groups = def.groups, + sound = {breaks = "default_tool_breaks"}, + }) + -- Register its recipe + if def.material == nil then + minetest.register_craft({ + output = name:sub(2), + recipe = def.recipe + }) + else + minetest.register_craft({ + output = name:sub(2), + recipe = { + {def.material, def.material, ""}, + {"", "group:stick", ""}, + {"", "group:stick", ""} + } + }) + -- Reverse Recipe + minetest.register_craft({ + output = name:sub(2), + recipe = { + {"", def.material, def.material}, + {"", "group:stick", ""}, + {"", "group:stick", ""} + } + }) + end +end + +-- how often node timers for plants will tick, +/- some random value +local function tick(pos) + minetest.get_node_timer(pos):start(math.random(166, 286)) +end +-- how often a growth failure tick is retried (e.g. too dark) +local function tick_again(pos) + minetest.get_node_timer(pos):start(math.random(40, 80)) +end + +-- Seed placement +farming.place_seed = function(itemstack, placer, pointed_thing, plantname) + local pt = pointed_thing + -- check if pointing at a node + if not pt then + return itemstack + end + if pt.type ~= "node" then + return itemstack + end + + local under = minetest.get_node(pt.under) + local above = minetest.get_node(pt.above) + + if minetest.is_protected(pt.under, placer:get_player_name()) then + minetest.record_protection_violation(pt.under, placer:get_player_name()) + return + end + if minetest.is_protected(pt.above, placer:get_player_name()) then + minetest.record_protection_violation(pt.above, placer:get_player_name()) + return + end + + -- return if any of the nodes is not registered + if not minetest.registered_nodes[under.name] then + return itemstack + end + if not minetest.registered_nodes[above.name] then + return itemstack + end + + -- check if pointing at the top of the node + if pt.above.y ~= pt.under.y+1 then + return itemstack + end + + -- check if you can replace the node above the pointed node + if not minetest.registered_nodes[above.name].buildable_to then + return itemstack + end + + -- check if pointing at soil + if minetest.get_item_group(under.name, "soil") < 2 then + return itemstack + end + + -- add the node and remove 1 item from the itemstack + minetest.add_node(pt.above, {name = plantname, param2 = 1}) + tick(pt.above) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack +end + +farming.grow_plant = function(pos, elapsed) + local node = minetest.get_node(pos) + local name = node.name + local def = minetest.registered_nodes[name] + + if not def.next_plant then + -- disable timer for fully grown plant + return + end + + -- grow seed + if minetest.get_item_group(node.name, "seed") and def.fertility then + local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) + if not soil_node then + tick_again(pos) + return + end + -- omitted is a check for light, we assume seeds can germinate in the dark. + for _, v in pairs(def.fertility) do + if minetest.get_item_group(soil_node.name, v) ~= 0 then + local placenode = {name = def.next_plant} + if def.place_param2 then + placenode.param2 = def.place_param2 + end + minetest.swap_node(pos, placenode) + if minetest.registered_nodes[def.next_plant].next_plant then + tick(pos) + return + end + end + end + + return + end + + -- check if on wet soil + local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) + if minetest.get_item_group(below.name, "soil") < 3 then + tick_again(pos) + return + end + + -- check light + local light = minetest.get_node_light(pos) + if not light or light < def.minlight or light > def.maxlight then + tick_again(pos) + return + end + + -- grow + local placenode = {name = def.next_plant} + if def.place_param2 then + placenode.param2 = def.place_param2 + end + minetest.swap_node(pos, placenode) + + -- new timer needed? + if minetest.registered_nodes[def.next_plant].next_plant then + tick(pos) + end + return +end + +-- Register plants +farming.register_plant = function(name, def) + local mname = name:split(":")[1] + local pname = name:split(":")[2] + + -- Check def table + if not def.description then + def.description = "Seed" + end + if not def.inventory_image then + def.inventory_image = "unknown_item.png" + end + if not def.steps then + return nil + end + if not def.minlight then + def.minlight = 1 + end + if not def.maxlight then + def.maxlight = 14 + end + if not def.fertility then + def.fertility = {} + end + + farming.registered_plants[pname] = def + + -- Register seed + local lbm_nodes = {mname .. ":seed_" .. pname} + local g = {seed = 1, snappy = 3, attached_node = 1, flammable = 2} + for k, v in pairs(def.fertility) do + g[v] = 1 + end + minetest.register_node(":" .. mname .. ":seed_" .. pname, { + description = def.description, + tiles = {def.inventory_image}, + inventory_image = def.inventory_image, + wield_image = def.inventory_image, + drawtype = "signlike", + groups = g, + paramtype = "light", + paramtype2 = "wallmounted", + place_param2 = def.place_param2 or nil, -- this isn't actually used for placement + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + fertility = def.fertility, + sounds = default.node_sound_dirt_defaults({ + dig = {name = "", gain = 0}, + dug = {name = "default_grass_footstep", gain = 0.2}, + place = {name = "default_place_node", gain = 0.25}, + }), + + on_place = function(itemstack, placer, pointed_thing) + return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname) + end, + next_plant = mname .. ":" .. pname .. "_1", + on_timer = farming.grow_plant, + minlight = def.minlight, + maxlight = def.maxlight, + }) + + -- Register harvest + minetest.register_craftitem(":" .. mname .. ":" .. pname, { + description = pname:gsub("^%l", string.upper), + inventory_image = mname .. "_" .. pname .. ".png", + groups = {flammable = 2}, + }) + + -- Register growing steps + for i = 1, def.steps do + local drop = { + items = { + {items = {mname .. ":" .. pname}, rarity = 9 - i}, + {items = {mname .. ":" .. pname}, rarity= 18 - i * 2}, + {items = {mname .. ":seed_" .. pname}, rarity = 9 - i}, + {items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, + } + } + local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} + nodegroups[pname] = i + + local next_plant = nil + + if i < def.steps then + next_plant = mname .. ":" .. pname .. "_" .. (i + 1) + lbm_nodes[#lbm_nodes + 1] = mname .. ":" .. pname .. "_" .. i + end + + minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, { + drawtype = "plantlike", + waving = 1, + tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"}, + paramtype = "light", + paramtype2 = def.paramtype2 or nil, + place_param2 = def.place_param2 or nil, + walkable = false, + buildable_to = true, + drop = drop, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + groups = nodegroups, + sounds = default.node_sound_leaves_defaults(), + next_plant = next_plant, + on_timer = farming.grow_plant, + minlight = def.minlight, + maxlight = def.maxlight, + }) + end + + -- replacement LBM for pre-nodetimer plants + minetest.register_lbm({ + name = ":" .. mname .. ":start_nodetimer_" .. pname, + nodenames = lbm_nodes, + action = function(pos, node) + tick_again(pos) + end, + }) + + -- Return + local r = { + seed = mname .. ":seed_" .. pname, + harvest = mname .. ":" .. pname + } + return r +end diff --git a/mods/farming/depends.txt b/mods/farming/depends.txt new file mode 100644 index 0000000..470ec30 --- /dev/null +++ b/mods/farming/depends.txt @@ -0,0 +1,2 @@ +default +wool diff --git a/mods/farming/hoes.lua b/mods/farming/hoes.lua new file mode 100644 index 0000000..5aae390 --- /dev/null +++ b/mods/farming/hoes.lua @@ -0,0 +1,42 @@ +farming.register_hoe(":farming:hoe_wood", { + description = "Wooden Hoe", + inventory_image = "farming_tool_woodhoe.png", + max_uses = 30, + material = "group:wood", + groups = {flammable = 2}, +}) + +farming.register_hoe(":farming:hoe_stone", { + description = "Stone Hoe", + inventory_image = "farming_tool_stonehoe.png", + max_uses = 90, + material = "group:stone" +}) + +farming.register_hoe(":farming:hoe_steel", { + description = "Steel Hoe", + inventory_image = "farming_tool_steelhoe.png", + max_uses = 200, + material = "default:steel_ingot" +}) + +farming.register_hoe(":farming:hoe_bronze", { + description = "Bronze Hoe", + inventory_image = "farming_tool_bronzehoe.png", + max_uses = 220, + material = "default:bronze_ingot" +}) + +farming.register_hoe(":farming:hoe_mese", { + description = "Mese Hoe", + inventory_image = "farming_tool_mesehoe.png", + max_uses = 350, + material = "default:mese_crystal" +}) + +farming.register_hoe(":farming:hoe_diamond", { + description = "Diamond Hoe", + inventory_image = "farming_tool_diamondhoe.png", + max_uses = 500, + material = "default:diamond" +}) diff --git a/mods/farming/init.lua b/mods/farming/init.lua new file mode 100644 index 0000000..97dc9b4 --- /dev/null +++ b/mods/farming/init.lua @@ -0,0 +1,109 @@ +-- Global farming namespace +farming = {} +farming.path = minetest.get_modpath("farming") + +-- Load files +dofile(farming.path .. "/api.lua") +dofile(farming.path .. "/nodes.lua") +dofile(farming.path .. "/hoes.lua") + +-- WHEAT +farming.register_plant("farming:wheat", { + description = "Wheat seed", + paramtype2 = "meshoptions", + inventory_image = "farming_wheat_seed.png", + steps = 8, + minlight = 13, + maxlight = default.LIGHT_MAX, + fertility = {"grassland"}, + groups = {flammable = 4}, + place_param2 = 3, +}) +minetest.register_craftitem("farming:flour", { + description = "Flour", + inventory_image = "farming_flour.png", + groups = {flammable = 1}, +}) + +minetest.register_craftitem("farming:bread", { + description = "Bread", + inventory_image = "farming_bread.png", + on_use = minetest.item_eat(5), + groups = {flammable = 2}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"} +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:bread", + recipe = "farming:flour" +}) + +-- Cotton +farming.register_plant("farming:cotton", { + description = "Cotton seed", + inventory_image = "farming_cotton_seed.png", + steps = 8, + minlight = 13, + maxlight = default.LIGHT_MAX, + fertility = {"grassland", "desert"}, + groups = {flammable = 4}, +}) + +minetest.register_alias("farming:string", "farming:cotton") + +minetest.register_craft({ + output = "wool:white", + recipe = { + {"farming:cotton", "farming:cotton"}, + {"farming:cotton", "farming:cotton"}, + } +}) + +-- Straw +minetest.register_craft({ + output = "farming:straw 3", + recipe = { + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + } +}) + +minetest.register_craft({ + output = "farming:wheat 3", + recipe = { + {"farming:straw"}, + } +}) + +-- Fuels +minetest.register_craft({ + type = "fuel", + recipe = "farming:straw", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:wheat", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:cotton", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hoe_wood", + burntime = 5, +}) diff --git a/mods/farming/license.txt b/mods/farming/license.txt new file mode 100644 index 0000000..8cbb63a --- /dev/null +++ b/mods/farming/license.txt @@ -0,0 +1,61 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 webdesigner97 +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +License of media (textures) +--------------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 MasterGollum +Copyright (C) 2015-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua new file mode 100644 index 0000000..09ad36f --- /dev/null +++ b/mods/farming/nodes.lua @@ -0,0 +1,163 @@ +minetest.override_item("default:dirt", { + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:dirt_with_grass", { + soil = { + base = "default:dirt_with_grass", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:dirt_with_dry_grass", { + soil = { + base = "default:dirt_with_dry_grass", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.register_node("farming:soil", { + description = "Soil", + tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1}, + sounds = default.node_sound_dirt_defaults(), + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.register_node("farming:soil_wet", { + description = "Wet Soil", + tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1}, + sounds = default.node_sound_dirt_defaults(), + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:desert_sand", { + groups = {crumbly=3, falling_node=1, sand=1, soil = 1}, + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) +minetest.register_node("farming:desert_sand_soil", { + description = "Desert Sand Soil", + drop = "default:desert_sand", + tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"}, + groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1}, + sounds = default.node_sound_sand_defaults(), + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) + +minetest.register_node("farming:desert_sand_soil_wet", { + description = "Wet Desert Sand Soil", + drop = "default:desert_sand", + tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"}, + groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1}, + sounds = default.node_sound_sand_defaults(), + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) + +minetest.register_node("farming:straw", { + description = "Straw", + tiles = {"farming_straw.png"}, + is_ground_content = false, + groups = {snappy=3, flammable=4, fall_damage_add_percent=-30}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + label = "Farming soil", + nodenames = {"group:field"}, + interval = 15, + chance = 4, + action = function(pos, node) + local n_def = minetest.registered_nodes[node.name] or nil + local wet = n_def.soil.wet or nil + local base = n_def.soil.base or nil + local dry = n_def.soil.dry or nil + if not n_def or not n_def.soil or not wet or not base or not dry then + return + end + + pos.y = pos.y + 1 + local nn = minetest.get_node_or_nil(pos) + if not nn or not nn.name then + return + end + local nn_def = minetest.registered_nodes[nn.name] or nil + pos.y = pos.y - 1 + + if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then + minetest.set_node(pos, {name = base}) + return + end + -- check if there is water nearby + local wet_lvl = minetest.get_item_group(node.name, "wet") + if minetest.find_node_near(pos, 3, {"group:water"}) then + -- if it is dry soil and not base node, turn it into wet soil + if wet_lvl == 0 then + minetest.set_node(pos, {name = wet}) + end + else + -- only turn back if there are no unloaded blocks (and therefore + -- possible water sources) nearby + if not minetest.find_node_near(pos, 3, {"ignore"}) then + -- turn it back into base if it is already dry + if wet_lvl == 0 then + -- only turn it back if there is no plant/seed on top of it + if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then + minetest.set_node(pos, {name = base}) + end + + -- if its wet turn it back into dry soil + elseif wet_lvl == 1 then + minetest.set_node(pos, {name = dry}) + end + end + end + end, +}) + + +for i = 1, 5 do + minetest.override_item("default:grass_"..i, {drop = { + max_items = 1, + items = { + {items = {'farming:seed_wheat'},rarity = 5}, + {items = {'default:grass_1'}}, + } + }}) +end + +minetest.override_item("default:junglegrass", {drop = { + max_items = 1, + items = { + {items = {'farming:seed_cotton'},rarity = 8}, + {items = {'default:junglegrass'}}, + } +}}) diff --git a/mods/farming/textures/farming_bread.png b/mods/farming/textures/farming_bread.png new file mode 100644 index 0000000..0c25678 Binary files /dev/null and b/mods/farming/textures/farming_bread.png differ diff --git a/mods/farming/textures/farming_cotton.png b/mods/farming/textures/farming_cotton.png new file mode 100644 index 0000000..e2bbfd7 Binary files /dev/null and b/mods/farming/textures/farming_cotton.png differ diff --git a/mods/farming/textures/farming_cotton_1.png b/mods/farming/textures/farming_cotton_1.png new file mode 100644 index 0000000..5fc2180 Binary files /dev/null and b/mods/farming/textures/farming_cotton_1.png differ diff --git a/mods/farming/textures/farming_cotton_2.png b/mods/farming/textures/farming_cotton_2.png new file mode 100644 index 0000000..db4f4a3 Binary files /dev/null and b/mods/farming/textures/farming_cotton_2.png differ diff --git a/mods/farming/textures/farming_cotton_3.png b/mods/farming/textures/farming_cotton_3.png new file mode 100644 index 0000000..df3d7a7 Binary files /dev/null and b/mods/farming/textures/farming_cotton_3.png differ diff --git a/mods/farming/textures/farming_cotton_4.png b/mods/farming/textures/farming_cotton_4.png new file mode 100644 index 0000000..f314b07 Binary files /dev/null and b/mods/farming/textures/farming_cotton_4.png differ diff --git a/mods/farming/textures/farming_cotton_5.png b/mods/farming/textures/farming_cotton_5.png new file mode 100644 index 0000000..3e89085 Binary files /dev/null and b/mods/farming/textures/farming_cotton_5.png differ diff --git a/mods/farming/textures/farming_cotton_6.png b/mods/farming/textures/farming_cotton_6.png new file mode 100644 index 0000000..f4bd4fb Binary files /dev/null and b/mods/farming/textures/farming_cotton_6.png differ diff --git a/mods/farming/textures/farming_cotton_7.png b/mods/farming/textures/farming_cotton_7.png new file mode 100644 index 0000000..466d40a Binary files /dev/null and b/mods/farming/textures/farming_cotton_7.png differ diff --git a/mods/farming/textures/farming_cotton_8.png b/mods/farming/textures/farming_cotton_8.png new file mode 100644 index 0000000..f835ba5 Binary files /dev/null and b/mods/farming/textures/farming_cotton_8.png differ diff --git a/mods/farming/textures/farming_cotton_seed.png b/mods/farming/textures/farming_cotton_seed.png new file mode 100644 index 0000000..f1d5b8a Binary files /dev/null and b/mods/farming/textures/farming_cotton_seed.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil.png b/mods/farming/textures/farming_desert_sand_soil.png new file mode 100644 index 0000000..3c09ef0 Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil_wet.png b/mods/farming/textures/farming_desert_sand_soil_wet.png new file mode 100644 index 0000000..facc83e Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil_wet.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil_wet_side.png b/mods/farming/textures/farming_desert_sand_soil_wet_side.png new file mode 100644 index 0000000..41e5a04 Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_flour.png b/mods/farming/textures/farming_flour.png new file mode 100644 index 0000000..b1a9783 Binary files /dev/null and b/mods/farming/textures/farming_flour.png differ diff --git a/mods/farming/textures/farming_soil.png b/mods/farming/textures/farming_soil.png new file mode 100644 index 0000000..5cd3e68 Binary files /dev/null and b/mods/farming/textures/farming_soil.png differ diff --git a/mods/farming/textures/farming_soil_wet.png b/mods/farming/textures/farming_soil_wet.png new file mode 100644 index 0000000..0b4487d Binary files /dev/null and b/mods/farming/textures/farming_soil_wet.png differ diff --git a/mods/farming/textures/farming_soil_wet_side.png b/mods/farming/textures/farming_soil_wet_side.png new file mode 100644 index 0000000..f0b1bd4 Binary files /dev/null and b/mods/farming/textures/farming_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_straw.png b/mods/farming/textures/farming_straw.png new file mode 100644 index 0000000..f9f5fe7 Binary files /dev/null and b/mods/farming/textures/farming_straw.png differ diff --git a/mods/farming/textures/farming_tool_bronzehoe.png b/mods/farming/textures/farming_tool_bronzehoe.png new file mode 100644 index 0000000..2802d11 Binary files /dev/null and b/mods/farming/textures/farming_tool_bronzehoe.png differ diff --git a/mods/farming/textures/farming_tool_diamondhoe.png b/mods/farming/textures/farming_tool_diamondhoe.png new file mode 100644 index 0000000..66f1042 Binary files /dev/null and b/mods/farming/textures/farming_tool_diamondhoe.png differ diff --git a/mods/farming/textures/farming_tool_mesehoe.png b/mods/farming/textures/farming_tool_mesehoe.png new file mode 100644 index 0000000..4534fba Binary files /dev/null and b/mods/farming/textures/farming_tool_mesehoe.png differ diff --git a/mods/farming/textures/farming_tool_steelhoe.png b/mods/farming/textures/farming_tool_steelhoe.png new file mode 100644 index 0000000..d057af2 Binary files /dev/null and b/mods/farming/textures/farming_tool_steelhoe.png differ diff --git a/mods/farming/textures/farming_tool_stonehoe.png b/mods/farming/textures/farming_tool_stonehoe.png new file mode 100644 index 0000000..55d8123 Binary files /dev/null and b/mods/farming/textures/farming_tool_stonehoe.png differ diff --git a/mods/farming/textures/farming_tool_woodhoe.png b/mods/farming/textures/farming_tool_woodhoe.png new file mode 100644 index 0000000..a287152 Binary files /dev/null and b/mods/farming/textures/farming_tool_woodhoe.png differ diff --git a/mods/farming/textures/farming_wheat.png b/mods/farming/textures/farming_wheat.png new file mode 100644 index 0000000..1e0ad3b Binary files /dev/null and b/mods/farming/textures/farming_wheat.png differ diff --git a/mods/farming/textures/farming_wheat_1.png b/mods/farming/textures/farming_wheat_1.png new file mode 100644 index 0000000..c16ad94 Binary files /dev/null and b/mods/farming/textures/farming_wheat_1.png differ diff --git a/mods/farming/textures/farming_wheat_2.png b/mods/farming/textures/farming_wheat_2.png new file mode 100644 index 0000000..baddb4c Binary files /dev/null and b/mods/farming/textures/farming_wheat_2.png differ diff --git a/mods/farming/textures/farming_wheat_3.png b/mods/farming/textures/farming_wheat_3.png new file mode 100644 index 0000000..36ebb19 Binary files /dev/null and b/mods/farming/textures/farming_wheat_3.png differ diff --git a/mods/farming/textures/farming_wheat_4.png b/mods/farming/textures/farming_wheat_4.png new file mode 100644 index 0000000..735ed77 Binary files /dev/null and b/mods/farming/textures/farming_wheat_4.png differ diff --git a/mods/farming/textures/farming_wheat_5.png b/mods/farming/textures/farming_wheat_5.png new file mode 100644 index 0000000..f40b5f0 Binary files /dev/null and b/mods/farming/textures/farming_wheat_5.png differ diff --git a/mods/farming/textures/farming_wheat_6.png b/mods/farming/textures/farming_wheat_6.png new file mode 100644 index 0000000..e9c78e0 Binary files /dev/null and b/mods/farming/textures/farming_wheat_6.png differ diff --git a/mods/farming/textures/farming_wheat_7.png b/mods/farming/textures/farming_wheat_7.png new file mode 100644 index 0000000..cc26ca9 Binary files /dev/null and b/mods/farming/textures/farming_wheat_7.png differ diff --git a/mods/farming/textures/farming_wheat_8.png b/mods/farming/textures/farming_wheat_8.png new file mode 100644 index 0000000..d050093 Binary files /dev/null and b/mods/farming/textures/farming_wheat_8.png differ diff --git a/mods/farming/textures/farming_wheat_seed.png b/mods/farming/textures/farming_wheat_seed.png new file mode 100644 index 0000000..a9031fb Binary files /dev/null and b/mods/farming/textures/farming_wheat_seed.png differ diff --git a/mods/fire/README.txt b/mods/fire/README.txt new file mode 100644 index 0000000..099da1c --- /dev/null +++ b/mods/fire/README.txt @@ -0,0 +1,35 @@ +Minetest Game mod: fire +======================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures and sounds) +-------------------------------------- +Everything not listed in here: +Copyright (C) 2012 Perttu Ahola (celeron55) (CC BY-SA 3.0) + +Muadtralk (CC BY-SA 3.0) + fire_basic_flame_animated.png + +Gambit (CC BY-SA 3.0) + fire_flint_steel.png + +dobroide (CC BY 3.0) +http://www.freesound.org/people/dobroide/sounds/4211/ + fire_small.ogg + +Dynamicell (CC BY 3.0) +http://www.freesound.org/people/Dynamicell/sounds/17548/ + fire_large.ogg + fire_fire.*.ogg + +fire_small.ogg and fire_large.ogg are unused but kept temporarily to not break +other mods that may use them. + +Benboncan (CC BY 3.0) +https://www.freesound.org/people/Benboncan/sounds/66457/ + fire_flint_and_steel.ogg diff --git a/mods/fire/depends.txt b/mods/fire/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/fire/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/fire/init.lua b/mods/fire/init.lua new file mode 100644 index 0000000..a6dc1e5 --- /dev/null +++ b/mods/fire/init.lua @@ -0,0 +1,359 @@ +-- Global namespace for functions + +fire = {} + + +-- +-- Items +-- + +-- Flame nodes + +minetest.register_node("fire:basic_flame", { + drawtype = "firelike", + tiles = { + { + name = "fire_basic_flame_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1 + }, + }, + }, + inventory_image = "fire_basic_flame.png", + paramtype = "light", + light_source = 13, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + damage_per_second = 4, + groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1}, + on_timer = function(pos) + local f = minetest.find_node_near(pos, 1, {"group:flammable"}) + if not f then + minetest.remove_node(pos) + return + end + -- Restart timer + return true + end, + drop = "", + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(30, 60)) + end, +}) + +minetest.register_node("fire:permanent_flame", { + description = "Permanent Flame", + drawtype = "firelike", + tiles = { + { + name = "fire_basic_flame_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1 + }, + }, + }, + inventory_image = "fire_basic_flame.png", + paramtype = "light", + light_source = 13, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + damage_per_second = 4, + groups = {igniter = 2, dig_immediate = 3}, + drop = "", +}) + + +-- Flint and steel + +minetest.register_tool("fire:flint_and_steel", { + description = "Flint and Steel", + inventory_image = "fire_flint_steel.png", + sound = {breaks = "default_tool_breaks"}, + + on_use = function(itemstack, user, pointed_thing) + local pt = pointed_thing + minetest.sound_play( + "fire_flint_and_steel", + {pos = pt.above, gain = 0.5, max_hear_distance = 8} + ) + if pt.type == "node" then + local node_under = minetest.get_node(pt.under).name + local nodedef = minetest.registered_nodes[node_under] + if not nodedef then + return + end + local player_name = user:get_player_name() + if minetest.is_protected(pt.under, player_name) then + minetest.chat_send_player(player_name, "This area is protected") + return + end + if nodedef.on_ignite then + nodedef.on_ignite(pt.under, user) + elseif minetest.get_item_group(node_under, "flammable") >= 1 + and minetest.get_node(pt.above).name == "air" then + minetest.set_node(pt.above, {name = "fire:basic_flame"}) + end + end + if not minetest.setting_getbool("creative_mode") then + -- Wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(1000) + -- Tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) + end + return itemstack + end + end +}) + +minetest.register_craft({ + output = "fire:flint_and_steel", + recipe = { + {"default:flint", "default:steel_ingot"} + } +}) + + +-- Override coalblock to enable permanent flame above +-- Coalblock is non-flammable to avoid unwanted basic_flame nodes + +minetest.override_item("default:coalblock", { + after_destruct = function(pos, oldnode) + pos.y = pos.y + 1 + if minetest.get_node(pos).name == "fire:permanent_flame" then + minetest.remove_node(pos) + end + end, + on_ignite = function(pos, igniter) + local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.get_node(flame_pos).name == "air" then + minetest.set_node(flame_pos, {name = "fire:permanent_flame"}) + end + end, +}) + + +-- +-- Sound +-- + +local flame_sound = minetest.setting_getbool("flame_sound") +if flame_sound == nil then + -- Enable if no setting present + flame_sound = true +end + +if flame_sound then + + local handles = {} + local timer = 0 + + -- Parameters + + local radius = 8 -- Flame node search radius around player + local cycle = 3 -- Cycle time for sound updates + + -- Update sound for player + + function fire.update_player_sound(player) + local player_name = player:get_player_name() + -- Search for flame nodes in radius around player + local ppos = player:getpos() + local areamin = vector.subtract(ppos, radius) + local areamax = vector.add(ppos, radius) + local fpos, num = minetest.find_nodes_in_area( + areamin, + areamax, + {"fire:basic_flame", "fire:permanent_flame"} + ) + -- Total number of flames in radius + local flames = (num["fire:basic_flame"] or 0) + + (num["fire:permanent_flame"] or 0) + -- Stop previous sound + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + -- If flames + if flames > 0 then + -- Find centre of flame positions + local fposmid = fpos[1] + -- If more than 1 flame + if #fpos > 1 then + local fposmin = areamax + local fposmax = areamin + for i = 1, #fpos do + local fposi = fpos[i] + if fposi.x > fposmax.x then + fposmax.x = fposi.x + end + if fposi.y > fposmax.y then + fposmax.y = fposi.y + end + if fposi.z > fposmax.z then + fposmax.z = fposi.z + end + if fposi.x < fposmin.x then + fposmin.x = fposi.x + end + if fposi.y < fposmin.y then + fposmin.y = fposi.y + end + if fposi.z < fposmin.z then + fposmin.z = fposi.z + end + end + fposmid = vector.divide(vector.add(fposmin, fposmax), 2) + end + -- Play sound + local handle = minetest.sound_play( + "fire_fire", + { + pos = fposmid, + to_player = player_name, + gain = math.min(0.06 * (1 + flames * 0.125), 0.18), + max_hear_distance = 32, + loop = true, -- In case of lag + } + ) + -- Store sound handle for this player + if handle then + handles[player_name] = handle + end + end + end + + -- Cycle for updating players sounds + + minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer < cycle then + return + end + + timer = 0 + local players = minetest.get_connected_players() + for n = 1, #players do + fire.update_player_sound(players[n]) + end + end) + + -- Stop sound and clear handle on player leave + + minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + end) +end + + +-- Deprecated function kept temporarily to avoid crashes if mod fire nodes call it + +function fire.update_sounds_around(pos) +end + + +-- +-- ABMs +-- + +-- Extinguish all flames quickly with water, snow, ice + +minetest.register_abm({ + label = "Extinguish flame", + nodenames = {"fire:basic_flame", "fire:permanent_flame"}, + neighbors = {"group:puts_out_fire"}, + interval = 3, + chance = 1, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.remove_node(pos) + minetest.sound_play("fire_extinguish_flame", + {pos = pos, max_hear_distance = 16, gain = 0.15}) + end, +}) + + +-- Enable the following ABMs according to 'enable fire' setting + +local fire_enabled = minetest.setting_getbool("enable_fire") +if fire_enabled == nil then + -- New setting not specified, check for old setting. + -- If old setting is also not specified, 'not nil' is true. + fire_enabled = not minetest.setting_getbool("disable_fire") +end + +if not fire_enabled then + + -- Remove basic flames only if fire disabled + + minetest.register_abm({ + label = "Remove disabled fire", + nodenames = {"fire:basic_flame"}, + interval = 7, + chance = 1, + catch_up = false, + action = minetest.remove_node, + }) + +else -- Fire enabled + + -- Ignite neighboring nodes, add basic flames + + minetest.register_abm({ + label = "Ignite flame", + nodenames = {"group:flammable"}, + neighbors = {"group:igniter"}, + interval = 7, + chance = 12, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + -- If there is water or stuff like that around node, don't ignite + if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then + return + end + local p = minetest.find_node_near(pos, 1, {"air"}) + if p then + minetest.set_node(p, {name = "fire:basic_flame"}) + end + end, + }) + + -- Remove flammable nodes around basic flame + + minetest.register_abm({ + label = "Remove flammable nodes", + nodenames = {"fire:basic_flame"}, + neighbors = "group:flammable", + interval = 5, + chance = 18, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + local p = minetest.find_node_near(pos, 1, {"group:flammable"}) + if p then + local flammable_node = minetest.get_node(p) + local def = minetest.registered_nodes[flammable_node.name] + if def.on_burn then + def.on_burn(p) + else + minetest.remove_node(p) + minetest.check_for_falling(p) + end + end + end, + }) + +end diff --git a/mods/fire/license.txt b/mods/fire/license.txt new file mode 100644 index 0000000..43f9cd7 --- /dev/null +++ b/mods/fire/license.txt @@ -0,0 +1,84 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures and sounds) +--------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Muadtralk +Copyright (C) 2013-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2005 dobroide +Copyright (C) 2006 Dynamicell +Copyright (C) 2009 Benboncan + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/fire/sounds/fire_extinguish_flame.1.ogg b/mods/fire/sounds/fire_extinguish_flame.1.ogg new file mode 100644 index 0000000..42506dd Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.1.ogg differ diff --git a/mods/fire/sounds/fire_extinguish_flame.2.ogg b/mods/fire/sounds/fire_extinguish_flame.2.ogg new file mode 100644 index 0000000..2747ab8 Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.2.ogg differ diff --git a/mods/fire/sounds/fire_extinguish_flame.3.ogg b/mods/fire/sounds/fire_extinguish_flame.3.ogg new file mode 100644 index 0000000..8baeac3 Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.3.ogg differ diff --git a/mods/fire/sounds/fire_fire.1.ogg b/mods/fire/sounds/fire_fire.1.ogg new file mode 100644 index 0000000..cbfee4c Binary files /dev/null and b/mods/fire/sounds/fire_fire.1.ogg differ diff --git a/mods/fire/sounds/fire_fire.2.ogg b/mods/fire/sounds/fire_fire.2.ogg new file mode 100644 index 0000000..e8d0eb1 Binary files /dev/null and b/mods/fire/sounds/fire_fire.2.ogg differ diff --git a/mods/fire/sounds/fire_fire.3.ogg b/mods/fire/sounds/fire_fire.3.ogg new file mode 100644 index 0000000..5cad3d9 Binary files /dev/null and b/mods/fire/sounds/fire_fire.3.ogg differ diff --git a/mods/fire/sounds/fire_flint_and_steel.ogg b/mods/fire/sounds/fire_flint_and_steel.ogg new file mode 100644 index 0000000..6996e16 Binary files /dev/null and b/mods/fire/sounds/fire_flint_and_steel.ogg differ diff --git a/mods/fire/sounds/fire_large.ogg b/mods/fire/sounds/fire_large.ogg new file mode 100644 index 0000000..fe78e62 Binary files /dev/null and b/mods/fire/sounds/fire_large.ogg differ diff --git a/mods/fire/sounds/fire_small.ogg b/mods/fire/sounds/fire_small.ogg new file mode 100644 index 0000000..5aac595 Binary files /dev/null and b/mods/fire/sounds/fire_small.ogg differ diff --git a/mods/fire/textures/fire_basic_flame.png b/mods/fire/textures/fire_basic_flame.png new file mode 100644 index 0000000..1da0702 Binary files /dev/null and b/mods/fire/textures/fire_basic_flame.png differ diff --git a/mods/fire/textures/fire_basic_flame_animated.png b/mods/fire/textures/fire_basic_flame_animated.png new file mode 100644 index 0000000..1cdd9fd Binary files /dev/null and b/mods/fire/textures/fire_basic_flame_animated.png differ diff --git a/mods/fire/textures/fire_flint_steel.png b/mods/fire/textures/fire_flint_steel.png new file mode 100644 index 0000000..c262ebc Binary files /dev/null and b/mods/fire/textures/fire_flint_steel.png differ diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt new file mode 100644 index 0000000..2a5e4de --- /dev/null +++ b/mods/flowers/README.txt @@ -0,0 +1,26 @@ +Minetest Game mod: flowers +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Ironzorg (MIT) and VanessaE (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +RHRhino (CC BY-SA 3.0): + flowers_dandelion_white.png + flowers_dandelion_yellow.png + flowers_geranium.png + flowers_rose.png + flowers_tulip.png + flowers_viola.png + +Gambit (CC BY-SA 3.0): + flowers_mushroom_brown.png + flowers_mushroom_red.png + flowers_waterlily.png + +yyt16384 (CC BY-SA 3.0): + flowers_waterlily_bottom.png, derived from Gambit's texture diff --git a/mods/flowers/depends.txt b/mods/flowers/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/flowers/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua new file mode 100644 index 0000000..c7cc670 --- /dev/null +++ b/mods/flowers/init.lua @@ -0,0 +1,296 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + + +-- Namespace for functions + +flowers = {} + + +-- Map Generation + +dofile(minetest.get_modpath("flowers") .. "/mapgen.lua") + + +-- +-- Flowers +-- + +-- Aliases for original flowers mod + +minetest.register_alias("flowers:flower_rose", "flowers:rose") +minetest.register_alias("flowers:flower_tulip", "flowers:tulip") +minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow") +minetest.register_alias("flowers:flower_geranium", "flowers:geranium") +minetest.register_alias("flowers:flower_viola", "flowers:viola") +minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white") + + +-- Flower registration + +local function add_simple_flower(name, desc, box, f_groups) + -- Common flowers' groups + f_groups.snappy = 3 + f_groups.flower = 1 + f_groups.flora = 1 + f_groups.attached_node = 1 + + minetest.register_node("flowers:" .. name, { + description = desc, + drawtype = "plantlike", + waving = 1, + tiles = {"flowers_" .. name .. ".png"}, + inventory_image = "flowers_" .. name .. ".png", + wield_image = "flowers_" .. name .. ".png", + sunlight_propagates = true, + paramtype = "light", + walkable = false, + buildable_to = true, + stack_max = 99, + groups = f_groups, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = box + } + }) +end + +flowers.datas = { + { + "rose", + "Rose", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 5 / 16, 2 / 16}, + {color_red = 1, flammable = 1} + }, + { + "tulip", + "Orange Tulip", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16}, + {color_orange = 1, flammable = 1} + }, + { + "dandelion_yellow", + "Yellow Dandelion", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 4 / 16, 2 / 16}, + {color_yellow = 1, flammable = 1} + }, + { + "geranium", + "Blue Geranium", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16}, + {color_blue = 1, flammable = 1} + }, + { + "viola", + "Viola", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -1 / 16, 5 / 16}, + {color_violet = 1, flammable = 1} + }, + { + "dandelion_white", + "White dandelion", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16}, + {color_white = 1, flammable = 1} + }, +} + +for _,item in pairs(flowers.datas) do + add_simple_flower(unpack(item)) +end + + +-- Flower spread +-- Public function to enable override by mods + +function flowers.flower_spread(pos, node) + pos.y = pos.y - 1 + local under = minetest.get_node(pos) + pos.y = pos.y + 1 + if under.name == "default:desert_sand" then + minetest.set_node(pos, {name = "default:dry_shrub"}) + return + elseif under.name ~= "default:dirt_with_grass" and + under.name ~= "default:dirt_with_dry_grass" then + return + end + + local light = minetest.get_node_light(pos) + if not light or light < 13 then + return + end + + local pos0 = vector.subtract(pos, 4) + local pos1 = vector.add(pos, 4) + if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then + return + end + + local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, + {"default:dirt_with_grass", "default:dirt_with_dry_grass"}) + if #seedling > 0 then + seedling = seedling[math.random(#seedling)] + seedling.y = seedling.y + 1 + light = minetest.get_node_light(seedling) + if not light or light < 13 then + return + end + minetest.set_node(seedling, {name = node.name}) + end +end + +minetest.register_abm({ + label = "Flower spread", + nodenames = {"group:flora"}, + neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass", + "default:desert_sand"}, + interval = 13, + chance = 96, + action = function(...) + flowers.flower_spread(...) + end, +}) + + +-- +-- Mushrooms +-- + +minetest.register_node("flowers:mushroom_red", { + description = "Red Mushroom", + tiles = {"flowers_mushroom_red.png"}, + inventory_image = "flowers_mushroom_red.png", + wield_image = "flowers_mushroom_red.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(-5), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +minetest.register_node("flowers:mushroom_brown", { + description = "Brown Mushroom", + tiles = {"flowers_mushroom_brown.png"}, + inventory_image = "flowers_mushroom_brown.png", + wield_image = "flowers_mushroom_brown.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(1), + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, -2 / 16, 3 / 16}, + } +}) + + +-- Mushroom spread and death + +minetest.register_abm({ + label = "Mushroom spread", + nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, + interval = 11, + chance = 50, + action = function(pos, node) + if minetest.get_node_light(pos, nil) == 15 then + minetest.remove_node(pos) + return + end + local random = { + x = pos.x + math.random(-2, 2), + y = pos.y + math.random(-1, 1), + z = pos.z + math.random(-2, 2) + } + local random_node = minetest.get_node_or_nil(random) + if not random_node or random_node.name ~= "air" then + return + end + local node_under = minetest.get_node_or_nil({x = random.x, + y = random.y - 1, z = random.z}) + if not node_under then + return + end + + if (minetest.get_item_group(node_under.name, "soil") ~= 0 or + minetest.get_item_group(node_under.name, "tree") ~= 0) and + minetest.get_node_light(pos, 0.5) <= 3 and + minetest.get_node_light(random, 0.5) <= 3 then + minetest.set_node(random, {name = node.name}) + end + end +}) + + +-- These old mushroom related nodes can be simplified now + +minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red") +minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red") +minetest.register_alias("mushroom:brown_natural", "flowers:mushroom_brown") +minetest.register_alias("mushroom:red_natural", "flowers:mushroom_red") + + +-- +-- Waterlily +-- + +minetest.register_node("flowers:waterlily", { + description = "Waterlily", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"}, + inventory_image = "flowers_waterlily.png", + wield_image = "flowers_waterlily.png", + liquids_pointable = true, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + floodable = true, + groups = {snappy = 3, flower = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + node_placement_prediction = "", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -15 / 32, 0.5} + }, + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16} + }, + + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.above + local node = minetest.get_node(pointed_thing.under).name + local def = minetest.registered_nodes[node] + local player_name = placer:get_player_name() + + if def and def.liquidtype == "source" and + minetest.get_item_group(node, "water") > 0 then + if not minetest.is_protected(pos, player_name) then + minetest.set_node(pos, {name = "flowers:waterlily", + param2 = math.random(0, 3)}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + else + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) + end + end + + return itemstack + end +}) diff --git a/mods/flowers/license.txt b/mods/flowers/license.txt new file mode 100644 index 0000000..d301162 --- /dev/null +++ b/mods/flowers/license.txt @@ -0,0 +1,62 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Ironzorg, VanessaE +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 RHRhino +Copyright (C) 2015-2016 Gambit +Copyright (C) 2016 yyt16384 + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua new file mode 100644 index 0000000..ec03c9b --- /dev/null +++ b/mods/flowers/mapgen.lua @@ -0,0 +1,169 @@ +-- +-- Mgv6 +-- + +local function register_mgv6_flower(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.006, + spread = {x = 100, y = 100, z = 100}, + seed = 436, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "flowers:"..name, + }) +end + +local function register_mgv6_mushroom(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.04, + spread = {x = 100, y = 100, z = 100}, + seed = 7133, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "flowers:"..name, + spawn_by = "default:tree", + num_spawn_by = 1, + }) +end + +local function register_mgv6_waterlily() + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.12, + scale = 0.3, + spread = {x = 100, y = 100, z = 100}, + seed = 33, + octaves = 3, + persist = 0.7 + }, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts", + rotation = "random", + }) +end + +function flowers.register_mgv6_decorations() + register_mgv6_flower("rose") + register_mgv6_flower("tulip") + register_mgv6_flower("dandelion_yellow") + register_mgv6_flower("geranium") + register_mgv6_flower("viola") + register_mgv6_flower("dandelion_white") + + register_mgv6_mushroom("mushroom_brown") + register_mgv6_mushroom("mushroom_red") + + register_mgv6_waterlily() +end + + +-- +-- All other biome API mapgens +-- + +local function register_flower(seed, name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.015, + scale = 0.025, + spread = {x = 200, y = 200, z = 200}, + seed = seed, + octaves = 3, + persist = 0.6 + }, + biomes = {"grassland", "deciduous_forest", "coniferous_forest"}, + y_min = 1, + y_max = 31000, + decoration = "flowers:"..name, + }) +end + +local function register_mushroom(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.006, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest", "coniferous_forest"}, + y_min = 1, + y_max = 31000, + decoration = "flowers:"..name, + }) +end + +local function register_waterlily() + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.12, + scale = 0.3, + spread = {x = 200, y = 200, z = 200}, + seed = 33, + octaves = 3, + persist = 0.7 + }, + biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"}, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts", + rotation = "random", + }) +end + +function flowers.register_decorations() + register_flower(436, "rose") + register_flower(19822, "tulip") + register_flower(1220999, "dandelion_yellow") + register_flower(36662, "geranium") + register_flower(1133, "viola") + register_flower(73133, "dandelion_white") + + register_mushroom("mushroom_brown") + register_mushroom("mushroom_red") + + register_waterlily() +end + + +-- +-- Detect mapgen to select functions +-- + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then + flowers.register_mgv6_decorations() +else + flowers.register_decorations() +end diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts new file mode 100644 index 0000000..69e1d8e Binary files /dev/null and b/mods/flowers/schematics/waterlily.mts differ diff --git a/mods/flowers/textures/flowers_dandelion_white.png b/mods/flowers/textures/flowers_dandelion_white.png new file mode 100644 index 0000000..1bc02fb Binary files /dev/null and b/mods/flowers/textures/flowers_dandelion_white.png differ diff --git a/mods/flowers/textures/flowers_dandelion_yellow.png b/mods/flowers/textures/flowers_dandelion_yellow.png new file mode 100644 index 0000000..ec11c1c Binary files /dev/null and b/mods/flowers/textures/flowers_dandelion_yellow.png differ diff --git a/mods/flowers/textures/flowers_geranium.png b/mods/flowers/textures/flowers_geranium.png new file mode 100644 index 0000000..88de1d7 Binary files /dev/null and b/mods/flowers/textures/flowers_geranium.png differ diff --git a/mods/flowers/textures/flowers_mushroom_brown.png b/mods/flowers/textures/flowers_mushroom_brown.png new file mode 100644 index 0000000..33ffcd4 Binary files /dev/null and b/mods/flowers/textures/flowers_mushroom_brown.png differ diff --git a/mods/flowers/textures/flowers_mushroom_red.png b/mods/flowers/textures/flowers_mushroom_red.png new file mode 100644 index 0000000..a68f5d5 Binary files /dev/null and b/mods/flowers/textures/flowers_mushroom_red.png differ diff --git a/mods/flowers/textures/flowers_rose.png b/mods/flowers/textures/flowers_rose.png new file mode 100644 index 0000000..e3b841d Binary files /dev/null and b/mods/flowers/textures/flowers_rose.png differ diff --git a/mods/flowers/textures/flowers_tulip.png b/mods/flowers/textures/flowers_tulip.png new file mode 100644 index 0000000..471fcd3 Binary files /dev/null and b/mods/flowers/textures/flowers_tulip.png differ diff --git a/mods/flowers/textures/flowers_viola.png b/mods/flowers/textures/flowers_viola.png new file mode 100644 index 0000000..ca2d750 Binary files /dev/null and b/mods/flowers/textures/flowers_viola.png differ diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png new file mode 100644 index 0000000..305c445 Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily.png differ diff --git a/mods/flowers/textures/flowers_waterlily_bottom.png b/mods/flowers/textures/flowers_waterlily_bottom.png new file mode 100644 index 0000000..3dbeaf4 Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily_bottom.png differ diff --git a/mods/give_initial_stuff/README.txt b/mods/give_initial_stuff/README.txt new file mode 100644 index 0000000..cbd240f --- /dev/null +++ b/mods/give_initial_stuff/README.txt @@ -0,0 +1,8 @@ +Minetest Game mod: give_initial_stuff +===================================== +See license.txt for license information. + +Authors of source code +---------------------- +Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) diff --git a/mods/give_initial_stuff/depends.txt b/mods/give_initial_stuff/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/give_initial_stuff/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/give_initial_stuff/init.lua b/mods/give_initial_stuff/init.lua new file mode 100644 index 0000000..022b743 --- /dev/null +++ b/mods/give_initial_stuff/init.lua @@ -0,0 +1,44 @@ +local stuff_string = minetest.setting_get("initial_stuff") or + "default:pick_steel,default:axe_steel,default:shovel_steel," .. + "default:torch 99,default:cobble 99" + +give_initial_stuff = { + items = {} +} + +function give_initial_stuff.give(player) + minetest.log("action", + "Giving initial stuff to player " .. player:get_player_name()) + local inv = player:get_inventory() + for _, stack in ipairs(give_initial_stuff.items) do + inv:add_item("main", stack) + end +end + +function give_initial_stuff.add(stack) + give_initial_stuff.items[#give_initial_stuff.items + 1] = ItemStack(stack) +end + +function give_initial_stuff.clear() + give_initial_stuff.items = {} +end + +function give_initial_stuff.add_from_csv(str) + local items = str:split(",") + for _, itemname in ipairs(items) do + give_initial_stuff.add(itemname) + end +end + +function give_initial_stuff.set_list(list) + give_initial_stuff.items = list +end + +function give_initial_stuff.get_list() + return give_initial_stuff.items +end + +give_initial_stuff.add_from_csv(stuff_string) +if minetest.setting_getbool("give_initial_stuff") then + minetest.register_on_newplayer(give_initial_stuff.give) +end diff --git a/mods/give_initial_stuff/license.txt b/mods/give_initial_stuff/license.txt new file mode 100644 index 0000000..8134c92 --- /dev/null +++ b/mods/give_initial_stuff/license.txt @@ -0,0 +1,25 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/killme/init.lua b/mods/killme/init.lua new file mode 100644 index 0000000..06aa39d --- /dev/null +++ b/mods/killme/init.lua @@ -0,0 +1,24 @@ +minetest.register_chatcommand("killme", { + description = "Kill yourself to respawn", + func = function(name) + local player = minetest.get_player_by_name(name) + if player then + if minetest.setting_getbool("enable_damage") then + player:set_hp(0) + return true + else + for _, callback in pairs(core.registered_on_respawnplayers) do + if callback(player) then + return true + end + end + + -- There doesn't seem to be a way to get a default spawn pos from the lua API + return false, "No static_spawnpoint defined" + end + else + -- Show error message if used when not logged in, eg: from IRC mod + return false, "You need to be online to be killed!" + end + end +}) diff --git a/mods/screwdriver/README.txt b/mods/screwdriver/README.txt new file mode 100644 index 0000000..9d39c58 --- /dev/null +++ b/mods/screwdriver/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: screwdriver +============================== +See license.txt for license information. + +License of source code +---------------------- +Originally by RealBadAngel, Maciej Kasatkin (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +License of media (textures) +--------------------------- +Created by Gambit (CC BY-SA 3.0): + screwdriver.png diff --git a/mods/screwdriver/init.lua b/mods/screwdriver/init.lua new file mode 100644 index 0000000..e73b618 --- /dev/null +++ b/mods/screwdriver/init.lua @@ -0,0 +1,117 @@ +screwdriver = {} + +local function nextrange(x, max) + x = x + 1 + if x > max then + x = 0 + end + return x +end + +screwdriver.ROTATE_FACE = 1 +screwdriver.ROTATE_AXIS = 2 +screwdriver.disallow = function(pos, node, user, mode, new_param2) + return false +end +screwdriver.rotate_simple = function(pos, node, user, mode, new_param2) + if mode ~= screwdriver.ROTATE_FACE then + return false + end +end + +-- Handles rotation +screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses) + if pointed_thing.type ~= "node" then + return + end + + local pos = pointed_thing.under + + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return + end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + -- verify node is facedir (expected to be rotatable) + if not ndef or ndef.paramtype2 ~= "facedir" then + return + end + -- Compute param2 + local rotationPart = node.param2 % 32 -- get first 4 bits + local preservePart = node.param2 - rotationPart + local axisdir = math.floor(rotationPart / 4) + local rotation = rotationPart - axisdir * 4 + if mode == screwdriver.ROTATE_FACE then + rotationPart = axisdir * 4 + nextrange(rotation, 3) + elseif mode == screwdriver.ROTATE_AXIS then + rotationPart = nextrange(axisdir, 5) * 4 + end + + local new_param2 = preservePart + rotationPart + local should_rotate = true + + if ndef and ndef.on_rotate then -- Node provides a handler, so let the handler decide instead if the node can be rotated + -- Copy pos and node because callback can modify it + local result = ndef.on_rotate(vector.new(pos), + {name = node.name, param1 = node.param1, param2 = node.param2}, + user, mode, new_param2) + if result == false then -- Disallow rotation + return + elseif result == true then + should_rotate = false + end + else + if not ndef or not ndef.paramtype2 == "facedir" or + ndef.on_rotate == false or + (ndef.drawtype == "nodebox" and + not ndef.node_box.type == "fixed") or + node.param2 == nil then + return + end + + if ndef.can_dig and not ndef.can_dig(pos, user) then + return + end + end + + if should_rotate then + node.param2 = new_param2 + minetest.swap_node(pos, node) + end + + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535 / ((uses or 200) - 1)) + end + + return itemstack +end + +-- Screwdriver +minetest.register_tool("screwdriver:screwdriver", { + description = "Screwdriver (left-click rotates face, right-click rotates axis)", + inventory_image = "screwdriver.png", + on_use = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200) + return itemstack + end, + on_place = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, 200) + return itemstack + end, +}) + + +minetest.register_craft({ + output = "screwdriver:screwdriver", + recipe = { + {"default:steel_ingot"}, + {"group:stick"} + } +}) + +minetest.register_alias("screwdriver:screwdriver1", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver2", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver3", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver4", "screwdriver:screwdriver") diff --git a/mods/screwdriver/license.txt b/mods/screwdriver/license.txt new file mode 100644 index 0000000..d9b721b --- /dev/null +++ b/mods/screwdriver/license.txt @@ -0,0 +1,50 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2013-2016 RealBadAngel, Maciej Kasatkin +Copyright (C) 2013-2016 Various Minetest developers and contributors + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2013-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/screwdriver/textures/screwdriver.png b/mods/screwdriver/textures/screwdriver.png new file mode 100644 index 0000000..b2a56d5 Binary files /dev/null and b/mods/screwdriver/textures/screwdriver.png differ diff --git a/mods/sethome/README.txt b/mods/sethome/README.txt new file mode 100644 index 0000000..6f0a282 --- /dev/null +++ b/mods/sethome/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: sethome +========================== +See license.txt for license information. + +Authors of source code +---------------------- +sfan5 (MIT) diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua new file mode 100644 index 0000000..e0fc453 --- /dev/null +++ b/mods/sethome/init.lua @@ -0,0 +1,88 @@ + +sethome = {} + +local homes_file = minetest.get_worldpath() .. "/homes" +local homepos = {} + +local function loadhomes() + local input, err = io.open(homes_file, "r") + if not input then + return minetest.log("info", "Could not load player homes file: " .. err) + end + + -- Iterate over all stored positions in the format "x y z player" for each line + for pos, name in input:read("*a"):gmatch("(%S+ %S+ %S+)%s([%w_-]+)[\r\n]") do + homepos[name] = minetest.string_to_pos(pos) + end + input:close() +end + +loadhomes() + +sethome.set = function(name, pos) + local player = minetest.get_player_by_name(name) + if not player or not pos then + return false + end + + local data = {} + local output, err = io.open(homes_file, "w") + if output then + homepos[name] = pos + for i, v in pairs(homepos) do + table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, i)) + end + output:write(table.concat(data)) + io.close(output) + return true + end + minetest.log("action", "Unable to write to player homes file: " .. err) + return false +end + +sethome.get = function(name) + local pos = homepos[name] + if pos then + return vector.new(pos) + else + return nil + end +end + +sethome.go = function(name) + local player = minetest.get_player_by_name(name) + if player and homepos[name] then + player:setpos(homepos[name]) + return true + end + return false +end + +minetest.register_privilege("home", { + description = "Can use /sethome and /home", + give_to_singleplayer = false +}) + +minetest.register_chatcommand("home", { + description = "Teleport you to your home point", + privs = {home = true}, + func = function(name) + if sethome.go(name) then + return true, "Teleported to home!" + end + return false, "Set a home using /sethome" + end, +}) + +minetest.register_chatcommand("sethome", { + description = "Set your home point", + privs = {home = true}, + func = function(name) + name = name or "" -- fallback to blank name if nil + local player = minetest.get_player_by_name(name) + if player and sethome.set(name, player:getpos()) then + return true, "Home set!" + end + return false, "Player not found!" + end, +}) diff --git a/mods/sethome/license.txt b/mods/sethome/license.txt new file mode 100644 index 0000000..09f03b0 --- /dev/null +++ b/mods/sethome/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 sfan5 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/sfinv/README.md b/mods/sfinv/README.md new file mode 100644 index 0000000..6ff3392 --- /dev/null +++ b/mods/sfinv/README.md @@ -0,0 +1,21 @@ +Simple Fast Inventory +==================== + +![SFINV Screeny](https://cdn.pbrd.co/images/1yQhd1TI.png) + +A cleaner, simpler, solution to having an advanced inventory in Minetest. + +Written by rubenwardy. +License: MIT + +See game_api.txt for this mod's API + +License of source code and media files: +--------------------------------------- +Copyright (C) 2016 rubenwardy + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mods/sfinv/api.lua b/mods/sfinv/api.lua new file mode 100644 index 0000000..b6e9766 --- /dev/null +++ b/mods/sfinv/api.lua @@ -0,0 +1,172 @@ +sfinv = { + pages = {}, + pages_unordered = {}, + contexts = {}, + enabled = true +} + +function sfinv.register_page(name, def) + assert(name, "Invalid sfinv page. Requires a name") + assert(def, "Invalid sfinv page. Requires a def[inition] table") + assert(def.get, "Invalid sfinv page. Def requires a get function.") + assert(not sfinv.pages[name], "Attempt to register already registered sfinv page " .. dump(name)) + + sfinv.pages[name] = def + def.name = name + table.insert(sfinv.pages_unordered, def) +end + +function sfinv.override_page(name, def) + assert(name, "Invalid sfinv page override. Requires a name") + assert(def, "Invalid sfinv page override. Requires a def[inition] table") + local page = sfinv.pages[name] + assert(page, "Attempt to override sfinv page " .. dump(name) .. " which does not exist.") + for key, value in pairs(def) do + page[key] = value + end +end + +function sfinv.get_nav_fs(player, context, nav, current_idx) + -- Only show tabs if there is more than one page + if #nav > 1 then + return "tabheader[0,0;tabs;" .. table.concat(nav, ",") .. ";" .. current_idx .. ";true;false]" + else + return "" + end +end + +local theme_main = "bgcolor[#080808BB;true]" .. default.gui_bg .. + default.gui_bg_img + +local theme_inv = default.gui_slots .. [[ + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + ]] + +function sfinv.make_formspec(player, context, content, show_inv, size) + local tmp = { + size or "size[8,8.6]", + theme_main, + sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx), + content + } + if show_inv then + tmp[#tmp + 1] = theme_inv + end + return table.concat(tmp, "") +end + +function sfinv.get_homepage_name(player) + return "sfinv:crafting" +end + +function sfinv.get_formspec(player, context) + -- Generate navigation tabs + local nav = {} + local nav_ids = {} + local current_idx = 1 + for i, pdef in pairs(sfinv.pages_unordered) do + if not pdef.is_in_nav or pdef:is_in_nav(player, context) then + nav[#nav + 1] = pdef.title + nav_ids[#nav_ids + 1] = pdef.name + if pdef.name == context.page then + current_idx = i + end + end + end + context.nav = nav_ids + context.nav_titles = nav + context.nav_idx = current_idx + + -- Generate formspec + local page = sfinv.pages[context.page] or sfinv.pages["404"] + if page then + return page:get(player, context) + else + local old_page = context.page + context.page = sfinv.get_homepage_name(player) + assert(sfinv.pages[context.page], "[sfinv] Invalid homepage") + minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. " so using switching to homepage") + return sfinv.get_formspec(player, context) + end +end + +function sfinv.get_or_create_context(player) + local name = player:get_player_name() + local context = sfinv.contexts[name] + if not context then + context = { + page = sfinv.get_homepage_name(player) + } + sfinv.contexts[name] = context + end + return context +end + +function sfinv.set_context(player, context) + sfinv.contexts[player:get_player_name()] = context +end + +function sfinv.set_player_inventory_formspec(player, context) + local fs = sfinv.get_formspec(player, + context or sfinv.get_or_create_context(player)) + player:set_inventory_formspec(fs) +end + +function sfinv.set_page(player, pagename) + local context = sfinv.get_or_create_context(player) + local oldpage = sfinv.pages[context.page] + if oldpage and oldpage.on_leave then + oldpage:on_leave(player, context) + end + context.page = pagename + local page = sfinv.pages[pagename] + if page.on_enter then + page:on_enter(player, context) + end + sfinv.set_player_inventory_formspec(player, context) +end + +minetest.register_on_joinplayer(function(player) + if sfinv.enabled then + minetest.after(0.5, function() + sfinv.set_player_inventory_formspec(player) + end) + end +end) + +minetest.register_on_leaveplayer(function(player) + sfinv.contexts[player:get_player_name()] = nil +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "" or not sfinv.enabled then + return false + end + + -- Get Context + local name = player:get_player_name() + local context = sfinv.contexts[name] + if not context then + sfinv.set_player_inventory_formspec(player) + return false + end + + -- Was a tab selected? + if fields.tabs and context.nav then + local tid = tonumber(fields.tabs) + if tid and tid > 0 then + local id = context.nav[tid] + local page = sfinv.pages[id] + if id and page then + sfinv.set_page(player, id) + end + end + else + -- Pass event to page + local page = sfinv.pages[context.page] + if page and page.on_player_receive_fields then + return page:on_player_receive_fields(player, context, fields) + end + end +end) diff --git a/mods/sfinv/depends.txt b/mods/sfinv/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/sfinv/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/sfinv/init.lua b/mods/sfinv/init.lua new file mode 100644 index 0000000..f030222 --- /dev/null +++ b/mods/sfinv/init.lua @@ -0,0 +1,22 @@ +dofile(minetest.get_modpath("sfinv") .. "/api.lua") + +sfinv.register_page("sfinv:crafting", { + title = "Crafting", + get = function(self, player, context) + return sfinv.make_formspec(player, context, [[ + list[current_player;craft;1.75,0.5;3,3;] + list[current_player;craftpreview;5.75,1.5;1,1;] + image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270] + listring[current_player;main] + listring[current_player;craft] + image[0,4.75;1,1;gui_hb_bg.png] + image[1,4.75;1,1;gui_hb_bg.png] + image[2,4.75;1,1;gui_hb_bg.png] + image[3,4.75;1,1;gui_hb_bg.png] + image[4,4.75;1,1;gui_hb_bg.png] + image[5,4.75;1,1;gui_hb_bg.png] + image[6,4.75;1,1;gui_hb_bg.png] + image[7,4.75;1,1;gui_hb_bg.png] + ]], true) + end +}) diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt new file mode 100644 index 0000000..d32cd71 --- /dev/null +++ b/mods/stairs/README.txt @@ -0,0 +1,16 @@ +Minetest Game mod: stairs +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Kahrl (LGPL 2.1) and +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (models) +------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0): + stairs_stair.obj + + diff --git a/mods/stairs/depends.txt b/mods/stairs/depends.txt new file mode 100644 index 0000000..d77ba25 --- /dev/null +++ b/mods/stairs/depends.txt @@ -0,0 +1,2 @@ +default +farming diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua new file mode 100644 index 0000000..191c78d --- /dev/null +++ b/mods/stairs/init.lua @@ -0,0 +1,535 @@ +-- Minetest 0.4 mod: stairs +-- See README.txt for licensing and other information. + + +-- Global namespace for functions + +stairs = {} + + +-- Register aliases for new pine node names + +minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood") +minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood") + + +-- Get setting for replace ABM + +local replace = minetest.setting_getbool("enable_stairs_replace_abm") + + +-- Register stairs. +-- Node will be called stairs:stair_ + +function stairs.register_stair(subname, recipeitem, groups, images, description, sounds) + groups.stair = 1 + minetest.register_node(":stairs:stair_" .. subname, { + description = description, + drawtype = "mesh", + mesh = "stairs_stair.obj", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + collision_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local param2 = 0 + + local placer_pos = placer:getpos() + if placer_pos then + local dir = { + x = p1.x - placer_pos.x, + y = p1.y - placer_pos.y, + z = p1.z - placer_pos.z + } + param2 = minetest.dir_to_facedir(dir) + end + + if p0.y - 1 == p1.y then + param2 = param2 + 20 + if param2 == 21 then + param2 = 23 + elseif param2 == 23 then + param2 = 21 + end + end + + return minetest.item_place(itemstack, placer, pointed_thing, param2) + end, + }) + + -- for replace ABM + if replace then + minetest.register_node(":stairs:stair_" .. subname .. "upside_down", { + replace_name = "stairs:stair_" .. subname, + groups = {slabs_replace = 1}, + }) + end + + if recipeitem then + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 8', + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Flipped recipe for the silly minecrafters + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 8', + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:stair_' .. subname, + burntime = math.floor(baseburntime * 0.75), + }) + end + end +end + + +-- Slab facedir to placement 6d matching table +local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4} +-- Slab facedir when placing initial slab against other surface +local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8} + +-- Register slabs. +-- Node will be called stairs:slab_ + +function stairs.register_slab(subname, recipeitem, groups, images, description, sounds) + groups.slab = 1 + minetest.register_node(":stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + local under = minetest.get_node(pointed_thing.under) + local wield_item = itemstack:get_name() + + if under and wield_item == under.name then + -- place slab using under node orientation + local dir = minetest.dir_to_facedir(vector.subtract( + pointed_thing.above, pointed_thing.under), true) + + local p2 = under.param2 + + -- combine two slabs if possible + if slab_trans_dir[math.floor(p2 / 4)] == dir then + if not recipeitem then + return itemstack + end + local player_name = placer:get_player_name() + if minetest.is_protected(pointed_thing.under, player_name) and not + minetest.check_player_privs(placer, "protection_bypass") then + minetest.record_protection_violation(pointed_thing.under, + player_name) + return + end + minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end + + -- Placing a slab on an upside down slab should make it right-side up. + if p2 >= 20 and dir == 8 then + p2 = p2 - 20 + -- same for the opposite case: slab below normal slab + elseif p2 <= 3 and dir == 4 then + p2 = p2 + 20 + end + + -- else attempt to place node with proper param2 + minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + else + -- place slab using look direction of player + local dir = minetest.dir_to_wallmounted(vector.subtract( + pointed_thing.above, pointed_thing.under), true) + + local rot = slab_trans_dir_place[dir] + if rot == 0 or rot == 20 then + rot = rot + minetest.dir_to_facedir(placer:get_look_dir()) + end + + return minetest.item_place(itemstack, placer, pointed_thing, rot) + end + end, + }) + + -- for replace ABM + if replace then + minetest.register_node(":stairs:slab_" .. subname .. "upside_down", { + replace_name = "stairs:slab_".. subname, + groups = {slabs_replace = 1}, + }) + end + + if recipeitem then + minetest.register_craft({ + output = 'stairs:slab_' .. subname .. ' 6', + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:slab_' .. subname, + burntime = math.floor(baseburntime * 0.5), + }) + end + end +end + + +-- Optionally replace old "upside_down" nodes with new param2 versions. +-- Disabled by default. + +if replace then + minetest.register_abm({ + label = "Slab replace", + nodenames = {"group:slabs_replace"}, + interval = 16, + chance = 1, + action = function(pos, node) + node.name = minetest.registered_nodes[node.name].replace_name + node.param2 = node.param2 + 20 + if node.param2 == 21 then + node.param2 = 23 + elseif node.param2 == 23 then + node.param2 = 21 + end + minetest.set_node(pos, node) + end, + }) +end + + +-- Stair/slab registration function. +-- Nodes will be called stairs:{stair,slab}_ + +function stairs.register_stair_and_slab(subname, recipeitem, + groups, images, desc_stair, desc_slab, sounds) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds) +end + + +-- Register default stairs and slabs + +stairs.register_stair_and_slab( + "wood", + "default:wood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_wood.png"}, + "Wooden Stair", + "Wooden Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "junglewood", + "default:junglewood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_junglewood.png"}, + "Jungle Wood Stair", + "Jungle Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "pine_wood", + "default:pine_wood", + {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + {"default_pine_wood.png"}, + "Pine Wood Stair", + "Pine Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "acacia_wood", + "default:acacia_wood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_acacia_wood.png"}, + "Acacia Wood Stair", + "Acacia Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "aspen_wood", + "default:aspen_wood", + {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + {"default_aspen_wood.png"}, + "Aspen Wood Stair", + "Aspen Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "stone", + "default:stone", + {cracky = 3}, + {"default_stone.png"}, + "Stone Stair", + "Stone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "cobble", + "default:cobble", + {cracky = 3}, + {"default_cobble.png"}, + "Cobblestone Stair", + "Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "mossycobble", + nil, + {cracky = 3}, + {"default_mossycobble.png"}, + "Mossy Cobblestone Stair", + "Mossy Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "stonebrick", + "default:stonebrick", + {cracky = 2}, + {"default_stone_brick.png"}, + "Stone Brick Stair", + "Stone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "stone_block", + "default:stone_block", + {cracky = 2}, + {"default_stone_block.png"}, + "Stone Block Stair", + "Stone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stone", + "default:desert_stone", + {cracky = 3}, + {"default_desert_stone.png"}, + "Desert Stone Stair", + "Desert Stone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_cobble", + "default:desert_cobble", + {cracky = 3}, + {"default_desert_cobble.png"}, + "Desert Cobblestone Stair", + "Desert Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stonebrick", + "default:desert_stonebrick", + {cracky = 2}, + {"default_desert_stone_brick.png"}, + "Desert Stone Brick Stair", + "Desert Stone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stone_block", + "default:desert_stone_block", + {cracky = 2}, + {"default_desert_stone_block.png"}, + "Desert Stone Block Stair", + "Desert Stone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstone", + "default:sandstone", + {crumbly = 1, cracky = 3}, + {"default_sandstone.png"}, + "Sandstone Stair", + "Sandstone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstonebrick", + "default:sandstonebrick", + {cracky = 2}, + {"default_sandstone_brick.png"}, + "Sandstone Brick Stair", + "Sandstone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstone_block", + "default:sandstone_block", + {cracky = 2}, + {"default_sandstone_block.png"}, + "Sandstone Block Stair", + "Sandstone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidian", + "default:obsidian", + {cracky = 1, level = 2}, + {"default_obsidian.png"}, + "Obsidian Stair", + "Obsidian Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidianbrick", + "default:obsidianbrick", + {cracky = 1, level = 2}, + {"default_obsidian_brick.png"}, + "Obsidian Brick Stair", + "Obsidian Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidian_block", + "default:obsidian_block", + {cracky = 1, level = 2}, + {"default_obsidian_block.png"}, + "Obsidian Block Stair", + "Obsidian Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "brick", + "default:brick", + {cracky = 3}, + {"default_brick.png"}, + "Brick Stair", + "Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "straw", + "farming:straw", + {snappy = 3, flammable = 4}, + {"farming_straw.png"}, + "Straw Stair", + "Straw Slab", + default.node_sound_leaves_defaults() +) + +stairs.register_stair_and_slab( + "steelblock", + "default:steelblock", + {cracky = 1, level = 2}, + {"default_steel_block.png"}, + "Steel Block Stair", + "Steel Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "copperblock", + "default:copperblock", + {cracky = 1, level = 2}, + {"default_copper_block.png"}, + "Copper Block Stair", + "Copper Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "bronzeblock", + "default:bronzeblock", + {cracky = 1, level = 2}, + {"default_bronze_block.png"}, + "Bronze Block Stair", + "Bronze Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "goldblock", + "default:goldblock", + {cracky = 1}, + {"default_gold_block.png"}, + "Gold Block Stair", + "Gold Block Slab", + default.node_sound_metal_defaults() +) diff --git a/mods/stairs/license.txt b/mods/stairs/license.txt new file mode 100644 index 0000000..8f16bbd --- /dev/null +++ b/mods/stairs/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (models) +-------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt new file mode 100644 index 0000000..c1ca88d --- /dev/null +++ b/mods/tnt/README.txt @@ -0,0 +1,41 @@ +Minetest Game mod: tnt +====================== +See license.txt for license information. + +Authors of source code +---------------------- +PilzAdam (MIT) +ShadowNinja (MIT) +sofar (sofar@foo-projects.org) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0): +All textures not mentioned below. + +ShadowNinja (CC BY-SA 3.0): +tnt_smoke.png + +Wuzzy (CC BY-SA 3.0): +All gunpowder textures except tnt_gunpowder_inventory.png. + +sofar (sofar@foo-projects.org) (CC BY-SA 3.0): +tnt_blast.png + +Introduction +------------ +This mod adds TNT to Minetest. TNT is a tool to help the player +in mining. + +How to use the mod: +Craft gunpowder by placing coal and gravel in the crafting area. +The gunpowder can be used to craft TNT or as fuse for TNT. +To craft TNT surround gunpowder with 4 wood in a + shape. + +There are different ways to blow up TNT: + 1. Hit it with a torch. + 2. Hit a gunpowder fuse that leads to a TNT block with a torch or flint-and-steel. + 3. Activate it with mesecons (fastest way). + +Be aware of the damage radius of 6 blocks! diff --git a/mods/tnt/depends.txt b/mods/tnt/depends.txt new file mode 100644 index 0000000..5ff216f --- /dev/null +++ b/mods/tnt/depends.txt @@ -0,0 +1,3 @@ +default +fire + diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua new file mode 100644 index 0000000..5d1de60 --- /dev/null +++ b/mods/tnt/init.lua @@ -0,0 +1,618 @@ +tnt = {} + +-- Default to enabled when in singleplayer +local enable_tnt = minetest.setting_getbool("enable_tnt") +if enable_tnt == nil then + enable_tnt = minetest.is_singleplayer() +end + +-- loss probabilities array (one in X will be lost) +local loss_prob = {} + +loss_prob["default:cobble"] = 3 +loss_prob["default:dirt"] = 4 + +local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3) + +-- Fill a list with data for content IDs, after all nodes are registered +local cid_data = {} +minetest.after(0, function() + for name, def in pairs(minetest.registered_nodes) do + cid_data[minetest.get_content_id(name)] = { + name = name, + drops = def.drops, + flammable = def.groups.flammable, + on_blast = def.on_blast, + } + end +end) + +local function rand_pos(center, pos, radius) + local def + local reg_nodes = minetest.registered_nodes + local i = 0 + repeat + -- Give up and use the center if this takes too long + if i > 4 then + pos.x, pos.z = center.x, center.z + break + end + pos.x = center.x + math.random(-radius, radius) + pos.z = center.z + math.random(-radius, radius) + def = reg_nodes[minetest.get_node(pos).name] + i = i + 1 + until def and not def.walkable +end + +local function eject_drops(drops, pos, radius) + local drop_pos = vector.new(pos) + for _, item in pairs(drops) do + local count = math.min(item:get_count(), item:get_stack_max()) + while count > 0 do + local take = math.max(1,math.min(radius * radius, + count, + item:get_stack_max())) + rand_pos(pos, drop_pos, radius) + local dropitem = ItemStack(item) + dropitem:set_count(take) + local obj = minetest.add_item(drop_pos, dropitem) + if obj then + obj:get_luaentity().collect = true + obj:setacceleration({x = 0, y = -10, z = 0}) + obj:setvelocity({x = math.random(-3, 3), + y = math.random(0, 10), + z = math.random(-3, 3)}) + end + count = count - take + end + end +end + +local function add_drop(drops, item) + item = ItemStack(item) + local name = item:get_name() + if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then + return + end + + local drop = drops[name] + if drop == nil then + drops[name] = item + else + drop:set_count(drop:get_count() + item:get_count()) + end +end + +local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast) + if not ignore_protection and minetest.is_protected(npos, "") then + return cid + end + + local def = cid_data[cid] + + if not def then + return c_air + elseif not ignore_on_blast and def.on_blast then + on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast} + return cid + elseif def.flammable then + return c_fire + else + local node_drops = minetest.get_node_drops(def.name, "") + for _, item in pairs(node_drops) do + add_drop(drops, item) + end + return c_air + end +end + +local function calc_velocity(pos1, pos2, old_vel, power) + -- Avoid errors caused by a vector of zero length + if vector.equals(pos1, pos2) then + return old_vel + end + + local vel = vector.direction(pos1, pos2) + vel = vector.normalize(vel) + vel = vector.multiply(vel, power) + + -- Divide by distance + local dist = vector.distance(pos1, pos2) + dist = math.max(dist, 1) + vel = vector.divide(vel, dist) + + -- Add old velocity + vel = vector.add(vel, old_vel) + + -- randomize it a bit + vel = vector.add(vel, { + x = math.random() - 0.5, + y = math.random() - 0.5, + z = math.random() - 0.5, + }) + + -- Limit to terminal velocity + dist = vector.length(vel) + if dist > 250 then + vel = vector.divide(vel, dist / 250) + end + return vel +end + +local function entity_physics(pos, radius, drops) + local objs = minetest.get_objects_inside_radius(pos, radius) + for _, obj in pairs(objs) do + local obj_pos = obj:getpos() + local dist = math.max(1, vector.distance(pos, obj_pos)) + + local damage = (4 / dist) * radius + if obj:is_player() then + -- currently the engine has no method to set + -- player velocity. See #2960 + -- instead, we knock the player back 1.0 node, and slightly upwards + local dir = vector.normalize(vector.subtract(obj_pos, pos)) + local moveoff = vector.multiply(dir, dist + 1.0) + local newpos = vector.add(pos, moveoff) + newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0}) + obj:setpos(newpos) + + obj:set_hp(obj:get_hp() - damage) + else + local do_damage = true + local do_knockback = true + local entity_drops = {} + local luaobj = obj:get_luaentity() + local objdef = minetest.registered_entities[luaobj.name] + + if objdef and objdef.on_blast then + do_damage, do_knockback, entity_drops = objdef.on_blast(luaobj, damage) + end + + if do_knockback then + local obj_vel = obj:getvelocity() + obj:setvelocity(calc_velocity(pos, obj_pos, + obj_vel, radius * 10)) + end + if do_damage then + if not obj:get_armor_groups().immortal then + obj:punch(obj, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + end + end + for _, item in pairs(entity_drops) do + add_drop(drops, item) + end + end + end +end + +local function add_effects(pos, radius, drops) + minetest.add_particle({ + pos = pos, + velocity = vector.new(), + acceleration = vector.new(), + expirationtime = 0.4, + size = radius * 10, + collisiondetection = false, + vertical = false, + texture = "tnt_boom.png", + }) + minetest.add_particlespawner({ + amount = 64, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = radius * 3, + maxsize = radius * 5, + texture = "tnt_smoke.png", + }) + + -- we just dropped some items. Look at the items entities and pick + -- one of them to use as texture + local texture = "tnt_blast.png" --fallback texture + local most = 0 + for name, stack in pairs(drops) do + local count = stack:get_count() + if count > most then + most = count + local def = minetest.registered_nodes[name] + if def and def.tiles and def.tiles[1] then + texture = def.tiles[1] + end + end + end + + minetest.add_particlespawner({ + amount = 64, + time = 0.1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -3, y = 0, z = -3}, + maxvel = {x = 3, y = 5, z = 3}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.8, + maxexptime = 2.0, + minsize = radius * 0.66, + maxsize = radius * 2, + texture = texture, + collisiondetection = true, + }) +end + +function tnt.burn(pos, nodename) + local name = nodename or minetest.get_node(pos).name + local group = minetest.get_item_group(name, "tnt") + if group > 0 then + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.get_node_timer(pos):start(1) + elseif name == "tnt:gunpowder" then + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end +end + +local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast) + pos = vector.round(pos) + -- scan for adjacent TNT nodes first, and enlarge the explosion + local vm1 = VoxelManip() + local p1 = vector.subtract(pos, 2) + local p2 = vector.add(pos, 2) + local minp, maxp = vm1:read_from_map(p1, p2) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm1:get_data() + local count = 0 + local c_tnt = minetest.get_content_id("tnt:tnt") + local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") + local c_tnt_boom = minetest.get_content_id("tnt:boom") + local c_air = minetest.get_content_id("air") + + for z = pos.z - 2, pos.z + 2 do + for y = pos.y - 2, pos.y + 2 do + local vi = a:index(pos.x - 2, y, z) + for x = pos.x - 2, pos.x + 2 do + local cid = data[vi] + if cid == c_tnt or cid == c_tnt_boom or cid == c_tnt_burning then + count = count + 1 + data[vi] = c_air + end + vi = vi + 1 + end + end + end + + vm1:set_data(data) + vm1:write_to_map() + + -- recalculate new radius + radius = math.floor(radius * math.pow(count, 1/3)) + + -- perform the explosion + local vm = VoxelManip() + local pr = PseudoRandom(os.time()) + p1 = vector.subtract(pos, radius) + p2 = vector.add(pos, radius) + minp, maxp = vm:read_from_map(p1, p2) + a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + data = vm:get_data() + + local drops = {} + local on_blast_queue = {} + + local c_fire = minetest.get_content_id("fire:basic_flame") + for z = -radius, radius do + for y = -radius, radius do + local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z) + for x = -radius, radius do + local r = vector.length(vector.new(x, y, z)) + if (radius * radius) / (r * r) >= (pr:next(80, 125) / 100) then + local cid = data[vi] + local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z} + if cid ~= c_air then + data[vi] = destroy(drops, p, cid, c_air, c_fire, + on_blast_queue, ignore_protection, + ignore_on_blast) + end + end + vi = vi + 1 + end + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() + vm:update_liquids() + + -- call check_single_for_falling for everything within 1.5x blast radius + for y = -radius * 1.5, radius * 1.5 do + for z = -radius * 1.5, radius * 1.5 do + for x = -radius * 1.5, radius * 1.5 do + local rad = {x = x, y = y, z = z} + local s = vector.add(pos, rad) + local r = vector.length(rad) + if r / radius < 1.4 then + minetest.check_single_for_falling(s) + end + end + end + end + + for _, queued_data in pairs(on_blast_queue) do + local dist = math.max(1, vector.distance(queued_data.pos, pos)) + local intensity = (radius * radius) / (dist * dist) + local node_drops = queued_data.on_blast(queued_data.pos, intensity) + if node_drops then + for _, item in pairs(node_drops) do + add_drop(drops, item) + end + end + end + + return drops, radius +end + +function tnt.boom(pos, def) + minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) + minetest.set_node(pos, {name = "tnt:boom"}) + local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, + def.ignore_on_blast) + -- append entity drops + local damage_radius = (radius / def.radius) * def.damage_radius + entity_physics(pos, damage_radius, drops) + if not def.disable_drops then + eject_drops(drops, pos, radius) + end + add_effects(pos, radius, drops) + minetest.log("action", "A TNT explosion occurred at " .. minetest.pos_to_string(pos) .. + " with radius " .. radius) +end + +minetest.register_node("tnt:boom", { + drawtype = "airlike", + light_source = default.LIGHT_MAX, + walkable = false, + drop = "", + groups = {dig_immediate = 3}, + on_construct = function(pos) + minetest.get_node_timer(pos):start(0.4) + end, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, +}) + +minetest.register_node("tnt:gunpowder", { + description = "Gun Powder", + drawtype = "raillike", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + tiles = {"tnt_gunpowder_straight.png", "tnt_gunpowder_curved.png", "tnt_gunpowder_t_junction.png", "tnt_gunpowder_crossing.png"}, + inventory_image = "tnt_gunpowder_inventory.png", + wield_image = "tnt_gunpowder_inventory.png", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {dig_immediate = 2, attached_node = 1, flammable = 5, + connect_to_raillike = minetest.raillike_group("gunpowder")}, + sounds = default.node_sound_leaves_defaults(), + + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites tnt:gunpowder at " .. + minetest.pos_to_string(pos)) + end + end, + on_blast = function(pos, intensity) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_burn = function(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, +}) + +minetest.register_node("tnt:gunpowder_burning", { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + light_source = 5, + tiles = {{ + name = "tnt_gunpowder_burning_straight_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_curved_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_t_junction_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_crossing_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }}, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + drop = "", + groups = {dig_immediate = 2, attached_node = 1, connect_to_raillike = minetest.raillike_group("gunpowder")}, + sounds = default.node_sound_leaves_defaults(), + on_timer = function(pos, elapsed) + for dx = -1, 1 do + for dz = -1, 1 do + for dy = -1, 1 do + if not (dx == 0 and dz == 0) then + tnt.burn({ + x = pos.x + dx, + y = pos.y + dy, + z = pos.z + dz, + }) + end + end + end + end + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_gunpowder_burning", {pos = pos, gain = 2}) + minetest.get_node_timer(pos):start(1) + end, +}) + +minetest.register_craft({ + output = "tnt:gunpowder 5", + type = "shapeless", + recipe = {"default:coal_lump", "default:gravel"} +}) + +if enable_tnt then + minetest.register_craft({ + output = "tnt:tnt", + recipe = { + {"group:wood", "tnt:gunpowder", "group:wood"}, + {"tnt:gunpowder", "tnt:gunpowder", "tnt:gunpowder"}, + {"group:wood", "tnt:gunpowder", "group:wood"} + } + }) + + minetest.register_abm({ + label = "TNT ignition", + nodenames = {"group:tnt", "tnt:gunpowder"}, + neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, + interval = 4, + chance = 1, + action = function(pos, node) + tnt.burn(pos, node.name) + end, + }) +end + +function tnt.register_tnt(def) + local name + if not def.name:find(':') then + name = "tnt:" .. def.name + else + name = def.name + def.name = def.name:match(":([%w_]+)") + end + if not def.tiles then def.tiles = {} end + local tnt_top = def.tiles.top or def.name .. "_top.png" + local tnt_bottom = def.tiles.bottom or def.name .. "_bottom.png" + local tnt_side = def.tiles.side or def.name .. "_side.png" + local tnt_burning = def.tiles.burning or def.name .. "_top_burning_animated.png" + if not def.damage_radius then def.damage_radius = def.radius * 2 end + + if enable_tnt then + minetest.register_node(":" .. name, { + description = def.description, + tiles = {tnt_top, tnt_bottom, tnt_side}, + is_ground_content = false, + groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites " .. node.name .. " at " .. + minetest.pos_to_string(pos)) + end + end, + on_blast = function(pos, intensity) + minetest.after(0.1, function() + tnt.boom(pos, def) + end) + end, + mesecons = {effector = + {action_on = + function(pos) + tnt.boom(pos, def) + end + } + }, + on_burn = function(pos) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + }) + end + + minetest.register_node(":" .. name .. "_burning", { + tiles = { + { + name = tnt_burning, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + tnt_bottom, tnt_side + }, + light_source = 5, + drop = "", + sounds = default.node_sound_wood_defaults(), + groups = {falling_node = 1}, + on_timer = function(pos, elapsed) + tnt.boom(pos, def) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.get_node_timer(pos):start(4) + minetest.check_for_falling(pos) + end, + }) +end + +tnt.register_tnt({ + name = "tnt:tnt", + description = "TNT", + radius = tnt_radius, +}) diff --git a/mods/tnt/license.txt b/mods/tnt/license.txt new file mode 100644 index 0000000..210f2bd --- /dev/null +++ b/mods/tnt/license.txt @@ -0,0 +1,65 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 PilzAdam +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2016 sofar (sofar@foo-projects.org) +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2015-2016 Wuzzy +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/tnt/sounds/tnt_explode.ogg b/mods/tnt/sounds/tnt_explode.ogg new file mode 100644 index 0000000..a414ea0 Binary files /dev/null and b/mods/tnt/sounds/tnt_explode.ogg differ diff --git a/mods/tnt/sounds/tnt_gunpowder_burning.ogg b/mods/tnt/sounds/tnt_gunpowder_burning.ogg new file mode 100644 index 0000000..5c5bfaf Binary files /dev/null and b/mods/tnt/sounds/tnt_gunpowder_burning.ogg differ diff --git a/mods/tnt/sounds/tnt_ignite.ogg b/mods/tnt/sounds/tnt_ignite.ogg new file mode 100644 index 0000000..199f206 Binary files /dev/null and b/mods/tnt/sounds/tnt_ignite.ogg differ diff --git a/mods/tnt/textures/tnt_blast.png b/mods/tnt/textures/tnt_blast.png new file mode 100644 index 0000000..bbb1096 Binary files /dev/null and b/mods/tnt/textures/tnt_blast.png differ diff --git a/mods/tnt/textures/tnt_boom.png b/mods/tnt/textures/tnt_boom.png new file mode 100644 index 0000000..c848bfc Binary files /dev/null and b/mods/tnt/textures/tnt_boom.png differ diff --git a/mods/tnt/textures/tnt_bottom.png b/mods/tnt/textures/tnt_bottom.png new file mode 100644 index 0000000..95f66cb Binary files /dev/null and b/mods/tnt/textures/tnt_bottom.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png new file mode 100644 index 0000000..a901f7b Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png new file mode 100644 index 0000000..bc01806 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png new file mode 100644 index 0000000..c860ace Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png new file mode 100644 index 0000000..a556072 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_crossing.png b/mods/tnt/textures/tnt_gunpowder_crossing.png new file mode 100644 index 0000000..916c84e Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_crossing.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_curved.png b/mods/tnt/textures/tnt_gunpowder_curved.png new file mode 100644 index 0000000..cb8b4ea Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_curved.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_inventory.png b/mods/tnt/textures/tnt_gunpowder_inventory.png new file mode 100644 index 0000000..105a2d2 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_inventory.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_straight.png b/mods/tnt/textures/tnt_gunpowder_straight.png new file mode 100644 index 0000000..8ab0e3c Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_straight.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_t_junction.png b/mods/tnt/textures/tnt_gunpowder_t_junction.png new file mode 100644 index 0000000..ac997a7 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_t_junction.png differ diff --git a/mods/tnt/textures/tnt_side.png b/mods/tnt/textures/tnt_side.png new file mode 100644 index 0000000..d303473 Binary files /dev/null and b/mods/tnt/textures/tnt_side.png differ diff --git a/mods/tnt/textures/tnt_smoke.png b/mods/tnt/textures/tnt_smoke.png new file mode 100644 index 0000000..488b50f Binary files /dev/null and b/mods/tnt/textures/tnt_smoke.png differ diff --git a/mods/tnt/textures/tnt_top.png b/mods/tnt/textures/tnt_top.png new file mode 100644 index 0000000..31b807c Binary files /dev/null and b/mods/tnt/textures/tnt_top.png differ diff --git a/mods/tnt/textures/tnt_top_burning.png b/mods/tnt/textures/tnt_top_burning.png new file mode 100644 index 0000000..fc0d490 Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning.png differ diff --git a/mods/tnt/textures/tnt_top_burning_animated.png b/mods/tnt/textures/tnt_top_burning_animated.png new file mode 100644 index 0000000..18a270f Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning_animated.png differ diff --git a/mods/vessels/README.txt b/mods/vessels/README.txt new file mode 100644 index 0000000..5bb798c --- /dev/null +++ b/mods/vessels/README.txt @@ -0,0 +1,22 @@ +Minetest Game mod: vessels +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Vanessa Ezekowitz (LGPL 2.1) +Modified by Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures) +--------------------------- +All not listed below, Vanessa Ezekowitz (CC BY-SA 3.0) + +The following textures were modified by Thomas-S (CC BY-SA 3.0): + vessels_drinking_glass.png + vessels_drinking_glass_inv.png + vessels_glass_bottle.png + vessels_steel_bottle.png + +The following texture was created by Wuzzy (CC BY-SA 3.0): + vessels_shelf_slot.png (based on vessels_glass_bottle.png) diff --git a/mods/vessels/depends.txt b/mods/vessels/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/vessels/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua new file mode 100644 index 0000000..688413f --- /dev/null +++ b/mods/vessels/init.lua @@ -0,0 +1,216 @@ +-- Minetest 0.4 mod: vessels +-- See README.txt for licensing and other information. + +local vessels_shelf_formspec = + "size[8,7;]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[context;vessels;0,0.3;8,2;]" .. + "list[current_player;main;0,2.85;8,1;]" .. + "list[current_player;main;0,4.08;8,3;8]" .. + "listring[context;vessels]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0, 2.85) + +local function get_vessels_shelf_formspec(inv) + local formspec = vessels_shelf_formspec + local invlist = inv and inv:get_list("vessels") + -- Inventory slots overlay + local vx, vy = 0, 0.3 + for i = 1, 16 do + if i == 9 then + vx = 0 + vy = vy + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]" + end + vx = vx + 1 + end + return formspec +end + +minetest.register_node("vessels:shelf", { + description = "Vessels Shelf", + tiles = {"default_wood.png", "default_wood.png", "default_wood.png", + "default_wood.png", "vessels_shelf.png", "vessels_shelf.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(nil)) + local inv = meta:get_inventory() + inv:set_size("vessels", 8 * 2) + end, + can_dig = function(pos,player) + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("vessels") + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if minetest.get_item_group(stack:get_name(), "vessel") ~= 0 then + return stack:get_count() + end + return 0 + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves stuff to vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes stuff from vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "vessels", drops) + drops[#drops + 1] = "vessels:shelf" + minetest.remove_node(pos) + return drops + end, +}) + +minetest.register_craft({ + output = "vessels:shelf", + recipe = { + {"group:wood", "group:wood", "group:wood"}, + {"group:vessel", "group:vessel", "group:vessel"}, + {"group:wood", "group:wood", "group:wood"}, + } +}) + +minetest.register_node("vessels:glass_bottle", { + description = "Glass Bottle (empty)", + drawtype = "plantlike", + tiles = {"vessels_glass_bottle.png"}, + inventory_image = "vessels_glass_bottle.png", + wield_image = "vessels_glass_bottle.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "vessels:glass_bottle 10", + recipe = { + {"default:glass", "", "default:glass"}, + {"default:glass", "", "default:glass"}, + {"", "default:glass", ""} + } +}) + +minetest.register_node("vessels:drinking_glass", { + description = "Drinking Glass (empty)", + drawtype = "plantlike", + tiles = {"vessels_drinking_glass.png"}, + inventory_image = "vessels_drinking_glass_inv.png", + wield_image = "vessels_drinking_glass.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "vessels:drinking_glass 14", + recipe = { + {"default:glass", "", "default:glass"}, + {"default:glass", "", "default:glass"}, + {"default:glass", "default:glass", "default:glass"} + } +}) + +minetest.register_node("vessels:steel_bottle", { + description = "Heavy Steel Bottle (empty)", + drawtype = "plantlike", + tiles = {"vessels_steel_bottle.png"}, + inventory_image = "vessels_steel_bottle.png", + wield_image = "vessels_steel_bottle.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craft( { + output = "vessels:steel_bottle 5", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + {"", "default:steel_ingot", ""} + } +}) + + +-- Glass and steel recycling + +minetest.register_craftitem("vessels:glass_fragments", { + description = "Pile of Glass Fragments", + inventory_image = "vessels_glass_fragments.png", +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:glass_bottle", + "vessels:glass_bottle", + }, +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:drinking_glass", + "vessels:drinking_glass", + }, +}) + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "vessels:glass_fragments", +}) + +minetest.register_craft( { + type = "cooking", + output = "default:steel_ingot", + recipe = "vessels:steel_bottle", +}) + +minetest.register_craft({ + type = "fuel", + recipe = "vessels:shelf", + burntime = 30, +}) diff --git a/mods/vessels/license.txt b/mods/vessels/license.txt new file mode 100644 index 0000000..de16a3b --- /dev/null +++ b/mods/vessels/license.txt @@ -0,0 +1,52 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2016 Thomas-S + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/vessels/textures/vessels_drinking_glass.png b/mods/vessels/textures/vessels_drinking_glass.png new file mode 100644 index 0000000..d5037b8 Binary files /dev/null and b/mods/vessels/textures/vessels_drinking_glass.png differ diff --git a/mods/vessels/textures/vessels_drinking_glass_inv.png b/mods/vessels/textures/vessels_drinking_glass_inv.png new file mode 100644 index 0000000..9992bd9 Binary files /dev/null and b/mods/vessels/textures/vessels_drinking_glass_inv.png differ diff --git a/mods/vessels/textures/vessels_glass_bottle.png b/mods/vessels/textures/vessels_glass_bottle.png new file mode 100644 index 0000000..6ea37db Binary files /dev/null and b/mods/vessels/textures/vessels_glass_bottle.png differ diff --git a/mods/vessels/textures/vessels_glass_fragments.png b/mods/vessels/textures/vessels_glass_fragments.png new file mode 100644 index 0000000..7c6c488 Binary files /dev/null and b/mods/vessels/textures/vessels_glass_fragments.png differ diff --git a/mods/vessels/textures/vessels_shelf.png b/mods/vessels/textures/vessels_shelf.png new file mode 100644 index 0000000..87c69b2 Binary files /dev/null and b/mods/vessels/textures/vessels_shelf.png differ diff --git a/mods/vessels/textures/vessels_shelf_slot.png b/mods/vessels/textures/vessels_shelf_slot.png new file mode 100644 index 0000000..ff29082 Binary files /dev/null and b/mods/vessels/textures/vessels_shelf_slot.png differ diff --git a/mods/vessels/textures/vessels_steel_bottle.png b/mods/vessels/textures/vessels_steel_bottle.png new file mode 100644 index 0000000..61d3071 Binary files /dev/null and b/mods/vessels/textures/vessels_steel_bottle.png differ diff --git a/mods/walls/README.txt b/mods/walls/README.txt new file mode 100644 index 0000000..0389174 --- /dev/null +++ b/mods/walls/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: walls +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Auke Kok (LGPL 2.1) diff --git a/mods/walls/depends.txt b/mods/walls/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/walls/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/walls/init.lua b/mods/walls/init.lua new file mode 100644 index 0000000..bee8e46 --- /dev/null +++ b/mods/walls/init.lua @@ -0,0 +1,46 @@ +walls = {} + +walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) + -- inventory node, and pole-type wall start item + minetest.register_node(wall_name, { + description = wall_desc, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, + -- connect_bottom = + connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, + connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, + connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, + connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, + }, + connects_to = { "group:wall", "group:stone" }, + paramtype = "light", + is_ground_content = false, + tiles = { wall_texture, }, + walkable = true, + groups = { cracky = 3, wall = 1, stone = 2 }, + sounds = wall_sounds, + }) + + -- crafting recipe + minetest.register_craft({ + output = wall_name .. " 6", + recipe = { + { '', '', '' }, + { wall_mat, wall_mat, wall_mat}, + { wall_mat, wall_mat, wall_mat}, + } + }) + +end + +walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", + "default:cobble", default.node_sound_stone_defaults()) + +walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", + "default:mossycobble", default.node_sound_stone_defaults()) + +walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", + "default:desert_cobble", default.node_sound_stone_defaults()) + diff --git a/mods/walls/license.txt b/mods/walls/license.txt new file mode 100644 index 0000000..ccfaf1c --- /dev/null +++ b/mods/walls/license.txt @@ -0,0 +1,14 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2015 Auke Kok + +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 (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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html diff --git a/mods/wool/README.txt b/mods/wool/README.txt new file mode 100644 index 0000000..a66677d --- /dev/null +++ b/mods/wool/README.txt @@ -0,0 +1,16 @@ +Minetest Game mod: wool +======================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Cisoun (CC BY-SA 3.0): + wool_black.png wool_brown.png wool_dark_green.png wool_green.png + wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png + wool_blue.png wool_cyan.png wool_dark_grey.png wool_grey.png + wool_orange.png wool_red.png wool_white.png diff --git a/mods/wool/depends.txt b/mods/wool/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/wool/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/wool/init.lua b/mods/wool/init.lua new file mode 100644 index 0000000..a36e4dd --- /dev/null +++ b/mods/wool/init.lua @@ -0,0 +1,47 @@ +-- This uses a trick: you can first define the recipes using all of the base +-- colors, and then some recipes using more specific colors for a few non-base +-- colors available. When crafting, the last recipes will be checked first. + +local dyes = { + {"white", "White", "basecolor_white"}, + {"grey", "Grey", "basecolor_grey"}, + {"black", "Black", "basecolor_black"}, + {"red", "Red", "basecolor_red"}, + {"yellow", "Yellow", "basecolor_yellow"}, + {"green", "Green", "basecolor_green"}, + {"cyan", "Cyan", "basecolor_cyan"}, + {"blue", "Blue", "basecolor_blue"}, + {"magenta", "Magenta", "basecolor_magenta"}, + {"orange", "Orange", "excolor_orange"}, + {"violet", "Violet", "excolor_violet"}, + {"brown", "Brown", "unicolor_dark_orange"}, + {"pink", "Pink", "unicolor_light_red"}, + {"dark_grey", "Dark Grey", "unicolor_darkgrey"}, + {"dark_green", "Dark Green", "unicolor_dark_green"}, +} + +for i = 1, #dyes do + local name, desc, craft_color_group = unpack(dyes[i]) + + minetest.register_node("wool:" .. name, { + description = desc .. " Wool", + tiles = {"wool_" .. name .. ".png"}, + is_ground_content = false, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, + flammable = 3, wool = 1}, + sounds = default.node_sound_defaults(), + }) + + minetest.register_craft{ + type = "shapeless", + output = "wool:" .. name, + recipe = {"group:dye," .. craft_color_group, "group:wool"}, + } +end + + +-- legacy + +-- Backwards compatibility with jordach's 16-color wool mod +minetest.register_alias("wool:dark_blue", "wool:blue") +minetest.register_alias("wool:gold", "wool:yellow") diff --git a/mods/wool/license.txt b/mods/wool/license.txt new file mode 100644 index 0000000..9310163 --- /dev/null +++ b/mods/wool/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Cisoun + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/wool/textures/wool_black.png b/mods/wool/textures/wool_black.png new file mode 100644 index 0000000..700d439 Binary files /dev/null and b/mods/wool/textures/wool_black.png differ diff --git a/mods/wool/textures/wool_blue.png b/mods/wool/textures/wool_blue.png new file mode 100644 index 0000000..a074986 Binary files /dev/null and b/mods/wool/textures/wool_blue.png differ diff --git a/mods/wool/textures/wool_brown.png b/mods/wool/textures/wool_brown.png new file mode 100644 index 0000000..2620dfd Binary files /dev/null and b/mods/wool/textures/wool_brown.png differ diff --git a/mods/wool/textures/wool_cyan.png b/mods/wool/textures/wool_cyan.png new file mode 100644 index 0000000..395b6ac Binary files /dev/null and b/mods/wool/textures/wool_cyan.png differ diff --git a/mods/wool/textures/wool_dark_green.png b/mods/wool/textures/wool_dark_green.png new file mode 100644 index 0000000..0e73999 Binary files /dev/null and b/mods/wool/textures/wool_dark_green.png differ diff --git a/mods/wool/textures/wool_dark_grey.png b/mods/wool/textures/wool_dark_grey.png new file mode 100644 index 0000000..7253696 Binary files /dev/null and b/mods/wool/textures/wool_dark_grey.png differ diff --git a/mods/wool/textures/wool_green.png b/mods/wool/textures/wool_green.png new file mode 100644 index 0000000..dcb663b Binary files /dev/null and b/mods/wool/textures/wool_green.png differ diff --git a/mods/wool/textures/wool_grey.png b/mods/wool/textures/wool_grey.png new file mode 100644 index 0000000..2f4c338 Binary files /dev/null and b/mods/wool/textures/wool_grey.png differ diff --git a/mods/wool/textures/wool_magenta.png b/mods/wool/textures/wool_magenta.png new file mode 100644 index 0000000..5c2c4a7 Binary files /dev/null and b/mods/wool/textures/wool_magenta.png differ diff --git a/mods/wool/textures/wool_orange.png b/mods/wool/textures/wool_orange.png new file mode 100644 index 0000000..a059f36 Binary files /dev/null and b/mods/wool/textures/wool_orange.png differ diff --git a/mods/wool/textures/wool_pink.png b/mods/wool/textures/wool_pink.png new file mode 100644 index 0000000..8e90140 Binary files /dev/null and b/mods/wool/textures/wool_pink.png differ diff --git a/mods/wool/textures/wool_red.png b/mods/wool/textures/wool_red.png new file mode 100644 index 0000000..da12ecf Binary files /dev/null and b/mods/wool/textures/wool_red.png differ diff --git a/mods/wool/textures/wool_violet.png b/mods/wool/textures/wool_violet.png new file mode 100644 index 0000000..d7d6783 Binary files /dev/null and b/mods/wool/textures/wool_violet.png differ diff --git a/mods/wool/textures/wool_white.png b/mods/wool/textures/wool_white.png new file mode 100644 index 0000000..88f1e2f Binary files /dev/null and b/mods/wool/textures/wool_white.png differ diff --git a/mods/wool/textures/wool_yellow.png b/mods/wool/textures/wool_yellow.png new file mode 100644 index 0000000..2b0f048 Binary files /dev/null and b/mods/wool/textures/wool_yellow.png differ diff --git a/mods/xpanes/README.txt b/mods/xpanes/README.txt new file mode 100644 index 0000000..bcbc129 --- /dev/null +++ b/mods/xpanes/README.txt @@ -0,0 +1,21 @@ +Minetest Game mod: xpanes +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by xyz (MIT) +BlockMen (MIT) +sofar (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +xyz (CC BY-SA 3.0): + All textures not mentioned below. + +Gambit (CC BY-SA 3.0): + xpanes_bar.png + +paramat (CC BY-SA 3.0): + xpanes_bar_top.png diff --git a/mods/xpanes/depends.txt b/mods/xpanes/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/mods/xpanes/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua new file mode 100644 index 0000000..77278a5 --- /dev/null +++ b/mods/xpanes/init.lua @@ -0,0 +1,184 @@ + +local function is_pane(pos) + return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 +end + +local function connects_dir(pos, name, dir) + local aside = vector.add(pos, minetest.facedir_to_dir(dir)) + if is_pane(aside) then + return true + end + + local connects_to = minetest.registered_nodes[name].connects_to + if not connects_to then + return false + end + local list = minetest.find_nodes_in_area(aside, aside, connects_to) + + if #list > 0 then + return true + end + + return false +end + +local function swap(pos, node, name, param2) + if node.name == name and node.param2 == param2 then + return + end + + minetest.set_node(pos, {name = name, param2 = param2}) +end + +local function update_pane(pos) + if not is_pane(pos) then + return + end + local node = minetest.get_node(pos) + local name = node.name + if name:sub(-5) == "_flat" then + name = name:sub(1, -6) + end + + local any = node.param2 + local c = {} + local count = 0 + for dir = 0, 3 do + c[dir] = connects_dir(pos, name, dir) + if c[dir] then + any = dir + count = count + 1 + end + end + + if count == 0 then + swap(pos, node, name .. "_flat", any) + elseif count == 1 then + swap(pos, node, name .. "_flat", (any + 1) % 4) + elseif count == 2 then + if (c[0] and c[2]) or (c[1] and c[3]) then + swap(pos, node, name .. "_flat", (any + 1) % 4) + else + swap(pos, node, name, 0) + end + else + swap(pos, node, name, 0) + end +end + +minetest.register_on_placenode(function(pos, node) + if minetest.get_item_group(node, "pane") then + update_pane(pos) + end + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +minetest.register_on_dignode(function(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +xpanes = {} +function xpanes.register_pane(name, def) + for i = 1, 15 do + minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat") + end + + local flatgroups = table.copy(def.groups) + flatgroups.pane = 1 + minetest.register_node(":xpanes:" .. name .. "_flat", { + description = def.description, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + paramtype2 = "facedir", + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = flatgroups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + selection_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connect_sides = { "left", "right" }, + }) + + local groups = table.copy(def.groups) + groups.pane = 1 + groups.not_in_creative_inventory = 1 + minetest.register_node(":xpanes:" .. name, { + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + description = def.description, + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = groups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "connected", + fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, + connect_front = {{-1/32, -1/2, -1/2, 1/32, 1/2, -1/32}}, + connect_left = {{-1/2, -1/2, -1/32, -1/32, 1/2, 1/32}}, + connect_back = {{-1/32, -1/2, 1/32, 1/32, 1/2, 1/2}}, + connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"}, + }) + + minetest.register_craft({ + output = "xpanes:" .. name .. "_flat 16", + recipe = def.recipe + }) +end + +xpanes.register_pane("pane", { + description = "Glass Pane", + textures = {"default_glass.png","xpanes_pane_half.png","xpanes_white.png"}, + inventory_image = "default_glass.png", + wield_image = "default_glass.png", + sounds = default.node_sound_glass_defaults(), + groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3}, + recipe = { + {"default:glass", "default:glass", "default:glass"}, + {"default:glass", "default:glass", "default:glass"} + } +}) + +xpanes.register_pane("bar", { + description = "Iron bar", + textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, + inventory_image = "xpanes_bar.png", + wield_image = "xpanes_bar.png", + groups = {cracky=2}, + sounds = default.node_sound_metal_defaults(), + recipe = { + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } +}) + +minetest.register_lbm({ + name = "xpanes:gen2", + nodenames = {"group:pane"}, + action = function(pos, node) + update_pane(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end + end +}) diff --git a/mods/xpanes/license.txt b/mods/xpanes/license.txt new file mode 100644 index 0000000..dff7227 --- /dev/null +++ b/mods/xpanes/license.txt @@ -0,0 +1,64 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 xyz +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2016 Auke Kok +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 xyz +Copyright (C) 2013-2016 Gambit +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/xpanes/textures/xpanes_bar.png b/mods/xpanes/textures/xpanes_bar.png new file mode 100644 index 0000000..3ea62a9 Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar.png differ diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png new file mode 100644 index 0000000..887518a Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar_top.png differ diff --git a/mods/xpanes/textures/xpanes_pane_half.png b/mods/xpanes/textures/xpanes_pane_half.png new file mode 100644 index 0000000..4e846df Binary files /dev/null and b/mods/xpanes/textures/xpanes_pane_half.png differ diff --git a/mods/xpanes/textures/xpanes_space.png b/mods/xpanes/textures/xpanes_space.png new file mode 100644 index 0000000..016cb35 Binary files /dev/null and b/mods/xpanes/textures/xpanes_space.png differ diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png new file mode 100644 index 0000000..a2f4b63 Binary files /dev/null and b/mods/xpanes/textures/xpanes_white.png differ diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..eeea0bf --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,45 @@ +# This file contains settings of minetest_game that can be changed in +# minetest.conf + +# In creative mode players are able to dig all kind of blocks nearly +# instantly, and have access to unlimited resources. +# Some of the functionality is only available if this setting is present +# at startup. +creative_mode (Creative mode) bool false + +# Flammable nodes will be ignited by nearby igniters. Spreading fire may +# cause severe destruction. +# Spreading fire nodes will disappear when fire is disabled, but +# 'permanent_flame' nodes are unaffected. +enable_fire (Fire) bool true + +# Enable flame sound. +flame_sound (Flame sound) bool true + +# If enabled, steel tools, torches and cobblestone will be given to new +# players. +give_initial_stuff (Give initial items) bool false + +# If enabled, players respawn at the bed they last lay on instead of normal +# spawn. +# This setting is only read at startup. +enable_bed_respawn (Respawn at bed) bool true + +# If enabled, the night can be skipped if more than half of the players are +# in beds. +enable_bed_night_skip (Skip night when sleeping) bool true + +# When TNT explodes, it destroys nearby nodes and damages nearby players. +# This setting is disabled by default on servers. +enable_tnt (TNT) bool true + +# The radius in which nodes will be destroyed by a TNT explosion. +tnt_radius (TNT radius) int 3 0 + +# The time in seconds after which the bones of a dead player can be looted +# by everyone. +# Setting this to 0 will disable sharing of bones completely. +share_bones_time (Bone share time) int 1200 0 + +# Replaces old stairs with new ones. Only required for older worlds. +enable_stairs_replace_abm (Replace old stairs) bool false