commit 1358cd57e2d70fbf02854b018c06d53d22c9e614 Author: migdyn Date: Sun Feb 10 16:19:48 2019 +0000 Initial commit diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..03a37c4 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,15 @@ +This game contains mods published under different licenses. + +Look into each mod directory to see its license. +I created a list of all of the mods licenses, but please keep in mind that it may be slightly outdated. I would highly recommend you looking in each mod directory if you want to redistribute this game or some of the mods included in it. +List of mods and their licenses: + +cottages: GPLv3 +food: MIT, CC BY 4.0 International +grenades: MIT License, CC BY 4.0 International +healing: MIT License, CC BY 4.0 International +main: MIT License, CC BY 4.0 International +mobs: MIT License +sprint: MIT License, CC BY 4.0 International (relicensed under MIT License by migdyn, the mod was released into the public domain by the original author, GunshipPenguin) +thirsty: LGPLv2.1, CC BY-SA 4.0 International +zombies: MIT License, CC BY 3.0 International diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..bd92443 --- /dev/null +++ b/game.conf @@ -0,0 +1 @@ +name = Zombietest \ No newline at end of file diff --git a/mods/cottages/LICENSE b/mods/cottages/LICENSE new file mode 100644 index 0000000..733c072 --- /dev/null +++ b/mods/cottages/LICENSE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, 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 +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/mods/cottages/README.md b/mods/cottages/README.md new file mode 100644 index 0000000..3f93af4 --- /dev/null +++ b/mods/cottages/README.md @@ -0,0 +1,99 @@ +This mod was modified by migdyn on February 04, 2019 +Changes made: + - REMOVED BEDS AND FUNCTIONS RELEATED TO THEM. + - REMOVED WASHING PLACES. + - REMOVED LADDER WITH ROPE AND RAIL. + - SOME OTHER MINOR CHANGES LIKE CHANGING NODE NAMES. +Contains nodes for building medieval houses. + +This used to be part of my random_buildings modpack, found under + https://github.com/Sokomine/random_buildings +It is now its own mod as all other mods in the modpack have been +superseded by newer versions. + +For more information about this mod, please refer to + https://forum.minetest.net/viewtopic.php?id=5120 +The thread introduces the nodes, shows crafting receipes and provides a place +to discuss about the mod. + +Special functions: +* Window shutters use an abm to automaticly close at night and open at day. +* The treshing place can be used to seperate harvested wheat into wheat seeds + and straw. The straw is useful for roofing purposes, straw bales etc. +* The handmill turns wheat seeds into flour. +* With anvil and hammer, tools can be repaired. +* The barrels do not yet have any further functionality. They may be used for + brewing in the future. Until then, punching makes them rotate and switch from + standing to lying on the ground. + +Liscence of this mod: GPLv3 +Autor: Sokomine + +--- +--- Textures and media: +--- +VanessaE (CC-by-SA 3.0): + cottages_waonwheel.png + cottages_homedecor_shingles_asphalt.png + cottages_homedecor_shingles_terracotta.png + cottages_homedecor_shingles_wood.png + cottages_sleepingmat.png + cottages_barrel.png + +CC-by-SA; done by GloopMaster (CC-by-SA): + glooptest_tool_steelhammer.png + +badger436 (created for this mod; CC BY-SA 3.0): + cottages_feldweg.png + +Some textures are taken from + https://github.com/minetest/minetest_game +and renamed (default_NAME.png -> cottages_NAME.png) + +Cisoun's WTFPL texture pack: + cottages_stone.png (for anvil and handmill) + cottages_wool.png + +Zeg9 (CC BY-SA 3.0): + cottages_steel_block.png (for steel hatch and stovepipie) + +MasterGollum (WTFPL, darkage mod): + cottages_darkage_straw_bale.png + cottages_darkage_straw.png + cottages_reet.png (straw texture changed in color) + +Sokomine (CC-by-SA 3.0): + cottages_glass_pane.png (modification of default_glass.png) + cottages_loam.png (part of a real loam wall) + +Copyright (C) 2010-2012 celeron55, Perttu Ahola +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + cottages_clay.png (washing place, stairs and slab) +From the supplied minimal game: + cottages_minimal_wood.png + +PilzAdam (WTFPL; default and beds mod): + cottages_junglewood.png + cottages_beds_bed_side.png + cottages_beds_bed_side_top_l.png + cottages_beds_bed_side_top_r.png + cottages_beds_bed_top_bottom.png + cottages_beds_bed_top_top.png + +Bas080 (CC; see https://forum.minetest.net/viewtopic.php?t=2344) + cottages_rope.png + +Derived from Universal schema.jpg by Stefanie Lindener, which can be found here: http://de.wikipedia.org/w/index.php?title=Datei:Universal_schema.jpg&filetimestamp=20060510110309& The texture is CC-by-sa 2.0/de. + cottages_slate.png + +Textures not provided but used (need to be supplied by a default mod): + default_wood.png + default_tree.png + default_dirt.png + default_grass_side.png + default_chest_top.png + default_chest_side.png + default_chest_front.png + default_stick.png + farming_wheat.png diff --git a/mods/cottages/adaptions.lua b/mods/cottages/adaptions.lua new file mode 100644 index 0000000..3d7d5d2 --- /dev/null +++ b/mods/cottages/adaptions.lua @@ -0,0 +1,102 @@ +-- some games may not have the default nodes; +-- change this so that craft receipes work! + +-- used for: anvil, hammer, barrel, steel hatch, stove pipe, wagon wheel, handmill. +cottages.craftitem_steel = "main:steel_ingot"; +-- used for: hammer, wood+steel hatch, fence gate, bed, table, bench, shelf, +-- washing place, wagon wheel, glass pane, flat wood, handmill, +-- operating the treshing floor. +cottages.craftitem_stick = "group:stick"; +-- used for: treshing floor, handmill, slate roof, vertical slate +cottages.craftitem_stone = "main:stone"; +-- used for: window shutter, half door, half door inverted, fence gate, +-- bed, bench, shelf, roof connector, vertical slate +cottages.craftitem_wood = "group:wood"; +-- used for: half door +cottages.craftitem_door = "doors:door_wood"; +-- used for: small fence +cottages.craftitem_fence = "main:fence_wood"; +-- used for: bed (head+foot), wool for tents +cottages.craftitem_wool = "wool:white"; +-- used for: washing place, loam +cottages.craftitem_clay = "main:clay"; +-- used for: wagon wheel +cottages.craftitem_iron = "main:iron_lump"; +-- used for: dirt road, brown roof (if no homedecor is installed) +cottages.craftitem_dirt = "default:dirt"; +-- used for: loam +cottages.craftitem_sand = "main:sand"; +-- used for: glass pane +cottages.craftitem_glass = "main:glass"; +-- used for: reet roof, reet block +cottages.craftitem_papyrus = "main:reeds"; +-- used for: black roof (if no homedecor is installed) +cottages.craftitem_coal_lump = "main:coal_lump"; +-- used for: red roof (if no homedecor is installed) +cottages.craftitem_clay_brick = "main:brick"; +-- used for: treshing floor +cottages.craftitem_junglewood = "group:wood"; +-- used for: hatch, table +cottages.craftitem_slab_wood = "stairs:slab_wood"; + +-- texture used for fence gate and bed posts +cottages.texture_furniture = "main_planks_oak.png"; +-- texture for the side of roof nodes +cottages.texture_roof_sides = "main_planks_oak.png"; +-- if the default wood node does not exist, use an alternate wood texture +-- (which is also used for furnitures and doors in this mod) +if( not( minetest.registered_nodes['default:wood'])) then + cottages.texture_roof_sides = "cottages_minimal_wood.png"; + cottages.texture_furniture = "cottages_minimal_wood.png"; +end + +cottages.texture_chest = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}; + +-- the treshing floor produces wheat seeds +cottages.craftitem_seed_wheat = "farming:seed_wheat"; +cottages.texture_wheat_seed = "farming_wheat_seed.png"; +cottages.texture_stick = "main_stick.png"; + +-- texture for roofs where the tree bark is the main roof texture +cottages.textures_roof_wood = "main_log_oak.png"; +if( not( minetest.registered_nodes["default:tree"])) then + -- realtest has diffrent barks; the spruce one seems to be the most fitting + if( minetest.registered_nodes["trees:spruce_log" ]) then + cottages.textures_roof_wood = "trees_spruce_trunk.png"; + + -- this is also an indicator that we are dealing with realtest; + cottages.craftitem_steel = "metals:pig_iron_ingot"; + -- stone exists, but is hard to obtain; chiseled stone is more suitable + cottages.craftitem_stone = "default:stone_flat"; + -- there are far more diffrent wood tpyes + cottages.craftitem_wood = "group:planks"; + cottages.craftitem_door = "doors:door_birch"; + cottages.craftitem_fence = "group:fence"; + cottages.craftitem_clay = "grounds:clay_lump"; + cottages.craftitem_iron = "group:plank"; -- iron lumps would be too specific + cottages.craftitem_coal_lump = "minerals:charcoal"; + cottages.craftitem_junglewood = "trees:chestnut_planks"; + cottages.craftitem_slab_wood = "group:plank"; + + cottages.texture_chest = { "spruce_chest_top.png", "spruce_chest_top.png", "spruce_chest_side.png", + "spruce_chest_side.png", "spruce_chest_side.png", "spruce_chest_front.png"}; + + -- wheat is called spelt in RealTest + cottages.craftitem_seed_wheat = 'farming:seed_spelt'; + cottages.texture_wheat_seed = 'farming_spelt_seed.png'; + cottages.texture_stick = 'trees_maple_stick.png'; + else + -- does not look so well in this case as it's no bark; but what else shall we do? + cottages.textures_roof_wood = "cottages_minimal_wood.png"; + end +end + +if( minetest.get_modpath("moreblocks") + and minetest.registered_nodes[ "moreblocks:slab_wood" ]) then + cottages.craftitem_slab_wood = "moreblocks:slab_wood"; +end + +if( not( minetest.registered_nodes["wool:white"])) then + cottages.craftitem_wool = "cottages:wool"; +end diff --git a/mods/cottages/alias.lua b/mods/cottages/alias.lua new file mode 100644 index 0000000..8600a92 --- /dev/null +++ b/mods/cottages/alias.lua @@ -0,0 +1,40 @@ + +minetest.register_alias("random_buildings:roof", "cottages:roof_wood"); +minetest.register_alias("random_buildings:roof_connector", "cottages:roof_connector_wood"); +minetest.register_alias("random_buildings:roof_flat", "cottages:roof_flat_wood"); +minetest.register_alias("random_buildings:roof_wood", "cottages:roof_wood"); +minetest.register_alias("random_buildings:roof_connector_wood", "cottages:roof_connector_wood"); +minetest.register_alias("random_buildings:roof_flat_wood", "cottages:roof_flat_wood"); +minetest.register_alias("random_buildings:roof_straw", "cottages:roof_straw"); +minetest.register_alias("random_buildings:roof_connector_straw", "cottages:roof_connector_straw"); +minetest.register_alias("random_buildings:roof_flat_straw", "cottages:roof_flat_straw"); +minetest.register_alias("random_buildings:barrel", "cottages:barrel"); +minetest.register_alias("random_buildings:barrel_open", "cottages:barrel_open"); +minetest.register_alias("random_buildings:barrel_lying", "cottages:barrel_lying"); +minetest.register_alias("random_buildings:barrel_lying_open", "cottages:barrel_lying_open"); +minetest.register_alias("random_buildings:tub", "cottages:tub"); +minetest.register_alias("random_buildings:window_shutter_open", "cottages:window_shutter_open"); +minetest.register_alias("random_buildings:window_shutter_closed", "cottages:window_shutter_closed"); +minetest.register_alias("random_buildings:half_door", "cottages:half_door"); +minetest.register_alias("random_buildings:half_door_inverted", "cottages:half_door_inverted"); +minetest.register_alias("random_buildings:gate_closed", "cottages:gate_closed"); +minetest.register_alias("random_buildings:gate_open", "cottages:gate_open"); +minetest.register_alias("random_buildings:bed_foot", "cottages:bed_foot"); +minetest.register_alias("random_buildings:bed_head", "cottages:bed_head"); +minetest.register_alias("random_buildings:sleeping_mat", "cottages:sleeping_mat"); +minetest.register_alias("random_buildings:loam", "cottages:loam"); +minetest.register_alias("random_buildings:bench", "cottages:bench"); +minetest.register_alias("random_buildings:table", "cottages:table"); +minetest.register_alias("random_buildings:shelf", "cottages:shelf"); +minetest.register_alias("random_buildings:stovepipe", "cottages:stovepipe"); +minetest.register_alias("random_buildings:washing", "cottages:washing"); +minetest.register_alias("random_buildings:wagon_wheel", "cottages:wagon_wheel"); +minetest.register_alias("random_buildings:feldweg", "cottages:feldweg"); +minetest.register_alias("random_buildings:straw_ground", "cottages:straw_ground"); +minetest.register_alias("random_buildings:glass_pane", "cottages:glass_pane"); +minetest.register_alias("random_buildings:straw_mat", "cottages:straw_mat"); +minetest.register_alias("random_buildings:straw_bale", "cottages:straw_bale"); +minetest.register_alias("random_buildings:straw", "cottages:straw"); +minetest.register_alias("random_buildings:chest_private", "cottages:chest_private"); +minetest.register_alias("random_buildings:chest_work", "cottages:chest_work"); +minetest.register_alias("random_buildings:chest_storage", "cottages:chest_storage"); diff --git a/mods/cottages/depends.txt b/mods/cottages/depends.txt new file mode 100644 index 0000000..d0220ae --- /dev/null +++ b/mods/cottages/depends.txt @@ -0,0 +1,8 @@ +default? +farming? +stairs? +homedecor? +intllib? +trees? +wool? +moreblocks? diff --git a/mods/cottages/init.lua b/mods/cottages/init.lua new file mode 100644 index 0000000..a2a4751 --- /dev/null +++ b/mods/cottages/init.lua @@ -0,0 +1,78 @@ + +-- Version: 2.2 +-- Autor: Sokomine +-- License: GPLv3 +-- +-- Modified: +-- 27.07.15 Moved into its own repository. +-- Made sure textures and craft receipe indigrents are available or can be replaced. +-- Took care of "unregistered globals" warnings. +-- 23.01.14 Added conversion receipes in case of installed castle-mod (has its own anvil) +-- 23.01.14 Added hammer and anvil as decoration and for repairing tools. +-- Added hatches (wood and steel). +-- Changed the texture of the fence/handrail. +-- 17.01.13 Added alternate receipe for fences in case of interference due to xfences +-- 14.01.13 Added alternate receipes for roof parts in case homedecor is not installed. +-- Added receipe for stove pipe, tub and barrel. +-- Added stairs/slabs for dirt road, loam and clay +-- Added fence_small, fence_corner and fence_end, which are useful as handrails and fences +-- If two or more window shutters are placed above each other, they will now all close/open simultaneously. +-- Added threshing floor. +-- Added hand-driven mill. + +cottages = {} + +-- Boilerplate to support localized strings if intllib mod is installed. +if minetest.get_modpath( "intllib" ) and intllib then + cottages.S = intllib.Getter() +else + cottages.S = function(s) return s end +end + +-- MineClone2 needs special treatment; default is only needed for +-- crafting materials and sounds (less important) +if( not( minetest.get_modpath("default"))) then + default = {}; +end +--cottages.config_use_mesh_barrel = false; +--cottages.config_use_mesh_handmill = true; + +-- set alternate crafting materials and textures where needed +-- (i.e. in combination with realtest) +dofile(minetest.get_modpath("cottages").."/adaptions.lua"); + +-- add to this table what you want the handmill to convert; +-- add a stack size if you want a higher yield +cottages.handmill_product = {}; +cottages.handmill_product[ cottages.craftitem_seed_wheat ] = 'farming:flour 1'; +--[[ some examples: +cottages.handmill_product[ 'default:cobble' ] = 'default:gravel'; +cottages.handmill_product[ 'default:gravel' ] = 'default:sand'; +cottages.handmill_product[ 'default:sand' ] = 'default:dirt 2'; +cottages.handmill_product[ 'flowers:rose' ] = 'dye:red 6'; +cottages.handmill_product[ 'default:cactus' ] = 'dye:green 6'; +cottages.handmill_product[ 'default:coal_lump'] = 'dye:black 6'; +--]] +-- process that many inputs per turn +cottages.handmill_max_per_turn = 20; +cottages.handmill_min_per_turn = 0; + + +-- uncomment parts you do not want +dofile(minetest.get_modpath("cottages").."/nodes_furniture.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_historic.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_feldweg.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_straw.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_anvil.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_doorlike.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_fences.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_roof.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_barrel.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_mining.lua"); +--dofile(minetest.get_modpath("cottages").."/nodes_chests.lua"); + +-- this is only required and useful if you run versions of the random_buildings mod where the nodes where defined inside that mod +dofile(minetest.get_modpath("cottages").."/alias.lua"); + +-- variable no longer needed +cottages.S = nil; diff --git a/mods/cottages/locale/de.txt b/mods/cottages/locale/de.txt new file mode 100644 index 0000000..9677a3b --- /dev/null +++ b/mods/cottages/locale/de.txt @@ -0,0 +1,130 @@ +# Translation by Xanthin + +### alias.lua ### + +### init.lua ### + +### nodes_anvil.lua ### +Steel hammer for repairing tools on the anvil = Stahlhammer um Werkzeuge auf dem Amboss zu reparieren +anvil = Amboss +Anvil = Amboss +The workpiece slot is for damaged tools only. = Das Werkstueckfeld gilt nur fuer beschaedigtes Werkzeug. +Your tool has been repaired successfully. = Dein Werkzeug wurde erfolgreich repariert. +Your workpiece improves. = Dein Werkstueck verbessert sich. +Anvil (owned by %s) = Amboss (gehoert %s) +Workpiece: = Werkstueck +Optional = Moegliche +storage for = Aufbewahrung fuer +your hammer = deinen Hammer +Owner: %s = Besitzer: %s +Punch anvil with hammer to = Schlage mit dem Hammer auf den Amboss um +repair tool in workpiece-slot. = das Werkzeug im Werkstueckfeld zu reparieren. + +### nodes_barrel.lua ### +Pour: = Eingiessen +Fill: = Ausgiessen +barrel (closed) = Fass (geschlossen) +barrel (open) = Fass (offen) +barrel (closed), lying somewhere = Liegendes Fass (geschlossen) +barrel (opened), lying somewhere = Liegendes Fass (offen) +tub = Bottich + +### nodes_chests.lua ### +private NPC chest = Private NSC-Truhe +chest for work utils and kitchens = NSC-Truhe fuer Arbeitsutensilien und Kuechen +storage chest = NSC-Lagertruhe + +### nodes_doorlike.lua ### +opened window shutters = Offene Fensterlaeden +closed window shutters = Geschlossene Fensterlaeden +half door = Kloentuer +half door inverted = Umgekehrte Kloentuer +closed fence gate = Geschlossenes Zauntor +opened fence gate = Offenes Zauntor +wooden hatch = Holzfalltuer +metal hatch = Metallfalltuer + +### nodes_fences.lua ### +small fence = Kleiner Zaun +small fence corner = Kleiner Zaun (Ecke) +small fence end = Kleiner Zaun (Ende) + +### nodes_furniture.lua ### +Bed (foot region) = Bett (Fussende) +Bed (head region) = Bett (Kopfende) +sleeping mat = Schlafmatte +simple wooden bench = Einfache Holzbank +table = Tisch +open storage shelf = Offenes Lagerregal +open storage shelf (in use) = Offenes Lagerregal (in Gebrauch) +open storage shelf (empty) = Offenes Lagerregal (leer) +stovepipe = Ofenrohr +washing place = Waschplatz +Sorry. This washing place is out of water. Please place it above water! = Entschuldige, dieser Waschplatz hat kein Wasser mehr. Bitte platziere ihn ueber Wasser! +You feel much cleaner after some washing. = Nach einer kleinen Waesche fuehlst du dich nun sauberer. + +### nodes_historic.lua ### +wagon wheel = Wagenrad +dirt road = Feldweg +loam = Lehm +Dirt Road Stairs = Feldwegtreppe +Dirt Road, half height = Feldwegstufe +Loam Stairs = Lehmtreppe +Loam Slab = Lehmstufe +Clay Stairs = Tontreppe +Clay Slab = Tonstufe +straw ground for animals = Strohboden fuer Tiere +simple glass pane = Einfache Fensterscheibe + +### nodes_roof.lua ### +Roof straw = Strohdach +Roof wood = Holzdach +Roof black = Schwarzes Dach +Roof red = Rotes Dach +Roof brown = Braunes Dach +Roof reet = Reetdach +Roof slate = Schieferdach +Roof connector straw = Strohdachverbinder +Roof connector wood = Holzdachverbinder +Roof connector black = Schwarzer Dachverbinder +Roof connector red = Roter Dachverbinder +Roof connector brown = Brauner Dachverbinder +Roof connector reet = Reet-Dachverbinder +Roof connector slate = Schiefer-Dachverbinder +Roof (flat) straw = Strohdach (flach) +Roof (flat) wood = Holzdach (flach) +Roof (flat) black = Schwarzes Dach (flach) +Roof (flat) red = Rotes Dach (flach) +Roof (flat) brown = Braunes Dach (flach) +Roof (flat) reet = Reetdach (flach) +Roof (flat) slate = Schieferdach (flach) +Vertical Slate = Vertikaler Schiefer +Reet for thatching = Reet + + +### nodes_straw.lua ### +layer of straw = Strohschicht +straw bale = Strohballen +straw = Stroh +threshing floor = Dreschboden +Threshing floor = Dreschboden +Threshing floor (owned by %s) = Dreschboden (gehoert %s) +Harvested wheat: = Geernteter Weizen +Straw: = Stroh +Seeds: = Koerner +Owner: %s = Besitzer: %s +Punch threshing floor with a stick = Schlage mit einem Stock auf den Dreschboden +to get straw and seeds from wheat. = um Stroh und Koerner vom Weizen zu bekommen. +You have threshed %s wheat (%s are left). = Du hast %s Weizenaehren gedroschen (%s bleiben uebrig). +You have threshed the last %s wheat. = Du hast die letzten %s Weizenaehren gedroschen. +mill, powered by punching = Muehle, durch Schlagen antreiben +Mill, powered by punching = Muehle, durch Schlagen antreiben +Mill, powered by punching (owned by %s) = Muehle, durch Schlagen antreiben (gehoert %s) +Wheat seeds: = Weizenkoerner +Flour: = Mehl +Mill = Muehle +Owner: %s = Besitzer: %s +Punch this hand-driven mill = Schlage auf diese handbetriebene Muehle +to convert wheat seeds into flour. = um Weizenkoerner in Mehl umzuwandeln. +You have grinded %s wheat seeds (%s are left). = Du hast %s Weizenkoerner gemahlen (%s bleiben uebrig). +You have grinded the last %s wheat seeds. = Du hast die letzten %s Weizenkoerner gemahlen. diff --git a/mods/cottages/locale/template.txt b/mods/cottages/locale/template.txt new file mode 100644 index 0000000..cbc6990 --- /dev/null +++ b/mods/cottages/locale/template.txt @@ -0,0 +1,129 @@ +# Template + +### alias.lua ### + +### init.lua ### + +### nodes_anvil.lua ### +Steel hammer for repairing tools on the anvil = +anvil = +Anvil = +The workpiece slot is for damaged tools only. = +Your tool has been repaired successfully. = +Your workpiece improves. = +Anvil (owned by %s) = +Workpiece: = +Optional = +storage for = +your hammer = +Owner: %s = +Punch anvil with hammer to = +repair tool in workpiece-slot. = + +### nodes_barrel.lua ### +Pour: = +Fill: = +barrel (closed) = +barrel (open) = +barrel (closed), lying somewhere = +barrel (opened), lying somewhere = +tub = + +### nodes_chests.lua ### +private NPC chest = +chest for work utils and kitchens = +storage chest = + +### nodes_doorlike.lua ### +opened window shutters = +closed window shutters = +half door = +half door inverted = +closed fence gate = +opened fence gate = +wooden hatch = +metal hatch = + +### nodes_fences.lua ### +small fence = +small fence corner = +small fence end = + +### nodes_furniture.lua ### +Bed (foot region) = +Bed (head region) = +sleeping mat = +simple wooden bench = +table = +open storage shelf = +open storage shelf (in use) = +open storage shelf (empty) = +stovepipe = +washing place = +Sorry. This washing place is out of water. Please place it above water! = +You feel much cleaner after some washing. = + +### nodes_historic.lua ### +wagon wheel = +dirt road = +loam = +Dirt Road Stairs = +Dirt Road, half height = +Loam Stairs = +Loam Slab = +Clay Stairs = +Clay Slab = +straw ground for animals = +simple glass pane = + +### nodes_roof.lua ### +Roof straw = +Roof wood = +Roof black = +Roof red = +Roof brown = +Roof reet = +Roof slate = +Roof connector straw = +Roof connector wood = +Roof connector black = +Roof connector red = +Roof connector brown = +Roof connector reet = +Roof connector slate = +Roof (flat) straw = +Roof (flat) wood = +Roof (flat) black = +Roof (flat) red = +Roof (flat) brown = +Roof (flat) reet = +Roof (flat) slate = +Vertical Slate = +Reet for thatching = + +### nodes_straw.lua ### +layer of straw = +straw bale = +straw = +threshing floor = +Threshing floor = +Threshing floor (owned by %s) = +Harvested wheat: = +Straw: = +Seeds: = +Owner: %s = +Punch threshing floor with a stick = +to get straw and seeds from wheat. = +You have threshed %s wheat (%s are left). = +You have threshed the last %s wheat. = +mill, powered by punching = +Mill, powered by punching = +Mill, powered by punching (owned by %s) = +Wheat seeds: = +Flour: = +Mill = +Owner: %s = +Punch this hand-driven mill = +to convert wheat seeds into flour. = +You have grinded %s wheat seeds (%s are left). = +You have grinded the last %s wheat seeds. = diff --git a/mods/cottages/models/cottages_barrel.obj b/mods/cottages/models/cottages_barrel.obj new file mode 100644 index 0000000..41258c3 --- /dev/null +++ b/mods/cottages/models/cottages_barrel.obj @@ -0,0 +1,543 @@ +# Blender v2.69 (sub 0) OBJ File: 'barrel.blend' +# www.blender.org +o Cylinder +v 0.092835 -0.500001 -0.466712 +v 0.092835 0.500000 -0.466712 +v 0.264371 -0.500001 -0.395660 +v 0.264371 0.500000 -0.395660 +v 0.395660 -0.500001 -0.264371 +v 0.395660 0.500000 -0.264371 +v 0.466712 -0.500001 -0.092835 +v 0.466712 0.500000 -0.092835 +v 0.466712 -0.500001 0.092835 +v 0.466712 0.500000 0.092835 +v 0.395660 -0.500001 0.264371 +v 0.395660 0.500000 0.264371 +v 0.264371 -0.500001 0.395660 +v 0.264371 0.500000 0.395660 +v 0.092835 -0.500001 0.466712 +v 0.092835 0.500000 0.466712 +v -0.092835 -0.500001 0.466712 +v -0.092835 0.500000 0.466712 +v -0.264371 -0.500001 0.395660 +v -0.264371 0.500000 0.395660 +v -0.395660 -0.500001 0.264371 +v -0.395660 0.500000 0.264371 +v -0.466712 -0.500001 0.092835 +v -0.466712 0.500000 0.092835 +v -0.466712 -0.500001 -0.092835 +v -0.466712 0.500000 -0.092835 +v -0.395660 -0.500001 -0.264371 +v -0.395660 0.500000 -0.264371 +v -0.264371 -0.500001 -0.395660 +v -0.264371 0.500000 -0.395660 +v -0.092835 -0.500001 -0.466713 +v -0.092835 0.500000 -0.466713 +v 0.095930 0.413334 -0.482270 +v 0.273184 -0.413334 -0.408849 +v 0.408849 -0.413334 -0.273184 +v 0.482270 -0.413334 -0.095929 +v 0.482270 -0.413334 0.095930 +v 0.408849 -0.413334 0.273184 +v 0.273184 -0.413334 0.408849 +v 0.095929 -0.413334 0.482270 +v -0.095929 -0.413334 0.482270 +v -0.273184 -0.413334 0.408849 +v -0.408849 -0.413334 0.273184 +v -0.482270 -0.413334 0.095929 +v -0.482270 -0.413334 -0.095930 +v -0.408849 -0.413334 -0.273184 +v -0.273184 -0.413334 -0.408849 +v -0.095929 -0.413334 -0.482270 +v 0.095930 -0.413334 -0.482270 +v 0.273184 0.413334 -0.408849 +v 0.408849 0.413334 -0.273184 +v 0.482270 0.413334 -0.095929 +v 0.482270 0.413334 0.095930 +v 0.408849 0.413334 0.273184 +v 0.273184 0.413334 0.408849 +v 0.095929 0.413334 0.482270 +v -0.095929 0.413334 0.482270 +v -0.273184 0.413334 0.408849 +v -0.408849 0.413334 0.273184 +v -0.482270 0.413334 0.095929 +v -0.482270 0.413334 -0.095930 +v -0.408849 0.413334 -0.273184 +v -0.273184 0.413334 -0.408849 +v -0.095929 0.413334 -0.482270 +v 0.099128 0.114830 -0.498352 +v 0.282294 -0.114831 -0.422482 +v 0.422482 -0.114831 -0.282294 +v 0.498352 -0.114831 -0.099128 +v 0.498352 -0.114831 0.099128 +v 0.422482 -0.114831 0.282294 +v 0.282294 -0.114831 0.422482 +v 0.099128 -0.114831 0.498352 +v -0.099128 -0.114831 0.498352 +v -0.282294 -0.114831 0.422482 +v -0.422482 -0.114831 0.282294 +v -0.498352 -0.114831 0.099128 +v -0.498352 -0.114831 -0.099128 +v -0.422482 -0.114831 -0.282294 +v -0.282293 -0.114831 -0.422482 +v -0.099128 -0.114831 -0.498352 +v 0.099128 -0.114831 -0.498352 +v 0.282294 0.114830 -0.422482 +v 0.422482 0.114830 -0.282294 +v 0.498352 0.114830 -0.099128 +v 0.498352 0.114830 0.099128 +v 0.422482 0.114830 0.282294 +v 0.282294 0.114830 0.422482 +v 0.099128 0.114830 0.498352 +v -0.099128 0.114830 0.498352 +v -0.282294 0.114830 0.422482 +v -0.422482 0.114830 0.282294 +v -0.498352 0.114830 0.099128 +v -0.498352 0.114830 -0.099128 +v -0.422482 0.114830 -0.282294 +v -0.282293 0.114830 -0.422482 +v -0.099128 0.114830 -0.498352 +v 0.083551 -0.500001 -0.420041 +v 0.083551 0.500000 -0.420041 +v 0.237934 -0.500001 -0.356094 +v 0.237934 0.500000 -0.356094 +v 0.356094 -0.500001 -0.237934 +v 0.356094 0.500000 -0.237934 +v 0.420041 -0.500001 -0.083551 +v 0.420041 0.500000 -0.083551 +v 0.420041 -0.500001 0.083551 +v 0.420041 0.500000 0.083551 +v 0.356094 -0.500001 0.237934 +v 0.356094 0.500000 0.237934 +v 0.237934 -0.500001 0.356094 +v 0.237934 0.500000 0.356094 +v 0.083551 -0.500001 0.420041 +v 0.083551 0.500000 0.420041 +v -0.083551 -0.500001 0.420041 +v -0.083551 0.500000 0.420041 +v -0.237934 -0.500001 0.356094 +v -0.237934 0.500000 0.356094 +v -0.356094 -0.500001 0.237934 +v -0.356094 0.500000 0.237934 +v -0.420041 -0.500001 0.083551 +v -0.420041 0.500000 0.083551 +v -0.420041 -0.500001 -0.083551 +v -0.420041 0.500000 -0.083551 +v -0.356094 -0.500001 -0.237934 +v -0.356094 0.500000 -0.237934 +v -0.237934 -0.500001 -0.356094 +v -0.237934 0.500000 -0.356094 +v -0.083551 -0.500001 -0.420041 +v -0.083551 0.500000 -0.420041 +v 0.086337 0.413334 -0.434043 +v 0.245866 -0.413335 -0.367964 +v 0.367964 -0.413335 -0.245866 +v 0.434043 -0.413335 -0.086336 +v 0.434043 -0.413335 0.086337 +v 0.367964 -0.413335 0.245866 +v 0.245866 -0.413335 0.367964 +v 0.086337 -0.413335 0.434043 +v -0.086336 -0.413335 0.434043 +v -0.245866 -0.413335 0.367964 +v -0.367964 -0.413335 0.245866 +v -0.434043 -0.413335 0.086337 +v -0.434043 -0.413335 -0.086337 +v -0.367964 -0.413335 -0.245866 +v -0.245865 -0.413335 -0.367964 +v -0.086336 -0.413335 -0.434043 +v 0.086337 -0.413335 -0.434043 +v 0.245866 0.413334 -0.367964 +v 0.367964 0.413334 -0.245866 +v 0.434043 0.413334 -0.086336 +v 0.434043 0.413334 0.086337 +v 0.367964 0.413334 0.245866 +v 0.245866 0.413334 0.367964 +v 0.086337 0.413334 0.434043 +v -0.086336 0.413334 0.434043 +v -0.245866 0.413334 0.367964 +v -0.367964 0.413334 0.245866 +v -0.434043 0.413334 0.086337 +v -0.434043 0.413334 -0.086337 +v -0.367964 0.413334 -0.245866 +v -0.245865 0.413334 -0.367964 +v -0.086336 0.413334 -0.434043 +v 0.089216 0.114830 -0.448517 +v 0.254064 -0.114831 -0.380234 +v 0.380234 -0.114831 -0.254064 +v 0.448517 -0.114831 -0.089215 +v 0.448517 -0.114831 0.089216 +v 0.380234 -0.114831 0.254064 +v 0.254064 -0.114831 0.380234 +v 0.089216 -0.114831 0.448517 +v -0.089215 -0.114831 0.448517 +v -0.254064 -0.114831 0.380234 +v -0.380234 -0.114831 0.254064 +v -0.448517 -0.114831 0.089216 +v -0.448517 -0.114831 -0.089216 +v -0.380234 -0.114831 -0.254064 +v -0.254064 -0.114831 -0.380234 +v -0.089215 -0.114831 -0.448517 +v 0.089216 -0.114831 -0.448517 +v 0.254064 0.114830 -0.380234 +v 0.380234 0.114830 -0.254064 +v 0.448517 0.114830 -0.089215 +v 0.448517 0.114830 0.089216 +v 0.380234 0.114830 0.254064 +v 0.254064 0.114830 0.380234 +v 0.089216 0.114830 0.448517 +v -0.089215 0.114830 0.448517 +v -0.254064 0.114830 0.380234 +v -0.380234 0.114830 0.254064 +v -0.448517 0.114830 0.089216 +v -0.448517 0.114830 -0.089216 +v -0.380234 0.114830 -0.254064 +v -0.254064 0.114830 -0.380234 +v -0.089215 0.114830 -0.448517 +v 0.087776 -0.352645 -0.441280 +v -0.087776 -0.352645 -0.441280 +v -0.249965 -0.352645 -0.374099 +v -0.374099 -0.352645 -0.249965 +v -0.441280 -0.352645 -0.087776 +v -0.441280 -0.352645 0.087776 +v -0.374099 -0.352645 0.249965 +v -0.249965 -0.352645 0.374099 +v -0.087776 -0.352645 0.441280 +v 0.087776 -0.352645 0.441280 +v 0.249965 -0.352645 0.374099 +v 0.374099 -0.352645 0.249965 +v 0.441280 -0.352645 0.087776 +v 0.441280 -0.352645 -0.087776 +v 0.374099 -0.352645 -0.249965 +v 0.249965 -0.352645 -0.374099 +v 0.000000 -0.352645 0.000000 +v -0.000000 -0.413334 0.000000 +vt 0.211538 0.442308 +vt 0.211538 0.467949 +vt 0.108974 0.467949 +vt 0.108974 0.442308 +vt 0.314103 0.442308 +vt 0.314103 0.467949 +vt 0.416667 0.442308 +vt 0.416667 0.467949 +vt 0.006410 0.467949 +vt 0.006410 0.442308 +vt 0.211792 0.993590 +vt 0.117562 0.954728 +vt 0.262789 0.738327 +vt 0.211538 0.006410 +vt 0.108974 0.006410 +vt 0.108974 0.032051 +vt 0.211538 0.032051 +vt 0.314103 0.006410 +vt 0.314103 0.032051 +vt 0.416667 0.006410 +vt 0.416667 0.032051 +vt 0.006410 0.006410 +vt 0.006410 0.032051 +vt 0.211361 0.993526 +vt 0.117394 0.954505 +vt 0.262040 0.737637 +vt 0.045447 0.882467 +vt 0.006475 0.788381 +vt 0.006410 0.686569 +vt 0.045263 0.592532 +vt 0.117118 0.520586 +vt 0.204627 0.488094 +vt 0.312719 0.481748 +vt 0.406687 0.520769 +vt 0.478633 0.592807 +vt 0.517605 0.686893 +vt 0.517670 0.788705 +vt 0.478816 0.882742 +vt 0.406962 0.954687 +vt 0.313044 0.993590 +vt 0.045441 0.882922 +vt 0.006410 0.789102 +vt 0.006410 0.687551 +vt 0.045442 0.593732 +vt 0.117562 0.521925 +vt 0.211793 0.483064 +vt 0.313787 0.483064 +vt 0.408016 0.521926 +vt 0.480136 0.593732 +vt 0.519168 0.687551 +vt 0.519168 0.789103 +vt 0.480136 0.882922 +vt 0.408016 0.954728 +vt 0.313786 0.993590 +vt 0.416667 0.397436 +vt 0.314103 0.397436 +vt 0.211538 0.397436 +vt 0.108974 0.397436 +vt 0.006410 0.397436 +vt 0.314103 0.185897 +vt 0.314103 0.282051 +vt 0.211538 0.282051 +vt 0.211538 0.185897 +vt 0.108974 0.282051 +vt 0.108974 0.185897 +vt 0.006410 0.282051 +vt 0.006410 0.185897 +vt 0.416667 0.185897 +vt 0.416667 0.282051 +vt 0.416667 0.076923 +vt 0.314103 0.076923 +vt 0.211538 0.076923 +vt 0.108974 0.076923 +vt 0.006410 0.076923 +vt 0.429487 0.397436 +vt 0.532051 0.397436 +vt 0.532051 0.442308 +vt 0.429487 0.442308 +vt 0.634615 0.397436 +vt 0.634615 0.442308 +vt 0.737179 0.397436 +vt 0.737179 0.442308 +vt 0.839744 0.397436 +vt 0.839744 0.442308 +vt 0.532051 0.185897 +vt 0.634615 0.185897 +vt 0.634615 0.282051 +vt 0.532051 0.282051 +vt 0.737179 0.185897 +vt 0.737179 0.282051 +vt 0.839744 0.185897 +vt 0.839744 0.282051 +vt 0.429487 0.185897 +vt 0.429487 0.282051 +vt 0.429487 0.032051 +vt 0.532051 0.032051 +vt 0.532051 0.076923 +vt 0.429487 0.076923 +vt 0.634615 0.032051 +vt 0.634615 0.076923 +vt 0.737179 0.032051 +vt 0.737179 0.076923 +vt 0.839744 0.032051 +vt 0.839744 0.076923 +s off +f 14/1 110/2 112/3 16/4 +f 12/5 108/6 110/2 14/1 +f 10/7 106/8 108/6 12/5 +f 8/4 104/3 106/9 10/10 +f 6/1 102/2 104/3 8/4 +f 4/5 100/6 102/2 6/1 +f 2/7 98/8 100/6 4/5 +f 32/4 128/3 98/9 2/10 +f 30/1 126/2 128/3 32/4 +f 28/5 124/6 126/2 30/1 +f 26/7 122/8 124/6 28/5 +f 24/4 120/3 122/9 26/10 +f 22/1 118/2 120/3 24/4 +f 20/5 116/6 118/2 22/1 +f 18/7 114/8 116/6 20/5 +f 16/4 112/3 114/9 18/10 +f 145/11 130/12 210/13 +f 13/14 15/15 111/16 109/17 +f 11/18 13/14 109/17 107/19 +f 9/20 11/18 107/19 105/21 +f 7/15 9/22 105/23 103/16 +f 5/14 7/15 103/16 101/17 +f 3/18 5/14 101/17 99/19 +f 1/20 3/18 99/19 97/21 +f 31/15 1/22 97/23 127/16 +f 29/14 31/15 127/16 125/17 +f 27/18 29/14 125/17 123/19 +f 25/20 27/18 123/19 121/21 +f 23/15 25/22 121/23 119/16 +f 21/14 23/15 119/16 117/17 +f 19/18 21/14 117/17 115/19 +f 17/20 19/18 115/19 113/21 +f 15/15 17/22 113/23 111/16 +f 194/24 195/25 209/26 +f 195/25 196/27 209/26 +f 196/27 197/28 209/26 +f 197/28 198/29 209/26 +f 198/29 199/30 209/26 +f 199/30 200/31 209/26 +f 200/31 201/32 209/26 +f 201/32 202/33 209/26 +f 202/33 203/34 209/26 +f 203/34 204/35 209/26 +f 204/35 205/36 209/26 +f 205/36 206/37 209/26 +f 206/37 207/38 209/26 +f 207/38 208/39 209/26 +f 208/39 193/40 209/26 +f 193/40 194/24 209/26 +f 130/12 131/41 210/13 +f 131/41 132/42 210/13 +f 132/42 133/43 210/13 +f 133/43 134/44 210/13 +f 134/44 135/45 210/13 +f 135/45 136/46 210/13 +f 136/46 137/47 210/13 +f 137/47 138/48 210/13 +f 138/48 139/49 210/13 +f 139/49 140/50 210/13 +f 140/50 141/51 210/13 +f 141/51 142/52 210/13 +f 142/52 143/53 210/13 +f 143/53 144/54 210/13 +f 144/54 145/11 210/13 +s 1 +f 33/55 2/7 4/5 50/56 +f 50/56 4/5 6/1 51/57 +f 51/57 6/1 8/4 52/58 +f 52/58 8/4 10/10 53/59 +f 53/55 10/7 12/5 54/56 +f 54/56 12/5 14/1 55/57 +f 55/57 14/1 16/4 56/58 +f 56/58 16/4 18/10 57/59 +f 57/55 18/7 20/5 58/56 +f 58/56 20/5 22/1 59/57 +f 59/57 22/1 24/4 60/58 +f 60/58 24/4 26/10 61/59 +f 61/55 26/7 28/5 62/56 +f 62/56 28/5 30/1 63/57 +f 64/58 32/4 2/10 33/59 +f 63/57 30/1 32/4 64/58 +f 66/60 82/61 83/62 67/63 +f 67/63 83/62 84/64 68/65 +f 68/65 84/64 85/66 69/67 +f 69/68 85/69 86/61 70/60 +f 70/60 86/61 87/62 71/63 +f 71/63 87/62 88/64 72/65 +f 72/65 88/64 89/66 73/67 +f 73/68 89/69 90/61 74/60 +f 74/60 90/61 91/62 75/63 +f 75/63 91/62 92/64 76/65 +f 76/65 92/64 93/66 77/67 +f 77/68 93/69 94/61 78/60 +f 78/60 94/61 95/62 79/63 +f 80/65 96/64 65/66 81/67 +f 79/63 95/62 96/64 80/65 +f 65/69 33/55 50/56 82/61 +f 82/61 50/56 51/57 83/62 +f 83/62 51/57 52/58 84/64 +f 84/64 52/58 53/59 85/66 +f 85/69 53/55 54/56 86/61 +f 86/61 54/56 55/57 87/62 +f 87/62 55/57 56/58 88/64 +f 88/64 56/58 57/59 89/66 +f 89/69 57/55 58/56 90/61 +f 90/61 58/56 59/57 91/62 +f 91/62 59/57 60/58 92/64 +f 92/64 60/58 61/59 93/66 +f 93/69 61/55 62/56 94/61 +f 94/61 62/56 63/57 95/62 +f 96/64 64/58 33/59 65/66 +f 95/62 63/57 64/58 96/64 +f 1/21 49/70 34/71 3/19 +f 3/19 34/71 35/72 5/17 +f 5/17 35/72 36/73 7/16 +f 7/16 36/73 37/74 9/23 +f 9/21 37/70 38/71 11/19 +f 11/19 38/71 39/72 13/17 +f 13/17 39/72 40/73 15/16 +f 15/16 40/73 41/74 17/23 +f 17/21 41/70 42/71 19/19 +f 19/19 42/71 43/72 21/17 +f 21/17 43/72 44/73 23/16 +f 23/16 44/73 45/74 25/23 +f 25/21 45/70 46/71 27/19 +f 27/19 46/71 47/72 29/17 +f 31/16 48/73 49/74 1/23 +f 29/17 47/72 48/73 31/16 +f 49/70 81/68 66/60 34/71 +f 34/71 66/60 67/63 35/72 +f 35/72 67/63 68/65 36/73 +f 36/73 68/65 69/67 37/74 +f 37/70 69/68 70/60 38/71 +f 38/71 70/60 71/63 39/72 +f 39/72 71/63 72/65 40/73 +f 40/73 72/65 73/67 41/74 +f 41/70 73/68 74/60 42/71 +f 42/71 74/60 75/63 43/72 +f 43/72 75/63 76/65 44/73 +f 44/73 76/65 77/67 45/74 +f 45/70 77/68 78/60 46/71 +f 46/71 78/60 79/63 47/72 +f 48/73 80/65 81/67 49/74 +f 47/72 79/63 80/65 48/73 +f 65/69 82/61 66/60 81/68 +f 129/75 146/76 100/77 98/78 +f 146/76 147/79 102/80 100/77 +f 147/79 148/81 104/82 102/80 +f 148/81 149/83 106/84 104/82 +f 149/75 150/76 108/77 106/78 +f 150/76 151/79 110/80 108/77 +f 151/79 152/81 112/82 110/80 +f 152/81 153/83 114/84 112/82 +f 153/75 154/76 116/77 114/78 +f 154/76 155/79 118/80 116/77 +f 155/79 156/81 120/82 118/80 +f 156/81 157/83 122/84 120/82 +f 157/75 158/76 124/77 122/78 +f 158/76 159/79 126/80 124/77 +f 160/81 129/83 98/84 128/82 +f 159/79 160/81 128/82 126/80 +f 162/85 163/86 179/87 178/88 +f 163/86 164/89 180/90 179/87 +f 164/89 165/91 181/92 180/90 +f 165/93 166/85 182/88 181/94 +f 166/85 167/86 183/87 182/88 +f 167/86 168/89 184/90 183/87 +f 168/89 169/91 185/92 184/90 +f 169/93 170/85 186/88 185/94 +f 170/85 171/86 187/87 186/88 +f 171/86 172/89 188/90 187/87 +f 172/89 173/91 189/92 188/90 +f 173/93 174/85 190/88 189/94 +f 174/85 175/86 191/87 190/88 +f 176/89 177/91 161/92 192/90 +f 175/86 176/89 192/90 191/87 +f 161/94 178/88 146/76 129/75 +f 178/88 179/87 147/79 146/76 +f 179/87 180/90 148/81 147/79 +f 180/90 181/92 149/83 148/81 +f 181/94 182/88 150/76 149/75 +f 182/88 183/87 151/79 150/76 +f 183/87 184/90 152/81 151/79 +f 184/90 185/92 153/83 152/81 +f 185/94 186/88 154/76 153/75 +f 186/88 187/87 155/79 154/76 +f 187/87 188/90 156/81 155/79 +f 188/90 189/92 157/83 156/81 +f 189/94 190/88 158/76 157/75 +f 190/88 191/87 159/79 158/76 +f 192/90 161/92 129/83 160/81 +f 191/87 192/90 160/81 159/79 +f 97/95 99/96 130/97 145/98 +f 99/96 101/99 131/100 130/97 +f 101/99 103/101 132/102 131/100 +f 103/101 105/103 133/104 132/102 +f 105/95 107/96 134/97 133/98 +f 107/96 109/99 135/100 134/97 +f 109/99 111/101 136/102 135/100 +f 111/101 113/103 137/104 136/102 +f 113/95 115/96 138/97 137/98 +f 115/96 117/99 139/100 138/97 +f 117/99 119/101 140/102 139/100 +f 119/101 121/103 141/104 140/102 +f 121/95 123/96 142/97 141/98 +f 123/96 125/99 143/100 142/97 +f 127/101 97/103 145/104 144/102 +f 125/99 127/101 144/102 143/100 +f 193/98 208/97 162/85 177/93 +f 208/97 207/100 163/86 162/85 +f 207/100 206/102 164/89 163/86 +f 206/102 205/104 165/91 164/89 +f 205/98 204/97 166/85 165/93 +f 204/97 203/100 167/86 166/85 +f 203/100 202/102 168/89 167/86 +f 202/102 201/104 169/91 168/89 +f 201/98 200/97 170/85 169/93 +f 200/97 199/100 171/86 170/85 +f 199/100 198/102 172/89 171/86 +f 198/102 197/104 173/91 172/89 +f 197/98 196/97 174/85 173/93 +f 196/97 195/100 175/86 174/85 +f 194/102 193/104 177/91 176/89 +f 195/100 194/102 176/89 175/86 +f 161/94 177/93 162/85 178/88 diff --git a/mods/cottages/models/cottages_barrel_closed.obj b/mods/cottages/models/cottages_barrel_closed.obj new file mode 100644 index 0000000..f2ab55a --- /dev/null +++ b/mods/cottages/models/cottages_barrel_closed.obj @@ -0,0 +1,453 @@ +# Blender v2.69 (sub 0) OBJ File: 'barrel-closed.blend' +# www.blender.org +o Cylinder +v 0.092835 -0.500001 -0.466712 +v 0.092835 0.500000 -0.466712 +v 0.264371 -0.500001 -0.395660 +v 0.264371 0.500000 -0.395660 +v 0.395660 -0.500001 -0.264371 +v 0.395660 0.500000 -0.264371 +v 0.466712 -0.500001 -0.092835 +v 0.466712 0.500000 -0.092835 +v 0.466712 -0.500001 0.092835 +v 0.466712 0.500000 0.092835 +v 0.395660 -0.500001 0.264371 +v 0.395660 0.500000 0.264371 +v 0.264371 -0.500001 0.395660 +v 0.264371 0.500000 0.395660 +v 0.092835 -0.500001 0.466712 +v 0.092835 0.500000 0.466712 +v -0.092835 -0.500001 0.466712 +v -0.092835 0.500000 0.466712 +v -0.264371 -0.500001 0.395660 +v -0.264371 0.500000 0.395660 +v -0.395660 -0.500001 0.264371 +v -0.395660 0.500000 0.264371 +v -0.466712 -0.500001 0.092835 +v -0.466712 0.500000 0.092835 +v -0.466712 -0.500001 -0.092835 +v -0.466712 0.500000 -0.092835 +v -0.395660 -0.500001 -0.264371 +v -0.395660 0.500000 -0.264371 +v -0.264371 -0.500001 -0.395660 +v -0.264371 0.500000 -0.395660 +v -0.092835 -0.500001 -0.466713 +v -0.092835 0.500000 -0.466713 +v 0.095930 0.413334 -0.482270 +v 0.273184 -0.413334 -0.408849 +v 0.408849 -0.413334 -0.273184 +v 0.482270 -0.413334 -0.095929 +v 0.482270 -0.413334 0.095930 +v 0.408849 -0.413334 0.273184 +v 0.273184 -0.413334 0.408849 +v 0.095929 -0.413334 0.482270 +v -0.095929 -0.413334 0.482270 +v -0.273184 -0.413334 0.408849 +v -0.408849 -0.413334 0.273184 +v -0.482270 -0.413334 0.095929 +v -0.482270 -0.413334 -0.095930 +v -0.408849 -0.413334 -0.273184 +v -0.273184 -0.413334 -0.408849 +v -0.095929 -0.413334 -0.482270 +v 0.095930 -0.413334 -0.482270 +v 0.273184 0.413334 -0.408849 +v 0.408849 0.413334 -0.273184 +v 0.482270 0.413334 -0.095929 +v 0.482270 0.413334 0.095930 +v 0.408849 0.413334 0.273184 +v 0.273184 0.413334 0.408849 +v 0.095929 0.413334 0.482270 +v -0.095929 0.413334 0.482270 +v -0.273184 0.413334 0.408849 +v -0.408849 0.413334 0.273184 +v -0.482270 0.413334 0.095929 +v -0.482270 0.413334 -0.095930 +v -0.408849 0.413334 -0.273184 +v -0.273184 0.413334 -0.408849 +v -0.095929 0.413334 -0.482270 +v 0.099128 0.114830 -0.498352 +v 0.282294 -0.114831 -0.422482 +v 0.422482 -0.114831 -0.282294 +v 0.498352 -0.114831 -0.099128 +v 0.498352 -0.114831 0.099128 +v 0.422482 -0.114831 0.282294 +v 0.282294 -0.114831 0.422482 +v 0.099128 -0.114831 0.498352 +v -0.099128 -0.114831 0.498352 +v -0.282294 -0.114831 0.422482 +v -0.422482 -0.114831 0.282294 +v -0.498352 -0.114831 0.099128 +v -0.498352 -0.114831 -0.099128 +v -0.422482 -0.114831 -0.282294 +v -0.282293 -0.114831 -0.422482 +v -0.099128 -0.114831 -0.498352 +v 0.099128 -0.114831 -0.498352 +v 0.282294 0.114830 -0.422482 +v 0.422482 0.114830 -0.282294 +v 0.498352 0.114830 -0.099128 +v 0.498352 0.114830 0.099128 +v 0.422482 0.114830 0.282294 +v 0.282294 0.114830 0.422482 +v 0.099128 0.114830 0.498352 +v -0.099128 0.114830 0.498352 +v -0.282294 0.114830 0.422482 +v -0.422482 0.114830 0.282294 +v -0.498352 0.114830 0.099128 +v -0.498352 0.114830 -0.099128 +v -0.422482 0.114830 -0.282294 +v -0.282293 0.114830 -0.422482 +v -0.099128 0.114830 -0.498352 +v 0.083551 -0.500001 -0.420041 +v 0.083551 0.500000 -0.420041 +v 0.237934 -0.500001 -0.356094 +v 0.237934 0.500000 -0.356094 +v 0.356094 -0.500001 -0.237934 +v 0.356094 0.500000 -0.237934 +v 0.420041 -0.500001 -0.083551 +v 0.420041 0.500000 -0.083551 +v 0.420041 -0.500001 0.083551 +v 0.420041 0.500000 0.083551 +v 0.356094 -0.500001 0.237934 +v 0.356094 0.500000 0.237934 +v 0.237934 -0.500001 0.356094 +v 0.237934 0.500000 0.356094 +v 0.083551 -0.500001 0.420041 +v 0.083551 0.500000 0.420041 +v -0.083551 -0.500001 0.420041 +v -0.083551 0.500000 0.420041 +v -0.237934 -0.500001 0.356094 +v -0.237934 0.500000 0.356094 +v -0.356094 -0.500001 0.237934 +v -0.356094 0.500000 0.237934 +v -0.420041 -0.500001 0.083551 +v -0.420041 0.500000 0.083551 +v -0.420041 -0.500001 -0.083551 +v -0.420041 0.500000 -0.083551 +v -0.356094 -0.500001 -0.237934 +v -0.356094 0.500000 -0.237934 +v -0.237934 -0.500001 -0.356094 +v -0.237934 0.500000 -0.356094 +v -0.083551 -0.500001 -0.420041 +v -0.083551 0.500000 -0.420041 +v 0.086337 0.413334 -0.434043 +v 0.245866 -0.413335 -0.367964 +v 0.367964 -0.413335 -0.245866 +v 0.434043 -0.413335 -0.086336 +v 0.434043 -0.413335 0.086337 +v 0.367964 -0.413335 0.245866 +v 0.245866 -0.413335 0.367964 +v 0.086337 -0.413335 0.434043 +v -0.086336 -0.413335 0.434043 +v -0.245866 -0.413335 0.367964 +v -0.367964 -0.413335 0.245866 +v -0.434043 -0.413335 0.086337 +v -0.434043 -0.413335 -0.086337 +v -0.367964 -0.413335 -0.245866 +v -0.245865 -0.413335 -0.367964 +v -0.086336 -0.413335 -0.434043 +v 0.086337 -0.413335 -0.434043 +v 0.245866 0.413334 -0.367964 +v 0.367964 0.413334 -0.245866 +v 0.434043 0.413334 -0.086336 +v 0.434043 0.413334 0.086337 +v 0.367964 0.413334 0.245866 +v 0.245866 0.413334 0.367964 +v 0.086337 0.413334 0.434043 +v -0.086336 0.413334 0.434043 +v -0.245866 0.413334 0.367964 +v -0.367964 0.413334 0.245866 +v -0.434043 0.413334 0.086337 +v -0.434043 0.413334 -0.086337 +v -0.367964 0.413334 -0.245866 +v -0.245865 0.413334 -0.367964 +v -0.086336 0.413334 -0.434043 +v 0.087776 0.428605 -0.441280 +v -0.087776 0.428605 -0.441280 +v -0.249965 0.428605 -0.374099 +v -0.374099 0.428605 -0.249965 +v -0.441280 0.428605 -0.087776 +v -0.441280 0.428605 0.087776 +v -0.374099 0.428605 0.249965 +v -0.249965 0.428605 0.374099 +v -0.087776 0.428605 0.441280 +v 0.087776 0.428605 0.441280 +v 0.249965 0.428605 0.374099 +v 0.374099 0.428605 0.249965 +v 0.441280 0.428605 0.087776 +v 0.441280 0.428605 -0.087776 +v 0.374099 0.428605 -0.249965 +v 0.249965 0.428605 -0.374099 +v 0.000000 0.428605 0.000000 +v -0.000000 -0.413334 0.000000 +vt 0.211538 0.442308 +vt 0.211538 0.467949 +vt 0.108974 0.467949 +vt 0.108974 0.442308 +vt 0.314103 0.442308 +vt 0.314103 0.467949 +vt 0.416667 0.442308 +vt 0.416667 0.467949 +vt 0.006410 0.467949 +vt 0.006410 0.442308 +vt 0.211792 0.993590 +vt 0.117562 0.954728 +vt 0.262789 0.738327 +vt 0.211538 0.006410 +vt 0.108974 0.006410 +vt 0.108974 0.032051 +vt 0.211538 0.032051 +vt 0.314103 0.006410 +vt 0.314103 0.032051 +vt 0.416667 0.006410 +vt 0.416667 0.032051 +vt 0.006410 0.006410 +vt 0.006410 0.032051 +vt 0.211361 0.993526 +vt 0.117394 0.954505 +vt 0.262040 0.737637 +vt 0.045447 0.882467 +vt 0.006475 0.788381 +vt 0.006410 0.686569 +vt 0.045263 0.592532 +vt 0.117118 0.520586 +vt 0.204627 0.488094 +vt 0.312719 0.481748 +vt 0.406687 0.520769 +vt 0.478633 0.592807 +vt 0.517605 0.686893 +vt 0.517670 0.788705 +vt 0.478816 0.882742 +vt 0.406962 0.954687 +vt 0.313044 0.993590 +vt 0.045441 0.882922 +vt 0.006410 0.789102 +vt 0.006410 0.687551 +vt 0.045442 0.593732 +vt 0.117562 0.521925 +vt 0.211793 0.483064 +vt 0.313787 0.483064 +vt 0.408016 0.521926 +vt 0.480136 0.593732 +vt 0.519168 0.687551 +vt 0.519168 0.789103 +vt 0.480136 0.882922 +vt 0.408016 0.954728 +vt 0.313786 0.993590 +vt 0.416667 0.397436 +vt 0.314103 0.397436 +vt 0.211538 0.397436 +vt 0.108974 0.397436 +vt 0.006410 0.397436 +vt 0.314103 0.185897 +vt 0.314103 0.282051 +vt 0.211538 0.282051 +vt 0.211538 0.185897 +vt 0.108974 0.282051 +vt 0.108974 0.185897 +vt 0.006410 0.282051 +vt 0.006410 0.185897 +vt 0.416667 0.185897 +vt 0.416667 0.282051 +vt 0.416667 0.076923 +vt 0.314103 0.076923 +vt 0.211538 0.076923 +vt 0.108974 0.076923 +vt 0.006410 0.076923 +vt 0.429487 0.397436 +vt 0.532051 0.397436 +vt 0.532051 0.442308 +vt 0.429487 0.442308 +vt 0.634615 0.397436 +vt 0.634615 0.442308 +vt 0.737179 0.397436 +vt 0.737179 0.442308 +vt 0.839744 0.397436 +vt 0.839744 0.442308 +vt 0.429487 0.032051 +vt 0.532051 0.032051 +vt 0.532051 0.076923 +vt 0.429487 0.076923 +vt 0.634615 0.032051 +vt 0.634615 0.076923 +vt 0.737179 0.032051 +vt 0.737179 0.076923 +vt 0.839744 0.032051 +vt 0.839744 0.076923 +s off +f 14/1 110/2 112/3 16/4 +f 12/5 108/6 110/2 14/1 +f 10/7 106/8 108/6 12/5 +f 8/4 104/3 106/9 10/10 +f 6/1 102/2 104/3 8/4 +f 4/5 100/6 102/2 6/1 +f 2/7 98/8 100/6 4/5 +f 32/4 128/3 98/9 2/10 +f 30/1 126/2 128/3 32/4 +f 28/5 124/6 126/2 30/1 +f 26/7 122/8 124/6 28/5 +f 24/4 120/3 122/9 26/10 +f 22/1 118/2 120/3 24/4 +f 20/5 116/6 118/2 22/1 +f 18/7 114/8 116/6 20/5 +f 16/4 112/3 114/9 18/10 +f 145/11 130/12 178/13 +f 13/14 15/15 111/16 109/17 +f 11/18 13/14 109/17 107/19 +f 9/20 11/18 107/19 105/21 +f 7/15 9/22 105/23 103/16 +f 5/14 7/15 103/16 101/17 +f 3/18 5/14 101/17 99/19 +f 1/20 3/18 99/19 97/21 +f 31/15 1/22 97/23 127/16 +f 29/14 31/15 127/16 125/17 +f 27/18 29/14 125/17 123/19 +f 25/20 27/18 123/19 121/21 +f 23/15 25/22 121/23 119/16 +f 21/14 23/15 119/16 117/17 +f 19/18 21/14 117/17 115/19 +f 17/20 19/18 115/19 113/21 +f 15/15 17/22 113/23 111/16 +f 162/24 163/25 177/26 +f 163/25 164/27 177/26 +f 164/27 165/28 177/26 +f 165/28 166/29 177/26 +f 166/29 167/30 177/26 +f 167/30 168/31 177/26 +f 168/31 169/32 177/26 +f 169/32 170/33 177/26 +f 170/33 171/34 177/26 +f 171/34 172/35 177/26 +f 172/35 173/36 177/26 +f 173/36 174/37 177/26 +f 174/37 175/38 177/26 +f 175/38 176/39 177/26 +f 176/39 161/40 177/26 +f 161/40 162/24 177/26 +f 130/12 131/41 178/13 +f 131/41 132/42 178/13 +f 132/42 133/43 178/13 +f 133/43 134/44 178/13 +f 134/44 135/45 178/13 +f 135/45 136/46 178/13 +f 136/46 137/47 178/13 +f 137/47 138/48 178/13 +f 138/48 139/49 178/13 +f 139/49 140/50 178/13 +f 140/50 141/51 178/13 +f 141/51 142/52 178/13 +f 142/52 143/53 178/13 +f 143/53 144/54 178/13 +f 144/54 145/11 178/13 +s 1 +f 33/55 2/7 4/5 50/56 +f 50/56 4/5 6/1 51/57 +f 51/57 6/1 8/4 52/58 +f 52/58 8/4 10/10 53/59 +f 53/55 10/7 12/5 54/56 +f 54/56 12/5 14/1 55/57 +f 55/57 14/1 16/4 56/58 +f 56/58 16/4 18/10 57/59 +f 57/55 18/7 20/5 58/56 +f 58/56 20/5 22/1 59/57 +f 59/57 22/1 24/4 60/58 +f 60/58 24/4 26/10 61/59 +f 61/55 26/7 28/5 62/56 +f 62/56 28/5 30/1 63/57 +f 64/58 32/4 2/10 33/59 +f 63/57 30/1 32/4 64/58 +f 66/60 82/61 83/62 67/63 +f 67/63 83/62 84/64 68/65 +f 68/65 84/64 85/66 69/67 +f 69/68 85/69 86/61 70/60 +f 70/60 86/61 87/62 71/63 +f 71/63 87/62 88/64 72/65 +f 72/65 88/64 89/66 73/67 +f 73/68 89/69 90/61 74/60 +f 74/60 90/61 91/62 75/63 +f 75/63 91/62 92/64 76/65 +f 76/65 92/64 93/66 77/67 +f 77/68 93/69 94/61 78/60 +f 78/60 94/61 95/62 79/63 +f 80/65 96/64 65/66 81/67 +f 79/63 95/62 96/64 80/65 +f 65/69 33/55 50/56 82/61 +f 82/61 50/56 51/57 83/62 +f 83/62 51/57 52/58 84/64 +f 84/64 52/58 53/59 85/66 +f 85/69 53/55 54/56 86/61 +f 86/61 54/56 55/57 87/62 +f 87/62 55/57 56/58 88/64 +f 88/64 56/58 57/59 89/66 +f 89/69 57/55 58/56 90/61 +f 90/61 58/56 59/57 91/62 +f 91/62 59/57 60/58 92/64 +f 92/64 60/58 61/59 93/66 +f 93/69 61/55 62/56 94/61 +f 94/61 62/56 63/57 95/62 +f 96/64 64/58 33/59 65/66 +f 95/62 63/57 64/58 96/64 +f 1/21 49/70 34/71 3/19 +f 3/19 34/71 35/72 5/17 +f 5/17 35/72 36/73 7/16 +f 7/16 36/73 37/74 9/23 +f 9/21 37/70 38/71 11/19 +f 11/19 38/71 39/72 13/17 +f 13/17 39/72 40/73 15/16 +f 15/16 40/73 41/74 17/23 +f 17/21 41/70 42/71 19/19 +f 19/19 42/71 43/72 21/17 +f 21/17 43/72 44/73 23/16 +f 23/16 44/73 45/74 25/23 +f 25/21 45/70 46/71 27/19 +f 27/19 46/71 47/72 29/17 +f 31/16 48/73 49/74 1/23 +f 29/17 47/72 48/73 31/16 +f 49/70 81/68 66/60 34/71 +f 34/71 66/60 67/63 35/72 +f 35/72 67/63 68/65 36/73 +f 36/73 68/65 69/67 37/74 +f 37/70 69/68 70/60 38/71 +f 38/71 70/60 71/63 39/72 +f 39/72 71/63 72/65 40/73 +f 40/73 72/65 73/67 41/74 +f 41/70 73/68 74/60 42/71 +f 42/71 74/60 75/63 43/72 +f 43/72 75/63 76/65 44/73 +f 44/73 76/65 77/67 45/74 +f 45/70 77/68 78/60 46/71 +f 46/71 78/60 79/63 47/72 +f 48/73 80/65 81/67 49/74 +f 47/72 79/63 80/65 48/73 +f 65/69 82/61 66/60 81/68 +f 129/75 146/76 100/77 98/78 +f 146/76 147/79 102/80 100/77 +f 147/79 148/81 104/82 102/80 +f 148/81 149/83 106/84 104/82 +f 149/75 150/76 108/77 106/78 +f 150/76 151/79 110/80 108/77 +f 151/79 152/81 112/82 110/80 +f 152/81 153/83 114/84 112/82 +f 153/75 154/76 116/77 114/78 +f 154/76 155/79 118/80 116/77 +f 155/79 156/81 120/82 118/80 +f 156/81 157/83 122/84 120/82 +f 157/75 158/76 124/77 122/78 +f 158/76 159/79 126/80 124/77 +f 160/81 129/83 98/84 128/82 +f 159/79 160/81 128/82 126/80 +f 97/85 99/86 130/87 145/88 +f 99/86 101/89 131/90 130/87 +f 101/89 103/91 132/92 131/90 +f 103/91 105/93 133/94 132/92 +f 105/85 107/86 134/87 133/88 +f 107/86 109/89 135/90 134/87 +f 109/89 111/91 136/92 135/90 +f 111/91 113/93 137/94 136/92 +f 113/85 115/86 138/87 137/88 +f 115/86 117/89 139/90 138/87 +f 117/89 119/91 140/92 139/90 +f 119/91 121/93 141/94 140/92 +f 121/85 123/86 142/87 141/88 +f 123/86 125/89 143/90 142/87 +f 127/91 97/93 145/94 144/92 +f 125/89 127/91 144/92 143/90 diff --git a/mods/cottages/models/cottages_barrel_closed_lying.obj b/mods/cottages/models/cottages_barrel_closed_lying.obj new file mode 100644 index 0000000..ae22045 --- /dev/null +++ b/mods/cottages/models/cottages_barrel_closed_lying.obj @@ -0,0 +1,453 @@ +# Blender v2.69 (sub 0) OBJ File: 'barrel-closed.blend' +# www.blender.org +o Cylinder +v 0.500001 0.092835 -0.466712 +v -0.500000 0.092835 -0.466712 +v 0.500001 0.264371 -0.395660 +v -0.500000 0.264371 -0.395660 +v 0.500001 0.395660 -0.264371 +v -0.500000 0.395660 -0.264371 +v 0.500001 0.466712 -0.092835 +v -0.500000 0.466713 -0.092835 +v 0.500001 0.466712 0.092835 +v -0.500000 0.466713 0.092835 +v 0.500001 0.395660 0.264371 +v -0.500000 0.395660 0.264371 +v 0.500001 0.264371 0.395660 +v -0.500000 0.264371 0.395660 +v 0.500001 0.092835 0.466712 +v -0.500000 0.092835 0.466712 +v 0.500001 -0.092835 0.466712 +v -0.500000 -0.092835 0.466712 +v 0.500001 -0.264371 0.395660 +v -0.500000 -0.264371 0.395660 +v 0.500001 -0.395660 0.264372 +v -0.500000 -0.395660 0.264371 +v 0.500001 -0.466713 0.092835 +v -0.500000 -0.466712 0.092835 +v 0.500001 -0.466713 -0.092835 +v -0.500000 -0.466712 -0.092835 +v 0.500001 -0.395660 -0.264371 +v -0.500000 -0.395660 -0.264372 +v 0.500001 -0.264371 -0.395660 +v -0.500000 -0.264371 -0.395660 +v 0.500001 -0.092835 -0.466712 +v -0.500000 -0.092835 -0.466713 +v -0.413334 0.095930 -0.482270 +v 0.413335 0.273184 -0.408849 +v 0.413335 0.408849 -0.273184 +v 0.413335 0.482270 -0.095929 +v 0.413335 0.482270 0.095930 +v 0.413335 0.408849 0.273184 +v 0.413334 0.273184 0.408849 +v 0.413334 0.095929 0.482270 +v 0.413334 -0.095930 0.482270 +v 0.413334 -0.273184 0.408849 +v 0.413334 -0.408849 0.273184 +v 0.413334 -0.482270 0.095930 +v 0.413334 -0.482270 -0.095929 +v 0.413334 -0.408849 -0.273184 +v 0.413334 -0.273184 -0.408849 +v 0.413334 -0.095929 -0.482270 +v 0.413335 0.095929 -0.482270 +v -0.413334 0.273184 -0.408849 +v -0.413334 0.408849 -0.273184 +v -0.413334 0.482270 -0.095929 +v -0.413334 0.482270 0.095929 +v -0.413334 0.408849 0.273184 +v -0.413334 0.273184 0.408849 +v -0.413334 0.095930 0.482270 +v -0.413334 -0.095929 0.482270 +v -0.413334 -0.273184 0.408849 +v -0.413334 -0.408849 0.273184 +v -0.413334 -0.482270 0.095929 +v -0.413334 -0.482270 -0.095930 +v -0.413334 -0.408849 -0.273184 +v -0.413334 -0.273184 -0.408849 +v -0.413334 -0.095929 -0.482270 +v -0.114830 0.099128 -0.498352 +v 0.114831 0.282294 -0.422482 +v 0.114831 0.422482 -0.282294 +v 0.114831 0.498352 -0.099128 +v 0.114831 0.498352 0.099128 +v 0.114831 0.422482 0.282294 +v 0.114831 0.282294 0.422482 +v 0.114831 0.099128 0.498352 +v 0.114831 -0.099128 0.498352 +v 0.114831 -0.282294 0.422482 +v 0.114831 -0.422482 0.282294 +v 0.114831 -0.498352 0.099128 +v 0.114831 -0.498352 -0.099128 +v 0.114831 -0.422482 -0.282294 +v 0.114831 -0.282293 -0.422482 +v 0.114831 -0.099128 -0.498352 +v 0.114831 0.099128 -0.498352 +v -0.114830 0.282294 -0.422482 +v -0.114830 0.422482 -0.282294 +v -0.114830 0.498352 -0.099128 +v -0.114830 0.498352 0.099128 +v -0.114830 0.422482 0.282294 +v -0.114830 0.282294 0.422482 +v -0.114830 0.099128 0.498352 +v -0.114830 -0.099128 0.498352 +v -0.114830 -0.282293 0.422482 +v -0.114830 -0.422482 0.282294 +v -0.114830 -0.498352 0.099128 +v -0.114830 -0.498352 -0.099128 +v -0.114830 -0.422482 -0.282294 +v -0.114830 -0.282293 -0.422482 +v -0.114830 -0.099128 -0.498352 +v 0.500001 0.083551 -0.420041 +v -0.500000 0.083552 -0.420041 +v 0.500001 0.237934 -0.356094 +v -0.500000 0.237934 -0.356094 +v 0.500001 0.356094 -0.237934 +v -0.500000 0.356094 -0.237934 +v 0.500001 0.420041 -0.083551 +v -0.500000 0.420041 -0.083551 +v 0.500001 0.420041 0.083552 +v -0.500000 0.420041 0.083551 +v 0.500001 0.356094 0.237934 +v -0.500000 0.356094 0.237934 +v 0.500001 0.237934 0.356094 +v -0.500000 0.237934 0.356094 +v 0.500001 0.083551 0.420041 +v -0.500000 0.083551 0.420041 +v 0.500001 -0.083551 0.420041 +v -0.500000 -0.083551 0.420041 +v 0.500001 -0.237934 0.356094 +v -0.500000 -0.237934 0.356094 +v 0.500001 -0.356094 0.237934 +v -0.500000 -0.356094 0.237934 +v 0.500001 -0.420041 0.083551 +v -0.500000 -0.420041 0.083551 +v 0.500001 -0.420041 -0.083551 +v -0.500000 -0.420041 -0.083552 +v 0.500001 -0.356094 -0.237934 +v -0.500000 -0.356094 -0.237934 +v 0.500001 -0.237934 -0.356094 +v -0.500000 -0.237934 -0.356094 +v 0.500001 -0.083551 -0.420041 +v -0.500000 -0.083551 -0.420041 +v -0.413334 0.086337 -0.434043 +v 0.413335 0.245866 -0.367964 +v 0.413335 0.367964 -0.245866 +v 0.413335 0.434043 -0.086336 +v 0.413335 0.434043 0.086337 +v 0.413335 0.367964 0.245866 +v 0.413335 0.245866 0.367964 +v 0.413334 0.086336 0.434043 +v 0.413334 -0.086337 0.434043 +v 0.413334 -0.245866 0.367964 +v 0.413334 -0.367964 0.245866 +v 0.413334 -0.434043 0.086337 +v 0.413334 -0.434043 -0.086337 +v 0.413334 -0.367964 -0.245866 +v 0.413335 -0.245865 -0.367964 +v 0.413335 -0.086336 -0.434043 +v 0.413335 0.086336 -0.434043 +v -0.413334 0.245866 -0.367964 +v -0.413334 0.367964 -0.245866 +v -0.413334 0.434043 -0.086337 +v -0.413334 0.434043 0.086337 +v -0.413334 0.367964 0.245866 +v -0.413334 0.245866 0.367964 +v -0.413334 0.086337 0.434043 +v -0.413334 -0.086336 0.434043 +v -0.413334 -0.245865 0.367964 +v -0.413334 -0.367964 0.245866 +v -0.413334 -0.434043 0.086337 +v -0.413334 -0.434043 -0.086337 +v -0.413334 -0.367964 -0.245866 +v -0.413334 -0.245865 -0.367964 +v -0.413334 -0.086336 -0.434043 +v -0.428605 0.087776 -0.441280 +v -0.428605 -0.087776 -0.441280 +v -0.428605 -0.249965 -0.374099 +v -0.428605 -0.374099 -0.249965 +v -0.428605 -0.441280 -0.087776 +v -0.428605 -0.441280 0.087776 +v -0.428605 -0.374099 0.249965 +v -0.428605 -0.249965 0.374099 +v -0.428605 -0.087776 0.441280 +v -0.428605 0.087776 0.441280 +v -0.428605 0.249965 0.374099 +v -0.428605 0.374099 0.249965 +v -0.428605 0.441280 0.087776 +v -0.428605 0.441280 -0.087776 +v -0.428605 0.374099 -0.249965 +v -0.428605 0.249965 -0.374099 +v -0.428605 0.000000 -0.000000 +v 0.413334 -0.000000 0.000000 +vt 0.211538 0.442308 +vt 0.211538 0.467949 +vt 0.108974 0.467949 +vt 0.108974 0.442308 +vt 0.314103 0.442308 +vt 0.314103 0.467949 +vt 0.416667 0.442308 +vt 0.416667 0.467949 +vt 0.006410 0.467949 +vt 0.006410 0.442308 +vt 0.211792 0.993590 +vt 0.117562 0.954728 +vt 0.262789 0.738327 +vt 0.211538 0.006410 +vt 0.108974 0.006410 +vt 0.108974 0.032051 +vt 0.211538 0.032051 +vt 0.314103 0.006410 +vt 0.314103 0.032051 +vt 0.416667 0.006410 +vt 0.416667 0.032051 +vt 0.006410 0.006410 +vt 0.006410 0.032051 +vt 0.211361 0.993526 +vt 0.117394 0.954505 +vt 0.262040 0.737637 +vt 0.045447 0.882467 +vt 0.006475 0.788381 +vt 0.006410 0.686569 +vt 0.045263 0.592532 +vt 0.117118 0.520586 +vt 0.204627 0.488094 +vt 0.312719 0.481748 +vt 0.406687 0.520769 +vt 0.478633 0.592807 +vt 0.517605 0.686893 +vt 0.517670 0.788705 +vt 0.478816 0.882742 +vt 0.406962 0.954687 +vt 0.313044 0.993590 +vt 0.045441 0.882922 +vt 0.006410 0.789102 +vt 0.006410 0.687551 +vt 0.045442 0.593732 +vt 0.117562 0.521925 +vt 0.211793 0.483064 +vt 0.313787 0.483064 +vt 0.408016 0.521926 +vt 0.480136 0.593732 +vt 0.519168 0.687551 +vt 0.519168 0.789103 +vt 0.480136 0.882922 +vt 0.408016 0.954728 +vt 0.313786 0.993590 +vt 0.416667 0.397436 +vt 0.314103 0.397436 +vt 0.211538 0.397436 +vt 0.108974 0.397436 +vt 0.006410 0.397436 +vt 0.314103 0.185897 +vt 0.314103 0.282051 +vt 0.211538 0.282051 +vt 0.211538 0.185897 +vt 0.108974 0.282051 +vt 0.108974 0.185897 +vt 0.006410 0.282051 +vt 0.006410 0.185897 +vt 0.416667 0.185897 +vt 0.416667 0.282051 +vt 0.416667 0.076923 +vt 0.314103 0.076923 +vt 0.211538 0.076923 +vt 0.108974 0.076923 +vt 0.006410 0.076923 +vt 0.429487 0.397436 +vt 0.532051 0.397436 +vt 0.532051 0.442308 +vt 0.429487 0.442308 +vt 0.634615 0.397436 +vt 0.634615 0.442308 +vt 0.737179 0.397436 +vt 0.737179 0.442308 +vt 0.839744 0.397436 +vt 0.839744 0.442308 +vt 0.429487 0.032051 +vt 0.532051 0.032051 +vt 0.532051 0.076923 +vt 0.429487 0.076923 +vt 0.634615 0.032051 +vt 0.634615 0.076923 +vt 0.737179 0.032051 +vt 0.737179 0.076923 +vt 0.839744 0.032051 +vt 0.839744 0.076923 +s off +f 14/1 110/2 112/3 16/4 +f 12/5 108/6 110/2 14/1 +f 10/7 106/8 108/6 12/5 +f 8/4 104/3 106/9 10/10 +f 6/1 102/2 104/3 8/4 +f 4/5 100/6 102/2 6/1 +f 2/7 98/8 100/6 4/5 +f 32/4 128/3 98/9 2/10 +f 30/1 126/2 128/3 32/4 +f 28/5 124/6 126/2 30/1 +f 26/7 122/8 124/6 28/5 +f 24/4 120/3 122/9 26/10 +f 22/1 118/2 120/3 24/4 +f 20/5 116/6 118/2 22/1 +f 18/7 114/8 116/6 20/5 +f 16/4 112/3 114/9 18/10 +f 145/11 130/12 178/13 +f 13/14 15/15 111/16 109/17 +f 11/18 13/14 109/17 107/19 +f 9/20 11/18 107/19 105/21 +f 7/15 9/22 105/23 103/16 +f 5/14 7/15 103/16 101/17 +f 3/18 5/14 101/17 99/19 +f 1/20 3/18 99/19 97/21 +f 31/15 1/22 97/23 127/16 +f 29/14 31/15 127/16 125/17 +f 27/18 29/14 125/17 123/19 +f 25/20 27/18 123/19 121/21 +f 23/15 25/22 121/23 119/16 +f 21/14 23/15 119/16 117/17 +f 19/18 21/14 117/17 115/19 +f 17/20 19/18 115/19 113/21 +f 15/15 17/22 113/23 111/16 +f 162/24 163/25 177/26 +f 163/25 164/27 177/26 +f 164/27 165/28 177/26 +f 165/28 166/29 177/26 +f 166/29 167/30 177/26 +f 167/30 168/31 177/26 +f 168/31 169/32 177/26 +f 169/32 170/33 177/26 +f 170/33 171/34 177/26 +f 171/34 172/35 177/26 +f 172/35 173/36 177/26 +f 173/36 174/37 177/26 +f 174/37 175/38 177/26 +f 175/38 176/39 177/26 +f 176/39 161/40 177/26 +f 161/40 162/24 177/26 +f 130/12 131/41 178/13 +f 131/41 132/42 178/13 +f 132/42 133/43 178/13 +f 133/43 134/44 178/13 +f 134/44 135/45 178/13 +f 135/45 136/46 178/13 +f 136/46 137/47 178/13 +f 137/47 138/48 178/13 +f 138/48 139/49 178/13 +f 139/49 140/50 178/13 +f 140/50 141/51 178/13 +f 141/51 142/52 178/13 +f 142/52 143/53 178/13 +f 143/53 144/54 178/13 +f 144/54 145/11 178/13 +s 1 +f 33/55 2/7 4/5 50/56 +f 50/56 4/5 6/1 51/57 +f 51/57 6/1 8/4 52/58 +f 52/58 8/4 10/10 53/59 +f 53/55 10/7 12/5 54/56 +f 54/56 12/5 14/1 55/57 +f 55/57 14/1 16/4 56/58 +f 56/58 16/4 18/10 57/59 +f 57/55 18/7 20/5 58/56 +f 58/56 20/5 22/1 59/57 +f 59/57 22/1 24/4 60/58 +f 60/58 24/4 26/10 61/59 +f 61/55 26/7 28/5 62/56 +f 62/56 28/5 30/1 63/57 +f 64/58 32/4 2/10 33/59 +f 63/57 30/1 32/4 64/58 +f 66/60 82/61 83/62 67/63 +f 67/63 83/62 84/64 68/65 +f 68/65 84/64 85/66 69/67 +f 69/68 85/69 86/61 70/60 +f 70/60 86/61 87/62 71/63 +f 71/63 87/62 88/64 72/65 +f 72/65 88/64 89/66 73/67 +f 73/68 89/69 90/61 74/60 +f 74/60 90/61 91/62 75/63 +f 75/63 91/62 92/64 76/65 +f 76/65 92/64 93/66 77/67 +f 77/68 93/69 94/61 78/60 +f 78/60 94/61 95/62 79/63 +f 80/65 96/64 65/66 81/67 +f 79/63 95/62 96/64 80/65 +f 65/69 33/55 50/56 82/61 +f 82/61 50/56 51/57 83/62 +f 83/62 51/57 52/58 84/64 +f 84/64 52/58 53/59 85/66 +f 85/69 53/55 54/56 86/61 +f 86/61 54/56 55/57 87/62 +f 87/62 55/57 56/58 88/64 +f 88/64 56/58 57/59 89/66 +f 89/69 57/55 58/56 90/61 +f 90/61 58/56 59/57 91/62 +f 91/62 59/57 60/58 92/64 +f 92/64 60/58 61/59 93/66 +f 93/69 61/55 62/56 94/61 +f 94/61 62/56 63/57 95/62 +f 96/64 64/58 33/59 65/66 +f 95/62 63/57 64/58 96/64 +f 1/21 49/70 34/71 3/19 +f 3/19 34/71 35/72 5/17 +f 5/17 35/72 36/73 7/16 +f 7/16 36/73 37/74 9/23 +f 9/21 37/70 38/71 11/19 +f 11/19 38/71 39/72 13/17 +f 13/17 39/72 40/73 15/16 +f 15/16 40/73 41/74 17/23 +f 17/21 41/70 42/71 19/19 +f 19/19 42/71 43/72 21/17 +f 21/17 43/72 44/73 23/16 +f 23/16 44/73 45/74 25/23 +f 25/21 45/70 46/71 27/19 +f 27/19 46/71 47/72 29/17 +f 31/16 48/73 49/74 1/23 +f 29/17 47/72 48/73 31/16 +f 49/70 81/68 66/60 34/71 +f 34/71 66/60 67/63 35/72 +f 35/72 67/63 68/65 36/73 +f 36/73 68/65 69/67 37/74 +f 37/70 69/68 70/60 38/71 +f 38/71 70/60 71/63 39/72 +f 39/72 71/63 72/65 40/73 +f 40/73 72/65 73/67 41/74 +f 41/70 73/68 74/60 42/71 +f 42/71 74/60 75/63 43/72 +f 43/72 75/63 76/65 44/73 +f 44/73 76/65 77/67 45/74 +f 45/70 77/68 78/60 46/71 +f 46/71 78/60 79/63 47/72 +f 48/73 80/65 81/67 49/74 +f 47/72 79/63 80/65 48/73 +f 65/69 82/61 66/60 81/68 +f 129/75 146/76 100/77 98/78 +f 146/76 147/79 102/80 100/77 +f 147/79 148/81 104/82 102/80 +f 148/81 149/83 106/84 104/82 +f 149/75 150/76 108/77 106/78 +f 150/76 151/79 110/80 108/77 +f 151/79 152/81 112/82 110/80 +f 152/81 153/83 114/84 112/82 +f 153/75 154/76 116/77 114/78 +f 154/76 155/79 118/80 116/77 +f 155/79 156/81 120/82 118/80 +f 156/81 157/83 122/84 120/82 +f 157/75 158/76 124/77 122/78 +f 158/76 159/79 126/80 124/77 +f 160/81 129/83 98/84 128/82 +f 159/79 160/81 128/82 126/80 +f 97/85 99/86 130/87 145/88 +f 99/86 101/89 131/90 130/87 +f 101/89 103/91 132/92 131/90 +f 103/91 105/93 133/94 132/92 +f 105/85 107/86 134/87 133/88 +f 107/86 109/89 135/90 134/87 +f 109/89 111/91 136/92 135/90 +f 111/91 113/93 137/94 136/92 +f 113/85 115/86 138/87 137/88 +f 115/86 117/89 139/90 138/87 +f 117/89 119/91 140/92 139/90 +f 119/91 121/93 141/94 140/92 +f 121/85 123/86 142/87 141/88 +f 123/86 125/89 143/90 142/87 +f 127/91 97/93 145/94 144/92 +f 125/89 127/91 144/92 143/90 diff --git a/mods/cottages/models/cottages_barrel_lying.obj b/mods/cottages/models/cottages_barrel_lying.obj new file mode 100644 index 0000000..dadb7b1 --- /dev/null +++ b/mods/cottages/models/cottages_barrel_lying.obj @@ -0,0 +1,543 @@ +# Blender v2.69 (sub 0) OBJ File: 'barrel.blend' +# www.blender.org +o Cylinder +v 0.500001 0.092835 -0.466712 +v -0.500000 0.092835 -0.466712 +v 0.500001 0.264371 -0.395660 +v -0.500000 0.264371 -0.395660 +v 0.500001 0.395660 -0.264371 +v -0.500000 0.395660 -0.264371 +v 0.500001 0.466712 -0.092835 +v -0.500000 0.466713 -0.092835 +v 0.500001 0.466712 0.092835 +v -0.500000 0.466713 0.092835 +v 0.500001 0.395660 0.264371 +v -0.500000 0.395660 0.264371 +v 0.500001 0.264371 0.395660 +v -0.500000 0.264371 0.395660 +v 0.500001 0.092835 0.466712 +v -0.500000 0.092835 0.466712 +v 0.500001 -0.092835 0.466712 +v -0.500000 -0.092835 0.466712 +v 0.500001 -0.264371 0.395660 +v -0.500000 -0.264371 0.395660 +v 0.500001 -0.395660 0.264372 +v -0.500000 -0.395660 0.264371 +v 0.500001 -0.466713 0.092835 +v -0.500000 -0.466712 0.092835 +v 0.500001 -0.466713 -0.092835 +v -0.500000 -0.466712 -0.092835 +v 0.500001 -0.395660 -0.264371 +v -0.500000 -0.395660 -0.264372 +v 0.500001 -0.264371 -0.395660 +v -0.500000 -0.264371 -0.395660 +v 0.500001 -0.092835 -0.466712 +v -0.500000 -0.092835 -0.466713 +v -0.413334 0.095930 -0.482270 +v 0.413335 0.273184 -0.408849 +v 0.413335 0.408849 -0.273184 +v 0.413335 0.482270 -0.095929 +v 0.413335 0.482270 0.095930 +v 0.413334 0.408849 0.273184 +v 0.413334 0.273184 0.408849 +v 0.413334 0.095929 0.482270 +v 0.413334 -0.095930 0.482270 +v 0.413334 -0.273184 0.408849 +v 0.413334 -0.408849 0.273184 +v 0.413334 -0.482270 0.095930 +v 0.413334 -0.482270 -0.095929 +v 0.413334 -0.408849 -0.273184 +v 0.413334 -0.273184 -0.408849 +v 0.413335 -0.095929 -0.482270 +v 0.413335 0.095929 -0.482270 +v -0.413334 0.273184 -0.408849 +v -0.413334 0.408849 -0.273184 +v -0.413334 0.482270 -0.095929 +v -0.413334 0.482270 0.095929 +v -0.413334 0.408849 0.273184 +v -0.413334 0.273184 0.408849 +v -0.413334 0.095930 0.482270 +v -0.413334 -0.095929 0.482270 +v -0.413334 -0.273184 0.408849 +v -0.413334 -0.408849 0.273184 +v -0.413334 -0.482270 0.095929 +v -0.413334 -0.482270 -0.095930 +v -0.413334 -0.408849 -0.273184 +v -0.413334 -0.273184 -0.408849 +v -0.413334 -0.095929 -0.482270 +v -0.114830 0.099128 -0.498352 +v 0.114831 0.282294 -0.422482 +v 0.114831 0.422482 -0.282293 +v 0.114831 0.498352 -0.099128 +v 0.114831 0.498352 0.099128 +v 0.114831 0.422482 0.282294 +v 0.114831 0.282294 0.422482 +v 0.114831 0.099128 0.498352 +v 0.114831 -0.099128 0.498352 +v 0.114831 -0.282294 0.422482 +v 0.114831 -0.422482 0.282294 +v 0.114831 -0.498352 0.099128 +v 0.114831 -0.498352 -0.099128 +v 0.114831 -0.422482 -0.282294 +v 0.114831 -0.282293 -0.422482 +v 0.114831 -0.099128 -0.498352 +v 0.114831 0.099128 -0.498352 +v -0.114830 0.282294 -0.422482 +v -0.114830 0.422482 -0.282294 +v -0.114830 0.498352 -0.099128 +v -0.114830 0.498352 0.099128 +v -0.114830 0.422482 0.282294 +v -0.114830 0.282294 0.422482 +v -0.114830 0.099128 0.498352 +v -0.114830 -0.099128 0.498352 +v -0.114830 -0.282293 0.422482 +v -0.114830 -0.422482 0.282294 +v -0.114830 -0.498352 0.099128 +v -0.114830 -0.498352 -0.099128 +v -0.114830 -0.422482 -0.282294 +v -0.114830 -0.282293 -0.422482 +v -0.114830 -0.099128 -0.498352 +v 0.500001 0.083551 -0.420041 +v -0.500000 0.083552 -0.420041 +v 0.500001 0.237934 -0.356094 +v -0.500000 0.237934 -0.356094 +v 0.500001 0.356094 -0.237934 +v -0.500000 0.356094 -0.237934 +v 0.500001 0.420041 -0.083551 +v -0.500000 0.420041 -0.083551 +v 0.500001 0.420041 0.083552 +v -0.500000 0.420041 0.083551 +v 0.500001 0.356094 0.237934 +v -0.500000 0.356094 0.237934 +v 0.500001 0.237934 0.356094 +v -0.500000 0.237934 0.356094 +v 0.500001 0.083551 0.420041 +v -0.500000 0.083551 0.420041 +v 0.500001 -0.083551 0.420041 +v -0.500000 -0.083551 0.420041 +v 0.500001 -0.237934 0.356094 +v -0.500000 -0.237934 0.356094 +v 0.500001 -0.356094 0.237934 +v -0.500000 -0.356094 0.237934 +v 0.500001 -0.420041 0.083551 +v -0.500000 -0.420041 0.083551 +v 0.500001 -0.420041 -0.083551 +v -0.500000 -0.420041 -0.083552 +v 0.500001 -0.356094 -0.237934 +v -0.500000 -0.356094 -0.237934 +v 0.500001 -0.237934 -0.356094 +v -0.500000 -0.237934 -0.356094 +v 0.500001 -0.083551 -0.420041 +v -0.500000 -0.083551 -0.420041 +v -0.413334 0.086337 -0.434043 +v 0.413335 0.245866 -0.367964 +v 0.413335 0.367964 -0.245865 +v 0.413335 0.434043 -0.086336 +v 0.413335 0.434043 0.086337 +v 0.413335 0.367964 0.245866 +v 0.413335 0.245866 0.367964 +v 0.413334 0.086336 0.434043 +v 0.413334 -0.086337 0.434043 +v 0.413334 -0.245866 0.367964 +v 0.413334 -0.367964 0.245866 +v 0.413334 -0.434043 0.086337 +v 0.413334 -0.434043 -0.086337 +v 0.413334 -0.367964 -0.245866 +v 0.413335 -0.245865 -0.367964 +v 0.413335 -0.086336 -0.434043 +v 0.413335 0.086336 -0.434043 +v -0.413334 0.245866 -0.367964 +v -0.413334 0.367964 -0.245866 +v -0.413334 0.434043 -0.086337 +v -0.413334 0.434043 0.086337 +v -0.413334 0.367964 0.245866 +v -0.413334 0.245866 0.367964 +v -0.413334 0.086337 0.434043 +v -0.413334 -0.086336 0.434043 +v -0.413334 -0.245865 0.367964 +v -0.413334 -0.367964 0.245866 +v -0.413334 -0.434043 0.086337 +v -0.413334 -0.434043 -0.086337 +v -0.413334 -0.367964 -0.245866 +v -0.413334 -0.245865 -0.367964 +v -0.413334 -0.086336 -0.434043 +v -0.114830 0.089216 -0.448517 +v 0.114831 0.254064 -0.380234 +v 0.114831 0.380234 -0.254064 +v 0.114831 0.448517 -0.089215 +v 0.114831 0.448517 0.089216 +v 0.114831 0.380234 0.254064 +v 0.114831 0.254064 0.380234 +v 0.114831 0.089215 0.448517 +v 0.114831 -0.089215 0.448517 +v 0.114831 -0.254064 0.380234 +v 0.114831 -0.380234 0.254064 +v 0.114831 -0.448517 0.089216 +v 0.114831 -0.448517 -0.089216 +v 0.114831 -0.380234 -0.254064 +v 0.114831 -0.254064 -0.380234 +v 0.114831 -0.089215 -0.448517 +v 0.114831 0.089216 -0.448517 +v -0.114830 0.254064 -0.380234 +v -0.114830 0.380234 -0.254064 +v -0.114830 0.448517 -0.089215 +v -0.114830 0.448517 0.089216 +v -0.114830 0.380234 0.254064 +v -0.114830 0.254064 0.380234 +v -0.114830 0.089216 0.448517 +v -0.114830 -0.089215 0.448517 +v -0.114830 -0.254064 0.380234 +v -0.114830 -0.380234 0.254064 +v -0.114830 -0.448517 0.089216 +v -0.114830 -0.448517 -0.089216 +v -0.114830 -0.380234 -0.254064 +v -0.114830 -0.254064 -0.380234 +v -0.114830 -0.089215 -0.448517 +v 0.352645 0.087776 -0.441280 +v 0.352645 -0.087776 -0.441280 +v 0.352645 -0.249965 -0.374099 +v 0.352645 -0.374099 -0.249965 +v 0.352645 -0.441280 -0.087776 +v 0.352645 -0.441280 0.087776 +v 0.352645 -0.374099 0.249965 +v 0.352645 -0.249965 0.374099 +v 0.352645 -0.087776 0.441280 +v 0.352645 0.087776 0.441280 +v 0.352645 0.249965 0.374099 +v 0.352645 0.374099 0.249965 +v 0.352645 0.441280 0.087776 +v 0.352645 0.441280 -0.087776 +v 0.352645 0.374099 -0.249965 +v 0.352645 0.249965 -0.374099 +v 0.352645 -0.000000 0.000000 +v 0.413334 -0.000000 0.000000 +vt 0.211538 0.442308 +vt 0.211538 0.467949 +vt 0.108974 0.467949 +vt 0.108974 0.442308 +vt 0.314103 0.442308 +vt 0.314103 0.467949 +vt 0.416667 0.442308 +vt 0.416667 0.467949 +vt 0.006410 0.467949 +vt 0.006410 0.442308 +vt 0.211792 0.993590 +vt 0.117562 0.954728 +vt 0.262789 0.738327 +vt 0.211538 0.006410 +vt 0.108974 0.006410 +vt 0.108974 0.032051 +vt 0.211538 0.032051 +vt 0.314103 0.006410 +vt 0.314103 0.032051 +vt 0.416667 0.006410 +vt 0.416667 0.032051 +vt 0.006410 0.006410 +vt 0.006410 0.032051 +vt 0.211361 0.993526 +vt 0.117394 0.954505 +vt 0.262040 0.737637 +vt 0.045447 0.882467 +vt 0.006475 0.788381 +vt 0.006410 0.686569 +vt 0.045263 0.592532 +vt 0.117118 0.520586 +vt 0.204627 0.488094 +vt 0.312719 0.481748 +vt 0.406687 0.520769 +vt 0.478633 0.592807 +vt 0.517605 0.686893 +vt 0.517670 0.788705 +vt 0.478816 0.882742 +vt 0.406962 0.954687 +vt 0.313044 0.993590 +vt 0.045441 0.882922 +vt 0.006410 0.789102 +vt 0.006410 0.687551 +vt 0.045442 0.593732 +vt 0.117562 0.521925 +vt 0.211793 0.483064 +vt 0.313787 0.483064 +vt 0.408016 0.521926 +vt 0.480136 0.593732 +vt 0.519168 0.687551 +vt 0.519168 0.789103 +vt 0.480136 0.882922 +vt 0.408016 0.954728 +vt 0.313786 0.993590 +vt 0.416667 0.397436 +vt 0.314103 0.397436 +vt 0.211538 0.397436 +vt 0.108974 0.397436 +vt 0.006410 0.397436 +vt 0.314103 0.185897 +vt 0.314103 0.282051 +vt 0.211538 0.282051 +vt 0.211538 0.185897 +vt 0.108974 0.282051 +vt 0.108974 0.185897 +vt 0.006410 0.282051 +vt 0.006410 0.185897 +vt 0.416667 0.185897 +vt 0.416667 0.282051 +vt 0.416667 0.076923 +vt 0.314103 0.076923 +vt 0.211538 0.076923 +vt 0.108974 0.076923 +vt 0.006410 0.076923 +vt 0.429487 0.397436 +vt 0.532051 0.397436 +vt 0.532051 0.442308 +vt 0.429487 0.442308 +vt 0.634615 0.397436 +vt 0.634615 0.442308 +vt 0.737179 0.397436 +vt 0.737179 0.442308 +vt 0.839744 0.397436 +vt 0.839744 0.442308 +vt 0.532051 0.185897 +vt 0.634615 0.185897 +vt 0.634615 0.282051 +vt 0.532051 0.282051 +vt 0.737179 0.185897 +vt 0.737179 0.282051 +vt 0.839744 0.185897 +vt 0.839744 0.282051 +vt 0.429487 0.185897 +vt 0.429487 0.282051 +vt 0.429487 0.032051 +vt 0.532051 0.032051 +vt 0.532051 0.076923 +vt 0.429487 0.076923 +vt 0.634615 0.032051 +vt 0.634615 0.076923 +vt 0.737179 0.032051 +vt 0.737179 0.076923 +vt 0.839744 0.032051 +vt 0.839744 0.076923 +s off +f 14/1 110/2 112/3 16/4 +f 12/5 108/6 110/2 14/1 +f 10/7 106/8 108/6 12/5 +f 8/4 104/3 106/9 10/10 +f 6/1 102/2 104/3 8/4 +f 4/5 100/6 102/2 6/1 +f 2/7 98/8 100/6 4/5 +f 32/4 128/3 98/9 2/10 +f 30/1 126/2 128/3 32/4 +f 28/5 124/6 126/2 30/1 +f 26/7 122/8 124/6 28/5 +f 24/4 120/3 122/9 26/10 +f 22/1 118/2 120/3 24/4 +f 20/5 116/6 118/2 22/1 +f 18/7 114/8 116/6 20/5 +f 16/4 112/3 114/9 18/10 +f 145/11 130/12 210/13 +f 13/14 15/15 111/16 109/17 +f 11/18 13/14 109/17 107/19 +f 9/20 11/18 107/19 105/21 +f 7/15 9/22 105/23 103/16 +f 5/14 7/15 103/16 101/17 +f 3/18 5/14 101/17 99/19 +f 1/20 3/18 99/19 97/21 +f 31/15 1/22 97/23 127/16 +f 29/14 31/15 127/16 125/17 +f 27/18 29/14 125/17 123/19 +f 25/20 27/18 123/19 121/21 +f 23/15 25/22 121/23 119/16 +f 21/14 23/15 119/16 117/17 +f 19/18 21/14 117/17 115/19 +f 17/20 19/18 115/19 113/21 +f 15/15 17/22 113/23 111/16 +f 194/24 195/25 209/26 +f 195/25 196/27 209/26 +f 196/27 197/28 209/26 +f 197/28 198/29 209/26 +f 198/29 199/30 209/26 +f 199/30 200/31 209/26 +f 200/31 201/32 209/26 +f 201/32 202/33 209/26 +f 202/33 203/34 209/26 +f 203/34 204/35 209/26 +f 204/35 205/36 209/26 +f 205/36 206/37 209/26 +f 206/37 207/38 209/26 +f 207/38 208/39 209/26 +f 208/39 193/40 209/26 +f 193/40 194/24 209/26 +f 130/12 131/41 210/13 +f 131/41 132/42 210/13 +f 132/42 133/43 210/13 +f 133/43 134/44 210/13 +f 134/44 135/45 210/13 +f 135/45 136/46 210/13 +f 136/46 137/47 210/13 +f 137/47 138/48 210/13 +f 138/48 139/49 210/13 +f 139/49 140/50 210/13 +f 140/50 141/51 210/13 +f 141/51 142/52 210/13 +f 142/52 143/53 210/13 +f 143/53 144/54 210/13 +f 144/54 145/11 210/13 +s 1 +f 33/55 2/7 4/5 50/56 +f 50/56 4/5 6/1 51/57 +f 51/57 6/1 8/4 52/58 +f 52/58 8/4 10/10 53/59 +f 53/55 10/7 12/5 54/56 +f 54/56 12/5 14/1 55/57 +f 55/57 14/1 16/4 56/58 +f 56/58 16/4 18/10 57/59 +f 57/55 18/7 20/5 58/56 +f 58/56 20/5 22/1 59/57 +f 59/57 22/1 24/4 60/58 +f 60/58 24/4 26/10 61/59 +f 61/55 26/7 28/5 62/56 +f 62/56 28/5 30/1 63/57 +f 64/58 32/4 2/10 33/59 +f 63/57 30/1 32/4 64/58 +f 66/60 82/61 83/62 67/63 +f 67/63 83/62 84/64 68/65 +f 68/65 84/64 85/66 69/67 +f 69/68 85/69 86/61 70/60 +f 70/60 86/61 87/62 71/63 +f 71/63 87/62 88/64 72/65 +f 72/65 88/64 89/66 73/67 +f 73/68 89/69 90/61 74/60 +f 74/60 90/61 91/62 75/63 +f 75/63 91/62 92/64 76/65 +f 76/65 92/64 93/66 77/67 +f 77/68 93/69 94/61 78/60 +f 78/60 94/61 95/62 79/63 +f 80/65 96/64 65/66 81/67 +f 79/63 95/62 96/64 80/65 +f 65/69 33/55 50/56 82/61 +f 82/61 50/56 51/57 83/62 +f 83/62 51/57 52/58 84/64 +f 84/64 52/58 53/59 85/66 +f 85/69 53/55 54/56 86/61 +f 86/61 54/56 55/57 87/62 +f 87/62 55/57 56/58 88/64 +f 88/64 56/58 57/59 89/66 +f 89/69 57/55 58/56 90/61 +f 90/61 58/56 59/57 91/62 +f 91/62 59/57 60/58 92/64 +f 92/64 60/58 61/59 93/66 +f 93/69 61/55 62/56 94/61 +f 94/61 62/56 63/57 95/62 +f 96/64 64/58 33/59 65/66 +f 95/62 63/57 64/58 96/64 +f 1/21 49/70 34/71 3/19 +f 3/19 34/71 35/72 5/17 +f 5/17 35/72 36/73 7/16 +f 7/16 36/73 37/74 9/23 +f 9/21 37/70 38/71 11/19 +f 11/19 38/71 39/72 13/17 +f 13/17 39/72 40/73 15/16 +f 15/16 40/73 41/74 17/23 +f 17/21 41/70 42/71 19/19 +f 19/19 42/71 43/72 21/17 +f 21/17 43/72 44/73 23/16 +f 23/16 44/73 45/74 25/23 +f 25/21 45/70 46/71 27/19 +f 27/19 46/71 47/72 29/17 +f 31/16 48/73 49/74 1/23 +f 29/17 47/72 48/73 31/16 +f 49/70 81/68 66/60 34/71 +f 34/71 66/60 67/63 35/72 +f 35/72 67/63 68/65 36/73 +f 36/73 68/65 69/67 37/74 +f 37/70 69/68 70/60 38/71 +f 38/71 70/60 71/63 39/72 +f 39/72 71/63 72/65 40/73 +f 40/73 72/65 73/67 41/74 +f 41/70 73/68 74/60 42/71 +f 42/71 74/60 75/63 43/72 +f 43/72 75/63 76/65 44/73 +f 44/73 76/65 77/67 45/74 +f 45/70 77/68 78/60 46/71 +f 46/71 78/60 79/63 47/72 +f 48/73 80/65 81/67 49/74 +f 47/72 79/63 80/65 48/73 +f 65/69 82/61 66/60 81/68 +f 129/75 146/76 100/77 98/78 +f 146/76 147/79 102/80 100/77 +f 147/79 148/81 104/82 102/80 +f 148/81 149/83 106/84 104/82 +f 149/75 150/76 108/77 106/78 +f 150/76 151/79 110/80 108/77 +f 151/79 152/81 112/82 110/80 +f 152/81 153/83 114/84 112/82 +f 153/75 154/76 116/77 114/78 +f 154/76 155/79 118/80 116/77 +f 155/79 156/81 120/82 118/80 +f 156/81 157/83 122/84 120/82 +f 157/75 158/76 124/77 122/78 +f 158/76 159/79 126/80 124/77 +f 160/81 129/83 98/84 128/82 +f 159/79 160/81 128/82 126/80 +f 162/85 163/86 179/87 178/88 +f 163/86 164/89 180/90 179/87 +f 164/89 165/91 181/92 180/90 +f 165/93 166/85 182/88 181/94 +f 166/85 167/86 183/87 182/88 +f 167/86 168/89 184/90 183/87 +f 168/89 169/91 185/92 184/90 +f 169/93 170/85 186/88 185/94 +f 170/85 171/86 187/87 186/88 +f 171/86 172/89 188/90 187/87 +f 172/89 173/91 189/92 188/90 +f 173/93 174/85 190/88 189/94 +f 174/85 175/86 191/87 190/88 +f 176/89 177/91 161/92 192/90 +f 175/86 176/89 192/90 191/87 +f 161/94 178/88 146/76 129/75 +f 178/88 179/87 147/79 146/76 +f 179/87 180/90 148/81 147/79 +f 180/90 181/92 149/83 148/81 +f 181/94 182/88 150/76 149/75 +f 182/88 183/87 151/79 150/76 +f 183/87 184/90 152/81 151/79 +f 184/90 185/92 153/83 152/81 +f 185/94 186/88 154/76 153/75 +f 186/88 187/87 155/79 154/76 +f 187/87 188/90 156/81 155/79 +f 188/90 189/92 157/83 156/81 +f 189/94 190/88 158/76 157/75 +f 190/88 191/87 159/79 158/76 +f 192/90 161/92 129/83 160/81 +f 191/87 192/90 160/81 159/79 +f 97/95 99/96 130/97 145/98 +f 99/96 101/99 131/100 130/97 +f 101/99 103/101 132/102 131/100 +f 103/101 105/103 133/104 132/102 +f 105/95 107/96 134/97 133/98 +f 107/96 109/99 135/100 134/97 +f 109/99 111/101 136/102 135/100 +f 111/101 113/103 137/104 136/102 +f 113/95 115/96 138/97 137/98 +f 115/96 117/99 139/100 138/97 +f 117/99 119/101 140/102 139/100 +f 119/101 121/103 141/104 140/102 +f 121/95 123/96 142/97 141/98 +f 123/96 125/99 143/100 142/97 +f 127/101 97/103 145/104 144/102 +f 125/99 127/101 144/102 143/100 +f 193/98 208/97 162/85 177/93 +f 208/97 207/100 163/86 162/85 +f 207/100 206/102 164/89 163/86 +f 206/102 205/104 165/91 164/89 +f 205/98 204/97 166/85 165/93 +f 204/97 203/100 167/86 166/85 +f 203/100 202/102 168/89 167/86 +f 202/102 201/104 169/91 168/89 +f 201/98 200/97 170/85 169/93 +f 200/97 199/100 171/86 170/85 +f 199/100 198/102 172/89 171/86 +f 198/102 197/104 173/91 172/89 +f 197/98 196/97 174/85 173/93 +f 196/97 195/100 175/86 174/85 +f 194/102 193/104 177/91 176/89 +f 195/100 194/102 176/89 175/86 +f 161/94 177/93 162/85 178/88 diff --git a/mods/cottages/models/cottages_handmill.obj b/mods/cottages/models/cottages_handmill.obj new file mode 100644 index 0000000..d7ba999 --- /dev/null +++ b/mods/cottages/models/cottages_handmill.obj @@ -0,0 +1,376 @@ +# Blender v2.69 (sub 0) OBJ File: 'handmill.blend' +# www.blender.org +o Cylinder.002 +v -0.047835 -0.281250 0.115485 +v -0.047835 -0.250000 0.115485 +v -0.115485 -0.281250 0.047835 +v -0.115485 -0.250000 0.047835 +v -0.115485 -0.281250 -0.047835 +v -0.115485 -0.250000 -0.047835 +v -0.047835 -0.281250 -0.115485 +v -0.047835 -0.250000 -0.115485 +v 0.047835 -0.281250 -0.115485 +v 0.047835 -0.250000 -0.115485 +v 0.115485 -0.281250 -0.047835 +v 0.115485 -0.250000 -0.047835 +v 0.115485 -0.281250 0.047835 +v 0.115485 -0.250000 0.047835 +v 0.047835 -0.281250 0.115485 +v 0.047835 -0.250000 0.115485 +v -0.047835 -0.062500 0.115485 +v -0.047835 0.000000 0.115485 +v -0.115485 -0.062500 0.047835 +v -0.115485 0.000000 0.047835 +v -0.115485 -0.062500 -0.047835 +v -0.115485 0.000000 -0.047835 +v -0.047835 -0.062500 -0.115485 +v -0.047835 0.000000 -0.115485 +v 0.047835 -0.062500 -0.115485 +v 0.047835 0.000000 -0.115485 +v 0.115485 -0.062500 -0.047835 +v 0.115485 0.000000 -0.047835 +v 0.115485 -0.062500 0.047835 +v 0.115485 0.000000 0.047835 +v 0.047835 -0.062500 0.115485 +v 0.047835 0.000000 0.115485 +v 0.272957 -0.062500 -0.239132 +v 0.272957 0.187500 -0.239132 +v 0.239133 -0.062500 -0.272957 +v 0.239133 0.187500 -0.272957 +v 0.239133 -0.062500 -0.320793 +v 0.239133 0.187500 -0.320793 +v 0.272957 -0.062500 -0.354617 +v 0.272957 0.187500 -0.354617 +v 0.320793 -0.062500 -0.354617 +v 0.320793 0.187500 -0.354617 +v 0.354618 -0.062500 -0.320793 +v 0.354618 0.187500 -0.320793 +v 0.354618 -0.062500 -0.272957 +v 0.354618 0.187500 -0.272957 +v 0.320793 -0.062500 -0.239132 +v 0.320793 0.187500 -0.239132 +v 0.272957 0.187500 -0.239132 +v 0.239133 0.187500 -0.272957 +v 0.239133 0.187500 -0.320793 +v 0.272957 0.187500 -0.354617 +v 0.320793 0.187500 -0.354617 +v 0.354618 0.187500 -0.320793 +v 0.354618 0.187500 -0.272957 +v 0.320793 0.187500 -0.239132 +v -0.097545 -0.062500 0.490393 +v -0.097545 -0.250000 0.490393 +v -0.097545 -0.500000 0.490393 +v -0.097545 -0.281250 0.490393 +v -0.277785 -0.500000 0.415735 +v -0.277785 -0.281250 0.415735 +v -0.415735 -0.500000 0.277785 +v -0.415735 -0.281250 0.277785 +v -0.490393 -0.500000 0.097545 +v -0.490393 -0.281250 0.097545 +v -0.490393 -0.500000 -0.097545 +v -0.490393 -0.281250 -0.097545 +v -0.415735 -0.500000 -0.277785 +v -0.415735 -0.281250 -0.277785 +v -0.277785 -0.500000 -0.415735 +v -0.277785 -0.281250 -0.415735 +v -0.097545 -0.500000 -0.490393 +v -0.097545 -0.281250 -0.490393 +v 0.097545 -0.500000 -0.490393 +v 0.097545 -0.281250 -0.490393 +v 0.277785 -0.500000 -0.415735 +v 0.277785 -0.281250 -0.415735 +v 0.415735 -0.500000 -0.277785 +v 0.415735 -0.281250 -0.277785 +v 0.490393 -0.500000 -0.097545 +v 0.490393 -0.281250 -0.097545 +v 0.490393 -0.500000 0.097545 +v 0.490393 -0.281250 0.097545 +v 0.415735 -0.500000 0.277785 +v 0.415735 -0.281250 0.277785 +v 0.277785 -0.500000 0.415735 +v 0.277785 -0.281250 0.415735 +v 0.097545 -0.500000 0.490393 +v 0.097545 -0.281250 0.490393 +v -0.277785 -0.250000 0.415735 +v -0.277785 -0.062500 0.415735 +v -0.415735 -0.250000 0.277785 +v -0.415735 -0.062500 0.277785 +v -0.490393 -0.250000 0.097545 +v -0.490393 -0.062500 0.097545 +v -0.490393 -0.250000 -0.097545 +v -0.490393 -0.062500 -0.097545 +v -0.415735 -0.250000 -0.277785 +v -0.415735 -0.062500 -0.277785 +v -0.277785 -0.250000 -0.415735 +v -0.277785 -0.062500 -0.415735 +v -0.097545 -0.250000 -0.490393 +v -0.097545 -0.062500 -0.490393 +v 0.097545 -0.250000 -0.490393 +v 0.097545 -0.062500 -0.490393 +v 0.277785 -0.250000 -0.415735 +v 0.277785 -0.062500 -0.415735 +v 0.415735 -0.250000 -0.277785 +v 0.415735 -0.062500 -0.277785 +v 0.490393 -0.250000 -0.097545 +v 0.490393 -0.062500 -0.097545 +v 0.490393 -0.250000 0.097545 +v 0.490393 -0.062500 0.097545 +v 0.415735 -0.250000 0.277785 +v 0.415735 -0.062500 0.277785 +v 0.277785 -0.250000 0.415735 +v 0.277785 -0.062500 0.415735 +v 0.097545 -0.250000 0.490393 +v 0.097545 -0.062500 0.490393 +v 0.296875 0.187500 -0.296875 +v -0.000000 -0.250000 0.000000 +v 0.000000 -0.281250 0.000000 +v 0.000000 -0.062500 0.000000 +v -0.000000 -0.500000 0.000000 +v -0.047835 0.000000 0.115485 +v -0.115485 0.000000 0.047835 +v -0.115485 0.000000 -0.047835 +v -0.047835 0.000000 -0.115485 +v 0.047835 0.000000 -0.115485 +v 0.115485 0.000000 -0.047835 +v 0.115485 0.000000 0.047835 +v 0.047835 0.000000 0.115485 +v 0.000000 0.000000 -0.000000 +vt 0.500000 0.812500 +vt 0.500000 0.875000 +vt 0.375000 0.875000 +vt 0.375000 0.812500 +vt 0.250000 0.875000 +vt 0.250000 0.812500 +vt 0.125000 0.875000 +vt 0.125000 0.812500 +vt 0.000000 0.875000 +vt 0.000000 0.812500 +vt 1.000000 0.812500 +vt 1.000000 0.875000 +vt 0.875000 0.875000 +vt 0.875000 0.812500 +vt 0.750000 0.875000 +vt 0.750000 0.812500 +vt 0.625000 0.812500 +vt 0.625000 0.875000 +vt 0.500000 0.937500 +vt 0.500000 1.000000 +vt 0.375000 1.000000 +vt 0.375000 0.937500 +vt 0.250000 1.000000 +vt 0.250000 0.937500 +vt 0.125000 1.000000 +vt 0.125000 0.937500 +vt 0.000000 1.000000 +vt 0.000000 0.937500 +vt 1.000000 0.937500 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.875000 0.937500 +vt 0.750000 1.000000 +vt 0.750000 0.937500 +vt 0.625000 0.937500 +vt 0.625000 1.000000 +vt 0.125000 0.963388 +vt 0.088388 1.000000 +vt 0.062500 0.937500 +vt 0.250000 0.437500 +vt 0.250000 0.750000 +vt 0.187500 0.750000 +vt 0.187500 0.437500 +vt 0.125000 0.750000 +vt 0.125000 0.437500 +vt 0.062500 0.750000 +vt 0.062500 0.437500 +vt 0.000000 0.750000 +vt 0.000000 0.437500 +vt 0.500000 0.437500 +vt 0.500000 0.750000 +vt 0.437500 0.750000 +vt 0.437500 0.437500 +vt 0.375000 0.750000 +vt 0.375000 0.437500 +vt 0.312500 0.437500 +vt 0.312500 0.750000 +vt 0.599456 1.000000 +vt 0.783227 0.923879 +vt 0.500000 0.500000 +vt 0.750000 0.250000 +vt 0.750000 0.437500 +vt 0.500000 0.250000 +vt 0.000000 0.250000 +vt 0.000000 0.000000 +vt 0.250000 0.000000 +vt 0.250000 0.250000 +vt 1.000000 0.250000 +vt 1.000000 0.437500 +vt 0.500000 0.000000 +vt 0.750000 0.000000 +vt 1.000000 0.000000 +vt 0.036612 1.000000 +vt 0.000000 0.963388 +vt 0.000000 0.911612 +vt 0.036612 0.875000 +vt 0.088388 0.875000 +vt 0.125000 0.911612 +vt 0.923880 0.783227 +vt 1.000000 0.599456 +vt 1.000000 0.400544 +vt 0.923880 0.216773 +vt 0.783227 0.076120 +vt 0.599456 -0.000000 +vt 0.400544 -0.000000 +vt 0.216773 0.076120 +vt 0.076121 0.216773 +vt 0.000000 0.400544 +vt 0.000000 0.599456 +vt 0.076121 0.783227 +vt 0.216773 0.923880 +vt 0.400544 1.000000 +vt 0.076120 0.783227 +vt 0.076120 0.216773 +vt 0.551777 0.375000 +vt 0.625000 0.448223 +vt 0.625000 0.551777 +vt 0.551777 0.625000 +vt 0.448223 0.625000 +vt 0.375000 0.551777 +vt 0.375000 0.448223 +vt 0.448223 0.375000 +s off +f 1/1 2/2 4/3 3/4 +f 3/4 4/3 6/5 5/6 +f 5/6 6/5 8/7 7/8 +f 7/8 8/7 10/9 9/10 +f 9/11 10/12 12/13 11/14 +f 11/14 12/13 14/15 13/16 +f 15/17 16/18 2/2 1/1 +f 13/16 14/15 16/18 15/17 +f 17/19 18/20 20/21 19/22 +f 19/22 20/21 22/23 21/24 +f 21/24 22/23 24/25 23/26 +f 23/26 24/25 26/27 25/28 +f 25/29 26/30 28/31 27/32 +f 27/32 28/31 30/33 29/34 +f 31/35 32/36 18/20 17/19 +f 29/34 30/33 32/36 31/35 +f 50/37 49/38 121/39 +f 33/40 34/41 36/42 35/43 +f 35/43 36/42 38/44 37/45 +f 37/45 38/44 40/46 39/47 +f 39/47 40/46 42/48 41/49 +f 41/50 42/51 44/52 43/53 +f 43/53 44/52 46/54 45/55 +f 47/56 48/57 34/41 33/40 +f 45/55 46/54 48/57 47/56 +f 58/58 91/59 122/60 +f 115/61 116/62 118/50 117/63 +f 59/64 60/65 62/66 61/67 +f 113/68 114/69 116/62 115/61 +f 61/67 62/66 64/70 63/63 +f 111/67 112/40 114/49 113/64 +f 63/63 64/70 66/71 65/61 +f 109/63 110/50 112/40 111/67 +f 65/61 66/71 68/72 67/68 +f 107/61 108/62 110/50 109/63 +f 67/64 68/65 70/66 69/67 +f 105/68 106/69 108/62 107/61 +f 69/67 70/66 72/70 71/63 +f 103/67 104/40 106/49 105/64 +f 71/63 72/70 74/71 73/61 +f 101/63 102/50 104/40 103/67 +f 73/61 74/71 76/72 75/68 +f 99/61 100/62 102/50 101/63 +f 75/64 76/65 78/66 77/67 +f 97/68 98/69 100/62 99/61 +f 77/67 78/66 80/70 79/63 +f 95/67 96/40 98/49 97/64 +f 79/63 80/70 82/71 81/61 +f 62/59 60/58 123/60 +f 93/63 94/50 96/40 95/67 +f 81/61 82/71 84/72 83/68 +f 117/63 118/50 120/40 119/67 +f 91/61 92/62 94/50 93/63 +f 83/64 84/65 86/66 85/67 +f 119/67 120/40 57/49 58/64 +f 58/68 57/69 92/62 91/61 +f 85/67 86/66 88/70 87/63 +f 92/59 57/58 124/60 +f 89/61 90/71 60/72 59/68 +f 87/63 88/70 90/71 89/61 +f 59/58 61/59 125/60 +f 49/38 56/73 121/39 +f 56/73 55/74 121/39 +f 55/74 54/75 121/39 +f 54/75 53/76 121/39 +f 53/76 52/77 121/39 +f 52/77 51/78 121/39 +f 51/78 50/37 121/39 +f 91/59 93/79 122/60 +f 93/79 95/80 122/60 +f 95/80 97/81 122/60 +f 97/81 99/82 122/60 +f 99/82 101/83 122/60 +f 101/83 103/84 122/60 +f 103/84 105/85 122/60 +f 105/85 107/86 122/60 +f 107/86 109/87 122/60 +f 109/87 111/88 122/60 +f 111/88 113/89 122/60 +f 113/89 115/90 122/60 +f 115/90 117/91 122/60 +f 117/91 119/92 122/60 +f 119/92 58/58 122/60 +f 60/58 90/92 123/60 +f 90/92 88/91 123/60 +f 88/91 86/90 123/60 +f 86/90 84/89 123/60 +f 84/89 82/88 123/60 +f 82/88 80/87 123/60 +f 80/87 78/86 123/60 +f 78/86 76/85 123/60 +f 76/85 74/84 123/60 +f 74/84 72/83 123/60 +f 72/83 70/82 123/60 +f 70/82 68/81 123/60 +f 68/81 66/80 123/60 +f 66/80 64/79 123/60 +f 64/79 62/59 123/60 +f 57/58 120/92 124/60 +f 120/92 118/91 124/60 +f 118/91 116/93 124/60 +f 116/93 114/89 124/60 +f 114/89 112/88 124/60 +f 112/88 110/94 124/60 +f 110/94 108/86 124/60 +f 108/86 106/85 124/60 +f 106/85 104/84 124/60 +f 104/84 102/83 124/60 +f 102/83 100/82 124/60 +f 100/82 98/81 124/60 +f 98/81 96/80 124/60 +f 96/80 94/79 124/60 +f 94/79 92/59 124/60 +f 61/59 63/79 125/60 +f 63/79 65/80 125/60 +f 65/80 67/81 125/60 +f 67/81 69/82 125/60 +f 69/82 71/83 125/60 +f 71/83 73/84 125/60 +f 73/84 75/85 125/60 +f 75/85 77/86 125/60 +f 77/86 79/94 125/60 +f 79/94 81/88 125/60 +f 81/88 83/89 125/60 +f 83/89 85/93 125/60 +f 85/93 87/91 125/60 +f 87/91 89/92 125/60 +f 89/92 59/58 125/60 +f 127/95 126/96 134/60 +f 126/96 133/97 134/60 +f 133/97 132/98 134/60 +f 132/98 131/99 134/60 +f 131/99 130/100 134/60 +f 130/100 129/101 134/60 +f 129/101 128/102 134/60 +f 134/60 128/102 127/95 diff --git a/mods/cottages/models/cottages_tub.obj b/mods/cottages/models/cottages_tub.obj new file mode 100644 index 0000000..6e3b04b --- /dev/null +++ b/mods/cottages/models/cottages_tub.obj @@ -0,0 +1,326 @@ +# Blender v2.69 (sub 0) OBJ File: 'cottages-tub.blend' +# www.blender.org +o Cylinder +v 0.092835 -0.500001 -0.466712 +v 0.264371 -0.500001 -0.395660 +v 0.395660 -0.500001 -0.264371 +v 0.466712 -0.500001 -0.092835 +v 0.466712 -0.500001 0.092835 +v 0.395660 -0.500001 0.264371 +v 0.264371 -0.500001 0.395660 +v 0.092835 -0.500001 0.466712 +v -0.092835 -0.500001 0.466712 +v -0.264371 -0.500001 0.395660 +v -0.395660 -0.500001 0.264371 +v -0.466712 -0.500001 0.092835 +v -0.466712 -0.500001 -0.092835 +v -0.395660 -0.500001 -0.264371 +v -0.264371 -0.500001 -0.395660 +v -0.092835 -0.500001 -0.466713 +v 0.273184 -0.413334 -0.408849 +v 0.408849 -0.413334 -0.273184 +v 0.482270 -0.413334 -0.095929 +v 0.482270 -0.413334 0.095930 +v 0.408849 -0.413334 0.273184 +v 0.273184 -0.413334 0.408849 +v 0.095929 -0.413334 0.482270 +v -0.095929 -0.413334 0.482270 +v -0.273184 -0.413334 0.408849 +v -0.408849 -0.413334 0.273184 +v -0.482270 -0.413334 0.095929 +v -0.482270 -0.413334 -0.095930 +v -0.408849 -0.413334 -0.273184 +v -0.273184 -0.413334 -0.408849 +v -0.095929 -0.413334 -0.482270 +v 0.095930 -0.413334 -0.482270 +v 0.282294 -0.114831 -0.422482 +v 0.422482 -0.114831 -0.282294 +v 0.498352 -0.114831 -0.099128 +v 0.498352 -0.114831 0.099128 +v 0.422482 -0.114831 0.282294 +v 0.282294 -0.114831 0.422482 +v 0.099128 -0.114831 0.498352 +v -0.099128 -0.114831 0.498352 +v -0.282294 -0.114831 0.422482 +v -0.422482 -0.114831 0.282294 +v -0.498352 -0.114831 0.099128 +v -0.498352 -0.114831 -0.099128 +v -0.422482 -0.114831 -0.282294 +v -0.282293 -0.114831 -0.422482 +v -0.099128 -0.114831 -0.498352 +v 0.099128 -0.114831 -0.498352 +v 0.083551 -0.500001 -0.420041 +v 0.237934 -0.500001 -0.356094 +v 0.356094 -0.500001 -0.237934 +v 0.420041 -0.500001 -0.083551 +v 0.420041 -0.500001 0.083551 +v 0.356094 -0.500001 0.237934 +v 0.237934 -0.500001 0.356094 +v 0.083551 -0.500001 0.420041 +v -0.083551 -0.500001 0.420041 +v -0.237934 -0.500001 0.356094 +v -0.356094 -0.500001 0.237934 +v -0.420041 -0.500001 0.083551 +v -0.420041 -0.500001 -0.083551 +v -0.356094 -0.500001 -0.237934 +v -0.237934 -0.500001 -0.356094 +v -0.083551 -0.500001 -0.420041 +v 0.245866 -0.413335 -0.367964 +v 0.367964 -0.413335 -0.245866 +v 0.434043 -0.413335 -0.086336 +v 0.434043 -0.413335 0.086337 +v 0.367964 -0.413335 0.245866 +v 0.245866 -0.413335 0.367964 +v 0.086337 -0.413335 0.434043 +v -0.086336 -0.413335 0.434043 +v -0.245866 -0.413335 0.367964 +v -0.367964 -0.413335 0.245866 +v -0.434043 -0.413335 0.086337 +v -0.434043 -0.413335 -0.086337 +v -0.367964 -0.413335 -0.245866 +v -0.245865 -0.413335 -0.367964 +v -0.086336 -0.413335 -0.434043 +v 0.086337 -0.413335 -0.434043 +v 0.254064 -0.114831 -0.380234 +v 0.380234 -0.114831 -0.254064 +v 0.448517 -0.114831 -0.089215 +v 0.448517 -0.114831 0.089216 +v 0.380234 -0.114831 0.254064 +v 0.254064 -0.114831 0.380234 +v 0.089216 -0.114831 0.448517 +v -0.089215 -0.114831 0.448517 +v -0.254064 -0.114831 0.380234 +v -0.380234 -0.114831 0.254064 +v -0.448517 -0.114831 0.089216 +v -0.448517 -0.114831 -0.089216 +v -0.380234 -0.114831 -0.254064 +v -0.254064 -0.114831 -0.380234 +v -0.089215 -0.114831 -0.448517 +v 0.089216 -0.114831 -0.448517 +v 0.087776 -0.352645 -0.441280 +v -0.087776 -0.352645 -0.441280 +v -0.249965 -0.352645 -0.374099 +v -0.374099 -0.352645 -0.249965 +v -0.441280 -0.352645 -0.087776 +v -0.441280 -0.352645 0.087776 +v -0.374099 -0.352645 0.249965 +v -0.249965 -0.352645 0.374099 +v -0.087776 -0.352645 0.441280 +v 0.087776 -0.352645 0.441280 +v 0.249965 -0.352645 0.374099 +v 0.374099 -0.352645 0.249965 +v 0.441280 -0.352645 0.087776 +v 0.441280 -0.352645 -0.087776 +v 0.374099 -0.352645 -0.249965 +v 0.249965 -0.352645 -0.374099 +v 0.000000 -0.352645 0.000000 +v -0.000000 -0.413334 0.000000 +vt 0.211792 0.993590 +vt 0.117562 0.954728 +vt 0.262789 0.738327 +vt 0.211538 0.006410 +vt 0.108974 0.006410 +vt 0.108974 0.032051 +vt 0.211538 0.032051 +vt 0.314103 0.006410 +vt 0.314103 0.032051 +vt 0.416667 0.006410 +vt 0.416667 0.032051 +vt 0.006410 0.006410 +vt 0.006410 0.032051 +vt 0.211361 0.993526 +vt 0.117394 0.954505 +vt 0.262040 0.737637 +vt 0.045447 0.882467 +vt 0.006475 0.788381 +vt 0.006410 0.686569 +vt 0.045263 0.592532 +vt 0.117118 0.520586 +vt 0.204627 0.488094 +vt 0.312719 0.481748 +vt 0.406687 0.520769 +vt 0.478633 0.592807 +vt 0.517605 0.686893 +vt 0.517670 0.788705 +vt 0.478816 0.882742 +vt 0.406962 0.954687 +vt 0.313044 0.993590 +vt 0.045441 0.882922 +vt 0.006410 0.789102 +vt 0.006410 0.687551 +vt 0.045442 0.593732 +vt 0.117562 0.521925 +vt 0.211793 0.483064 +vt 0.313787 0.483064 +vt 0.408016 0.521926 +vt 0.480136 0.593732 +vt 0.519168 0.687551 +vt 0.519168 0.789103 +vt 0.480136 0.882922 +vt 0.408016 0.954728 +vt 0.313786 0.993590 +vt 0.211538 0.442308 +vt 0.211538 0.467949 +vt 0.108974 0.467949 +vt 0.108974 0.442308 +vt 0.314103 0.442308 +vt 0.314103 0.467949 +vt 0.416667 0.442308 +vt 0.416667 0.467949 +vt 0.006410 0.467949 +vt 0.006410 0.442308 +vt 0.416667 0.076923 +vt 0.314103 0.076923 +vt 0.211538 0.076923 +vt 0.108974 0.076923 +vt 0.006410 0.076923 +vt 0.416667 0.185897 +vt 0.314103 0.185897 +vt 0.211538 0.185897 +vt 0.108974 0.185897 +vt 0.006410 0.185897 +vt 0.429487 0.032051 +vt 0.532051 0.032051 +vt 0.532051 0.076923 +vt 0.429487 0.076923 +vt 0.634615 0.032051 +vt 0.634615 0.076923 +vt 0.737179 0.032051 +vt 0.737179 0.076923 +vt 0.839744 0.032051 +vt 0.839744 0.076923 +vt 0.532051 0.185897 +vt 0.429487 0.185897 +vt 0.634615 0.185897 +vt 0.737179 0.185897 +vt 0.839744 0.185897 +s off +f 80/1 65/2 114/3 +f 7/4 8/5 56/6 55/7 +f 6/8 7/4 55/7 54/9 +f 5/10 6/8 54/9 53/11 +f 4/5 5/12 53/13 52/6 +f 3/4 4/5 52/6 51/7 +f 2/8 3/4 51/7 50/9 +f 1/10 2/8 50/9 49/11 +f 16/5 1/12 49/13 64/6 +f 15/4 16/5 64/6 63/7 +f 14/8 15/4 63/7 62/9 +f 13/10 14/8 62/9 61/11 +f 12/5 13/12 61/13 60/6 +f 11/4 12/5 60/6 59/7 +f 10/8 11/4 59/7 58/9 +f 9/10 10/8 58/9 57/11 +f 8/5 9/12 57/13 56/6 +f 98/14 99/15 113/16 +f 99/15 100/17 113/16 +f 100/17 101/18 113/16 +f 101/18 102/19 113/16 +f 102/19 103/20 113/16 +f 103/20 104/21 113/16 +f 104/21 105/22 113/16 +f 105/22 106/23 113/16 +f 106/23 107/24 113/16 +f 107/24 108/25 113/16 +f 108/25 109/26 113/16 +f 109/26 110/27 113/16 +f 110/27 111/28 113/16 +f 111/28 112/29 113/16 +f 112/29 97/30 113/16 +f 97/30 98/14 113/16 +f 65/2 66/31 114/3 +f 66/31 67/32 114/3 +f 67/32 68/33 114/3 +f 68/33 69/34 114/3 +f 69/34 70/35 114/3 +f 70/35 71/36 114/3 +f 71/36 72/37 114/3 +f 72/37 73/38 114/3 +f 73/38 74/39 114/3 +f 74/39 75/40 114/3 +f 75/40 76/41 114/3 +f 76/41 77/42 114/3 +f 77/42 78/43 114/3 +f 78/43 79/44 114/3 +f 79/44 80/1 114/3 +f 38/45 86/46 87/47 39/48 +f 37/49 85/50 86/46 38/45 +f 36/51 84/52 85/50 37/49 +f 35/48 83/47 84/53 36/54 +f 34/45 82/46 83/47 35/48 +f 33/49 81/50 82/46 34/45 +f 48/51 96/52 81/50 33/49 +f 47/48 95/47 96/53 48/54 +f 46/45 94/46 95/47 47/48 +f 45/49 93/50 94/46 46/45 +f 44/51 92/52 93/50 45/49 +f 43/48 91/47 92/53 44/54 +f 42/45 90/46 91/47 43/48 +f 41/49 89/50 90/46 42/45 +f 40/51 88/52 89/50 41/49 +f 39/48 87/47 88/53 40/54 +s 1 +f 1/11 32/55 17/56 2/9 +f 2/9 17/56 18/57 3/7 +f 3/7 18/57 19/58 4/6 +f 4/6 19/58 20/59 5/13 +f 5/11 20/55 21/56 6/9 +f 6/9 21/56 22/57 7/7 +f 7/7 22/57 23/58 8/6 +f 8/6 23/58 24/59 9/13 +f 9/11 24/55 25/56 10/9 +f 10/9 25/56 26/57 11/7 +f 11/7 26/57 27/58 12/6 +f 12/6 27/58 28/59 13/13 +f 13/11 28/55 29/56 14/9 +f 14/9 29/56 30/57 15/7 +f 16/6 31/58 32/59 1/13 +f 15/7 30/57 31/58 16/6 +f 32/55 48/60 33/61 17/56 +f 17/56 33/61 34/62 18/57 +f 18/57 34/62 35/63 19/58 +f 19/58 35/63 36/64 20/59 +f 20/55 36/60 37/61 21/56 +f 21/56 37/61 38/62 22/57 +f 22/57 38/62 39/63 23/58 +f 23/58 39/63 40/64 24/59 +f 24/55 40/60 41/61 25/56 +f 25/56 41/61 42/62 26/57 +f 26/57 42/62 43/63 27/58 +f 27/58 43/63 44/64 28/59 +f 28/55 44/60 45/61 29/56 +f 29/56 45/61 46/62 30/57 +f 31/58 47/63 48/64 32/59 +f 30/57 46/62 47/63 31/58 +f 49/65 50/66 65/67 80/68 +f 50/66 51/69 66/70 65/67 +f 51/69 52/71 67/72 66/70 +f 52/71 53/73 68/74 67/72 +f 53/65 54/66 69/67 68/68 +f 54/66 55/69 70/70 69/67 +f 55/69 56/71 71/72 70/70 +f 56/71 57/73 72/74 71/72 +f 57/65 58/66 73/67 72/68 +f 58/66 59/69 74/70 73/67 +f 59/69 60/71 75/72 74/70 +f 60/71 61/73 76/74 75/72 +f 61/65 62/66 77/67 76/68 +f 62/66 63/69 78/70 77/67 +f 64/71 49/73 80/74 79/72 +f 63/69 64/71 79/72 78/70 +f 97/68 112/67 81/75 96/76 +f 112/67 111/70 82/77 81/75 +f 111/70 110/72 83/78 82/77 +f 110/72 109/74 84/79 83/78 +f 109/68 108/67 85/75 84/76 +f 108/67 107/70 86/77 85/75 +f 107/70 106/72 87/78 86/77 +f 106/72 105/74 88/79 87/78 +f 105/68 104/67 89/75 88/76 +f 104/67 103/70 90/77 89/75 +f 103/70 102/72 91/78 90/77 +f 102/72 101/74 92/79 91/78 +f 101/68 100/67 93/75 92/76 +f 100/67 99/70 94/77 93/75 +f 98/72 97/74 96/79 95/78 +f 99/70 98/72 95/78 94/77 diff --git a/mods/cottages/models/feldweg-T-junction.obj b/mods/cottages/models/feldweg-T-junction.obj new file mode 100644 index 0000000..aae5c3d --- /dev/null +++ b/mods/cottages/models/feldweg-T-junction.obj @@ -0,0 +1,203 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg-T-junction.blend' +# www.blender.org +o Cube.001 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.250000 0.413592 0.500000 +v 0.375000 0.500000 0.500000 +v 0.125000 0.375000 0.500000 +v 0.500000 0.413592 0.250000 +v 0.500000 0.500000 0.375000 +v 0.500000 0.375000 0.125000 +v -0.250000 0.413592 0.500000 +v -0.125000 0.375000 0.500000 +v -0.375000 0.500000 0.500000 +v 0.500000 0.413592 -0.250000 +v 0.500000 0.375000 -0.125000 +v 0.500000 0.500000 -0.375000 +v -0.250000 0.413592 -0.500000 +v -0.375000 0.500000 -0.500000 +v -0.125000 0.375000 -0.500000 +v 0.250000 0.413592 -0.500000 +v 0.125000 0.375000 -0.500000 +v 0.375000 0.500000 -0.500000 +v 0.147929 0.375000 0.384092 +v 0.205019 0.375000 0.284810 +v 0.284810 0.375000 0.205019 +v 0.384092 0.375000 0.147929 +v 0.264688 0.413592 0.428728 +v 0.304057 0.413592 0.361075 +v 0.361075 0.413592 0.304057 +v 0.428728 0.413592 0.264688 +v 0.473364 0.500000 0.381447 +v 0.437341 0.500000 0.403095 +v 0.403095 0.500000 0.437341 +v 0.381447 0.500000 0.473364 +v 0.473364 0.500000 -0.381447 +v 0.437341 0.500000 -0.403095 +v 0.403095 0.500000 -0.437341 +v 0.381447 0.500000 -0.473364 +v 0.428728 0.413592 -0.264688 +v 0.361075 0.413592 -0.304057 +v 0.304057 0.413592 -0.361075 +v 0.264688 0.413592 -0.428728 +v 0.147929 0.375000 -0.384092 +v 0.205019 0.375000 -0.284810 +v 0.284810 0.375000 -0.205019 +v 0.384092 0.375000 -0.147929 +v 0.000000 -0.005322 -0.500000 +v 0.500000 -0.005322 0.000000 +v -0.000000 -0.005322 0.500000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.500000 0.494678 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.973364 0.118553 +vt 0.937341 0.096905 +vt 0.903095 0.062659 +vt 0.881447 0.026636 +vt 0.875000 0.000000 +vt 1.000000 0.125000 +vt 0.026636 0.118553 +vt 0.000000 0.125000 +vt 0.125000 0.000000 +vt 0.118553 0.026636 +vt 0.096905 0.062659 +vt 0.062659 0.096905 +vt 0.000000 0.875000 +vt 1.000000 0.875000 +vt 0.352071 0.115908 +vt 0.235312 0.071272 +vt 0.250000 0.000000 +vt 0.375000 0.000000 +vt 0.294981 0.215190 +vt 0.195943 0.138925 +vt 0.215190 0.294981 +vt 0.138925 0.195943 +vt 0.071272 0.235312 +vt 0.115908 0.352071 +vt 0.000000 0.250000 +vt 0.000000 0.375000 +vt 0.928728 0.235312 +vt 1.000000 0.250000 +vt 1.000000 0.375000 +vt 0.884092 0.352071 +vt 0.861075 0.195943 +vt 0.784810 0.294981 +vt 0.804057 0.138925 +vt 0.705019 0.215190 +vt 0.647929 0.115908 +vt 0.764688 0.071272 +vt 0.625000 0.000000 +vt 0.750000 0.000000 +vt 0.000000 0.625000 +vt 1.000000 0.625000 +vt 1.000000 0.750000 +vt 0.000000 0.750000 +vt 0.312500 0.625000 +vt 0.312500 0.500000 +vt 0.375000 0.500000 +vt 0.375000 0.625000 +vt 0.250000 0.625000 +vt 0.250000 0.500000 +vt 0.187500 0.625000 +vt 0.187500 0.500000 +vt 0.125000 0.500000 +vt 0.125000 0.625000 +vt 0.062500 0.500000 +vt 0.062500 0.625000 +vt 0.750000 0.500000 +vt 0.812500 0.500000 +vt 0.812500 0.625000 +vt 0.750000 0.625000 +vt 0.687500 0.500000 +vt 0.687500 0.625000 +vt 0.625000 0.500000 +vt 0.625000 0.625000 +vt 0.562500 0.625000 +vt 0.562500 0.500000 +vt 0.500000 0.625000 +vt 0.500000 0.500000 +g Cube.001_Cube.001_road_ends +s off +f 7/1 8/2 53/3 +f 5/2 1/4 52/3 +f 5/1 6/2 51/3 +f 6/2 2/4 51/3 +f 2/4 22/5 51/3 +f 22/5 21/6 51/3 +f 21/6 23/7 51/3 +f 23/7 25/8 51/3 +f 25/8 24/9 51/3 +f 24/9 26/10 51/3 +f 26/10 1/11 51/3 +f 1/11 5/1 51/3 +f 1/4 20/5 52/3 +f 20/5 18/6 52/3 +f 18/6 19/7 52/3 +f 19/7 14/8 52/3 +f 14/8 12/9 52/3 +f 12/9 13/10 52/3 +f 13/10 4/11 52/3 +f 4/11 8/1 52/3 +f 8/1 5/2 52/3 +f 8/2 4/4 53/3 +f 4/4 10/5 53/3 +f 10/5 9/6 53/3 +f 9/6 11/7 53/3 +f 11/7 16/8 53/3 +f 16/8 15/9 53/3 +f 15/9 17/10 53/3 +f 17/10 3/11 53/3 +f 3/11 7/1 53/3 +g Cube.001_Cube.001_road_sides +f 7/2 3/4 2/11 6/1 +g Cube.001_Cube.001_bottom +f 7/1 6/2 5/4 8/11 +g Cube.001_Cube.001_top_grass +f 42/12 41/13 40/14 39/15 20/16 1/2 26/17 +f 38/18 10/19 4/1 13/20 35/21 36/22 37/23 +f 3/11 17/24 22/25 2/4 +g Cube.001_Cube.001_road +f 30/26 34/27 12/28 14/29 +f 29/30 33/31 34/27 30/26 +f 28/32 32/33 33/31 29/30 +f 31/34 32/33 28/32 27/35 +f 9/36 31/34 27/35 11/37 +f 46/38 24/39 25/40 47/41 +f 45/42 46/38 47/41 48/43 +f 44/44 45/42 48/43 49/45 +f 50/46 43/47 44/44 49/45 +f 19/48 18/49 43/47 50/46 +f 16/50 23/51 21/52 15/53 +f 23/51 16/50 11/37 25/40 +f 27/35 47/41 25/40 11/37 +f 28/32 48/43 47/41 27/35 +f 29/30 49/45 48/43 28/32 +f 30/26 50/46 49/45 29/30 +f 30/26 14/29 19/48 50/46 +g Cube.001_Cube.001_road-grass_blend +f 34/54 35/55 13/56 12/57 +f 33/58 36/59 35/55 34/54 +f 32/60 37/61 36/59 33/58 +f 38/62 37/61 32/60 31/63 +f 10/64 38/62 31/63 9/65 +f 42/66 26/67 24/68 46/69 +f 41/70 42/66 46/69 45/71 +f 40/72 41/70 45/71 44/73 +f 43/74 39/75 40/72 44/73 +f 18/76 20/77 39/75 43/74 +f 15/53 21/52 22/25 17/24 diff --git a/mods/cottages/models/feldweg-crossing.obj b/mods/cottages/models/feldweg-crossing.obj new file mode 100644 index 0000000..9caa296 --- /dev/null +++ b/mods/cottages/models/feldweg-crossing.obj @@ -0,0 +1,314 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg-crossing.blend' +# www.blender.org +o Cube.003 +v 0.500000 0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v -0.500000 0.413592 0.250000 +v -0.500000 0.500000 0.375000 +v -0.500000 0.375000 0.125000 +v -0.250000 0.413592 0.500000 +v -0.375000 0.500000 0.500000 +v -0.125000 0.375000 0.500000 +v -0.500000 0.413592 -0.250000 +v -0.500000 0.375000 -0.125000 +v -0.500000 0.500000 -0.375000 +v 0.250000 0.413592 0.500000 +v 0.125000 0.375000 0.500000 +v 0.375000 0.500000 0.500000 +v 0.500000 0.413592 -0.250000 +v 0.500000 0.500000 -0.375000 +v 0.500000 0.375000 -0.125000 +v 0.500000 0.413592 0.250000 +v 0.500000 0.375000 0.125000 +v 0.500000 0.500000 0.375000 +v 0.250000 0.413592 -0.500000 +v 0.375000 0.500000 -0.500000 +v 0.125000 0.375000 -0.500000 +v -0.250000 0.413592 -0.500000 +v -0.125000 0.375000 -0.500000 +v -0.375000 0.500000 -0.500000 +v -0.384092 0.375000 0.147929 +v -0.284809 0.375000 0.205019 +v -0.205019 0.375000 0.284810 +v -0.147929 0.375000 0.384092 +v -0.428728 0.413592 0.264688 +v -0.361075 0.413592 0.304057 +v -0.304057 0.413592 0.361075 +v -0.264688 0.413592 0.428728 +v -0.381447 0.500000 0.473364 +v -0.403095 0.500000 0.437341 +v -0.437341 0.500000 0.403095 +v -0.473364 0.500000 0.381447 +v -0.473364 0.500000 -0.381447 +v -0.437341 0.500000 -0.403095 +v -0.403095 0.500000 -0.437341 +v -0.381447 0.500000 -0.473364 +v -0.428728 0.413592 -0.264688 +v -0.361075 0.413592 -0.304057 +v -0.304057 0.413592 -0.361075 +v -0.264688 0.413592 -0.428728 +v -0.147929 0.375000 -0.384092 +v -0.205019 0.375000 -0.284810 +v -0.284810 0.375000 -0.205019 +v -0.384092 0.375000 -0.147929 +v 0.381447 0.500000 0.473364 +v 0.403095 0.500000 0.437341 +v 0.437341 0.500000 0.403095 +v 0.473364 0.500000 0.381447 +v 0.264688 0.413592 0.428728 +v 0.304057 0.413592 0.361075 +v 0.361075 0.413592 0.304057 +v 0.428728 0.413592 0.264688 +v 0.384091 0.375000 0.147929 +v 0.284810 0.375000 0.205019 +v 0.205019 0.375000 0.284810 +v 0.147929 0.375000 0.384092 +v 0.384091 0.375000 -0.147929 +v 0.284809 0.375000 -0.205019 +v 0.205018 0.375000 -0.284810 +v 0.147929 0.375000 -0.384092 +v 0.428728 0.413592 -0.264688 +v 0.361075 0.413592 -0.304057 +v 0.304057 0.413592 -0.361075 +v 0.264688 0.413592 -0.428728 +v 0.381447 0.500000 -0.473364 +v 0.403095 0.500000 -0.437341 +v 0.437341 0.500000 -0.403095 +v 0.473364 0.500000 -0.381447 +v 0.000000 -0.005322 0.500000 +v 0.500000 -0.005322 0.000000 +v 0.000000 -0.005322 -0.500000 +v -0.500000 -0.005322 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.500000 0.494678 +vt 0.000000 0.000000 +vt 0.875000 1.000000 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.026636 0.118553 +vt 0.000000 0.125000 +vt 0.125000 0.000000 +vt 0.118553 0.026636 +vt 0.096905 0.062659 +vt 0.062659 0.096905 +vt 0.973364 0.118553 +vt 0.937341 0.096905 +vt 0.903095 0.062659 +vt 0.881447 0.026636 +vt 0.875000 0.000000 +vt 1.000000 0.125000 +vt 0.973364 0.881447 +vt 1.000000 0.875000 +vt 0.881447 0.973364 +vt 0.903095 0.937341 +vt 0.937341 0.903095 +vt 0.118553 0.973364 +vt 0.000000 0.875000 +vt 0.026636 0.881447 +vt 0.062659 0.903095 +vt 0.096905 0.937341 +vt 0.352071 0.115908 +vt 0.235312 0.071272 +vt 0.250000 0.000000 +vt 0.375000 0.000000 +vt 0.294981 0.215190 +vt 0.195943 0.138925 +vt 0.215191 0.294981 +vt 0.138925 0.195943 +vt 0.071272 0.235312 +vt 0.115908 0.352071 +vt 0.000000 0.250000 +vt 0.000000 0.375000 +vt 0.235312 0.928728 +vt 0.352071 0.884092 +vt 0.375000 1.000000 +vt 0.250000 1.000000 +vt 0.195943 0.861075 +vt 0.294981 0.784810 +vt 0.138925 0.804057 +vt 0.215190 0.705019 +vt 0.115908 0.647929 +vt 0.071272 0.764688 +vt 0.000000 0.625000 +vt 0.000000 0.750000 +vt 0.928728 0.235312 +vt 1.000000 0.250000 +vt 1.000000 0.375000 +vt 0.884092 0.352071 +vt 0.861075 0.195943 +vt 0.784810 0.294981 +vt 0.804057 0.138925 +vt 0.705019 0.215190 +vt 0.647929 0.115908 +vt 0.764688 0.071272 +vt 0.625000 0.000000 +vt 0.750000 0.000000 +vt 0.647929 0.884092 +vt 0.764688 0.928728 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vt 0.705018 0.784810 +vt 0.804057 0.861075 +vt 0.784809 0.705019 +vt 0.861075 0.804057 +vt 0.928728 0.764688 +vt 0.884091 0.647929 +vt 1.000000 0.750000 +vt 1.000000 0.625000 +vt 0.750000 0.625000 +vt 0.750000 0.500000 +vt 0.812500 0.500000 +vt 0.812500 0.625000 +vt 0.687500 0.625000 +vt 0.687500 0.500000 +vt 0.625000 0.625000 +vt 0.625000 0.500000 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.500000 0.500000 +vt 0.500000 0.625000 +vt 0.125000 0.500000 +vt 0.125000 0.625000 +vt 0.062500 0.625000 +vt 0.062500 0.500000 +vt 0.187500 0.500000 +vt 0.187500 0.625000 +vt 0.250000 0.500000 +vt 0.250000 0.625000 +vt 0.312500 0.625000 +vt 0.312500 0.500000 +vt 0.375000 0.625000 +vt 0.375000 0.500000 +vt 0.125000 0.875000 +vt 0.062500 0.875000 +vt 0.062500 0.750000 +vt 0.125000 0.750000 +vt 0.187500 0.875000 +vt 0.187500 0.750000 +vt 0.250000 0.875000 +vt 0.250000 0.750000 +vt 0.312500 0.750000 +vt 0.312500 0.875000 +vt 0.375000 0.750000 +vt 0.562500 0.750000 +vt 0.562500 0.875000 +vt 0.500000 0.875000 +vt 0.500000 0.750000 +vt 0.625000 0.750000 +vt 0.687500 0.750000 +vt 0.687500 0.875000 +vt 0.750000 0.875000 +vt 0.750000 0.750000 +vt 0.812500 0.875000 +vt 0.812500 0.750000 +g Cube.003_Cube.003_road_ends +s off +f 7/1 3/2 83/3 +f 5/4 6/1 82/3 +f 7/4 8/1 84/3 +f 5/1 1/2 81/3 +f 1/2 20/5 81/3 +f 20/5 18/6 81/3 +f 18/6 19/7 81/3 +f 19/7 14/8 81/3 +f 14/8 12/9 81/3 +f 12/9 13/10 81/3 +f 13/10 4/11 81/3 +f 4/11 8/4 81/3 +f 8/4 5/1 81/3 +f 6/1 2/2 82/3 +f 2/2 22/5 82/3 +f 22/5 21/6 82/3 +f 21/6 23/7 82/3 +f 23/7 25/8 82/3 +f 25/8 24/9 82/3 +f 24/9 26/10 82/3 +f 26/10 1/11 82/3 +f 1/11 5/4 82/3 +f 3/2 32/5 83/3 +f 32/5 30/6 83/3 +f 30/6 31/7 83/3 +f 31/7 29/8 83/3 +f 29/8 27/9 83/3 +f 27/9 28/10 83/3 +f 28/10 2/11 83/3 +f 2/11 6/4 83/3 +f 6/4 7/1 83/3 +f 8/1 4/2 84/3 +f 4/2 10/5 84/3 +f 10/5 9/6 84/3 +f 9/6 11/7 84/3 +f 11/7 16/8 84/3 +f 16/8 15/9 84/3 +f 15/9 17/10 84/3 +f 17/10 3/11 84/3 +f 3/11 7/4 84/3 +g Cube.003_Cube.003_bottom +f 7/4 6/1 5/2 8/11 +g Cube.003_Cube.003_top_grass +f 44/12 10/13 4/4 13/14 41/15 42/16 43/17 +f 60/18 59/19 58/20 57/21 20/22 1/1 26/23 +f 80/24 22/25 2/2 28/5 77/26 78/27 79/28 +f 48/29 32/10 3/11 17/30 45/31 46/32 47/33 +g Cube.003_Cube.003_road +f 36/34 40/35 12/36 14/37 +f 35/38 39/39 40/35 36/34 +f 34/40 38/41 39/39 35/38 +f 37/42 38/41 34/40 33/43 +f 9/44 37/42 33/43 11/45 +f 52/46 53/47 31/48 30/49 +f 51/50 54/51 53/47 52/46 +f 50/52 55/53 54/51 51/50 +f 56/54 55/53 50/52 49/55 +f 16/56 56/54 49/55 15/57 +f 64/58 24/59 25/60 65/61 +f 63/62 64/58 65/61 66/63 +f 62/64 63/62 66/63 67/65 +f 68/66 61/67 62/64 67/65 +f 19/68 18/69 61/67 68/66 +f 72/70 76/71 27/72 29/73 +f 71/74 75/75 76/71 72/70 +f 70/76 74/77 75/75 71/74 +f 73/78 74/77 70/76 69/79 +f 21/80 73/78 69/79 23/81 +f 36/34 14/37 19/68 68/66 +f 36/34 68/66 67/65 35/38 +f 65/61 25/60 23/81 69/79 +f 66/63 65/61 69/79 70/76 +f 53/47 72/70 29/73 31/48 +f 53/47 54/51 71/74 72/70 +f 33/43 56/54 16/56 11/45 +f 33/43 34/40 55/53 56/54 +f 34/40 35/38 67/65 66/63 70/76 71/74 54/51 55/53 +g Cube.003_Cube.003_road-grass_blend +f 40/82 41/83 13/84 12/85 +f 39/86 42/87 41/83 40/82 +f 38/88 43/89 42/87 39/86 +f 44/90 43/89 38/88 37/91 +f 10/92 44/90 37/91 9/93 +f 48/94 52/95 30/96 32/97 +f 47/98 51/99 52/95 48/94 +f 46/100 50/101 51/99 47/98 +f 49/102 50/101 46/100 45/103 +f 15/104 49/102 45/103 17/105 +f 60/106 26/107 24/108 64/109 +f 59/110 60/106 64/109 63/111 +f 58/112 59/110 63/111 62/113 +f 61/114 57/115 58/112 62/113 +f 18/116 20/8 57/115 61/114 +f 76/117 77/118 28/119 27/120 +f 75/121 78/7 77/118 76/117 +f 74/122 79/123 78/7 75/121 +f 80/124 79/123 74/122 73/125 +f 22/126 80/124 73/125 21/127 diff --git a/mods/cottages/models/feldweg-curve.obj b/mods/cottages/models/feldweg-curve.obj new file mode 100644 index 0000000..4b776e7 --- /dev/null +++ b/mods/cottages/models/feldweg-curve.obj @@ -0,0 +1,207 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg-curve.blend' +# www.blender.org +o Cube.002 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.250000 0.413592 0.500000 +v 0.375000 0.500000 0.500000 +v 0.125000 0.375000 0.500000 +v 0.500000 0.413592 0.250000 +v 0.500000 0.500000 0.375000 +v 0.500000 0.375000 0.125000 +v -0.250000 0.413592 0.500000 +v -0.125000 0.375000 0.500000 +v -0.375000 0.500000 0.500000 +v 0.500000 0.413592 -0.250000 +v 0.500000 0.375000 -0.125000 +v 0.500000 0.500000 -0.375000 +v 0.147929 0.375000 0.384092 +v 0.205019 0.375000 0.284809 +v 0.284810 0.375000 0.205019 +v 0.384092 0.375000 0.147929 +v 0.264688 0.413592 0.428728 +v 0.304057 0.413592 0.361075 +v 0.361075 0.413592 0.304057 +v 0.428728 0.413592 0.264688 +v 0.473364 0.500000 0.381447 +v 0.437341 0.500000 0.403095 +v 0.403095 0.500000 0.437341 +v 0.381447 0.500000 0.473364 +v -0.347302 0.500000 0.313164 +v -0.272666 0.500000 0.136438 +v -0.162122 0.500000 -0.023675 +v -0.023675 0.500000 -0.162122 +v 0.136438 0.500000 -0.272666 +v 0.313164 0.500000 -0.347302 +v -0.227010 0.413592 0.347148 +v -0.163160 0.413592 0.196715 +v -0.066130 0.413592 0.056392 +v 0.056392 0.413592 -0.066130 +v 0.196715 0.413592 -0.163160 +v 0.347148 0.413592 -0.227010 +v 0.381132 0.375000 -0.106719 +v 0.256993 0.375000 -0.053654 +v 0.136458 0.375000 0.029861 +v 0.029861 0.375000 0.136458 +v -0.053654 0.375000 0.256993 +v -0.106719 0.375000 0.381132 +v -0.000000 -0.005322 0.500000 +v 0.500000 -0.005322 0.000000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 0.026636 0.118553 +vt 0.000000 0.125000 +vt 0.125000 0.000000 +vt 0.118553 0.026636 +vt 0.096905 0.062659 +vt 0.062659 0.096905 +vt 0.875000 0.000000 +vt 0.847302 0.186836 +vt 0.000000 0.875000 +vt 0.186836 0.847302 +vt 0.363562 0.772666 +vt 0.772666 0.363562 +vt 0.523674 0.662122 +vt 0.662122 0.523675 +vt 0.500000 0.494678 +vt 0.875000 1.000000 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.352071 0.115908 +vt 0.235312 0.071272 +vt 0.250000 0.000000 +vt 0.375000 0.000000 +vt 0.294981 0.215190 +vt 0.195943 0.138925 +vt 0.215191 0.294981 +vt 0.138925 0.195943 +vt 0.071272 0.235312 +vt 0.115908 0.352071 +vt 0.000000 0.250000 +vt 0.000000 0.375000 +vt 0.727010 0.152852 +vt 0.606719 0.118868 +vt 0.625000 0.000000 +vt 0.750000 0.000000 +vt 0.663160 0.303285 +vt 0.553654 0.243007 +vt 0.566130 0.443608 +vt 0.470139 0.363542 +vt 0.443608 0.566130 +vt 0.363542 0.470138 +vt 0.303285 0.663160 +vt 0.243007 0.553654 +vt 0.118868 0.606719 +vt 0.152852 0.727010 +vt 0.000000 0.625000 +vt 0.000000 0.750000 +vt 0.625000 0.625000 +vt 0.625000 0.500000 +vt 0.687500 0.500000 +vt 0.687500 0.625000 +vt 0.562500 0.625000 +vt 0.562500 0.500000 +vt 0.500000 0.625000 +vt 0.500000 0.500000 +vt 0.437500 0.500000 +vt 0.437500 0.625000 +vt 0.375000 0.500000 +vt 0.375000 0.625000 +vt 0.812500 0.875000 +vt 0.812500 0.750000 +vt 0.937500 0.750000 +vt 0.937500 0.875000 +vt 0.687500 0.875000 +vt 0.687500 0.750000 +vt 0.562500 0.875000 +vt 0.562500 0.750000 +vt 0.437500 0.875000 +vt 0.437500 0.750000 +vt 0.312500 0.875000 +vt 0.312500 0.750000 +vt 0.187500 0.750000 +vt 0.187500 0.875000 +vt 0.062500 0.750000 +vt 0.062500 0.875000 +g Cube.002_Cube.002_road_ends +s off +f 6/1 2/2 1/3 5/4 +f 7/1 3/2 2/3 6/4 +g Cube.002_Cube.002_road_ends_default_grass.png +f 32/5 10/6 4/4 13/7 29/8 30/9 31/10 +f 20/11 1/1 38/12 +f 17/13 33/14 3/3 +f 3/3 33/14 2/2 +f 1/1 2/2 38/12 +f 33/14 34/15 2/2 +f 38/12 2/2 37/16 +f 35/17 2/2 34/15 +f 36/18 2/2 35/17 +f 37/16 2/2 36/18 +g Cube.002_Cube.002_road_ends_cottages_feldweg_end.png +f 5/1 1/2 52/19 +f 7/4 8/1 51/19 +f 8/1 4/2 51/19 +f 4/2 10/20 51/19 +f 10/20 9/21 51/19 +f 9/21 11/22 51/19 +f 11/22 16/23 51/19 +f 16/23 15/24 51/19 +f 15/24 17/25 51/19 +f 17/25 3/3 51/19 +f 3/3 7/4 51/19 +f 1/2 20/20 52/19 +f 20/20 18/21 52/19 +f 18/21 19/22 52/19 +f 19/22 14/23 52/19 +f 14/23 12/24 52/19 +f 12/24 13/25 52/19 +f 13/25 4/3 52/19 +f 4/3 8/4 52/19 +f 8/4 5/1 52/19 +g Cube.002_Cube.002_road_ends_cottages_feldweg.png +f 24/26 28/27 12/28 14/29 +f 23/30 27/31 28/27 24/26 +f 22/32 26/33 27/31 23/30 +f 25/34 26/33 22/32 21/35 +f 9/36 25/34 21/35 11/37 +f 44/38 45/39 19/40 18/41 +f 43/42 46/43 45/39 44/38 +f 42/44 47/45 46/43 43/42 +f 41/46 48/47 47/45 42/44 +f 40/48 49/49 48/47 41/46 +f 50/50 49/49 40/48 39/51 +f 16/52 50/50 39/51 15/53 +f 24/26 14/29 19/40 45/39 +f 21/35 50/50 16/52 11/37 +f 50/50 21/35 49/49 +f 45/39 46/43 24/26 +f 23/30 24/26 46/43 47/45 +f 22/32 23/30 47/45 48/47 +f 21/35 22/32 48/47 49/49 +g Cube.002_Cube.002_bottom +f 7/4 6/1 5/2 8/3 +g Cube.002_Cube.002_road-gass_blend +f 28/54 29/55 13/56 12/57 +f 27/58 30/59 29/55 28/54 +f 26/60 31/61 30/59 27/58 +f 32/62 31/61 26/60 25/63 +f 10/64 32/62 25/63 9/65 +f 38/66 44/67 18/68 20/69 +f 37/70 43/71 44/67 38/66 +f 36/72 42/73 43/71 37/70 +f 35/74 41/75 42/73 36/72 +f 34/76 40/77 41/75 35/74 +f 39/78 40/77 34/76 33/79 +f 15/80 39/78 33/79 17/81 diff --git a/mods/cottages/models/feldweg.obj b/mods/cottages/models/feldweg.obj new file mode 100644 index 0000000..417071e --- /dev/null +++ b/mods/cottages/models/feldweg.obj @@ -0,0 +1,87 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg.blend' +# www.blender.org +o Cube +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.250000 0.413592 0.500000 +v 0.250000 0.413592 -0.500000 +v 0.250000 0.413592 0.500000 +v -0.250000 0.413592 -0.500000 +v -0.375000 0.500000 0.500000 +v 0.375000 0.500000 -0.500000 +v 0.125000 0.375000 0.500000 +v -0.125000 0.375000 -0.500000 +v -0.125000 0.375000 0.500000 +v 0.125000 0.375000 -0.500000 +v 0.375000 0.500000 0.500000 +v -0.375000 0.500000 -0.500000 +v 0.000000 -0.005322 0.500000 +v -0.000000 -0.005322 -0.500000 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.500000 0.494678 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.875000 +vt 0.000000 0.875000 +vt 1.000000 0.125000 +vt 0.000000 0.125000 +vt 1.000000 0.625000 +vt 1.000000 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.625000 +vt 1.000000 0.250000 +vt 1.000000 0.375000 +vt 0.000000 0.375000 +vt 0.000000 0.250000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +g Cube_Cube_road_ends +s off +f 4/1 20/2 22/3 +f 2/1 19/2 21/3 +f 19/2 11/4 21/3 +f 11/4 15/5 21/3 +f 15/5 17/6 21/3 +f 17/6 9/7 21/3 +f 9/7 13/8 21/3 +f 13/8 1/9 21/3 +f 1/9 5/10 21/3 +f 5/10 6/11 21/3 +f 6/11 2/1 21/3 +f 20/2 12/4 22/3 +f 12/4 16/5 22/3 +f 16/5 18/6 22/3 +f 18/6 10/7 22/3 +f 10/7 14/8 22/3 +f 14/8 3/9 22/3 +f 3/9 7/10 22/3 +f 7/10 8/11 22/3 +f 8/11 4/1 22/3 +g Cube_Cube_road_sides +f 1/1 4/9 8/10 5/11 +f 3/1 2/9 6/10 7/11 +g Cube_Cube_bottom +f 8/9 7/10 6/11 5/1 +g Cube_Cube_top_grass +f 19/12 2/1 3/9 14/13 +f 1/11 13/14 20/15 4/10 +g Cube_Cube_road +f 15/16 11/17 10/18 18/19 +f 9/20 17/21 16/22 12/23 +f 15/16 18/19 16/22 17/21 +g Cube_Cube_road-grass_blend +f 13/24 9/16 12/19 20/25 +f 11/17 19/12 14/13 10/18 diff --git a/mods/cottages/models/feldweg_end.obj b/mods/cottages/models/feldweg_end.obj new file mode 100644 index 0000000..46315f5 --- /dev/null +++ b/mods/cottages/models/feldweg_end.obj @@ -0,0 +1,206 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg_end.blend' +# www.blender.org +o Cube +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 0.500000 -0.500000 +v -0.500000 0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.250000 0.500000 0.500000 +v 0.250000 0.413592 -0.500000 +v 0.250000 0.500000 0.500000 +v -0.250000 0.413592 -0.500000 +v -0.375000 0.500000 0.500000 +v 0.375000 0.500000 -0.500000 +v 0.125000 0.500000 0.500000 +v -0.125000 0.375000 -0.500000 +v -0.125000 0.500000 0.500000 +v 0.125000 0.375000 -0.500000 +v 0.375000 0.500000 0.500000 +v -0.375000 0.500000 -0.500000 +v -0.000000 -0.005322 -0.500000 +v 0.250000 0.413592 -0.000000 +v -0.250000 0.413592 0.000000 +v 0.375000 0.500000 -0.000000 +v -0.125000 0.375000 0.000000 +v 0.125000 0.375000 -0.016321 +v -0.375000 0.500000 0.000000 +v 0.210101 0.443819 0.205395 +v -0.210101 0.443819 0.205395 +v 0.359784 0.500000 0.250000 +v -0.130863 0.426864 0.289840 +v 0.075837 0.429295 0.285669 +v -0.363898 0.500000 0.250000 +v 0.250000 0.499467 0.375000 +v -0.250000 0.499467 0.375000 +v 0.338593 0.500000 0.299881 +v -0.060925 0.480171 0.395010 +v 0.125000 0.480171 0.399350 +v -0.338593 0.500000 0.299881 +v 0.250000 0.413592 0.125000 +v -0.250000 0.413592 0.125000 +v 0.375000 0.500000 0.125000 +v -0.078088 0.375000 0.108679 +v 0.125000 0.375000 0.145321 +v -0.375000 0.500000 0.125000 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.500000 0.494678 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vt 0.375000 1.000000 +vt 0.250000 1.000000 +vt 0.500000 0.875000 +vt 0.625000 0.125000 +vt 0.750000 0.136102 +vt 1.000000 0.625000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 1.000000 0.125000 +vt 1.000000 0.250000 +vt 0.875000 0.250000 +vt 1.000000 0.875000 +vt 0.799881 0.838593 +vt 1.000000 0.375000 +vt 0.895010 0.439075 +vt 0.899350 0.625000 +vt 0.799881 0.161407 +vt 0.000000 0.125000 +vt 0.500000 0.125000 +vt 0.750000 0.859784 +vt 0.000000 0.875000 +vt 0.541968 0.500000 +vt 0.541968 0.625000 +vt 0.125000 0.625000 +vt 0.125000 0.500000 +vt 0.541968 0.750000 +vt 0.541968 0.875000 +vt 0.125000 0.875000 +vt 0.125000 0.750000 +vt 0.646210 0.500000 +vt 0.646210 0.625000 +vt 0.646210 0.750000 +vt 0.646210 0.875000 +vt 0.635605 0.135605 +vt 0.760605 0.155911 +vt 0.720706 0.297351 +vt 0.172012 0.218555 +vt 0.260605 0.155911 +vt 0.300504 0.297350 +vt 0.751051 0.512257 +vt 0.876118 0.512257 +vt 0.876118 0.600535 +vt 0.449680 0.139224 +vt 0.379742 0.226929 +vt 0.586442 0.230407 +vt 0.146707 0.260153 +vt 0.260605 0.364395 +vt 0.870389 0.260153 +vt 0.885605 0.364395 +vt 0.135605 0.364395 +vt 0.760605 0.364395 +vt 0.459281 0.625000 +vt 0.474779 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.625000 +vt 0.474779 0.250000 +vt 0.474779 0.375000 +vt 0.000000 0.375000 +vt 0.000000 0.250000 +vt 0.612771 0.625000 +vt 0.593474 0.750000 +vt 0.593474 0.250000 +vt 0.577976 0.421912 +vt 0.746039 0.575837 +vt 0.669814 0.710101 +vt 0.669814 0.289899 +vt 0.750000 0.369137 +g Cube_Cube_ends +s off +f 4/1 20/2 21/3 +f 20/2 12/4 21/3 +f 12/4 16/5 21/3 +f 16/5 18/6 21/3 +f 18/6 10/7 21/3 +f 10/7 14/8 21/3 +f 14/8 3/9 21/3 +f 3/9 7/10 21/3 +f 7/10 8/11 21/3 +f 8/11 4/1 21/3 +g Cube_Cube_sides +f 1/1 4/9 8/10 5/11 +f 3/1 2/9 6/10 7/11 +f 1/9 5/10 6/11 2/1 19/2 11/12 15/13 17/14 9/15 13/8 +g Cube_Cube_bottom +f 8/9 7/10 6/11 5/1 +g Cube_Cube_top_grass +f 24/16 42/5 2/1 +f 45/17 1/11 33/18 +f 15/19 11/20 34/21 +f 13/22 9/23 35/24 +f 11/20 19/25 36/26 +f 9/23 17/27 37/28 +f 15/19 38/29 37/28 +f 38/29 15/19 34/21 +f 39/30 13/22 35/24 +f 34/21 11/20 36/26 +f 35/24 9/23 37/28 +f 17/27 15/19 37/28 +f 19/25 2/1 36/26 +f 20/31 4/10 27/32 +f 45/17 27/32 1/11 +f 3/9 24/16 2/1 +f 2/1 30/33 36/26 +f 2/1 42/5 30/33 +f 3/9 14/34 24/16 +f 33/18 1/11 39/30 +f 27/32 4/10 1/11 +f 1/11 13/22 39/30 +g Cube_Cube_top_grass_blend +f 27/35 23/36 12/37 20/38 +f 22/39 24/40 14/41 10/42 +f 45/43 41/44 23/36 +f 40/45 42/46 24/40 +f 38/47 34/48 28/49 +f 39/50 35/51 29/52 +f 34/53 36/54 30/55 +f 35/51 37/56 31/57 +f 38/47 32/58 31/57 +f 33/59 29/52 41/60 +f 28/49 30/61 42/62 +f 27/35 45/43 23/36 +f 22/39 40/45 24/40 +f 32/58 38/47 28/49 +f 33/59 39/50 29/52 +f 28/49 34/48 30/61 +f 29/52 35/51 31/57 +f 37/56 38/47 31/57 +f 45/63 33/59 41/60 +f 40/64 28/49 42/62 +g Cube_Cube_road +f 26/65 22/66 10/67 18/68 +f 23/69 25/70 16/71 12/72 +f 26/65 18/68 16/71 25/70 +f 44/73 40/74 22/66 +f 41/75 43/76 25/70 +f 44/73 26/65 25/70 +f 32/77 28/78 40/74 +f 29/79 31/80 43/76 +f 32/77 44/73 43/76 +f 26/65 44/73 22/66 +f 23/69 41/75 25/70 +f 43/76 44/73 25/70 +f 44/73 32/77 40/74 +f 41/75 29/79 43/76 +f 31/80 32/77 43/76 diff --git a/mods/cottages/models/feldweg_slope.obj b/mods/cottages/models/feldweg_slope.obj new file mode 100644 index 0000000..dd083f6 --- /dev/null +++ b/mods/cottages/models/feldweg_slope.obj @@ -0,0 +1,84 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg_slope.blend' +# www.blender.org +o Cube +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 -0.625000 -0.500000 +v -0.500000 -0.625000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.250000 -0.586408 -0.500000 +v -0.250000 0.413592 0.500000 +v -0.250000 -0.586408 -0.500000 +v 0.250000 0.413592 0.500000 +v 0.375000 -0.500000 -0.500000 +v -0.375000 0.500000 0.500000 +v -0.125000 -0.625000 -0.500000 +v 0.125000 0.375000 0.500000 +v 0.125000 -0.625000 -0.500000 +v -0.125000 0.375000 0.500000 +v -0.375000 -0.500000 -0.500000 +v 0.375000 0.500000 0.500000 +v -0.000000 -0.005322 0.500000 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.500000 0.494678 +vt 1.000000 0.875000 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.000000 0.875000 +vt 0.000000 0.187500 +vt 1.000000 0.312500 +vt 0.000000 0.312500 +vt 1.000000 0.187500 +vt 1.000000 0.125000 +vt 0.000000 0.125000 +vt 1.000000 0.625000 +vt 1.000000 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.625000 +vt 1.000000 0.250000 +vt 1.000000 0.375000 +vt 0.000000 0.375000 +vt 0.000000 0.250000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +g Cube_Cube_road_ends +s off +f 4/1 20/2 21/3 +f 6/4 2/1 19/2 11/5 15/6 +f 20/2 12/5 21/3 +f 12/5 16/6 21/3 +f 16/6 18/7 21/3 +f 18/7 10/8 21/3 +f 10/8 14/9 21/3 +f 14/9 3/10 21/3 +f 3/10 7/11 21/3 +f 7/11 8/12 21/3 +f 8/12 4/1 21/3 +f 1/10 5/13 17/7 9/8 13/9 +g Cube_Cube_road_ends_default_grass_side.png +f 6/14 7/15 2/16 +f 2/11 7/12 3/1 +f 4/10 8/11 1/12 +f 5/17 1/15 8/16 +g Cube_Cube_bottom +f 8/10 7/11 6/12 5/1 +g Cube_Cube_top_grass +f 19/4 2/1 3/10 14/13 +f 1/12 13/18 20/19 4/11 +g Cube_Cube_road +f 15/20 11/21 10/22 18/23 +f 9/24 17/25 16/26 12/27 +f 15/20 18/23 16/26 17/25 +g Cube_Cube_road-grass_blend +f 13/28 9/20 12/23 20/29 +f 11/21 19/4 14/13 10/22 diff --git a/mods/cottages/models/feldweg_slope_long.obj b/mods/cottages/models/feldweg_slope_long.obj new file mode 100644 index 0000000..976f927 --- /dev/null +++ b/mods/cottages/models/feldweg_slope_long.obj @@ -0,0 +1,108 @@ +# Blender v2.72 (sub 0) OBJ File: 'feldweg_slope_long.blend' +# www.blender.org +o Cube +v 0.500000 -0.500000 -1.500000 +v -0.500000 -0.500000 -1.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v 0.500000 -0.625000 -1.500000 +v -0.500000 -0.625000 -1.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v 0.250000 -0.586408 -1.500000 +v -0.250000 0.413592 0.500000 +v -0.250000 -0.586408 -1.500000 +v 0.250000 0.413592 0.500000 +v 0.375000 -0.500000 -1.500000 +v -0.375000 0.500000 0.500000 +v -0.125000 -0.625000 -1.500000 +v 0.125000 0.375000 0.500000 +v 0.125000 -0.625000 -1.500000 +v -0.125000 0.375000 0.500000 +v -0.375000 -0.500000 -1.500000 +v 0.375000 0.500000 0.500000 +v -0.000000 -0.005322 0.500000 +v -0.250000 -0.086408 -0.500000 +v 0.500000 -0.562500 -0.500000 +v 0.375000 0.000000 -0.500000 +v 0.500000 -0.500000 -0.500000 +v 0.250000 -0.086408 -0.500000 +v -0.500000 -0.562500 -0.500000 +v 0.500000 0.000000 -0.500000 +v -0.500000 0.000000 -0.500000 +v -0.375000 0.000000 -0.500000 +v 0.125000 -0.125000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.125000 -0.125000 -0.500000 +vt 1.000000 1.000000 +vt 0.875000 1.000000 +vt 0.500000 0.494678 +vt 1.000000 0.875000 +vt 0.750000 0.913592 +vt 0.625000 0.875000 +vt 0.375000 0.875000 +vt 0.250000 0.913592 +vt 0.125000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.000000 0.875000 +vt 0.000000 0.250000 +vt 1.000000 0.312500 +vt 0.000000 0.312500 +vt 0.000000 0.500000 +vt 1.000000 0.187500 +vt 1.000000 0.500000 +vt 1.000000 0.250000 +vt 0.000000 0.187500 +vt 1.000000 0.125000 +vt 0.000000 0.125000 +vt 1.000000 0.625000 +vt 1.000000 0.750000 +vt 0.000000 0.750000 +vt 0.000000 0.625000 +vt 1.000000 0.375000 +vt 0.000000 0.375000 +g Cube_Cube_road_ends +s off +f 4/1 20/2 21/3 +f 6/4 2/1 19/2 11/5 15/6 +f 20/2 12/5 21/3 +f 12/5 16/6 21/3 +f 16/6 18/7 21/3 +f 18/7 10/8 21/3 +f 10/8 14/9 21/3 +f 14/9 3/10 21/3 +f 3/10 7/11 21/3 +f 7/11 8/12 21/3 +f 8/12 4/1 21/3 +f 1/10 5/13 17/7 9/8 13/9 +g Cube_Cube_road_ends_default_grass_side.png +f 27/14 7/15 32/16 +f 32/11 7/12 3/1 29/17 +f 28/17 25/11 1/12 +f 5/18 1/15 25/16 23/14 +f 2/11 32/12 29/19 +f 23/20 25/15 8/16 +f 6/21 27/20 32/15 2/16 +f 4/10 8/11 25/12 28/19 +g Cube_Cube_bottom +f 8/11 7/12 27/1 23/10 +f 23/11 27/12 6/1 5/10 +g Cube_Cube_top_grass +f 30/4 29/1 3/10 14/13 +f 28/12 24/22 20/23 4/11 +f 1/12 13/22 24/23 28/11 +f 19/4 2/1 29/10 30/13 +g Cube_Cube_road +f 15/24 11/25 22/26 33/27 +f 26/20 31/28 16/29 12/14 +f 33/24 18/27 16/29 31/28 +f 33/24 22/25 10/26 18/27 +f 9/20 17/28 31/29 26/14 +f 15/24 33/27 31/29 17/28 +g Cube_Cube_road-grass_blend +f 24/19 26/24 12/27 20/17 +f 11/25 19/4 30/13 22/26 +f 22/25 30/4 14/13 10/26 +f 13/19 9/24 26/27 24/17 diff --git a/mods/cottages/nodes_anvil.lua b/mods/cottages/nodes_anvil.lua new file mode 100644 index 0000000..9456ed1 --- /dev/null +++ b/mods/cottages/nodes_anvil.lua @@ -0,0 +1,303 @@ +--------------------------------------------------------------------------------------- +-- simple anvil that can be used to repair tools +--------------------------------------------------------------------------------------- +-- * can be used to repair tools +-- * the hammer gets dammaged a bit at each repair step +--------------------------------------------------------------------------------------- +-- License of the hammer picture: CC-by-SA; done by GloopMaster; source: +-- https://github.com/GloopMaster/glooptest/blob/master/glooptest/textures/glooptest_tool_steelhammer.png + +local S = cottages.S + +-- the hammer for the anvil +minetest.register_tool("cottages:hammer", { + description = S("Steel hammer for repairing tools on the anvil"), + image = "glooptest_tool_steelhammer.png", + inventory_image = "glooptest_tool_steelhammer.png", + + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + -- about equal to a stone pick (it's not intended as a tool) + cracky={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1}, + }, + damage_groups = {fleshy=6}, + } +}) + + +local cottages_anvil_formspec = + "size[8,8]".. + "image[7,3;1,1;glooptest_tool_steelhammer.png]".. +-- "list[current_name;sample;0,0.5;1,1;]".. + "list[current_name;input;2.5,1.5;1,1;]".. +-- "list[current_name;material;5,0;3,3;]".. + "list[current_name;hammer;5,3;1,1;]".. +-- "label[0.0,0.0;Sample:]".. +-- "label[0.0,1.0;(Receipe)]".. + "label[2.5,1.0;"..S("Workpiece:").."]".. +-- "label[6.0,-0.5;Materials:]".. + "label[6.0,2.7;"..S("Optional").."]".. + "label[6.0,3.0;"..S("storage for").."]".. + "label[6.0,3.3;"..S("your hammer").."]".. + + "label[0,-0.5;"..S("Anvil").."]".. + "label[0,3.0;"..S("Punch anvil with hammer to").."]".. + "label[0,3.3;"..S("repair tool in workpiece-slot.").."]".. + "list[current_player;main;0,4;8,4;]"; + + +minetest.register_node("cottages:anvil", { + drawtype = "nodebox", + description = S("anvil"), + tiles = {"cottages_stone.png"}, -- TODO default_steel_block.png, default_obsidian.png are also nice + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=2}, + -- the nodebox model comes from realtest + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.3,0.5,-0.4,0.3}, + {-0.35,-0.4,-0.25,0.35,-0.3,0.25}, + {-0.3,-0.3,-0.15,0.3,-0.1,0.15}, + {-0.35,-0.1,-0.2,0.35,0.1,0.2}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.3,0.5,-0.4,0.3}, + {-0.35,-0.4,-0.25,0.35,-0.3,0.25}, + {-0.3,-0.3,-0.15,0.3,-0.1,0.15}, + {-0.35,-0.1,-0.2,0.35,0.1,0.2}, + } + }, + on_construct = function(pos) + + local meta = minetest.get_meta(pos); + meta:set_string("infotext", S("Anvil")); + local inv = meta:get_inventory(); + inv:set_size("input", 1); +-- inv:set_size("material", 9); +-- inv:set_size("sample", 1); + inv:set_size("hammer", 1); + meta:set_string("formspec", cottages_anvil_formspec ); + end, + + 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", S("Anvil (owned by %s)"):format((meta:get_string("owner") or ""))); + meta:set_string("formspec", + cottages_anvil_formspec, + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"); + end, + + can_dig = function(pos,player) + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + local owner = meta:get_string('owner'); + + if( not( inv:is_empty("input")) +-- or not( inv:is_empty("material")) +-- or not( inv:is_empty("sample")) + or not( inv:is_empty("hammer")) + or not( player ) + or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then + + return false; + end + return true; + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + if( player and player:get_player_name() ~= meta:get_string('owner' ) and from_list~="input") then + return 0 + end + return count; + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then + return 0; + end + if( listname=='hammer' and stack and stack:get_name() ~= 'cottages:hammer') then + return 0; + end + if( listname=='input' + and( stack:get_wear() == 0 + or stack:get_name() == "technic:water_can" + or stack:get_name() == "technic:lava_can" )) then + + minetest.chat_send_player( player:get_player_name(), + S('The workpiece slot is for damaged tools only.')); + 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( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then + return 0 + end + return stack:get_count() + end, + + + on_punch = function(pos, node, puncher) + if( not( pos ) or not( node ) or not( puncher )) then + return; + end + -- only punching with the hammer is supposed to work + local wielded = puncher:get_wielded_item(); + if( not( wielded ) or not( wielded:get_name() ) or wielded:get_name() ~= 'cottages:hammer') then + return; + end + local name = puncher:get_player_name(); + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + + local input = inv:get_stack('input',1); + + -- only tools can be repaired + if( not( input ) + or input:is_empty() + or input:get_name() == "technic:water_can" + or input:get_name() == "technic:lava_can" ) then + + meta:set_string("formspec", + cottages_anvil_formspec, + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"); + return; + end + + -- 65535 is max damage + local damage_state = 40-math.floor(input:get_wear()/1638); + + local tool_name = input:get_name(); + local hud_image = ""; + if( tool_name + and minetest.registered_items[ tool_name ] ) then + if( minetest.registered_items[ tool_name ].inventory_image ) then + hud_image = minetest.registered_items[ tool_name ].inventory_image; + elseif( minetest.registered_items[ tool_name ].textures + and type(minetest.registered_items[ tool_name ].textures)=='table') then + hud_image = minetest.registered_items[ tool_name ].textures[1]; + elseif( minetest.registered_items[ tool_name ].textures + and type(minetest.registered_items[ tool_name ].textures)=='string') then + hud_image = minetest.registered_items[ tool_name ].textures; + end + end + + local hud1 = puncher:hud_add({ + hud_elem_type = "image", + scale = {x = 15, y = 15}, + text = hud_image, + position = {x = 0.5, y = 0.5}, + alignment = {x = 0, y = 0} + }); + local hud2 = nil; + local hud3 = nil; + if( input:get_wear()>0 ) then + hud2 = puncher:hud_add({ + hud_elem_type = "statbar", + text = "default_cloud.png^[colorize:#ff0000:256", + number = 40, + direction = 0, -- left to right + position = {x=0.5, y=0.65}, + alignment = {x = 0, y = 0}, + offset = {x = -320, y = 0}, + size = {x=32, y=32}, + }) + hud3 = puncher:hud_add({ + hud_elem_type = "statbar", + text = "default_cloud.png^[colorize:#00ff00:256", + number = damage_state, + direction = 0, -- left to right + position = {x=0.5, y=0.65}, + alignment = {x = 0, y = 0}, + offset = {x = -320, y = 0}, + size = {x=32, y=32}, + }); + end + minetest.after(2, function() + if( puncher ) then + puncher:hud_remove(hud1); + puncher:hud_remove(hud2); + puncher:hud_remove(hud3); + end + end) + + -- tell the player when the job is done + if( input:get_wear() == 0 ) then +-- minetest.chat_send_player( puncher:get_player_name(), +-- S('Your tool has been repaired successfully.')); + return; + end + + -- do the actual repair + input:add_wear( -5000 ); -- equals to what technic toolshop does in 5 seconds + inv:set_stack("input", 1, input) + + -- damage the hammer slightly + wielded:add_wear( 100 ); + puncher:set_wielded_item( wielded ); + + -- do not spam too much +-- if( math.random( 1,5 )==1 ) then +-- minetest.chat_send_player( puncher:get_player_name(), +-- S('Your workpiece improves.')); +-- end + end, + is_ground_content = false, +}) + + + +--------------------------------------------------------------------------------------- +-- crafting receipes +--------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "cottages:anvil", + recipe = { + {cottages.craftitem_steel,cottages.craftitem_steel,cottages.craftitem_steel}, + {'', cottages.craftitem_steel,'' }, + {cottages.craftitem_steel,cottages.craftitem_steel,cottages.craftitem_steel} }, +}) + + +-- the castle-mod has an anvil as well - with the same receipe. convert the two into each other +if ( minetest.get_modpath("castle") ~= nil ) then + + minetest.register_craft({ + output = "cottages:anvil", + recipe = { + {'castle:anvil'}, + }, + }) + + minetest.register_craft({ + output = "castle:anvil", + recipe = { + {'cottages:anvil'}, + }, + }) +end + + + +minetest.register_craft({ + output = "cottages:hammer", + recipe = { + {cottages.craftitem_steel}, + {'cottages:anvil'}, + {cottages.craftitem_stick} } +}) + diff --git a/mods/cottages/nodes_barrel.lua b/mods/cottages/nodes_barrel.lua new file mode 100644 index 0000000..4c84983 --- /dev/null +++ b/mods/cottages/nodes_barrel.lua @@ -0,0 +1,214 @@ + +--------------------------------------------------------------------- +-- a barrel and a tub - plus a function that makes 'round' objects +--------------------------------------------------------------------- +-- IMPORTANT NOTE: The barrel requires a lot of nodeboxes. That may be +-- too much for weak hardware! +--------------------------------------------------------------------- +-- Functionality: right-click to open/close a barrel; +-- punch a barrel to change between vertical/horizontal +--------------------------------------------------------------------- +-- Changelog: +-- 24.03.13 Can no longer be opended/closed on rightclick because that is now used for a formspec; +-- instead, it can be filled with liquids. +-- Filled barrels will always be closed, while empty barrels will always be open. + +-- pipes: table with the following entries for each pipe-part: +-- f: radius factor; if 1, it will have a radius of half a nodebox and fill the entire nodebox +-- h1, h2: height at witch the nodebox shall start and end; usually -0.5 and 0.5 for a full nodebox +-- b: make a horizontal part/shelf +-- horizontal: if 1, then x and y coordinates will be swapped + +-- TODO: option so that it works without nodeboxes + +local S = cottages.S + +barrel = {}; + +-- prepare formspec +barrel.on_construct = function( pos ) + + local meta = minetest.get_meta(pos); + local percent = math.random( 1, 100 ); -- TODO: show real filling + + meta:set_string( 'formspec', + "size[8,9]".. + "image[2.6,2;2,3;default_sandstone.png^[lowpart:".. + (100-percent)..":default_desert_stone.png]".. -- TODO: better images + "label[2.2,0;"..S("Pour:").."]".. + "list[current_name;input;3,0.5;1,1;]".. + "label[5,3.3;"..S("Fill:").."]".. + "list[current_name;output;5,3.8;1,1;]".. + "list[current_player;main;0,5;8,4;]"); + + + meta:set_string( 'liquid_type', '' ); -- which liquid is in the barrel? + meta:set_int( 'liquid_level', 0 ); -- how much of the liquid is in there? + + local inv = meta:get_inventory() + inv:set_size("input", 1); -- to fill in new liquid + inv:set_size("output", 1); -- to extract liquid +end + + +-- can only be digged if there are no more vessels/buckets in any of the slots +-- TODO: allow digging of a filled barrel? this would disallow stacking of them +barrel.can_dig = function( pos, player ) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + + return ( inv:is_empty('input') + and inv:is_empty('output')); +end + + +-- the barrel received input; either a new liquid that is to be poured in or a vessel that is to be filled +barrel.on_metadata_inventory_put = function( pos, listname, index, stack, player ) +end + + +-- right-click to open/close barrel; punch to switch between horizontal/vertical position + minetest.register_node("cottages:barrel", { + description = S("barrel (closed)"), + paramtype = "light", + drawtype = "mesh", + mesh = "cottages_barrel_closed.obj", + tiles = {"cottages_barrel.png" }, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2 + }, + drop = "cottages:barrel", +-- on_rightclick = function(pos, node, puncher) +-- minetest.add_node(pos, {name = "cottages:barrel_open", param2 = node.param2}) +-- end, +-- TODO: on_rightclick is no longer available - maybe open if empty and closed if full? + on_punch = function(pos, node, puncher) + minetest.add_node(pos, {name = "cottages:barrel_lying", param2 = node.param2}) + end, + + on_construct = function( pos ) + return barrel.on_construct( pos ); + end, + can_dig = function(pos,player) + return barrel.can_dig( pos, player ); + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + return barrel.on_metadata_inventory_put( pos, listname, index, stack, player ); + end, + is_ground_content = false, + + }) + + -- this barrel is opened at the top + minetest.register_node("cottages:barrel_open", { + description = S("barrel (open)"), + paramtype = "light", + drawtype = "mesh", + mesh = "cottages_barrel.obj", + tiles = {"cottages_barrel.png" }, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory=1, + }, + drop = "cottages:barrel", +-- on_rightclick = function(pos, node, puncher) +-- minetest.add_node(pos, {name = "cottages:barrel", param2 = node.param2}) +-- end, + on_punch = function(pos, node, puncher) + minetest.add_node(pos, {name = "cottages:barrel_lying_open", param2 = node.param2}) + end, + is_ground_content = false, + }) + + -- horizontal barrel + minetest.register_node("cottages:barrel_lying", { + description = S("barrel (closed), lying somewhere"), + paramtype = "light", + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "cottages_barrel_closed_lying.obj", + tiles = {"cottages_barrel.png" }, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory=1, + }, + drop = "cottages:barrel", + on_rightclick = function(pos, node, puncher) + minetest.add_node(pos, {name = "cottages:barrel_lying_open", param2 = node.param2}) + end, + on_punch = function(pos, node, puncher) + if( node.param2 < 4 ) then + minetest.add_node(pos, {name = "cottages:barrel_lying", param2 = (node.param2+1)}) + else + minetest.add_node(pos, {name = "cottages:barrel", param2 = 0}) + end + end, + is_ground_content = false, + }) + + -- horizontal barrel, open + minetest.register_node("cottages:barrel_lying_open", { + description = S("barrel (opened), lying somewhere"), + paramtype = "light", + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "cottages_barrel_lying.obj", + tiles = {"cottages_barrel.png" }, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory=1, + }, + drop = "cottages:barrel", + on_rightclick = function(pos, node, puncher) + minetest.add_node(pos, {name = "cottages:barrel_lying", param2 = node.param2}) + end, + on_punch = function(pos, node, puncher) + if( node.param2 < 4 ) then + minetest.add_node(pos, {name = "cottages:barrel_lying_open", param2 = (node.param2+1)}) + else + minetest.add_node(pos, {name = "cottages:barrel_open", param2 = 0}) + end + end, + is_ground_content = false, + + }) + + -- let's hope "tub" is the correct english word for "bottich" + minetest.register_node("cottages:tub", { + description = S("tub"), + paramtype = "light", + drawtype = "mesh", + mesh = "cottages_tub.obj", + tiles = {"cottages_barrel.png" }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5,-0.1, 0.5}, + }}, + collision_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5,-0.1, 0.5}, + }}, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2 + }, + is_ground_content = false, + }) + + +minetest.register_craft({ + output = "cottages:barrel", + recipe = { + {cottages.craftitem_wood, "", cottages.craftitem_wood }, + {cottages.craftitem_steel, "", cottages.craftitem_steel}, + {cottages.craftitem_wood, cottages.craftitem_wood, cottages.craftitem_wood }, + }, +}) + +minetest.register_craft({ + output = "cottages:tub 2", + recipe = { + {"cottages:barrel"}, + }, +}) + +minetest.register_craft({ + output = "cottages:barrel", + recipe = { + {"cottages:tub"}, + {"cottages:tub"}, + }, +}) diff --git a/mods/cottages/nodes_chests.lua b/mods/cottages/nodes_chests.lua new file mode 100644 index 0000000..c099749 --- /dev/null +++ b/mods/cottages/nodes_chests.lua @@ -0,0 +1,61 @@ + +-- TODO: make these chests as chests and indicate that they are owned by npc +-- TODO: add bags (not for carrying around but for decoration) + +-- Boilerplate to support localized strings if intllib mod is installed. +local S = cottages.S + +cottages_chests = {} +-- uses default.chest_formspec for now +cottages_chests.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec",default.chest_formspec) +-- meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + +cottages_chests.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end + +-- the chests do not need receipes since they are only placeholders and not intended to be built by players +-- (they are later on supposed to be filled with diffrent items by fill_chest.lua) +minetest.register_node("cottages:chest_private", { + description = S("private NPC chest"), + infotext = "chest containing the possesions of one of the inhabitants", + tiles = cottages.texture_chest, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + on_construct = cottages_chests.on_construct, + can_dig = cottages_chests.can_dig, + is_ground_content = false, +}) + +minetest.register_node("cottages:chest_work", { + description = S("chest for work utils and kitchens"), + infotext = "everything the inhabitant needs for his work", + tiles = cottages.texture_chest, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + on_construct = cottages_chests.on_construct, + can_dig = cottages_chests.can_dig, + is_ground_content = false, +}) + +minetest.register_node("cottages:chest_storage", { + description = S("storage chest"), + infotext = "stored food reserves", + tiles = cottages.texture_chest, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + on_construct = cottages_chests.on_construct, + can_dig = cottages_chests.can_dig, + is_ground_content = false, +}) + diff --git a/mods/cottages/nodes_doorlike.lua b/mods/cottages/nodes_doorlike.lua new file mode 100644 index 0000000..d989c05 --- /dev/null +++ b/mods/cottages/nodes_doorlike.lua @@ -0,0 +1,437 @@ + +----------------------------------------------------------------------------------------------------------- +-- These nodes are all like doors in a way: +-- * window shutters (they open on right-click and when it turns day; they close at night) +-- * a half-door where the top part can be opened seperately from the bottom part +-- * a gate that drops to the floor when opened +-- +----------------------------------------------------------------------------------------------------------- +-- IMPORTANT NOTICE: If you have a very slow computer, it might be wise to increase the rate at which the +-- abm that opens/closes the window shutters is called. Anything less than 10 minutes +-- (600 seconds) ought to be ok. +----------------------------------------------------------------------------------------------------------- +local S = cottages.S + +----------------------------------------------------------------------------------------------------------- +-- small window shutters for single-node-windows; they open at day and close at night if the abm is working +----------------------------------------------------------------------------------------------------------- + +-- propagate shutting/closing of window shutters to window shutters below/above this one +cottages_window_sutter_operate = function( pos, old_node_state_name, new_node_state_name ) + + local offsets = {-1,1,-2,2,-3,3}; + local stop_up = 0; + local stop_down = 0; + + for i,v in ipairs(offsets) do + + local node = minetest.get_node_or_nil( {x=pos.x, y=(pos.y+v), z=pos.z } ); + if( node and node.name and node.name==old_node_state_name + and ( (v > 0 and stop_up == 0 ) + or (v < 0 and stop_down == 0 ))) then + + minetest.swap_node({x=pos.x, y=(pos.y+v), z=pos.z }, {name = new_node_state_name, param2 = node.param2}) + + -- found a diffrent node - no need to search further up + elseif( v > 0 and stop_up == 0 ) then + stop_up = 1; + + elseif( v < 0 and stop_down == 0 ) then + stop_down = 1; + end + end +end + +-- window shutters - they cover half a node to each side +minetest.register_node("cottages:window_shutter_open", { + description = S("opened window shutters"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem + node_box = { + type = "fixed", + fixed = { + {-0.90, -0.5, 0.4, -0.45, 0.5, 0.5}, + { 0.45, -0.5, 0.4, 0.9, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.9, -0.5, 0.4, 0.9, 0.5, 0.5}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.swap_node(pos, {name = "cottages:window_shutter_closed", param2 = node.param2}) + cottages_window_sutter_operate( pos, "cottages:window_shutter_open", "cottages:window_shutter_closed" ); + end, + is_ground_content = false, +}) + +minetest.register_node("cottages:window_shutter_closed", { + description = S("closed window shutters"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, -0.05, 0.5, 0.5}, + { 0.05, -0.5, 0.4, 0.5, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.swap_node(pos, {name = "cottages:window_shutter_open", param2 = node.param2}) + cottages_window_sutter_operate( pos, "cottages:window_shutter_closed", "cottages:window_shutter_open" ); + end, + is_ground_content = false, + drop = "cottages:window_shutter_open", +}) + + +-- open shutters in the morning +minetest.register_abm({ + nodenames = {"cottages:window_shutter_closed"}, + interval = 20, -- change this to 600 if your machine is too slow + chance = 3, -- not all people wake up at the same time! + action = function(pos) + + -- at this time, sleeping in a bed is not possible + if( not(minetest.get_timeofday() < 0.2 or minetest.get_timeofday() > 0.805)) then + local old_node = minetest.get_node( pos ); + minetest.swap_node(pos, {name = "cottages:window_shutter_open", param2 = old_node.param2}) + cottages_window_sutter_operate( pos, "cottages:window_shutter_closed", "cottages:window_shutter_open" ); + end + end +}) + + +-- close them at night +minetest.register_abm({ + nodenames = {"cottages:window_shutter_open"}, + interval = 20, -- change this to 600 if your machine is too slow + chance = 2, + action = function(pos) + + -- same time at which sleeping is allowed in beds + if( minetest.get_timeofday() < 0.2 or minetest.get_timeofday() > 0.805) then + local old_node = minetest.get_node( pos ); + minetest.swap_node(pos, {name = "cottages:window_shutter_closed", param2 = old_node.param2}) + cottages_window_sutter_operate( pos, "cottages:window_shutter_open", "cottages:window_shutter_closed" ); + end + end +}) + + +------------------------------------------------------------------------------------------------------------------------------ +-- a half door; can be combined to a full door where the upper part can be operated seperately; usually found in barns/stables +------------------------------------------------------------------------------------------------------------------------------ +minetest.register_node("cottages:half_door", { + description = S("half door"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.48, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.48, 0.5, 0.5}, + }, + }, + on_rightclick = function(pos, node, puncher) + local node2 = minetest.get_node( {x=pos.x,y=(pos.y+1),z=pos.z}); + + local param2 = node.param2; + if( param2%4 == 1) then param2 = param2+1; --2; + elseif( param2%4 == 2) then param2 = param2-1; --1; + elseif( param2%4 == 3) then param2 = param2-3; --0; + elseif( param2%4 == 0) then param2 = param2+3; --3; + end; + minetest.swap_node(pos, {name = "cottages:half_door", param2 = param2}) + -- if the node above consists of a door of the same type, open it as well + -- Note: doors beneath this one are not opened! It is a special feature of these doors that they can be opend partly + if( node2 ~= nil and node2.name == node.name and node2.param2==node.param2) then + minetest.swap_node( {x=pos.x,y=(pos.y+1),z=pos.z}, {name = "cottages:half_door", param2 = param2}) + end + end, + is_ground_content = false, +}) + + + +minetest.register_node("cottages:half_door_inverted", { + description = S("half door inverted"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.48, 0.5, -0.4}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.48, 0.5, -0.4}, + }, + }, + on_rightclick = function(pos, node, puncher) + local node2 = minetest.get_node( {x=pos.x,y=(pos.y+1),z=pos.z}); + + local param2 = node.param2; + if( param2%4 == 1) then param2 = param2-1; --0; + elseif( param2%4 == 0) then param2 = param2+1; --1; + elseif( param2%4 == 2) then param2 = param2+1; --3; + elseif( param2%4 == 3) then param2 = param2-1; --2; + end; + minetest.swap_node(pos, {name = "cottages:half_door_inverted", param2 = param2}) + -- open upper parts of this door (if there are any) + if( node2 ~= nil and node2.name == node.name and node2.param2==node.param2) then + minetest.swap_node( {x=pos.x,y=(pos.y+1),z=pos.z}, {name = "cottages:half_door_inverted", param2 = param2}) + end + end, + is_ground_content = false, +}) + + + + +------------------------------------------------------------------------------------------------------------------------------ +-- this gate for fences solves the "where to store the opened gate" problem by dropping it to the floor in optened state +------------------------------------------------------------------------------------------------------------------------------ +minetest.register_node("cottages:gate_closed", { + description = S("closed fence gate"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {cottages.texture_furniture}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.85, -0.25, -0.02, 0.85, -0.05, 0.02}, + { -0.85, 0.15, -0.02, 0.85, 0.35, 0.02}, + + { -0.80, -0.05, -0.02, -0.60, 0.15, 0.02}, + { 0.60, -0.05, -0.02, 0.80, 0.15, 0.02}, + { -0.15, -0.05, -0.02, 0.15, 0.15, 0.02}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.85, -0.25, -0.1, 0.85, 0.35, 0.1}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.swap_node(pos, {name = "cottages:gate_open", param2 = node.param2}) + end, + is_ground_content = false, +}) + + +minetest.register_node("cottages:gate_open", { + description = S("opened fence gate"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {cottages.texture_furniture}, + paramtype = "light", + paramtype2 = "facedir", + drop = "cottages:gate_closed", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + node_box = { + type = "fixed", + fixed = { + { -0.85, -0.5, -0.25, 0.85, -0.46, -0.05}, + { -0.85, -0.5, 0.15, 0.85, -0.46, 0.35}, + + { -0.80, -0.5, -0.05, -0.60, -0.46, 0.15}, + { 0.60, -0.5, -0.05, 0.80, -0.46, 0.15}, + { -0.15, -0.5, -0.05, 0.15, -0.46, 0.15}, + + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.85, -0.5, -0.25, 0.85, -0.3, 0.35}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.swap_node(pos, {name = "cottages:gate_closed", param2 = node.param2}) + end, + is_ground_content = false, + drop = "cottages:gate_closed", +}) + + + +----------------------------------------------------------------------------------------------------------- +-- a hatch; nodebox definition taken from realtest +----------------------------------------------------------------------------------------------------------- + +-- hatches rotate around their axis +-- old facedir: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 +new_facedirs = { 10,19, 4,13, 2,18,22,14,20,16, 0,12,11, 3, 7,21, 9,23, 5, 1, 8,15, 6,17}; + + +cottages.register_hatch = function( nodename, description, texture, receipe_item ) + + minetest.register_node( nodename, { + description = S(description), -- not that there are any other... + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = { texture }, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + + node_box = { + type = "fixed", + fixed = { + {-0.49, -0.55, -0.49, -0.3, -0.45, 0.45}, +-- {-0.5, -0.55, 0.3, 0.3, -0.45, 0.5}, + {0.3, -0.55, -0.3, 0.49, -0.45, 0.45}, + {0.49, -0.55, -0.49, -0.3, -0.45, -0.3}, + {-0.075, -0.55, -0.3, 0.075, -0.45, 0.3}, + {-0.3, -0.55, -0.075, -0.075, -0.45, 0.075}, + {0.075, -0.55, -0.075, 0.3, -0.45, 0.075}, + + {-0.3, -0.55, 0.3, 0.3, -0.45, 0.45}, + + -- hinges + {-0.45,-0.530, 0.45, -0.15,-0.470, 0.525}, + { 0.15,-0.530, 0.45, 0.45,-0.470, 0.525}, + + -- handle + {-0.05,-0.60,-0.35, 0.05,-0.40,-0.45}, + }, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.55, -0.5, 0.5, -0.45, 0.5}, + }, + on_rightclick = function(pos, node, puncher) + + minetest.swap_node(pos, {name = node.name, param2 = new_facedirs[ node.param2+1 ]}) + end, + is_ground_content = false, + on_place = minetest.rotate_node, + }) + + minetest.register_craft({ + output = nodename, + recipe = { + { '', '', receipe_item }, + { receipe_item, cottages.craftitem_stick, '' }, + { '', '', '' }, + } + }) +end + + +-- further alternate hatch materials: wood, tree, copper_block +cottages.register_hatch( 'cottages:hatch_wood', 'wooden hatch', 'cottages_minimal_wood.png', cottages.craftitem_slab_wood ); +cottages.register_hatch( 'cottages:hatch_steel', 'metal hatch', 'cottages_steel_block.png', cottages.craftitem_steel ); + + + + +----------------------------------------------------------------------------------------------------------- +-- and now the crafting receipes: +----------------------------------------------------------------------------------------------------------- + +-- transform opend and closed shutters into each other for convenience +minetest.register_craft({ + output = "cottages:window_shutter_open", + recipe = { + {"cottages:window_shutter_closed" }, + } +}) + +minetest.register_craft({ + output = "cottages:window_shutter_closed", + recipe = { + {"cottages:window_shutter_open" }, + } +}) + +minetest.register_craft({ + output = "cottages:window_shutter_open", + recipe = { + {cottages.craftitem_wood, "", cottages.craftitem_wood }, + } +}) + +-- transform one half door into another +minetest.register_craft({ + output = "cottages:half_door", + recipe = { + {"cottages:half_door_inverted" }, + } +}) + +minetest.register_craft({ + output = "cottages:half_door_inverted", + recipe = { + {"cottages:half_door" }, + } +}) + +minetest.register_craft({ + output = "cottages:half_door 2", + recipe = { + {"", cottages.craftitem_wood, "" }, + {"", cottages.craftitem_door, "" }, + } +}) + + +-- transform open and closed versions into into another for convenience +minetest.register_craft({ + output = "cottages:gate_closed", + recipe = { + {"cottages:gate_open" }, + } +}) + +minetest.register_craft({ + output = "cottages:gate_open", + recipe = { + {"cottages:gate_closed"}, + } +}) + +minetest.register_craft({ + output = "cottages:gate_closed", + recipe = { + {cottages.craftitem_stick, cottages.craftitem_stick, cottages.craftitem_wood }, + } +}) + diff --git a/mods/cottages/nodes_feldweg.lua b/mods/cottages/nodes_feldweg.lua new file mode 100644 index 0000000..bb21479 --- /dev/null +++ b/mods/cottages/nodes_feldweg.lua @@ -0,0 +1,406 @@ +--------------------------------------------------------------------------------------- +-- decoration and building material +--------------------------------------------------------------------------------------- +-- * includes a wagon wheel that can be used as decoration on walls or to build (stationary) wagons +-- * dirt road - those are more natural in small old villages than cobble roads +-- * loam - no, old buildings are usually not built out of clay; loam was used +-- * straw - useful material for roofs +-- * glass pane - an improvement compared to fence posts as windows :-) +--------------------------------------------------------------------------------------- + +local S = cottages.S + +-- supported modes: +-- * simple: only a straight dirt road; no curves, junctions etc. +-- * flat: each node is a full node; junction, t-junction and corner are included +-- * nodebox: like flat - except that each node has a nodebox that fits to that road node +-- * mesh: like nodebox - except that it uses a nice roundish model +if( not( cottages_feldweg_mode )) then + cottages_feldweg_mode = "mesh"; +end + +--- a nice dirt road for small villages or paths to fields +if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then + minetest.register_node("cottages:feldweg", { + description = S("dirt road"), + tiles = {"cottages_feldweg.png","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + }) +end + +-- add crossing, t-junction and corner + +-- +-- flat - just textures, full blocks +-- +if( cottages_feldweg_mode == "flat" ) then + + minetest.register_node("cottages:feldweg_crossing", { + description = S("dirt road crossing"), + tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + }) + + minetest.register_node("cottages:feldweg_t_junction", { + description = S("dirt road t junction"), + tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + }) + + minetest.register_node("cottages:feldweg_curve", { + description = S("dirt road curve"), + tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + }) + +-- +-- cube-style nodebox version +-- +elseif( cottages_feldweg_mode == "nodebox" ) then + minetest.register_node("cottages:feldweg", { + description = S("dirt road"), + tiles = {"cottages_feldweg_orig.png","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + roups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5}, + -- Rasenkanten + { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, 0.5}, + { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5}, + -- uebergang zwischen Wagenspur und Rasenkante + { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, 0.5}, + { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + }, + }) + + minetest.register_node("cottages:feldweg_crossing", { + description = S("dirt road crossing"), + tiles = {"cottages_feldweg_kreuzung.png","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5}, + -- Rasenkanten + { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, -0.5+3/16}, + { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, -0.5+3/16}, + + { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5}, + { 0.5-3/16, 0.5-2/16, 0.5-3/16, 0.5, 0.5, 0.5}, + -- uebergang zwischen Wagenspur und Rasenkante + { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, -0.5+4/16}, + { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, -0.5+4/16}, + + { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5}, + { 0.5-4/16, 0.5-2/16, 0.5-4/16, 0.5-3/16, 0.5-1/16, 0.5}, + + + { -0.5, 0.5-2/16, -0.5+3/16, -0.5+3/16, 0.5-1/16, -0.5+4/16}, + { 0.5-3/16, 0.5-2/16, -0.5+3/16, 0.5, 0.5-1/16, -0.5+4/16}, + + { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16}, + { 0.5-3/16, 0.5-2/16, 0.5-4/16, 0.5, 0.5-1/16, 0.5-3/16}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + }, + }) + + minetest.register_node("cottages:feldweg_t_junction", { + description = S("dirt road t junction"), + tiles = {"cottages_feldweg_t-kreuzung.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5}, + -- Rasenkanten + { -0.5, 0.5-2/16, -0.5, -0.5+3/16, 0.5, -0.5+3/16}, + + { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5}, + -- Rasenkante seitlich durchgehend + { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5}, + -- uebergang zwischen Wagenspur und Rasenkante + { -0.5+3/16, 0.5-2/16, -0.5, -0.5+4/16, 0.5-1/16, -0.5+4/16}, + + { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5}, + + + { -0.5, 0.5-2/16, -0.5+3/16, -0.5+3/16, 0.5-1/16, -0.5+4/16}, + + { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16}, + -- Ueberganng seitlich durchgehend + { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + }, + }) + + minetest.register_node("cottages:feldweg_curve", { + description = S("dirt road curve"), + tiles = {"cottages_feldweg_ecke.png^[transform2","default_dirt.png", "default_dirt.png^default_grass_side.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5-2/16, 0.5}, + -- Rasenkante vorne durchgehend + { -0.5, 0.5-2/16, -0.5, 0.5-3/16, 0.5, -0.5+3/16}, + + -- Rasenkanten + { -0.5, 0.5-2/16, 0.5-3/16, -0.5+3/16, 0.5, 0.5}, + -- Rasenkante seitlich durchgehend + { 0.5-3/16, 0.5-2/16, -0.5, 0.5, 0.5, 0.5}, + -- uebergang zwischen Wagenspur und Rasenkante + { -0.5+3/16, 0.5-2/16, 0.5-4/16, -0.5+4/16, 0.5-1/16, 0.5}, + + + -- Uebergang vorne durchgehend + { -0.5, 0.5-2/16, -0.5+3/16, 0.5-3/16, 0.5-1/16, -0.5+4/16}, + + { -0.5, 0.5-2/16, 0.5-4/16, -0.5+3/16, 0.5-1/16, 0.5-3/16}, + -- Ueberganng seitlich durchgehend + { 0.5-4/16, 0.5-2/16, -0.5, 0.5-3/16, 0.5-1/16, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + }, + }) + + +-- +-- the mesh version (rounded); provided and created by VanessaE +-- +elseif( cottages_feldweg_mode == "mesh" ) then + + -- a nice dirt road for small villages or paths to fields + minetest.register_node("cottages:feldweg", { + description = S("dirt road"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", + "default_dirt.png", "default_grass.png", + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg.obj", + }) + + + minetest.register_node("cottages:feldweg_crossing", { + description = S("dirt road crossing"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png", + "default_grass.png","cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-crossing.obj", + }) + + minetest.register_node("cottages:feldweg_t_junction", { + description = S("dirt road t junction"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", + "default_grass.png","cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-T-junction.obj", + }) + + minetest.register_node("cottages:feldweg_curve", { + description = S("dirt road curve"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"default_dirt.png^default_grass_side.png","default_grass.png", + "default_dirt.png^default_grass_side.png","cottages_feldweg_surface.png", + "default_dirt.png","cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-curve.obj", + }) + + minetest.register_node("cottages:feldweg_end", { + description = S("dirt road end"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", + "default_dirt.png", "default_grass.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + "cottages_feldweg_surface.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg_end.obj", + }) +end + + +-- create stairs if possible +if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then + stairs.register_stair_and_slab("feldweg", "cottages:feldweg", + {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + {"cottages_feldweg.png","default_dirt.png", "default_grass.png","default_grass.png","cottages_feldweg.png","cottages_feldweg.png"}, + S("Dirt Road Stairs"), + S("Dirt Road, half height"), + default.node_sound_dirt_defaults) +end + +if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then + local box_slope = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5} + }}; + + local box_slope_long = { + type = "fixed", + fixed = { + {-0.5, -0.5, -1.5, 0.5, -0.10, 0.5}, + {-0.5, -0.25, -1.3, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -1.0, 0.5, 0, 0.5}, + {-0.5, 0, -0.5, 0.5, 0.25, 0.5}, + {-0.5, 0.25, 0, 0.5, 0.5, 0.5} + }}; + + minetest.register_node("cottages:feldweg_slope", { + description = S("dirt road slope"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", + "default_dirt.png", "default_grass.png", + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg_slope.obj", + + collision_box = box_slope, + selection_box = box_slope, + }) + + minetest.register_node("cottages:feldweg_slope_long", { + description = S("dirt road slope long"), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", + "default_dirt.png", "default_grass.png", + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg_slope_long.obj", + collision_box = box_slope_long, + selection_box = box_slope_long, + }) +end diff --git a/mods/cottages/nodes_fences.lua b/mods/cottages/nodes_fences.lua new file mode 100644 index 0000000..0a4a26f --- /dev/null +++ b/mods/cottages/nodes_fences.lua @@ -0,0 +1,159 @@ +-- 22.01.13 Changed texture to that of the wood from the minimal development game + +local S = cottages.S + +minetest.register_node("cottages:fence_small", { + description = S("small fence"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, + { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, + { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, + + { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, + { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.50, -0.50, 0.4, 0.50, 0.50, 0.5}, + }, + }, + is_ground_content = false, +}) + + +minetest.register_node("cottages:fence_corner", { + description = S("small fence corner"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, + { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, + { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, + + { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, + { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, + + { 0.46, -0.35, -0.45, 0.50, -0.20, 0.45}, + { 0.46, 0.00, -0.45, 0.50, 0.15, 0.45}, + { 0.46, 0.35, -0.45, 0.50, 0.50, 0.45}, + + { 0.46, -0.50, -0.50, 0.50, 0.50, -0.45}, + { 0.46, -0.50, 0.45, 0.50, 0.50, 0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.50, -0.50,-0.5, 0.50, 0.50, 0.5}, + }, + }, + is_ground_content = false, +}) + + +minetest.register_node("cottages:fence_end", { + description = S("small fence end"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.45, -0.35, 0.46, 0.45, -0.20, 0.50}, + { -0.45, 0.00, 0.46, 0.45, 0.15, 0.50}, + { -0.45, 0.35, 0.46, 0.45, 0.50, 0.50}, + + { -0.50, -0.50, 0.46, -0.45, 0.50, 0.50}, + { 0.45, -0.50, 0.46, 0.50, 0.50, 0.50}, + + { 0.46, -0.35, -0.45, 0.50, -0.20, 0.45}, + { 0.46, 0.00, -0.45, 0.50, 0.15, 0.45}, + { 0.46, 0.35, -0.45, 0.50, 0.50, 0.45}, + + { 0.46, -0.50, -0.50, 0.50, 0.50, -0.45}, + { 0.46, -0.50, 0.45, 0.50, 0.50, 0.50}, + + { -0.50, -0.35, -0.45, -0.46, -0.20, 0.45}, + { -0.50, 0.00, -0.45, -0.46, 0.15, 0.45}, + { -0.50, 0.35, -0.45, -0.46, 0.50, 0.45}, + + { -0.50, -0.50, -0.50, -0.46, 0.50, -0.45}, + { -0.50, -0.50, 0.45, -0.46, 0.50, 0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.50, -0.50,-0.5, 0.50, 0.50, 0.5}, + }, + }, + is_ground_content = false, +}) + +minetest.register_craft({ + output = "cottages:fence_small 3", + recipe = { + {cottages.craftitem_fence, cottages.craftitem_fence}, + } +}) + +-- xfences can be configured to replace normal fences - which makes them uncraftable +if ( minetest.get_modpath("xfences") ~= nil ) then + minetest.register_craft({ + output = "cottages:fence_small 3", + recipe = { + {"xfences:fence","xfences:fence" }, + } + }) +end + +minetest.register_craft({ + output = "cottages:fence_corner", + recipe = { + {"cottages:fence_small","cottages:fence_small" }, + } +}) + +minetest.register_craft({ + output = "cottages:fence_small 2", + recipe = { + {"cottages:fence_corner" }, + } +}) + +minetest.register_craft({ + output = "cottages:fence_end", + recipe = { + {"cottages:fence_small","cottages:fence_small", "cottages:fence_small" }, + } +}) + +minetest.register_craft({ + output = "cottages:fence_small 3", + recipe = { + {"cottages:fence_end" }, + } +}) + + + + diff --git a/mods/cottages/nodes_furniture.lua b/mods/cottages/nodes_furniture.lua new file mode 100644 index 0000000..c0b1ec3 --- /dev/null +++ b/mods/cottages/nodes_furniture.lua @@ -0,0 +1,319 @@ +--------------------------------------------------------------------------------------- +-- furniture +--------------------------------------------------------------------------------------- +-- contains: +-- * a sleeping mat - mostly for NPC that cannot afford a bet yet +-- * bench - if you don't have 3dforniture:chair, then this is the next best thing +-- * table - very simple one +-- * shelf - for stroring things; this one is 3d +-- * stovepipe - so that the smoke from the furnace can get away +--------------------------------------------------------------------------------------- +-- TODO: change the textures of the bed (make the clothing white, foot path not entirely covered with cloth) + +local S = cottages.S + +-- the basic version of a bed - a sleeping mat +-- to facilitate upgrade path straw mat -> sleeping mat -> bed, this uses a nodebox +minetest.register_node("cottages:sleeping_mat", { + description = S("sleeping mat"), + drawtype = 'nodebox', + tiles = { 'cottages_sleepingmat.png' }, -- done by VanessaE + wield_image = 'cottages_sleepingmat.png', + inventory_image = 'cottages_sleepingmat.png', + sunlight_propagates = true, + paramtype = 'light', + paramtype2 = "facedir", + walkable = false, + groups = { snappy = 3 }, + sounds = default.node_sound_leaves_defaults, + selection_box = { + type = "wallmounted", + }, + node_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.5+1/16, 0.48}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.5+2/16, 0.48}, + } + }, + is_ground_content = false, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return cottages.sleep_in_bed( pos, node, clicker, itemstack, pointed_thing ); + end +}) + + +-- this one has a pillow for the head; thus, param2 becomes visible to the builder, and mobs may use it as a bed +minetest.register_node("cottages:sleeping_mat_head", { + description = S("sleeping mat with pillow"), + drawtype = 'nodebox', + tiles = { 'cottages_sleepingmat.png' }, -- done by VanessaE + wield_image = 'cottages_sleepingmat.png', + inventory_image = 'cottages_sleepingmat.png', + sunlight_propagates = true, + paramtype = 'light', + paramtype2 = "facedir", + groups = { snappy = 3 }, + sounds = default.node_sound_leaves_defaults, + node_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.5+1/16, 0.48}, + {-0.34, -0.5+1/16,-0.12, 0.34, -0.5+2/16, 0.34}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.5+2/16, 0.48}, + } + }, + is_ground_content = false, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return cottages.sleep_in_bed( pos, node, clicker, itemstack, pointed_thing ); + end +}) + + +-- furniture; possible replacement: 3dforniture:chair +minetest.register_node("cottages:bench", { + drawtype = "nodebox", + description = S("simple wooden bench"), + tiles = {"cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + sounds = default.node_sound_wood_defaults, + node_box = { + type = "fixed", + fixed = { + -- sitting area + {-0.5, -0.15, 0.1, 0.5, -0.05, 0.5}, + + -- stützen + {-0.4, -0.5, 0.2, -0.3, -0.15, 0.4}, + { 0.3, -0.5, 0.2, 0.4, -0.15, 0.4}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0, 0.5, 0, 0.5}, + } + }, + is_ground_content = false, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return cottages.sit_on_bench( pos, node, clicker, itemstack, pointed_thing ); + end, +}) + + +-- a simple table; possible replacement: 3dforniture:table +local cottages_table_def = { + description = S("table"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.1, -0.5, -0.1, 0.1, 0.3, 0.1}, + { -0.5, 0.48, -0.5, 0.5, 0.4, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.4, 0.5}, + }, + }, + is_ground_content = false, +} + + +-- search for the workbench in AdventureTest +local workbench = minetest.registered_nodes[ "workbench:3x3"]; +if( workbench ) then + cottages_table_def.tiles = {workbench.tiles[1], cottages_table_def.tiles[1]}; + cottages_table_def.on_rightclick = workbench.on_rightclick; +end +-- search for the workbench from RealTEst +workbench = minetest.registered_nodes[ "workbench:work_bench_birch"]; +if( workbench ) then + cottages_table_def.tiles = {workbench.tiles[1], cottages_table_def.tiles[1]}; + cottages_table_def.on_construct = workbench.on_construct; + cottages_table_def.can_dig = workbench.can_dig; + cottages_table_def.on_metadata_inventory_take = workbench.on_metadata_inventory_take; + cottages_table_def.on_metadata_inventory_move = workbench.on_metadata_inventory_move; + cottages_table_def.on_metadata_inventory_put = workbench.on_metadata_inventory_put; +end + +minetest.register_node("cottages:table", cottages_table_def ); + +-- looks better than two slabs impersonating a shelf; also more 3d than a bookshelf +-- the infotext shows if it's empty or not +minetest.register_node("cottages:shelf", { + description = S("open storage shelf"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + + { -0.5, -0.5, -0.3, -0.4, 0.5, 0.5}, + { 0.4, -0.5, -0.3, 0.5, 0.5, 0.5}, + + { -0.5, -0.2, -0.3, 0.5, -0.1, 0.5}, + { -0.5, 0.3, -0.3, 0.5, 0.4, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + }, + + on_construct = function(pos) + + local meta = minetest.get_meta(pos); + + meta:set_string("formspec", + "size[8,8]".. + "list[current_name;main;0,0;8,3;]".. + "list[current_player;main;0,4;8,4;]") + meta:set_string("infotext", S("open storage shelf")) + local inv = meta:get_inventory(); + inv:set_size("main", 24); + 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_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta( pos ); + meta:set_string('infotext', S('open storage shelf (in use)')); + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta( pos ); + local inv = meta:get_inventory(); + if( inv:is_empty("main")) then + meta:set_string('infotext', S('open storage shelf (empty)')); + end + end, + is_ground_content = false, + + +}) + +-- so that the smoke from a furnace can get out of a building +minetest.register_node("cottages:stovepipe", { + description = S("stovepipe"), + drawtype = "nodebox", + tiles = {"cottages_steel_block.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { 0.20, -0.5, 0.20, 0.45, 0.5, 0.45}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { 0.20, -0.5, 0.20, 0.45, 0.5, 0.45}, + }, + }, + is_ground_content = false, + climbable = true, +}) + +--------------------------------------------------------------------------------------- +-- functions for sitting or sleeping +--------------------------------------------------------------------------------------- + +cottages.allow_sit = function( player ) + -- no check possible + if( not( player.get_player_velocity )) then + return true; + end + local velo = player:get_player_velocity(); + if( not( velo )) then + return false; + end + local max_velo = 0.0001; + if( math.abs(velo.x) < max_velo + and math.abs(velo.y) < max_velo + and math.abs(velo.z) < max_velo ) then + return true; + end + return false; +end + +--------------------------------------------------------------------------------------- +-- crafting receipes +--------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "cottages:sleeping_mat 3", + recipe = { + {"cottages:wool_tent", "cottages:straw_mat","cottages:straw_mat" } + } +}) + + +minetest.register_craft({ + output = "cottages:sleeping_mat_head", + recipe = { + {"cottages:sleeping_mat","cottages:straw_mat" } + } +}) + +minetest.register_craft({ + output = "cottages:table", + recipe = { + {"", cottages.craftitem_slab_wood, "", }, + {"", cottages.craftitem_stick, "" } + } +}) + +minetest.register_craft({ + output = "cottages:bench", + recipe = { + {"", cottages.craftitem_wood, "", }, + {cottages.craftitem_stick, "", cottages.craftitem_stick, } + } +}) + + +minetest.register_craft({ + output = "cottages:shelf", + recipe = { + {cottages.craftitem_stick, cottages.craftitem_wood, cottages.craftitem_stick, }, + {cottages.craftitem_stick, cottages.craftitem_wood, cottages.craftitem_stick, }, + {cottages.craftitem_stick, "", cottages.craftitem_stick} + } +}) + +minetest.register_craft({ + output = "cottages:stovepipe 2", + recipe = { + {cottages.craftitem_steel, '', cottages.craftitem_steel}, + } +}) diff --git a/mods/cottages/nodes_historic.lua b/mods/cottages/nodes_historic.lua new file mode 100644 index 0000000..90e48c4 --- /dev/null +++ b/mods/cottages/nodes_historic.lua @@ -0,0 +1,272 @@ +--------------------------------------------------------------------------------------- +-- decoration and building material +--------------------------------------------------------------------------------------- +-- * includes a wagon wheel that can be used as decoration on walls or to build (stationary) wagons +-- * dirt road - those are more natural in small old villages than cobble roads +-- * loam - no, old buildings are usually not built out of clay; loam was used +-- * straw - useful material for roofs +-- * glass pane - an improvement compared to fence posts as windows :-) +--------------------------------------------------------------------------------------- + +local S = cottages.S + +-- can be used to buid real stationary wagons or attached to walls as decoration +minetest.register_node("cottages:wagon_wheel", { + description = S("wagon wheel"), + drawtype = "signlike", + tiles = {"cottages_wagonwheel.png"}, -- done by VanessaE! + inventory_image = "cottages_wagonwheel.png", + wield_image = "cottages_wagonwheel.png", + paramtype = "light", + paramtype2 = "wallmounted", + + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "wallmounted", + }, + groups = {choppy=2,dig_immediate=2,attached_node=1}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults, + is_ground_content = false, +}) + + +-- people didn't use clay for houses; they did build with loam +minetest.register_node("cottages:loam", { + description = S("loam"), + tiles = {"cottages_loam.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, +}) + +-- create stairs if possible +if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then + + stairs.register_stair_and_slab("loam", "cottages:loam", + {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + {"cottages_loam.png"}, + S("Loam Stairs"), + S("Loam Slab"), + default.node_sound_dirt_defaults) + + if( minetest.registered_nodes["default:clay"]) then + stairs.register_stair_and_slab("clay", "default:clay", + {crumbly=3}, + {"cottages_clay.png"}, + S("Clay Stairs"), + S("Clay Slab"), + default.node_sound_dirt_defaults) + end +end + + +-- straw is a common material for places where animals are kept indoors +-- right now, this block mostly serves as a placeholder +minetest.register_node("cottages:straw_ground", { + description = S("straw ground for animals"), + tiles = {"cottages_darkage_straw.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults, + is_ground_content = false, +}) + + +-- note: these houses look good with a single fence pile as window! the glass pane is the version for 'richer' inhabitants +minetest.register_node("cottages:glass_pane", { + description = S("simple glass pane (centered)"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_glass_pane.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.05, 0.5, 0.5, 0.05}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.05, 0.5, 0.5, 0.05}, + }, + }, + is_ground_content = false, +}) + + +minetest.register_node("cottages:glass_pane_side", { + description = S("simple glass pane"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_glass_pane.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.40, 0.5, 0.5, -0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.40, 0.5, 0.5, -0.50}, + }, + }, + is_ground_content = false, +}) + + +--------------------------------------------------------------------------------------- +-- a very small wooden slab +--------------------------------------------------------------------------------------- +minetest.register_node("cottages:wood_flat", { + description = S("flat wooden planks"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_minimal_wood.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.50, 0.5, -0.5+1/16, 0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.50, 0.5, -0.5+1/16, 0.50}, + }, + }, + is_ground_content = false, + on_place = minetest.rotate_node, +}) + +--------------------------------------------------------------------------------------- +-- useful for building tents +--------------------------------------------------------------------------------------- +minetest.register_node("cottages:wool_tent", { + description = S("wool for tents"), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"cottages_wool.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.50, 0.5, -0.5+1/16, 0.50}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.50, 0.5, -0.5+1/16, 0.50}, + }, + }, + is_ground_content = false, + on_place = minetest.rotate_node, +}) + +-- a fallback for cases in which there is no wool +minetest.register_node("cottages:wool", { + description = "Wool", + tiles = {"cottages_wool.png"}, + is_ground_content = false, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1}, +}) + + +--------------------------------------------------------------------------------------- +-- crafting receipes +--------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "cottages:wagon_wheel 3", + recipe = { + {cottages.craftitem_iron, cottages.craftitem_stick, cottages.craftitem_iron }, + {cottages.craftitem_stick, cottages.craftitem_steel, cottages.craftitem_stick }, + {cottages.craftitem_iron, cottages.craftitem_stick, cottages.craftitem_iron } + } +}) + +-- run a wagon wheel over dirt :-) +minetest.register_craft({ + output = "cottages:feldweg 4", + recipe = { + {"", "cottages:wagon_wheel", "" }, + {cottages.craftitem_dirt,cottages.craftitem_dirt,cottages.craftitem_dirt } + }, + replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, } +}) + +minetest.register_craft({ + output = "cottages:loam 4", + recipe = { + {cottages.craftitem_sand}, + {cottages.craftitem_clay} + } +}) + +minetest.register_craft({ + output = "cottages:straw_ground 2", + recipe = { + {"cottages:straw_mat" }, + {"cottages:loam"} + } +}) + +minetest.register_craft({ + output = "cottages:glass_pane 4", + recipe = { + {cottages.craftitem_stick, cottages.craftitem_stick, cottages.craftitem_stick }, + {cottages.craftitem_stick, cottages.craftitem_glass, cottages.craftitem_stick }, + {cottages.craftitem_stick, cottages.craftitem_stick, cottages.craftitem_stick } + } +}) + +minetest.register_craft({ + output = "cottages:glass_pane_side", + recipe = { + {"cottages:glass_pane"}, + } +}) + +minetest.register_craft({ + output = "cottages:glass_pane", + recipe = { + {"cottages:glass_pane_side"}, + } +}) + +minetest.register_craft({ + output = "cottages:wood_flat 16", + recipe = { + {cottages.craftitem_stick, "farming:string",cottages.craftitem_stick }, + {cottages.craftitem_stick, "", cottages.craftitem_stick }, + } +}) + +minetest.register_craft({ + output = "cottages:wool_tent 2", + recipe = { + {"farming:string", "farming:string"}, + {"",cottages.craftitem_stick} + } +}) + +minetest.register_craft({ + output = "cottages:wool", + recipe = { + {"cottages:wool_tent", "cottages:wool_tent"} + } +}) diff --git a/mods/cottages/nodes_mining.lua b/mods/cottages/nodes_mining.lua new file mode 100644 index 0000000..c417dd4 --- /dev/null +++ b/mods/cottages/nodes_mining.lua @@ -0,0 +1,36 @@ + + +--------------------------------------------------------------------------------------- +-- a rope that is of use to the mines +--------------------------------------------------------------------------------------- +-- the rope can only be digged if there is no further rope above it; +-- Note: This rope also counts as a rail node; thus, carts can move through it +minetest.register_node("cottages:rope", { + description = "rope for climbing", + tiles = {"cottages_rope.png"}, + groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,rail=1,connect_to_raillike=1},--connect_to_raillike=minetest.raillike_group("rail")}, + walkable = false, + climbable = true, + paramtype = "light", + sunlight_propagates = true, + drawtype = "plantlike", + is_ground_content = false, + can_dig = function(pos, player) + local below = minetest.get_node( {x=pos.x, y=pos.y-1, z=pos.z}); + if( below and below.name and below.name == "cottages:rope" ) then + if( player ) then + minetest.chat_send_player( player:get_player_name(), + 'The entire rope would be too heavy. Start digging at its lowest end!'); + end + return false; + end + return true; + end +}) + +minetest.register_craft({ + output = "cottages:rope", + recipe = { + {"default:cotton","default:cotton","default:cotton"} + } +}) diff --git a/mods/cottages/nodes_roof.lua b/mods/cottages/nodes_roof.lua new file mode 100644 index 0000000..0b8b284 --- /dev/null +++ b/mods/cottages/nodes_roof.lua @@ -0,0 +1,201 @@ +-- Boilerplate to support localized strings if intllib mod is installed. +local S = cottages.S + +--------------------------------------------------------------------------------------- +-- roof parts +--------------------------------------------------------------------------------------- +-- a better roof than the normal stairs; can be replaced by stairs:stair_wood + + +-- create the three basic roof parts plus receipes for them; +cottages.register_roof = function( name, tiles, basic_material, homedecor_alternative ) + + minetest.register_node("cottages:roof_"..name, { + description = S("Roof "..name), + drawtype = "nodebox", + --tiles = {cottages.textures_roof_wood,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.texture_roof_sides,cottages.textures_roof_wood}, + tiles = tiles, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + is_ground_content = false, + }) + + -- a better roof than the normal stairs; this one is for usage directly on top of walls (it has the form of a stair) + minetest.register_node("cottages:roof_connector_"..name, { + description = S("Roof connector "..name), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = tiles, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_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}, + }, + }, + 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}, + }, + }, + is_ground_content = false, + }) + + -- this one is the slab version of the above roof + minetest.register_node("cottages:roof_flat_"..name, { + description = S("Roof (flat) "..name), + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + -- this one is from all sides - except from the underside - of the given material + tiles = { tiles[1], tiles[2], tiles[1], tiles[1], tiles[1], tiles[1] }; + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + }, + is_ground_content = false, + }) + + + if( not( homedecor_alternative ) + or ( minetest.get_modpath("homedecor") ~= nil )) then + + minetest.register_craft({ + output = "cottages:roof_"..name.." 6", + recipe = { + {'', '', basic_material }, + {'', basic_material, '' }, + {basic_material, '', '' } + } + }) + end + + -- make those roof parts that use homedecor craftable without that mod + if( homedecor_alternative ) then + basic_material = 'cottages:roof_wood'; + + minetest.register_craft({ + output = "cottages:roof_"..name.." 3", + recipe = { + {homedecor_alternative, '', basic_material }, + {'', basic_material, '' }, + {basic_material, '', '' } + } + }) + end + + + minetest.register_craft({ + output = "cottages:roof_connector_"..name, + recipe = { + {'cottages:roof_'..name }, + {cottages.craftitem_wood }, + } + }) + + minetest.register_craft({ + output = "cottages:roof_flat_"..name..' 2', + recipe = { + {'cottages:roof_'..name, 'cottages:roof_'..name }, + } + }) + + -- convert flat roofs back to normal roofs + minetest.register_craft({ + output = "cottages:roof_"..name, + recipe = { + {"cottages:roof_flat_"..name, "cottages:roof_flat_"..name } + } + }) + +end -- of cottages.register_roof( name, tiles, basic_material ) + + + + +--------------------------------------------------------------------------------------- +-- add the diffrent roof types +--------------------------------------------------------------------------------------- +cottages.register_roof( 'straw', + {"cottages_darkage_straw.png","cottages_darkage_straw.png", + "cottages_darkage_straw.png","cottages_darkage_straw.png", + "cottages_darkage_straw.png","cottages_darkage_straw.png"}, + 'cottages:straw_mat', nil ); +cottages.register_roof( 'reet', + {"cottages_reet.png","cottages_reet.png", + "cottages_reet.png","cottages_reet.png", + "cottages_reet.png","cottages_reet.png"}, + cottages.craftitem_papyrus, nil ); +cottages.register_roof( 'wood', + {cottages.textures_roof_wood, cottages.texture_roof_sides, + cottages.texture_roof_sides, cottages.texture_roof_sides, + cottages.texture_roof_sides, cottages.textures_roof_wood}, + cottages.craftitem_wood, nil); + +--------------------------------------------------------------------------------------- +-- slate roofs are sometimes on vertical fronts of houses +--------------------------------------------------------------------------------------- +minetest.register_node("cottages:slate_vertical", { + description = S("Vertical Slate"), + tiles = {"cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png","cottages_slate.png",cottages.texture_roof_sides,"cottages_slate.png"}, + paramtype2 = "facedir", + groups = {cracky=2, stone=1}, + sounds = default.node_sound_stone_defaults, + is_ground_content = false, +}) + + +minetest.register_craft({ + output = "cottages:slate_vertical", + recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, '' } + } +}); + +--------------------------------------------------------------------------------------- +-- Reed might also be needed as a full block +--------------------------------------------------------------------------------------- +minetest.register_node("cottages:reet", { + description = S("Reet for thatching"), + tiles = {"cottages_reet.png"}, + groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3}, + sounds = default.node_sound_wood_defaults, + is_ground_content = false, +}) + + +minetest.register_craft({ + output = "cottages:reet", + recipe = { {cottages.craftitem_papyrus,cottages.craftitem_papyrus}, + {cottages.craftitem_papyrus,cottages.craftitem_papyrus}, + }, +}) diff --git a/mods/cottages/nodes_straw.lua b/mods/cottages/nodes_straw.lua new file mode 100644 index 0000000..0077f71 --- /dev/null +++ b/mods/cottages/nodes_straw.lua @@ -0,0 +1,578 @@ +--------------------------------------------------------------------------------------- +-- straw - a very basic material +--------------------------------------------------------------------------------------- +-- * straw mat - for animals and very poor NPC; also basis for other straw things +-- * straw bale - well, just a good source for building and decoration + +local S = cottages.S + +local cottages_can_use = function( meta, player ) + if( not( player) or not( meta )) then + return false; + end + local pname = player:get_player_name(); + local owner = meta:get_string('owner' ); + if( not(owner) or owner=="" or owner==pname ) then + return true; + end + return false; +end + + +-- an even simpler from of bed - usually for animals +-- it is a nodebox and not wallmounted because that makes it easier to replace beds with straw mats +minetest.register_node("cottages:straw_mat", { + description = S("layer of straw"), + drawtype = 'nodebox', + tiles = { 'cottages_darkage_straw.png' }, -- done by VanessaE + wield_image = 'cottages_darkage_straw.png', + inventory_image = 'cottages_darkage_straw.png', + sunlight_propagates = true, + paramtype = 'light', + paramtype2 = "facedir", + walkable = false, + groups = { snappy = 3 }, + sounds = default.node_sound_leaves_defaults, + node_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.45, 0.48}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.48, -0.5,-0.48, 0.48, -0.25, 0.48}, + } + }, + is_ground_content = false, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return cottages.sleep_in_bed( pos, node, clicker, itemstack, pointed_thing ); + end +}) + +-- straw bales are a must for farming environments; if you for some reason do not have the darkage mod installed, this here gets you a straw bale +minetest.register_node("cottages:straw_bale", { + drawtype = "nodebox", + description = S("straw bale"), + tiles = {"cottages_darkage_straw_bale.png"}, + paramtype = "light", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + sounds = default.node_sound_wood_defaults, + -- the bale is slightly smaller than a full node + node_box = { + type = "fixed", + fixed = { + {-0.45, -0.5,-0.45, 0.45, 0.45, 0.45}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.45, -0.5,-0.45, 0.45, 0.45, 0.45}, + } + }, + is_ground_content = false, +}) + +-- just straw +minetest.register_node("cottages:straw", { + drawtype = "normal", + description = S("straw"), + tiles = {"cottages_darkage_straw.png"}, + groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3}, + sounds = default.node_sound_wood_defaults, + -- the bale is slightly smaller than a full node + is_ground_content = false, +}) + + +local cottages_formspec_treshing_floor = + "size[8,8]".. + "image[1.5,0;1,1;"..cottages.texture_stick.."]".. + "image[0,1;1,1;farming_wheat.png]".. + "list[current_name;harvest;1,1;2,1;]".. + "list[current_name;straw;5,0;2,2;]".. + "list[current_name;seeds;5,2;2,2;]".. + "label[1,0.5;"..S("Harvested wheat:").."]".. + "label[4,0.0;"..S("Straw:").."]".. + "label[4,2.0;"..S("Seeds:").."]".. + "label[0,-0.5;"..S("Threshing floor").."]".. + "label[0,2.5;"..S("Punch threshing floor with a stick").."]".. + "label[0,3.0;"..S("to get straw and seeds from wheat.").."]".. + "list[current_player;main;0,4;8,4;]"; + +minetest.register_node("cottages:threshing_floor", { + drawtype = "nodebox", + description = S("threshing floor"), +-- TODO: stone also looks pretty well for this + tiles = {"cottages_junglewood.png^farming_wheat.png","cottages_junglewood.png","cottages_junglewood.png^"..cottages.texture_stick}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=2}, + is_ground_content = false, + node_box = { + type = "fixed", + fixed = { + {-0.50, -0.5,-0.50, 0.50, -0.40, 0.50}, + + {-0.50, -0.4,-0.50,-0.45, -0.20, 0.50}, + { 0.45, -0.4,-0.50, 0.50, -0.20, 0.50}, + + {-0.45, -0.4,-0.50, 0.45, -0.20,-0.45}, + {-0.45, -0.4, 0.45, 0.45, -0.20, 0.50}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.50, -0.5,-0.50, 0.50, -0.20, 0.50}, + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos); + meta:set_string("infotext", S("Threshing floor")); + local inv = meta:get_inventory(); + inv:set_size("harvest", 2); + inv:set_size("straw", 4); + inv:set_size("seeds", 4); + meta:set_string("formspec", cottages_formspec_treshing_floor ); + end, + + 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", S("Threshing floor (owned by %s)"):format(meta:get_string("owner") or "")); + meta:set_string("formspec", + cottages_formspec_treshing_floor.. + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string("owner") or "").."]" ); + end, + + can_dig = function(pos,player) + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + local owner = meta:get_string('owner'); + + if( not( inv:is_empty("harvest")) + or not( inv:is_empty("straw")) + or not( inv:is_empty("seeds")) + or not( player ) + or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then + + return false; + end + return true; + 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( cottages_can_use( 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) + -- only accept input the threshing floor can use/process + if( listname=='straw' + or listname=='seeds' + or (listname=='harvest' and stack and stack:get_name() ~= 'farming:wheat' )) then + return 0; + end + + if( not( cottages_can_use( 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( cottages_can_use( meta, player ))) then + return 0 + end + return stack:get_count() + end, + + + on_punch = function(pos, node, puncher) + if( not( pos ) or not( node ) or not( puncher )) then + return; + end + -- only punching with a normal stick is supposed to work + local wielded = puncher:get_wielded_item(); + if( not( wielded ) + or not( wielded:get_name() ) + or not( minetest.registered_items[ wielded:get_name() ]) + or not( minetest.registered_items[ wielded:get_name() ].groups ) + or not( minetest.registered_items[ wielded:get_name() ].groups.stick )) then + return; + end + local name = puncher:get_player_name(); + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + + local input = inv:get_list('harvest'); + -- we have two input slots + local stack1 = inv:get_stack( 'harvest', 1); + local stack2 = inv:get_stack( 'harvest', 2); + + if( ( stack1:is_empty() and stack2:is_empty()) + or( not( stack1:is_empty()) and stack1:get_name() ~= 'farming:wheat') + or( not( stack2:is_empty()) and stack2:get_name() ~= 'farming:wheat')) then + +-- minetest.chat_send_player( name, 'One of the input slots contains something else than wheat, or there is no wheat at all.'); + -- update the formspec + meta:set_string("formspec", + cottages_formspec_treshing_floor.. + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string("owner") or "").."]" ); + return; + end + + -- on average, process 25 wheat at each punch (10..40 are possible) + local anz_wheat = 10 + math.random( 0, 30 ); + -- we already made sure there is only wheat inside + local found_wheat = stack1:get_count() + stack2:get_count(); + + -- do not process more wheat than present in the input slots + if( found_wheat < anz_wheat ) then + anz_wheat = found_wheat; + end + + local overlay1 = "^farming_wheat.png"; + local overlay2 = "^cottages_darkage_straw.png"; + local overlay3 = "^"..cottages.texture_wheat_seed; + + -- this can be enlarged by a multiplicator if desired + local anz_straw = anz_wheat; + local anz_seeds = anz_wheat; + + if( inv:room_for_item('straw','cottages:straw_mat '..tostring( anz_straw )) + and inv:room_for_item('seeds',cottages.craftitem_seed_wheat..' '..tostring( anz_seeds ))) then + + -- the player gets two kind of output + inv:add_item("straw",'cottages:straw_mat '..tostring( anz_straw )); + inv:add_item("seeds",cottages.craftitem_seed_wheat..' '..tostring( anz_seeds )); + -- consume the wheat + inv:remove_item("harvest", 'farming:wheat '..tostring( anz_wheat )); + + local anz_left = found_wheat - anz_wheat; + if( anz_left > 0 ) then +-- minetest.chat_send_player( name, S('You have threshed %s wheat (%s are left).'):format(anz_wheat,anz_left)); + else +-- minetest.chat_send_player( name, S('You have threshed the last %s wheat.'):format(anz_wheat)); + overlay1 = ""; + end + end + + local hud0 = puncher:hud_add({ + hud_elem_type = "image", + scale = {x = 38, y = 38}, + text = "cottages_junglewood.png^[colorize:#888888:128", + position = {x = 0.5, y = 0.5}, + alignment = {x = 0, y = 0} + }); + + local hud1 = puncher:hud_add({ + hud_elem_type = "image", + scale = {x = 15, y = 15}, + text = "cottages_junglewood.png"..overlay1, + position = {x = 0.4, y = 0.5}, + alignment = {x = 0, y = 0} + }); + local hud2 = puncher:hud_add({ + hud_elem_type = "image", + scale = {x = 15, y = 15}, + text = "cottages_junglewood.png"..overlay2, + position = {x = 0.6, y = 0.35}, + alignment = {x = 0, y = 0} + }); + local hud3 = puncher:hud_add({ + hud_elem_type = "image", + scale = {x = 15, y = 15}, + text = "cottages_junglewood.png"..overlay3, + position = {x = 0.6, y = 0.65}, + alignment = {x = 0, y = 0} + }); + + local hud4 = puncher:hud_add({ + hud_elem_type = "text", + text = tostring( found_wheat-anz_wheat ), + number = 0x00CC00, + alignment = {x = 0, y = 0}, + scale = {x = 100, y = 100}, -- bounding rectangle of the text + position = {x = 0.4, y = 0.5}, + }); + if( not( anz_straw )) then + anz_straw = "0"; + end + if( not( anz_seed )) then + anz_seed = "0"; + end + local hud5 = puncher:hud_add({ + hud_elem_type = "text", + text = '+ '..tostring( anz_straw )..' straw', + number = 0x00CC00, + alignment = {x = 0, y = 0}, + scale = {x = 100, y = 100}, -- bounding rectangle of the text + position = {x = 0.6, y = 0.35}, + }); + local hud6 = puncher:hud_add({ + hud_elem_type = "text", + text = '+ '..tostring( anz_seed )..' seeds', + number = 0x00CC00, + alignment = {x = 0, y = 0}, + scale = {x = 100, y = 100}, -- bounding rectangle of the text + position = {x = 0.6, y = 0.65}, + }); + + + + minetest.after(2, function() + if( puncher ) then + puncher:hud_remove(hud1); + puncher:hud_remove(hud2); + puncher:hud_remove(hud3); + puncher:hud_remove(hud4); + puncher:hud_remove(hud5); + puncher:hud_remove(hud6); + puncher:hud_remove(hud0); + end + end) + end, +}) + + +local cottages_handmill_formspec = "size[8,8]".. + "image[0,1;1,1;"..cottages.texture_wheat_seed.."]".. + "list[current_name;seeds;1,1;1,1;]".. + "list[current_name;flour;5,1;2,2;]".. + "label[0,0.5;"..S("Wheat seeds:").."]".. + "label[4,0.5;"..S("Flour:").."]".. + "label[0,-0.3;"..S("Mill").."]".. + "label[0,2.5;"..S("Punch this hand-driven mill").."]".. + "label[0,3.0;"..S("to convert wheat seeds into flour.").."]".. + "list[current_player;main;0,4;8,4;]"; + +minetest.register_node("cottages:handmill", { + description = S("mill, powered by punching"), + drawtype = "mesh", + mesh = "cottages_handmill.obj", + tiles = {"cottages_stone.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=2}, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = { + {-0.50, -0.5,-0.50, 0.50, 0.25, 0.50}, + } + }, + collision_box = { + type = "fixed", + fixed = { + {-0.50, -0.5,-0.50, 0.50, 0.25, 0.50}, + } + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos); + meta:set_string("infotext", S("Mill, powered by punching")); + local inv = meta:get_inventory(); + inv:set_size("seeds", 1); + inv:set_size("flour", 4); + meta:set_string("formspec", cottages_handmill_formspec ); + end, + + 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", S("Mill, powered by punching (owned by %s)"):format(meta:get_string("owner") or "")); + meta:set_string("formspec", + cottages_handmill_formspec.. + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]" ); + end, + + can_dig = function(pos,player) + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + local owner = meta:get_string('owner'); + + if( not( inv:is_empty("flour")) + or not( inv:is_empty("seeds")) + or not( player ) + or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then + + return false; + end + return true; + 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( cottages_can_use( 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) + -- only accept input the threshing floor can use/process + if( listname=='flour' + or (listname=='seeds' and stack and not( cottages.handmill_product[ stack:get_name()] ))) then + return 0; + end + + if( not( cottages_can_use( 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( cottages_can_use( meta, player ))) then + return 0 + end + return stack:get_count() + end, + + -- this code is very similar to the threshing floor; except that it has only one input- and output-slot + -- and does not require the usage of a stick + on_punch = function(pos, node, puncher) + if( not( pos ) or not( node ) or not( puncher )) then + return; + end + local name = puncher:get_player_name(); + + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory(); + + local input = inv:get_list('seeds'); + local stack1 = inv:get_stack( 'seeds', 1); + + if( ( stack1:is_empty()) + or( not( stack1:is_empty()) + and not( cottages.handmill_product[ stack1:get_name() ] ))) then + + if not( stack1:is_empty() ) then + minetest.chat_send_player(name,"Nothing happens...") + end + -- update the formspec + meta:set_string("formspec", + cottages_handmill_formspec.. + "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]" ); + return; + end + + -- turning the mill is a slow process; 1-21 flour are generated per turn + local anz = 1 + math.random( cottages.handmill_min_per_turn, cottages.handmill_max_per_turn ); + -- we already made sure there is only wheat inside + local found = stack1:get_count(); + + -- do not process more wheat than present in the input slots + if( found < anz ) then + anz = found; + end + + local product_stack = ItemStack( cottages.handmill_product[ stack1:get_name() ]); + local anz_result = anz; + -- items that produce more + if( product_stack:get_count()> 1 ) then + anz_result = anz * product_stack:get_count(); + end + + if( inv:room_for_item('flour', product_stack:get_name()..' '..tostring( anz_result ))) then + + inv:add_item( 'flour', product_stack:get_name()..' '..tostring( anz_result )); + inv:remove_item( 'seeds', stack1:get_name()..' '..tostring( anz )); + + local anz_left = found - anz; + if( anz_left > 0 ) then + minetest.chat_send_player( name, S('You have ground a %s (%s are left).'):format(stack1:get_definition().description,(anz_left))); + else + minetest.chat_send_player( name, S('You have ground the last %s.'):format(stack1:get_definition().description)); + end + + -- if the version of MT is recent enough, rotate the mill a bit + if( minetest.swap_node ) then + node.param2 = node.param2 + 1; + if( node.param2 > 3 ) then + node.param2 = 0; + end + minetest.swap_node( pos, node ); + end + end + end, +}) + + + + +--------------------------------------------------------------------------------------- +-- crafting receipes +--------------------------------------------------------------------------------------- +-- this returns corn as well +-- the replacements work only if the replaced slot gets empty... +minetest.register_craft({ + output = "cottages:straw_mat 6", + recipe = { + {cottages.craftitem_stone,'',''}, + {"farming:wheat", "farming:wheat", "farming:wheat", }, + }, + replacements = {{ cottages.craftitem_stone, cottages.craftitem_seed_wheat.." 3" }}, +}) + +--[[ this is a better way to get straw mats +minetest.register_craft({ + output = "cottages:threshing_floor", + recipe = { + {cottages.craftitem_junglewood, cottages.craftitem_chest_locked, cottages.craftitem_junglewood, }, + {cottages.craftitem_junglewood, cottages.craftitem_stone, cottages.craftitem_junglewood, }, + }, +})]]-- + +-- and a way to turn wheat seeds into flour +minetest.register_craft({ + output = "cottages:handmill", + recipe = { + {cottages.craftitem_stick, cottages.craftitem_stone, "", }, + {"", cottages.craftitem_steel, "", }, + {"", cottages.craftitem_stone, "", }, + }, +}) + +minetest.register_craft({ + output = "cottages:straw_bale", + recipe = { + {"cottages:straw_mat"}, + {"cottages:straw_mat"}, + {"cottages:straw_mat"}, + }, +}) + +minetest.register_craft({ + output = "cottages:straw", + recipe = { + {"cottages:straw_bale"}, + }, +}) + +minetest.register_craft({ + output = "cottages:straw_bale", + recipe = { + {"cottages:straw"}, + }, +}) + +minetest.register_craft({ + output = "cottages:straw_mat 3", + recipe = { + {"cottages:straw_bale"}, + }, +}) diff --git a/mods/cottages/screenshot.jpg b/mods/cottages/screenshot.jpg new file mode 100644 index 0000000..62916da Binary files /dev/null and b/mods/cottages/screenshot.jpg differ diff --git a/mods/cottages/textures/cottages_barrel.png b/mods/cottages/textures/cottages_barrel.png new file mode 100644 index 0000000..174c5d7 Binary files /dev/null and b/mods/cottages/textures/cottages_barrel.png differ diff --git a/mods/cottages/textures/cottages_clay.png b/mods/cottages/textures/cottages_clay.png new file mode 100644 index 0000000..76e5a40 Binary files /dev/null and b/mods/cottages/textures/cottages_clay.png differ diff --git a/mods/cottages/textures/cottages_darkage_straw.png b/mods/cottages/textures/cottages_darkage_straw.png new file mode 100644 index 0000000..9817316 Binary files /dev/null and b/mods/cottages/textures/cottages_darkage_straw.png differ diff --git a/mods/cottages/textures/cottages_darkage_straw_bale.png b/mods/cottages/textures/cottages_darkage_straw_bale.png new file mode 100644 index 0000000..f607c2f Binary files /dev/null and b/mods/cottages/textures/cottages_darkage_straw_bale.png differ diff --git a/mods/cottages/textures/cottages_feldweg.png b/mods/cottages/textures/cottages_feldweg.png new file mode 100644 index 0000000..65456a8 Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg.png differ diff --git a/mods/cottages/textures/cottages_feldweg_ecke.png b/mods/cottages/textures/cottages_feldweg_ecke.png new file mode 100644 index 0000000..937b7df Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_ecke.png differ diff --git a/mods/cottages/textures/cottages_feldweg_edges.png b/mods/cottages/textures/cottages_feldweg_edges.png new file mode 100644 index 0000000..a81653d Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_edges.png differ diff --git a/mods/cottages/textures/cottages_feldweg_end.png b/mods/cottages/textures/cottages_feldweg_end.png new file mode 100644 index 0000000..81ac09e Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_end.png differ diff --git a/mods/cottages/textures/cottages_feldweg_kreuzung.png b/mods/cottages/textures/cottages_feldweg_kreuzung.png new file mode 100644 index 0000000..d26d94b Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_kreuzung.png differ diff --git a/mods/cottages/textures/cottages_feldweg_surface.png b/mods/cottages/textures/cottages_feldweg_surface.png new file mode 100644 index 0000000..1e9510c Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_surface.png differ diff --git a/mods/cottages/textures/cottages_feldweg_t-kreuzung.png b/mods/cottages/textures/cottages_feldweg_t-kreuzung.png new file mode 100644 index 0000000..e78594c Binary files /dev/null and b/mods/cottages/textures/cottages_feldweg_t-kreuzung.png differ diff --git a/mods/cottages/textures/cottages_glass_pane.png b/mods/cottages/textures/cottages_glass_pane.png new file mode 100644 index 0000000..f07912e Binary files /dev/null and b/mods/cottages/textures/cottages_glass_pane.png differ diff --git a/mods/cottages/textures/cottages_homedecor_shingles_asphalt.png b/mods/cottages/textures/cottages_homedecor_shingles_asphalt.png new file mode 100644 index 0000000..057546c Binary files /dev/null and b/mods/cottages/textures/cottages_homedecor_shingles_asphalt.png differ diff --git a/mods/cottages/textures/cottages_homedecor_shingles_terracotta.png b/mods/cottages/textures/cottages_homedecor_shingles_terracotta.png new file mode 100644 index 0000000..3f42cca Binary files /dev/null and b/mods/cottages/textures/cottages_homedecor_shingles_terracotta.png differ diff --git a/mods/cottages/textures/cottages_homedecor_shingles_wood.png b/mods/cottages/textures/cottages_homedecor_shingles_wood.png new file mode 100644 index 0000000..b982747 Binary files /dev/null and b/mods/cottages/textures/cottages_homedecor_shingles_wood.png differ diff --git a/mods/cottages/textures/cottages_junglewood.png b/mods/cottages/textures/cottages_junglewood.png new file mode 100644 index 0000000..2507706 Binary files /dev/null and b/mods/cottages/textures/cottages_junglewood.png differ diff --git a/mods/cottages/textures/cottages_loam.png b/mods/cottages/textures/cottages_loam.png new file mode 100644 index 0000000..bdf058f Binary files /dev/null and b/mods/cottages/textures/cottages_loam.png differ diff --git a/mods/cottages/textures/cottages_minimal_wood.png b/mods/cottages/textures/cottages_minimal_wood.png new file mode 100644 index 0000000..57c1d7c Binary files /dev/null and b/mods/cottages/textures/cottages_minimal_wood.png differ diff --git a/mods/cottages/textures/cottages_reet.png b/mods/cottages/textures/cottages_reet.png new file mode 100644 index 0000000..67a4bdd Binary files /dev/null and b/mods/cottages/textures/cottages_reet.png differ diff --git a/mods/cottages/textures/cottages_rope.png b/mods/cottages/textures/cottages_rope.png new file mode 100644 index 0000000..0045c4c Binary files /dev/null and b/mods/cottages/textures/cottages_rope.png differ diff --git a/mods/cottages/textures/cottages_sleepingmat.png b/mods/cottages/textures/cottages_sleepingmat.png new file mode 100644 index 0000000..5721a5b Binary files /dev/null and b/mods/cottages/textures/cottages_sleepingmat.png differ diff --git a/mods/cottages/textures/cottages_steel_block.png b/mods/cottages/textures/cottages_steel_block.png new file mode 100644 index 0000000..7f49f61 Binary files /dev/null and b/mods/cottages/textures/cottages_steel_block.png differ diff --git a/mods/cottages/textures/cottages_stone.png b/mods/cottages/textures/cottages_stone.png new file mode 100644 index 0000000..63cb7c4 Binary files /dev/null and b/mods/cottages/textures/cottages_stone.png differ diff --git a/mods/cottages/textures/cottages_wagonwheel.png b/mods/cottages/textures/cottages_wagonwheel.png new file mode 100644 index 0000000..6175bba Binary files /dev/null and b/mods/cottages/textures/cottages_wagonwheel.png differ diff --git a/mods/cottages/textures/cottages_wool.png b/mods/cottages/textures/cottages_wool.png new file mode 100644 index 0000000..2bbb9cf Binary files /dev/null and b/mods/cottages/textures/cottages_wool.png differ diff --git a/mods/cottages/textures/glooptest_tool_steelhammer.png b/mods/cottages/textures/glooptest_tool_steelhammer.png new file mode 100644 index 0000000..b662a71 Binary files /dev/null and b/mods/cottages/textures/glooptest_tool_steelhammer.png differ diff --git a/mods/food/LICENSE.txt b/mods/food/LICENSE.txt new file mode 100644 index 0000000..fe2696b --- /dev/null +++ b/mods/food/LICENSE.txt @@ -0,0 +1,113 @@ +===================================== +Code License: MIT License (see below) +===================================== + +Copyright 2019 migdyn + +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. + + +================================================================ +Textures and sounds license: CC BY 4.0 International (see below) +================================================================ + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + diff --git a/mods/food/init.lua b/mods/food/init.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/food/textures/food_apple.png b/mods/food/textures/food_apple.png new file mode 100644 index 0000000..8f953ff Binary files /dev/null and b/mods/food/textures/food_apple.png differ diff --git a/mods/food/textures/food_apple_mese.png b/mods/food/textures/food_apple_mese.png new file mode 100644 index 0000000..2434f0d Binary files /dev/null and b/mods/food/textures/food_apple_mese.png differ diff --git a/mods/grenades/.luacheckrc b/mods/grenades/.luacheckrc new file mode 100644 index 0000000..560847f --- /dev/null +++ b/mods/grenades/.luacheckrc @@ -0,0 +1,18 @@ +unused_args = false +allow_defined_top = true + +globals = { + "minetest", +} + +read_globals = { + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + -- Builtin + "vector", "ItemStack", + "dump", "DIR_DELIM", "VoxelArea", "Settings", + + -- MTG + "default", "sfinv", "creative", +} diff --git a/mods/grenades/API.md b/mods/grenades/API.md new file mode 100644 index 0000000..1e8464d --- /dev/null +++ b/mods/grenades/API.md @@ -0,0 +1,24 @@ +#Grenades API + +Still WIP. Please suggest new features here: https://forum.minetest.net/viewtopic.php?f=9&t=21466 + +##API + + grenades.register_grenade("name", { -- Name of the grenade (Like 'smoke' or 'flashbang') + description = "", -- A short description of the grenade. + image = "", -- The name of the grenade's texture + on_explode = function(pos, name) + -- This function is called when the grenade 'explodes' + -- the place the grenade 'exploded' at + -- the name of the player that threw the grenade + end, + placeable = false, -- Optional, default is false + timeout = 5, -- Optional, default is 5 + particle = { -- Adds particles in the grenade's trail + image = "grenades_smoke.png", -- The particle's image + life = 1, -- How long (seconds) it takes for the particle to disappear + size = 4, -- Size of the particle + glow = 0, -- Brightens the texture in darkness + interval = 5, -- How long it takes before a particle can be added + } + }) diff --git a/mods/grenades/LICENSE b/mods/grenades/LICENSE new file mode 100644 index 0000000..87048ed --- /dev/null +++ b/mods/grenades/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-2019 Lone_Wolf + +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/grenades/README.md b/mods/grenades/README.md new file mode 100644 index 0000000..53af646 --- /dev/null +++ b/mods/grenades/README.md @@ -0,0 +1,6 @@ +# grenades +Adds a grenade API and a few grenades to Minetest + +License of code: **MIT** + +License of sound and textures: **CC-BY 4.0** diff --git a/mods/grenades/depends.txt b/mods/grenades/depends.txt new file mode 100644 index 0000000..21c2521 --- /dev/null +++ b/mods/grenades/depends.txt @@ -0,0 +1 @@ +default? \ No newline at end of file diff --git a/mods/grenades/grenades.lua b/mods/grenades/grenades.lua new file mode 100644 index 0000000..3f6ec84 --- /dev/null +++ b/mods/grenades/grenades.lua @@ -0,0 +1,151 @@ +local settings = minetest.settings + +local regular = settings:get_bool("enable_regular_grenade") +local flash = settings:get_bool("enable_flashbang_grenade") +local smoke = settings:get_bool("enable_smoke_grenade") + + +-- Regular Grenade + +if not regular or regular == true then + grenades.register_grenade("regular", { + description = "Regular grenade (Kills anyone near blast)", + image = "grenades_regular.png", + on_explode = function(pos, name) + if not name or not pos then + return + end + + local player = minetest.get_player_by_name(name) + + local radius = 10 + + minetest.add_particlespawner({ + amount = 20, + time = 0.5, + minpos = vector.subtract(pos, radius), + maxpos = vector.add(pos, radius), + minvel = {x = 0, y = 5, z = 0}, + maxvel = {x = 0, y = 7, z = 0}, + minacc = {x = 0, y = 1, z = 0}, + maxacc = {x = 0, y = 1, z = 0}, + minexptime = 0.3, + maxexptime = 0.6, + minsize = 7, + maxsize = 10, + collisiondetection = true, + collision_removal = false, + vertical = false, + texture = "grenades_smoke.png", + }) + + minetest.sound_play("boom", { + pos = pos, + gain = 1.0, + max_hear_distance = 32, + }) + + for k, v in ipairs(minetest.get_objects_inside_radius(pos, radius)) do + if v:get_hp() > 0 then + v:punch(player, 2, {damage_groups = {fleshy = 24 - (vector.distance(pos, v:get_pos()) * 2)}}, nil) + end + end + end, + }) +end + +-- Flashbang Grenade + +if not flash or flash == true then + grenades.register_grenade("flashbang", { + description = "Flashbang grenade (Blinds all who look at blast)", + image = "grenades_flashbang.png", + on_explode = function(pos, name) + for k, v in ipairs(minetest.get_objects_inside_radius(pos, 20)) do + if v:is_player() and v:get_hp() > 0 then + local playerdir = vector.round(v:get_look_dir()) + local grenadedir = vector.round(vector.direction(v:get_pos(), pos)) + local pname = v:get_player_name() + + minetest.sound_play("glasslike_break", { + pos = pos, + gain = 1.0, + max_hear_distance = 32, + }) + + if vector.equals(playerdir, grenadedir) then + for i = 0, 5, 1 do + local key = v:hud_add({ + hud_elem_type = "image", + position = {x = 0, y = 0}, + name = "flashbang hud "..pname, + scale = {x = -200, y = -200}, + text = "grenades_white.png^[opacity:"..tostring(255 - (i * 13)), + alignment = {x = 0, y = 0}, + offset = {x = 0, y = 0} + }) +. + minetest.after(2 * i, function() + if minetest.get_player_by_name(pname) then + minetest.get_player_by_name(pname):hud_remove(key) + end + end) + end + end + + end + end + end, + }) +end + +-- Smoke Grenade + +if not smoke or smoke == true then + grenades.register_grenade("smoke", { + description = "Smoke grenade (Generates smoke around blast site)", + image = "grenades_smoke_grenade.png", + on_explode = function(pos, name) + + minetest.sound_play("glasslike_break", { + pos = pos, + gain = 1.0, + max_hear_distance = 32, + }) + + minetest.sound_play("hiss", { + pos = pos, + gain = 1.0, + max_hear_distance = 32, + }) + + for i = 0, 5, 1 do + minetest.add_particlespawner({ + amount = 60, + time = 20, + minpos = vector.subtract(pos, 3), + maxpos = vector.add(pos, 4), + minvel = {x = 0, y = 2, z = 0}, + maxvel = {x = 0, y = 3, z = 0}, + minacc = {x = 1, y = 0.2, z = 1}, + maxacc = {x = 1, y = 0.2, z = 1}, + minexptime = 0.3, + maxexptime = 0.5, + minsize = 90, + maxsize = 180, + collisiondetection = false, + collision_removal = false, + vertical = false, + texture = "grenades_smoke.png", + }) + end + end, + particle = { + image = "grenades_smoke.png", + life = 1, + size = 4, + glow = 0, + interval = 5, + } + }) +end diff --git a/mods/grenades/init.lua b/mods/grenades/init.lua new file mode 100644 index 0000000..4eb962f --- /dev/null +++ b/mods/grenades/init.lua @@ -0,0 +1,120 @@ +grenades = {} + +local function throw_grenade(name, player) + local dir = player:get_look_dir() + local pos = player:get_pos() + local obj = minetest.add_entity({x = pos.x + dir.x, y = pos.y + 1.6, z = pos.z + dir.z}, name) + + obj:set_velocity({x = dir.x * 40, y = dir.y * 40, z = dir.z * 40}) + obj:set_acceleration({x = dir.x * -12, y = -41, z = dir.z * -12}) + + return(obj:get_luaentity()) +end + +function grenades.register_grenade(name, def) + if not def.timeout then + def.timeout = 5 + end + + local grenade_entity = { + physical = false, + collide_with_objects = true, + timer = 0, + visual = "sprite", + visual_size = {x = 1, y = 1, z = 1}, + textures = {def.image}, + collisionbox = {1, 1, 1, 1, 1, 1}, + on_step = function(self, dtime) + local obj = self.object + local pos = obj:get_pos() + local node = minetest.get_node(vector.add(pos, vector.normalize(obj:get_velocity()))) + + if self.particle == nil then + self.particle = 0 + end + + if self.timer then + self.timer = self.timer + dtime + else + self.timer = dtime + end + + if def.particle and self.particle >= 4 then + self.particle = 0 + + minetest.add_particle({ + pos = obj:get_pos(), + velocity = vector.divide(obj:get_velocity(), 2), + acceleration = vector.divide(obj:get_acceleration(), -5), + expirationtime = def.particle.life, + size = def.particle.size, + collisiondetection = true, + collision_removal = true, + vertical = false, + texture = def.particle.image, + glow = def.particle.glow + }) + elseif def.particle and self.particle < def.particle.interval then + self.particle = self.particle + 1 + end + + if self.timer > def.timeout or node.name ~= "air" then + if self.thrower_name then + minetest.log("[Grenades] A grenade thrown by "..self.thrower_name.. + " is exploding at "..minetest.pos_to_string(pos)) + def.on_explode(pos, self.thrower_name) + else + minetest.chat_send_all(minetest.colorize("red", "[Error] self.thrower_name on line 62".. + " (grenades/init.lua) was nil. Removing grenade")) + minetest.log("[Error] self.thrower_name on line 62 (grenades/init.lua) was nil. Removing grenade") + end + + obj:remove() + end + end + } + + minetest.register_entity("grenades:grenade_"..name, grenade_entity) + + local newdef = {} + + newdef.description = def.description + newdef.stack_max = 1 + newdef.range = 4 + newdef.inventory_image = def.image + newdef.on_use = function(itemstack, user, pointed_thing) + local player_name = user:get_player_name() + + if pointed_thing.type ~= "node" then + local grenade = throw_grenade("grenades:grenade_"..name, user) + grenade.timer = 0 + grenade.thrower_name = player_name + + if not minetest.settings:get_bool("creative_mode") then + itemstack = "" + end + end + + return itemstack + end + + if def.placeable == true then + + newdef.tiles = {def.image} + newdef.selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.4, 0.3}, + } + newdef.groups = {oddly_breakable_by_hand = 2} + newdef.paramtype = "light" + newdef.sunlight_propagates = true + newdef.walkable = false + newdef.drawtype = "plantlike" + + minetest.register_node("grenades:grenade_"..name, newdef) + else + minetest.register_craftitem("grenades:grenade_"..name, newdef) + end +end + +dofile(minetest.get_modpath("grenades").."/grenades.lua") diff --git a/mods/grenades/mod.conf b/mods/grenades/mod.conf new file mode 100644 index 0000000..e2b506a --- /dev/null +++ b/mods/grenades/mod.conf @@ -0,0 +1 @@ +name = grenades \ No newline at end of file diff --git a/mods/grenades/settingtypes.txt b/mods/grenades/settingtypes.txt new file mode 100644 index 0000000..2da940f --- /dev/null +++ b/mods/grenades/settingtypes.txt @@ -0,0 +1,11 @@ +#Add a regular grenade +enable_regular_grenade (Add a regular grenade to the world) bool true + +#Add a flashbang grenade +enable_flashbang_grenade (Add a flashbang grenade to the world) bool true + +#Add a smoke grenade +enable_smoke_grenade (Add a smoke grenade to the world) bool true + +#Enable Recipes +enable_grenade_recipes (Gives enabled grenades cafting recipes) bool true \ No newline at end of file diff --git a/mods/grenades/sounds/LICENSE.txt b/mods/grenades/sounds/LICENSE.txt new file mode 100644 index 0000000..5724583 --- /dev/null +++ b/mods/grenades/sounds/LICENSE.txt @@ -0,0 +1,97 @@ +Creative Commons Attribution 4.0 International Public License + +Copyright (c) 2019 Lone_Wolf + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. diff --git a/mods/grenades/sounds/boom.ogg b/mods/grenades/sounds/boom.ogg new file mode 100644 index 0000000..f4c3faa Binary files /dev/null and b/mods/grenades/sounds/boom.ogg differ diff --git a/mods/grenades/sounds/glasslike_break.ogg b/mods/grenades/sounds/glasslike_break.ogg new file mode 100644 index 0000000..d2138db Binary files /dev/null and b/mods/grenades/sounds/glasslike_break.ogg differ diff --git a/mods/grenades/sounds/hiss.ogg b/mods/grenades/sounds/hiss.ogg new file mode 100644 index 0000000..371dd66 Binary files /dev/null and b/mods/grenades/sounds/hiss.ogg differ diff --git a/mods/grenades/textures/LICENSE.txt b/mods/grenades/textures/LICENSE.txt new file mode 100644 index 0000000..5724583 --- /dev/null +++ b/mods/grenades/textures/LICENSE.txt @@ -0,0 +1,97 @@ +Creative Commons Attribution 4.0 International Public License + +Copyright (c) 2019 Lone_Wolf + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. diff --git a/mods/grenades/textures/grenades_flashbang.png b/mods/grenades/textures/grenades_flashbang.png new file mode 100644 index 0000000..2816686 Binary files /dev/null and b/mods/grenades/textures/grenades_flashbang.png differ diff --git a/mods/grenades/textures/grenades_gun_powder.png b/mods/grenades/textures/grenades_gun_powder.png new file mode 100644 index 0000000..1e6f436 Binary files /dev/null and b/mods/grenades/textures/grenades_gun_powder.png differ diff --git a/mods/grenades/textures/grenades_regular.png b/mods/grenades/textures/grenades_regular.png new file mode 100644 index 0000000..5de4795 Binary files /dev/null and b/mods/grenades/textures/grenades_regular.png differ diff --git a/mods/grenades/textures/grenades_smoke.png b/mods/grenades/textures/grenades_smoke.png new file mode 100755 index 0000000..cf5e603 Binary files /dev/null and b/mods/grenades/textures/grenades_smoke.png differ diff --git a/mods/grenades/textures/grenades_smoke_grenade.png b/mods/grenades/textures/grenades_smoke_grenade.png new file mode 100644 index 0000000..3a2b0f2 Binary files /dev/null and b/mods/grenades/textures/grenades_smoke_grenade.png differ diff --git a/mods/grenades/textures/grenades_white.png b/mods/grenades/textures/grenades_white.png new file mode 100644 index 0000000..a61c0c1 Binary files /dev/null and b/mods/grenades/textures/grenades_white.png differ diff --git a/mods/healing/LICENSE.txt b/mods/healing/LICENSE.txt new file mode 100644 index 0000000..7df9b3e --- /dev/null +++ b/mods/healing/LICENSE.txt @@ -0,0 +1,110 @@ +LICENSE OF CODE: MIT License (see below) + +Copyright 2019 migdyn + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------------------------------------------------------------------------------- +LICENSE OF TEXTURES: Creative Commons Attribution 4.0 International (see below) +------------------------------------------------------------------------------- + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + diff --git a/mods/healing/init.lua b/mods/healing/init.lua new file mode 100644 index 0000000..697481d --- /dev/null +++ b/mods/healing/init.lua @@ -0,0 +1,24 @@ +minetest.register_tool("healing:bandage", { + description = "Bandage", + inventory_image = "healing_bandage.png", + on_use = function(player, itemstack, pointed_thing) + seal_wound(player) + end +}) + +minetest.register_tool("healing:antibiotic", { + description = "Antibiotic", + inventory_image = "healing_antibiotic.png", + on_use = function(player, itemstack, pointed_thing) + seal_wound(player) + end +}) + +function seal_wound(player) + + +end + +function cure_infectcion(player) + +end diff --git a/mods/healing/textures/healing_antibiotics.png b/mods/healing/textures/healing_antibiotics.png new file mode 100644 index 0000000..de30c8a Binary files /dev/null and b/mods/healing/textures/healing_antibiotics.png differ diff --git a/mods/healing/textures/healing_bandage.png b/mods/healing/textures/healing_bandage.png new file mode 100644 index 0000000..37deb39 Binary files /dev/null and b/mods/healing/textures/healing_bandage.png differ diff --git a/mods/healing/textures/healing_shears.png b/mods/healing/textures/healing_shears.png new file mode 100644 index 0000000..f683ebe Binary files /dev/null and b/mods/healing/textures/healing_shears.png differ diff --git a/mods/healing/textures/healing_splinter.png b/mods/healing/textures/healing_splinter.png new file mode 100644 index 0000000..8e14c83 Binary files /dev/null and b/mods/healing/textures/healing_splinter.png differ diff --git a/mods/main/LICENSE.txt b/mods/main/LICENSE.txt new file mode 100644 index 0000000..fe2696b --- /dev/null +++ b/mods/main/LICENSE.txt @@ -0,0 +1,113 @@ +===================================== +Code License: MIT License (see below) +===================================== + +Copyright 2019 migdyn + +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. + + +================================================================ +Textures and sounds license: CC BY 4.0 International (see below) +================================================================ + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + diff --git a/mods/main/init.lua b/mods/main/init.lua new file mode 100644 index 0000000..1f9a909 --- /dev/null +++ b/mods/main/init.lua @@ -0,0 +1,6 @@ +local modpath = minetest.get_modpath("main") + +dofile(modpath.."/nodes.lua") +--dofile(modpath.."/craftitems.lua") +dofile(modpath.."/mapgen.lua") +dofile(modpath.."/tools.lua") diff --git a/mods/main/mapgen.lua b/mods/main/mapgen.lua new file mode 100644 index 0000000..90b7295 --- /dev/null +++ b/mods/main/mapgen.lua @@ -0,0 +1,97 @@ +minetest.register_alias("mapgen_stone", "main:stone") +minetest.register_alias("mapgen_dirt", "main:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "main:grass") +minetest.register_alias("mapgen_sand", "main:sand") +minetest.register_alias("mapgen_water_source", "main:water_source") +minetest.register_alias("mapgen_river_water_source", "main:water_source") +minetest.register_alias("mapgen_lava_source", "main:lava_source") + +--Grasslands +minetest.register_biome( + { + name = "Grasslands", + + node_top = "main:grass", + node_filler = "main:dirt", + + depth_top = 1, + depth_filler = 1, + + y_min = 1, + y_max = 30, + + heat_point = 60, + humidity_point = 30, +}) + +--Forest +minetest.register_biome( + { + name = "Forest", + + node_top = "main:grass_forest", + node_filler = "main:dirt", + + depth_top = 1, + depth_filler = 3, + + y_min = 10, + y_max = 20, + + heat_point = 60, + humidity_point = 40, +}) + +--Mountains +minetest.register_biome( + { + name = "Mountains", + + node_top = "main:cobble", + node_filler = "main:stone", + + depth_top = 10, + depth_filler = 1, + + y_min = 15, + y_max = 30000, + + heat_point = 40, + humidity_point = 60, +}) + + +------- +--Decor +------- +--Oak Tree +minetest.register_decoration( + { + deco_type = "schematic", + place_on = {"main:grass"}, + rotation = "random", + sidelen = 16, + fill_ratio = 0.004, + biomes = {"Grasslands"}, + flags = "place_center_x, place_center_z", + schematic = minetest.get_modpath("main") + .. "/schematics/main_tree_oak.mts", + y_min = 1, + y_max = 32000, +}) + +--Oak Tree (forest) +minetest.register_decoration( + { + deco_type = "schematic", + place_on = {"main:grass_forest"}, + rotation = "random", + sidelen = 16, + fill_ratio = 0.1, + biomes = {"Forest"}, + flags = "place_center_x, place_center_z", + schematic = minetest.get_modpath("main") + .. "/schematics/main_tree_oak.mts", + y_min = 1, + y_max = 32000, +}) diff --git a/mods/main/nodes.lua b/mods/main/nodes.lua new file mode 100644 index 0000000..bd11239 --- /dev/null +++ b/mods/main/nodes.lua @@ -0,0 +1,171 @@ +minetest.register_node("main:dirt", { + description = "Dirt", + tiles = {"main_dirt.png"}, + groups = {crumbly = 3}, +}) + +minetest.register_node("main:stone", { + description = "Stone", + tiles = {"main_stone.png"}, + groups = {cracky = 3}, +}) + +minetest.register_node("main:cobble", { + description = "Cobble", + tiles = {"main_cobble.png"}, + groups = {cracky = 2}, +}) + +minetest.register_node("main:grass", { + description = "Dirt with Grass", + tiles = {"main_grass.png", "main_dirt.png", + {name = "main_dirt.png^main_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 2, snappy = 2}, +}) + +minetest.register_node("main:grass_forest", { + description = "Dirt with Forest Grass", + tiles = {"main_grass_forest.png", "main_dirt.png", + {name = "main_dirt.png^main_grass_forest_side.png", + tileable_vertical = false}}, + groups = {crumbly = 2, snappy = 2}, +}) + +minetest.register_node("main:sand", { + description = "Sand", + tiles = {"main_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, +}) + +--Oak Planks +minetest.register_node("main:planks_oak", { + description = "Oak Wood Planks", + tiles = {"main_planks_oak.png"}, + groups = {choppy = 2}, +}) + +--Oak Log +minetest.register_node("main:log_oak", { + description = "Oak Log", + tiles = {"main_log_oak.png"}, + groups = {choppy = 2}, +}) + +--Oak Leaves +minetest.register_node("main:leaves_oak", { + drawtype = "allfaces", + paramtype = "light", + light_propagates = true, + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + description = "Oak Leaves", + tiles = {"main_leaves_oak.png"}, + groups = {snappy = 2}, +}) + +--Spikes +minetest.register_node("main:spiked_wire", { + drawtype = "plantlike", + damage_per_second = 2 * 4, + paramtype = "light", + light_propagates = true, + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + description = "Spiked Wire", + tiles = {"main_spikedwire.png"}, + groups = {cracky = 2}, +}) + +--WATER +minetest.register_node("main:water_source", { + description = "Water Source", + drawtype = "liquid", + paramtype = "light", + + tiles = { + { + name = "main_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + alpha = 180, + post_effect_color = {a = 50, r = 0, g = 50, b = 200}, + + --Behavior + walkable = false, + pointable = false, + buildable_to = true, + diggable = false, + is_ground_content = false, + + --Properties + liquid_range = 14, + liquid_viscosity = 0.1, + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "main:water_flowing", + liquid_alternative_source = "main:water_source", + groups = {liquid = 3, water = 1}, +}) + +minetest.register_node("main:water_flowing", { + description = "Flowing Water", + drawtype = "flowingliquid", + paramtype = "light", + + tiles = { + { + name = "main_water_flowing_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + + special_tiles = { + { + name = "main_water_flowing_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, + aspect_h = 16, length = 2.0}, + backface_culling = true, + }, + + { + name = "main_water_flowing_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, + aspect_h = 16, length = 2.0}, + backface_culling = false, + } + }, + + alpha = 180, + post_effect_color = {a = 50, r = 0, g = 50, b = 200}, + + --Behavior + walkable = false, + pointable = false, + buildable_to = true, + diggable = false, + is_ground_content = false, + + --Properties + liquid_range = 14, + liquid_viscosity = 0.1, + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "main:water_flowing", + liquid_alternative_source = "main:water_source", + groups = {liquid = 3, water = 1}, +}) + diff --git a/mods/main/schematics/main_tree_oak.mts b/mods/main/schematics/main_tree_oak.mts new file mode 100644 index 0000000..9d0f804 Binary files /dev/null and b/mods/main/schematics/main_tree_oak.mts differ diff --git a/mods/main/textures/bubble.png b/mods/main/textures/bubble.png new file mode 100644 index 0000000..f45f3f7 Binary files /dev/null and b/mods/main/textures/bubble.png differ diff --git a/mods/main/textures/crack_anylength.png b/mods/main/textures/crack_anylength.png new file mode 100644 index 0000000..ab8d5b3 Binary files /dev/null and b/mods/main/textures/crack_anylength.png differ diff --git a/mods/main/textures/hand.png b/mods/main/textures/hand.png new file mode 100644 index 0000000..e40bc73 Binary files /dev/null and b/mods/main/textures/hand.png differ diff --git a/mods/main/textures/heart.png b/mods/main/textures/heart.png new file mode 100644 index 0000000..6d4e228 Binary files /dev/null and b/mods/main/textures/heart.png differ diff --git a/mods/main/textures/main_cobble.png b/mods/main/textures/main_cobble.png new file mode 100644 index 0000000..0a949c1 Binary files /dev/null and b/mods/main/textures/main_cobble.png differ diff --git a/mods/main/textures/main_dirt.png b/mods/main/textures/main_dirt.png new file mode 100644 index 0000000..b73f019 Binary files /dev/null and b/mods/main/textures/main_dirt.png differ diff --git a/mods/main/textures/main_grass.png b/mods/main/textures/main_grass.png new file mode 100644 index 0000000..cd1ceb7 Binary files /dev/null and b/mods/main/textures/main_grass.png differ diff --git a/mods/main/textures/main_grass_forest.png b/mods/main/textures/main_grass_forest.png new file mode 100644 index 0000000..c2a8990 Binary files /dev/null and b/mods/main/textures/main_grass_forest.png differ diff --git a/mods/main/textures/main_grass_forest_side.png b/mods/main/textures/main_grass_forest_side.png new file mode 100644 index 0000000..289ecc2 Binary files /dev/null and b/mods/main/textures/main_grass_forest_side.png differ diff --git a/mods/main/textures/main_grass_side.png b/mods/main/textures/main_grass_side.png new file mode 100644 index 0000000..738b8db Binary files /dev/null and b/mods/main/textures/main_grass_side.png differ diff --git a/mods/main/textures/main_leaves_apple.png b/mods/main/textures/main_leaves_apple.png new file mode 100644 index 0000000..451f30e Binary files /dev/null and b/mods/main/textures/main_leaves_apple.png differ diff --git a/mods/main/textures/main_leaves_oak.png b/mods/main/textures/main_leaves_oak.png new file mode 100644 index 0000000..0db1453 Binary files /dev/null and b/mods/main/textures/main_leaves_oak.png differ diff --git a/mods/main/textures/main_log_apple.png b/mods/main/textures/main_log_apple.png new file mode 100644 index 0000000..ef944d2 Binary files /dev/null and b/mods/main/textures/main_log_apple.png differ diff --git a/mods/main/textures/main_log_oak.png b/mods/main/textures/main_log_oak.png new file mode 100644 index 0000000..3202fcc Binary files /dev/null and b/mods/main/textures/main_log_oak.png differ diff --git a/mods/main/textures/main_planks_oak.png b/mods/main/textures/main_planks_oak.png new file mode 100644 index 0000000..c7d77e5 Binary files /dev/null and b/mods/main/textures/main_planks_oak.png differ diff --git a/mods/main/textures/main_sand.png b/mods/main/textures/main_sand.png new file mode 100644 index 0000000..1e753f0 Binary files /dev/null and b/mods/main/textures/main_sand.png differ diff --git a/mods/main/textures/main_spikedwire.png b/mods/main/textures/main_spikedwire.png new file mode 100644 index 0000000..1acd40a Binary files /dev/null and b/mods/main/textures/main_spikedwire.png differ diff --git a/mods/main/textures/main_stick.png b/mods/main/textures/main_stick.png new file mode 100644 index 0000000..218166f Binary files /dev/null and b/mods/main/textures/main_stick.png differ diff --git a/mods/main/textures/main_stone.png b/mods/main/textures/main_stone.png new file mode 100644 index 0000000..ac8a8c2 Binary files /dev/null and b/mods/main/textures/main_stone.png differ diff --git a/mods/main/textures/main_water.png b/mods/main/textures/main_water.png new file mode 100644 index 0000000..300b8a2 Binary files /dev/null and b/mods/main/textures/main_water.png differ diff --git a/mods/main/textures/main_water_flowing_animated.png b/mods/main/textures/main_water_flowing_animated.png new file mode 100644 index 0000000..f1c52f5 Binary files /dev/null and b/mods/main/textures/main_water_flowing_animated.png differ diff --git a/mods/main/textures/main_water_source_animated.png b/mods/main/textures/main_water_source_animated.png new file mode 100644 index 0000000..f1c52f5 Binary files /dev/null and b/mods/main/textures/main_water_source_animated.png differ diff --git a/mods/main/tools.lua b/mods/main/tools.lua new file mode 100644 index 0000000..58706e3 --- /dev/null +++ b/mods/main/tools.lua @@ -0,0 +1,63 @@ +minetest.register_item(":", { + type = "none", + wield_image = "hand.png", + wield_scale = {x=1,y=1,z=3.5}, + tool_capabilities = { + max_drop_level = 0, + full_punch_interval = 0.4, + + groupcaps = { + oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}, + snappy = {times={[3]=4.00}, uses=0, maxlevel=1}, + fleshy = {times={[3]=2.50}, uses=0, maxlevel=1}, + }, + damage_groups = {snappy = 2, fleshy = 2}, + } +}) + +minetest.register_item("main:supertool", { + type = "none", + wield_image = "main_cobble.png", + wield_scale = {x=1,y=1,z=1}, + tool_capabilities = { + max_drop_level = 0, + full_punch_interval = 0, + + groupcaps = { + oddly_breakable_by_hand = {times={[1]=0.00,[2]=0.00,[3]=0.00}, uses=0}, + snappy = {times={[1]=0.00, [2]=0.00, [3]=0.00}, uses=0, maxlevel=1}, + cracky = {times={[1]=0.00, [2]=0.00, [3]=0.00}, uses=0, maxlevel=1}, + choppy = {times={[1]=0.00, [2]=0.00, [3]=0.00}, uses=0, maxlevel=1}, + crumbly = {times={[1]=0.00, [2]=0.00, [3]=0.00}, uses=0, maxlevel=1}, + }, + damage_groups = {fleshy = 100}, + } +}) + +minetest.register_item("main:sword_wood", { + type = "none", + wield_image = "main_pickaxe_stone.png", + tool_capabilities = { + max_drop_level = 1, + full_punch_interval = 2.0, + + groupcaps = { + fleshy = {times={[2]=1.50,[3]=0.50}, uses=0, maxlevel=1}, + }, + damage_groups = {fleshy = 5, snappy = 4}, + } +}) + +minetest.register_item("main:sword_stone", { + type = "none", + wield_image = "main_pickaxe_stone.png", + tool_capabilities = { + max_drop_level = 1, + full_punch_interval = 0.3, + + groupcaps = { + fleshy = {times={[3]=1.50, [2]=0.80,[3]=0.20}, uses=0, maxlevel=1}, + }, + damage_groups = {fleshy = 7, snappy = 5}, + } +}) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua new file mode 100644 index 0000000..01b55fa --- /dev/null +++ b/mods/mobs/api.lua @@ -0,0 +1,3952 @@ + +-- Intllib and CMI support check +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP .. "/intllib.lua") +local use_cmi = minetest.global_exists("cmi") + +mobs = { + mod = "redo", + version = "20181005", + intllib = S, + invis = minetest.global_exists("invisibility") and invisibility or {}, +} + +-- creative check +local creative_cache = minetest.settings:get_bool("creative_mode") +function mobs.is_creative(name) + return creative_cache or minetest.check_player_privs(name, {creative = true}) +end + + +-- localize math functions +local pi = math.pi +local square = math.sqrt +local sin = math.sin +local cos = math.cos +local abs = math.abs +local min = math.min +local max = math.max +local atann = math.atan +local random = math.random +local floor = math.floor +local atan = function(x) + if not x or x ~= x then + --error("atan bassed NaN") + return 0 + else + return atann(x) + end +end + + +-- Load settings +local damage_enabled = minetest.settings:get_bool("enable_damage") +local mobs_spawn = minetest.settings:get_bool("mobs_spawn") ~= false +local peaceful_only = minetest.settings:get_bool("only_peaceful_mobs") +local disable_blood = minetest.settings:get_bool("mobs_disable_blood") +local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false +local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false +local creative = minetest.settings:get_bool("creative_mode") +local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false +local remove_far = minetest.settings:get_bool("remove_far_mobs") ~= false +local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0 +local show_health = minetest.settings:get_bool("mob_show_health") ~= false +local max_per_block = tonumber(minetest.settings:get("max_objects_per_block") or 99) +local mob_chance_multiplier = tonumber(minetest.settings:get("mob_chance_multiplier") or 1) + +-- Peaceful mode message so players will know there are no monsters +if peaceful_only then + minetest.register_on_joinplayer(function(player) + minetest.chat_send_player(player:get_player_name(), + S("** Peaceful Mode Active - No Monsters Will Spawn")) + end) +end + +-- calculate aoc range for mob count +local aoc_range = tonumber(minetest.settings:get("active_block_range")) * 16 + +-- pathfinding settings +local enable_pathfinding = true +local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching +local stuck_path_timeout = 10 -- how long will mob follow path before giving up + +-- default nodes +local node_fire = "fire:basic_flame" +local node_permanent_flame = "fire:permanent_flame" +local node_ice = "default:ice" +local node_snowblock = "default:snowblock" +local node_snow = "default:snow" +mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "default:dirt" + + +-- play sound +local mob_sound = function(self, sound) + + if sound then + minetest.sound_play(sound, { + object = self.object, + gain = 1.0, + max_hear_distance = self.sounds.distance + }) + end +end + + +-- attack player/mob +local do_attack = function(self, player) + + if self.state == "attack" then + return + end + + self.attack = player + self.state = "attack" + + if random(0, 100) < 90 then + mob_sound(self, self.sounds.war_cry) + end +end + + +-- calculate distance +local get_distance = function(a, b) + + local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z + + return square(x * x + y * y + z * z) +end + + +-- collision function based on jordan4ibanez' open_ai mod +local collision = function(self) + + local pos = self.object:get_pos() + local vel = self.object:get_velocity() + local x, z = 0, 0 + local width = -self.collisionbox[1] + self.collisionbox[4] + 0.5 + + for _,object in ipairs(minetest.get_objects_inside_radius(pos, width)) do + + if object:is_player() + or (object:get_luaentity()._cmi_is_mob == true and object ~= self.object) then + + local pos2 = object:get_pos() + local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z} + + x = x + vec.x + z = z + vec.z + end + end + + return({x, z}) +end + + +-- move mob in facing direction +local set_velocity = function(self, v) + + local c_x, c_y = 0, 0 + + -- can mob be pushed, if so calculate direction + if self.pushable then + c_x, c_y = unpack(collision(self)) + end + + -- halt mob if it has been ordered to stay + if self.order == "stand" then + self.object:set_velocity({x = 0, y = 0, z = 0}) + return + end + + local yaw = (self.object:get_yaw() or 0) + self.rotate + + self.object:set_velocity({ + x = (sin(yaw) * -v) + c_x, + y = self.object:get_velocity().y, + z = (cos(yaw) * v) + c_y, + }) +end + + +-- calculate mob velocity +local get_velocity = function(self) + + local v = self.object:get_velocity() + + return (v.x * v.x + v.z * v.z) ^ 0.5 +end + + +-- set and return valid yaw +local set_yaw = function(self, yaw, delay) + + if not yaw or yaw ~= yaw then + yaw = 0 + end + + delay = delay or 0 + + if delay == 0 then + self.object:set_yaw(yaw) + return yaw + end + + self.target_yaw = yaw + self.delay = delay + + return self.target_yaw +end + +-- global function to set mob yaw +function mobs:yaw(self, yaw, delay) + set_yaw(self, yaw, delay) +end + + +-- set defined animation +local set_animation = function(self, anim) + + if not self.animation + or not anim then return end + + self.animation.current = self.animation.current or "" + + -- only set different animation for attacks when setting to same set + if anim ~= "punch" and anim ~= "shoot" + and string.find(self.animation.current, anim) then + return + end + + -- check for more than one animation + local num = 0 + + for n = 1, 4 do + + if self.animation[anim .. n .. "_start"] + and self.animation[anim .. n .. "_end"] then + num = n + end + end + + -- choose random animation from set + if num > 0 then + num = random(0, num) + anim = anim .. (num ~= 0 and num or "") + end + + if anim == self.animation.current + or not self.animation[anim .. "_start"] + or not self.animation[anim .. "_end"] then + return + end + + self.animation.current = anim + + self.object:set_animation({ + x = self.animation[anim .. "_start"], + y = self.animation[anim .. "_end"]}, + self.animation[anim .. "_speed"] or self.animation.speed_normal or 15, + 0, self.animation[anim .. "_loop"] ~= false) +end + +-- above function exported for mount.lua +function mobs:set_animation(self, anim) + set_animation(self, anim) +end + + +-- check line of sight (by BrunoMine, tweaked by Astrobe) +local line_of_sight = function(self, pos1, pos2, stepsize) + + if not pos1 or not pos2 then return end + + stepsize = stepsize or 1 + + local stepv = vector.multiply(vector.direction(pos1, pos2), stepsize) + + local s, pos = minetest.line_of_sight(pos1, pos2, stepsize) + + -- normal walking and flying mobs can see you through air + if s == true then return true end + + -- New pos1 to be analyzed + local npos1 = {x = pos1.x, y = pos1.y, z = pos1.z} + + local r, pos = minetest.line_of_sight(npos1, pos2, stepsize) + + -- Checks the return + if r == true then return true end + + -- Nodename found + local nn = minetest.get_node(pos).name + + -- It continues to advance in the line of sight in search of a real + -- obstruction which counts as 'normal' nodebox. + while minetest.registered_nodes[nn] + and (minetest.registered_nodes[nn].walkable == false) do +-- or minetest.registered_nodes[nn].drawtype == "nodebox") do + + npos1 = vector.add(npos1, stepv) + + if get_distance(npos1, pos2) < stepsize then return true end + + -- scan again + r, pos = minetest.line_of_sight(npos1, pos2, stepsize) + + if r == true then return true end + + -- New Nodename found + nn = minetest.get_node(pos).name + end + + return false +end + +-- global function +function mobs:line_of_sight(self, pos1, pos2, stepsize) + + return line_of_sight(self, pos1, pos2, stepsize) +end + + +-- are we flying in what we are suppose to? (taikedz) +local flight_check = function(self, pos_w) + + local def = minetest.registered_nodes[self.standing_in] + + if not def then return false end -- nil check + + if type(self.fly_in) == "string" + and self.standing_in == self.fly_in then + + return true + + elseif type(self.fly_in) == "table" then + + for _,fly_in in pairs(self.fly_in) do + + if self.standing_in == fly_in then + + return true + end + end + end + + -- stops mobs getting stuck inside stairs and plantlike nodes + if def.drawtype ~= "airlike" + and def.drawtype ~= "liquid" + and def.drawtype ~= "flowingliquid" then + return true + end + + return false +end + + +-- custom particle effects +local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow) + + radius = radius or 2 + min_size = min_size or 0.5 + max_size = max_size or 1 + gravity = gravity or -10 + glow = glow or 0 + + minetest.add_particlespawner({ + amount = amount, + time = 0.25, + minpos = pos, + maxpos = pos, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = {x = 0, y = gravity, z = 0}, + maxacc = {x = 0, y = gravity, z = 0}, + minexptime = 0.1, + maxexptime = 1, + minsize = min_size, + maxsize = max_size, + texture = texture, + glow = glow, + }) +end + + +-- update nametag colour +local update_tag = function(self) + + local col = "#00FF00" + local qua = self.hp_max / 4 + + if self.health <= floor(qua * 3) then + col = "#FFFF00" + end + + if self.health <= floor(qua * 2) then + col = "#FF6600" + end + + if self.health <= floor(qua) then + col = "#FF0000" + end + + self.object:set_properties({ + nametag = self.nametag, + nametag_color = col + }) + +end + + +-- drop items +local item_drop = function(self) + + -- check for nil or no drops + if not self.drops or #self.drops == 0 then + return + end + + -- no drops if disabled by setting + if not mobs_drop_items then return end + + -- no drops for child mobs + if self.child then return end + + -- was mob killed by player? + local death_by_player = self.cause_of_death and self.cause_of_death.puncher + and self.cause_of_death.puncher:is_player() or nil + + local obj, item, num + local pos = self.object:get_pos() + + for n = 1, #self.drops do + + if random(1, self.drops[n].chance) == 1 then + + num = random(self.drops[n].min or 0, self.drops[n].max or 1) + item = self.drops[n].name + + -- cook items on a hot death + if self.cause_of_death.hot then + + local output = minetest.get_craft_result({ + method = "cooking", width = 1, items = {item}}) + + if output and output.item and not output.item:is_empty() then + item = output.item:get_name() + end + end + + -- only drop rare items (drops.min=0) if killed by player + if death_by_player then + obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) + + elseif self.drops[n].min ~= 0 then + obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) + end + + if obj and obj:get_luaentity() then + + obj:set_velocity({ + x = random(-10, 10) / 9, + y = 6, + z = random(-10, 10) / 9, + }) + + elseif obj then + obj:remove() -- item does not exist + end + end + end + + self.drops = {} +end + + +-- check if mob is dead or only hurt +local check_for_death = function(self, cmi_cause) + + -- has health actually changed? + if self.health == self.old_health and self.health > 0 then + return + end + + self.old_health = self.health + + -- still got some health? play hurt sound + if self.health > 0 then + + mob_sound(self, self.sounds.damage) + + -- make sure health isn't higher than max + if self.health > self.hp_max then + self.health = self.hp_max + end + + -- backup nametag so we can show health stats + if not self.nametag2 then + self.nametag2 = self.nametag or "" + end + + if show_health + and (cmi_cause and cmi_cause.type == "punch") then + + self.htimer = 2 + self.nametag = "♥ " .. self.health .. " / " .. self.hp_max + + update_tag(self) + end + + return false + end + + self.cause_of_death = cmi_cause + + -- drop items + item_drop(self) + + mob_sound(self, self.sounds.death) + + local pos = self.object:get_pos() + + -- execute custom death function + if self.on_die then + + self.on_die(self, pos) + + if use_cmi then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + + return true + end + + -- default death function and die animation (if defined) + if self.animation + and self.animation.die_start + and self.animation.die_end then + + local frames = self.animation.die_end - self.animation.die_start + local speed = self.animation.die_speed or 15 + local length = max(frames / speed, 0) + + self.attack = nil + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.passive = true + self.state = "die" + set_velocity(self, 0) + set_animation(self, "die") + + minetest.after(length, function(self) + + if use_cmi and self.object:get_luaentity() then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + end, self) + else + + if use_cmi then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + end + + effect(pos, 20, "tnt_smoke.png") + + return true +end + + +-- is mob facing a cliff +local is_at_cliff = function(self) + + if self.fear_height == 0 then -- 0 for no falling protection! + return false + end + + local yaw = self.object:get_yaw() + local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) + local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) + local pos = self.object:get_pos() + local ypos = pos.y + self.collisionbox[2] -- just above floor + + if minetest.line_of_sight( + {x = pos.x + dir_x, y = ypos, z = pos.z + dir_z}, + {x = pos.x + dir_x, y = ypos - self.fear_height, z = pos.z + dir_z} + , 1) then + + return true + end + + return false +end + + +-- get node but use fallback for nil or unknown +local node_ok = function(pos, fallback) + + fallback = fallback or mobs.fallback_node + + local node = minetest.get_node_or_nil(pos) + + if node and minetest.registered_nodes[node.name] then + return node + end + + return minetest.registered_nodes[fallback] +end + + +-- environmental damage (water, lava, fire, light etc.) +local do_env_damage = function(self) + + -- feed/tame text timer (so mob 'full' messages dont spam chat) + if self.htimer > 0 then + self.htimer = self.htimer - 1 + end + + -- reset nametag after showing health stats + if self.htimer < 1 and self.nametag2 then + + self.nametag = self.nametag2 + self.nametag2 = nil + + update_tag(self) + end + + local pos = self.object:get_pos() + + self.time_of_day = minetest.get_timeofday() + + -- remove mob if standing inside ignore node + if self.standing_in == "ignore" then + self.object:remove() + return + end + + -- is mob light sensative, or scared of the dark :P + if self.light_damage ~= 0 then + + local light = minetest.get_node_light(pos) or 0 + + if light >= self.light_damage_min + and light <= self.light_damage_max then + + self.health = self.health - self.light_damage + + effect(pos, 5, "tnt_smoke.png") + + if check_for_death(self, {type = "light"}) then return end + end + end + + local nodef = minetest.registered_nodes[self.standing_in] + + pos.y = pos.y + 1 -- for particle effect position + + -- water + if self.water_damage + and nodef.groups.water then + + if self.water_damage ~= 0 then + + self.health = self.health - self.water_damage + + effect(pos, 5, "bubble.png", nil, nil, 1, nil) + + if check_for_death(self, {type = "environment", + pos = pos, node = self.standing_in}) then return end + end + + -- lava or fire or ignition source + elseif self.lava_damage + and nodef.groups.igniter then +-- and (nodef.groups.lava +-- or self.standing_in == node_fire +-- or self.standing_in == node_permanent_flame) then + + if self.lava_damage ~= 0 then + + self.health = self.health - self.lava_damage + + effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) + + if check_for_death(self, {type = "environment", + pos = pos, node = self.standing_in, hot = true}) then return end + end + + -- damage_per_second node check + elseif nodef.damage_per_second ~= 0 then + + self.health = self.health - nodef.damage_per_second + + effect(pos, 5, "tnt_smoke.png") + + if check_for_death(self, {type = "environment", + pos = pos, node = self.standing_in}) then return end + end +--[[ + --- suffocation inside solid node + if self.suffocation ~= 0 + and nodef.walkable == true + and nodef.groups.disable_suffocation ~= 1 + and nodef.drawtype == "normal" then + + self.health = self.health - self.suffocation + + if check_for_death(self, {type = "environment", + pos = pos, node = self.standing_in}) then return end + end +]] + check_for_death(self, {type = "unknown"}) +end + + +-- jump if facing a solid node (not fences or gates) +local do_jump = function(self) + + if not self.jump + or self.jump_height == 0 + or self.fly + or self.child + or self.order == "stand" then + return false + end + + self.facing_fence = false + + -- something stopping us while moving? + if self.state ~= "stand" + and get_velocity(self) > 0.5 + and self.object:get_velocity().y ~= 0 then + return false + end + + local pos = self.object:get_pos() + local yaw = self.object:get_yaw() + + -- what is mob standing on? + pos.y = pos.y + self.collisionbox[2] - 0.2 + + local nod = node_ok(pos) + +--print ("standing on:", nod.name, pos.y) + + if minetest.registered_nodes[nod.name].walkable == false then + return false + end + + -- where is front + local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) + local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) + + -- what is in front of mob? + local nod = node_ok({ + x = pos.x + dir_x, + y = pos.y + 0.5, + z = pos.z + dir_z + }) + + -- thin blocks that do not need to be jumped + if nod.name == node_snow then + return false + end + +--print ("in front:", nod.name, pos.y + 0.5) + + if self.walk_chance == 0 + or minetest.registered_items[nod.name].walkable then + + if not nod.name:find("fence") + and not nod.name:find("gate") then + + local v = self.object:get_velocity() + + v.y = self.jump_height + + set_animation(self, "jump") -- only when defined + + self.object:set_velocity(v) + + -- when in air move forward + minetest.after(0.3, function(self, v) + + if self.object:get_luaentity() then + + self.object:set_acceleration({ + x = v.x * 2,--1.5, + y = 0, + z = v.z * 2,--1.5 + }) + end + end, self, v) + + if get_velocity(self) > 0 then + mob_sound(self, self.sounds.jump) + end + else + self.facing_fence = true + end + + return true + end + + return false +end + + +-- blast damage to entities nearby (modified from TNT mod) +local entity_physics = function(pos, radius) + + radius = radius * 2 + + local objs = minetest.get_objects_inside_radius(pos, radius) + local obj_pos, dist + + for n = 1, #objs do + + obj_pos = objs[n]:get_pos() + + dist = get_distance(pos, obj_pos) + if dist < 1 then dist = 1 end + + local damage = floor((4 / dist) * radius) + local ent = objs[n]:get_luaentity() + + -- punches work on entities AND players + objs[n]:punch(objs[n], 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, pos) + end +end + + +-- should mob follow what I'm holding ? +local follow_holding = function(self, clicker) + + if mobs.invis[clicker:get_player_name()] then + return false + end + + local item = clicker:get_wielded_item() + local t = type(self.follow) + + -- single item + if t == "string" + and item:get_name() == self.follow then + return true + + -- multiple items + elseif t == "table" then + + for no = 1, #self.follow do + + if self.follow[no] == item:get_name() then + return true + end + end + end + + return false +end + + +-- find two animals of same type and breed if nearby and horny +local breed = function(self) + + -- child takes 240 seconds before growing into adult + if self.child == true then + + self.hornytimer = self.hornytimer + 1 + + if self.hornytimer > 240 then + + self.child = false + self.hornytimer = 0 + + self.object:set_properties({ + textures = self.base_texture, + mesh = self.base_mesh, + visual_size = self.base_size, + collisionbox = self.base_colbox, + selectionbox = self.base_selbox, + }) + + -- custom function when child grows up + if self.on_grown then + self.on_grown(self) + else + -- jump when fully grown so as not to fall into ground + self.object:set_velocity({ + x = 0, + y = self.jump_height, + z = 0 + }) + end + end + + return + end + + -- horny animal can mate for 40 seconds, + -- afterwards horny animal cannot mate again for 200 seconds + if self.horny == true + and self.hornytimer < 240 then + + self.hornytimer = self.hornytimer + 1 + + if self.hornytimer >= 240 then + self.hornytimer = 0 + self.horny = false + end + end + + -- find another same animal who is also horny and mate if nearby + if self.horny == true + and self.hornytimer <= 40 then + + local pos = self.object:get_pos() + + effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "heart.png", 3, 4, 1, 0.1) + + local objs = minetest.get_objects_inside_radius(pos, 3) + local num = 0 + local ent = nil + + for n = 1, #objs do + + ent = objs[n]:get_luaentity() + + -- check for same animal with different colour + local canmate = false + + if ent then + + if ent.name == self.name then + canmate = true + else + local entname = string.split(ent.name,":") + local selfname = string.split(self.name,":") + + if entname[1] == selfname[1] then + entname = string.split(entname[2],"_") + selfname = string.split(selfname[2],"_") + + if entname[1] == selfname[1] then + canmate = true + end + end + end + end + + if ent + and canmate == true + and ent.horny == true + and ent.hornytimer <= 40 then + num = num + 1 + end + + -- found your mate? then have a baby + if num > 1 then + + self.hornytimer = 41 + ent.hornytimer = 41 + + -- spawn baby + minetest.after(5, function(self, ent) + + if not self.object:get_luaentity() then + return + end + + -- custom breed function + if self.on_breed then + + -- when false skip going any further + if self.on_breed(self, ent) == false then + return + end + else + effect(pos, 15, "tnt_smoke.png", 1, 2, 2, 15, 5) + end + + local mob = minetest.add_entity(pos, self.name) + local ent2 = mob:get_luaentity() + local textures = self.base_texture + + -- using specific child texture (if found) + if self.child_texture then + textures = self.child_texture[1] + end + + -- and resize to half height + mob:set_properties({ + textures = textures, + visual_size = { + x = self.base_size.x * .5, + y = self.base_size.y * .5, + }, + collisionbox = { + self.base_colbox[1] * .5, + self.base_colbox[2] * .5, + self.base_colbox[3] * .5, + self.base_colbox[4] * .5, + self.base_colbox[5] * .5, + self.base_colbox[6] * .5, + }, + selectionbox = { + self.base_selbox[1] * .5, + self.base_selbox[2] * .5, + self.base_selbox[3] * .5, + self.base_selbox[4] * .5, + self.base_selbox[5] * .5, + self.base_selbox[6] * .5, + }, + }) + -- tamed and owned by parents' owner + ent2.child = true + ent2.tamed = true + ent2.owner = self.owner + end, self, ent) + + num = 0 + + break + end + end + end +end + + +-- find and replace what mob is looking for (grass, wheat etc.) +local replace = function(self, pos) + + if not mobs_griefing + or not self.replace_rate + or not self.replace_what + or self.child == true + or self.object:get_velocity().y ~= 0 + or random(1, self.replace_rate) > 1 then + return + end + + local what, with, y_offset + + if type(self.replace_what[1]) == "table" then + + local num = random(#self.replace_what) + + what = self.replace_what[num][1] or "" + with = self.replace_what[num][2] or "" + y_offset = self.replace_what[num][3] or 0 + else + what = self.replace_what + with = self.replace_with or "" + y_offset = self.replace_offset or 0 + end + + pos.y = pos.y + y_offset + + if #minetest.find_nodes_in_area(pos, pos, what) > 0 then + +-- print ("replace node = ".. minetest.get_node(pos).name, pos.y) + + local oldnode = {name = what} + local newnode = {name = with} + local on_replace_return + + if self.on_replace then + on_replace_return = self.on_replace(self, pos, oldnode, newnode) + end + + if on_replace_return ~= false then + + minetest.set_node(pos, {name = with}) + + -- when cow/sheep eats grass, replace wool and milk + if self.gotten == true then + self.gotten = false + self.object:set_properties(self) + end + end + end +end + + +-- check if daytime and also if mob is docile during daylight hours +local day_docile = function(self) + + if self.docile_by_day == false then + + return false + + elseif self.docile_by_day == true + and self.time_of_day > 0.2 + and self.time_of_day < 0.8 then + + return true + end +end + + +local los_switcher = false +local height_switcher = false + +-- path finding and smart mob routine by rnd, line_of_sight and other edits by Elkien3 +local smart_mobs = function(self, s, p, dist, dtime) + + local s1 = self.path.lastpos + + local target_pos = self.attack:get_pos() + + -- is it becoming stuck? + if abs(s1.x - s.x) + abs(s1.z - s.z) < .5 then + self.path.stuck_timer = self.path.stuck_timer + dtime + else + self.path.stuck_timer = 0 + end + + self.path.lastpos = {x = s.x, y = s.y, z = s.z} + + local use_pathfind = false + local has_lineofsight = minetest.line_of_sight( + {x = s.x, y = (s.y) + .5, z = s.z}, + {x = target_pos.x, y = (target_pos.y) + 1.5, z = target_pos.z}, .2) + + -- im stuck, search for path + if not has_lineofsight then + + if los_switcher == true then + use_pathfind = true + los_switcher = false + end -- cannot see target! + else + if los_switcher == false then + + los_switcher = true + use_pathfind = false + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end -- can see target! + end + + if (self.path.stuck_timer > stuck_timeout and not self.path.following) then + + use_pathfind = true + self.path.stuck_timer = 0 + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end + + if (self.path.stuck_timer > stuck_path_timeout and self.path.following) then + + use_pathfind = true + self.path.stuck_timer = 0 + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end + + if abs(vector.subtract(s,target_pos).y) > self.stepheight then + + if height_switcher then + use_pathfind = true + height_switcher = false + end + else + if not height_switcher then + use_pathfind = false + height_switcher = true + end + end + + if use_pathfind then + -- lets try find a path, first take care of positions + -- since pathfinder is very sensitive + local sheight = self.collisionbox[5] - self.collisionbox[2] + + -- round position to center of node to avoid stuck in walls + -- also adjust height for player models! + s.x = floor(s.x + 0.5) +-- s.y = floor(s.y + 0.5) - sheight + s.z = floor(s.z + 0.5) + + local ssight, sground = minetest.line_of_sight(s, { + x = s.x, y = s.y - 4, z = s.z}, 1) + + -- determine node above ground + if not ssight then + s.y = sground.y + 1 + end + + local p1 = self.attack:get_pos() + + p1.x = floor(p1.x + 0.5) + p1.y = floor(p1.y + 0.5) + p1.z = floor(p1.z + 0.5) + + local dropheight = 6 + if self.fear_height ~= 0 then dropheight = self.fear_height end + + self.path.way = minetest.find_path(s, p1, 16, self.stepheight, dropheight, "Dijkstra") + +--[[ + -- show path using particles + if self.path.way and #self.path.way > 0 then + print ("-- path length:" .. tonumber(#self.path.way)) + for _,pos in pairs(self.path.way) do + minetest.add_particle({ + pos = pos, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 1, + size = 4, + collisiondetection = false, + vertical = false, + texture = "heart.png", + }) + end + end +]] + + self.state = "" + do_attack(self, self.attack) + + -- no path found, try something else + if not self.path.way then + + self.path.following = false + + -- lets make way by digging/building if not accessible + if self.pathfinding == 2 and mobs_griefing then + + -- is player higher than mob? + if s.y < p1.y then + + -- build upwards + if not minetest.is_protected(s, "") then + + local ndef1 = minetest.registered_nodes[self.standing_in] + + if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then + + minetest.set_node(s, {name = mobs.fallback_node}) + end + end + + local sheight = math.ceil(self.collisionbox[5]) + 1 + + -- assume mob is 2 blocks high so it digs above its head + s.y = s.y + sheight + + -- remove one block above to make room to jump + if not minetest.is_protected(s, "") then + + local node1 = node_ok(s, "air").name + local ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.set_node(s, {name = "air"}) + minetest.add_item(s, ItemStack(node1)) + + end + end + + s.y = s.y - sheight + self.object:set_pos({x = s.x, y = s.y + 2, z = s.z}) + + else -- dig 2 blocks to make door toward player direction + + local yaw1 = self.object:get_yaw() + pi / 2 + local p1 = { + x = s.x + cos(yaw1), + y = s.y, + z = s.z + sin(yaw1) + } + + if not minetest.is_protected(p1, "") then + + local node1 = node_ok(p1, "air").name + local ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.add_item(p1, ItemStack(node1)) + minetest.set_node(p1, {name = "air"}) + end + + p1.y = p1.y + 1 + node1 = node_ok(p1, "air").name + ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.add_item(p1, ItemStack(node1)) + minetest.set_node(p1, {name = "air"}) + end + + end + end + end + + -- will try again in 2 second + self.path.stuck_timer = stuck_timeout - 2 + + -- frustration! cant find the damn path :( + mob_sound(self, self.sounds.random) + else + -- yay i found path + mob_sound(self, self.sounds.war_cry) + set_velocity(self, self.walk_velocity) + + -- follow path now that it has it + self.path.following = true + end + end +end + + +-- specific attacks +local specific_attack = function(list, what) + + -- no list so attack default (player, animals etc.) + if list == nil then + return true + end + + -- found entity on list to attack? + for no = 1, #list do + + if list[no] == what then + return true + end + end + + return false +end + + +-- general attack function for all mobs ========== +local general_attack = function(self) + + -- return if already attacking, passive or docile during day + if self.passive + or self.state == "attack" + or day_docile(self) then + return + end + + local s = self.object:get_pos() + local objs = minetest.get_objects_inside_radius(s, self.view_range) + + -- remove entities we aren't interested in + for n = 1, #objs do + + local ent = objs[n]:get_luaentity() + + -- are we a player? + if objs[n]:is_player() then + + -- if player invisible or mob not setup to attack then remove from list + if self.attack_players == false + or (self.owner and self.type ~= "monster") + or mobs.invis[objs[n]:get_player_name()] + or not specific_attack(self.specific_attack, "player") then + objs[n] = nil +--print("- pla", n) + end + + -- or are we a mob? + elseif ent and ent._cmi_is_mob then + + -- remove mobs not to attack + if self.name == ent.name + or (not self.attack_animals and ent.type == "animal") + or (not self.attack_monsters and ent.type == "monster") + or (not self.attack_npcs and ent.type == "npc") + or not specific_attack(self.specific_attack, ent.name) then + objs[n] = nil +--print("- mob", n, self.name, ent.name) + end + + -- remove all other entities + else +--print(" -obj", n) + objs[n] = nil + end + end + + local p, sp, dist, min_player + local min_dist = self.view_range + 1 + + -- go through remaining entities and select closest + for _,player in pairs(objs) do + + p = player:get_pos() + sp = s + + dist = get_distance(p, s) + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + -- choose closest player to attack that isnt self + if dist ~= 0 + and dist < min_dist + and line_of_sight(self, sp, p, 2) == true then + min_dist = dist + min_player = player + end + end + + -- attack closest player or mob + if min_player and random(1, 100) > self.attack_chance then + do_attack(self, min_player) + end +end + + +-- specific runaway +local specific_runaway = function(list, what) + + -- no list so do not run + if list == nil then + return false + end + + -- found entity on list to attack? + for no = 1, #list do + + if list[no] == what then + return true + end + end + + return false +end + + +-- find someone to runaway from +local runaway_from = function(self) + + if not self.runaway_from then + return + end + + local s = self.object:get_pos() + local p, sp, dist, pname + local player, obj, min_player, name + local min_dist = self.view_range + 1 + local objs = minetest.get_objects_inside_radius(s, self.view_range) + + for n = 1, #objs do + + if objs[n]:is_player() then + + pname = objs[n]:get_player_name() + + if mobs.invis[pname] + or self.owner == pname then + + name = "" + else + player = objs[n] + name = "player" + end + else + obj = objs[n]:get_luaentity() + + if obj then + player = obj.object + name = obj.name or "" + end + end + + -- find specific mob to runaway from + if name ~= "" and name ~= self.name + and specific_runaway(self.runaway_from, name) then + + p = player:get_pos() + sp = s + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + dist = get_distance(p, s) + + -- choose closest player/mob to runaway from + if dist < min_dist + and line_of_sight(self, sp, p, 2) == true then + min_dist = dist + min_player = player + end + end + end + + if min_player then + + local lp = player:get_pos() + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end + + yaw = set_yaw(self, yaw, 4) + self.state = "runaway" + self.runaway_timer = 3 + self.following = nil + end +end + + +-- follow player if owner or holding item, if fish outta water then flop +local follow_flop = function(self) + + -- find player to follow + if (self.follow ~= "" + or self.order == "follow") + and not self.following + and self.state ~= "attack" + and self.state ~= "runaway" then + + local s = self.object:get_pos() + local players = minetest.get_connected_players() + + for n = 1, #players do + + if get_distance(players[n]:get_pos(), s) < self.view_range + and not mobs.invis[ players[n]:get_player_name() ] then + + self.following = players[n] + + break + end + end + end + + if self.type == "npc" + and self.order == "follow" + and self.state ~= "attack" + and self.owner ~= "" then + + -- npc stop following player if not owner + if self.following + and self.owner + and self.owner ~= self.following:get_player_name() then + self.following = nil + end + else + -- stop following player if not holding specific item + if self.following + and self.following:is_player() + and follow_holding(self, self.following) == false then + self.following = nil + end + + end + + -- follow that thing + if self.following then + + local s = self.object:get_pos() + local p + + if self.following:is_player() then + + p = self.following:get_pos() + + elseif self.following.object then + + p = self.following.object:get_pos() + end + + if p then + + local dist = get_distance(p, s) + + -- dont follow if out of range + if dist > self.view_range then + self.following = nil + else + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw, 6) + + -- anyone but standing npc's can move along + if dist > self.reach + and self.order ~= "stand" then + + set_velocity(self, self.walk_velocity) + + if self.walk_chance ~= 0 then + set_animation(self, "walk") + end + else + set_velocity(self, 0) + set_animation(self, "stand") + end + + return + end + end + end + + -- swimmers flop when out of their element, and swim again when back in + if self.fly then + local s = self.object:get_pos() + if not flight_check(self, s) then + + self.state = "flop" + self.object:set_velocity({x = 0, y = -5, z = 0}) + + set_animation(self, "stand") + + return + elseif self.state == "flop" then + self.state = "stand" + end + end +end + + +-- dogshoot attack switch and counter function +local dogswitch = function(self, dtime) + + -- switch mode not activated + if not self.dogshoot_switch + or not dtime then + return 0 + end + + self.dogshoot_count = self.dogshoot_count + dtime + + if (self.dogshoot_switch == 1 + and self.dogshoot_count > self.dogshoot_count_max) + or (self.dogshoot_switch == 2 + and self.dogshoot_count > self.dogshoot_count2_max) then + + self.dogshoot_count = 0 + + if self.dogshoot_switch == 1 then + self.dogshoot_switch = 2 + else + self.dogshoot_switch = 1 + end + end + + return self.dogshoot_switch +end + + +-- execute current state (stand, walk, run, attacks) +local do_states = function(self, dtime) + + local yaw = self.object:get_yaw() or 0 + + if self.state == "stand" then + + if random(1, 4) == 1 then + + local lp = nil + local s = self.object:get_pos() + local objs = minetest.get_objects_inside_radius(s, 3) + + for n = 1, #objs do + + if objs[n]:is_player() then + lp = objs[n]:get_pos() + break + end + end + + -- look at any players nearby, otherwise turn randomly + if lp then + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + else + yaw = yaw + random(-0.5, 0.5) + end + + yaw = set_yaw(self, yaw, 8) + end + + set_velocity(self, 0) + set_animation(self, "stand") + + -- mobs ordered to stand stay standing + if self.order ~= "stand" + and self.walk_chance ~= 0 + and self.facing_fence ~= true + and random(1, 100) <= self.walk_chance + and is_at_cliff(self) == false then + + set_velocity(self, self.walk_velocity) + self.state = "walk" + set_animation(self, "walk") + end + + elseif self.state == "walk" then + + local s = self.object:get_pos() + local lp = nil + + -- is there something I need to avoid? + if self.water_damage > 0 + and self.lava_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:water", "group:lava"}) + + elseif self.water_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:water"}) + + elseif self.lava_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:lava"}) + end + + if lp then + + -- if mob in water or lava then look for land + if (self.lava_damage + and minetest.registered_nodes[self.standing_in].groups.lava) + or (self.water_damage + and minetest.registered_nodes[self.standing_in].groups.water) then + + lp = minetest.find_node_near(s, 5, {"group:soil", "group:stone", + "group:sand", node_ice, node_snowblock}) + + -- did we find land? + if lp then + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + + -- look towards land and jump/move in that direction + yaw = set_yaw(self, yaw, 6) + do_jump(self) + set_velocity(self, self.walk_velocity) + else + yaw = yaw + random(-0.5, 0.5) + end + + else + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + end + + yaw = set_yaw(self, yaw, 8) + + -- otherwise randomly turn + elseif random(1, 100) <= 30 then + + yaw = yaw + random(-0.5, 0.5) + + yaw = set_yaw(self, yaw, 8) + end + + -- stand for great fall in front + local temp_is_cliff = is_at_cliff(self) + + if self.facing_fence == true + or temp_is_cliff + or random(1, 100) <= 30 then + + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.walk_velocity) + + if flight_check(self) + and self.animation + and self.animation.fly_start + and self.animation.fly_end then + set_animation(self, "fly") + else + set_animation(self, "walk") + end + end + + -- runaway when punched + elseif self.state == "runaway" then + + self.runaway_timer = self.runaway_timer + 1 + + -- stop after 5 seconds or when at cliff + if self.runaway_timer > 5 + or is_at_cliff(self) + or self.order == "stand" then + self.runaway_timer = 0 + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.run_velocity) + set_animation(self, "walk") + end + + -- attack routines (explode, dogfight, shoot, dogshoot) + elseif self.state == "attack" then + + -- calculate distance from mob and enemy + local s = self.object:get_pos() + local p = self.attack:get_pos() or s + local dist = get_distance(p, s) + + -- stop attacking if player invisible or out of range + if dist > self.view_range + or not self.attack + or not self.attack:get_pos() + or self.attack:get_hp() <= 0 + or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then + +-- print(" ** stop attacking **", dist, self.view_range) + self.state = "stand" + set_velocity(self, 0) + set_animation(self, "stand") + self.attack = nil + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.path.way = nil + + return + end + + if self.attack_type == "explode" then + + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + local node_break_radius = self.explosion_radius or 1 + local entity_damage_radius = self.explosion_damage_radius + or (node_break_radius * 2) + + -- start timer when in reach and line of sight + if not self.v_start + and dist <= self.reach + and line_of_sight(self, s, p, 2) then + + self.v_start = true + self.timer = 0 + self.blinktimer = 0 + mob_sound(self, self.sounds.fuse) +-- print ("=== explosion timer started", self.explosion_timer) + + -- stop timer if out of reach or direct line of sight + elseif self.allow_fuse_reset + and self.v_start + and (dist > self.reach + or not line_of_sight(self, s, p, 2)) then + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.blinkstatus = false + self.object:settexturemod("") + end + + -- walk right up to player unless the timer is active + if self.v_start and (self.stop_to_explode or dist < 1.5) then + set_velocity(self, 0) + else + set_velocity(self, self.run_velocity) + end + + if self.animation and self.animation.run_start then + set_animation(self, "run") + else + set_animation(self, "walk") + end + + if self.v_start then + + self.timer = self.timer + dtime + self.blinktimer = (self.blinktimer or 0) + dtime + + if self.blinktimer > 0.2 then + + self.blinktimer = 0 + + if self.blinkstatus then + self.object:settexturemod("") + else + self.object:settexturemod("^[brighten") + end + + self.blinkstatus = not self.blinkstatus + end + +-- print ("=== explosion timer", self.timer) + + if self.timer > self.explosion_timer then + + local pos = self.object:get_pos() + + -- dont damage anything if area protected or next to water + if minetest.find_node_near(pos, 1, {"group:water"}) + or minetest.is_protected(pos, "") then + + node_break_radius = 1 + end + + self.object:remove() + + if minetest.get_modpath("tnt") and tnt and tnt.boom + and not minetest.is_protected(pos, "") then + + tnt.boom(pos, { + radius = node_break_radius, + damage_radius = entity_damage_radius, + sound = self.sounds.explode, + }) + else + + minetest.sound_play(self.sounds.explode, { + pos = pos, + gain = 1.0, + max_hear_distance = self.sounds.distance or 32 + }) + + entity_physics(pos, entity_damage_radius) + effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0) + end + + return + end + end + + elseif self.attack_type == "dogfight" + or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 2) + or (self.attack_type == "dogshoot" and dist <= self.reach and dogswitch(self) == 0) then + + if self.fly + and dist > self.reach then + + local p1 = s + local me_y = floor(p1.y) + local p2 = p + local p_y = floor(p2.y + 1) + local v = self.object:get_velocity() + + if flight_check(self, s) then + + if me_y < p_y then + + self.object:set_velocity({ + x = v.x, + y = 1 * self.walk_velocity, + z = v.z + }) + + elseif me_y > p_y then + + self.object:set_velocity({ + x = v.x, + y = -1 * self.walk_velocity, + z = v.z + }) + end + else + if me_y < p_y then + + self.object:set_velocity({ + x = v.x, + y = 0.01, + z = v.z + }) + + elseif me_y > p_y then + + self.object:set_velocity({ + x = v.x, + y = -0.01, + z = v.z + }) + end + end + + end + + -- rnd: new movement direction + if self.path.following + and self.path.way + and self.attack_type ~= "dogshoot" then + + -- no paths longer than 50 + if #self.path.way > 50 + or dist < self.reach then + self.path.following = false + return + end + + local p1 = self.path.way[1] + + if not p1 then + self.path.following = false + return + end + + if abs(p1.x-s.x) + abs(p1.z - s.z) < 0.6 then + -- reached waypoint, remove it from queue + table.remove(self.path.way, 1) + end + + -- set new temporary target + p = {x = p1.x, y = p1.y, z = p1.z} + end + + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + -- move towards enemy if beyond mob reach + if dist > self.reach then + + -- path finding by rnd + if self.pathfinding -- only if mob has pathfinding enabled + and enable_pathfinding then + + smart_mobs(self, s, p, dist, dtime) + end + + if is_at_cliff(self) then + + set_velocity(self, 0) + set_animation(self, "stand") + else + + if self.path.stuck then + set_velocity(self, self.walk_velocity) + else + set_velocity(self, self.run_velocity) + end + + if self.animation and self.animation.run_start then + set_animation(self, "run") + else + set_animation(self, "walk") + end + end + + else -- rnd: if inside reach range + + self.path.stuck = false + self.path.stuck_timer = 0 + self.path.following = false -- not stuck anymore + + set_velocity(self, 0) + + if not self.custom_attack then + + if self.timer > 1 then + + self.timer = 0 + +-- if self.double_melee_attack +-- and random(1, 2) == 1 then +-- set_animation(self, "punch2") +-- else + set_animation(self, "punch") +-- end + + local p2 = p + local s2 = s + + p2.y = p2.y + .5 + s2.y = s2.y + .5 + + if line_of_sight(self, p2, s2) == true then + + -- play attack sound + mob_sound(self, self.sounds.attack) + + -- punch player (or what player is attached to) + local attached = self.attack:get_attach() + if attached then + self.attack = attached + end + self.attack:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self.damage} + }, nil) + end + end + else -- call custom attack every second + if self.custom_attack + and self.timer > 1 then + + self.timer = 0 + + self.custom_attack(self, p) + end + end + end + + elseif self.attack_type == "shoot" + or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 1) + or (self.attack_type == "dogshoot" and dist > self.reach and dogswitch(self) == 0) then + + p.y = p.y - .5 + s.y = s.y + .5 + + local dist = get_distance(p, s) + local vec = { + x = p.x - s.x, + y = p.y - s.y, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + set_velocity(self, 0) + + if self.shoot_interval + and self.timer > self.shoot_interval + and random(1, 100) <= 60 then + + self.timer = 0 + set_animation(self, "shoot") + + -- play shoot attack sound + mob_sound(self, self.sounds.shoot_attack) + + local p = self.object:get_pos() + + p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2 + + if minetest.registered_entities[self.arrow] then + + local obj = minetest.add_entity(p, self.arrow) + local ent = obj:get_luaentity() + local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 + local v = ent.velocity or 1 -- or set to default + + ent.switch = 1 + ent.owner_id = tostring(self.object) -- add unique owner id to arrow + + -- offset makes shoot aim accurate + vec.y = vec.y + self.shoot_offset + vec.x = vec.x * (v / amount) + vec.y = vec.y * (v / amount) + vec.z = vec.z * (v / amount) + + obj:set_velocity(vec) + end + end + end + end +end + + +-- falling and fall damage +local falling = function(self, pos) + + if self.fly then + return + end + + -- floating in water (or falling) + local v = self.object:get_velocity() + + if v.y > 0 then + + -- apply gravity when moving up + self.object:set_acceleration({ + x = 0, + y = -10, + z = 0 + }) + + elseif v.y <= 0 and v.y > self.fall_speed then + + -- fall downwards at set speed + self.object:set_acceleration({ + x = 0, + y = self.fall_speed, + z = 0 + }) + else + -- stop accelerating once max fall speed hit + self.object:set_acceleration({x = 0, y = 0, z = 0}) + end + + -- in water then float up + if self.standing_in + and minetest.registered_nodes[self.standing_in].groups.water then + + if self.floats == 1 then + + self.object:set_acceleration({ + x = 0, + y = -self.fall_speed / (max(1, v.y) ^ 8), -- 8 was 2 + z = 0 + }) + end + else + + -- fall damage onto solid ground + if self.fall_damage == 1 + and self.object:get_velocity().y == 0 then + + local d = (self.old_y or 0) - self.object:get_pos().y + + if d > 5 then + + self.health = self.health - floor(d - 5) + + effect(pos, 5, "tnt_smoke.png", 1, 2, 2, nil) + + if check_for_death(self, {type = "fall"}) then + return + end + end + + self.old_y = self.object:get_pos().y + end + end +end + + +-- is Took Ranks mod active? +local tr = minetest.get_modpath("toolranks") + +-- deal damage and effects when mob punched +local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) + + -- mob health check + if self.health <= 0 then + return + end + + -- custom punch function + if self.do_punch + and self.do_punch(self, hitter, tflp, tool_capabilities, dir) == false then + return + end + + -- error checking when mod profiling is enabled + if not tool_capabilities then + minetest.log("warning", "[mobs] Mod profiling enabled, damage not enabled") + return + end + + -- is mob protected? + if self.protected and hitter:is_player() + and minetest.is_protected(self.object:get_pos(), hitter:get_player_name()) then + minetest.chat_send_player(hitter:get_player_name(), S("Mob has been protected!")) + return + end + + local weapon = hitter:get_wielded_item() + local weapon_def = weapon:get_definition() or {} + local punch_interval = 1.4 + + -- calculate mob damage + local damage = 0 + local armor = self.object:get_armor_groups() or {} + local tmp + + -- quick error check incase it ends up 0 (serialize.h check test) + if tflp == 0 then + tflp = 0.2 + end + + if use_cmi then + damage = cmi.calculate_damage(self.object, hitter, tflp, tool_capabilities, dir) + else + + for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do + + tmp = tflp / (tool_capabilities.full_punch_interval or 1.4) + + if tmp < 0 then + tmp = 0.0 + elseif tmp > 1 then + tmp = 1.0 + end + + damage = damage + (tool_capabilities.damage_groups[group] or 0) + * tmp * ((armor[group] or 0) / 100.0) + end + end + + -- check for tool immunity or special damage + for n = 1, #self.immune_to do + + if self.immune_to[n][1] == weapon_def.name then + + damage = self.immune_to[n][2] or 0 + break + + -- if "all" then no tool does damage unless it's specified in list + elseif self.immune_to[n][1] == "all" then + damage = self.immune_to[n][2] or 0 + end + end + + -- healing + if damage <= -1 then + self.health = self.health - floor(damage) + return + end + +-- print ("Mob Damage is", damage) + + if use_cmi + and cmi.notify_punch(self.object, hitter, tflp, tool_capabilities, dir, damage) then + return + end + + -- add weapon wear + punch_interval = tool_capabilities.full_punch_interval or 1.4 + + -- toolrank support + local wear = floor((punch_interval / 75) * 9000) + + if mobs.is_creative(hitter:get_player_name()) then + + if tr then + wear = 1 + else + wear = 0 + end + end + + if tr then + if weapon_def.original_description then + weapon:add_wear(toolranks.new_afteruse(weapon, hitter, nil, {wear = wear})) + end + else + weapon:add_wear(wear) + end + + hitter:set_wielded_item(weapon) + + -- only play hit sound and show blood effects if damage is 1 or over + if damage >= 1 then + + -- weapon sounds + if weapon_def.sounds then + + local s = random(0, #weapon_def.sounds) + + minetest.sound_play(weapon_def.sounds[s], { + object = self.object, + max_hear_distance = 8 + }) + else + minetest.sound_play("default_punch", { + object = self.object, + max_hear_distance = 5 + }) + end + + -- blood_particles + if not disable_blood and self.blood_amount > 0 then + + local pos = self.object:get_pos() + + pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5 + + -- do we have a single blood texture or multiple? + if type(self.blood_texture) == "table" then + + local blood = self.blood_texture[random(1, #self.blood_texture)] + + effect(pos, self.blood_amount, blood, nil, nil, 1, nil) + else + effect(pos, self.blood_amount, self.blood_texture, nil, nil, 1, nil) + end + end + + -- do damage + self.health = self.health - floor(damage) + + -- exit here if dead, check for tools with fire damage + local hot = tool_capabilities and tool_capabilities.damage_groups + and tool_capabilities.damage_groups.fire + + if check_for_death(self, {type = "punch", + puncher = hitter, hot = hot}) then + return + end + + --[[ add healthy afterglow when hit (can cause hit lag with larger textures) + minetest.after(0.1, function() + + if not self.object:get_luaentity() then return end + + self.object:settexturemod("^[colorize:#c9900070") + + core.after(0.3, function() + self.object:settexturemod("") + end) + end) ]] + + end -- END if damage + + -- knock back effect (only on full punch) + if self.knock_back + and tflp >= punch_interval then + + local v = self.object:get_velocity() + local kb = damage or 1 + local up = 2 + + -- if already in air then dont go up anymore when hit + if v.y > 0 + or self.fly then + up = 0 + end + + -- direction error check + dir = dir or {x = 0, y = 0, z = 0} + + -- use tool knockback value or default + kb = tool_capabilities.damage_groups["knockback"] or (kb * 1.5) + + self.object:set_velocity({ + x = dir.x * kb, + y = up, + z = dir.z * kb + }) + + self.pause_timer = 0.25 + end + + -- if skittish then run away + if self.runaway == true + and self.order ~= "stand" then + + local lp = hitter:get_pos() + local s = self.object:get_pos() + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end + + yaw = set_yaw(self, yaw, 6) + self.state = "runaway" + self.runaway_timer = 0 + self.following = nil + end + + local name = hitter:get_player_name() or "" + + -- attack puncher and call other mobs for help + if self.passive == false + and self.state ~= "flop" + and self.child == false + and self.attack_players == true + and hitter:get_player_name() ~= self.owner + and not mobs.invis[ name ] then + + -- attack whoever punched mob + self.state = "" + do_attack(self, hitter) + + -- alert others to the attack + local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) + local obj = nil + + for n = 1, #objs do + + obj = objs[n]:get_luaentity() + + if obj and obj._cmi_is_mob then + + -- only alert members of same mob + if obj.group_attack == true + and obj.state ~= "attack" + and obj.owner ~= name + and obj.name == self.name then + do_attack(obj, hitter) + end + + -- have owned mobs attack player threat + if obj.owner == name and obj.owner_loyal then + do_attack(obj, self.object) + end + end + end + end +end + + +-- get entity staticdata +local mob_staticdata = function(self) + + -- remove mob when out of range unless tamed + if remove_far + and self.remove_ok + and self.type ~= "npc" + and self.state ~= "attack" + and not self.tamed + and self.lifetimer < 20000 then + + --print ("REMOVED " .. self.name) + + self.object:remove() + + return ""-- nil + end + + self.remove_ok = true + self.attack = nil + self.following = nil + self.state = "stand" + + -- used to rotate older mobs + if self.drawtype + and self.drawtype == "side" then + self.rotate = math.rad(90) + end + + if use_cmi then + self.serialized_cmi_components = cmi.serialize_components(self._cmi_components) + end + + local tmp = {} + + for _,stat in pairs(self) do + + local t = type(stat) + + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" + and _ ~= "_cmi_components" then + tmp[_] = self[_] + end + end + + --print('===== '..self.name..'\n'.. dump(tmp)..'\n=====\n') + return minetest.serialize(tmp) +end + + +-- activate mob and reload settings +local mob_activate = function(self, staticdata, def, dtime) + + -- remove monsters in peaceful mode + if self.type == "monster" + and peaceful_only then + + self.object:remove() + + return + end + + -- load entity variables + local tmp = minetest.deserialize(staticdata) + + if tmp then + for _,stat in pairs(tmp) do + self[_] = stat + end + end + + -- select random texture, set model and size + if not self.base_texture then + + -- compatiblity with old simple mobs textures + if def.textures and type(def.textures[1]) == "string" then + def.textures = {def.textures} + end + + self.base_texture = def.textures and def.textures[random(1, #def.textures)] + self.base_mesh = def.mesh + self.base_size = self.visual_size + self.base_colbox = self.collisionbox + self.base_selbox = self.selectionbox + end + + -- for current mobs that dont have this set + if not self.base_selbox then + self.base_selbox = self.selectionbox or self.base_colbox + end + + -- set texture, model and size + local textures = self.base_texture + local mesh = self.base_mesh + local vis_size = self.base_size + local colbox = self.base_colbox + local selbox = self.base_selbox + + -- specific texture if gotten + if self.gotten == true + and def.gotten_texture then + textures = def.gotten_texture + end + + -- specific mesh if gotten + if self.gotten == true + and def.gotten_mesh then + mesh = def.gotten_mesh + end + + -- set child objects to half size + if self.child == true then + + vis_size = { + x = self.base_size.x * .5, + y = self.base_size.y * .5, + } + + if def.child_texture then + textures = def.child_texture[1] + end + + colbox = { + self.base_colbox[1] * .5, + self.base_colbox[2] * .5, + self.base_colbox[3] * .5, + self.base_colbox[4] * .5, + self.base_colbox[5] * .5, + self.base_colbox[6] * .5 + } + selbox = { + self.base_selbox[1] * .5, + self.base_selbox[2] * .5, + self.base_selbox[3] * .5, + self.base_selbox[4] * .5, + self.base_selbox[5] * .5, + self.base_selbox[6] * .5 + } + end + + if self.health == 0 then + self.health = random (self.hp_min, self.hp_max) + end + + -- pathfinding init + self.path = {} + self.path.way = {} -- path to follow, table of positions + self.path.lastpos = {x = 0, y = 0, z = 0} + self.path.stuck = false + self.path.following = false -- currently following path? + self.path.stuck_timer = 0 -- if stuck for too long search for path + + -- mob defaults + self.object:set_armor_groups({immortal = 1, fleshy = self.armor}) + self.old_y = self.object:get_pos().y + self.old_health = self.health + self.sounds.distance = self.sounds.distance or 10 + self.textures = textures + self.mesh = mesh + self.collisionbox = colbox + self.selectionbox = selbox + self.visual_size = vis_size + self.standing_in = "air" + + -- check existing nametag + if not self.nametag then + self.nametag = def.nametag + end + + -- set anything changed above + self.object:set_properties(self) + set_yaw(self, (random(0, 360) - 180) / 180 * pi, 6) + update_tag(self) + set_animation(self, "stand") + + -- run on_spawn function if found + if self.on_spawn and not self.on_spawn_run then + if self.on_spawn(self) then + self.on_spawn_run = true -- if true, set flag to run once only + end + end + + -- run after_activate + if def.after_activate then + def.after_activate(self, staticdata, def, dtime) + end + + if use_cmi then + self._cmi_components = cmi.activate_components(self.serialized_cmi_components) + cmi.notify_activate(self.object, dtime) + end +end + + +-- handle mob lifetimer and expiration +local mob_expire = function(self, pos, dtime) + + -- when lifetimer expires remove mob (except npc and tamed) + if self.type ~= "npc" + and not self.tamed + and self.state ~= "attack" + and remove_far ~= true + and self.lifetimer < 20000 then + + self.lifetimer = self.lifetimer - dtime + + if self.lifetimer <= 0 then + + -- only despawn away from player + local objs = minetest.get_objects_inside_radius(pos, 15) + + for n = 1, #objs do + + if objs[n]:is_player() then + + self.lifetimer = 20 + + return + end + end + +-- minetest.log("action", +-- S("lifetimer expired, removed @1", self.name)) + + effect(pos, 15, "tnt_smoke.png", 2, 4, 2, 0) + + self.object:remove() + + return + end + end +end + + +-- main mob function +local mob_step = function(self, dtime) + + if use_cmi then + cmi.notify_step(self.object, dtime) + end + + local pos = self.object:get_pos() + local yaw = 0 + + -- get node at foot level every quarter second + self.node_timer = (self.node_timer or 0) + dtime + + if self.node_timer > 0.25 then + + self.node_timer = 0 + + local y_level = self.collisionbox[2] + + if self.child then + y_level = self.collisionbox[2] * 0.5 + end + + -- what is mob standing in? + self.standing_in = node_ok({ + x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name +-- print ("standing in " .. self.standing_in) + + -- check for mob expiration (0.25 instead of dtime since were in a timer) + mob_expire(self, pos, 0.25) + end + + -- check if falling, flying, floating + falling(self, pos) + + -- smooth rotation by ThomasMonroe314 + + if self.delay and self.delay > 0 then + + local yaw = self.object:get_yaw() + + if self.delay == 1 then + yaw = self.target_yaw + else + local dif = abs(yaw - self.target_yaw) + + if yaw > self.target_yaw then + + if dif > pi then + dif = 2 * pi - dif -- need to add + yaw = yaw + dif / self.delay + else + yaw = yaw - dif / self.delay -- need to subtract + end + + elseif yaw < self.target_yaw then + + if dif > pi then + dif = 2 * pi - dif + yaw = yaw - dif / self.delay -- need to subtract + else + yaw = yaw + dif / self.delay -- need to add + end + end + + if yaw > (pi * 2) then yaw = yaw - (pi * 2) end + if yaw < 0 then yaw = yaw + (pi * 2) end + end + + self.delay = self.delay - 1 + self.object:set_yaw(yaw) + end + + -- end rotation + + -- knockback timer + if self.pause_timer > 0 then + + self.pause_timer = self.pause_timer - dtime + + return + end + + -- run custom function (defined in mob lua file) + if self.do_custom then + + -- when false skip going any further + if self.do_custom(self, dtime) == false then + return + end + end + + -- attack timer + self.timer = self.timer + dtime + + if self.state ~= "attack" then + + if self.timer < 1 then + return + end + + self.timer = 0 + end + + -- never go over 100 + if self.timer > 100 then + self.timer = 1 + end + + -- mob plays random sound at times + if random(1, 100) == 1 then + mob_sound(self, self.sounds.random) + end + + -- environmental damage timer (every 1 second) + self.env_damage_timer = self.env_damage_timer + dtime + + if (self.state == "attack" and self.env_damage_timer > 1) + or self.state ~= "attack" then + + self.env_damage_timer = 0 + + -- check for environmental damage (water, fire, lava etc.) + do_env_damage(self) + + -- node replace check (cow eats grass etc.) + replace(self, pos) + end + + general_attack(self) + + breed(self) + + follow_flop(self) + + do_states(self, dtime) + + do_jump(self) + + runaway_from(self) + +end + + +-- default function when mobs are blown up with TNT +local do_tnt = function(obj, damage) + + --print ("----- Damage", damage) + + obj.object:punch(obj.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + + return false, true, {} +end + + +mobs.spawning_mobs = {} + +-- register mob entity +function mobs:register_mob(name, def) + + mobs.spawning_mobs[name] = true + +minetest.register_entity(name, { + + stepheight = def.stepheight or 1.1, -- was 0.6 + name = name, + type = def.type, + attack_type = def.attack_type, + fly = def.fly, + fly_in = def.fly_in or "air", + owner = def.owner or "", + order = def.order or "", + on_die = def.on_die, + do_custom = def.do_custom, + jump_height = def.jump_height or 4, -- was 6 + drawtype = def.drawtype, -- DEPRECATED, use rotate instead + rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 + lifetimer = def.lifetimer or 180, -- 3 minutes + hp_min = max(1, (def.hp_min or 5) * difficulty), + hp_max = max(1, (def.hp_max or 10) * difficulty), + physical = true, + collisionbox = def.collisionbox or {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + selectionbox = def.selectionbox or def.collisionbox, + visual = def.visual, + visual_size = def.visual_size or {x = 1, y = 1}, + mesh = def.mesh, + makes_footstep_sound = def.makes_footstep_sound or false, + view_range = def.view_range or 5, + walk_velocity = def.walk_velocity or 1, + run_velocity = def.run_velocity or 2, + damage = max(0, (def.damage or 0) * difficulty), + light_damage = def.light_damage or 0, + light_damage_min = def.light_damage_min or 14, + light_damage_max = def.light_damage_max or 15, + water_damage = def.water_damage or 0, + lava_damage = def.lava_damage or 0, + suffocation = def.suffocation or 2, + fall_damage = def.fall_damage or 1, + fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10) + drops = def.drops or {}, + armor = def.armor or 100, + on_rightclick = def.on_rightclick, + arrow = def.arrow, + shoot_interval = def.shoot_interval, + sounds = def.sounds or {}, + animation = def.animation, + follow = def.follow, + jump = def.jump ~= false, + walk_chance = def.walk_chance or 50, + attack_chance = def.attack_chance or 5, + passive = def.passive or false, + knock_back = def.knock_back ~= false, + blood_amount = def.blood_amount or 5, + blood_texture = def.blood_texture or "mobs_blood.png", + shoot_offset = def.shoot_offset or 0, + floats = def.floats or 1, -- floats in water by default + replace_rate = def.replace_rate, + replace_what = def.replace_what, + replace_with = def.replace_with, + replace_offset = def.replace_offset or 0, + on_replace = def.on_replace, + timer = 0, + env_damage_timer = 0, -- only used when state = "attack" + tamed = false, + pause_timer = 0, + horny = false, + hornytimer = 0, + child = false, + gotten = false, + health = 0, + reach = def.reach or 3, + htimer = 0, + texture_list = def.textures, + child_texture = def.child_texture, + docile_by_day = def.docile_by_day or false, + time_of_day = 0.5, + fear_height = def.fear_height or 0, + runaway = def.runaway, + runaway_timer = 0, + pathfinding = def.pathfinding, + immune_to = def.immune_to or {}, + explosion_radius = def.explosion_radius, + explosion_damage_radius = def.explosion_damage_radius, + explosion_timer = def.explosion_timer or 3, + allow_fuse_reset = def.allow_fuse_reset ~= false, + stop_to_explode = def.stop_to_explode ~= false, + custom_attack = def.custom_attack, + double_melee_attack = def.double_melee_attack, + dogshoot_switch = def.dogshoot_switch, + dogshoot_count = 0, + dogshoot_count_max = def.dogshoot_count_max or 5, + dogshoot_count2_max = def.dogshoot_count2_max or (def.dogshoot_count_max or 5), + group_attack = def.group_attack or false, + attack_monsters = def.attacks_monsters or def.attack_monsters or false, + attack_animals = def.attack_animals or false, + attack_players = def.attack_players ~= false, + attack_npcs = def.attack_npcs ~= false, + specific_attack = def.specific_attack, + runaway_from = def.runaway_from, + owner_loyal = def.owner_loyal, + facing_fence = false, + pushable = def.pushable, + _cmi_is_mob = true, + + on_spawn = def.on_spawn, + + on_blast = def.on_blast or do_tnt, + + on_step = mob_step, + + do_punch = def.do_punch, + + on_punch = mob_punch, + + on_breed = def.on_breed, + + on_grown = def.on_grown, + + on_activate = function(self, staticdata, dtime) + return mob_activate(self, staticdata, def, dtime) + end, + + get_staticdata = function(self) + return mob_staticdata(self) + end, + +}) + +end -- END mobs:register_mob function + + +-- count how many mobs of one type are inside an area +local count_mobs = function(pos, type) + + local total = 0 + local objs = minetest.get_objects_inside_radius(pos, aoc_range * 2) + local ent + + for n = 1, #objs do + + if not objs[n]:is_player() then + + ent = objs[n]:get_luaentity() + + -- count mob type and add to total also + if ent and ent.name and ent.name == type then + total = total + 1 + end + end + end + + return total +end + + +-- global functions + +function mobs:spawn_abm_check(pos, node, name) + -- global function to add additional spawn checks + -- return true to stop spawning mob +end + + +function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, + interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) + + -- Do mobs spawn at all? + if not mobs_spawn then + return + end + + -- chance/spawn number override in minetest.conf for registered mob + local numbers = minetest.settings:get(name) + + if numbers then + numbers = numbers:split(",") + chance = tonumber(numbers[1]) or chance + aoc = tonumber(numbers[2]) or aoc + + if chance == 0 then + minetest.log("warning", string.format("[mobs] %s has spawning disabled", name)) + return + end + + minetest.log("action", + string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) + + end + + minetest.register_abm({ + + label = name .. " spawning", + nodenames = nodes, + neighbors = neighbors, + interval = interval, + chance = max(1, (chance * mob_chance_multiplier)), + catch_up = false, + + action = function(pos, node, active_object_count, active_object_count_wider) + + -- is mob actually registered? + if not mobs.spawning_mobs[name] + or not minetest.registered_entities[name] then +--print ("--- mob doesn't exist", name) + return + end + + -- additional custom checks for spawning mob + if mobs:spawn_abm_check(pos, node, name) == true then + return + end + + -- do not spawn if too many entities in area + if active_object_count_wider >= max_per_block then +--print("--- too many entities in area", active_object_count_wider) + return + end + + -- get total number of this mob in area + local num_mob = count_mobs(pos, name) + + if num_mob >= aoc then +--print ("--- too many " .. name .. " in area", num_mob .. "/" .. aoc) + return + end + + -- if toggle set to nil then ignore day/night check + if day_toggle ~= nil then + + local tod = (minetest.get_timeofday() or 0) * 24000 + + if tod > 4500 and tod < 19500 then + -- daylight, but mob wants night + if day_toggle == false then +--print ("--- mob needs night", name) + return + end + else + -- night time but mob wants day + if day_toggle == true then +--print ("--- mob needs day", name) + return + end + end + end + + -- spawn above node + pos.y = pos.y + 1 + + -- are we spawning within height limits? + if pos.y > max_height + or pos.y < min_height then +--print ("--- height limits not met", name, pos.y) + return + end + + -- are light levels ok? + local light = minetest.get_node_light(pos) + if not light + or light > max_light + or light < min_light then +--print ("--- light limits not met", name, light) + return + end + + -- only spawn away from player + local objs = minetest.get_objects_inside_radius(pos, 10) + + for n = 1, #objs do + + if objs[n]:is_player() then +--print ("--- player too close", name) + return + end + end + + -- do we have enough height clearance to spawn mob? + local ent = minetest.registered_entities[name] + local height = max(1, math.ceil( + (ent.collisionbox[5] or 0.25) - + (ent.collisionbox[2] or -0.25) - 1)) + + for n = 0, height do + + local pos2 = {x = pos.x, y = pos.y + n, z = pos.z} + + if minetest.registered_nodes[node_ok(pos2).name].walkable == true then +--print ("--- inside block", name, node_ok(pos2).name) + return + end + end + + -- mobs cannot spawn in protected areas when enabled + if not spawn_protected + and minetest.is_protected(pos, "") then +--print ("--- inside protected area", name) + return + end + + -- spawn mob half block higher than ground + pos.y = pos.y + 0.5 + + local mob = minetest.add_entity(pos, name) +--[[ + print ("[mobs] Spawned " .. name .. " at " + .. minetest.pos_to_string(pos) .. " on " + .. node.name .. " near " .. neighbors[1]) +]] + if on_spawn then + + local ent = mob:get_luaentity() + + on_spawn(ent, pos) + end + end + }) +end + + +-- compatibility with older mob registration +function mobs:register_spawn(name, nodes, max_light, min_light, chance, + active_object_count, max_height, day_toggle) + + mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, + chance, active_object_count, -31000, max_height, day_toggle) +end + + +-- MarkBu's spawn function +function mobs:spawn(def) + + mobs:spawn_specific( + def.name, + def.nodes or {"group:soil", "group:stone"}, + def.neighbors or {"air"}, + def.min_light or 0, + def.max_light or 15, + def.interval or 30, + def.chance or 5000, + def.active_object_count or 1, + def.min_height or -31000, + def.max_height or 31000, + def.day_toggle, + def.on_spawn + ) +end + + +-- register arrow for shoot attack +function mobs:register_arrow(name, def) + + if not name or not def then return end -- errorcheck + + minetest.register_entity(name, { + + physical = false, + visual = def.visual, + visual_size = def.visual_size, + textures = def.textures, + velocity = def.velocity, + hit_player = def.hit_player, + hit_node = def.hit_node, + hit_mob = def.hit_mob, + drop = def.drop or false, -- drops arrow as registered item when true + collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, + timer = 0, + switch = 0, + owner_id = def.owner_id, + rotate = def.rotate, + automatic_face_movement_dir = def.rotate + and (def.rotate - (pi / 180)) or false, + + on_activate = def.on_activate, + + on_punch = def.on_punch or function(self, hitter, tflp, tool_capabilities, dir) + end, + + on_step = def.on_step or function(self, dtime) + + self.timer = self.timer + 1 + + local pos = self.object:get_pos() + + if self.switch == 0 + or self.timer > 150 then + + self.object:remove() ; -- print ("removed arrow") + + return + end + + -- does arrow have a tail (fireball) + if def.tail + and def.tail == 1 + and def.tail_texture then + + minetest.add_particle({ + pos = pos, + velocity = {x = 0, y = 0, z = 0}, + acceleration = {x = 0, y = 0, z = 0}, + expirationtime = def.expire or 0.25, + collisiondetection = false, + texture = def.tail_texture, + size = def.tail_size or 5, + glow = def.glow or 0, + }) + end + + if self.hit_node then + + local node = node_ok(pos).name + + if minetest.registered_nodes[node].walkable then + + self.hit_node(self, pos, node) + + if self.drop == true then + + pos.y = pos.y + 1 + + self.lastpos = (self.lastpos or pos) + + minetest.add_item(self.lastpos, self.object:get_luaentity().name) + end + + self.object:remove() ; -- print ("hit node") + + return + end + end + + if self.hit_player or self.hit_mob then + + for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do + + if self.hit_player + and player:is_player() then + + self.hit_player(self, player) + self.object:remove() ; -- print ("hit player") + return + end + + local entity = player:get_luaentity() + + if entity + and self.hit_mob + and entity._cmi_is_mob == true + and tostring(player) ~= self.owner_id + and entity.name ~= self.object:get_luaentity().name then + + self.hit_mob(self, player) + + self.object:remove() ; --print ("hit mob") + + return + end + end + end + + self.lastpos = pos + end + }) +end + + +-- compatibility function +function mobs:explosion(pos, radius) + + local self = {sounds = {explode = "tnt_explode"}} + + mobs:boom(self, pos, radius) +end + + +-- no damage to nodes explosion +function mobs:safe_boom(self, pos, radius) + + minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", { + pos = pos, + gain = 1.0, + max_hear_distance = self.sounds and self.sounds.distance or 32 + }) + + entity_physics(pos, radius) + + effect(pos, 32, "tnt_smoke.png", radius * 3, radius * 5, radius, 1, 0) +end + + +-- make explosion with protection and tnt mod check +function mobs:boom(self, pos, radius) + + if mobs_griefing + and minetest.get_modpath("tnt") and tnt and tnt.boom + and not minetest.is_protected(pos, "") then + + tnt.boom(pos, { + radius = radius, + damage_radius = radius, + sound = self.sounds and self.sounds.explode, + explode_center = true, + }) + else + mobs:safe_boom(self, pos, radius) + end +end + + +-- Register spawn eggs + +-- Note: This also introduces the “spawn_egg” group: +-- * spawn_egg=1: Spawn egg (generic mob, no metadata) +-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata) +function mobs:register_egg(mob, desc, background, addegg, no_creative) + + local grp = {spawn_egg = 1} + + -- do NOT add this egg to creative inventory (e.g. dungeon master) + if creative and no_creative == true then + grp.not_in_creative_inventory = 1 + end + + local invimg = background + + if addegg == 1 then + invimg = "mobs_chicken_egg.png^(" .. invimg .. + "^[mask:mobs_chicken_egg_overlay.png)" + end + + -- register new spawn egg containing mob information + minetest.register_craftitem(mob .. "_set", { + + description = S("@1 (Tamed)", desc), + inventory_image = invimg, + groups = {spawn_egg = 2, not_in_creative_inventory = 1}, + stack_max = 1, + + on_place = function(itemstack, placer, pointed_thing) + + local pos = pointed_thing.above + + -- am I clicking on something with existing on_rightclick function? + local under = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, under, placer, itemstack) + end + + if pos + and not minetest.is_protected(pos, placer:get_player_name()) then + + if not minetest.registered_entities[mob] then + return + end + + pos.y = pos.y + 1 + + local data = itemstack:get_metadata() + local mob = minetest.add_entity(pos, mob, data) + local ent = mob:get_luaentity() + + -- set owner if not a monster + if ent.type ~= "monster" then + ent.owner = placer:get_player_name() + ent.tamed = true + end + + -- since mob is unique we remove egg once spawned + itemstack:take_item() + end + + return itemstack + end, + }) + + + -- register old stackable mob egg + minetest.register_craftitem(mob, { + + description = desc, + inventory_image = invimg, + groups = grp, + + on_place = function(itemstack, placer, pointed_thing) + + local pos = pointed_thing.above + + -- am I clicking on something with existing on_rightclick function? + local under = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, under, placer, itemstack) + end + + if pos + and not minetest.is_protected(pos, placer:get_player_name()) then + + if not minetest.registered_entities[mob] then + return + end + + pos.y = pos.y + 1 + + local mob = minetest.add_entity(pos, mob) + local ent = mob:get_luaentity() + + -- don't set owner if monster or sneak pressed + if ent.type ~= "monster" + and not placer:get_player_control().sneak then + ent.owner = placer:get_player_name() + ent.tamed = true + end + + -- if not in creative then take item + if not mobs.is_creative(placer:get_player_name()) then + itemstack:take_item() + end + end + + return itemstack + end, + }) + +end + + +-- capture critter (thanks to blert2112 for idea) +function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, + force_take, replacewith) + + if self.child + or not clicker:is_player() + or not clicker:get_inventory() then + return false + end + + -- get name of clicked mob + local mobname = self.name + + -- if not nil change what will be added to inventory + if replacewith then + mobname = replacewith + end + + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + -- are we using hand, net or lasso to pick up mob? + if tool:get_name() ~= "" + and tool:get_name() ~= "mobs:net" + and tool:get_name() ~= "mobs:lasso" then + return false + end + + -- is mob tamed? + if self.tamed == false + and force_take == false then + + minetest.chat_send_player(name, S("Not tamed!")) + + return true -- false + end + + -- cannot pick up if not owner + if self.owner ~= name + and force_take == false then + + minetest.chat_send_player(name, S("@1 is owner!", self.owner)) + + return true -- false + end + + if clicker:get_inventory():room_for_item("main", mobname) then + + -- was mob clicked with hand, net, or lasso? + local chance = 0 + + if tool:get_name() == "" then + chance = chance_hand + + elseif tool:get_name() == "mobs:net" then + + chance = chance_net + + tool:add_wear(4000) -- 17 uses + + clicker:set_wielded_item(tool) + + elseif tool:get_name() == "mobs:lasso" then + + chance = chance_lasso + + tool:add_wear(650) -- 100 uses + + clicker:set_wielded_item(tool) + + end + + -- calculate chance.. add to inventory if successful? + if chance > 0 and random(1, 100) <= chance then + + -- default mob egg + local new_stack = ItemStack(mobname) + + -- add special mob egg with all mob information + -- unless 'replacewith' contains new item to use + if not replacewith then + + new_stack = ItemStack(mobname .. "_set") + + local tmp = {} + + for _,stat in pairs(self) do + local t = type(stat) + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" then + tmp[_] = self[_] + end + end + + local data_str = minetest.serialize(tmp) + + new_stack:set_metadata(data_str) + end + + local inv = clicker:get_inventory() + + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(clicker:get_pos(), new_stack) + end + + self.object:remove() + + mob_sound(self, "default_place_node_hard") + + elseif chance ~= 0 then + minetest.chat_send_player(name, S("Missed!")) + + mob_sound(self, "mobs_swing") + end + end + + return true +end + + +-- protect tamed mob with rune item +function mobs:protect(self, clicker) + + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + if tool:get_name() ~= "mobs:protector" then + return false + end + + if self.tamed == false then + minetest.chat_send_player(name, S("Not tamed!")) + return true -- false + end + + if self.protected == true then + minetest.chat_send_player(name, S("Already protected!")) + return true -- false + end + + if not mobs.is_creative(clicker:get_player_name()) then + tool:take_item() -- take 1 protection rune + clicker:set_wielded_item(tool) + end + + self.protected = true + + local pos = self.object:get_pos() + pos.y = pos.y + self.collisionbox[2] + 0.5 + + effect(self.object:get_pos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15) + + mob_sound(self, "mobs_spell") + + return true +end + + +local mob_obj = {} +local mob_sta = {} + +-- feeding, taming and breeding (thanks blert2112) +function mobs:feed_tame(self, clicker, feed_count, breed, tame) + + if not self.follow then + return false + end + + -- can eat/tame with item in hand + if follow_holding(self, clicker) then + + -- if not in creative then take item + if not mobs.is_creative(clicker:get_player_name()) then + + local item = clicker:get_wielded_item() + + item:take_item() + + clicker:set_wielded_item(item) + end + + -- increase health + self.health = self.health + 4 + + if self.health >= self.hp_max then + + self.health = self.hp_max + + if self.htimer < 1 then + + minetest.chat_send_player(clicker:get_player_name(), + S("@1 at full health (@2)", + self.name:split(":")[2], tostring(self.health))) + + self.htimer = 5 + end + end + + self.object:set_hp(self.health) + + update_tag(self) + + -- make children grow quicker + if self.child == true then + + self.hornytimer = self.hornytimer + 20 + + return true + end + + -- feed and tame + self.food = (self.food or 0) + 1 + if self.food >= feed_count then + + self.food = 0 + + if breed and self.hornytimer == 0 then + self.horny = true + end + + self.gotten = false + + if tame then + + if self.tamed == false then + minetest.chat_send_player(clicker:get_player_name(), + S("@1 has been tamed!", + self.name:split(":")[2])) + end + + self.tamed = true + + if not self.owner or self.owner == "" then + self.owner = clicker:get_player_name() + end + end + + -- make sound when fed so many times + mob_sound(self, self.sounds.random) + end + + return true + end + + local item = clicker:get_wielded_item() + + -- if mob has been tamed you can name it with a nametag + if item:get_name() == "mobs:nametag" + and clicker:get_player_name() == self.owner then + + local name = clicker:get_player_name() + + -- store mob and nametag stack in external variables + mob_obj[name] = self + mob_sta[name] = item + + local tag = self.nametag or "" + + minetest.show_formspec(name, "mobs_nametag", "size[8,4]" + .. default.gui_bg + .. default.gui_bg_img + .. "field[0.5,1;7.5,0;name;" + .. minetest.formspec_escape(S("Enter name:")) .. ";" .. tag .. "]" + .. "button_exit[2.5,3.5;3,1;mob_rename;" + .. minetest.formspec_escape(S("Rename")) .. "]") + end + + return false +end + + +-- inspired by blockmen's nametag mod +minetest.register_on_player_receive_fields(function(player, formname, fields) + + -- right-clicked with nametag and name entered? + if formname == "mobs_nametag" + and fields.name + and fields.name ~= "" then + + local name = player:get_player_name() + + if not mob_obj[name] + or not mob_obj[name].object then + return + end + + -- make sure nametag is being used to name mob + local item = player:get_wielded_item() + + if item:get_name() ~= "mobs:nametag" then + return + end + + -- limit name entered to 64 characters long + if string.len(fields.name) > 64 then + fields.name = string.sub(fields.name, 1, 64) + end + + -- update nametag + mob_obj[name].nametag = fields.name + + update_tag(mob_obj[name]) + + -- if not in creative then take item + if not mobs.is_creative(name) then + + mob_sta[name]:take_item() + + player:set_wielded_item(mob_sta[name]) + end + + -- reset external variables + mob_obj[name] = nil + mob_sta[name] = nil + end +end) + + +-- compatibility function for old entities to new modpack entities +function mobs:alias_mob(old_name, new_name) + + -- spawn egg + minetest.register_alias(old_name, new_name) + + -- entity + minetest.register_entity(":" .. old_name, { + + physical = false, + + on_activate = function(self) + + if minetest.registered_entities[new_name] then + minetest.add_entity(self.object:get_pos(), new_name) + end + + self.object:remove() + end + }) +end diff --git a/mods/mobs/api.lua_testspawn b/mods/mobs/api.lua_testspawn new file mode 100644 index 0000000..471df35 --- /dev/null +++ b/mods/mobs/api.lua_testspawn @@ -0,0 +1,3985 @@ + +-- Mobs Api + +mobs = {} +mobs.mod = "redo" +mobs.version = "20180623" + + +-- Intllib +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP .. "/intllib.lua") +mobs.intllib = S + + +-- CMI support check +local use_cmi = minetest.global_exists("cmi") + + +-- Invisibility mod check +mobs.invis = {} +if minetest.global_exists("invisibility") then + mobs.invis = invisibility +end + + +-- creative check +local creative_mode_cache = minetest.settings:get_bool("creative_mode") +function mobs.is_creative(name) + return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) +end + + +-- localize math functions +local pi = math.pi +local square = math.sqrt +local sin = math.sin +local cos = math.cos +local abs = math.abs +local min = math.min +local max = math.max +local atann = math.atan +local random = math.random +local floor = math.floor +local atan = function(x) + if not x or x ~= x then + --error("atan bassed NaN") + return 0 + else + return atann(x) + end +end + + +-- Load settings +local damage_enabled = minetest.settings:get_bool("enable_damage") +local mobs_spawn = minetest.settings:get_bool("mobs_spawn") ~= false +local peaceful_only = minetest.settings:get_bool("only_peaceful_mobs") +local disable_blood = minetest.settings:get_bool("mobs_disable_blood") +local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false +local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false +local creative = minetest.settings:get_bool("creative_mode") +local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false +local remove_far = minetest.settings:get_bool("remove_far_mobs") ~= false +local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0 +local show_health = minetest.settings:get_bool("mob_show_health") ~= false +local max_per_block = tonumber(minetest.settings:get("max_objects_per_block") or 99) +local mob_chance_multiplier = tonumber(minetest.settings:get("mob_chance_multiplier") or 1) + +-- Peaceful mode message so players will know there are no monsters +if peaceful_only then + minetest.register_on_joinplayer(function(player) + minetest.chat_send_player(player:get_player_name(), + S("** Peaceful Mode Active - No Monsters Will Spawn")) + end) +end + +-- calculate aoc range for mob count +local aosrb = tonumber(minetest.settings:get("active_object_send_range_blocks")) +local abr = tonumber(minetest.settings:get("active_block_range")) +local aoc_range = max(aosrb, abr) * 16 + +-- pathfinding settings +local enable_pathfinding = true +local stuck_timeout = 3 -- how long before mob gets stuck in place and starts searching +local stuck_path_timeout = 10 -- how long will mob follow path before giving up + +-- default nodes +local node_fire = "fire:basic_flame" +local node_permanent_flame = "fire:permanent_flame" +local node_ice = "default:ice" +local node_snowblock = "default:snowblock" +local node_snow = "default:snow" +mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "default:dirt" + + +-- play sound +local mob_sound = function(self, sound) + + if sound then + minetest.sound_play(sound, { + object = self.object, + gain = 1.0, + max_hear_distance = self.sounds.distance + }) + end +end + + +-- attack player/mob +local do_attack = function(self, player) + + if self.state == "attack" then + return + end + + self.attack = player + self.state = "attack" + + if random(0, 100) < 90 then + mob_sound(self, self.sounds.war_cry) + end +end + + +-- move mob in facing direction +local set_velocity = function(self, v) + + -- do not move if mob has been ordered to stay + if self.order == "stand" then + self.object:setvelocity({x = 0, y = 0, z = 0}) + return + end + + local yaw = (self.object:get_yaw() or 0) + self.rotate + + self.object:setvelocity({ + x = sin(yaw) * -v, + y = self.object:getvelocity().y, + z = cos(yaw) * v + }) +end + + +-- calculate mob velocity +local get_velocity = function(self) + + local v = self.object:getvelocity() + + return (v.x * v.x + v.z * v.z) ^ 0.5 +end + + +-- set and return valid yaw +local set_yaw = function(self, yaw, delay) + + if not yaw or yaw ~= yaw then + yaw = 0 + end + + delay = delay or 0 + + if delay == 0 then + self.object:set_yaw(yaw) + return yaw + end + + self.target_yaw = yaw + self.delay = delay + + return self.target_yaw +end + +-- global function to set mob yaw +function mobs:yaw(self, yaw, delay) + set_yaw(self, yaw, delay) +end + + +-- set defined animation +local set_animation = function(self, anim) + + if not self.animation + or not anim then return end + + self.animation.current = self.animation.current or "" + + if anim == self.animation.current + or not self.animation[anim .. "_start"] + or not self.animation[anim .. "_end"] then + return + end + + self.animation.current = anim + + self.object:set_animation({ + x = self.animation[anim .. "_start"], + y = self.animation[anim .. "_end"]}, + self.animation[anim .. "_speed"] or self.animation.speed_normal or 15, + 0, self.animation[anim .. "_loop"] ~= false) +end + + +-- above function exported for mount.lua +function mobs:set_animation(self, anim) + set_animation(self, anim) +end + + +-- calculate distance +local get_distance = function(a, b) + + local x, y, z = a.x - b.x, a.y - b.y, a.z - b.z + + return square(x * x + y * y + z * z) +end + + +-- check line of sight (BrunoMine) +local line_of_sight = function(self, pos1, pos2, stepsize) + + stepsize = stepsize or 1 + + local s, pos = minetest.line_of_sight(pos1, pos2, stepsize) + + -- normal walking and flying mobs can see you through air + if s == true then + return true + end + + -- New pos1 to be analyzed + local npos1 = {x = pos1.x, y = pos1.y, z = pos1.z} + + local r, pos = minetest.line_of_sight(npos1, pos2, stepsize) + + -- Checks the return + if r == true then return true end + + -- Nodename found + local nn = minetest.get_node(pos).name + + -- Target Distance (td) to travel + local td = get_distance(pos1, pos2) + + -- Actual Distance (ad) traveled + local ad = 0 + + -- It continues to advance in the line of sight in search of a real + -- obstruction which counts as 'normal' nodebox. + while minetest.registered_nodes[nn] + and (minetest.registered_nodes[nn].walkable == false + or minetest.registered_nodes[nn].drawtype == "nodebox") do + + -- Check if you can still move forward + if td < ad + stepsize then + return true -- Reached the target + end + + -- Moves the analyzed pos + local d = get_distance(pos1, pos2) + + npos1.x = ((pos2.x - pos1.x) / d * stepsize) + pos1.x + npos1.y = ((pos2.y - pos1.y) / d * stepsize) + pos1.y + npos1.z = ((pos2.z - pos1.z) / d * stepsize) + pos1.z + + -- NaN checks + if d == 0 + or npos1.x ~= npos1.x + or npos1.y ~= npos1.y + or npos1.z ~= npos1.z then + return false + end + + ad = ad + stepsize + + -- scan again + r, pos = minetest.line_of_sight(npos1, pos2, stepsize) + + if r == true then return true end + + -- New Nodename found + nn = minetest.get_node(pos).name + + end + + return false +end + + +-- are we flying in what we are suppose to? (taikedz) +local flight_check = function(self, pos_w) + + local def = minetest.registered_nodes[self.standing_in] + + if not def then return false end -- nil check + + if type(self.fly_in) == "string" + and self.standing_in == self.fly_in then + + return true + + elseif type(self.fly_in) == "table" then + + for _,fly_in in pairs(self.fly_in) do + + if self.standing_in == fly_in then + + return true + end + end + end + + -- stops mobs getting stuck inside stairs and plantlike nodes + if def.drawtype ~= "airlike" + and def.drawtype ~= "liquid" + and def.drawtype ~= "flowingliquid" then + return true + end + + return false +end + + +-- custom particle effects +local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow) + + radius = radius or 2 + min_size = min_size or 0.5 + max_size = max_size or 1 + gravity = gravity or -10 + glow = glow or 0 + + minetest.add_particlespawner({ + amount = amount, + time = 0.25, + minpos = pos, + maxpos = pos, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = {x = 0, y = gravity, z = 0}, + maxacc = {x = 0, y = gravity, z = 0}, + minexptime = 0.1, + maxexptime = 1, + minsize = min_size, + maxsize = max_size, + texture = texture, + glow = glow, + }) +end + + +-- update nametag colour +local update_tag = function(self) + + local col = "#00FF00" + local qua = self.hp_max / 4 + + if self.health <= floor(qua * 3) then + col = "#FFFF00" + end + + if self.health <= floor(qua * 2) then + col = "#FF6600" + end + + if self.health <= floor(qua) then + col = "#FF0000" + end + + self.object:set_properties({ + nametag = self.nametag, + nametag_color = col + }) + +end + + +-- drop items +local item_drop = function(self, cooked) + + -- no drops if disabled by setting + if not mobs_drop_items then return end + + -- no drops for child mobs + if self.child then return end + + local obj, item, num + local pos = self.object:get_pos() + + self.drops = self.drops or {} -- nil check + + for n = 1, #self.drops do + + if random(1, self.drops[n].chance) == 1 then + + num = random(self.drops[n].min or 1, self.drops[n].max or 1) + item = self.drops[n].name + + -- cook items when true + if cooked then + + local output = minetest.get_craft_result({ + method = "cooking", width = 1, items = {item}}) + + if output and output.item and not output.item:is_empty() then + item = output.item:get_name() + end + end + + -- add item if it exists + obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) + + if obj and obj:get_luaentity() then + + obj:setvelocity({ + x = random(-10, 10) / 9, + y = 6, + z = random(-10, 10) / 9, + }) + elseif obj then + obj:remove() -- item does not exist + end + end + end + + self.drops = {} +end + + +-- check if mob is dead or only hurt +local check_for_death = function(self, cause, cmi_cause) + + -- has health actually changed? + if self.health == self.old_health and self.health > 0 then + return + end + + self.old_health = self.health + + -- still got some health? play hurt sound + if self.health > 0 then + + mob_sound(self, self.sounds.damage) + + -- make sure health isn't higher than max + if self.health > self.hp_max then + self.health = self.hp_max + end + + -- backup nametag so we can show health stats + if not self.nametag2 then + self.nametag2 = self.nametag or "" + end + + if show_health + and (cmi_cause and cmi_cause.type == "punch") then + + self.htimer = 2 + self.nametag = "♥ " .. self.health .. " / " .. self.hp_max + + update_tag(self) + end + + return false + end + + -- dropped cooked item if mob died in lava + if cause == "lava" then + item_drop(self, true) + else + item_drop(self, nil) + end + + mob_sound(self, self.sounds.death) + + local pos = self.object:get_pos() + + -- execute custom death function + if self.on_die then + + self.on_die(self, pos) + + if use_cmi then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + + return true + end + + -- default death function and die animation (if defined) + if self.animation + and self.animation.die_start + and self.animation.die_end then + + local frames = self.animation.die_end - self.animation.die_start + local speed = self.animation.die_speed or 15 + local length = max(frames / speed, 0) + + self.attack = nil + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.passive = true + self.state = "die" + set_velocity(self, 0) + set_animation(self, "die") + + minetest.after(length, function(self) + + if use_cmi and self.object:get_luaentity() then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + end, self) + else + + if use_cmi then + cmi.notify_die(self.object, cmi_cause) + end + + self.object:remove() + end + + effect(pos, 20, "tnt_smoke.png") + + return true +end + + +-- check if within physical map limits (-30911 to 30927) +local within_limits = function(pos, radius) + + if (pos.x - radius) > -30913 + and (pos.x + radius) < 30928 + and (pos.y - radius) > -30913 + and (pos.y + radius) < 30928 + and (pos.z - radius) > -30913 + and (pos.z + radius) < 30928 then + return true -- within limits + end + + return false -- beyond limits +end + + +-- is mob facing a cliff +local is_at_cliff = function(self) + + if self.fear_height == 0 then -- 0 for no falling protection! + return false + end + + local yaw = self.object:get_yaw() + local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) + local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) + local pos = self.object:get_pos() + local ypos = pos.y + self.collisionbox[2] -- just above floor + + if minetest.line_of_sight( + {x = pos.x + dir_x, y = ypos, z = pos.z + dir_z}, + {x = pos.x + dir_x, y = ypos - self.fear_height, z = pos.z + dir_z} + , 1) then + + return true + end + + return false +end + + +-- get node but use fallback for nil or unknown +local node_ok = function(pos, fallback) + + fallback = fallback or mobs.fallback_node + + local node = minetest.get_node_or_nil(pos) + + if node and minetest.registered_nodes[node.name] then + return node + end + + return minetest.registered_nodes[fallback] +end + + +-- environmental damage (water, lava, fire, light etc.) +local do_env_damage = function(self) + + -- feed/tame text timer (so mob 'full' messages dont spam chat) + if self.htimer > 0 then + self.htimer = self.htimer - 1 + end + + -- reset nametag after showing health stats + if self.htimer < 1 and self.nametag2 then + + self.nametag = self.nametag2 + self.nametag2 = nil + + update_tag(self) + end + + local pos = self.object:get_pos() + + self.time_of_day = minetest.get_timeofday() + + -- remove mob if beyond map limits + if not within_limits(pos, 0) then + self.object:remove() + return + end + + -- bright light harms mob + if self.light_damage ~= 0 +-- and pos.y > 0 +-- and self.time_of_day > 0.2 +-- and self.time_of_day < 0.8 + and (minetest.get_node_light(pos) or 0) > 12 then + + self.health = self.health - self.light_damage + + effect(pos, 5, "tnt_smoke.png") + + if check_for_death(self, "light", {type = "light"}) then return end + end +--[[ + local y_level = self.collisionbox[2] + + if self.child then + y_level = self.collisionbox[2] * 0.5 + end + + -- what is mob standing in? + pos.y = pos.y + y_level + 0.25 -- foot level + self.standing_in = node_ok(pos, "air").name +-- print ("standing in " .. self.standing_in) +]] + -- don't fall when on ignore, just stand still + if self.standing_in == "ignore" then + self.object:setvelocity({x = 0, y = 0, z = 0}) + end + + local nodef = minetest.registered_nodes[self.standing_in] + + pos.y = pos.y + 1 -- for particle effect position + + -- water + if self.water_damage + and nodef.groups.water then + + if self.water_damage ~= 0 then + + self.health = self.health - self.water_damage + + effect(pos, 5, "bubble.png", nil, nil, 1, nil) + + if check_for_death(self, "water", {type = "environment", + pos = pos, node = self.standing_in}) then return end + end + + -- lava or fire + elseif self.lava_damage + and (nodef.groups.lava + or self.standing_in == node_fire + or self.standing_in == node_permanent_flame) then + + if self.lava_damage ~= 0 then + + self.health = self.health - self.lava_damage + + effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil) + + if check_for_death(self, "lava", {type = "environment", + pos = pos, node = self.standing_in}) then return end + end + + -- damage_per_second node check + elseif nodef.damage_per_second ~= 0 then + + self.health = self.health - nodef.damage_per_second + + effect(pos, 5, "tnt_smoke.png") + + if check_for_death(self, "dps", {type = "environment", + pos = pos, node = self.standing_in}) then return end + end +--[[ + --- suffocation inside solid node + if self.suffocation ~= 0 + and nodef.walkable == true + and nodef.groups.disable_suffocation ~= 1 + and nodef.drawtype == "normal" then + + self.health = self.health - self.suffocation + + if check_for_death(self, "suffocation", {type = "environment", + pos = pos, node = self.standing_in}) then return end + end +]] + check_for_death(self, "", {type = "unknown"}) +end + + +-- jump if facing a solid node (not fences or gates) +local do_jump = function(self) + + if not self.jump + or self.jump_height == 0 + or self.fly + or self.child + or self.order == "stand" then + return false + end + + self.facing_fence = false + + -- something stopping us while moving? + if self.state ~= "stand" + and get_velocity(self) > 0.5 + and self.object:getvelocity().y ~= 0 then + return false + end + + local pos = self.object:get_pos() + local yaw = self.object:get_yaw() + + -- what is mob standing on? + pos.y = pos.y + self.collisionbox[2] - 0.2 + + local nod = node_ok(pos) + +--print ("standing on:", nod.name, pos.y) + + if minetest.registered_nodes[nod.name].walkable == false then + return false + end + + -- where is front + local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5) + local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5) + + -- what is in front of mob? + local nod = node_ok({ + x = pos.x + dir_x, + y = pos.y + 0.5, + z = pos.z + dir_z + }) + + -- thin blocks that do not need to be jumped + if nod.name == node_snow then + return false + end + +--print ("in front:", nod.name, pos.y + 0.5) + + if self.walk_chance == 0 + or minetest.registered_items[nod.name].walkable then + + if not nod.name:find("fence") + and not nod.name:find("gate") then + + local v = self.object:getvelocity() + + v.y = self.jump_height + + set_animation(self, "jump") -- only when defined + + self.object:setvelocity(v) + + -- when in air move forward + minetest.after(0.3, function(self, v) + + if self.object:get_luaentity() then + + self.object:set_acceleration({ + x = v.x * 2,--1.5, + y = 0, + z = v.z * 2,--1.5 + }) + end + end, self, v) + + if get_velocity(self) > 0 then + mob_sound(self, self.sounds.jump) + end + else + self.facing_fence = true + end + + return true + end + + return false +end + + +-- blast damage to entities nearby (modified from TNT mod) +local entity_physics = function(pos, radius) + + radius = radius * 2 + + local objs = minetest.get_objects_inside_radius(pos, radius) + local obj_pos, dist + + for n = 1, #objs do + + obj_pos = objs[n]:get_pos() + + dist = get_distance(pos, obj_pos) + if dist < 1 then dist = 1 end + + local damage = floor((4 / dist) * radius) + local ent = objs[n]:get_luaentity() + + -- punches work on entities AND players + objs[n]:punch(objs[n], 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, pos) + end +end + + +-- should mob follow what I'm holding ? +local follow_holding = function(self, clicker) + + if mobs.invis[clicker:get_player_name()] then + return false + end + + local item = clicker:get_wielded_item() + local t = type(self.follow) + + -- single item + if t == "string" + and item:get_name() == self.follow then + return true + + -- multiple items + elseif t == "table" then + + for no = 1, #self.follow do + + if self.follow[no] == item:get_name() then + return true + end + end + end + + return false +end + + +-- find two animals of same type and breed if nearby and horny +local breed = function(self) + + -- child takes 240 seconds before growing into adult + if self.child == true then + + self.hornytimer = self.hornytimer + 1 + + if self.hornytimer > 240 then + + self.child = false + self.hornytimer = 0 + + self.object:set_properties({ + textures = self.base_texture, + mesh = self.base_mesh, + visual_size = self.base_size, + collisionbox = self.base_colbox, + selectionbox = self.base_selbox, + }) + + -- custom function when child grows up + if self.on_grown then + self.on_grown(self) + else + -- jump when fully grown so as not to fall into ground + self.object:setvelocity({ + x = 0, + y = self.jump_height, + z = 0 + }) + end + end + + return + end + + -- horny animal can mate for 40 seconds, + -- afterwards horny animal cannot mate again for 200 seconds + if self.horny == true + and self.hornytimer < 240 then + + self.hornytimer = self.hornytimer + 1 + + if self.hornytimer >= 240 then + self.hornytimer = 0 + self.horny = false + end + end + + -- find another same animal who is also horny and mate if nearby + if self.horny == true + and self.hornytimer <= 40 then + + local pos = self.object:get_pos() + + effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "heart.png", 3, 4, 1, 0.1) + + local objs = minetest.get_objects_inside_radius(pos, 3) + local num = 0 + local ent = nil + + for n = 1, #objs do + + ent = objs[n]:get_luaentity() + + -- check for same animal with different colour + local canmate = false + + if ent then + + if ent.name == self.name then + canmate = true + else + local entname = string.split(ent.name,":") + local selfname = string.split(self.name,":") + + if entname[1] == selfname[1] then + entname = string.split(entname[2],"_") + selfname = string.split(selfname[2],"_") + + if entname[1] == selfname[1] then + canmate = true + end + end + end + end + + if ent + and canmate == true + and ent.horny == true + and ent.hornytimer <= 40 then + num = num + 1 + end + + -- found your mate? then have a baby + if num > 1 then + + self.hornytimer = 41 + ent.hornytimer = 41 + + -- spawn baby + minetest.after(5, function(self, ent) + + if not self.object:get_luaentity() then + return + end + + -- custom breed function + if self.on_breed then + + -- when false skip going any further + if self.on_breed(self, ent) == false then + return + end + else + effect(pos, 15, "tnt_smoke.png", 1, 2, 2, 15, 5) + end + + local mob = minetest.add_entity(pos, self.name) + local ent2 = mob:get_luaentity() + local textures = self.base_texture + + -- using specific child texture (if found) + if self.child_texture then + textures = self.child_texture[1] + end + + -- and resize to half height + mob:set_properties({ + textures = textures, + visual_size = { + x = self.base_size.x * .5, + y = self.base_size.y * .5, + }, + collisionbox = { + self.base_colbox[1] * .5, + self.base_colbox[2] * .5, + self.base_colbox[3] * .5, + self.base_colbox[4] * .5, + self.base_colbox[5] * .5, + self.base_colbox[6] * .5, + }, + selectionbox = { + self.base_selbox[1] * .5, + self.base_selbox[2] * .5, + self.base_selbox[3] * .5, + self.base_selbox[4] * .5, + self.base_selbox[5] * .5, + self.base_selbox[6] * .5, + }, + }) + -- tamed and owned by parents' owner + ent2.child = true + ent2.tamed = true + ent2.owner = self.owner + end, self, ent) + + num = 0 + + break + end + end + end +end + + +-- find and replace what mob is looking for (grass, wheat etc.) +local replace = function(self, pos) + + if not mobs_griefing + or not self.replace_rate + or not self.replace_what + or self.child == true + or self.object:getvelocity().y ~= 0 + or random(1, self.replace_rate) > 1 then + return + end + + local what, with, y_offset + + if type(self.replace_what[1]) == "table" then + + local num = random(#self.replace_what) + + what = self.replace_what[num][1] or "" + with = self.replace_what[num][2] or "" + y_offset = self.replace_what[num][3] or 0 + else + what = self.replace_what + with = self.replace_with or "" + y_offset = self.replace_offset or 0 + end + + pos.y = pos.y + y_offset + + if #minetest.find_nodes_in_area(pos, pos, what) > 0 then + +-- print ("replace node = ".. minetest.get_node(pos).name, pos.y) + + local oldnode = {name = what} + local newnode = {name = with} + local on_replace_return + + if self.on_replace then + on_replace_return = self.on_replace(self, pos, oldnode, newnode) + end + + if on_replace_return ~= false then + + minetest.set_node(pos, {name = with}) + + -- when cow/sheep eats grass, replace wool and milk + if self.gotten == true then + self.gotten = false + self.object:set_properties(self) + end + end + end +end + + +-- check if daytime and also if mob is docile during daylight hours +local day_docile = function(self) + + if self.docile_by_day == false then + + return false + + elseif self.docile_by_day == true + and self.time_of_day > 0.2 + and self.time_of_day < 0.8 then + + return true + end +end + + +local los_switcher = false +local height_switcher = false + +-- path finding and smart mob routine by rnd, line_of_sight and other edits by Elkien3 +local smart_mobs = function(self, s, p, dist, dtime) + + local s1 = self.path.lastpos + + local target_pos = self.attack:get_pos() + + -- is it becoming stuck? + if abs(s1.x - s.x) + abs(s1.z - s.z) < .5 then + self.path.stuck_timer = self.path.stuck_timer + dtime + else + self.path.stuck_timer = 0 + end + + self.path.lastpos = {x = s.x, y = s.y, z = s.z} + + local use_pathfind = false + local has_lineofsight = minetest.line_of_sight( + {x = s.x, y = (s.y) + .5, z = s.z}, + {x = target_pos.x, y = (target_pos.y) + 1.5, z = target_pos.z}, .2) + + -- im stuck, search for path + if not has_lineofsight then + + if los_switcher == true then + use_pathfind = true + los_switcher = false + end -- cannot see target! + else + if los_switcher == false then + + los_switcher = true + use_pathfind = false + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end -- can see target! + end + + if (self.path.stuck_timer > stuck_timeout and not self.path.following) then + + use_pathfind = true + self.path.stuck_timer = 0 + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end + + if (self.path.stuck_timer > stuck_path_timeout and self.path.following) then + + use_pathfind = true + self.path.stuck_timer = 0 + + minetest.after(1, function(self) + + if self.object:get_luaentity() then + + if has_lineofsight then + self.path.following = false + end + end + end, self) + end + + if math.abs(vector.subtract(s,target_pos).y) > self.stepheight then + + if height_switcher then + use_pathfind = true + height_switcher = false + end + else + if not height_switcher then + use_pathfind = false + height_switcher = true + end + end + + if use_pathfind then + -- lets try find a path, first take care of positions + -- since pathfinder is very sensitive + local sheight = self.collisionbox[5] - self.collisionbox[2] + + -- round position to center of node to avoid stuck in walls + -- also adjust height for player models! + s.x = floor(s.x + 0.5) +-- s.y = floor(s.y + 0.5) - sheight + s.z = floor(s.z + 0.5) + + local ssight, sground = minetest.line_of_sight(s, { + x = s.x, y = s.y - 4, z = s.z}, 1) + + -- determine node above ground + if not ssight then + s.y = sground.y + 1 + end + + local p1 = self.attack:get_pos() + + p1.x = floor(p1.x + 0.5) + p1.y = floor(p1.y + 0.5) + p1.z = floor(p1.z + 0.5) + + local dropheight = 6 + if self.fear_height ~= 0 then dropheight = self.fear_height end + + self.path.way = minetest.find_path(s, p1, 16, self.stepheight, dropheight, "Dijkstra") +--[[ + -- show path using particles + if self.path.way and #self.path.way > 0 then + print ("-- path length:" .. tonumber(#self.path.way)) + for _,pos in pairs(self.path.way) do + minetest.add_particle({ + pos = pos, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0, z=0}, + expirationtime = 1, + size = 4, + collisiondetection = false, + vertical = false, + texture = "heart.png", + }) + end + end +]] + + self.state = "" + do_attack(self, self.attack) + + -- no path found, try something else + if not self.path.way then + + self.path.following = false + + -- lets make way by digging/building if not accessible + if self.pathfinding == 2 and mobs_griefing then + + -- is player higher than mob? + if s.y < p1.y then + + -- build upwards + if not minetest.is_protected(s, "") then + + local ndef1 = minetest.registered_nodes[self.standing_in] + + if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then + + minetest.set_node(s, {name = mobs.fallback_node}) + end + end + + local sheight = math.ceil(self.collisionbox[5]) + 1 + + -- assume mob is 2 blocks high so it digs above its head + s.y = s.y + sheight + + -- remove one block above to make room to jump + if not minetest.is_protected(s, "") then + + local node1 = node_ok(s, "air").name + local ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.set_node(s, {name = "air"}) + minetest.add_item(s, ItemStack(node1)) + + end + end + + s.y = s.y - sheight + self.object:setpos({x = s.x, y = s.y + 2, z = s.z}) + + else -- dig 2 blocks to make door toward player direction + + local yaw1 = self.object:get_yaw() + pi / 2 + local p1 = { + x = s.x + cos(yaw1), + y = s.y, + z = s.z + sin(yaw1) + } + + if not minetest.is_protected(p1, "") then + + local node1 = node_ok(p1, "air").name + local ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.add_item(p1, ItemStack(node1)) + minetest.set_node(p1, {name = "air"}) + end + + p1.y = p1.y + 1 + node1 = node_ok(p1, "air").name + ndef1 = minetest.registered_nodes[node1] + + if node1 ~= "air" + and node1 ~= "ignore" + and ndef1 + and not ndef1.groups.level + and not ndef1.groups.unbreakable + and not ndef1.groups.liquid then + + minetest.add_item(p1, ItemStack(node1)) + minetest.set_node(p1, {name = "air"}) + end + + end + end + end + + -- will try again in 2 second + self.path.stuck_timer = stuck_timeout - 2 + + -- frustration! cant find the damn path :( + mob_sound(self, self.sounds.random) + else + -- yay i found path + mob_sound(self, self.sounds.war_cry) + set_velocity(self, self.walk_velocity) + + -- follow path now that it has it + self.path.following = true + end + end +end + + +-- specific attacks +local specific_attack = function(list, what) + + -- no list so attack default (player, animals etc.) + if list == nil then + return true + end + + -- found entity on list to attack? + for no = 1, #list do + + if list[no] == what then + return true + end + end + + return false +end + + +-- monster find someone to attack +local monster_attack = function(self) + + if self.type ~= "monster" + or not damage_enabled + or creative + or self.state == "attack" + or day_docile(self) then + return + end + + local s = self.object:get_pos() + local p, sp, dist + local player, obj, min_player + local type, name = "", "" + local min_dist = self.view_range + 1 + local objs = minetest.get_objects_inside_radius(s, self.view_range) + + for n = 1, #objs do + + if objs[n]:is_player() then + + if mobs.invis[ objs[n]:get_player_name() ] then + + type = "" + else + player = objs[n] + type = "player" + name = "player" + end + else + obj = objs[n]:get_luaentity() + + if obj then + player = obj.object + type = obj.type + name = obj.name or "" + end + end + + -- find specific mob to attack, failing that attack player/npc/animal + if specific_attack(self.specific_attack, name) + and (type == "player" or type == "npc" + or (type == "animal" and self.attack_animals == true)) then + + p = player:get_pos() + sp = s + + dist = get_distance(p, s) + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + + -- choose closest player to attack + if dist < min_dist + and line_of_sight(self, sp, p, 2) == true then + min_dist = dist + min_player = player + end + end + end + + -- attack player + if min_player then + do_attack(self, min_player) + end +end + + +-- npc, find closest monster to attack +local npc_attack = function(self) + + if self.type ~= "npc" + or not self.attacks_monsters + or self.state == "attack" then + return + end + + local p, sp, obj, min_player, dist + local s = self.object:get_pos() + local min_dist = self.view_range + 1 + local objs = minetest.get_objects_inside_radius(s, self.view_range) + + for n = 1, #objs do + + obj = objs[n]:get_luaentity() + + if obj and obj.type == "monster" then + + p = obj.object:get_pos() + sp = s + + dist = get_distance(p, s) + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + if dist < min_dist + and line_of_sight(self, sp, p, 2) == true then + min_dist = dist + min_player = obj.object + end + end + end + + if min_player then + do_attack(self, min_player) + end +end + + +-- specific runaway +local specific_runaway = function(list, what) + + -- no list so do not run + if list == nil then + return false + end + + -- found entity on list to attack? + for no = 1, #list do + + if list[no] == what then + return true + end + end + + return false +end + + +-- find someone to runaway from +local runaway_from = function(self) + + if not self.runaway_from then + return + end + + local s = self.object:get_pos() + local p, sp, dist + local player, obj, min_player + local type, name = "", "" + local min_dist = self.view_range + 1 + local objs = minetest.get_objects_inside_radius(s, self.view_range) + + for n = 1, #objs do + + if objs[n]:is_player() then + + if mobs.invis[ objs[n]:get_player_name() ] + or self.owner == objs[n]:get_player_name() then + + type = "" + else + player = objs[n] + type = "player" + name = "player" + end + else + obj = objs[n]:get_luaentity() + + if obj then + player = obj.object + type = obj.type + name = obj.name or "" + end + end + + -- find specific mob to runaway from + if name ~= "" and name ~= self.name + and specific_runaway(self.runaway_from, name) then + + p = player:get_pos() + sp = s + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + dist = get_distance(p, s) + + + -- choose closest player/mpb to runaway from + if dist < min_dist + and line_of_sight(self, sp, p, 2) == true then + min_dist = dist + min_player = player + end + end + end + + if min_player then + + local lp = player:get_pos() + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end + + yaw = set_yaw(self, yaw, 4) + self.state = "runaway" + self.runaway_timer = 3 + self.following = nil + end +end + + +-- follow player if owner or holding item, if fish outta water then flop +local follow_flop = function(self) + + -- find player to follow + if (self.follow ~= "" + or self.order == "follow") + and not self.following + and self.state ~= "attack" + and self.state ~= "runaway" then + + local s = self.object:get_pos() + local players = minetest.get_connected_players() + + for n = 1, #players do + + if get_distance(players[n]:get_pos(), s) < self.view_range + and not mobs.invis[ players[n]:get_player_name() ] then + + self.following = players[n] + + break + end + end + end + + if self.type == "npc" + and self.order == "follow" + and self.state ~= "attack" + and self.owner ~= "" then + + -- npc stop following player if not owner + if self.following + and self.owner + and self.owner ~= self.following:get_player_name() then + self.following = nil + end + else + -- stop following player if not holding specific item + if self.following + and self.following:is_player() + and follow_holding(self, self.following) == false then + self.following = nil + end + + end + + -- follow that thing + if self.following then + + local s = self.object:get_pos() + local p + + if self.following:is_player() then + + p = self.following:get_pos() + + elseif self.following.object then + + p = self.following.object:get_pos() + end + + if p then + + local dist = get_distance(p, s) + + -- dont follow if out of range + if dist > self.view_range then + self.following = nil + else + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw, 6) + + -- anyone but standing npc's can move along + if dist > self.reach + and self.order ~= "stand" then + + set_velocity(self, self.walk_velocity) + + if self.walk_chance ~= 0 then + set_animation(self, "walk") + end + else + set_velocity(self, 0) + set_animation(self, "stand") + end + + return + end + end + end + + -- swimmers flop when out of their element, and swim again when back in + if self.fly then + local s = self.object:get_pos() + if not flight_check(self, s) then + + self.state = "flop" + self.object:setvelocity({x = 0, y = -5, z = 0}) + + set_animation(self, "stand") + + return + elseif self.state == "flop" then + self.state = "stand" + end + end +end + + +-- dogshoot attack switch and counter function +local dogswitch = function(self, dtime) + + -- switch mode not activated + if not self.dogshoot_switch + or not dtime then + return 0 + end + + self.dogshoot_count = self.dogshoot_count + dtime + + if (self.dogshoot_switch == 1 + and self.dogshoot_count > self.dogshoot_count_max) + or (self.dogshoot_switch == 2 + and self.dogshoot_count > self.dogshoot_count2_max) then + + self.dogshoot_count = 0 + + if self.dogshoot_switch == 1 then + self.dogshoot_switch = 2 + else + self.dogshoot_switch = 1 + end + end + + return self.dogshoot_switch +end + + +-- execute current state (stand, walk, run, attacks) +local do_states = function(self, dtime) + + local yaw = self.object:get_yaw() or 0 + + if self.state == "stand" then + + if random(1, 4) == 1 then + + local lp = nil + local s = self.object:get_pos() + local objs = minetest.get_objects_inside_radius(s, 3) + + for n = 1, #objs do + + if objs[n]:is_player() then + lp = objs[n]:get_pos() + break + end + end + + -- look at any players nearby, otherwise turn randomly + if lp then + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + else + yaw = yaw + random(-0.5, 0.5) + end + + yaw = set_yaw(self, yaw, 8) + end + + set_velocity(self, 0) + set_animation(self, "stand") + + -- npc's ordered to stand stay standing + if self.type ~= "npc" + or self.order ~= "stand" then + + if self.walk_chance ~= 0 + and self.facing_fence ~= true + and random(1, 100) <= self.walk_chance + and is_at_cliff(self) == false then + + set_velocity(self, self.walk_velocity) + self.state = "walk" + set_animation(self, "walk") + + --[[ fly up/down randomly for flying mobs + if self.fly and random(1, 100) <= self.walk_chance then + + local v = self.object:getvelocity() + local ud = random(-1, 2) / 9 + + self.object:setvelocity({x = v.x, y = ud, z = v.z}) + end--]] + end + end + + elseif self.state == "walk" then + + local s = self.object:get_pos() + local lp = nil + + -- is there something I need to avoid? + if self.water_damage > 0 + and self.lava_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:water", "group:lava"}) + + elseif self.water_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:water"}) + + elseif self.lava_damage > 0 then + + lp = minetest.find_node_near(s, 1, {"group:lava"}) + end + + if lp then + + -- if mob in water or lava then look for land + if (self.lava_damage + and minetest.registered_nodes[self.standing_in].groups.lava) + or (self.water_damage + and minetest.registered_nodes[self.standing_in].groups.water) then + + lp = minetest.find_node_near(s, 5, {"group:soil", "group:stone", + "group:sand", node_ice, node_snowblock}) + + -- did we find land? + if lp then + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + + -- look towards land and jump/move in that direction + yaw = set_yaw(self, yaw, 6) + do_jump(self) + set_velocity(self, self.walk_velocity) + else + yaw = yaw + random(-0.5, 0.5) + end + + else + + local vec = { + x = lp.x - s.x, + z = lp.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if lp.x > s.x then yaw = yaw + pi end + end + + yaw = set_yaw(self, yaw, 8) + + -- otherwise randomly turn + elseif random(1, 100) <= 30 then + + yaw = yaw + random(-0.5, 0.5) + + yaw = set_yaw(self, yaw, 8) + end + + -- stand for great fall in front + local temp_is_cliff = is_at_cliff(self) + + if self.facing_fence == true + or temp_is_cliff + or random(1, 100) <= 30 then + + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.walk_velocity) + + if flight_check(self) + and self.animation + and self.animation.fly_start + and self.animation.fly_end then + set_animation(self, "fly") + else + set_animation(self, "walk") + end + end + + -- runaway when punched + elseif self.state == "runaway" then + + self.runaway_timer = self.runaway_timer + 1 + + -- stop after 5 seconds or when at cliff + if self.runaway_timer > 5 + or is_at_cliff(self) then + self.runaway_timer = 0 + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.run_velocity) + set_animation(self, "walk") + end + + -- attack routines (explode, dogfight, shoot, dogshoot) + elseif self.state == "attack" then + + -- calculate distance from mob and enemy + local s = self.object:get_pos() + local p = self.attack:get_pos() or s + local dist = get_distance(p, s) + + -- stop attacking if player invisible or out of range + if dist > self.view_range + or not self.attack + or not self.attack:get_pos() + or self.attack:get_hp() <= 0 + or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then + +-- print(" ** stop attacking **", dist, self.view_range) + self.state = "stand" + set_velocity(self, 0) + set_animation(self, "stand") + self.attack = nil + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.path.way = nil + + return + end + + if self.attack_type == "explode" then + + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + local node_break_radius = self.explosion_radius or 1 + local entity_damage_radius = self.explosion_damage_radius + or (node_break_radius * 2) + + -- start timer when in reach and line of sight + if not self.v_start + and dist <= self.reach + and line_of_sight(self, s, p, 2) then + + self.v_start = true + self.timer = 0 + self.blinktimer = 0 + mob_sound(self, self.sounds.fuse) +-- print ("=== explosion timer started", self.explosion_timer) + + -- stop timer if out of reach or direct line of sight + elseif self.allow_fuse_reset + and self.v_start + and (dist > self.reach + or not line_of_sight(self, s, p, 2)) then + self.v_start = false + self.timer = 0 + self.blinktimer = 0 + self.blinkstatus = false + self.object:settexturemod("") + end + + -- walk right up to player unless the timer is active + if self.v_start and (self.stop_to_explode or dist < 1.5) then + set_velocity(self, 0) + else + set_velocity(self, self.run_velocity) + end + + if self.animation and self.animation.run_start then + set_animation(self, "run") + else + set_animation(self, "walk") + end + + if self.v_start then + + self.timer = self.timer + dtime + self.blinktimer = (self.blinktimer or 0) + dtime + + if self.blinktimer > 0.2 then + + self.blinktimer = 0 + + if self.blinkstatus then + self.object:settexturemod("") + else + self.object:settexturemod("^[brighten") + end + + self.blinkstatus = not self.blinkstatus + end + +-- print ("=== explosion timer", self.timer) + + if self.timer > self.explosion_timer then + + local pos = self.object:get_pos() + + -- dont damage anything if area protected or next to water + if minetest.find_node_near(pos, 1, {"group:water"}) + or minetest.is_protected(pos, "") then + + node_break_radius = 1 + end + + self.object:remove() + + if minetest.get_modpath("tnt") and tnt and tnt.boom + and not minetest.is_protected(pos, "") then + + tnt.boom(pos, { + radius = node_break_radius, + damage_radius = entity_damage_radius, + sound = self.sounds.explode, + }) + else + + minetest.sound_play(self.sounds.explode, { + pos = pos, + gain = 1.0, + max_hear_distance = self.sounds.distance or 32 + }) + + entity_physics(pos, entity_damage_radius) + effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0) + end + + return + end + end + + elseif self.attack_type == "dogfight" + or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 2) + or (self.attack_type == "dogshoot" and dist <= self.reach and dogswitch(self) == 0) then + + if self.fly + and dist > self.reach then + + local p1 = s + local me_y = floor(p1.y) + local p2 = p + local p_y = floor(p2.y + 1) + local v = self.object:getvelocity() + + if flight_check(self, s) then + + if me_y < p_y then + + self.object:setvelocity({ + x = v.x, + y = 1 * self.walk_velocity, + z = v.z + }) + + elseif me_y > p_y then + + self.object:setvelocity({ + x = v.x, + y = -1 * self.walk_velocity, + z = v.z + }) + end + else + if me_y < p_y then + + self.object:setvelocity({ + x = v.x, + y = 0.01, + z = v.z + }) + + elseif me_y > p_y then + + self.object:setvelocity({ + x = v.x, + y = -0.01, + z = v.z + }) + end + end + + end + + -- rnd: new movement direction + if self.path.following + and self.path.way + and self.attack_type ~= "dogshoot" then + + -- no paths longer than 50 + if #self.path.way > 50 + or dist < self.reach then + self.path.following = false + return + end + + local p1 = self.path.way[1] + + if not p1 then + self.path.following = false + return + end + + if abs(p1.x-s.x) + abs(p1.z - s.z) < 0.6 then + -- reached waypoint, remove it from queue + table.remove(self.path.way, 1) + end + + -- set new temporary target + p = {x = p1.x, y = p1.y, z = p1.z} + end + + local vec = { + x = p.x - s.x, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + -- move towards enemy if beyond mob reach + if dist > self.reach then + + -- path finding by rnd + if self.pathfinding -- only if mob has pathfinding enabled + and enable_pathfinding then + + smart_mobs(self, s, p, dist, dtime) + end + + if is_at_cliff(self) then + + set_velocity(self, 0) + set_animation(self, "stand") + else + + if self.path.stuck then + set_velocity(self, self.walk_velocity) + else + set_velocity(self, self.run_velocity) + end + + if self.animation and self.animation.run_start then + set_animation(self, "run") + else + set_animation(self, "walk") + end + end + + else -- rnd: if inside reach range + + self.path.stuck = false + self.path.stuck_timer = 0 + self.path.following = false -- not stuck anymore + + set_velocity(self, 0) + + if not self.custom_attack then + + if self.timer > 1 then + + self.timer = 0 + + if self.double_melee_attack + and random(1, 2) == 1 then + set_animation(self, "punch2") + else + set_animation(self, "punch") + end + + local p2 = p + local s2 = s + + p2.y = p2.y + .5 + s2.y = s2.y + .5 + + if line_of_sight(self, p2, s2) == true then + + -- play attack sound + mob_sound(self, self.sounds.attack) + + -- punch player (or what player is attached to) + local attached = self.attack:get_attach() + if attached then + self.attack = attached + end + self.attack:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self.damage} + }, nil) + end + end + else -- call custom attack every second + if self.custom_attack + and self.timer > 1 then + + self.timer = 0 + + self.custom_attack(self, p) + end + end + end + + elseif self.attack_type == "shoot" + or (self.attack_type == "dogshoot" and dogswitch(self, dtime) == 1) + or (self.attack_type == "dogshoot" and dist > self.reach and dogswitch(self) == 0) then + + p.y = p.y - .5 + s.y = s.y + .5 + + local dist = get_distance(p, s) + local vec = { + x = p.x - s.x, + y = p.y - s.y, + z = p.z - s.z + } + + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate + + if p.x > s.x then yaw = yaw + pi end + + yaw = set_yaw(self, yaw) + + set_velocity(self, 0) + + if self.shoot_interval + and self.timer > self.shoot_interval + and random(1, 100) <= 60 then + + self.timer = 0 + set_animation(self, "shoot") + + -- play shoot attack sound + mob_sound(self, self.sounds.shoot_attack) + + local p = self.object:get_pos() + + p.y = p.y + (self.collisionbox[2] + self.collisionbox[5]) / 2 + + if minetest.registered_entities[self.arrow] then + + local obj = minetest.add_entity(p, self.arrow) + local ent = obj:get_luaentity() + local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 + local v = ent.velocity or 1 -- or set to default + + ent.switch = 1 + ent.owner_id = tostring(self.object) -- add unique owner id to arrow + + -- offset makes shoot aim accurate + vec.y = vec.y + self.shoot_offset + vec.x = vec.x * (v / amount) + vec.y = vec.y * (v / amount) + vec.z = vec.z * (v / amount) + + obj:setvelocity(vec) + end + end + end + end +end + + +-- falling and fall damage +local falling = function(self, pos) + + if self.fly then + return + end + + -- floating in water (or falling) + local v = self.object:getvelocity() + + if v.y > 0 then + + -- apply gravity when moving up + self.object:setacceleration({ + x = 0, + y = -10, + z = 0 + }) + + elseif v.y <= 0 and v.y > self.fall_speed then + + -- fall downwards at set speed + self.object:setacceleration({ + x = 0, + y = self.fall_speed, + z = 0 + }) + else + -- stop accelerating once max fall speed hit + self.object:setacceleration({x = 0, y = 0, z = 0}) + end + + -- in water then float up + if minetest.registered_nodes[self.standing_in].groups.water then + + if self.floats == 1 then + + self.object:setacceleration({ + x = 0, + y = -self.fall_speed / (max(1, v.y) ^ 8), -- 8 was 2 + z = 0 + }) + end + else + + -- fall damage onto solid ground + if self.fall_damage == 1 + and self.object:getvelocity().y == 0 then + + local d = (self.old_y or 0) - self.object:get_pos().y + + if d > 5 then + + self.health = self.health - floor(d - 5) + + effect(pos, 5, "tnt_smoke.png", 1, 2, 2, nil) + + if check_for_death(self, "fall", {type = "fall"}) then + return + end + end + + self.old_y = self.object:get_pos().y + end + end +end + + +-- deal damage and effects when mob punched +local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) + + -- custom punch function + if self.do_punch then + + -- when false skip going any further + if self.do_punch(self, hitter, tflp, tool_capabilities, dir) == false then + return + end + end + + -- mob health check +-- if self.health <= 0 then +-- return +-- end + + -- error checking when mod profiling is enabled + if not tool_capabilities then + minetest.log("warning", "[mobs] Mod profiling enabled, damage not enabled") + return + end + + -- is mob protected? + if self.protected and hitter:is_player() + and minetest.is_protected(self.object:get_pos(), hitter:get_player_name()) then + minetest.chat_send_player(hitter:get_player_name(), S("Mob has been protected!")) + return + end + + + -- weapon wear + local weapon = hitter:get_wielded_item() + local punch_interval = 1.4 + + -- calculate mob damage + local damage = 0 + local armor = self.object:get_armor_groups() or {} + local tmp + + -- quick error check incase it ends up 0 (serialize.h check test) + if tflp == 0 then + tflp = 0.2 + end + + if use_cmi then + damage = cmi.calculate_damage(self.object, hitter, tflp, tool_capabilities, dir) + else + + for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do + + tmp = tflp / (tool_capabilities.full_punch_interval or 1.4) + + if tmp < 0 then + tmp = 0.0 + elseif tmp > 1 then + tmp = 1.0 + end + + damage = damage + (tool_capabilities.damage_groups[group] or 0) + * tmp * ((armor[group] or 0) / 100.0) + end + end + + -- check for tool immunity or special damage + for n = 1, #self.immune_to do + + if self.immune_to[n][1] == weapon:get_name() then + + damage = self.immune_to[n][2] or 0 + break + + -- if "all" then no tool does damage unless it's specified in list + elseif self.immune_to[n][1] == "all" then + damage = self.immune_to[n][2] or 0 + end + end + + -- healing + if damage <= -1 then + self.health = self.health - floor(damage) + return + end + +-- print ("Mob Damage is", damage) + + if use_cmi then + + local cancel = cmi.notify_punch(self.object, hitter, tflp, tool_capabilities, dir, damage) + + if cancel then return end + end + + -- add weapon wear + if tool_capabilities then + punch_interval = tool_capabilities.full_punch_interval or 1.4 + end + + if weapon:get_definition() + and weapon:get_definition().tool_capabilities then + + weapon:add_wear(floor((punch_interval / 75) * 9000)) + hitter:set_wielded_item(weapon) + end + + -- only play hit sound and show blood effects if damage is 1 or over + if damage >= 1 then + + -- weapon sounds + if weapon:get_definition().sounds ~= nil then + + local s = random(0, #weapon:get_definition().sounds) + + minetest.sound_play(weapon:get_definition().sounds[s], { + object = self.object, --hitter, + max_hear_distance = 8 + }) + else + minetest.sound_play("default_punch", { + object = self.object, --hitter, + max_hear_distance = 5 + }) + end + + -- blood_particles + if self.blood_amount > 0 + and not disable_blood then + + local pos = self.object:get_pos() + + pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5 + + -- do we have a single blood texture or multiple? + if type(self.blood_texture) == "table" then + + local blood = self.blood_texture[random(1, #self.blood_texture)] + + effect(pos, self.blood_amount, blood, nil, nil, 1, nil) + else + effect(pos, self.blood_amount, self.blood_texture, nil, nil, 1, nil) + end + end + + -- do damage + self.health = self.health - floor(damage) + + -- exit here if dead, special item check + if weapon:get_name() == "mobs:pick_lava" then + if check_for_death(self, "lava", {type = "punch", + puncher = hitter}) then + return + end + else + if check_for_death(self, "hit", {type = "punch", + puncher = hitter}) then + return + end + end + + --[[ add healthy afterglow when hit (can cause hit lag with larger textures) + minetest.after(0.1, function() + + if not self.object:get_luaentity() then return end + + self.object:settexturemod("^[colorize:#c9900070") + + core.after(0.3, function() + self.object:settexturemod("") + end) + end) ]] + + -- knock back effect (only on full punch) + if self.knock_back + and tflp >= punch_interval then + + local v = self.object:getvelocity() + local r = 1.4 - min(punch_interval, 1.4) + local kb = r * 5 + local up = 2 + + -- if already in air then dont go up anymore when hit + if v.y > 0 + or self.fly then + up = 0 + end + + -- direction error check + dir = dir or {x = 0, y = 0, z = 0} + + -- check if tool already has specific knockback value + if tool_capabilities.damage_groups["knockback"] then + kb = tool_capabilities.damage_groups["knockback"] + else + kb = kb * 1.5 + end + + self.object:setvelocity({ + x = dir.x * kb, + y = up, + z = dir.z * kb + }) + + self.pause_timer = 0.25 + end + end -- END if damage + + -- if skittish then run away + if self.runaway == true then + + local lp = hitter:get_pos() + local s = self.object:get_pos() + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + local yaw = (atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end + + yaw = set_yaw(self, yaw, 6) + self.state = "runaway" + self.runaway_timer = 0 + self.following = nil + end + + local name = hitter:get_player_name() or "" + + -- attack puncher and call other mobs for help + if self.passive == false + and self.state ~= "flop" + and self.child == false + and hitter:get_player_name() ~= self.owner + and not mobs.invis[ name ] then + + -- attack whoever punched mob + self.state = "" + do_attack(self, hitter) + + -- alert others to the attack + local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) + local obj = nil + + for n = 1, #objs do + + obj = objs[n]:get_luaentity() + + if obj then + + -- only alert members of same mob + if obj.group_attack == true + and obj.state ~= "attack" + and obj.owner ~= name + and obj.name == self.name then + do_attack(obj, hitter) + end + + -- have owned mobs attack player threat + if obj.owner == name and obj.owner_loyal then + do_attack(obj, self.object) + end + end + end + end +end + + +-- get entity staticdata +local mob_staticdata = function(self) + + -- remove mob when out of range unless tamed + if remove_far + and self.remove_ok + and self.type ~= "npc" + and self.state ~= "attack" + and not self.tamed + and self.lifetimer < 20000 then + + --print ("REMOVED " .. self.name) + + self.object:remove() + + return ""-- nil + end + + self.remove_ok = true + self.attack = nil + self.following = nil + self.state = "stand" + + -- used to rotate older mobs + if self.drawtype + and self.drawtype == "side" then + self.rotate = math.rad(90) + end + + if use_cmi then + self.serialized_cmi_components = cmi.serialize_components(self._cmi_components) + end + + local tmp = {} + + for _,stat in pairs(self) do + + local t = type(stat) + + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" + and _ ~= "_cmi_components" then + tmp[_] = self[_] + end + end + + --print('===== '..self.name..'\n'.. dump(tmp)..'\n=====\n') + return minetest.serialize(tmp) +end + + +-- activate mob and reload settings +local mob_activate = function(self, staticdata, def, dtime) + + -- remove monsters in peaceful mode + if self.type == "monster" + and peaceful_only then + + self.object:remove() + + return + end + + -- load entity variables + local tmp = minetest.deserialize(staticdata) + + if tmp then + for _,stat in pairs(tmp) do + self[_] = stat + end + end + + -- select random texture, set model and size + if not self.base_texture then + + -- compatiblity with old simple mobs textures + if type(def.textures[1]) == "string" then + def.textures = {def.textures} + end + + self.base_texture = def.textures[random(1, #def.textures)] + self.base_mesh = def.mesh + self.base_size = self.visual_size + self.base_colbox = self.collisionbox + self.base_selbox = self.selectionbox + end + + -- for current mobs that dont have this set + if not self.base_selbox then + self.base_selbox = self.selectionbox or self.base_colbox + end + + -- set texture, model and size + local textures = self.base_texture + local mesh = self.base_mesh + local vis_size = self.base_size + local colbox = self.base_colbox + local selbox = self.base_selbox + + -- specific texture if gotten + if self.gotten == true + and def.gotten_texture then + textures = def.gotten_texture + end + + -- specific mesh if gotten + if self.gotten == true + and def.gotten_mesh then + mesh = def.gotten_mesh + end + + -- set child objects to half size + if self.child == true then + + vis_size = { + x = self.base_size.x * .5, + y = self.base_size.y * .5, + } + + if def.child_texture then + textures = def.child_texture[1] + end + + colbox = { + self.base_colbox[1] * .5, + self.base_colbox[2] * .5, + self.base_colbox[3] * .5, + self.base_colbox[4] * .5, + self.base_colbox[5] * .5, + self.base_colbox[6] * .5 + } + selbox = { + self.base_selbox[1] * .5, + self.base_selbox[2] * .5, + self.base_selbox[3] * .5, + self.base_selbox[4] * .5, + self.base_selbox[5] * .5, + self.base_selbox[6] * .5 + } + end + + if self.health == 0 then + self.health = random (self.hp_min, self.hp_max) + end + + -- pathfinding init + self.path = {} + self.path.way = {} -- path to follow, table of positions + self.path.lastpos = {x = 0, y = 0, z = 0} + self.path.stuck = false + self.path.following = false -- currently following path? + self.path.stuck_timer = 0 -- if stuck for too long search for path + + -- mob defaults + self.object:set_armor_groups({immortal = 1, fleshy = self.armor}) + self.old_y = self.object:get_pos().y + self.old_health = self.health + self.sounds.distance = self.sounds.distance or 10 + self.textures = textures + self.mesh = mesh + self.collisionbox = colbox + self.selectionbox = selbox + self.visual_size = vis_size + self.standing_in = "air" + + -- check existing nametag + if not self.nametag then + self.nametag = def.nametag + end + + -- set anything changed above + self.object:set_properties(self) + set_yaw(self, (random(0, 360) - 180) / 180 * pi, 6) + update_tag(self) + set_animation(self, "stand") + + -- run on_spawn function if found + if self.on_spawn and not self.on_spawn_run then + if self.on_spawn(self) then + self.on_spawn_run = true -- if true, set flag to run once only + end + end + + -- run after_activate + if def.after_activate then + def.after_activate(self, staticdata, def, dtime) + end + + if use_cmi then + self._cmi_components = cmi.activate_components(self.serialized_cmi_components) + cmi.notify_activate(self.object, dtime) + end +end + + +-- main mob function +local mob_step = function(self, dtime) + + if use_cmi then + cmi.notify_step(self.object, dtime) + end + + local pos = self.object:get_pos() + local yaw = 0 + + -- when lifetimer expires remove mob (except npc and tamed) + if self.type ~= "npc" + and not self.tamed + and self.state ~= "attack" + and remove_far ~= true + and self.lifetimer < 20000 then + + self.lifetimer = self.lifetimer - dtime + + if self.lifetimer <= 0 then + + -- only despawn away from player + local objs = minetest.get_objects_inside_radius(pos, 15) + + for n = 1, #objs do + + if objs[n]:is_player() then + + self.lifetimer = 20 + + return + end + end + +-- minetest.log("action", +-- S("lifetimer expired, removed @1", self.name)) + + effect(pos, 15, "tnt_smoke.png", 2, 4, 2, 0) + + self.object:remove() + + return + end + end + + -- get node at foot level every quarter second + self.node_timer = (self.node_timer or 0) + dtime + + if self.node_timer > 0.25 then + + self.node_timer = 0 + + local y_level = self.collisionbox[2] + + if self.child then + y_level = self.collisionbox[2] * 0.5 + end + + -- what is mob standing in? + self.standing_in = node_ok({ + x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name +-- print ("standing in " .. self.standing_in) + end + + -- check if falling, flying, floating + falling(self, pos) + + -- smooth rotation by ThomasMonroe314 + + if self.delay and self.delay > 0 then + + local yaw = self.object:get_yaw() + + if self.delay == 1 then + yaw = self.target_yaw + else + local dif = abs(yaw - self.target_yaw) + + if yaw > self.target_yaw then + + if dif > pi then + dif = 2 * pi - dif -- need to add + yaw = yaw + dif / self.delay + else + yaw = yaw - dif / self.delay -- need to subtract + end + + elseif yaw < self.target_yaw then + + if dif > pi then + dif = 2 * pi - dif + yaw = yaw - dif / self.delay -- need to subtract + else + yaw = yaw + dif / self.delay -- need to add + end + end + + if yaw > (pi * 2) then yaw = yaw - (pi * 2) end + if yaw < 0 then yaw = yaw + (pi * 2) end + end + + self.delay = self.delay - 1 + self.object:set_yaw(yaw) + end + + -- end rotation + + -- knockback timer + if self.pause_timer > 0 then + + self.pause_timer = self.pause_timer - dtime + + return + end + + -- run custom function (defined in mob lua file) + if self.do_custom then + + -- when false skip going any further + if self.do_custom(self, dtime) == false then + return + end + end + + -- attack timer + self.timer = self.timer + dtime + + if self.state ~= "attack" then + + if self.timer < 1 then + return + end + + self.timer = 0 + end + + -- never go over 100 + if self.timer > 100 then + self.timer = 1 + end + + -- mob plays random sound at times + if random(1, 100) == 1 then + mob_sound(self, self.sounds.random) + end + + -- environmental damage timer (every 1 second) + self.env_damage_timer = self.env_damage_timer + dtime + + if (self.state == "attack" and self.env_damage_timer > 1) + or self.state ~= "attack" then + + self.env_damage_timer = 0 + + -- check for environmental damage (water, fire, lava etc.) + do_env_damage(self) + + -- node replace check (cow eats grass etc.) + replace(self, pos) + end + + monster_attack(self) + + npc_attack(self) + + breed(self) + + follow_flop(self) + + do_states(self, dtime) + + do_jump(self) + + runaway_from(self) + +end + + +-- default function when mobs are blown up with TNT +local do_tnt = function(obj, damage) + + --print ("----- Damage", damage) + + obj.object:punch(obj.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + + return false, true, {} +end + + +mobs.spawning_mobs = {} + +-- register mob entity +function mobs:register_mob(name, def) + + mobs.spawning_mobs[name] = true + +minetest.register_entity(name, { + + stepheight = def.stepheight or 1.1, -- was 0.6 + name = name, + type = def.type, + attack_type = def.attack_type, + fly = def.fly, + fly_in = def.fly_in or "air", + owner = def.owner or "", + order = def.order or "", + on_die = def.on_die, + do_custom = def.do_custom, + jump_height = def.jump_height or 4, -- was 6 + drawtype = def.drawtype, -- DEPRECATED, use rotate instead + rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 + lifetimer = def.lifetimer or 180, -- 3 minutes + hp_min = max(1, (def.hp_min or 5) * difficulty), + hp_max = max(1, (def.hp_max or 10) * difficulty), + physical = true, + collisionbox = def.collisionbox or {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + selectionbox = def.selectionbox or def.collisionbox, + visual = def.visual, + visual_size = def.visual_size or {x = 1, y = 1}, + mesh = def.mesh, + makes_footstep_sound = def.makes_footstep_sound or false, + view_range = def.view_range or 5, + walk_velocity = def.walk_velocity or 1, + run_velocity = def.run_velocity or 2, + damage = max(0, (def.damage or 0) * difficulty), + light_damage = def.light_damage or 0, + water_damage = def.water_damage or 0, + lava_damage = def.lava_damage or 0, + suffocation = def.suffocation or 2, + fall_damage = def.fall_damage or 1, + fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10) + drops = def.drops or {}, + armor = def.armor or 100, + on_rightclick = def.on_rightclick, + arrow = def.arrow, + shoot_interval = def.shoot_interval, + sounds = def.sounds or {}, + animation = def.animation, + follow = def.follow, + jump = def.jump ~= false, + walk_chance = def.walk_chance or 50, + attacks_monsters = def.attacks_monsters or false, + group_attack = def.group_attack or false, + passive = def.passive or false, + knock_back = def.knock_back ~= false, + blood_amount = def.blood_amount or 5, + blood_texture = def.blood_texture or "mobs_blood.png", + shoot_offset = def.shoot_offset or 0, + floats = def.floats or 1, -- floats in water by default + replace_rate = def.replace_rate, + replace_what = def.replace_what, + replace_with = def.replace_with, + replace_offset = def.replace_offset or 0, + on_replace = def.on_replace, + timer = 0, + env_damage_timer = 0, -- only used when state = "attack" + tamed = false, + pause_timer = 0, + horny = false, + hornytimer = 0, + child = false, + gotten = false, + health = 0, + reach = def.reach or 3, + htimer = 0, + texture_list = def.textures, + child_texture = def.child_texture, + docile_by_day = def.docile_by_day or false, + time_of_day = 0.5, + fear_height = def.fear_height or 0, + runaway = def.runaway, + runaway_timer = 0, + pathfinding = def.pathfinding, + immune_to = def.immune_to or {}, + explosion_radius = def.explosion_radius, + explosion_damage_radius = def.explosion_damage_radius, + explosion_timer = def.explosion_timer or 3, + allow_fuse_reset = def.allow_fuse_reset ~= false, + stop_to_explode = def.stop_to_explode ~= false, + custom_attack = def.custom_attack, + double_melee_attack = def.double_melee_attack, + dogshoot_switch = def.dogshoot_switch, + dogshoot_count = 0, + dogshoot_count_max = def.dogshoot_count_max or 5, + dogshoot_count2_max = def.dogshoot_count2_max or (def.dogshoot_count_max or 5), + attack_animals = def.attack_animals or false, + specific_attack = def.specific_attack, + runaway_from = def.runaway_from, + owner_loyal = def.owner_loyal, + facing_fence = false, + _cmi_is_mob = true, + + on_spawn = def.on_spawn, + + on_blast = def.on_blast or do_tnt, + + on_step = mob_step, + + do_punch = def.do_punch, + + on_punch = mob_punch, + + on_breed = def.on_breed, + + on_grown = def.on_grown, + + on_activate = function(self, staticdata, dtime) + return mob_activate(self, staticdata, def, dtime) + end, + + get_staticdata = function(self) + return mob_staticdata(self) + end, + +}) + +end -- END mobs:register_mob function + + +-- count how many mobs of one type are inside an area +local count_mobs = function(pos, type) + + local num_type = 0 + local num_total = 0 + local objs = minetest.get_objects_inside_radius(pos, aoc_range) + + for n = 1, #objs do + + if not objs[n]:is_player() then + + local obj = objs[n]:get_luaentity() + + -- count mob type and add to total also + if obj and obj.name and obj.name == type then + + num_type = num_type + 1 + num_total = num_total + 1 + + -- add to total mobs + elseif obj and obj.name and obj.health ~= nil then + + num_total = num_total + 1 + end + end + end + + return num_type, num_total +end + + +-- global functions + +function mobs:spawn_abm_check(pos, node, name) + -- global function to add additional spawn checks + -- return true to stop spawning mob +end + + +local function player_near(pos, radius) + + local objs = minetest.get_objects_inside_radius(pos, radius) + + for n = 1, #objs do + + if objs[n]:is_player() then + return true + end + end + + return false +end + + +local function daycheck(day_toggle) + + if day_toggle ~= nil then + + local tod = (minetest.get_timeofday() or 0) * 24000 + + if tod > 4500 and tod < 19500 then + + if day_toggle == false then + return false -- mob requires night + end + else + if day_toggle == true then + return false -- mob requires day + end + end + end + + return true -- mob doesn't care +end + + +local function is_protected(pos) + + if not spawn_protected + and minetest.is_protected(pos, "") then + return true -- protected area + end + + return false -- mobs can spawn +end + + +local interval = 30 +local timer = 0 +local spawning_mobs = {} + +minetest.register_globalstep(function(dtime) + + if not mobs_spawn then + return + end + + timer = timer + dtime + if timer < interval then + return + end + timer = 0 + + for _,player in ipairs(minetest.get_connected_players()) do + + if player:get_hp() > 0 then + + local pos = player:getpos() + local area, pos2, light, obj, base + + for _,mob in ipairs(spawning_mobs) do + + area = nil + + if minetest.registered_entities[mob.name] + and random(1, mob.chance) == 1 then + + area = minetest.find_nodes_in_area_under_air( + {x = pos.x - 20, y = pos.y - 20, z = pos.z - 20}, + {x = pos.x + 20, y = pos.y + 20, z = pos.z + 20}, + mob.nodes) + end + + if area and #area > 0 then + + pos2 = area[math.random(1, #area)] + base = minetest.registered_entities[mob.name].collisionbox[5] + pos2.y = pos2.y + 1 + base + + light = minetest.get_node_light(pos2) or -1 + + if pos2.y >= mob.min_height + and pos2.y <= mob.max_height + and light >= mob.min_light + and light <= mob.max_light + and daycheck(mob.day_toggle) + and minetest.find_node_near(pos2, 1, mob.neighbors) + and count_mobs(pos2, mob.name) < mob.total + and not player_near(pos2, 10) + and not is_protected(pos2) then + +print ("--- Spawned ", mob.name, minetest.pos_to_string(pos2), mob.chance) + + obj = minetest.add_entity(pos2, mob.name) + + if mob.on_spawn then + mob.on_spawn(obj:get_luaentity(), pos2) + end + else +print ("--- Cannot spawn ", mob.name) + end + end + end + end + end +end) + + +function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, + interval, chance, aoc, min_height, max_height, day_toggle, on_spawn) + + -- chance/spawn number override in minetest.conf for registered mob + local numbers = minetest.settings:get(name) + + if numbers then + numbers = numbers:split(",") + chance = tonumber(numbers[1]) or chance + aoc = tonumber(numbers[2]) or aoc + + if chance == 0 then + minetest.log("warning", string.format("[mobs] %s has spawning disabled", name)) + return + end + + minetest.log("action", + string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc)) + end + + -- change old chance values to be more useable by new spawn routine + if chance > 999 then + chance = max(1, chance / 1000) + end + + -- adjust for mob chance multiplier + chance = max(1, chance * mob_chance_multiplier) + + -- add mob to table for spawning with routine above + table.insert(spawning_mobs, { + name = name, + nodes = nodes, + neighbors = neighbors, + chance = chance, + min_height = min_height, + max_height = max_height, + min_light = min_light, + max_light = max_light, + total = aoc, + day_toggle = day_toggle, + on_spawn = on_spawn, + }) +end + + +-- compatibility with older mob registration +function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) + + mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, + chance, active_object_count, -31000, max_height, day_toggle) +end + + +-- MarkBu's spawn function +function mobs:spawn(def) + + mobs:spawn_specific( + def.name, + def.nodes or {"group:soil", "group:stone"}, + def.neighbors or {"air"}, + def.min_light or 0, + def.max_light or 15, + def.interval or 30, + def.chance or 5000, + def.active_object_count or 1, + def.min_height or -31000, + def.max_height or 31000, + def.day_toggle, + def.on_spawn + ) +end + + +-- register arrow for shoot attack +function mobs:register_arrow(name, def) + + if not name or not def then return end -- errorcheck + + minetest.register_entity(name, { + + physical = false, + visual = def.visual, + visual_size = def.visual_size, + textures = def.textures, + velocity = def.velocity, + hit_player = def.hit_player, + hit_node = def.hit_node, + hit_mob = def.hit_mob, + drop = def.drop or false, -- drops arrow as registered item when true + collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows + timer = 0, + switch = 0, + owner_id = def.owner_id, + rotate = def.rotate, + automatic_face_movement_dir = def.rotate + and (def.rotate - (pi / 180)) or false, + + on_activate = def.on_activate, + + on_step = def.on_step or function(self, dtime) + + self.timer = self.timer + 1 + + local pos = self.object:get_pos() + + if self.switch == 0 + or self.timer > 150 + or not within_limits(pos, 0) then + + self.object:remove() ; -- print ("removed arrow") + + return + end + + -- does arrow have a tail (fireball) + if def.tail + and def.tail == 1 + and def.tail_texture then + + minetest.add_particle({ + pos = pos, + velocity = {x = 0, y = 0, z = 0}, + acceleration = {x = 0, y = 0, z = 0}, + expirationtime = def.expire or 0.25, + collisiondetection = false, + texture = def.tail_texture, + size = def.tail_size or 5, + glow = def.glow or 0, + }) + end + + if self.hit_node then + + local node = node_ok(pos).name + + if minetest.registered_nodes[node].walkable then + + self.hit_node(self, pos, node) + + if self.drop == true then + + pos.y = pos.y + 1 + + self.lastpos = (self.lastpos or pos) + + minetest.add_item(self.lastpos, self.object:get_luaentity().name) + end + + self.object:remove() ; -- print ("hit node") + + return + end + end + + if self.hit_player or self.hit_mob then + + for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do + + if self.hit_player + and player:is_player() then + + self.hit_player(self, player) + self.object:remove() ; -- print ("hit player") + return + end + + local entity = player:get_luaentity() + + if entity + and self.hit_mob + and entity._cmi_is_mob == true + and tostring(player) ~= self.owner_id + and entity.name ~= self.object:get_luaentity().name then + + self.hit_mob(self, player) + + self.object:remove() ; --print ("hit mob") + + return + end + end + end + + self.lastpos = pos + end + }) +end + + +-- compatibility function +function mobs:explosion(pos, radius) + local self = {sounds = {}} + self.sounds.explode = "tnt_explode" + mobs:boom(self, pos, radius) +end + + +-- no damage to nodes explosion +function mobs:safe_boom(self, pos, radius) + + minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", { + pos = pos, + gain = 1.0, + max_hear_distance = self.sounds and self.sounds.distance or 32 + }) + + entity_physics(pos, radius) + effect(pos, 32, "tnt_smoke.png", radius * 3, radius * 5, radius, 1, 0) +end + + +-- make explosion with protection and tnt mod check +function mobs:boom(self, pos, radius) + + if mobs_griefing + and minetest.get_modpath("tnt") and tnt and tnt.boom + and not minetest.is_protected(pos, "") then + + tnt.boom(pos, { + radius = radius, + damage_radius = radius, + sound = self.sounds and self.sounds.explode, + explode_center = true, + }) + else + mobs:safe_boom(self, pos, radius) + end +end + + +-- Register spawn eggs + +-- Note: This also introduces the “spawn_egg” group: +-- * spawn_egg=1: Spawn egg (generic mob, no metadata) +-- * spawn_egg=2: Spawn egg (captured/tamed mob, metadata) +function mobs:register_egg(mob, desc, background, addegg, no_creative) + + local grp = {spawn_egg = 1} + + -- do NOT add this egg to creative inventory (e.g. dungeon master) + if creative and no_creative == true then + grp.not_in_creative_inventory = 1 + end + + local invimg = background + + if addegg == 1 then + invimg = "mobs_chicken_egg.png^(" .. invimg .. + "^[mask:mobs_chicken_egg_overlay.png)" + end + + -- register new spawn egg containing mob information + minetest.register_craftitem(mob .. "_set", { + + description = S("@1 (Tamed)", desc), + inventory_image = invimg, + groups = {spawn_egg = 2, not_in_creative_inventory = 1}, + stack_max = 1, + + on_place = function(itemstack, placer, pointed_thing) + + local pos = pointed_thing.above + + -- am I clicking on something with existing on_rightclick function? + local under = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, under, placer, itemstack) + end + + if pos + and within_limits(pos, 0) + and not minetest.is_protected(pos, placer:get_player_name()) then + + if not minetest.registered_entities[mob] then + return + end + + pos.y = pos.y + 1 + + local data = itemstack:get_metadata() + local mob = minetest.add_entity(pos, mob, data) + local ent = mob:get_luaentity() + + -- set owner if not a monster + if ent.type ~= "monster" then + ent.owner = placer:get_player_name() + ent.tamed = true + end + + -- since mob is unique we remove egg once spawned + itemstack:take_item() + end + + return itemstack + end, + }) + + + -- register old stackable mob egg + minetest.register_craftitem(mob, { + + description = desc, + inventory_image = invimg, + groups = grp, + + on_place = function(itemstack, placer, pointed_thing) + + local pos = pointed_thing.above + + -- am I clicking on something with existing on_rightclick function? + local under = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[under.name] + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, under, placer, itemstack) + end + + if pos + and within_limits(pos, 0) + and not minetest.is_protected(pos, placer:get_player_name()) then + + if not minetest.registered_entities[mob] then + return + end + + pos.y = pos.y + 1 + + local mob = minetest.add_entity(pos, mob) + local ent = mob:get_luaentity() + + -- don't set owner if monster or sneak pressed + if ent.type ~= "monster" + and not placer:get_player_control().sneak then + ent.owner = placer:get_player_name() + ent.tamed = true + end + + -- if not in creative then take item + if not mobs.is_creative(placer:get_player_name()) then + itemstack:take_item() + end + end + + return itemstack + end, + }) + +end + + +-- capture critter (thanks to blert2112 for idea) +function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith) + + if self.child + or not clicker:is_player() + or not clicker:get_inventory() then + return false + end + + -- get name of clicked mob + local mobname = self.name + + -- if not nil change what will be added to inventory + if replacewith then + mobname = replacewith + end + + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + -- are we using hand, net or lasso to pick up mob? + if tool:get_name() ~= "" + and tool:get_name() ~= "mobs:net" + and tool:get_name() ~= "mobs:lasso" then + return false + end + + -- is mob tamed? + if self.tamed == false + and force_take == false then + + minetest.chat_send_player(name, S("Not tamed!")) + + return true -- false + end + + -- cannot pick up if not owner + if self.owner ~= name + and force_take == false then + + minetest.chat_send_player(name, S("@1 is owner!", self.owner)) + + return true -- false + end + + if clicker:get_inventory():room_for_item("main", mobname) then + + -- was mob clicked with hand, net, or lasso? + local chance = 0 + + if tool:get_name() == "" then + chance = chance_hand + + elseif tool:get_name() == "mobs:net" then + + chance = chance_net + + tool:add_wear(4000) -- 17 uses + + clicker:set_wielded_item(tool) + + elseif tool:get_name() == "mobs:lasso" then + + chance = chance_lasso + + tool:add_wear(650) -- 100 uses + + clicker:set_wielded_item(tool) + + end + + -- calculate chance.. add to inventory if successful? + if chance > 0 and random(1, 100) <= chance then + + -- default mob egg + local new_stack = ItemStack(mobname) + + -- add special mob egg with all mob information + -- unless 'replacewith' contains new item to use + if not replacewith then + + new_stack = ItemStack(mobname .. "_set") + + local tmp = {} + + for _,stat in pairs(self) do + local t = type(stat) + if t ~= "function" + and t ~= "nil" + and t ~= "userdata" then + tmp[_] = self[_] + end + end + + local data_str = minetest.serialize(tmp) + + new_stack:set_metadata(data_str) + end + + local inv = clicker:get_inventory() + + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(clicker:get_pos(), new_stack) + end + + self.object:remove() + + mob_sound(self, "default_place_node_hard") + + elseif chance ~= 0 then + minetest.chat_send_player(name, S("Missed!")) + + mob_sound(self, "mobs_swing") + end + end + + return true +end + + +-- protect tamed mob with rune item +function mobs:protect(self, clicker) + + local name = clicker:get_player_name() + local tool = clicker:get_wielded_item() + + if tool:get_name() ~= "mobs:protector" then + return false + end + + if self.tamed == false then + minetest.chat_send_player(name, S("Not tamed!")) + return true -- false + end + + if self.protected == true then + minetest.chat_send_player(name, S("Already protected!")) + return true -- false + end + + if not mobs.is_creative(clicker:get_player_name()) then + tool:take_item() -- take 1 protection rune + clicker:set_wielded_item(tool) + end + + self.protected = true + + local pos = self.object:get_pos() + pos.y = pos.y + self.collisionbox[2] + 0.5 + + effect(self.object:get_pos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15) + + mob_sound(self, "mobs_spell") + + return true +end + + +local mob_obj = {} +local mob_sta = {} + +-- feeding, taming and breeding (thanks blert2112) +function mobs:feed_tame(self, clicker, feed_count, breed, tame) + + if not self.follow then + return false + end + + -- can eat/tame with item in hand + if follow_holding(self, clicker) then + + -- if not in creative then take item + if not mobs.is_creative(clicker:get_player_name()) then + + local item = clicker:get_wielded_item() + + item:take_item() + + clicker:set_wielded_item(item) + end + + -- increase health + self.health = self.health + 4 + + if self.health >= self.hp_max then + + self.health = self.hp_max + + if self.htimer < 1 then + + minetest.chat_send_player(clicker:get_player_name(), + S("@1 at full health (@2)", + self.name:split(":")[2], tostring(self.health))) + + self.htimer = 5 + end + end + + self.object:set_hp(self.health) + + update_tag(self) + + -- make children grow quicker + if self.child == true then + + self.hornytimer = self.hornytimer + 20 + + return true + end + + -- feed and tame + self.food = (self.food or 0) + 1 + if self.food >= feed_count then + + self.food = 0 + + if breed and self.hornytimer == 0 then + self.horny = true + end + + self.gotten = false + + if tame then + + if self.tamed == false then + minetest.chat_send_player(clicker:get_player_name(), + S("@1 has been tamed!", + self.name:split(":")[2])) + end + + self.tamed = true + + if not self.owner or self.owner == "" then + self.owner = clicker:get_player_name() + end + end + + -- make sound when fed so many times + mob_sound(self, self.sounds.random) + end + + return true + end + + local item = clicker:get_wielded_item() + + -- if mob has been tamed you can name it with a nametag + if item:get_name() == "mobs:nametag" + and clicker:get_player_name() == self.owner then + + local name = clicker:get_player_name() + + -- store mob and nametag stack in external variables + mob_obj[name] = self + mob_sta[name] = item + + local tag = self.nametag or "" + + minetest.show_formspec(name, "mobs_nametag", "size[8,4]" + .. default.gui_bg + .. default.gui_bg_img + .. "field[0.5,1;7.5,0;name;" .. minetest.formspec_escape(S("Enter name:")) .. ";" .. tag .. "]" + .. "button_exit[2.5,3.5;3,1;mob_rename;" .. minetest.formspec_escape(S("Rename")) .. "]") + end + + return false +end + + +-- inspired by blockmen's nametag mod +minetest.register_on_player_receive_fields(function(player, formname, fields) + + -- right-clicked with nametag and name entered? + if formname == "mobs_nametag" + and fields.name + and fields.name ~= "" then + + local name = player:get_player_name() + + if not mob_obj[name] + or not mob_obj[name].object then + return + end + + -- make sure nametag is being used to name mob + local item = player:get_wielded_item() + + if item:get_name() ~= "mobs:nametag" then + return + end + + -- limit name entered to 64 characters long + if string.len(fields.name) > 64 then + fields.name = string.sub(fields.name, 1, 64) + end + + -- update nametag + mob_obj[name].nametag = fields.name + + update_tag(mob_obj[name]) + + -- if not in creative then take item + if not mobs.is_creative(name) then + + mob_sta[name]:take_item() + + player:set_wielded_item(mob_sta[name]) + end + + -- reset external variables + mob_obj[name] = nil + mob_sta[name] = nil + end +end) + + +-- compatibility function for old entities to new modpack entities +function mobs:alias_mob(old_name, new_name) + + -- spawn egg + minetest.register_alias(old_name, new_name) + + -- entity + minetest.register_entity(":" .. old_name, { + + physical = false, + + on_step = function(self) + + if minetest.registered_entities[new_name] then + minetest.add_entity(self.object:get_pos(), new_name) + end + + self.object:remove() + end + }) +end diff --git a/mods/mobs/api.txt b/mods/mobs/api.txt new file mode 100644 index 0000000..f6b8d48 --- /dev/null +++ b/mods/mobs/api.txt @@ -0,0 +1,743 @@ + +Mobs Redo API +============= + +Welcome to the world of mobs in minetest and hopefully an easy guide to defining +your own mobs and having them appear in your worlds. + + +Registering Mobs +---------------- + +To register a mob and have it ready for use requires the following function: + + mobs:register_mob(name, definition) + +The 'name' of a mob usually starts with the mod name it's running from followed +by it's own name e.g. + + "mobs_monster:sand_monster" or "mymod:totally_awesome_beast" + +... and the 'definition' is a table which holds all of the settings and +functions needed for the mob to work properly which contains the following: + + 'nametag' contains the name which is shown above mob. + 'type' holds the type of mob that inhabits your world e.g. + "animal" usually docile and walking around. + "monster" attacks player or npc on sight. + "npc" walk around and will defend themselves if hit first, they + kill monsters. + 'hp_min' has the minimum health value the mob can spawn with. + 'hp_max' has the maximum health value the mob can spawn with. + 'armor' holds strength of mob, 100 is normal, lower is more powerful + and needs more hits and better weapons to kill. + 'passive' when true allows animals to defend themselves when hit, + otherwise they amble onwards. + 'walk_velocity' is the speed that your mob can walk around. + 'run_velocity' is the speed your mob can run with, usually when attacking. + 'walk_chance' has a 0-100 chance value your mob will walk from standing, + set to 0 for jumping mobs only. + 'jump' when true allows your mob to jump updwards. + 'jump_height' holds the height your mob can jump, 0 to disable jumping. + 'stepheight' height of a block that your mob can easily walk up onto, + defaults to 1.1. + 'fly' when true allows your mob to fly around instead of walking. + 'fly_in' holds the node name that the mob flies (or swims) around + in e.g. "air" or "default:water_source". + 'runaway' if true causes animals to turn and run away when hit. + 'pushable' when true mobs can be pushed by player or other mobs. + 'view_range' how many nodes in distance the mob can see a player. + 'damage' how many health points the mob does to a player or another + mob when melee attacking. + 'knock_back' when true has mobs falling backwards when hit, the greater + the damage the more they move back. + 'fear_height' is how high a cliff or edge has to be before the mob stops + walking, 0 to turn off height fear. + 'fall_speed' has the maximum speed the mob can fall at, default is -10. + 'fall_damage' when true causes falling to inflict damage. + 'water_damage' holds the damage per second infliced to mobs when standing in + water. + 'lava_damage' holds the damage per second inflicted to mobs when standing + in lava or fire or an ignition source. + 'light_damage' holds the damage per second inflicted to mobs when light + level is between the min and max values below + 'light_damage_min' minimum light value when mob is affected (default: 14) + 'light_damage_max' maximum light value when mob is affected (default: 15) + 'suffocation' when true causes mobs to suffocate inside solid blocks. + 'floats' when set to 1 mob will float in water, 0 has them sink. + 'follow' mobs follow player when holding any of the items which appear + on this table, the same items can be fed to a mob to tame or + breed e.g. {"farming:wheat", "default:apple"} + + 'reach' is how far the mob can attack player when standing + nearby, default is 3 nodes. + 'docile_by_day' when true has mobs wandering around during daylight + hours and only attacking player at night or when + provoked. + 'attack_chance' 0 to 100 chance the mob will attack (default is 5). + 'attack_monsters' when true mob will attack monsters. + 'attack_animals' when true mob will attack animals. + 'attack_npcs' when true mob will attack npcs within range. + 'attack_players' when true mob will attack players nearby. + 'owner_loyal' when true non-docile tamed mobs attack anything player + punches when nearby. + 'group_attack' when true has same mob type grouping together to attack + offender. + 'attack_type' tells the api what a mob does when attacking the player + or another mob: + 'dogfight' is a melee attack when player is within mob reach. + 'shoot' has mob shoot pre-defined arrows at player when inside + view_range. + 'dogshoot' has melee attack when inside reach and shoot attack + when inside view_range. + 'explode' causes mob to stop and explode when inside reach. + 'explosion_radius' the radius of explosion node destruction, + defaults to 1 + 'explosion_damage_radius' the radius of explosion entity & player damage, + defaults to explosion_radius * 2 + 'explosion_timer' number of seconds before mob explodes while its target + is still inside reach or explosion_damage_radius, + defaults to 3. + 'allow_fuse_reset' Allow 'explode' attack_type to reset fuse and resume + chasing if target leaves the blast radius or line of + sight. Defaults to true. + 'stop_to_explode' When set to true (default), mob must stop and wait for + explosion_timer in order to explode. If false, mob will + continue chasing. + 'arrow' holds the pre-defined arrow object to shoot when + attacking. + 'dogshoot_switch' allows switching between attack types by using timers + (1 for shoot, 2 for dogfight) + 'dogshoot_count_max' contains how many seconds before switching from + dogfight to shoot. + 'dogshoot_count2_max' contains how many seconds before switching from shoot + to dogfight. + 'shoot_interval' has the number of seconds between shots. + 'shoot_offset' holds the y position added as to where the + arrow/fireball appears on mob. + 'specific_attack' has a table of entity names that mob can also attack + e.g. {"player", "mobs_animal:chicken"}. + 'runaway_from' contains a table with mob names to run away from, add + "player" to list to runaway from player also. + 'blood_amount' contains the number of blood droplets to appear when + mob is hit. + 'blood_texture' has the texture name to use for droplets e.g. + "mobs_blood.png", or table {"blood1.png", "blood2.png"} + 'pathfinding' set to 1 for mobs to use pathfinder feature to locate + player, set to 2 so they can build/break also (only + works with dogfight attack and when 'mobs_griefing' + in minetest.conf is not false). + 'immune_to' is a table that holds specific damage when being hit by + certain items e.g. + {"default:sword_wood", 0} -- causes no damage. + {"default:gold_lump", -10} -- heals by 10 health points. + {"default:coal_block", 20} -- 20 damage when hit on head with coal blocks. + {"all"} -- stops all weapons causing damage apart from those on list. + + 'makes_footstep_sound' when true you can hear mobs walking. + 'sounds' this is a table with sounds of the mob + 'distance' maximum distance sounds can be heard, default is 10. + 'random' random sound that plays during gameplay. + 'war_cry' what you hear when mob starts to attack player. + 'attack' what you hear when being attacked. + 'shoot_attack' sound played when mob shoots. + 'damage' sound heard when mob is hurt. + 'death' played when mob is killed. + 'jump' played when mob jumps. + 'fuse' sound played when mob explode timer starts. + 'explode' sound played when mob explodes. + + 'drops' table of items that are dropped when mob is killed, fields are: + 'name' name of item to drop. + 'chance' chance of drop, 1 for always, 2 for 1-in-2 chance etc. + 'min' minimum number of items dropped, set to 0 for rare drops. + 'max' maximum number of items dropped. + Note: If weapon has {fire=1} damage group set then cooked items will drop. + + 'visual' holds the look of the mob you wish to create: + 'cube' looks like a normal node + 'sprite' sprite which looks same from all angles. + 'upright_sprite' flat model standing upright. + 'wielditem' how it looks when player holds it in hand. + 'mesh' uses separate object file to define mob. + 'visual_size' has the size of the mob, defaults to {x = 1, y = 1} + 'collisionbox' has the box in which mob can be interacted with the + world e.g. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} + 'selectionbox' has the box in which player can interact with mob + 'textures' holds a table list of textures to be used for mob, or you + could use multiple lists inside another table for random + selection e.g. { {"texture1.png"}, {"texture2.png"} } + 'child_texture' holds the texture table for when baby mobs are used. + 'gotten_texture' holds the texture table for when self.gotten value is + true, used for milking cows or shearing sheep. + 'mesh' holds the name of the external object used for mob model + e.g. "mobs_cow.b3d" + 'gotten_mesh" holds the name of the external object used for when + self.gotten is true for mobs. + 'rotate' custom model rotation, 0 = front, 90 = side, 180 = back, + 270 = other side. + 'double_melee_attack' when true has the api choose between 'punch' and + 'punch2' animations. [DEPRECATED] + + 'animation' holds a table containing animation names and settings for use with mesh models: + 'stand_start' start frame for when mob stands still. + 'stand_end' end frame of stand animation. + 'stand_speed' speed of animation in frames per second. + 'walk_start' when mob is walking around. + 'walk_end' + 'walk_speed' + 'run_start' when a mob runs or attacks. + 'run_end' + 'run_speed' + 'fly_start' when a mob is flying. + 'fly_end' + 'fly_speed' + 'punch_start' when a mob melee attacks. + 'punch_end' + 'punch_speed' + 'punch2_start' alternative melee attack animation. + 'punch2_end' + 'punch2_speed' + 'shoot_start' shooting animation. + 'shoot_end' + 'shoot_speed' + 'die_start' death animation + 'die_end' + 'die_speed' + 'die_loop' when set to false stops the animation looping. + + Using '_loop = false' setting will stop any of the above animations from + looping. + + 'speed_normal' is used for animation speed for compatibility with some + older mobs. + + Note: Up to 5 different animations can be used per action e.g. + stand_start, stand_end, stand1_start, stand1_end .. up to stand4_start + + +Node Replacement +---------------- + +Mobs can look around for specific nodes as they walk and replace them to mimic +eating. + + 'replace_what' group of items to replace e.g. + {"farming:wheat_8", "farming:carrot_8"} + or you can use the specific options of what, with and + y offset by using this instead: + { + {"group:grass", "air", 0}, + {"default:dirt_with_grass", "default:dirt", -1} + } + 'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg" + 'replace_rate' how random should the replace rate be (typically 10) + 'replace_offset' +/- value to check specific node to replace + + 'on_replace(self, pos, oldnode, newnode)' is called when mob is about to + replace a node. + 'self' ObjectRef of mob + 'pos' Position of node to replace + 'oldnode' Current node + 'newnode' What the node will become after replacing + + If false is returned, the mob will not replace the node. + + By default, replacing sets self.gotten to true and resets the object + properties. + + +Custom Definition Functions +--------------------------- + +Along with the above mob registry settings we can also use custom functions to +enhance mob functionality and have them do many interesting things: + + 'on_die' a function that is called when the mob is killed the + parameters are (self, pos) + 'on_rightclick' its same as in minetest.register_entity() + 'on_blast' is called when an explosion happens near mob when using TNT + functions, parameters are (object, damage) and returns + (do_damage, do_knockback, drops) + 'on_spawn' is a custom function that runs on mob spawn with 'self' as + variable, return true at end of function to run only once. + 'after_activate' is a custom function that runs once mob has been activated + with these paramaters (self, staticdata, def, dtime) + 'on_breed' called when two similar mobs breed, paramaters are + (parent1, parent2) objects, return false to stop child from + being resized and owner/tamed flags and child textures being + applied. Function itself must spawn new child mob. + 'on_grown' is called when a child mob has grown up, only paramater is + (self). + 'do_punch' called when mob is punched with paramaters (self, hitter, + time_from_last_punch, tool_capabilities, direction), return + false to stop punch damage and knockback from taking place. + 'custom_attack' when set this function is called instead of the normal mob + melee attack, parameters are (self, to_attack). + 'on_die' a function that is called when mob is killed (self, pos) + 'do_custom' a custom function that is called every tick while mob is + active and which has access to all of the self.* variables + e.g. (self.health for health or self.standing_in for node + status), return with 'false' to skip remainder of mob API. + + +Internal Variables +------------------ + +The mob api also has some preset variables and functions that it will remember +for each mob. + + 'self.health' contains current health of mob (cannot exceed + self.hp_max) + 'self.texture_list' contains list of all mob textures + 'self.child_texture' contains mob child texture when growing up + 'self.base_texture' contains current skin texture which was randomly + selected from textures list + 'self.gotten' this is used for obtaining milk from cow and wool from + sheep + 'self.horny' when animal fed enough it is set to true and animal can + breed with same animal + 'self.hornytimer' background timer that controls breeding functions and + mob childhood timings + 'self.child' used for when breeding animals have child, will use + child_texture and be half size + 'self.owner' string used to set owner of npc mobs, typically used for + dogs + 'self.order' set to "follow" or "stand" so that npc will follow owner + or stand it's ground + 'self.nametag' contains the name of the mob which it can show above + + +Spawning Mobs in World +---------------------- + +mobs:register_spawn(name, nodes, max_light, min_light, chance, + active_object_count, max_height, day_toggle) + +mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval, + chance, active_object_count, min_height, max_height, day_toggle, on_spawn) + +These functions register a spawn algorithm for the mob. Without this function +the call the mobs won't spawn. + + 'name' is the name of the animal/monster + 'nodes' is a list of nodenames on that the animal/monster can + spawn on top of + 'neighbors' is a list of nodenames on that the animal/monster will + spawn beside (default is {"air"} for + mobs:register_spawn) + 'max_light' is the maximum of light + 'min_light' is the minimum of light + 'interval' is same as in register_abm() (default is 30 for + mobs:register_spawn) + 'chance' is same as in register_abm() + 'active_object_count' number of this type of mob to spawn at one time inside + map area + 'min_height' is the minimum height the mob can spawn + 'max_height' is the maximum height the mob can spawn + 'day_toggle' true for day spawning, false for night or nil for + anytime + 'on_spawn' is a custom function which runs after mob has spawned + and gives self and pos values. + +A simpler way to handle mob spawns has been added with the mobs:spawn(def) +command which uses above names to make settings clearer: + + mobs:spawn({name = "mobs_monster:tree_monster", + nodes = {"group:leaves"}, + max_light = 7, + }) + + +For each mob that spawns with this function is a field in mobs.spawning_mobs. +It tells if the mob should spawn or not. Default is true. So other mods can +only use the API of this mod by disabling the spawning of the default mobs in +this mod. + + +mobs:spawn_abm_check(pos, node, name) + +This global function can be changed to contain additional checks for mobs to +spawn e.g. mobs that spawn only in specific areas and the like. By returning +true the mob will not spawn. + + 'pos' holds the position of the spawning mob + 'node' contains the node the mob is spawning on top of + 'name' is the name of the animal/monster + + +Making Arrows +------------- + +mobs:register_arrow(name, definition) + +This function registers a arrow for mobs with the attack type shoot. + + 'name' is the name of the arrow + 'definition' is a table with the following values: + 'visual' same is in minetest.register_entity() + 'visual_size' same is in minetest.register_entity() + 'textures' same is in minetest.register_entity() + 'velocity' the velocity of the arrow + 'drop' if set to true any arrows hitting a node will drop as item + 'hit_player' a function that is called when the arrow hits a player; + this function should hurt the player, the parameters are + (self, player) + 'hit_mob' a function that is called when the arrow hits a mob; + this function should hurt the mob, the parameters are + (self, player) + 'hit_node' a function that is called when the arrow hits a node, the + parameters are (self, pos, node) + 'tail' when set to 1 adds a trail or tail to mob arrows + 'tail_texture' texture string used for above effect + 'tail_size' has size for above texture (defaults to between 5 and 10) + 'expire' contains float value for how long tail appears for + (defaults to 0.25) + 'glow' has value for how brightly tail glows 1 to 10 (default is + 0 for no glow) + 'rotate' integer value in degrees to rotate arrow + 'on_step' is a custom function when arrow is active, nil for + default. + 'on_punch' is a custom function when arrow is punched, nil by default + 'collisionbox' is hitbox table for arrow, {0,0,0,0,0,0} by default. + + +Spawn Eggs +---------- + +mobs:register_egg(name, description, background, addegg, no_creative) + +This function registers a spawn egg which can be used by admin to properly spawn in a mob. + + 'name' this is the name of your new mob to spawn e.g. "mob:sheep" + 'description' the name of the new egg you are creating e.g. "Spawn Sheep" + 'background' the texture displayed for the egg in inventory + 'addegg' would you like an egg image in front of your texture (1 = yes, + 0 = no) + 'no_creative' when set to true this stops spawn egg appearing in creative + mode for destructive mobs like Dungeon Masters. + + +Explosion Function +------------------ + +mobs:explosion(pos, radius) -- DEPRECATED!!! use mobs:boom() instead + +mobs:boom(self, pos, radius) + 'self' mob entity + 'pos' centre position of explosion + 'radius' radius of explosion (typically set to 3) + +This function generates an explosion which removes nodes in a specific radius +and damages any entity caught inside the blast radius. Protection will limit +node destruction but not entity damage. + + +Capturing Mobs +-------------- + +mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, + force_take, replacewith) + +This function is generally called inside the on_rightclick section of the mob +api code, it provides a chance of capturing the mob by hand, using the net or +lasso items, and can also have the player take the mob by force if tamed and +replace with another item entirely. + + 'self' mob information + 'clicker' player information + 'chance_hand' chance of capturing mob by hand (1 to 100) 0 to disable + 'chance_net' chance of capturing mob using net (1 to 100) 0 to disable + 'chance_lasso' chance of capturing mob using magic lasso (1 to 100) 0 to + disable + 'force_take' take mob by force, even if tamed (true or false) + 'replacewith' once captured replace mob with this item instead (overrides + new mob eggs with saved information) + + +Feeding and Taming/Breeding +--------------------------- + +mobs:feed_tame(self, clicker, feed_count, breed, tame) + +This function allows the mob to be fed the item inside self.follow be it apple, +wheat or whatever a set number of times and be tamed or bred as a result. +Will return true when mob is fed with item it likes. + + 'self' mob information + 'clicker' player information + 'feed_count' number of times mob must be fed to tame or breed + 'breed' true or false stating if mob can be bred and a child created + afterwards + 'tame' true or false stating if mob can be tamed so player can pick + them up + + +Protecting Mobs +--------------- + +mobs:protect(self, clicker) + +This function can be used to right-click any tamed mob with mobs:protector item, +this will protect the mob from harm inside of a protected area from other +players. Will return true when mob right-clicked with mobs:protector item. + + 'self' mob information + 'clicker' player information + + +Riding Mobs +----------- + +Mobs can now be ridden by players and the following shows its functions and +usage: + + +mobs:attach(self, player) + +This function attaches a player to the mob so it can be ridden. + + 'self' mob information + 'player' player information + + +mobs:detach(player, offset) + +This function will detach the player currently riding a mob to an offset +position. + + 'player' player information + 'offset' position table containing offset values + + +mobs:drive(self, move_animation, stand_animation, can_fly, dtime) + +This function allows an attached player to move the mob around and animate it at +same time. + + 'self' mob information + 'move_animation' string containing movement animation e.g. "walk" + 'stand_animation' string containing standing animation e.g. "stand" + 'can_fly' if true then jump and sneak controls will allow mob to fly + up and down + 'dtime' tick time used inside drive function + + +mobs:fly(self, dtime, speed, can_shoot, arrow_entity, move_animation, stand_animation) + +This function allows an attached player to fly the mob around using directional +controls. + + 'self' mob information + 'dtime' tick time used inside fly function + 'speed' speed of flight + 'can_shoot' true if mob can fire arrow (sneak and left mouse button + fires) + 'arrow_entity' name of arrow entity used for firing + 'move_animation' string containing name of pre-defined animation e.g. "walk" + or "fly" etc. + 'stand_animation' string containing name of pre-defined animation e.g. + "stand" or "blink" etc. + +Note: animation names above are from the pre-defined animation lists inside mob +registry without extensions. + + +mobs:set_animation(self, name) + +This function sets the current animation for mob, defaulting to "stand" if not +found. + + 'self' mob information + 'name' name of animation + + +Certain variables need to be set before using the above functions: + + 'self.v2' toggle switch used to define below values for the + first time + 'self.max_speed_forward' max speed mob can move forward + 'self.max_speed_reverse' max speed mob can move backwards + 'self.accel' acceleration speed + 'self.terrain_type' integer containing terrain mob can walk on + (1 = water, 2 or 3 = land) + 'self.driver_attach_at' position offset for attaching player to mob + 'self.driver_eye_offset' position offset for attached player view + 'self.driver_scale' sets driver scale for mobs larger than {x=1, y=1} + + +mobs:line_of_sight(self, pos1, pos2, stepsize) + +This function is for use within the mobs definition for special use cases and +returns true if a mob can see the player or victim. + +...'self' mob information + 'pos1' position of mob + 'pos2' position of vistim or player + 'stepsize' usually set to 1 + + +External Settings for "minetest.conf" +------------------------------------ + + 'enable_damage' if true monsters will attack players (default is true) + 'only_peaceful_mobs' if true only animals will spawn in game (default is + false) + 'mobs_disable_blood' if false blood effects appear when mob is hit (default + is false) + 'mobs_spawn_protected' if set to false then mobs will not spawn in protected + areas (default is true) + 'remove_far_mobs' if true then untamed mobs that are outside players + visual range will be removed (default is true) + 'mobname' can change specific mob chance rate (0 to disable) and + spawn number e.g. mobs_animal:cow = 1000,5 + 'mob_difficulty' sets difficulty level (health and hit damage + multiplied by this number), defaults to 1.0. + 'mob_show_health' if false then punching mob will not show health status + (true by default) + 'mob_chance_multiplier' multiplies chance of all mobs spawning and can be set + to 0.5 to have mobs spawn more or 2.0 to spawn less. + e.g. 1 in 7000 * 0.5 = 1 in 3500 so better odds of + spawning. + 'mobs_spawn' if false then mobs no longer spawn without spawner or + spawn egg. + 'mobs_drop_items' when false mobs no longer drop items when they die. + 'mobs_griefing' when false mobs cannot break blocks when using either + pathfinding level 2, replace functions or mobs:boom + function. + +Players can override the spawn chance for each mob registered by adding a line +to their minetest.conf file with a new value, the lower the value the more each +mob will spawn e.g. + +mobs_animal:sheep_chance 11000 +mobs_monster:sand_monster_chance 100 + + +Rideable Horse Example Mob +-------------------------- + +mobs:register_mob("mob_horse:horse", { + type = "animal", + visual = "mesh", + visual_size = {x = 1.20, y = 1.20}, + mesh = "mobs_horse.x", + collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4}, + animation = { + speed_normal = 15, + speed_run = 30, + stand_start = 25, + stand_end = 75, + walk_start = 75, + walk_end = 100, + run_start = 75, + run_end = 100, + }, + textures = { + {"mobs_horse.png"}, + {"mobs_horsepeg.png"}, + {"mobs_horseara.png"} + }, + fear_height = 3, + runaway = true, + fly = false, + walk_chance = 60, + view_range = 5, + follow = {"farming:wheat"}, + passive = true, + hp_min = 12, + hp_max = 16, + armor = 200, + lava_damage = 5, + fall_damage = 5, + water_damage = 1, + makes_footstep_sound = true, + drops = { + {name = "mobs:meat_raw", chance = 1, min = 2, max = 3} + }, + sounds = { + random = "horse_neigh.ogg", + damage = "horse_whinney.ogg", + }, + + do_custom = function(self, dtime) + + -- set needed values if not already present + if not self.v2 then + self.v2 = 0 + self.max_speed_forward = 6 + self.max_speed_reverse = 2 + self.accel = 6 + self.terrain_type = 3 + self.driver_attach_at = {x = 0, y = 20, z = -2} + self.driver_eye_offset = {x = 0, y = 3, z = 0} + self.driver_scale = {x = 1, y = 1} + end + + -- if driver present allow control of horse + if self.driver then + + mobs.drive(self, "walk", "stand", false, dtime) + + return false -- skip rest of mob functions + end + + return true + end, + + on_die = function(self, pos) + + -- drop saddle when horse is killed while riding + -- also detach from horse properly + if self.driver then + minetest.add_item(pos, "mobs:saddle") + mobs.detach(self.driver, {x = 1, y = 0, z = 1}) + end + + end, + + on_rightclick = function(self, clicker) + + -- make sure player is clicking + if not clicker or not clicker:is_player() then + return + end + + -- feed, tame or heal horse + if mobs:feed_tame(self, clicker, 10, true, true) then + return + end + + -- make sure tamed horse is being clicked by owner only + if self.tamed and self.owner == clicker:get_player_name() then + + local inv = clicker:get_inventory() + + -- detatch player already riding horse + if self.driver and clicker == self.driver then + + mobs.detach(clicker, {x = 1, y = 0, z = 1}) + + -- add saddle back to inventory + if inv:room_for_item("main", "mobs:saddle") then + inv:add_item("main", "mobs:saddle") + else + minetest.add_item(clicker.getpos(), "mobs:saddle") + end + + -- attach player to horse + elseif not self.driver + and clicker:get_wielded_item():get_name() == "mobs:saddle" then + + self.object:set_properties({stepheight = 1.1}) + mobs.attach(self, clicker) + + -- take saddle from inventory + inv:remove_item("main", "mobs:saddle") + end + end + + -- used to capture horse with magic lasso + mobs:capture_mob(self, clicker, 0, 0, 80, false, nil) + end +}) diff --git a/mods/mobs/crafts.lua b/mods/mobs/crafts.lua new file mode 100644 index 0000000..a47d645 --- /dev/null +++ b/mods/mobs/crafts.lua @@ -0,0 +1,32 @@ + +local S = mobs.intllib + +-- leather +minetest.register_craftitem("mobs:leather", { + description = S("Leather"), + inventory_image = "mobs_leather.png", + groups = {flammable = 2}, +}) + +-- raw meat +minetest.register_craftitem("mobs:meat_raw", { + description = S("Raw Meat"), + inventory_image = "mobs_meat_raw.png", + on_use = minetest.item_eat(3), + groups = {food_meat_raw = 1, flammable = 2}, +}) + +-- cooked meat +minetest.register_craftitem("mobs:meat", { + description = S("Meat"), + inventory_image = "mobs_meat.png", + on_use = minetest.item_eat(8), + groups = {food_meat = 1, flammable = 2}, +}) + +minetest.register_craft({ + type = "cooking", + output = "mobs:meat", + recipe = "mobs:meat_raw", + cooktime = 5, +}) diff --git a/mods/mobs/depends.txt b/mods/mobs/depends.txt new file mode 100644 index 0000000..057a4c2 --- /dev/null +++ b/mods/mobs/depends.txt @@ -0,0 +1,9 @@ +main +tnt? +dye? +farming? +invisibility? +intllib? +lucky_block? +cmi? +toolranks? diff --git a/mods/mobs/description.txt b/mods/mobs/description.txt new file mode 100644 index 0000000..919852a --- /dev/null +++ b/mods/mobs/description.txt @@ -0,0 +1 @@ +Adds a mob api for mods to add animals or monsters etc. \ No newline at end of file diff --git a/mods/mobs/init.lua b/mods/mobs/init.lua new file mode 100644 index 0000000..f63fb16 --- /dev/null +++ b/mods/mobs/init.lua @@ -0,0 +1,19 @@ + +local path = minetest.get_modpath("mobs") + +-- Mob API +dofile(path .. "/api.lua") + +-- Rideable Mobs +dofile(path .. "/mount.lua") + +-- Mob Items +dofile(path .. "/crafts.lua") + +-- Mob Spawner +dofile(path .. "/spawner.lua") + +-- Lucky Blocks +dofile(path .. "/lucky_block.lua") + +minetest.log("action", "[MOD] Mobs Redo loaded") diff --git a/mods/mobs/intllib.lua b/mods/mobs/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/mods/mobs/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/mods/mobs/license.txt b/mods/mobs/license.txt new file mode 100644 index 0000000..fec6f6a --- /dev/null +++ b/mods/mobs/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 TenPlus1 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/mods/mobs/locale/de_DE.po b/mods/mobs/locale/de_DE.po new file mode 100644 index 0000000..210990d --- /dev/null +++ b/mods/mobs/locale/de_DE.po @@ -0,0 +1,131 @@ +# Mobs Redo translation. +# Copyright (C) 2017 TenPlus1 +# This file is distributed under the same license as the mobs package. +# Wuzzy , 2017 +# +msgid "" +msgstr "" +"Project-Id-Version: mobs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-02 16:48+0200\n" +"PO-Revision-Date: 2017-07-02 14:27+0200\n" +"Last-Translator: Wuzzy \n" +"Language-Team: \n" +"Language: de_DE\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "Kreatur wurde geschützt!" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (Gezähmt)" + +#: api.lua +msgid "Not tamed!" +msgstr "Nicht gezähmt!" + +#: api.lua +msgid "@1 is owner!" +msgstr "@1 ist der Besitzer!" + +#: api.lua +msgid "Missed!" +msgstr "Daneben!" + +#: api.lua +msgid "Already protected!" +msgstr "Bereits geschützt!" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 bei voller Gesundheit (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 wurde gezähmt!" + +#: api.lua +msgid "Enter name:" +msgstr "Namen eingeben:" + +#: api.lua +msgid "Rename" +msgstr "Umbenennen" + +#: crafts.lua +msgid "Name Tag" +msgstr "Namensschild" + +#: crafts.lua +msgid "Leather" +msgstr "Leder" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Rohes Fleisch" + +#: crafts.lua +msgid "Meat" +msgstr "Fleisch" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Lasso (Rechtsklick auf Tier, um es zu nehmen)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Netz (Rechtsklick auf Tier, um es zu nehmen)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Stahlschere (Rechtsklick zum Scheren)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Kreaturschutzrune" + +#: crafts.lua +msgid "Saddle" +msgstr "Sattel" + +#: crafts.lua +msgid "Mob Fence" +msgstr "Kreaturen Zaun" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Kreaturenspawner" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Kreatur MinLicht MaxLicht Menge SpielerEntfng" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Nicht aktiv (Einstellungen eingeben)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Spawner aktiv (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Kreaturenspawner-Einstellungen gescheitert!" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" +"Syntax: „name min_licht[0-14] max_licht[0-14] max_mobs_im_gebiet[0 zum " +"Deaktivieren] distanz[1-20] y_versatz[-10 bis 10]“" diff --git a/mods/mobs/locale/es.po b/mods/mobs/locale/es.po new file mode 100644 index 0000000..849db66 --- /dev/null +++ b/mods/mobs/locale/es.po @@ -0,0 +1,128 @@ +# Mobs Redo translation. +# Copyright (C) 2017 TenPlus1 +# This file is distributed under the same license as the mobs package. +# Wuzzy , 2017 +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-16 16:48+0200\n" +"PO-Revision-Date: 2017-07-16 16:48+0200\n" +"Last-Translator: Aleks \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "El mob ha sido protegido!" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (Domesticado)" + +#: api.lua +msgid "Not tamed!" +msgstr "No domesticado!" + +#: api.lua +msgid "@1 is owner!" +msgstr "@1 es el dueño!" + +#: api.lua +msgid "Missed!" +msgstr "Perdido!" + +#: api.lua +msgid "Already protected!" +msgstr "Ya está protegido!" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 con salud llena (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 ha sido domesticado!" + +#: api.lua +msgid "Enter name:" +msgstr "Ingrese nombre:" + +#: api.lua +msgid "Rename" +msgstr "Renombrar" + +#: crafts.lua +msgid "Name Tag" +msgstr "Nombrar etiqueta" + +#: crafts.lua +msgid "Leather" +msgstr "Cuero" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Carne cruda" + +#: crafts.lua +msgid "Meat" +msgstr "Carne" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Lazo (click derecho en animal para colocar en inventario)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Red (click derecho en animal para colocar en inventario)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Tijera de acero (click derecho para esquilar)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Runa de protección de Mob" + +#: crafts.lua +msgid "Saddle" +msgstr "Montura" + +#: crafts.lua +msgid "Mob Fence" +msgstr "" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Generador de Mob" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob LuzMin LuzMax Cantidad DistJugador" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Generador no activo (ingrese config)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Generador activo (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Configuracion de generador de Mob falló!" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "Sintaxis: “nombre luz_min[0-14] luz_max[0-14] max_mobs_en_area[0 para deshabilitar] " +"distancia[1-20] compensacion[-10 a 10]”" diff --git a/mods/mobs/locale/fr.po b/mods/mobs/locale/fr.po new file mode 100644 index 0000000..25b920c --- /dev/null +++ b/mods/mobs/locale/fr.po @@ -0,0 +1,129 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-29 09:13+0200\n" +"PO-Revision-Date: 2017-07-29 09:20+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.12\n" +"Last-Translator: fat115 \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Language: fr\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "** Mode pacifique activé - Aucun monstre ne sera généré" + +#: api.lua +msgid "Mob has been protected!" +msgstr "L'animal a été protégé !" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (apprivoisé)" + +#: api.lua +msgid "Not tamed!" +msgstr "Non-apprivoisé !" + +#: api.lua +msgid "@1 is owner!" +msgstr "Appartient à @1 !" + +#: api.lua +msgid "Missed!" +msgstr "Raté !" + +#: api.lua +msgid "Already protected!" +msgstr "Déjà protégé !" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 est en pleine forme (@2) " + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 a été apprivoisé ! " + +#: api.lua +msgid "Enter name:" +msgstr "Saisissez un nom :" + +#: api.lua +msgid "Rename" +msgstr "Renommer" + +#: crafts.lua +msgid "Name Tag" +msgstr "Étiquette pour collier" + +#: crafts.lua +msgid "Leather" +msgstr "Cuir" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Viande crue" + +#: crafts.lua +msgid "Meat" +msgstr "Viande" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Lasso (clic droit sur l'animal pour le mettre dans l'inventaire)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Filet (clic droit sur l'animal pour le mettre dans l'inventaire)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Ciseaux à laine (clic droit pour tondre)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Rune de protection des animaux" + +#: crafts.lua +msgid "Saddle" +msgstr "Selle" + +#: crafts.lua +msgid "Mob Fence" +msgstr "Clôture à animaux" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Générateur de mob" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob MinLumière MaxLumière Quantité DistanceJoueur" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Générateur non actif (entrez les paramètres)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Générateur actif (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Echec des paramètres du générateur" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "Syntaxe : “nom min_lumière[0-14] max_lumière[0-14] max_mobs_dans_zone[0 pour désactiver] distance[1-20] décalage_y[-10 à 10]“" diff --git a/mods/mobs/locale/it.po b/mods/mobs/locale/it.po new file mode 100644 index 0000000..a439f6d --- /dev/null +++ b/mods/mobs/locale/it.po @@ -0,0 +1,131 @@ +# ITALIAN LOCALE FILE FOR THE MOBS REDO MODULE +# Copyright (c) 2014 Krupnov Pavel and 2016 TenPlus1 +# This file is distributed under the same license as the MOBS REDO package. +# Hamlet , 2017. +# +msgid "" +msgstr "" +"Project-Id-Version: Italian locale file for the Mobs Redo module\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-02 16:48+0200\n" +"PO-Revision-Date: 2017-08-18 12:18+0100\n" +"Last-Translator: H4mlet \n" +"Language-Team: \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.6.10\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "Il mob è stato protetto!" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (Addomesticat*)" + +#: api.lua +msgid "Not tamed!" +msgstr "Non addomesticat*!" + +#: api.lua +msgid "@1 is owner!" +msgstr "Proprietari* @1!" + +#: api.lua +msgid "Missed!" +msgstr "Mancat*!" + +#: api.lua +msgid "Already protected!" +msgstr "Già protett*!" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 in piena salute (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 è stat* addomesticat*!" + +#: api.lua +msgid "Enter name:" +msgstr "Inserire il nome:" + +#: api.lua +msgid "Rename" +msgstr "Rinominare" + +#: crafts.lua +msgid "Name Tag" +msgstr "Targhetta" + +#: crafts.lua +msgid "Leather" +msgstr "Pelle" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Carne cruda" + +#: crafts.lua +msgid "Meat" +msgstr "Carne" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Lazo (click di destro per mettere l'animale nell'inventario)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Rete (click destro per mettere l'animale nell'inventario)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Cesoie d'acciaio (click destro per tosare)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Runa di protezione per mob" + +#: crafts.lua +msgid "Saddle" +msgstr "Sella" + +#: crafts.lua +msgid "Mob Fence" +msgstr "" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Generatore di mob" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob LuceMin LuceMax Ammontare DistGiocat." + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Generatore inattivo (inserire le impostazioni)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Generatore attivo (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Impostazioni del generatore di mob fallite!" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" +"Sintassi: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 per " +"disabilitare] distance[1-20] y_offset[-10 to 10]”" diff --git a/mods/mobs/locale/ms.po b/mods/mobs/locale/ms.po new file mode 100644 index 0000000..a2a31f3 --- /dev/null +++ b/mods/mobs/locale/ms.po @@ -0,0 +1,131 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-05 23:40+0800\n" +"PO-Revision-Date: 2018-02-05 23:51+0800\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.6\n" +"Last-Translator: MuhdNurHidayat (MNH48) \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: ms\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "** Mod Aman Diaktifkan - Tiada Raksasa Akan Muncul" + +#: api.lua +msgid "Mob has been protected!" +msgstr "Mob telah pun dilindungi!" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (Jinak)" + +#: api.lua +msgid "Not tamed!" +msgstr "Belum dijinakkan!" + +#: api.lua +msgid "@1 is owner!" +msgstr "Ini hak milik @1!" + +#: api.lua +msgid "Missed!" +msgstr "Terlepas!" + +#: api.lua +msgid "Already protected!" +msgstr "Telah dilindungi!" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "Mata kesihatan @1 telah penuh (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 telah dijinakkan!" + +#: api.lua +msgid "Enter name:" +msgstr "Masukkan nama:" + +#: api.lua +msgid "Rename" +msgstr "Namakan semula" + +#: crafts.lua +msgid "Name Tag" +msgstr "Tanda Nama" + +#: crafts.lua +msgid "Leather" +msgstr "Kulit" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Daging Mentah" + +#: crafts.lua +msgid "Meat" +msgstr "Daging Bakar" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Tanjul (klik-kanan haiwan untuk masukkan ke inventori)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Jaring (klik-kanan haiwan untuk masukkan ke inventori)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Ketam Keluli (klik-kanan untuk mengetam bulu biri-biri)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Rune Perlindungan Mob" + +#: crafts.lua +msgid "Saddle" +msgstr "Pelana" + +#: crafts.lua +msgid "Mob Fence" +msgstr "Pagar Mob" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Pewujud Mob" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob CahayaMin CahayaMax Amaun JarakPemain" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Pewujud Mob Tidak Aktif (masukkan tetapan)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Pewujud Mob Aktif (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Penetapan Pewujud Mob gagal!" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" +"Sintaks: \"nama cahaya_minimum[0-14] cahaya_maksimum[0-14] " +"amaun_mob_maksimum[0 untuk lumpuhkan] jarak[1-20] ketinggian[-10 hingga 10]\"" diff --git a/mods/mobs/locale/pt.po b/mods/mobs/locale/pt.po new file mode 100644 index 0000000..b52afd6 --- /dev/null +++ b/mods/mobs/locale/pt.po @@ -0,0 +1,133 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: mobs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-02 16:48+0200\n" +"PO-Revision-Date: 2017-07-02 14:55+0200\n" +"Last-Translator: Wuzzy \n" +"Language-Team: \n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "" + +#: api.lua +msgid "Not tamed!" +msgstr "Indomesticado!" + +#: api.lua +msgid "@1 is owner!" +msgstr "Dono @1!" + +#: api.lua +msgid "Missed!" +msgstr "Faltou!" + +#: api.lua +msgid "Already protected!" +msgstr "" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 em plena saude (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 foi domesticado!" + +#: api.lua +msgid "Enter name:" +msgstr "Insira um nome:" + +#: api.lua +msgid "Rename" +msgstr "Renomear" + +#: crafts.lua +msgid "Name Tag" +msgstr "Etiqueta" + +#: crafts.lua +msgid "Leather" +msgstr "Couro" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Carne crua" + +#: crafts.lua +msgid "Meat" +msgstr "Carne" + +#: crafts.lua +#, fuzzy +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Laço (clique-direito no animal para por no inventario)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Net (clique-direito no animal para por no inventario)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Tesoura de Aço (clique-direito para tosquiar)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "" + +#: crafts.lua +msgid "Saddle" +msgstr "" + +#: crafts.lua +msgid "Mob Fence" +msgstr "" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Spawnador de Mob" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob LuzMinima LuzMaxima Valor DistJogador" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Spawnador Inativo (configurar)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Spawnador Ativo (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Configuraçao de Spawnador do Mob falhou!" + +#: spawner.lua +#, fuzzy +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" +"> nome luz_min[0-14] luz_max[0-14] max_mobs_na_area[0 para desabilitar] " +"distancia[1-20] y_offset[-10 a 10]" diff --git a/mods/mobs/locale/ru.po b/mods/mobs/locale/ru.po new file mode 100644 index 0000000..6cde7ef --- /dev/null +++ b/mods/mobs/locale/ru.po @@ -0,0 +1,129 @@ +# Russian translation for the mobs_redo mod. +# Copyright (C) 2018 TenPlus1 +# This file is distributed under the same license as the mobs_redo package. +# Oleg720 , 2017. +# CodeXP , 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-13 15:47+0200\n" +"PO-Revision-Date: 2018-03-23 22:22+0100\n" +"Last-Translator: CodeXP \n" +"Language-Team: \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "** Мирный модус активирован - монстры не спаунятся" + +#: api.lua +msgid "Mob has been protected!" +msgstr "Моб защищен!" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "@1 (Прирученный)" + +#: api.lua +msgid "Not tamed!" +msgstr "Не прирученный" + +#: api.lua +msgid "@1 is owner!" +msgstr "@1 владелец" + +#: api.lua +msgid "Missed!" +msgstr "Промазал!" + +#: api.lua +msgid "Already protected!" +msgstr "Уже защищен!" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 при полном здоровье (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 приручен" + +#: api.lua +msgid "Enter name:" +msgstr "Введите имя:" + +#: api.lua +msgid "Rename" +msgstr "Переименовать" + +#: crafts.lua +msgid "Name Tag" +msgstr "Новый тэг" + +#: crafts.lua +msgid "Leather" +msgstr "Кожа" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Сырое мясо" + +#: crafts.lua +msgid "Meat" +msgstr "Мясо" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Лассо (Правый клик - положить животное в инвентарь)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Сеть (Правый клик - положить животное в инвентарь)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Ножницы (Правый клик - подстричь)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "Защитная руна мобов" + +#: crafts.lua +msgid "Saddle" +msgstr "Седло" + +#: crafts.lua +msgid "Mob Fence" +msgstr "Забор от мобов" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Спаунер моба" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Спаунер не активен (введите настройки)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Активные спаунер (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Настройки спаунера моба провалились" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" diff --git a/mods/mobs/locale/template.pot b/mods/mobs/locale/template.pot new file mode 100644 index 0000000..af31440 --- /dev/null +++ b/mods/mobs/locale/template.pot @@ -0,0 +1,128 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-02 16:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "" + +#: api.lua +msgid "Not tamed!" +msgstr "" + +#: api.lua +msgid "@1 is owner!" +msgstr "" + +#: api.lua +msgid "Missed!" +msgstr "" + +#: api.lua +msgid "Already protected!" +msgstr "" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "" + +#: api.lua +msgid "Enter name:" +msgstr "" + +#: api.lua +msgid "Rename" +msgstr "" + +#: crafts.lua +msgid "Name Tag" +msgstr "" + +#: crafts.lua +msgid "Leather" +msgstr "" + +#: crafts.lua +msgid "Raw Meat" +msgstr "" + +#: crafts.lua +msgid "Meat" +msgstr "" + +#: crafts.lua +msgid "Lasso (right-click animal to put in inventory)" +msgstr "" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "" + +#: crafts.lua +msgid "Saddle" +msgstr "" + +#: crafts.lua +msgid "Mob Fence" +msgstr "" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "" + +#: spawner.lua +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" diff --git a/mods/mobs/locale/tr.po b/mods/mobs/locale/tr.po new file mode 100644 index 0000000..10688e2 --- /dev/null +++ b/mods/mobs/locale/tr.po @@ -0,0 +1,133 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: mobs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-02 16:48+0200\n" +"PO-Revision-Date: 2017-07-02 14:56+0200\n" +"Last-Translator: Wuzzy \n" +"Language-Team: \n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: api.lua +msgid "** Peaceful Mode Active - No Monsters Will Spawn" +msgstr "" + +#: api.lua +msgid "Mob has been protected!" +msgstr "" + +#: api.lua +msgid "@1 (Tamed)" +msgstr "" + +#: api.lua +msgid "Not tamed!" +msgstr "Evcil değil!" + +#: api.lua +msgid "@1 is owner!" +msgstr "Sahibi @1!" + +#: api.lua +msgid "Missed!" +msgstr "Kaçırdın!" + +#: api.lua +msgid "Already protected!" +msgstr "" + +#: api.lua +msgid "@1 at full health (@2)" +msgstr "@1 tam canında (@2)" + +#: api.lua +msgid "@1 has been tamed!" +msgstr "@1 tamamen evcilleştirilmiştir!" + +#: api.lua +msgid "Enter name:" +msgstr "İsim gir:" + +#: api.lua +msgid "Rename" +msgstr "Yeniden adlandır" + +#: crafts.lua +msgid "Name Tag" +msgstr "İsim etiketi" + +#: crafts.lua +msgid "Leather" +msgstr "Deri" + +#: crafts.lua +msgid "Raw Meat" +msgstr "Çiğ et" + +#: crafts.lua +msgid "Meat" +msgstr "Et" + +#: crafts.lua +#, fuzzy +msgid "Lasso (right-click animal to put in inventory)" +msgstr "Kement (hayvana sağ tıklayarak envantere koy)" + +#: crafts.lua +msgid "Net (right-click animal to put in inventory)" +msgstr "Ağ (hayvana sağ tıklayarak envantere koy)" + +#: crafts.lua +msgid "Steel Shears (right-click to shear)" +msgstr "Çelik makas (sağ tıklayarak kes)" + +#: crafts.lua +msgid "Mob Protection Rune" +msgstr "" + +#: crafts.lua +msgid "Saddle" +msgstr "" + +#: crafts.lua +msgid "Mob Fence" +msgstr "Canavar Yaratıcı" + +#: spawner.lua +msgid "Mob Spawner" +msgstr "Canavar Yaratıcı" + +#: spawner.lua +msgid "Mob MinLight MaxLight Amount PlayerDist" +msgstr "Mob MinIşık MaxIşık Miktar OyuncuMesafesi" + +#: spawner.lua +msgid "Spawner Not Active (enter settings)" +msgstr "Yaratıcı aktif değil (ayarlara gir)" + +#: spawner.lua +msgid "Spawner Active (@1)" +msgstr "Yaratıcı aktif (@1)" + +#: spawner.lua +msgid "Mob Spawner settings failed!" +msgstr "Yaratıcı ayarları uygulanamadı." + +#: spawner.lua +#, fuzzy +msgid "" +"Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] " +"distance[1-20] y_offset[-10 to 10]”" +msgstr "" +"> isim min_isik[0-14] max_isik[0-14] alandaki_max_canavar_sayisi[kapatmak " +"icin 0] mesafe[1-20] y_cikinti[-10 ve 10 arası]" diff --git a/mods/mobs/lucky_block.lua b/mods/mobs/lucky_block.lua new file mode 100644 index 0000000..ef7d59c --- /dev/null +++ b/mods/mobs/lucky_block.lua @@ -0,0 +1,18 @@ + +if minetest.get_modpath("lucky_block") then + + lucky_block:add_blocks({ + {"dro", {"mobs:meat_raw"}, 5}, + {"dro", {"mobs:meat"}, 5}, + {"dro", {"mobs:nametag"}, 1}, + {"dro", {"mobs:leather"}, 5}, + {"dro", {"default:stick"}, 10}, + {"dro", {"mobs:net"}, 1}, + {"dro", {"mobs:lasso"}, 1}, + {"dro", {"mobs:shears"}, 1}, + {"dro", {"mobs:protector"}, 1}, + {"dro", {"mobs:fence_wood"}, 10}, + {"dro", {"mobs:fence_top"}, 12}, + {"lig"}, + }) +end diff --git a/mods/mobs/mod.conf b/mods/mobs/mod.conf new file mode 100644 index 0000000..f3a3ad7 --- /dev/null +++ b/mods/mobs/mod.conf @@ -0,0 +1 @@ +name = mobs diff --git a/mods/mobs/mount.lua b/mods/mobs/mount.lua new file mode 100644 index 0000000..d1f5841 --- /dev/null +++ b/mods/mobs/mount.lua @@ -0,0 +1,448 @@ + +-- lib_mount by Blert2112 (edited by TenPlus1) + +local enable_crash = false +local crash_threshold = 6.5 -- ignored if enable_crash=false + +------------------------------------------------------------------------------ + +-- +-- Helper functions +-- + +local node_ok = function(pos, fallback) + + fallback = fallback or mobs.fallback_node + + local node = minetest.get_node_or_nil(pos) + + if node and minetest.registered_nodes[node.name] then + return node + end + + return {name = fallback} +end + + +local function node_is(pos) + + local node = node_ok(pos) + + if node.name == "air" then + return "air" + end + + if minetest.get_item_group(node.name, "lava") ~= 0 then + return "lava" + end + + if minetest.get_item_group(node.name, "liquid") ~= 0 then + return "liquid" + end + + if minetest.registered_nodes[node.name].walkable == true then + return "walkable" + end + + return "other" +end + + +local function get_sign(i) + + i = i or 0 + + if i == 0 then + return 0 + else + return i / math.abs(i) + end +end + + +local function get_velocity(v, yaw, y) + + local x = -math.sin(yaw) * v + local z = math.cos(yaw) * v + + return {x = x, y = y, z = z} +end + + +local function get_v(v) + return math.sqrt(v.x * v.x + v.z * v.z) +end + + +local function force_detach(player) + + local attached_to = player:get_attach() + + if not attached_to then + return + end + + local entity = attached_to:get_luaentity() + + if entity.driver + and entity.driver == player then + + entity.driver = nil + end + + player:set_detach() + default.player_attached[player:get_player_name()] = false + player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) + default.player_set_animation(player, "stand" , 30) + player:set_properties({visual_size = {x = 1, y = 1} }) + +end + +------------------------------------------------------------------------------- + + +minetest.register_on_leaveplayer(function(player) + force_detach(player) +end) + +minetest.register_on_shutdown(function() + local players = minetest.get_connected_players() + for i = 1, #players do + force_detach(players[i]) + end +end) + +minetest.register_on_dieplayer(function(player) + force_detach(player) + return true +end) + +------------------------------------------------------------------------------- + +function mobs.attach(entity, player) + + local attach_at, eye_offset = {}, {} + + entity.player_rotation = entity.player_rotation or {x = 0, y = 0, z = 0} + entity.driver_attach_at = entity.driver_attach_at or {x = 0, y = 0, z = 0} + entity.driver_eye_offset = entity.driver_eye_offset or {x = 0, y = 0, z = 0} + entity.driver_scale = entity.driver_scale or {x = 1, y = 1} + + local rot_view = 0 + + if entity.player_rotation.y == 90 then + rot_view = math.pi/2 + end + + attach_at = entity.driver_attach_at + eye_offset = entity.driver_eye_offset + entity.driver = player + + force_detach(player) + + player:set_attach(entity.object, "", attach_at, entity.player_rotation) + default.player_attached[player:get_player_name()] = true + player:set_eye_offset(eye_offset, {x = 0, y = 0, z = 0}) + + player:set_properties({ + visual_size = { + x = entity.driver_scale.x, + y = entity.driver_scale.y + } + }) + + minetest.after(0.2, function() + default.player_set_animation(player, "sit" , 30) + end) + + --player:set_look_yaw(entity.object:get_yaw() - rot_view) + player:set_look_horizontal(entity.object:get_yaw() - rot_view) +end + + +function mobs.detach(player, offset) + + force_detach(player) + + default.player_set_animation(player, "stand" , 30) + + local pos = player:get_pos() + + pos = {x = pos.x + offset.x, y = pos.y + 0.2 + offset.y, z = pos.z + offset.z} + + minetest.after(0.1, function() + player:set_pos(pos) + end) +end + + +function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) + + local rot_steer, rot_view = math.pi/2, 0 + + if entity.player_rotation.y == 90 then + rot_steer, rot_view = 0, math.pi/2 + end + + local acce_y = 0 + local velo = entity.object:get_velocity() + + entity.v = get_v(velo) * get_sign(entity.v) + + -- process controls + if entity.driver then + +--print ("---velo", get_v(velo)) + + local ctrl = entity.driver:get_player_control() + + -- move forwards + if ctrl.up then + + entity.v = entity.v + entity.accel / 10 + + -- move backwards + elseif ctrl.down then + + if entity.max_speed_reverse == 0 and entity.v == 0 then + return + end + + entity.v = entity.v - entity.accel / 10 + end + + -- fix mob rotation + entity.object:set_yaw(entity.driver:get_look_horizontal() - entity.rotate) + + if can_fly then + + -- fly up + if ctrl.jump then + velo.y = velo.y + 1 + if velo.y > entity.accel then velo.y = entity.accel end + + elseif velo.y > 0 then + velo.y = velo.y - 0.1 + if velo.y < 0 then velo.y = 0 end + end + + -- fly down + if ctrl.sneak then + velo.y = velo.y - 1 + if velo.y < -entity.accel then velo.y = -entity.accel end + + elseif velo.y < 0 then + velo.y = velo.y + 0.1 + if velo.y > 0 then velo.y = 0 end + end + + else + + -- jump + if ctrl.jump then + + if velo.y == 0 then + velo.y = velo.y + entity.jump_height + acce_y = acce_y + (acce_y * 3) + 1 + end + end + + end + end + + -- if not moving then set animation and return + if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + + if stand_anim then + mobs:set_animation(entity, stand_anim) + end + + return + end + + -- set moving animation + if moving_anim then + mobs:set_animation(entity, moving_anim) + end + + -- Stop! + local s = get_sign(entity.v) + + entity.v = entity.v - 0.02 * s + + if s ~= get_sign(entity.v) then + + entity.object:set_velocity({x = 0, y = 0, z = 0}) + entity.v = 0 + return + end + + -- enforce speed limit forward and reverse + local max_spd = entity.max_speed_reverse + + if get_sign(entity.v) >= 0 then + max_spd = entity.max_speed_forward + end + + if math.abs(entity.v) > max_spd then + entity.v = entity.v - get_sign(entity.v) + end + + -- Set position, velocity and acceleration + local p = entity.object:get_pos() + local new_velo = {x = 0, y = 0, z = 0} + local new_acce = {x = 0, y = -9.8, z = 0} + + p.y = p.y - 0.5 + + local ni = node_is(p) + local v = entity.v + + if ni == "air" then + + if can_fly == true then + new_acce.y = 0 + end + + elseif ni == "liquid" or ni == "lava" then + + if ni == "lava" and entity.lava_damage ~= 0 then + + entity.lava_counter = (entity.lava_counter or 0) + dtime + + if entity.lava_counter > 1 then + + minetest.sound_play("default_punch", { + object = entity.object, + max_hear_distance = 5 + }) + + entity.object:punch(entity.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = entity.lava_damage} + }, nil) + + entity.lava_counter = 0 + end + end + + if entity.terrain_type == 2 + or entity.terrain_type == 3 then + + new_acce.y = 0 + p.y = p.y + 1 + + if node_is(p) == "liquid" then + + if velo.y >= 5 then + velo.y = 5 + elseif velo.y < 0 then + new_acce.y = 20 + else + new_acce.y = 5 + end + else + if math.abs(velo.y) < 1 then + local pos = entity.object:get_pos() + pos.y = math.floor(pos.y) + 0.5 + entity.object:set_pos(pos) + velo.y = 0 + end + end + else + v = v * 0.25 + end + end + + new_velo = get_velocity(v, entity.object:get_yaw() - rot_view, velo.y) + new_acce.y = new_acce.y + acce_y + + entity.object:set_velocity(new_velo) + entity.object:set_acceleration(new_acce) + + -- CRASH! + if enable_crash then + + local intensity = entity.v2 - v + + if intensity >= crash_threshold then + +--print("----------- crash", intensity) + + entity.object:punch(entity.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = intensity} + }, nil) + + end + end + + entity.v2 = v +end + + +-- directional flying routine by D00Med (edited by TenPlus1) + +function mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_anim) + + local ctrl = entity.driver:get_player_control() + local velo = entity.object:get_velocity() + local dir = entity.driver:get_look_dir() + local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands + local rot_steer, rot_view = math.pi / 2, 0 + + if entity.player_rotation.y == 90 then + rot_steer, rot_view = 0, math.pi / 2 + end + + if ctrl.up then + entity.object:set_velocity({ + x = dir.x * speed, + y = dir.y * speed + 2, + z = dir.z * speed + }) + + elseif ctrl.down then + entity.object:set_velocity({ + x = -dir.x * speed, + y = dir.y * speed + 2, + z = -dir.z * speed + }) + + elseif not ctrl.down or ctrl.up or ctrl.jump then + entity.object:set_velocity({x = 0, y = -2, z = 0}) + end + + entity.object:set_yaw(yaw + math.pi + math.pi / 2 - entity.rotate) + + -- firing arrows + if ctrl.LMB and ctrl.sneak and shoots then + + local pos = entity.object:get_pos() + local obj = minetest.add_entity({ + x = pos.x + 0 + dir.x * 2.5, + y = pos.y + 1.5 + dir.y, + z = pos.z + 0 + dir.z * 2.5}, arrow) + + local ent = obj:get_luaentity() + if ent then + ent.switch = 1 -- for mob specific arrows + ent.owner_id = tostring(entity.object) -- so arrows dont hurt entity you are riding + local vec = {x = dir.x * 6, y = dir.y * 6, z = dir.z * 6} + local yaw = entity.driver:get_look_horizontal() + obj:set_yaw(yaw + math.pi / 2) + obj:set_velocity(vec) + else + obj:remove() + end + end + + -- change animation if stopped + if velo.x == 0 and velo.y == 0 and velo.z == 0 then + + mobs:set_animation(entity, stand_anim) + else + -- moving animation + mobs:set_animation(entity, moving_anim) + end +end diff --git a/mods/mobs/readme.MD b/mods/mobs/readme.MD new file mode 100644 index 0000000..5066d82 --- /dev/null +++ b/mods/mobs/readme.MD @@ -0,0 +1,83 @@ + +MOBS REDO for MINETEST + +Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel, Zeg9, ExeterDad and AspireMint. + + +This mod contains the API only for adding your own mobs into the world, so please use the additional modpacks to add animals, monsters etc. + + +https://forum.minetest.net/viewtopic.php?f=11&t=9917 + + +Crafts: + + - Nametag (paper, black dye, string) can be used right-click on a tamed mob to give them a name. + - Nets can be used to right-click tamed mobs to pick them up and place inside inventory as a spawn egg. + - Magic Lasso is similar to nets but with a better chance of picking up larger mobs. + - Shears are used to right-click sheep and return 1-3 wool. + - Protection Rune lets you protect tamed mobs from harm by other players + - Mob Fence and Fence Top (to stop mobs escaping/glitching through fences) + +Lucky Blocks: 9 + + +Changelog: +- 1.47- Mob damage changes, min and max light level for damage added, ignition sources checked for lava damage +- 1.46- Mobs only drop rare items when killed by player (drops.min = 0 makes them rare), code tweak, pathfinding no longer sees through walkable nodes +- 1.45- Added Fence Top to add on top of any fence to stop mobs escaping, new line_of_sight tweaked by Astrobe +- 1.44- Added ToolRanks support for swords when attacking mobs +- 1.43- Better 0.4.16 compatibility, added general attack function and settings +- 1.42- Added "all" option to immune_to table, tidied floating mobs to be less intensive +- 1.41- Mob pathfinding has been updated thanks to Elkien3 +- 1.40- Updated to use newer functions, requires Minetest 0.4.16+ to work. +- 1.39- Added 'on_breed', 'on_grown' and 'do_punch' custom functions per mob +- 1.38- Better entity checking, nametag setting and on_spawn function added to mob registry, tweaked light damage +- 1.37- Added support for Raymoo's CMI (common mob interface) mod: https://forum.minetest.net/viewtopic.php?f=9&t=15448 +- 1.36- Death check added, if mob dies in fire/lava/with lava pick then drops are cooked +- 1.35- Added owner_loyal flag for owned mobs to attack player enemies, also fixed group_attack +- 1.34- Added function to fly mob using directional movement (thanks D00Med for flying code) +- 1.33- Added functions to mount ride mobs (mobs.attach, mobs.detach, mobs.drive) many thanks to Blert2112 +- 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs +- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder. +- 1.30- Added support for invisibility mod (mobs cant attack what they cant see), tweaked and tidied code +- 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod +- 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :) +- 1.27- Added new sheep, lava flan and spawn egg textures. New Lava Pick tool smelts what you dig. New atan checking function. +- 1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :) +- 1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak. +- 1.24- Added feature where certain animals run away when punched (runaway = true in mob definition) +- 1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings) +- 1.22- Added ability to name tamed animals and npc using nametags, also npc will attack anyone who punches them apart from owner +- 1.21- Added some more error checking to reduce serialize.h error and added height checks for falling off cliffs (thanks cmdskp) +- 1.20- Error checking added to remove bad mobs, out of map limit mobs and stop serialize.h error +- 1.19- Chickens now drop egg items instead of placing the egg, also throwing eggs result in 1/8 chance of spawning chick +- 1.18- Added docile_by_day flag so that monsters will not attack automatically during daylight hours unless hit first +- 1.17- Added 'dogshoot' attack type, shoots when out of reach, melee attack when in reach, also api tweaks and self.reach added +- 1.16- Mobs follow multiple items now, Npc's can breed +- 1.15- Added Feeding/Taming/Breeding function, right-click to pick up any sheep with X mark on them and replace with new one to fix compatibility. +- 1.14- All .self variables saved in staticdata, Fixed self.health bug +- 1.13- Added capture function (thanks blert2112) chance of picking up mob with hand; net; magic lasso, replaced some .x models with newer .b3d one's +- 1.12- Added animal ownership so that players cannot steal your tamed animals +- 1.11- Added flying mobs (and swimming), fly=true and fly_in="air" or "deafult:water_source" for fishy +- 1,10- Footstep removed (use replace), explosion routine added for exploding mobs. +- 1.09- reworked breeding routine, added mob rotation value, added footstep feature, added jumping mobs with sounds feature, added magic lasso for picking up animals +- 1.08- Mob throwing attack has been rehauled so that they can damage one another, also drops and on_die function added +- 1.07- Npc's can now be set to follow player or stand by using self.order and self.owner variables +- beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop +- 1.06- Changed recovery times after breeding, and time taken to grow up (can be sped up by feeding baby animal) +- 1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten +- 1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :) +- 1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc. +- 1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions +- 1.01- Mobs that suffer fall damage or die in water/lava/sunlight will now drop items +- 1.0 - more work on Api so that certain mobs can float in water while some sink like a brick :) +- 0.9 - Spawn eggs added for all mobs (admin only, cannot be placed in protected areas)... Api tweaked +- 0.8 - Added sounds to monster mobs (thanks Cyberpangolin for the sfx) and also chicken sound +- 0.7 - mobs.protected switch added to api.lua, when set to 1 mobs no longer spawn in protected areas, also bug fixes +- 0.6 - Api now supports multi-textured mobs, e.g oerkki, dungeon master, rats and chickens have random skins when spawning (sheep fix TODO), also new Honey block +- 0.5 - Mobs now float in water, die from falling, and some code improvements +- 0.4 - Dungeon Masters and Mese Monsters have much better aim due to shoot_offset, also they can both shoot through nodes that aren't walkable (flowers, grass etc) plus new sheep sound :) +- 0.3 - Added LOTT's Spider mob, made Cobwebs, added KPavel's Bee with Honey and Beehives (made texture), Warthogs now have sound and can be tamed, taming of shaved sheep or milked cow with 8 wheat so it will not despawn, many bug fixes :) +- 0.2 - Cooking bucket of milk into cheese now returns empty bucket +- 0.1 - Initial Release diff --git a/mods/mobs/settingtypes.txt b/mods/mobs/settingtypes.txt new file mode 100644 index 0000000..0821437 --- /dev/null +++ b/mods/mobs/settingtypes.txt @@ -0,0 +1,29 @@ +# If false then mobs no longer spawn in world without spawner or spawn egg +mobs_spawn (Spawn Mobs) bool true + +# If enabled then monsters no longer spawn in world +only_peaceful_mobs (Only spawn peaceful Mobs) bool false + +# If enabled then punching mobs no longer shows blood effects +mobs_disable_blood (Disable Mob blood) bool false + +# If disabled then Mobs no longer destroy world blocks +mobs_griefing (Griefing Mobs) bool true + +# If false then Mobs no longer spawn inside player protected areas +mobs_spawn_protected (Spawn Mobs in protected areas) bool true + +# If true Mobs will be removed once a map chunk is out of view +remove_far_mobs (Remove far Mobs) bool true + +# Sets Mob difficulty level by multiplying punch damage +mob_difficulty (Mob difficulty) float 1.0 + +# If disabled health status no longer appears above Mob when punched +mob_show_health (Show Mob health) bool true + +# Contains a value used to multiply Mob spawn values +mob_chance_multiplier (Mob chance multiplier) float 1.0 + +# When false Mob no longer drop items when killed +mobs_drop_items (Mob drops) bool true diff --git a/mods/mobs/sounds/default_punch.ogg b/mods/mobs/sounds/default_punch.ogg new file mode 100644 index 0000000..28a500b Binary files /dev/null and b/mods/mobs/sounds/default_punch.ogg differ diff --git a/mods/mobs/sounds/license.txt b/mods/mobs/sounds/license.txt new file mode 100644 index 0000000..3b160fe --- /dev/null +++ b/mods/mobs/sounds/license.txt @@ -0,0 +1,7 @@ +Creative Commons sounds from Freesound.org + +mobs_swing.ogg by qubodup + - http://freesound.org/people/qubodup/sounds/60012/ + +mobs_spell.ogg by littlerobotsoundfactory + - http://freesound.org/people/LittleRobotSoundFactory/sounds/270396/ diff --git a/mods/mobs/sounds/mobs_spell.ogg b/mods/mobs/sounds/mobs_spell.ogg new file mode 100644 index 0000000..455b54f Binary files /dev/null and b/mods/mobs/sounds/mobs_spell.ogg differ diff --git a/mods/mobs/sounds/mobs_swing.ogg b/mods/mobs/sounds/mobs_swing.ogg new file mode 100644 index 0000000..ffe6a9c Binary files /dev/null and b/mods/mobs/sounds/mobs_swing.ogg differ diff --git a/mods/mobs/spawner.lua b/mods/mobs/spawner.lua new file mode 100644 index 0000000..ca75dee --- /dev/null +++ b/mods/mobs/spawner.lua @@ -0,0 +1,181 @@ + +-- intllib +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP .. "/intllib.lua") + +-- mob spawner + +local spawner_default = "mobs_animal:pumba 10 15 0 0" + +minetest.register_node("mobs:spawner", { + tiles = {"mob_spawner.png"}, + drawtype = "glasslike", + paramtype = "light", + walkable = true, + description = S("Mob Spawner"), + groups = {cracky = 1}, + + on_construct = function(pos) + + local meta = minetest.get_meta(pos) + + -- text entry formspec + meta:set_string("formspec", + "field[text;" .. S("Mob MinLight MaxLight Amount PlayerDist") .. ";${command}]") + meta:set_string("infotext", S("Spawner Not Active (enter settings)")) + meta:set_string("command", spawner_default) + end, + + on_right_click = function(pos, placer) + + if minetest.is_protected(pos, placer:get_player_name()) then + return + end + end, + + on_receive_fields = function(pos, formname, fields, sender) + + if not fields.text or fields.text == "" then + return + end + + local meta = minetest.get_meta(pos) + local comm = fields.text:split(" ") + local name = sender:get_player_name() + + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return + end + + local mob = comm[1] -- mob to spawn + local mlig = tonumber(comm[2]) -- min light + local xlig = tonumber(comm[3]) -- max light + local num = tonumber(comm[4]) -- total mobs in area + local pla = tonumber(comm[5]) -- player distance (0 to disable) + local yof = tonumber(comm[6]) or 0 -- Y offset to spawn mob + + if mob and mob ~= "" and mobs.spawning_mobs[mob] == true + and num and num >= 0 and num <= 10 + and mlig and mlig >= 0 and mlig <= 15 + and xlig and xlig >= 0 and xlig <= 15 + and pla and pla >=0 and pla <= 20 + and yof and yof > -10 and yof < 10 then + + meta:set_string("command", fields.text) + meta:set_string("infotext", S("Spawner Active (@1)", mob)) + + else + minetest.chat_send_player(name, S("Mob Spawner settings failed!")) + minetest.chat_send_player(name, + S("Syntax: “name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10]”")) + end + end, +}) + + +local max_per_block = tonumber(minetest.settings:get("max_objects_per_block") or 99) + +-- spawner abm +minetest.register_abm({ + label = "Mob spawner node", + nodenames = {"mobs:spawner"}, + interval = 10, + chance = 4, + catch_up = false, + + action = function(pos, node, active_object_count, active_object_count_wider) + + -- return if too many entities already + if active_object_count_wider >= max_per_block then + return + end + + -- get meta and command + local meta = minetest.get_meta(pos) + local comm = meta:get_string("command"):split(" ") + + -- get settings from command + local mob = comm[1] + local mlig = tonumber(comm[2]) + local xlig = tonumber(comm[3]) + local num = tonumber(comm[4]) + local pla = tonumber(comm[5]) or 0 + local yof = tonumber(comm[6]) or 0 + + -- if amount is 0 then do nothing + if num == 0 then + return + end + + -- are we spawning a registered mob? + if not mobs.spawning_mobs[mob] then + --print ("--- mob doesn't exist", mob) + return + end + + -- check objects inside 9x9 area around spawner + local objs = minetest.get_objects_inside_radius(pos, 9) + local count = 0 + local ent = nil + + -- count mob objects of same type in area + for k, obj in ipairs(objs) do + + ent = obj:get_luaentity() + + if ent and ent.name and ent.name == mob then + count = count + 1 + end + end + + -- is there too many of same type? + if count >= num then + return + end + + -- spawn mob if player detected and in range + if pla > 0 then + + local in_range = 0 + local objs = minetest.get_objects_inside_radius(pos, pla) + + for _,oir in pairs(objs) do + + if oir:is_player() then + + in_range = 1 + + break + end + end + + -- player not found + if in_range == 0 then + return + end + end + + -- find air blocks within 5 nodes of spawner + local air = minetest.find_nodes_in_area( + {x = pos.x - 5, y = pos.y + yof, z = pos.z - 5}, + {x = pos.x + 5, y = pos.y + yof, z = pos.z + 5}, + {"air"}) + + -- spawn in random air block + if air and #air > 0 then + + local pos2 = air[math.random(#air)] + local lig = minetest.get_node_light(pos2) or 0 + + pos2.y = pos2.y + 0.5 + + -- only if light levels are within range + if lig >= mlig and lig <= xlig + and minetest.registered_entities[mob] then + minetest.add_entity(pos2, mob) + end + end + + end +}) diff --git a/mods/mobs/textures/mob_spawner.png b/mods/mobs/textures/mob_spawner.png new file mode 100644 index 0000000..8f0ac39 Binary files /dev/null and b/mods/mobs/textures/mob_spawner.png differ diff --git a/mods/mobs/textures/mobs_blood.png b/mods/mobs/textures/mobs_blood.png new file mode 100644 index 0000000..77cfbda Binary files /dev/null and b/mods/mobs/textures/mobs_blood.png differ diff --git a/mods/mobs/textures/mobs_chicken_egg.png b/mods/mobs/textures/mobs_chicken_egg.png new file mode 100644 index 0000000..be8a4e1 Binary files /dev/null and b/mods/mobs/textures/mobs_chicken_egg.png differ diff --git a/mods/mobs/textures/mobs_chicken_egg_overlay.png b/mods/mobs/textures/mobs_chicken_egg_overlay.png new file mode 100644 index 0000000..e81716a Binary files /dev/null and b/mods/mobs/textures/mobs_chicken_egg_overlay.png differ diff --git a/mods/mobs/textures/mobs_leather.png b/mods/mobs/textures/mobs_leather.png new file mode 100644 index 0000000..3205e5d Binary files /dev/null and b/mods/mobs/textures/mobs_leather.png differ diff --git a/mods/mobs/textures/mobs_magic_lasso.png b/mods/mobs/textures/mobs_magic_lasso.png new file mode 100644 index 0000000..befdc11 Binary files /dev/null and b/mods/mobs/textures/mobs_magic_lasso.png differ diff --git a/mods/mobs/textures/mobs_meat.png b/mods/mobs/textures/mobs_meat.png new file mode 100644 index 0000000..4c63fdd Binary files /dev/null and b/mods/mobs/textures/mobs_meat.png differ diff --git a/mods/mobs/textures/mobs_meat_raw.png b/mods/mobs/textures/mobs_meat_raw.png new file mode 100644 index 0000000..0dea4ec Binary files /dev/null and b/mods/mobs/textures/mobs_meat_raw.png differ diff --git a/mods/mobs/textures/mobs_nametag.png b/mods/mobs/textures/mobs_nametag.png new file mode 100644 index 0000000..74005b3 Binary files /dev/null and b/mods/mobs/textures/mobs_nametag.png differ diff --git a/mods/mobs/textures/mobs_net.png b/mods/mobs/textures/mobs_net.png new file mode 100644 index 0000000..df7c3a6 Binary files /dev/null and b/mods/mobs/textures/mobs_net.png differ diff --git a/mods/mobs/textures/mobs_noentry_particle.png b/mods/mobs/textures/mobs_noentry_particle.png new file mode 100644 index 0000000..87938ff Binary files /dev/null and b/mods/mobs/textures/mobs_noentry_particle.png differ diff --git a/mods/mobs/textures/mobs_protect_particle.png b/mods/mobs/textures/mobs_protect_particle.png new file mode 100644 index 0000000..debe20c Binary files /dev/null and b/mods/mobs/textures/mobs_protect_particle.png differ diff --git a/mods/mobs/textures/mobs_protector.png b/mods/mobs/textures/mobs_protector.png new file mode 100644 index 0000000..f3937b7 Binary files /dev/null and b/mods/mobs/textures/mobs_protector.png differ diff --git a/mods/mobs/textures/mobs_saddle.png b/mods/mobs/textures/mobs_saddle.png new file mode 100644 index 0000000..e9d42f8 Binary files /dev/null and b/mods/mobs/textures/mobs_saddle.png differ diff --git a/mods/mobs/textures/mobs_shears.png b/mods/mobs/textures/mobs_shears.png new file mode 100644 index 0000000..aa16f2e Binary files /dev/null and b/mods/mobs/textures/mobs_shears.png differ diff --git a/mods/mobs/textures/tnt_smoke.png b/mods/mobs/textures/tnt_smoke.png new file mode 100644 index 0000000..488b50f Binary files /dev/null and b/mods/mobs/textures/tnt_smoke.png differ diff --git a/mods/sprint/LICENSE.txt b/mods/sprint/LICENSE.txt new file mode 100644 index 0000000..fe2696b --- /dev/null +++ b/mods/sprint/LICENSE.txt @@ -0,0 +1,113 @@ +===================================== +Code License: MIT License (see below) +===================================== + +Copyright 2019 migdyn + +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. + + +================================================================ +Textures and sounds license: CC BY 4.0 International (see below) +================================================================ + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + Licensor means the individual(s) or entity(ies) granting rights under this Public License. + Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + License grant. + Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + reproduce and Share the Licensed Material, in whole or in part; and + produce, reproduce, and Share Adapted Material. + Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + Term. The term of this Public License is specified in Section 6(a). + Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + Downstream recipients. + Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + Other rights. + Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + Patent and trademark rights are not licensed under this Public License. + To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + Attribution. + + If You Share the Licensed Material (including in modified form), You must: + retain the following if it is supplied by the Licensor with the Licensed Material: + identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + a copyright notice; + a notice that refers to this Public License; + a notice that refers to the disclaimer of warranties; + a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and + You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + upon express reinstatement by the Licensor. + For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + diff --git a/mods/sprint/README.md b/mods/sprint/README.md new file mode 100644 index 0000000..3a4111c --- /dev/null +++ b/mods/sprint/README.md @@ -0,0 +1,65 @@ +Sprint Mod For Minetest by GunshipPenguin +Modified by migdyn for his MineZ game. + +Allows the player to sprint by either double tapping w or pressing e. +By default, sprinting will make the player travel 80% faster and +allow him/her to jump 10% higher. Also adds a stamina bar that goes +down when the player sprints and goes up when he/she isn't +sprinting. + +This mod is compatible with the HUD bars [hudbars] mod, but does +not depend on it. In this care, a green HUD bar will be displayed, +also showing a number. +If this mod is not present, a standard statbar with 0-20 +“half-arrows” is shown, which is a bit more coarse than the HUD +bar version. + +//EDIT BY MIGDYN: +The work was released into the public domain by GunshipPenguin using CC0. +I changed the license to MIT License, since CC0 allows it. +License: MIT License (see LICENSE.txt) + +--- + +This mod can be configured by changing the variables declared in +the start of init.lua. The following is a brief explanation of each +one. + +SPRINT_METHOD (default 1) + +What a player has to do to start sprinting. 0 = double tap w, 1 = press e. +Note that if you have the fast privlige, and have the fast +speed turned on, you will run very, very fast. You can toggle this +by pressing j. + +SPRINT_SPEED (default 1.5) + +How fast the player will move when sprinting as opposed to normal +movement speed. 1.0 represents normal speed so 1.5 would mean that a +sprinting player would travel 50% faster than a walking player and +2.4 would mean that a sprinting player would travel 140% faster than +a walking player. + +SPRINT_JUMP (default 1.1) + +How high the player will jump when sprinting as opposed to normal +jump height. Same as SPRINT_SPEED, just controls jump height while +sprinting rather than speed. + +SPRINT_STAMINA (default 20) + +How long the player can sprint for in seconds. Each player has a +stamina variable assigned to them, it is initially set to +SPRINT_STAMINA and can go no higher. When the player is sprinting, +this variable ticks down once each second, and when it reaches 0, +the player stops sprinting. It ticks back up when the player isn't +sprinting and stops at SPRINT_STAMINA. Set this to a huge value if +you want unlimited sprinting. + +SPRINT_TIMEOUT (default 0.5) + +Only used if SPRINT_METHOD = 0. +How much time the player has after releasing w, to press w again and +start sprinting. Setting this too high will result in unwanted +sprinting and setting it too low will result in it being +difficult/impossible to sprint. diff --git a/mods/sprint/depends.txt b/mods/sprint/depends.txt new file mode 100644 index 0000000..3e1d5c2 --- /dev/null +++ b/mods/sprint/depends.txt @@ -0,0 +1 @@ +hudbars? diff --git a/mods/sprint/esprint.lua b/mods/sprint/esprint.lua new file mode 100644 index 0000000..0ec319c --- /dev/null +++ b/mods/sprint/esprint.lua @@ -0,0 +1,97 @@ +--[[ +Sprint mod for Minetest by GunshipPenguin + +To the extent possible under law, the author(s) +have dedicated all copyright and related and neighboring rights +to this software to the public domain worldwide. This software is +distributed without any warranty. +]] + +local players = {} + +local function setSprinting(playerName, sprinting) --Sets the state of a player (0=stopped/moving, 1=sprinting) + local player = minetest.get_player_by_name(playerName) + if players[playerName] then + players[playerName]["sprinting"] = sprinting + if sprinting == true then + player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP}) + elseif sprinting == false then + player:set_physics_override({speed=1.0,jump=1.0}) + end + return true + end + return false +end + +minetest.register_on_joinplayer(function(player) + local playerName = player:get_player_name() + + players[playerName] = { + sprinting = false, + timeOut = 0, + shouldSprint = false, + } + if SPRINT_HUDBARS_USED then + hb.init_hudbar(player, "sprint") + else + players[playerName].hud = player:hud_add({ + hud_elem_type = "statbar", + position = {x=0.5,y=1}, + size = {x=24, y=24}, + number = 20, + alignment = {x=0,y=1}, + offset = {x=-263, y=-110}, + } + ) + end +end) +minetest.register_on_leaveplayer(function(player) + local playerName = player:get_player_name() + players[playerName] = nil +end) +minetest.register_globalstep(function(dtime) + --Get the gametime + local gameTime = minetest.get_gametime() + + --Loop through all connected players + for playerName,playerInfo in pairs(players) do + local player = minetest.get_player_by_name(playerName) + if player ~= nil then + --Check if the player should be sprinting + if player:get_player_control()["aux1"] and player:get_player_control()["up"] then + players[playerName]["shouldSprint"] = true + else + players[playerName]["shouldSprint"] = false + end + + --If the player is sprinting, create particles behind him/her + if playerInfo["sprinting"] == true and gameTime % 0.1 == 0 then + local numParticles = math.random(1, 2) + local playerPos = player:getpos() + local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]}) + if playerNode["name"] ~= "air" then + for i=1, numParticles, 1 do + minetest.add_particle({ + pos = {x=playerPos["x"]+math.random(-1,1)*math.random()/2,y=playerPos["y"]+0.1,z=playerPos["z"]+math.random(-1,1)*math.random()/2}, + vel = {x=0, y=5, z=0}, + acc = {x=0, y=-13, z=0}, + expirationtime = math.random(), + size = math.random()+0.5, + collisiondetection = true, + vertical = false, + texture = "sprint_particle.png", + }) + end + end + end + + --Adjust player states + if players[playerName]["shouldSprint"] == true then --Stopped + setSprinting(playerName, true) + elseif players[playerName]["shouldSprint"] == false then + setSprinting(playerName, false) + end + + end + end +end) diff --git a/mods/sprint/init.lua b/mods/sprint/init.lua new file mode 100644 index 0000000..c31d789 --- /dev/null +++ b/mods/sprint/init.lua @@ -0,0 +1,33 @@ +--[[ +Sprint mod for Minetest by GunshipPenguin + +To the extent possible under law, the author(s) +have dedicated all copyright and related and neighboring rights +to this software to the public domain worldwide. This software is +distributed without any warranty. +]] + +--Configuration variables, these are all explained in README.md +SPRINT_METHOD = 1 +SPRINT_SPEED = 3 +SPRINT_JUMP = 1.1 +SPRINT_TIMEOUT = 0.5 --Only used if SPRINT_METHOD = 0 + +if minetest.get_modpath("hudbars") ~= nil then + hb.register_hudbar("sprint", 0xFFFFFF, "Stamina", + { bar = "sprint_stamina_bar.png", icon = "sprint_stamina_icon.png" }, + SPRINT_STAMINA, SPRINT_STAMINA, + false, "%s: %.1f/%.1f") + SPRINT_HUDBARS_USED = true +else + SPRINT_HUDBARS_USED = false +end + +if SPRINT_METHOD == 0 then + dofile(minetest.get_modpath("sprint") .. "/wsprint.lua") +elseif SPRINT_METHOD == 1 then + dofile(minetest.get_modpath("sprint") .. "/esprint.lua") +else + minetest.log("error", "Sprint Mod - SPRINT_METHOD is not set properly, using e to sprint") + dofile(minetest.get_modpath("sprint") .. "/esprint.lua") +end diff --git a/mods/sprint/textures/sprint_particle.png b/mods/sprint/textures/sprint_particle.png new file mode 100644 index 0000000..e53866c Binary files /dev/null and b/mods/sprint/textures/sprint_particle.png differ diff --git a/mods/sprint/wsprint.lua b/mods/sprint/wsprint.lua new file mode 100644 index 0000000..3a832e2 --- /dev/null +++ b/mods/sprint/wsprint.lua @@ -0,0 +1,135 @@ +--[[ +Sprint mod for Minetest by GunshipPenguin + +To the extent possible under law, the author(s) +have dedicated all copyright and related and neighboring rights +to this software to the public domain worldwide. This software is +distributed without any warranty. +]] + +local players = {} +local staminaHud = {} + +minetest.register_on_joinplayer(function(player) + local playerName = player:get_player_name() + players[playerName] = { + state = 0, + timeOut = 0, + stamina = SPRINT_STAMINA, + moving = false, + } + + if SPRINT_HUDBARS_USED then + hb.init_hudbar(player, "sprint") + else + players[playerName].hud = player:hud_add({ + hud_elem_type = "statbar", + position = {x=0.5,y=1}, + size = {x=24, y=24}, + text = "sprint_stamina_icon.png", + number = 20, + alignment = {x=0,y=1}, + offset = {x=-263, y=-110}, + } + ) + end +end) +minetest.register_on_leaveplayer(function(player) + local playerName = player:get_player_name() + players[playerName] = nil +end) +minetest.register_globalstep(function(dtime) + --Get the gametime + local gameTime = minetest.get_gametime() + + --Loop through all connected players + for playerName,playerInfo in pairs(players) do + local player = minetest.get_player_by_name(playerName) + if player ~= nil then + --Check if they are moving or not + players[playerName]["moving"] = player:get_player_control()["up"] + + --If the player has tapped w longer than SPRINT_TIMEOUT ago, set his/her state to 0 + if playerInfo["state"] == 2 then + if playerInfo["timeOut"] + SPRINT_TIMEOUT < gameTime then + players[playerName]["timeOut"] = nil + setState(playerName, 0) + end + + --If the player is sprinting, create particles behind him/her + elseif playerInfo["state"] == 3 and gameTime % 0.1 == 0 then + local numParticles = math.random(1, 2) + local playerPos = player:getpos() + local playerNode = minetest.get_node({x=playerPos["x"], y=playerPos["y"]-1, z=playerPos["z"]}) + if playerNode["name"] ~= "air" then + for i=1, numParticles, 1 do + minetest.add_particle({ + pos = {x=playerPos["x"]+math.random(-1,1)*math.random()/2,y=playerPos["y"]+0.1,z=playerPos["z"]+math.random(-1,1)*math.random()/2}, + vel = {x=0, y=5, z=0}, + acc = {x=0, y=-13, z=0}, + expirationtime = math.random(), + size = math.random()+0.5, + collisiondetection = true, + vertical = false, + texture = "sprint_particle.png", + }) + end + end + end + + --Adjust player states + if players[playerName]["moving"] == false and playerInfo["state"] == 3 then --Stopped + setState(playerName, 0) + elseif players[playerName]["moving"] == true and playerInfo["state"] == 0 then --Moving + setState(playerName, 1) + elseif players[playerName]["moving"] == false and playerInfo["state"] == 1 then --Primed + setState(playerName, 2) + elseif players[playerName]["moving"] == true and playerInfo["state"] == 2 then --Sprinting + setState(playerName, 3) + end + + --Lower the player's stamina by dtime if he/she is sprinting and set his/her state to 0 if stamina is zero + if playerInfo["state"] == 3 then + playerInfo["stamina"] = playerInfo["stamina"] - dtime + if playerInfo["stamina"] <= 0 then + playerInfo["stamina"] = 0 + setState(playerName, 0) + end + + --Increase player's stamina if he/she is not sprinting and his/her stamina is less than SPRINT_STAMINA + elseif playerInfo["state"] ~= 3 and playerInfo["stamina"] < SPRINT_STAMINA then + playerInfo["stamina"] = playerInfo["stamina"] + dtime + end + -- Cap stamina at SPRINT_STAMINA + if playerInfo["stamina"] > SPRINT_STAMINA then + playerInfo["stamina"] = SPRINT_STAMINA + end + + --Update the players's hud sprint stamina bar + + if SPRINT_HUDBARS_USED then + hb.change_hudbar(player, "sprint", playerInfo["stamina"]) + else + local numBars = (playerInfo["stamina"]/SPRINT_STAMINA)*20 + player:hud_change(playerInfo["hud"], "number", numBars) + end + end + end +end) + +function setState(playerName, state) --Sets the state of a player (0=stopped, 1=moving, 2=primed, 3=sprinting) + local player = minetest.get_player_by_name(playerName) + local gameTime = minetest.get_gametime() + if players[playerName] then + players[playerName]["state"] = state + if state == 0 then--Stopped + player:set_physics_override({speed=1.0,jump=1.0}) + elseif state == 2 then --Primed + players[playerName]["timeOut"] = gameTime + elseif state == 3 then --Sprinting + player:set_physics_override({speed=SPRINT_SPEED,jump=SPRINT_JUMP}) + end + return true + end + return false +end diff --git a/mods/thirsty/HUD.txt b/mods/thirsty/HUD.txt new file mode 100644 index 0000000..5aa9426 --- /dev/null +++ b/mods/thirsty/HUD.txt @@ -0,0 +1,17 @@ +Configuration for Better HUD +---------------------------- + +The Better HUD mod positions the stat displays according to +a 'hud.conf' file in its mod directory. If you wish to shift +the positions of the stat displays around, you need to create or +edit the 'hud.conf' file. + +There should be two files in this mod directory, 'hud.conf.with_hunger' +and 'hud.conf.no_hunger'. These can be used as the basis for your +'hud.conf', depending on whether you are also using the Hunger mod +(which adds a hunger display), or not. + +The positions of the displays in those files correspond to the +default settings in Better HUD. In most cases, it's enough to +copy one of these files as 'hud.conf' in the Better HUD mod +directory 'mods/hud'. diff --git a/mods/thirsty/LICENSE b/mods/thirsty/LICENSE new file mode 100644 index 0000000..5f2dd7f --- /dev/null +++ b/mods/thirsty/LICENSE @@ -0,0 +1,505 @@ + 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. + + {description} + Copyright (C) {year} {fullname} + + 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. + + {signature of Ty Coon}, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/mods/thirsty/README.md b/mods/thirsty/README.md new file mode 100644 index 0000000..e218b8c --- /dev/null +++ b/mods/thirsty/README.md @@ -0,0 +1,104 @@ +Thirsty [thirsty] +================= +THIS MOD WAS MODIFIED BY MIGDYN FOR HIS ZOMBIETEST GAME ON FEBRUARY 10, 2019. +CHANGES MADE: + Removed bowls. + Removed some crafting recipes and chaned node names. + + +Any bugs or problems that may occur with this modified version of the mod are probably NOT the original developer's fault so please report them to me, not to the original author of the mod. + +A Minetest mod that adds a "thirst" mechanic. + +Version: 0.10.2 + +License: + Code: LGPL 2.1 (see included LICENSE file) + Textures: CC-BY-SA (see http://creativecommons.org/licenses/by-sa/4.0/) + +Report bugs or request help on the forum topic. + +Description +----------- + +This is a mod for MineTest. It adds a thirst mechanic to the +game, similar to many hunger mods (but independent of them). +Players will slowly get thirstier over time, and will need to +drink or suffer damage. + +The point of this mod is not to make the game more realistic, +or harder. The point is to have another mechanic that rewards +preparation and infrastructure. Players will now have an incentive +to build their base next to water (or add some water to their base), +and/or take some water with them when mining or travelling. + +Terminology: "Thirst" vs. "hydration" +------------------------------------- + +"Thirst" is the absence of "hydration" (a term suggested by +everamzah on the Minetest forums, thanks!). The overall mechanic +is still called "thirst", but the visible bar is that of +"hydration", meaning a full bar represents full hydration, not full +thirst. Players lose hydration (or "hydro points") over time, and +gain hydration when drinking. + +Current behavior +---------------- + +**Tier 0**: stand in water (running or standing) to slowly drink. +You may not move during drinking (or you could cross an ocean without +getting thirsty). + +**Tier 1**: use a container (e.g. from `vessels`) on water to instantly +fill your hydration. Craftable wooden bowl included. + +**Tier 2**: craftable canteens: steel canteen holds two full hydration +bars, bronze canteen three bars worth of water. + +**Tier 3**: placeable drinking fountain / wash basin node: instantly +fills your hydration when used. + +**Tier 4+**: placeable fountain node(s) to fill the hydration of all +players within range. Placing more nodes increases the range. + +**Tier 5**: craftable trinkets/gadgets/amulets that constantly keep your +hydration filled when in your inventory, solving your thirst problem +once and for all. + +API +--- +Some functions of interest: + +* thirsty.drink(player, amount, [max]) : instantly drink a bit (up to a max value, default 20) +* thirsty.get_hydro(player) : returns the current hydration of a player +* thirsty.set_thirst_factor(player, factor) : how fast does the given player get thirsty (default is 1.0) +* thirsty.get_thirst_factor(player) : returns the current thirst factor of a player + +"player" refers to a player object, i.e. with a get_player_name() method. + +Future plans +------------ +Better configurability and an API. + +Dependencies +------------ +* default (optional but needed for included components) +* bucket (optional but needed for some included components) +* hud (optional): https://forum.minetest.net/viewtopic.php?f=11&t=6342 (see HUD.txt for configuration) +* hudbars (optional): https://forum.minetest.net/viewtopic.php?f=11&t=11153 +* vessels (optional): https://forum.minetest.net/viewtopic.php?id=2574 + +Installation +------------ + +Unzip the archive, rename the folder to to `thirsty` and +place it in minetest/mods/ + +( Linux: If you have a linux system-wide installation place + it in ~/.minetest/mods/. ) + +( If you only want this to be used in a single world, place + the folder in worldmods/ in your worlddirectory. ) + +For further information or help see: +http://wiki.minetest.com/wiki/Installing_Mods diff --git a/mods/thirsty/components.lua b/mods/thirsty/components.lua new file mode 100644 index 0000000..f0ee9c5 --- /dev/null +++ b/mods/thirsty/components.lua @@ -0,0 +1,210 @@ +--[[ + +Default components for Thirsty. + +These are nodes and items that "implement" the functionality +from functions.lua + +See init.lua for license. + +]] + +--[[ + +Hydro containers (Tier 2) + +Defines canteens (currently two types, with different capacities), +tools which store hydro. They use wear to show their content +level in their durability bar; they do not disappear when used up. + +Wear corresponds to hydro level as follows: +- a wear of 0 shows no durability bar -> empty (initial state) +- a wear of 1 shows a full durability bar -> full +- a wear of 65535 shows an empty durability bar -> empty + +]] + +if minetest.get_modpath("default") and thirsty.config.register_canteens then + + minetest.register_tool('thirsty:steel_canteen', { + description = 'Steel canteen', + inventory_image = "thirsty_steel_canteen_16.png", + liquids_pointable = true, + stack_max = 1, + on_use = thirsty.on_use(nil), + }) + + minetest.register_tool('thirsty:bronze_canteen', { + description = 'Bronze canteen', + inventory_image = "thirsty_bronze_canteen_16.png", + liquids_pointable = true, + stack_max = 1, + on_use = thirsty.on_use(nil), + }) + + minetest.register_craft({ + output = "thirsty:steel_canteen", + recipe = { + { "group:wood", ""}, + { "main:steel_ingot", "main:steel_ingot"}, + { "main:steel_ingot", "main:steel_ingot"} + } + }) + +end + +--[[ + +Tier 3 + +]] + +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_drinking_fountain then + + minetest.register_node('thirsty:drinking_fountain', { + description = 'Drinking fountain', + drawtype = 'nodebox', + tiles = { + -- top, bottom, right, left, front, back + 'thirsty_drinkfount_top.png', + 'thirsty_drinkfount_bottom.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + 'thirsty_drinkfount_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + node_box = { + type = "fixed", + fixed = { + { -3/16, -8/16, -3/16, 3/16, 3/16, 3/16 }, + { -8/16, 3/16, -8/16, 8/16, 6/16, 8/16 }, + { -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 }, + { -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, + { -8/16, 6/16, -6/16, -6/16, 8/16, 6/16 }, + { 6/16, 6/16, -6/16, 8/16, 8/16, 6/16 }, + }, + }, + selection_box = { + type = "regular", + }, + collision_box = { + type = "regular", + }, + on_rightclick = thirsty.on_rightclick(nil), + }) + + minetest.register_craft({ + output = "thirsty:drinking_fountain", + recipe = { + { "default:stone", "bucket:bucket_water", "default:stone"}, + { "", "default:stone", ""}, + { "", "default:stone", ""} + } + }) + +end + +--[[ + +Tier 4+: the water fountains, plus extenders + +]] + +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_fountains then + + minetest.register_node('thirsty:water_fountain', { + description = 'Water fountain', + tiles = { + -- top, bottom, right, left, front, back + 'thirsty_waterfountain_top.png', + 'thirsty_waterfountain_top.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + 'thirsty_waterfountain_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + }) + + minetest.register_node('thirsty:water_extender', { + description = 'Water fountain extender', + tiles = { + 'thirsty_waterextender_top.png', + 'thirsty_waterextender_top.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + 'thirsty_waterextender_side.png', + }, + paramtype = 'light', + groups = { cracky = 2 }, + }) + + minetest.register_craft({ + output = "thirsty:water_fountain", + recipe = { + { "default:copper_ingot", "bucket:bucket_water", "default:copper_ingot"}, + { "", "default:copper_ingot", ""}, + { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} + } + }) + minetest.register_craft({ + output = "thirsty:water_extender", + recipe = { + { "", "bucket:bucket_water", ""}, + { "", "default:copper_ingot", ""}, + { "default:copper_ingot", "default:mese_crystal", "default:copper_ingot"} + } + }) + + + minetest.register_abm({ + nodenames = {'thirsty:water_fountain'}, + interval = 2, + chance = 5, + action = thirsty.fountain_abm, + }) + +end + +--[[ + +Tier 5 + +These amulets don't do much; the actual code is above, where +they are searched for in player's inventories + +]] + +if minetest.get_modpath("default") and minetest.get_modpath("bucket") and thirsty.config.register_amulets then + + minetest.register_craftitem('thirsty:injector', { + description = 'Water injector', + inventory_image = 'thirsty_injector.png', + }) + minetest.register_craft({ + output = "thirsty:injector", + recipe = { + { "default:diamond", "default:mese_crystal", "default:diamond"}, + { "default:mese_crystal", "bucket:bucket_water", "default:mese_crystal"}, + { "default:diamond", "default:mese_crystal", "default:diamond"} + } + }) + + minetest.register_craftitem('thirsty:extractor', { + description = 'Water extractor', + inventory_image = 'thirsty_extractor.png', + }) + minetest.register_craft({ + output = "thirsty:extractor", + recipe = { + { "default:mese_crystal", "default:diamond", "default:mese_crystal"}, + { "default:diamond", "bucket:bucket_water", "default:diamond"}, + { "default:mese_crystal", "default:diamond", "default:mese_crystal"} + } + }) + +end diff --git a/mods/thirsty/configuration.lua b/mods/thirsty/configuration.lua new file mode 100644 index 0000000..e769416 --- /dev/null +++ b/mods/thirsty/configuration.lua @@ -0,0 +1,64 @@ +--[[ + +Configuration from default, moddir and worlddir, in that order. + +See init.lua for license. + +]] + +-- change these for other mods +local M = thirsty +local modname = 'thirsty' +local fileroot = modname + +-- make sure config exists; keep constant reference to it +local C = M.config or {} +M.config = C + +local function try_config_file(filename) + --print("Config from "..filename) + local file, err = io.open(filename, 'r') + if file then + file:close() -- was just for checking existance + local confcode, err = loadfile(filename) + if confcode then + confcode() + if C ~= M.config then + -- M.config was overriden, merge + for key, value in pairs(M.config) do + if type(value) == 'table' and type(C[key]) == 'table' and not value.CLEAR then + for k, v in pairs(value) do + C[key][k] = value[k] + end + else + -- copy (not a table, or asked to clear) + C[key] = value + end + end + else + -- no override? Empty, or file knows what it is doing. + end + else + minetest.log("error", "Could not load " .. filename .. ": " .. err) + end + end +end + +-- read starting configuration from .default.conf +try_config_file(minetest.get_modpath(modname) .. "/" .. fileroot .. ".default.conf") + +-- next, install-specific copy in modpath +try_config_file(minetest.get_modpath(modname) .. "/" .. fileroot .. ".conf") + +-- last, world-specific copy in worldpath +try_config_file(minetest.get_worldpath() .. "/" .. fileroot .. ".conf") + +-- remove any special keys from tables +for key, value in pairs(C) do + if type(value) == 'table' then + value.CLEAR = nil + end +end + +-- write back +M.config = C diff --git a/mods/thirsty/depends.txt b/mods/thirsty/depends.txt new file mode 100644 index 0000000..e809f30 --- /dev/null +++ b/mods/thirsty/depends.txt @@ -0,0 +1,5 @@ +default? +bucket? +hud? +hudbars? +vessels? diff --git a/mods/thirsty/description.txt b/mods/thirsty/description.txt new file mode 100644 index 0000000..97a7be3 --- /dev/null +++ b/mods/thirsty/description.txt @@ -0,0 +1,2 @@ +A mod that adds a "thirst" mechanic, similar to hunger. + diff --git a/mods/thirsty/functions.lua b/mods/thirsty/functions.lua new file mode 100644 index 0000000..0a8902b --- /dev/null +++ b/mods/thirsty/functions.lua @@ -0,0 +1,405 @@ +--[[ + +Core functions for Thirsty. + +See init.lua for license. + +]] + +local PPA = thirsty.persistent_player_attributes + +PPA.register({ + name = 'thirsty_hydro', + min = 0, + max = 50, + default = 20, +}) + +function thirsty.on_joinplayer(player) + local name = player:get_player_name() + -- default entry for new players + if not thirsty.players[name] then + local pos = player:getpos() + thirsty.players[name] = { + last_pos = math.floor(pos.x) .. ':' .. math.floor(pos.z), + time_in_pos = 0.0, + pending_dmg = 0.0, + thirst_factor = 1.0, + } + end + thirsty.hud_init(player) +end + +function thirsty.on_dieplayer(player) + local name = player:get_player_name() + local pl = thirsty.players[name] + -- reset after death + PPA.set_value(player, 'thirsty_hydro', 20) + pl.pending_dmg = 0.0 + pl.thirst_factor = 1.0 +end + +--[[ + +Getters, setters and such + +]] + +function thirsty.drink(player, value, max) + -- if max is not specified, assume 20 + if not max then + max = 20 + end + local hydro = PPA.get_value(player, 'thirsty_hydro') + -- test whether we're not *above* max; + -- this function should not remove any overhydration + if hydro < max then + hydro = math.min(hydro + value, max) + --print("Drinking by "..value.." to "..hydro) + PPA.set_value(player, 'thirsty_hydro', hydro) + return true + end + return false +end + +function thirsty.get_hydro(player) + return PPA.get_value(player, 'thirsty_hydro') +end + +function thirsty.set_thirst_factor(player, factor) + local name = player:get_player_name() + local pl = thirsty.players[name] + pl.thirst_factor = factor +end + +function thirsty.get_thirst_factor(player) + local name = player:get_player_name() + local pl = thirsty.players[name] + return pl.thirst_factor +end + +--[[ + +Main Loop (Tier 0) + +]] + +function thirsty.main_loop(dtime) + -- get thirsty + thirsty.time_next_tick = thirsty.time_next_tick - dtime + while thirsty.time_next_tick < 0.0 do + -- time for thirst + thirsty.time_next_tick = thirsty.time_next_tick + thirsty.config.tick_time + for _,player in ipairs(minetest.get_connected_players()) do + + if player:get_hp() <= 0 then + -- dead players don't get thirsty, or full for that matter :-P + break + end + + local name = player:get_player_name() + local pos = player:getpos() + local pl = thirsty.players[name] + local hydro = PPA.get_value(player, 'thirsty_hydro') + + -- how long have we been standing "here"? + -- (the node coordinates in X and Z should be enough) + local pos_hash = math.floor(pos.x) .. ':' .. math.floor(pos.z) + if pl.last_pos == pos_hash then + pl.time_in_pos = pl.time_in_pos + thirsty.config.tick_time + else + -- you moved! + pl.last_pos = pos_hash + pl.time_in_pos = 0.0 + end + local pl_standing = pl.time_in_pos > thirsty.config.stand_still_for_drink + local pl_afk = pl.time_in_pos > thirsty.config.stand_still_for_afk + --print("Standing: " .. (pl_standing and 'true' or 'false' ) .. ", AFK: " .. (pl_afk and 'true' or 'false')) + + pos.y = pos.y + 0.1 + local node = minetest.get_node(pos) + local drink_per_second = thirsty.config.regen_from_node[node.name] or 0 + + -- fountaining (uses pos, slight changes ok) + for k, fountain in pairs(thirsty.fountains) do + local dx = fountain.pos.x - pos.x + local dy = fountain.pos.y - pos.y + local dz = fountain.pos.z - pos.z + local dist2 = dx * dx + dy * dy + dz * dz + local fdist = fountain.level * thirsty.config.fountain_distance_per_level -- max 100 nodes radius + --print (string.format("Distance from %s (%d): %f out of %f", k, fountain.level, math.sqrt(dist2), fdist )) + if dist2 < fdist * fdist then + -- in range, drink as if standing (still) in water + drink_per_second = math.max(thirsty.config.regen_from_fountain or 0, drink_per_second) + pl_standing = true + break -- no need to check the other fountains + end + end + + -- amulets + -- TODO: I *guess* we need to optimize this, but I haven't + -- measured it yet. No premature optimizations! + local pl_inv = player:get_inventory() + local extractor_max = 0.0 + local injector_max = 0.0 + local container_not_full = nil + local container_not_empty = nil + local inv_main = player:get_inventory():get_list('main') + for i, itemstack in ipairs(inv_main) do + local name = itemstack:get_name() + local injector_this = thirsty.config.injection_for_item[name] + if injector_this and injector_this > injector_max then + injector_max = injector_this + end + local extractor_this = thirsty.config.extraction_for_item[name] + if extractor_this and extractor_this > extractor_max then + extractor_max = extractor_this + end + if thirsty.config.container_capacity[name] then + local wear = itemstack:get_wear() + -- can be both! + if wear == 0 or wear > 1 then + container_not_full = { i, itemstack } + end + if wear > 0 and wear < 65534 then + container_not_empty = { i, itemstack } + end + end + end + if extractor_max > 0.0 and container_not_full then + local i = container_not_full[1] + local itemstack = container_not_full[2] + local capacity = thirsty.config.container_capacity[itemstack:get_name()] + local wear = itemstack:get_wear() + if wear == 0 then wear = 65535.0 end + local drink = extractor_max * thirsty.config.tick_time + local drinkwear = drink / capacity * 65535.0 + wear = wear - drinkwear + if wear < 1 then wear = 1 end + itemstack:set_wear(wear) + player:get_inventory():set_stack("main", i, itemstack) + end + if injector_max > 0.0 and container_not_empty then + local i = container_not_empty[1] + local itemstack = container_not_empty[2] + local capacity = thirsty.config.container_capacity[itemstack:get_name()] + local wear = itemstack:get_wear() + if wear == 0 then wear = 65535.0 end + local drink = injector_max * thirsty.config.tick_time + local drink_missing = 20 - hydro + drink = math.max(math.min(drink, drink_missing), 0) + local drinkwear = drink / capacity * 65535.0 + wear = wear + drinkwear + if wear > 65534 then wear = 65534 end + itemstack:set_wear(wear) + thirsty.drink(player, drink, 20) + hydro = PPA.get_value(player, 'thirsty_hydro') + player:get_inventory():set_stack("main", i, itemstack) + end + + + if drink_per_second > 0 and pl_standing then + -- Drinking from the ground won't give you more than max + thirsty.drink(player, drink_per_second * thirsty.config.tick_time, 20) + --print("Raising hydration by "..(drink_per_second*thirsty.config.tick_time).." to "..PPA.get_value(player, 'thirsty_hydro')) + else + if not pl_afk then + -- only get thirsty if not AFK + local amount = thirsty.config.thirst_per_second * thirsty.config.tick_time * pl.thirst_factor + PPA.set_value(player, 'thirsty_hydro', hydro - amount) + hydro = PPA.get_value(player, 'thirsty_hydro') + --print("Lowering hydration by "..amount.." to "..hydro) + end + end + + + -- should we only update the hud on an actual change? + thirsty.hud_update(player, hydro) + + -- damage, if enabled + if minetest.setting_getbool("enable_damage") then + -- maybe not the best way to do this, but it does mean + -- we can do anything with one tick loop + if hydro <= 0.0 and not pl_afk then + pl.pending_dmg = pl.pending_dmg + thirsty.config.damage_per_second * thirsty.config.tick_time + --print("Pending damage at " .. pl.pending_dmg) + if pl.pending_dmg > 1.0 then + local dmg = math.floor(pl.pending_dmg) + pl.pending_dmg = pl.pending_dmg - dmg + player:set_hp( player:get_hp() - dmg ) + end + else + -- forget any pending damage when not thirsty + pl.pending_dmg = 0.0 + end + end + end -- for players + + -- check fountains for expiration + for k, fountain in pairs(thirsty.fountains) do + fountain.time_until_check = fountain.time_until_check - thirsty.config.tick_time + if fountain.time_until_check <= 0 then + -- remove fountain, the abm will set it again + --print("Removing fountain at " .. k) + thirsty.fountains[k] = nil + end + end + + end +end + +--[[ + +General handler + +Most tools, nodes and craftitems use the same code, so here it is: + +]] + +function thirsty.drink_handler(player, itemstack, node) + local pl = thirsty.players[player:get_player_name()] + local hydro = PPA.get_value(player, 'thirsty_hydro') + local old_hydro = hydro + + -- selectors, always true, to make the following code easier + local item_name = itemstack and itemstack:get_name() or ':' + local node_name = node and node.name or ':' + + if thirsty.config.node_drinkable[node_name] then + -- we found something to drink! + local cont_level = thirsty.config.drink_from_container[item_name] or 0 + local node_level = thirsty.config.drink_from_node[node_name] or 0 + -- drink until level + local level = math.max(cont_level, node_level) + --print("Drinking to level " .. level) + thirsty.drink(player, level, level) + + -- fill container, if applicable + if thirsty.config.container_capacity[item_name] then + --print("Filling a " .. item_name .. " to " .. thirsty.config.container_capacity[item_name]) + itemstack:set_wear(1) -- "looks full" + end + + elseif thirsty.config.container_capacity[item_name] then + -- drinking from a container + if itemstack:get_wear() ~= 0 then + local capacity = thirsty.config.container_capacity[item_name] + local hydro_missing = 20 - hydro; + if hydro_missing > 0 then + local wear_missing = hydro_missing / capacity * 65535.0; + local wear = itemstack:get_wear() + local new_wear = math.ceil(math.max(wear + wear_missing, 1)) + if (new_wear > 65534) then + wear_missing = 65534 - wear + new_wear = 65534 + end + itemstack:set_wear(new_wear) + if wear_missing > 0 then -- rounding glitches? + thirsty.drink(player, wear_missing * capacity / 65535.0, 20) + hydro = PPA.get_value(player, 'thirsty_hydro') + end + end + end + end + + -- update HUD if value changed + if hydro ~= old_hydro then + thirsty.hud_update(player, hydro) + end +end + +--[[ + +Adapters for drink_handler to on_use and on_rightclick slots. +These close over the next handler to call in a chain, if desired. + +]] + +function thirsty.on_use( old_on_use ) + return function(itemstack, player, pointed_thing) + local node = nil + if pointed_thing and pointed_thing.type == 'node' then + node = minetest.get_node(pointed_thing.under) + end + + thirsty.drink_handler(player, itemstack, node) + + -- call original on_use, if provided + if old_on_use ~= nil then + return old_on_use(itemstack, player, pointed_thing) + else + return itemstack + end + end +end + +function thirsty.on_rightclick( old_on_rightclick ) + return function(pos, node, player, itemstack, pointed_thing) + + thirsty.drink_handler(player, itemstack, node) + + -- call original on_rightclick, if provided + if old_on_rightclick ~= nil then + return old_on_rightclick(pos, node, player, itemstack, pointed_thing) + else + return itemstack + end + end +end + +--[[ + +Adapter to add "drink_handler" to any item (node, tool, craftitem). + +]] + +function thirsty.augment_item_for_drinking( itemname, level ) + local new_definition = {} + -- we need to be able to point at the water + new_definition.liquids_pointable = true + -- call closure generator with original on_use handler + new_definition.on_use = thirsty.on_use( + minetest.registered_items[itemname].on_use + ) + -- overwrite the node definition with almost the original + minetest.override_item(itemname, new_definition) + + -- add configuration settings + thirsty.config.drink_from_container[itemname] = level +end + +function thirsty.fountain_abm(pos, node) + local fountain_count = 0 + local water_count = 0 + local total_count = 0 + for y = 0, thirsty.config.fountain_height do + for x = -y, y do + for z = -y, y do + local n = minetest.get_node({ + x = pos.x + x, + y = pos.y - y + 1, -- start one *above* the fountain + z = pos.z + z + }) + if n then + --print(string.format("%s at %d:%d:%d", n.name, pos.x+x, pos.y-y+1, pos.z+z)) + total_count = total_count + 1 + local type = thirsty.config.fountain_type[n.name] or '' + if type == 'f' then + fountain_count = fountain_count + 1 + elseif type == 'w' then + water_count = water_count + 1 + end + end + end + end + end + local level = math.min(thirsty.config.fountain_max_level, math.min(fountain_count, water_count)) + --print(string.format("Fountain (%d): %d + %d / %d", level, fountain_count, water_count, total_count)) + thirsty.fountains[string.format("%d:%d:%d", pos.x, pos.y, pos.z)] = { + pos = { x=pos.x, y=pos.y, z=pos.z }, + level = level, + -- time until check is 20 seconds, or twice the average + -- time until the abm ticks again. Should be enough. + time_until_check = 20, + } +end diff --git a/mods/thirsty/hud.conf.no_hunger b/mods/thirsty/hud.conf.no_hunger new file mode 100644 index 0000000..df4b15d --- /dev/null +++ b/mods/thirsty/hud.conf.no_hunger @@ -0,0 +1,40 @@ +--[[ + +Better HUD config file, without Hunger mod. + +This file mirrors the default settings of the Better HUD mod, +except that it moves the "breath" bar upwards to make room +for the "thirst" bar. + +Use this config file as a starting point if you *don't* have the +Hunger mod enabled. + +For more information, see hud.conf.example in the mods/hud +directory. + +]] + +HUD_SB_SIZE = { x = 24, y = 24 } + +--[[ Layout: + + ARMOR | (AIR) + HEALTH | THIRST + +]] + +HUD_HEALTH_POS = { x = 0.5, y = 1 } +HUD_HEALTH_OFFSET = { x = -262, y = -87 } + +-- not used +HUD_HUNGER_POS = { x = 0.5, y = 1 } +HUD_HUNGER_OFFSET = { x = 15, y = -133 } + +HUD_AIR_POS = { x = 0.5, y = 1 } +HUD_AIR_OFFSET = { x = 15, y = -110 } + +HUD_ARMOR_POS = { x = 0.5, y = 1 } +HUD_ARMOR_OFFSET = { x = -262, y = -110 } + +HUD_THIRST_POS = { x = 0.5, y = 1 } +HUD_THIRST_OFFSET = { x = 15, y = -87 } diff --git a/mods/thirsty/hud.conf.with_hunger b/mods/thirsty/hud.conf.with_hunger new file mode 100644 index 0000000..6565c8d --- /dev/null +++ b/mods/thirsty/hud.conf.with_hunger @@ -0,0 +1,43 @@ +--[[ + +Better HUD config file, with Hunger mod. + +This file mirrors the default settings of the Better HUD mod, +except that it moves the "breath" bar upwards to make room +for the "thirst" bar. + +Use this config file as a starting point if you *do* have the +Hunger mod enabled. + +For more information, see hud.conf.example in the mods/hud +directory. + +]] + +HUD_SB_SIZE = { x = 24, y = 24 } + +--[[ Layout: + + (AIR) + ARMOR | THIRST + HEALTH | HUNGER + +]] + +HUD_HEALTH_POS = { x = 0.5, y = 1 } +HUD_HEALTH_OFFSET = { x = -262, y = -87 } + +-- At the time of writing, the Hunger mod contains code to swap +-- the positions of "hunger" and "air", so these positions are +-- "un-swapped"... +HUD_HUNGER_POS = { x = 0.5, y = 1 } +HUD_HUNGER_OFFSET = { x = 15, y = -133 } + +HUD_AIR_POS = { x = 0.5, y = 1 } +HUD_AIR_OFFSET = { x = 15, y = -87 } + +HUD_ARMOR_POS = { x = 0.5, y = 1 } +HUD_ARMOR_OFFSET = { x = -262, y = -110 } + +HUD_THIRST_POS = { x = 0.5, y = 1 } +HUD_THIRST_OFFSET = { x = 15, y = -110 } diff --git a/mods/thirsty/hud.lua b/mods/thirsty/hud.lua new file mode 100644 index 0000000..c7c2f2a --- /dev/null +++ b/mods/thirsty/hud.lua @@ -0,0 +1,87 @@ +--[[ + +HUD definitions for Thirsty + +Optionally from one of the supported mods + +Any hud needs to define the following functions: + +- thirsty.hud_init(player) + Initialize the HUD for a new player. + +- thirsty.hud_update(player, value) + Display the new value "value" for the given player. "value" is + a floating point number, not necessarily bounded. You can use the + "thirsty.hud_clamp(value)" function to get an integer between 0 + and 20. + +]] + +local PPA = thirsty.persistent_player_attributes + +function thirsty.hud_clamp(value) + if value < 0 then + return 0 + elseif value > 20 then + return 20 + else + return math.ceil(value) + end +end + +if minetest.get_modpath("hudbars") then + hb.register_hudbar('thirst', 0xffffff, "Hydration", { + bar = 'thirsty_hudbars_bar.png', + icon = 'thirsty_cup_100_16.png' + }, 20, 20, false) + function thirsty.hud_init(player) + hb.init_hudbar(player, 'thirst', + thirsty.hud_clamp(PPA.get_value(player, 'thirsty_hydro')), + 20, false) + end + function thirsty.hud_update(player, value) + hb.change_hudbar(player, 'thirst', thirsty.hud_clamp(value), 20) + end +elseif minetest.get_modpath("hud") then + -- default positions follow [hud] defaults + local position = HUD_THIRST_POS or { x=0.5, y=1 } + local offset = HUD_THIRST_OFFSET or { x=15, y=-133} -- above AIR + hud.register('thirst', { + hud_elem_type = "statbar", + position = position, + text = "thirsty_cup_100_24.png", + background = "thirsty_cup_0_24.png", + number = 20, + max = 20, + size = HUD_SB_SIZE, -- by default { x=24, y=24 }, + offset = offset, + }) + function thirsty.hud_init(player) + -- automatic by [hud] + end + function thirsty.hud_update(player, value) + hud.change_item(player, 'thirst', { + number = thirsty.hud_clamp(value) + }) + end +else + -- 'builtin' hud + function thirsty.hud_init(player) + -- above breath bar, for now + local name = player:get_player_name() + thirsty.players[name].hud_id = player:hud_add({ + hud_elem_type = "statbar", + position = { x=0.5, y=1 }, + text = "thirsty_cup_100_24.png", + number = thirsty.hud_clamp(PPA.get_value(player, 'thirsty_hydro')), + direction = 0, + size = { x=24, y=24 }, + offset = { x=25, y=-(48+24+16+32)}, + }) + end + function thirsty.hud_update(player, value) + local name = player:get_player_name() + local hud_id = thirsty.players[name].hud_id + player:hud_change(hud_id, 'number', thirsty.hud_clamp(value)) + end +end diff --git a/mods/thirsty/init.lua b/mods/thirsty/init.lua new file mode 100644 index 0000000..d52e6b1 --- /dev/null +++ b/mods/thirsty/init.lua @@ -0,0 +1,91 @@ +--[[ + +Thirsty mod [thirsty] +========================== + +A mod that adds a "thirst" mechanic, similar to hunger. + +Copyright (C) 2015 Ben Deutsch + +License +------- + +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 + +Terminology: "Thirst" vs. "hydration" +------------------------------------- + +"Thirst" is the absence of "hydration" (a term suggested by +everamzah on the Minetest forums, thanks!). The overall mechanic +is still called "thirst", but the visible bar is that of +"hydration", filled with "hydro points". + +]] + +-- the main module variable +thirsty = { + + -- Configuration variables + config = { + -- configuration in thirsty.default.conf + }, + + -- the players' values + players = { + --[[ + name = { + last_pos = '-10:3', + time_in_pos = 0.0, + pending_dmg = 0.0, + thirst_factor = 1.0, + } + ]] + }, + + -- water fountains + fountains = { + --[[ + x:y:z = { + pos = { x=x, y=y, z=z }, + level = 4, + time_until_check = 20, + -- something about times + } + ]] + }, + + -- general settings + time_next_tick = 0.0, +} +local M = thirsty + +dofile(minetest.get_modpath('thirsty')..'/configuration.lua') +local C = M.config + +dofile(minetest.get_modpath('thirsty')..'/persistent_player_attributes.lua') +local PPA = M.persistent_player_attributes + +thirsty.time_next_tick = thirsty.config.tick_time + +dofile(minetest.get_modpath('thirsty')..'/hud.lua') +dofile(minetest.get_modpath('thirsty')..'/functions.lua') + +minetest.register_on_joinplayer(thirsty.on_joinplayer) +minetest.register_on_dieplayer(thirsty.on_dieplayer) +minetest.register_globalstep(thirsty.main_loop) + +dofile(minetest.get_modpath('thirsty')..'/components.lua') + diff --git a/mods/thirsty/persistent_player_attributes.lua b/mods/thirsty/persistent_player_attributes.lua new file mode 100644 index 0000000..78c69e7 --- /dev/null +++ b/mods/thirsty/persistent_player_attributes.lua @@ -0,0 +1,111 @@ +--[[ + +Persistent player attributes + +]] + +-- change this to inject into other module +local M = thirsty + +M.persistent_player_attributes = {} +local PPA = M.persistent_player_attributes + +--[[ +Helper functions that take care of the conversions *and* the +clamping for us +]] + +local function _count_for_val(value, def) + local count = math.floor((value - def.min) / (def.max - def.min) * 65535) + if count < 0 then count = 0 end + if count > 65535 then count = 65535 end + return count +end +local function _val_for_count(count, def) + local value = count / 65535 * (def.max - def.min) + def.min + if value < def.min then value = def.min end + if value > def.max then value = def.max end + return value +end +-- end helper functions + +-- the stash of registered attributes + +PPA.defs = {--[[ + name = { + name = "mymod_attr1", + min = 0, + max = 10, + default = 5, + }, +]]} + +PPA.read_cache = {--[[ + player_name = { + attr1 = value1, + attr2 = value2, + }, +]]} + +--[[ +How to register a new attribute, with named parameters: + PPA.register({ name = "mymod_attr1", min = 0, ... }) +]] + +PPA.register = function(def) + PPA.defs[def.name] = { + name = def.name, + min = def.min or 0.0, + max = def.max or 1.0, + default = def.default or def.min or 0.0, + } +end + +-- The on_joinplayer handler + +PPA.on_joinplayer = function(player) + local inv = player:get_inventory() + local player_name = player:get_player_name() + PPA.read_cache[player_name] = {} + for name, def in pairs(PPA.defs) do + inv:set_size(name, 1) + if inv:is_empty(name) then + -- set default value + inv:set_stack(name, 1, ItemStack({ name = ":", count = _count_for_val(def.default, def) })) + -- cache default value + PPA.read_cache[player_name][name] = def.default + end + end +end + +minetest.register_on_joinplayer(PPA.on_joinplayer) + + +--[[ get an attribute, procedural style: + local attr1 = PPA.get_value(player, "mymod_attr1") +]] + +PPA.get_value = function(player, name) + local player_name = player:get_player_name() + if PPA.read_cache[player_name][name] == nil then + local def = PPA.defs[name] + local inv = player:get_inventory() + local count = inv:get_stack(name, 1):get_count() + PPA.read_cache[player_name][name] = _val_for_count(count, def) + end + return PPA.read_cache[player_name][name] +end + +--[[ set an attribute, procedural style: + PPA.set_value(player, "mymod_attr1", attr1) +]] + +PPA.set_value = function(player, name, value) + local def = PPA.defs[name] + local inv = player:get_inventory() + local player_name = player:get_player_name() + if value > def.max then value = def.max end + if value < def.min then value = def.min end + PPA.read_cache[player_name][name] = value + inv:set_stack(name, 1, ItemStack({ name = ":", count = _count_for_val(value, def) })) +end diff --git a/mods/thirsty/textures/src/bowl.svg b/mods/thirsty/textures/src/bowl.svg new file mode 100644 index 0000000..1085aa3 --- /dev/null +++ b/mods/thirsty/textures/src/bowl.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/bronze_canteen.svg b/mods/thirsty/textures/src/bronze_canteen.svg new file mode 100644 index 0000000..3a33e99 --- /dev/null +++ b/mods/thirsty/textures/src/bronze_canteen.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/cup_0.svg b/mods/thirsty/textures/src/cup_0.svg new file mode 100644 index 0000000..037ec10 --- /dev/null +++ b/mods/thirsty/textures/src/cup_0.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/cup_100.svg b/mods/thirsty/textures/src/cup_100.svg new file mode 100644 index 0000000..7a081b2 --- /dev/null +++ b/mods/thirsty/textures/src/cup_100.svg @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/cup_50.svg b/mods/thirsty/textures/src/cup_50.svg new file mode 100644 index 0000000..fc380fe --- /dev/null +++ b/mods/thirsty/textures/src/cup_50.svg @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/drinkfount_bottom.svg b/mods/thirsty/textures/src/drinkfount_bottom.svg new file mode 100644 index 0000000..189a693 --- /dev/null +++ b/mods/thirsty/textures/src/drinkfount_bottom.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/mods/thirsty/textures/src/drinkfount_side.svg b/mods/thirsty/textures/src/drinkfount_side.svg new file mode 100644 index 0000000..d0b3f4c --- /dev/null +++ b/mods/thirsty/textures/src/drinkfount_side.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/drinkfount_top.svg b/mods/thirsty/textures/src/drinkfount_top.svg new file mode 100644 index 0000000..a9b1993 --- /dev/null +++ b/mods/thirsty/textures/src/drinkfount_top.svg @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/extractor.svg b/mods/thirsty/textures/src/extractor.svg new file mode 100644 index 0000000..f4c1112 --- /dev/null +++ b/mods/thirsty/textures/src/extractor.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/injector.svg b/mods/thirsty/textures/src/injector.svg new file mode 100644 index 0000000..0969a78 --- /dev/null +++ b/mods/thirsty/textures/src/injector.svg @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/steel_canteen.svg b/mods/thirsty/textures/src/steel_canteen.svg new file mode 100644 index 0000000..89f2f01 --- /dev/null +++ b/mods/thirsty/textures/src/steel_canteen.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/waterextender_side.svg b/mods/thirsty/textures/src/waterextender_side.svg new file mode 100644 index 0000000..fdf6326 --- /dev/null +++ b/mods/thirsty/textures/src/waterextender_side.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/mods/thirsty/textures/src/waterextender_top.svg b/mods/thirsty/textures/src/waterextender_top.svg new file mode 100644 index 0000000..5f80814 --- /dev/null +++ b/mods/thirsty/textures/src/waterextender_top.svg @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/waterfountain_side.svg b/mods/thirsty/textures/src/waterfountain_side.svg new file mode 100644 index 0000000..410234e --- /dev/null +++ b/mods/thirsty/textures/src/waterfountain_side.svg @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/src/waterfountain_top.svg b/mods/thirsty/textures/src/waterfountain_top.svg new file mode 100644 index 0000000..4db3923 --- /dev/null +++ b/mods/thirsty/textures/src/waterfountain_top.svg @@ -0,0 +1,1051 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mods/thirsty/textures/thirsty_bowl_16.png b/mods/thirsty/textures/thirsty_bowl_16.png new file mode 100644 index 0000000..c7b8df6 Binary files /dev/null and b/mods/thirsty/textures/thirsty_bowl_16.png differ diff --git a/mods/thirsty/textures/thirsty_bowl_32.png b/mods/thirsty/textures/thirsty_bowl_32.png new file mode 100644 index 0000000..147fa86 Binary files /dev/null and b/mods/thirsty/textures/thirsty_bowl_32.png differ diff --git a/mods/thirsty/textures/thirsty_bowl_64.png b/mods/thirsty/textures/thirsty_bowl_64.png new file mode 100644 index 0000000..c8de654 Binary files /dev/null and b/mods/thirsty/textures/thirsty_bowl_64.png differ diff --git a/mods/thirsty/textures/thirsty_bronze_canteen_16.png b/mods/thirsty/textures/thirsty_bronze_canteen_16.png new file mode 100644 index 0000000..6c1555c Binary files /dev/null and b/mods/thirsty/textures/thirsty_bronze_canteen_16.png differ diff --git a/mods/thirsty/textures/thirsty_bronze_canteen_32.png b/mods/thirsty/textures/thirsty_bronze_canteen_32.png new file mode 100644 index 0000000..1ec8c9f Binary files /dev/null and b/mods/thirsty/textures/thirsty_bronze_canteen_32.png differ diff --git a/mods/thirsty/textures/thirsty_cup_0_16.png b/mods/thirsty/textures/thirsty_cup_0_16.png new file mode 100644 index 0000000..9c080ba Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_0_16.png differ diff --git a/mods/thirsty/textures/thirsty_cup_0_24.png b/mods/thirsty/textures/thirsty_cup_0_24.png new file mode 100644 index 0000000..aea96a3 Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_0_24.png differ diff --git a/mods/thirsty/textures/thirsty_cup_0_32.png b/mods/thirsty/textures/thirsty_cup_0_32.png new file mode 100644 index 0000000..105a2ef Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_0_32.png differ diff --git a/mods/thirsty/textures/thirsty_cup_100.png b/mods/thirsty/textures/thirsty_cup_100.png new file mode 100644 index 0000000..a2b9e1c Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_100.png differ diff --git a/mods/thirsty/textures/thirsty_cup_100_16.png b/mods/thirsty/textures/thirsty_cup_100_16.png new file mode 100644 index 0000000..a2b9e1c Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_100_16.png differ diff --git a/mods/thirsty/textures/thirsty_cup_100_24.png b/mods/thirsty/textures/thirsty_cup_100_24.png new file mode 100644 index 0000000..ee283b8 Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_100_24.png differ diff --git a/mods/thirsty/textures/thirsty_cup_100_32.png b/mods/thirsty/textures/thirsty_cup_100_32.png new file mode 100644 index 0000000..effe6fd Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_100_32.png differ diff --git a/mods/thirsty/textures/thirsty_cup_50_16.png b/mods/thirsty/textures/thirsty_cup_50_16.png new file mode 100644 index 0000000..64f7581 Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_50_16.png differ diff --git a/mods/thirsty/textures/thirsty_cup_50_24.png b/mods/thirsty/textures/thirsty_cup_50_24.png new file mode 100644 index 0000000..c5c7c69 Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_50_24.png differ diff --git a/mods/thirsty/textures/thirsty_cup_50_32.png b/mods/thirsty/textures/thirsty_cup_50_32.png new file mode 100644 index 0000000..ac33d2c Binary files /dev/null and b/mods/thirsty/textures/thirsty_cup_50_32.png differ diff --git a/mods/thirsty/textures/thirsty_drinkfount_bottom.png b/mods/thirsty/textures/thirsty_drinkfount_bottom.png new file mode 100644 index 0000000..1dcaf56 Binary files /dev/null and b/mods/thirsty/textures/thirsty_drinkfount_bottom.png differ diff --git a/mods/thirsty/textures/thirsty_drinkfount_side.png b/mods/thirsty/textures/thirsty_drinkfount_side.png new file mode 100644 index 0000000..5b568e3 Binary files /dev/null and b/mods/thirsty/textures/thirsty_drinkfount_side.png differ diff --git a/mods/thirsty/textures/thirsty_drinkfount_top.png b/mods/thirsty/textures/thirsty_drinkfount_top.png new file mode 100644 index 0000000..2440cbd Binary files /dev/null and b/mods/thirsty/textures/thirsty_drinkfount_top.png differ diff --git a/mods/thirsty/textures/thirsty_extractor.png b/mods/thirsty/textures/thirsty_extractor.png new file mode 100644 index 0000000..1c32fee Binary files /dev/null and b/mods/thirsty/textures/thirsty_extractor.png differ diff --git a/mods/thirsty/textures/thirsty_hudbars_bar.png b/mods/thirsty/textures/thirsty_hudbars_bar.png new file mode 100644 index 0000000..7e57b4a Binary files /dev/null and b/mods/thirsty/textures/thirsty_hudbars_bar.png differ diff --git a/mods/thirsty/textures/thirsty_injector.png b/mods/thirsty/textures/thirsty_injector.png new file mode 100644 index 0000000..d75621e Binary files /dev/null and b/mods/thirsty/textures/thirsty_injector.png differ diff --git a/mods/thirsty/textures/thirsty_steel_canteen_16.png b/mods/thirsty/textures/thirsty_steel_canteen_16.png new file mode 100644 index 0000000..abcc2a7 Binary files /dev/null and b/mods/thirsty/textures/thirsty_steel_canteen_16.png differ diff --git a/mods/thirsty/textures/thirsty_steel_canteen_32.png b/mods/thirsty/textures/thirsty_steel_canteen_32.png new file mode 100644 index 0000000..024daf0 Binary files /dev/null and b/mods/thirsty/textures/thirsty_steel_canteen_32.png differ diff --git a/mods/thirsty/textures/thirsty_waterextender_side.png b/mods/thirsty/textures/thirsty_waterextender_side.png new file mode 100644 index 0000000..ee8ef5a Binary files /dev/null and b/mods/thirsty/textures/thirsty_waterextender_side.png differ diff --git a/mods/thirsty/textures/thirsty_waterextender_top.png b/mods/thirsty/textures/thirsty_waterextender_top.png new file mode 100644 index 0000000..a68aa44 Binary files /dev/null and b/mods/thirsty/textures/thirsty_waterextender_top.png differ diff --git a/mods/thirsty/textures/thirsty_waterfountain_side.png b/mods/thirsty/textures/thirsty_waterfountain_side.png new file mode 100644 index 0000000..310966a Binary files /dev/null and b/mods/thirsty/textures/thirsty_waterfountain_side.png differ diff --git a/mods/thirsty/textures/thirsty_waterfountain_top.png b/mods/thirsty/textures/thirsty_waterfountain_top.png new file mode 100644 index 0000000..b4f4529 Binary files /dev/null and b/mods/thirsty/textures/thirsty_waterfountain_top.png differ diff --git a/mods/thirsty/thirsty.default.conf b/mods/thirsty/thirsty.default.conf new file mode 100644 index 0000000..6fe27b2 --- /dev/null +++ b/mods/thirsty/thirsty.default.conf @@ -0,0 +1,193 @@ +--[[ + +Thirsty configuration +----------------------------- + +To modify the configuration without fear of it being overwritten +by an update of this mod, copy this file to + + thirsty.conf + +in the mod directory or the directory of a specific world, and +modify away. The mod will read configuration first from the +default file, then from the mod directory copy, and finally from +the world directory copy. + +The settings from these locations will be merged together in an +intelligent fashion. Normal entries in the config table will get +overwritten. Table entries (those with {} at the left of the =) +will get merged together, unless the special table entry 'CLEAR' +is given, with a true value. This merging does not go deeper than +one level, but this should be sufficient. + +]] + +thirsty.config = { + + --[[ The period, in seconds, in which this mod updates values. + Changing this will not directly affect other values, but + may change computation load or accuracy. + ]] + tick_time = 0.5, + + ------------------------------------------- + -- Tier 0: basics, and standing in water -- + ------------------------------------------- + + -- Thirst per second (full hydration is 20 hydro points) + thirst_per_second = 1.0 / 20.0, + + -- Damage per second if completely thirsty / out of hydration + damage_per_second = 1.0 / 10.0, + + --[[ How long in seconds you have to remain still to drink + from standing in water + ]] + stand_still_for_drink = 1.0, + + --[[ How long in seconds of not moving before a player is deemed + AFK (away from keyboard), such players no longer get thirsty + or damaged + ]] + stand_still_for_afk = 120.0, -- 2 Minutes + + --[[ regen_from_node is a table defining, for each node type, the + amount of hydro per second a player drinks by standing in it. + Assign 0 to stop a player from drinking from this node type. + ]] + regen_from_node = { + ['default:water_source'] = 0.5, + ['default:water_flowing'] = 0.5, + ['default:river_water_source'] = 0.5, + ['default:river_water_flowing'] = 0.5, + }, + + --------------------------------- + -- Tier 1: drinking with bowls -- + --------------------------------- + + --[[ node_drinkable: which nodes can we drink from, given a + container (a cup, a bowl etc.) + ]] + node_drinkable = { + ['default:water_source'] = true, + ['default:water_flowing'] = true, + ['default:river_water_source'] = true, + ['default:river_water_flowing'] = true, + ['thirsty:drinking_fountain'] = true, + }, + + --[[ drink_from_container: the hydration you drink to when + using each container. Remember that "full hydration" is + 20 points; these should be more to reward using them. + ]] + drink_from_container = { + ['thirsty:wooden_bowl'] = 25, + ['thirsty:steel_canteen'] = 25, + ['thirsty:bronze_canteen'] = 25, + }, + + ---------------------- + -- Tier 2: canteens -- + ---------------------- + + --[[ container_capacity: how much hydration each container + (canteens) can hold. Remember that "full hydration" is + 20 points + ]] + container_capacity = { + ['thirsty:steel_canteen'] = 40, + ['thirsty:bronze_canteen'] = 60, + }, + + -------------------------------- + -- Tier 3: drinking fountains -- + -------------------------------- + + --[[ drink_from_node: if you use one of these node + (i.e. fountains), even without cups or bowls, how full + will you get? + ]] + drink_from_node = { + ['thirsty:drinking_fountain'] = 30, + }, + + ------------------------------------- + -- Tier 4: free-standing fountains -- + ------------------------------------- + + --[[ fountain_type: when scanning the surroundings of fountains, + which nodes are "fountains" and which are "water"? You need + at least one "fountain" and one "water" per fountain level. + ]] + fountain_type = { + ['thirsty:water_fountain'] = 'f', + ['thirsty:water_extender'] = 'f', + ['default:water_source'] = 'w', + ['default:water_flowing'] = 'w', + ['default:river_water_source'] = 'w', + ['default:river_water_flowing'] = 'w', + }, + + --[[ Regeneration from being within a fountain's radius; see also + regen_from_node (it's as if you're standing in water) + ]] + regen_from_fountain = 0.5, + + -- How far should the fountain scanning pyramid go? + fountain_height = 4, + + -- The max level of a fountain + fountain_max_level = 20, + + --[[ How many nodes away can you still benefit from a fountain, + per fountain level + ]] + fountain_distance_per_level = 5, + + --------------------- + -- Tier 5: amulets -- + --------------------- + + --[[ How much hydration does a given item *extract* + (pull out of the air) + ]] + extraction_for_item = { + ['thirsty:extractor']= 0.6, + }, + + --[[ How much hydration does a given item *inject* + (fill you up with) + ]] + injection_for_item = { + ['thirsty:injector'] = 0.5, + }, + + --------------------------------------- + -- Toggle node and craft definitions -- + --------------------------------------- + + --[[ These flags enable or disable the predefined components + included in this mod. They do *not* enable or disable + the functionality. + ]] + + -- Should we augment the vessels from the "vessels" mod? + register_vessels = true, + + -- Add the wooden bowl and crafting recipe? + register_bowl = true, + + -- Add the canteens and crafting recipes? + register_canteens = true, + + -- Add the drinking fountain and crafting recipes? + register_drinking_fountain = true, + + -- Add the fountain and extenders and crafting recipes? + register_fountains = true, + + -- Add the amulets (extractor / injector) and crafting recipes? + register_amulets = true, + +} diff --git a/zombies/depends.txt b/zombies/depends.txt new file mode 100644 index 0000000..3fbaf4b --- /dev/null +++ b/zombies/depends.txt @@ -0,0 +1,3 @@ +mobs +main +cityscape? diff --git a/zombies/description.txt b/zombies/description.txt new file mode 100644 index 0000000..cadb2b4 --- /dev/null +++ b/zombies/description.txt @@ -0,0 +1 @@ +This mod adds several styles of zombies, that spawn mainly on broken nodes from Duane's Cityscape mod. diff --git a/zombies/init.lua b/zombies/init.lua new file mode 100644 index 0000000..0c9df2c --- /dev/null +++ b/zombies/init.lua @@ -0,0 +1,142 @@ +--A few tables to simplify. +Skins = { +{"zombie01.png"}, +{"zombie02.png"}, +{"zombie03.png"}, +{"zombie04.png"}, +} + +Inventory = { +{name = "main:dirt", chance = 2, min = 3, max = 5}, +--{name = "default:apple", chance = 4, min = 2, max = 5}, +--{name = "default:clay_lump", chance = 10, min = 1, max = 4}, +} + +Noise = { +random = "eating-brains", +attack = "groan", +} + +mobs:register_mob('zombies:1arm', { + type = "monster", + passive = false, + attack_type = "dogfight", + pathfinding = true, + reach = 2, + damage = 2, + hp_min = 3, + hp_max = 15, + armor = 80, + collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4}, + visual = "mesh", + mesh = "zombie_one-arm.b3d", + textures = Skins, + blood_texture = "mobs_blood.png", + makes_footstep_sound = true, + sounds = Noise, + walk_velocity = 2, + run_velocity = 8, + jump = true, + view_range = 25, + drops = Inventory, + lava_damage = 5, + light_damage = 0, + fall_damage = 2, + animation = { + speed_normal = 10, + speed_run = 25, + punch_speed = 20, + walk_start = 0, + walk_end = 20, + run_start = 0, + run_end = 20, + punch_start = 21, + punch_end = 51, + }, +}) + +mobs:register_mob('zombies:crawler', { + type = "monster", + passive = false, + attack_type = "dogfight", + pathfinding = true, + reach = 2, + damage = 1, + hp_min = 1, + hp_max = 10, + armor = 80, + collisionbox = {-0.5, -.5, -0.4, 0.5, 0.2, 0.4}, + visual = "mesh", + mesh = "zombie_crawler.b3d", + textures = Skins, + blood_texture = "mobs_blood.png", + makes_footstep_sound = true, + sounds = Noise, + walk_velocity = .5, + run_velocity = 1, + jump = true, + view_range = 15, + drops = Inventory, + lava_damage = 5, + light_damage = 0, + fall_damage = 2, + animation = { + speed_normal = 10, + speed_run = 10, + punch_speed = 60, + walk_start = 0, + walk_end = 40, + run_start = 0, + run_end = 40, + punch_start = 41, + punch_end = 71, + }, +}) + +mobs:register_mob('zombies:normal', { + type = "monster", + group_attack = true, + passive = false, + attack_type = "dogfight", + pathfinding = true, + reach = 3, + damage = 2, + hp_min = 4, + hp_max = 15, + armor = 80, + collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4}, + visual = "mesh", + mesh = "zombie_normal.b3d", + textures = Skins, + blood_texture = "mobs_blood.png", + blood_amount = 200, + makes_footstep_sound = true, + sounds = Noise, + walk_velocity = 4, + run_velocity = 8, + jump = true, + view_range = 30, + drops = Inventory, + lava_damage = 5, + light_damage = 0, + fall_damage = 2, + animation = { + speed_normal = 20, + speed_run = 80, + punch_speed = 20, + stand_start = 0, + stand_end = 40, + walk_start = 41, + walk_end = 101, + run_start = 41, + run_end = 101, + punch_start = 102, + punch_end = 142, + }, +}) + + +--Spawn Functions +mobs:register_spawn("zombies:1arm", {"main:stone", "main:dirt", "main:grass",},15, 0, 30, 10, 170, nil) +mobs:register_spawn("zombies:crawler", {"main:stone", "main:cobble", "main:grass",},15, 0, 30, 10, 170, nil) +mobs:register_spawn("zombies:normal", {"main:stone", "main:cobble", "main:grass",},15, 0, 40, 10, 170, nil) diff --git a/zombies/license.txt b/zombies/license.txt new file mode 100644 index 0000000..fb0b15a --- /dev/null +++ b/zombies/license.txt @@ -0,0 +1,6 @@ +Zombie model derived from the default player model. + +Textures Created by me, Nathan +CC by SA 3.0 + +Code copy/pasted with minor changes from Tenplus1's mob API, licensed as MIT. diff --git a/zombies/mod.conf b/zombies/mod.conf new file mode 100644 index 0000000..f018309 --- /dev/null +++ b/zombies/mod.conf @@ -0,0 +1 @@ +name = zombies diff --git a/zombies/models/Zombie.blend b/zombies/models/Zombie.blend new file mode 100644 index 0000000..e7ea31b Binary files /dev/null and b/zombies/models/Zombie.blend differ diff --git a/zombies/models/Zombie_base.blend b/zombies/models/Zombie_base.blend new file mode 100644 index 0000000..1830d61 Binary files /dev/null and b/zombies/models/Zombie_base.blend differ diff --git a/zombies/models/Zombie_crawler.blend b/zombies/models/Zombie_crawler.blend new file mode 100644 index 0000000..fc6fc82 Binary files /dev/null and b/zombies/models/Zombie_crawler.blend differ diff --git a/zombies/models/Zombie_one-arm.blend b/zombies/models/Zombie_one-arm.blend new file mode 100644 index 0000000..87f186c Binary files /dev/null and b/zombies/models/Zombie_one-arm.blend differ diff --git a/zombies/models/zombie_crawler.b3d b/zombies/models/zombie_crawler.b3d new file mode 100644 index 0000000..ac36890 Binary files /dev/null and b/zombies/models/zombie_crawler.b3d differ diff --git a/zombies/models/zombie_normal.b3d b/zombies/models/zombie_normal.b3d new file mode 100644 index 0000000..9a96df4 Binary files /dev/null and b/zombies/models/zombie_normal.b3d differ diff --git a/zombies/models/zombie_one-arm.b3d b/zombies/models/zombie_one-arm.b3d new file mode 100644 index 0000000..4cbdc5a Binary files /dev/null and b/zombies/models/zombie_one-arm.b3d differ diff --git a/zombies/screenshot.png b/zombies/screenshot.png new file mode 100644 index 0000000..f960973 Binary files /dev/null and b/zombies/screenshot.png differ diff --git a/zombies/sounds/eating-brains.ogg b/zombies/sounds/eating-brains.ogg new file mode 100644 index 0000000..296a9ac Binary files /dev/null and b/zombies/sounds/eating-brains.ogg differ diff --git a/zombies/sounds/groan.ogg b/zombies/sounds/groan.ogg new file mode 100644 index 0000000..f91a3be Binary files /dev/null and b/zombies/sounds/groan.ogg differ diff --git a/zombies/sounds/rattles.ogg b/zombies/sounds/rattles.ogg new file mode 100644 index 0000000..6497b47 Binary files /dev/null and b/zombies/sounds/rattles.ogg differ diff --git a/zombies/textures/zombie-base.kra b/zombies/textures/zombie-base.kra new file mode 100644 index 0000000..71fb908 Binary files /dev/null and b/zombies/textures/zombie-base.kra differ diff --git a/zombies/textures/zombie-base.png b/zombies/textures/zombie-base.png new file mode 100644 index 0000000..d11f67b Binary files /dev/null and b/zombies/textures/zombie-base.png differ diff --git a/zombies/textures/zombie-base.psd b/zombies/textures/zombie-base.psd new file mode 100644 index 0000000..923de9e Binary files /dev/null and b/zombies/textures/zombie-base.psd differ diff --git a/zombies/textures/zombie-base.xcf b/zombies/textures/zombie-base.xcf new file mode 100644 index 0000000..440f902 Binary files /dev/null and b/zombies/textures/zombie-base.xcf differ diff --git a/zombies/textures/zombie01.png b/zombies/textures/zombie01.png new file mode 100644 index 0000000..7116fa0 Binary files /dev/null and b/zombies/textures/zombie01.png differ diff --git a/zombies/textures/zombie02.png b/zombies/textures/zombie02.png new file mode 100644 index 0000000..3a92b80 Binary files /dev/null and b/zombies/textures/zombie02.png differ diff --git a/zombies/textures/zombie03.png b/zombies/textures/zombie03.png new file mode 100644 index 0000000..480b907 Binary files /dev/null and b/zombies/textures/zombie03.png differ diff --git a/zombies/textures/zombie04.png b/zombies/textures/zombie04.png new file mode 100644 index 0000000..e01310f Binary files /dev/null and b/zombies/textures/zombie04.png differ