Initial commit

master
Aaron Mitcham 2017-12-26 19:23:18 -06:00
commit 96616dd9f5
738 changed files with 30828 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

12
Changelog.txt Normal file
View File

@ -0,0 +1,12 @@
Version 0.3:
------------
- Fix dead tree generation
- Digged nodes are dropped and need to be collected by pressing "USE"-Key (default E)
- Fix some mapgen bugs and crashes
- Fix wheat bug (digging)
- Added zombies
- Reduce stack sizes (depending on context between 20 and 60)
- Added beds (currently no way to get wool for crafting)
- Chests in ruins (and coffins) cant be opened anymore (items are dropped when cracked)
- New formspec background
- Many, many smaller fixes and tweaks

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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) 2017 {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 <http://www.gnu.org/licenses/>.
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:
ZombieWar Copyright (C) 2017 Aaron Mitcham
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
<http://www.gnu.org/licenses/>.
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

31
README.txt Normal file
View File

@ -0,0 +1,31 @@
WASTELAND - a game for the Minetest game engine
===============================================
Version 0.3
A long time ago there where trees, grass and the ocean. But that is all gone, everything that is left is a WASTELAND and
YOU.
How to play:
------------
Your only chance to survive are the ruined houses you can find in the world. There you can find
usefull stuff to survive: Food, water, seeds and even saplings. But you wont find that in every ruin.
Some contain just food and just rarely you can find water or a sapling.
Seeds can rarely be dropped when digging the dry shrub, wood can be get from the dead trees or from ruins.
((Currently removed: Sand with minerals can be found in the dry out oceans which can be used to grow wheat, grass or trees faster.))
If you die there will be a grave with your stuff, also there are very (!) rarely spawning graves with stuff.
Keep in mind, you must eat or you will starve. And hunger comes faster than you think.
License of mods, textures, media and sounds)
--------------------------------------------
See README.txt in each mod directory for information about other authors.
everything else:
Copyright (C) 2013-2014 by BlockMen (WTFPL)
See "Changelog.txt" for version history

1
game.conf Normal file
View File

@ -0,0 +1 @@
name = ZombieWar

BIN
menu/header.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
menu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
menu/overlay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

2
minetest.conf Normal file
View File

@ -0,0 +1,2 @@
give_initial_stuff = true
creative_mode = true

View File

@ -0,0 +1,41 @@
=======================================
All code is from the Minetest Mod - Simple Shooter [shooter]
License Source Code: 2013 Stuart Jones - LGPL v2.1
Additional credit for code ideas taken from other mods:
-PilzAdam [throwing] for the throwing physics
License Textures: Stuart Jones - WTFPL
-basic_bow_hit.png
-basic_bow_arrow_uv.png
License Textures (from original throwing mod): PilzAdams - WTFPL
-basic_bow_arrow_inv.png
-basic_bow_inv.png
-basic_bow_loaded.png
License Textures (from 32px_alt folder): Napiophelios - CC-BY-SA 3.0
-basic_bow_arrow_inv.png
-basic_bow_inv.png
-basic_bow_loaded.png
Licence Models: Stuart Jones - CC-BY-SA 3.0
-basic_bow_arrow.b3d
-basic_bow_arrow.blend
Licence Models: p0ss
(http://opengameart.org/content/training-target)
-trainingtarget.blend
-trainingtarget.obj
License Sounds:
arrow sounds by qubodup (http://opengameart.org/) :
-basic_bow_arrow.ogg
CC-BY-SA 3.0
arrow sounds by artisticdude (http://opengameart.org/) :
-basic_bow_throw.ogg
CC-BY-SA 3.0
anything not mentioned by name : WTFPL

View File

@ -0,0 +1,14 @@
default
craft_guide
farming
creatures?
creeper?
kpgmobs?
mobs?
mobs_goblins?
ninja?
pmobs?
pyramids?
zombie?

523
mods/basic_bow/init.lua Normal file
View File

@ -0,0 +1,523 @@
--Basic Bow Mod [basic_bow] rev002
--All Code is from Stu's Shooter mod (crossbow)
--License Source Code: 2013 Stuart Jones - LGPL v2.1
basic_bow = {}
minetest.register_alias("bow", "basic_bow:wood_bow")
minetest.register_alias("arrow", "basicbow:arrow")
BASIC_BOW_USES = 300
BASIC_BOW_ARROW_TOOL_CAPS = {damage_groups={fleshy=4}}
BASIC_BOW_ARROW_LIFETIME = 60-- 1 minute
BASIC_BOW_ENABLE_PARTICLE_FX = true
BASIC_BOW_ENABLE_PROTECTION = false
BASIC_BOW_EXPLOSION_TEXTURE = "basic_bow_hit.png"
BASIC_BOW_ALLOW_NODES = true
BASIC_BOW_ALLOW_ENTITIES = true
BASIC_BOW_ALLOW_PLAYERS = true
BASIC_BOW_PLAYER_OFFSET = {x=0, y=1, z=0}
BASIC_BOW_ENTITY_OFFSET = {x=0, y=0, z=0}
BASIC_BOW_ENTITIES = {
"creatures:sheep",
"creatures:zombie",
"creeper:creeper",
"kpgmobs:cow",
"kpgmobs:deer",
"kpgmobs:horse",
"kpgmobs:horse2",
"kpgmobs:horse3",
"kpgmobs:horsearah1",
"kpgmobs:horseh1",
"kpgmobs:horsepegh1",
"kpgmobs:jeraf",
"kpgmobs:medved",
"kpgmobs:pumba",
"kpgmobs:rat",
"kpgmobs:sheep",
"kpgmobs:wolf",
"mobs:black_widow",
"mobs:chicken",
"mobs:cow",
"mobs:dirt_monster",
"mobs:dungeon_master",
"mobs:goat",
"mobs:kitten",
"mobs:mese_monster",
"mobs:npc",
"mobs:oerkki",
"mobs:pig",
"mobs:pumba",
"mobs:rat",
"mobs:rhino",
"mobs:sand_monster",
"mobs:senderman",
"mobs:sheep",
"mobs:snow_monster",
"mobs:spider",
"mobs:stone_monster",
"mobs:tarantula",
"mobs:tree_monster",
"mobs:zombie",
"mobs_animal:bee",
"mobs_animal:bunny",
"mobs_animal:chicken",
"mobs_animal:cow",
"mobs_animal:kitten",
"mobs_animal:rat",
"mobs_animal:sheep",
"mobs_animal:warthog",
"mobs_bat:bat",
"mobs_bear:medved",
"mobs_better_rat:rat",
"mobs_birds:bird_lg",
"mobs_birds:bird_sm",
"mobs_birds:gull",
"mobs_bugslive:bug",
"mobs_butterfly:butterfly",
"mobs_crocs:crocodile",
"mobs_crocs:crocodile_float",
"mobs_crocs:crocodile_swim",
"mobs_deer:deer",
"mobs_fish:clownfish",
"mobs_fish:tropical",
"mobs_giraffe:jeraf",
"mobs_goblins:goblin",
"mobs_goblins:goblin_coal",
"mobs_goblins:goblin_cobble",
"mobs_goblins:goblin_diamond",
"mobs_goblins:goblin_gold",
"mobs_goblins:goblin_iron",
"mobs_goblins:goblin_king",
"mobs_horse:horse",
"mobs_jellyfish:jellyfish",
"mobs_monster:dirt_monster",
"mobs_monster:dungeon_master",
"mobs_monster:lava_flan",
"mobs_monster:mese_monster",
"mobs_monster:oerkki",
"mobs_monster:sand_monster",
"mobs_monster:spider",
"mobs_monster:stone_monster",
"mobs_monster:tree_monster",
"mobs_mr_goat:goat",
"mobs_npc:npc",
"mobs_npc:trader",
"mobs_sharks:shark_lg",
"mobs_sharks:shark_md",
"mobs_sharks:shark_sm",
"mobs_snowman:snowman",
"mobs_turtles:seaturtle",
"mobs_turtles:turtle",
"mobs_wolf:dog",
"mobs_wolf:wolf",
"mr_goat:goat",
"ninja:ninja",
"pmobs:archer",
"pmobs:dog",
"pmobs:guard",
"pmobs:ninja",
"pmobs:npc",
"pmobs:npc_nurse",
"pmobs:npc_women",
"pmobs:wolf",
"pmobs:yeti",
"pyramids:mummy",
"zombie:zombie",
}
if minetest.is_singleplayer() == true then
BASIC_BOW_ALLOW_ENTITIES = true
BASIC_BOW_ALLOW_PLAYERS = true
end
local allowed_entities = {}
for _,v in ipairs(BASIC_BOW_ENTITIES) do
allowed_entities[v] = 1
end
local function get_dot_product(v1, v2)
return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z
end
local function get_particle_pos(p, v, d)
return vector.add(p, vector.multiply(v, {x=d, y=d, z=d}))
end
function basic_bow:spawn_particles(pos, texture)
if BASIC_BOW_ENABLE_PARTICLE_FX == true then
if type(texture) ~= "string" then
texture = BASIC_BOW_EXPLOSION_TEXTURE
end
local spread = {x=0.1, y=0.1, z=0.1}
minetest.add_particlespawner(15, 0.3,
vector.subtract(pos, spread), vector.add(pos, spread),
{x=-1, y=1, z=-1}, {x=1, y=2, z=1},
{x=-2, y=-2, z=-2}, {x=2, y=-2, z=2},
0.1, 0.75, 1, 2, false, texture
)
end
end
--[[
function --basic_bow:play_node_sound(node, pos)
local item = minetest.registered_items[node.name]
if item then
if item.sounds then
local spec = item.sounds.dug
if spec then
spec.pos = pos
minetest.sound_play(spec.name, spec)
end
end
end
end
]]
function basic_bow:punch_node(pos, def)
local node = minetest.get_node(pos)
if not node then
return
end
local item = minetest.registered_items[node.name]
if not item then
return
end
if BASIC_BOW_ENABLE_PROTECTION then
if minetest.is_protected(pos, def.name) then
return
end
end
if item.groups then
for k, v in pairs(def.groups) do
local level = item.groups[k] or 0
if level >= v then
minetest.remove_node(pos)
--basic_bow:play_node_sound(node, pos)
if item.tiles then
if item.tiles[1] then
basic_bow:spawn_particles(pos, item.tiles[1])
end
end
break
end
end
end
end
function basic_bow:is_valid_object(object)
if object then
if object:is_player() == true then
return BASIC_BOW_ALLOW_PLAYERS
end
if BASIC_BOW_ALLOW_ENTITIES == true then
local luaentity = object:get_luaentity()
if luaentity then
if luaentity.name then
if allowed_entities[luaentity.name] then
return true
end
end
end
end
end
end
function basic_bow:get_intersect_pos(ray, plane, collisionbox)
local v = vector.subtract(ray.pos, plane.pos)
local r1 = get_dot_product(v, plane.normal)
local r2 = get_dot_product(ray.dir, plane.normal)
if r2 ~= 0 then
local t = -(r1 / r2)
local td = vector.multiply(ray.dir, {x=t, y=t, z=t})
local pt = vector.add(ray.pos, td)
local pd = vector.subtract(pt, plane.pos)
if math.abs(pd.x) < collisionbox[4] and
math.abs(pd.y) < collisionbox[5] and
math.abs(pd.z) < collisionbox[6] then
return pt
end
end
end
function basic_bow:process_round(round)
local target = {object=nil, distance=10000}
local p1 = round.pos
local v1 = round.ray
for _,ref in ipairs(basic_bow.objects) do
local p2 = vector.add(ref.pos, ref.offset)
if p1 and p2 and ref.name ~= round.name then
local d = vector.distance(p1, p2)
if d < round.def.step and d < target.distance then
local ray = {pos=p1, dir=v1}
local plane = {pos=p2, normal={x=-1, y=0, z=-1}}
local pos = basic_bow:get_intersect_pos(ray, plane, ref.collisionbox)
if pos then
target.object = ref.object
target.pos = pos
target.distance = d
end
end
end
end
if target.object and target.pos then
local success, pos = minetest.line_of_sight(p1, target.pos, 1)
if success then
local user = minetest.get_player_by_name(round.name)
if user then
target.object:punch(user, nil, round.def.tool_caps, v1)
basic_bow:spawn_particles(target.pos, BASIC_BOW_EXPLOSION_TEXTURE)
end
return 1
elseif pos and BASIC_BOW_ALLOW_NODES == true then
basic_bow:punch_node(pos, round.def)
return 1
end
elseif BASIC_BOW_ALLOW_NODES == true then
local d = round.def.step
local p2 = vector.add(p1, vector.multiply(v1, {x=d, y=d, z=d}))
local success, pos = minetest.line_of_sight(p1, p2, 1)
if pos then
basic_bow:punch_node(pos, round.def)
return 1
end
end
end
local function get_animation_frame(dir)
local angle = math.atan(dir.y)
local frame = 90 - math.floor(angle * 360 / math.pi)
if frame < 1 then
frame = 1
elseif frame > 180 then
frame = 180
end
return frame
end
local function get_target_pos(p1, p2, dir, offset)
local d = vector.distance(p1, p2) - offset
local td = vector.multiply(dir, {x=d, y=d, z=d})
return vector.add(p1, td)
end
local function punch_object(puncher, object)
if puncher and basic_bow:is_valid_object(object) then
if puncher ~= object then
local dir = puncher:get_look_dir()
local p1 = puncher:getpos()
local p2 = object:getpos()
local tpos = get_target_pos(p1, p2, dir, 0)
basic_bow:spawn_particles(tpos, BASIC_BOW_EXPLOSION_TEXTURE)
object:punch(puncher, nil, BASIC_BOW_ARROW_TOOL_CAPS, dir)
end
end
end
local function stop_arrow(object, pos, stuck)
local acceleration = {x=0, y=-10, z=0}
if stuck == true then
pos = pos or object:getpos()
acceleration = {x=0, y=0, z=0}
object:moveto(pos)
end
object:set_properties({
physical = true,
collisionbox = {-1/8,-1/8,-1/8, 1/8,1/8,1/8},
})
object:setvelocity({x=0, y=0, z=0})
object:setacceleration(acceleration)
end
minetest.register_craftitem("basic_bow:arrow", {
description = "Arrow",
inventory_image = "basic_bow_arrow_inv.png",
})
minetest.register_entity("basic_bow:arrow_entity", {
physical = false,
visual = "mesh",
mesh = "basic_bow_arrow.b3d",
visual_size = {x=1.0, y=1.0},
textures = {
"basic_bow_arrow_uv.png",
},
timer = 0,
lifetime = BASIC_BOW_ARROW_LIFETIME,
player = nil,
state = "init",
node_pos = nil,
collisionbox = {0,0,0, 0,0,0},
on_activate = function(self, staticdata)
self.object:set_armor_groups({immortal=1})
if staticdata == "expired" then
self.object:remove()
end
end,
on_punch = function(self, puncher)
if puncher then
if puncher:is_player() then
local stack = "basic_bow:arrow"
local inv = puncher:get_inventory()
if inv:room_for_item("main", stack) then
inv:add_item("main", stack)
self.object:remove()
end
end
end
end,
on_step = function(self, dtime)
if self.state == "init" then
return
end
self.timer = self.timer + dtime
self.lifetime = self.lifetime - dtime
if self.lifetime < 0 then
self.object:remove()
return
elseif self.state == "dropped" then
return
elseif self.state == "stuck" then
if self.timer > 1 then
if self.node_pos then
local node = minetest.get_node(self.node_pos)
if node.name then
local item = minetest.registered_items[node.name]
if item then
if not item.walkable then
self.state = "dropped"
stop_arrow(self.object)
return
end
end
end
end
self.timer = 0
end
return
end
if self.timer > 0.2 then
local pos = self.object:getpos()
local dir = vector.normalize(self.object:getvelocity())
local frame = get_animation_frame(dir)
self.object:set_animation({x=frame, y=frame}, 0)
local objects = minetest.get_objects_inside_radius(pos, 5)
for _,obj in ipairs(objects) do
if basic_bow:is_valid_object(obj) then
local collisionbox = {-0.25,-1.0,-0.25, 0.25,0.8,0.25}
local offset = BASIC_BOW_PLAYER_OFFSET
if not obj:is_player() then
offset = BASIC_BOW_ENTITY_OFFSET
local ent = obj:get_luaentity()
if ent then
local def = minetest.registered_entities[ent.name]
collisionbox = def.collisionbox or collisionbox
end
end
local opos = vector.add(obj:getpos(), offset)
local ray = {pos=pos, dir=dir}
local plane = {pos=opos, normal={x=-1, y=0, z=-1}}
local ipos = basic_bow:get_intersect_pos(ray, plane, collisionbox)
if ipos then
punch_object(self.player, obj)
end
end
end
local p = vector.add(pos, vector.multiply(dir, {x=5, y=5, z=5}))
local _, npos = minetest.line_of_sight(pos, p, 1)
if npos then
local node = minetest.get_node(npos)
local tpos = get_target_pos(pos, npos, dir, 0.66)
self.node_pos = npos
self.state = "stuck"
stop_arrow(self.object, tpos, true)
minetest.sound_play("basic_bow_arrow", {pos = self.lastpos, gain = 0.08, max_hear_distance = 2})
end
self.timer = 0
end
end,
get_staticdata = function(self)
return "expired"
end,
})
minetest.register_tool("basic_bow:wood_bow", {
description = "Wood Bow",
inventory_image = "basic_bow_inv.png",
wield_image = "basic_bow_loaded.png",
on_use = function(itemstack, user, pointed_thing)
local inv = user:get_inventory()
if user:get_inventory():get_stack("main", user:get_wield_index()+1): get_name()=="basic_bow:arrow" then
if not minetest.setting_getbool("creative_mode") then
user:get_inventory():remove_item("main", "basic_bow:arrow 1")
end
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/BASIC_BOW_USES)
end
itemstack = "basic_bow:wood_bow 1 "..itemstack:get_wear()
local pos = user:getpos()
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.5
local obj = minetest.add_entity(pos, "basic_bow:arrow_entity")
local ent = nil
if obj then
ent = obj:get_luaentity()
end
if ent then
minetest.sound_play("basic_bow_throw", {object=obj, gain = 0.08})
local frame = get_animation_frame(dir)
obj:setyaw(yaw + math.pi)
obj:set_animation({x=frame, y=frame}, 0)
obj:setvelocity({x=dir.x * 14, y=dir.y * 14, z=dir.z * 14})
if pointed_thing.type ~= "nothing" then
local ppos = minetest.get_pointed_thing_position(pointed_thing, false)
local _, npos = minetest.line_of_sight(pos, ppos, 1)
if npos then
ppos = npos
pointed_thing.type = "node"
end
if pointed_thing.type == "object" then
punch_object(user, pointed_thing.ref)
elseif pointed_thing.type == "node" then
local node = minetest.get_node(ppos)
local tpos = get_target_pos(pos, ppos, dir, 0.66)
minetest.after(0.2, function(object, pos, npos)
ent.node_pos = npos
ent.state = "stuck"
stop_arrow(object, pos, true)
--basic_bow:play_node_sound(node)
minetest.sound_play("basic_bow_arrow", {gain = 0.08, max_hear_distance = 2})
end, obj, tpos, ppos)
return itemstack
end
end
obj:setacceleration({x=dir.x * -3, y=-5, z=dir.z * -3})
ent.player = ent.player or user
ent.state = "flight"
end
end
end
return itemstack
end,
})
minetest.register_craft({
output = "basic_bow:wood_bow",
recipe = {
{"farming:string", "group:wood", ""},
{"farming:string", "", "group:wood"},
{"farming:string", "group:wood", ""},
}
})
minetest.register_craft({
output = "basic_bow:arrow 20",
recipe = {
{"group:wood", "group:wood", "group:stone"},
}
})

View File

@ -0,0 +1,10 @@
Licence Models: Stuart Jones - CC-BY-SA 3.0
-basic_bow_arrow.b3d
-basic_bow_arrow.blend
Licence Models: p0ss
(http://opengameart.org/content/training-target)
-trainingtarget.blend
-trainingtarget.obj

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

View File

@ -0,0 +1,346 @@
# Blender v2.72 (sub 0) OBJ File: ''
# www.blender.org
mtllib untitled.mtl
o Cylinder
v -0.242712 0.962406 0.809921
v -0.242713 1.001104 1.002010
v -0.429880 0.943960 1.013523
v -0.429879 0.905262 0.821433
v -0.602079 0.852119 1.032025
v -0.602077 0.813422 0.839935
v -0.752691 0.729110 1.056806
v -0.752690 0.690412 0.864717
v -0.875930 0.579660 1.086915
v -0.875928 0.540963 0.894825
v -0.967058 0.409512 1.121192
v -0.967057 0.370816 0.929103
v -1.022574 0.225206 1.158322
v -1.022574 0.186510 0.966233
v -1.040345 0.033824 1.196878
v -1.040345 -0.004872 1.004788
v -1.019687 -0.157279 1.235377
v -1.019688 -0.195975 1.043287
v -0.961395 -0.340760 1.272341
v -0.961396 -0.379456 1.080251
v -0.867709 -0.509566 1.306349
v -0.867710 -0.548263 1.114259
v -0.742228 -0.657212 1.336093
v -0.742229 -0.695909 1.144004
v -0.589776 -0.778023 1.360432
v -0.589777 -0.816720 1.168343
v -0.416211 -0.908185 1.378429
v -0.416211 -0.906054 1.186340
v -0.228203 -0.921779 1.389393
v -0.228202 -0.930473 1.197304
v -0.032976 -0.922753 1.392903
v -0.032975 -0.939346 1.200813
v 0.161967 -0.918950 1.388823
v 0.161968 -0.927644 1.196734
v 0.349133 -0.895031 1.377311
v 0.349135 -0.900504 1.185222
v 0.521332 -0.769966 1.358809
v 0.521334 -0.808663 1.166719
v 0.671944 -0.646958 1.334028
v 0.671946 -0.685654 1.141938
v 0.795183 -0.497509 1.303920
v 0.795185 -0.536204 1.111830
v 0.886312 -0.327362 1.269642
v 0.886313 -0.366057 1.077552
v 0.941829 -0.143057 1.232513
v 0.941830 -0.181751 1.040422
v 0.959601 0.048325 1.193957
v 0.959600 0.009631 1.001866
v 0.938944 0.239428 1.155458
v 0.938943 0.200734 0.963367
v 0.880653 0.422908 1.118494
v 0.880651 0.384215 0.926403
v 0.786968 0.591716 1.084486
v 0.786965 0.553022 0.892395
v 0.661489 0.739362 1.054741
v 0.661484 0.700668 0.862651
v 0.509037 0.860174 1.030402
v 0.509032 0.821479 0.838312
v 0.335473 0.949508 1.012405
v 0.335466 0.910813 0.820315
v 0.147464 1.003933 1.001441
v 0.147457 0.965236 0.809351
v -0.047762 1.021355 0.997931
v -0.047771 0.982657 0.805841
v -0.593877 -0.066173 1.018948
v -0.597977 0.040939 0.998207
v -0.425323 0.072388 0.991870
v -0.420767 -0.095115 1.024779
v 0.344579 -0.089565 1.023661
v 0.340022 0.077938 0.990752
v 0.517233 -0.058115 1.017325
v 0.513132 0.048996 0.996583
v 0.429031 -0.915002 0.192302
v 0.642647 -0.915336 0.221824
v 0.647707 -0.917388 0.330906
v 0.434653 -0.917750 0.362985
v -0.509776 -0.917814 0.368647
v -0.723392 -0.917481 0.339125
v -0.728452 -0.915428 0.230043
v -0.515398 -0.915066 0.197964
vt 0.746028 0.019557
vt 0.781168 0.000000
vt 0.781023 0.029133
vt 0.745883 0.048689
vt 0.780983 0.075966
vt 0.745843 0.095523
vt 0.781050 0.138702
vt 0.745910 0.158258
vt 0.781221 0.214927
vt 0.746082 0.234484
vt 0.781491 0.301714
vt 0.746351 0.321270
vt 0.781847 0.395727
vt 0.746707 0.415283
vt 0.782278 0.493353
vt 0.747138 0.512909
vt 0.782765 0.590840
vt 0.747625 0.610396
vt 0.783291 0.684443
vt 0.748151 0.703999
vt 0.783835 0.770563
vt 0.748695 0.790119
vt 0.784376 0.845891
vt 0.749237 0.865448
vt 0.784894 0.907534
vt 0.749754 0.927091
vt 0.784016 0.973941
vt 0.750229 0.972678
vt 0.785782 0.980901
vt 0.751636 0.985158
vt 1.000000 0.019498
vt 0.969344 0.019624
vt 0.967940 0.009873
vt 0.996145 0.009756
vt 0.969338 0.000126
vt 0.999994 0.000000
vt 0.710421 0.000000
vt 0.744561 0.004257
vt 0.744000 0.016448
vt 0.709967 0.013833
vt 0.745503 0.080225
vt 0.710369 0.060668
vt 0.745754 0.142960
vt 0.710620 0.123404
vt 0.745843 0.219186
vt 0.710709 0.199630
vt 0.745767 0.305973
vt 0.710633 0.286417
vt 0.745528 0.399986
vt 0.710394 0.380431
vt 0.745136 0.497612
vt 0.710002 0.478057
vt 0.744606 0.595099
vt 0.709472 0.575544
vt 0.743959 0.688701
vt 0.708825 0.669146
vt 0.743219 0.774821
vt 0.708085 0.755266
vt 0.742414 0.850149
vt 0.707280 0.830594
vt 0.741576 0.911791
vt 0.706442 0.892236
vt 0.740737 0.957378
vt 0.705603 0.937822
vt 0.739928 0.985157
vt 0.704794 0.965601
vt 0.159012 0.028448
vt 0.159671 0.008797
vt 0.194376 0.000000
vt 0.193717 0.019651
vt 0.228409 0.010419
vt 0.227748 0.030070
vt 0.352397 0.426188
vt 0.352364 0.523814
vt 0.345562 0.621281
vt 0.345658 0.332154
vt 0.332251 0.714841
vt 0.332408 0.245326
vt 0.312943 0.800901
vt 0.313154 0.169040
vt 0.288380 0.876153
vt 0.193883 0.995563
vt 0.159319 1.000000
vt 0.125146 0.993941
vt 0.039243 0.870273
vt 0.019990 0.793986
vt 0.039454 0.238411
vt 0.064018 0.163159
vt 0.006739 0.707158
vt 0.020146 0.324471
vt 0.000000 0.613124
vt 0.006835 0.418031
vt 0.000033 0.515498
vt 0.359136 0.304119
vt 0.372543 0.686812
vt 0.359232 0.593250
vt 0.352397 0.398155
vt 0.352430 0.495782
vt 0.372387 0.217290
vt 0.391851 0.772874
vt 0.391641 0.141002
vt 0.416414 0.848127
vt 0.416158 0.078190
vt 0.445288 0.909680
vt 0.444445 0.014321
vt 0.477364 0.955168
vt 0.477046 0.002031
vt 0.511408 0.982842
vt 0.511350 0.000000
vt 0.546113 0.991639
vt 0.580146 0.981220
vt 0.545782 0.000409
vt 0.579151 0.007261
vt 0.612196 0.951986
vt 0.611902 0.073569
vt 0.641034 0.905061
vt 0.640776 0.135122
vt 0.665551 0.842248
vt 0.665340 0.210375
vt 0.684805 0.765960
vt 0.684648 0.296436
vt 0.698056 0.679130
vt 0.697959 0.389999
vt 0.704794 0.585094
vt 0.704762 0.487467
vt 0.272643 0.554878
vt 0.275137 0.500246
vt 0.259506 0.937705
vt 0.288637 0.106228
vt 0.245220 0.484125
vt 0.259799 0.059303
vt 0.227430 0.983192
vt 0.241646 0.569561
vt 0.106815 0.566378
vt 0.110389 0.480942
vt 0.092598 0.980009
vt 0.124967 0.056121
vt 0.063760 0.933085
vt 0.076898 0.550257
vt 0.079392 0.495625
vt 0.092892 0.101607
vt 0.078171 0.986933
vt 0.040510 0.987017
vt 0.788098 0.015935
vt 0.819229 0.000000
vt 0.823352 0.437914
vt 0.785782 0.437984
vt 0.889235 0.433909
vt 0.858079 0.419253
vt 0.855543 0.000000
vt 0.893205 0.000055
vt 0.282221 0.987698
vt 0.244664 0.987402
vt 0.946784 0.489877
vt 0.927775 0.435505
vt 0.925376 0.000000
vt 0.944847 0.000609
vt 0.895561 0.085027
vt 0.923608 0.505184
vt 0.893205 0.505901
vt 0.852239 0.508738
vt 0.823352 0.423685
vt 0.825154 0.000000
vt 0.855543 0.000744
vt 0.946784 0.054389
vt 0.965213 0.000000
vt 0.967940 0.493349
vt 0.948469 0.493975
vt 0.972392 0.030317
vt 0.991991 0.030389
vt 0.998449 0.041009
vt 0.967940 0.041010
vt 0.993998 0.030317
vt 0.974399 0.030246
vt 0.967940 0.019626
vt 0.998449 0.019624
usemtl Material.001_traingingtarget-tex.t
s off
f 1/1 2/2 3/3 4/4
f 4/4 3/3 5/5 6/6
f 6/6 5/5 7/7 8/8
f 8/8 7/7 9/9 10/10
f 10/10 9/9 11/11 12/12
f 12/12 11/11 13/13 14/14
f 14/14 13/13 15/15 16/16
f 16/16 15/15 17/17 18/18
f 18/18 17/17 19/19 20/20
f 20/20 19/19 21/21 22/22
f 22/22 21/21 23/23 24/24
f 24/24 23/23 25/25 26/26
f 26/26 25/25 27/27 28/28
f 28/28 27/27 29/29 30/30
f 30/31 29/32 31/33 32/34
f 32/34 31/33 33/35 34/36
f 34/37 33/38 35/39 36/40
f 36/40 35/39 37/41 38/42
f 38/42 37/41 39/43 40/44
f 40/44 39/43 41/45 42/46
f 42/46 41/45 43/47 44/48
f 44/48 43/47 45/49 46/50
f 46/50 45/49 47/51 48/52
f 48/52 47/51 49/53 50/54
f 50/54 49/53 51/55 52/56
f 52/56 51/55 53/57 54/58
f 54/58 53/57 55/59 56/60
f 56/60 55/59 57/61 58/62
f 58/62 57/61 59/63 60/64
f 60/64 59/63 61/65 62/66
f 62/67 61/68 63/69 64/70
f 2/71 1/72 64/70 63/69
f 14/73 16/74 18/75
f 12/76 14/73 18/75 20/77
f 10/78 12/76 20/77 22/79
f 8/80 10/78 22/79 24/81
f 64/70 1/72 30/82 32/83
f 32/83 34/84 62/67 64/70
f 40/85 42/86 54/87 56/88
f 42/86 44/89 52/90 54/87
f 44/89 46/91 50/92 52/90
f 46/91 48/93 50/92
f 43/94 51/95 49/96 45/97
f 45/97 49/96 47/98
f 41/99 53/100 51/95 43/94
f 39/101 55/102 53/100 41/99
f 37/103 57/104 55/102 39/101
f 35/105 59/106 57/104 37/103
f 33/107 61/108 59/106 35/105
f 31/109 63/110 61/108 33/107
f 2/111 63/110 31/109 29/112
f 2/111 29/112 27/113 3/114
f 3/114 27/113 25/115 5/116
f 5/116 25/115 23/117 7/118
f 7/118 23/117 21/119 9/120
f 9/120 21/119 19/121 11/122
f 11/122 19/121 17/123 13/124
f 13/124 17/123 15/125
f 65/126 66/127 8/80 24/81
f 26/128 65/126 24/81
f 66/127 6/129 8/80
f 6/129 66/127 67/130 4/131
f 65/126 26/128 28/132 68/133
f 30/82 1/72 67/130 68/133
f 67/130 1/72 4/131
f 68/133 28/132 30/82
f 69/134 70/135 62/67 34/84
f 36/136 69/134 34/84
f 70/135 60/137 62/67
f 38/138 71/139 69/134 36/136
f 72/140 58/141 60/137 70/135
f 72/140 71/139 40/85 56/88
f 58/141 72/140 56/88
f 71/139 38/138 40/85
f 72/140 70/135 73/142 74/143
f 69/144 71/145 75/146 76/147
f 65/148 68/149 77/150 78/151
f 67/130 66/127 79/152 80/153
f 66/154 65/155 78/156 79/157
f 68/158 67/156 80/159 77/160
f 70/161 69/162 76/163 73/164
f 71/165 72/166 74/167 75/168
f 75/169 74/170 73/171 76/172
f 79/173 78/174 77/175 80/176

View File

@ -0,0 +1,9 @@
License Sounds:
arrow sounds by qubodup (http://opengameart.org/) :
-basic_bow_arrow.ogg
CC-BY-SA 3.0
arrow sounds by artisticdude (http://opengameart.org/) :
-basic_bow_throw.ogg
CC-BY-SA 3.0

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
License Textures: Stuart Jones - WTFPL
-basic_bow_hit.png
-basic_bow_arrow_uv.png
License Textures (from original throwing mod): PilzAdams - WTFPL
-basic_bow_arrow_inv.png
-basic_bow_inv.png
-basic_bow_loaded.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

View File

@ -0,0 +1,8 @@
License Textures: Stuart Jones - WTFPL
-basic_bow_hit.png
-basic_bow_arrow_uv.png
License Textures (from original throwing mod): PilzAdams - WTFPL
-basic_bow_arrow_inv.png
-basic_bow_inv.png
-basic_bow_loaded.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

26
mods/beds/README.txt Normal file
View File

@ -0,0 +1,26 @@
Minetest Game mod: beds
=======================
See license.txt for license information.
Authors of source code
----------------------
Originally by BlockMen (MIT)
Various Minetest developers and contributors (MIT)
Authors of media (textures)
---------------------------
BlockMen (CC BY-SA 3.0)
This mod adds a bed to Minetest which allows to skip the night.
To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped
immediately. If playing multiplayer you get shown how many other players are in bed too,
if all players are sleeping the night gets skipped. The night skip can be forced if more
than 50% of the players are lying in bed and use this option.
Another feature is a controlled respawning. If you have slept in bed (not just lying in
it) your respawn point is set to the beds location and you will respawn there after
death.
You can disable the respawn at beds by setting "enable_bed_respawn = false" in
minetest.conf.
You can disable the night skip feature by setting "enable_bed_night_skip = false" in
minetest.conf or by using the /set command in-game.

167
mods/beds/api.lua Normal file
View File

@ -0,0 +1,167 @@
local reverse = true
local function destruct_bed(pos, n)
local node = minetest.get_node(pos)
local other
if n == 2 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.subtract(pos, dir)
elseif n == 1 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.add(pos, dir)
end
if reverse then
reverse = not reverse
minetest.remove_node(other)
minetest.check_for_falling(other)
else
reverse = not reverse
end
end
function beds.register_bed(name, def)
minetest.register_node(name .. "_bottom", {
description = def.description,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
drawtype = "nodebox",
tiles = def.tiles.bottom,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
local pos
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
pos = under
else
pos = pointed_thing.above
end
if minetest.is_protected(pos, placer:get_player_name()) and
not minetest.check_player_privs(placer, "protection_bypass") then
minetest.record_protection_violation(pos, placer:get_player_name())
return itemstack
end
local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
if not node_def or not node_def.buildable_to then
return itemstack
end
local dir = minetest.dir_to_facedir(placer:get_look_dir())
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
if minetest.is_protected(botpos, placer:get_player_name()) and
not minetest.check_player_privs(placer, "protection_bypass") then
minetest.record_protection_violation(botpos, placer:get_player_name())
return itemstack
end
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack
end
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
return itemstack
end,
on_destruct = function(pos)
destruct_bed(pos, 1)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
beds.on_rightclick(pos, clicker)
return itemstack
end,
on_rotate = function(pos, node, user, mode, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
minetest.record_protection_violation(p, user:get_player_name())
return false
end
if mode ~= screwdriver.ROTATE_FACE then
return false
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
local node_def = node3 and minetest.registered_nodes[node3.name]
if not node_def or not node_def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
minetest.record_protection_violation(newp, user:get_player_name())
return false
end
node.param2 = new_param2
-- do not remove_node here - it will trigger destroy_bed()
minetest.set_node(p, {name = "air"})
minetest.set_node(pos, node)
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
return true
end,
})
minetest.register_node(name .. "_top", {
drawtype = "nodebox",
tiles = def.tiles.top,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = def.sounds or default.node_sound_wood_defaults(),
drop = name .. "_bottom",
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
on_destruct = function(pos)
destruct_bed(pos, 2)
end,
})
minetest.register_alias(name, name .. "_bottom")
minetest.register_craft({
output = name,
recipe = def.recipe
})
end

104
mods/beds/beds.lua Normal file
View File

@ -0,0 +1,104 @@
-- Fancy shaped bed
beds.register_bed("beds:fancy_bed", {
description = "Fancy Bed",
inventory_image = "beds_bed_fancy.png",
wield_image = "beds_bed_fancy.png",
tiles = {
bottom = {
"beds_bed_top1.png",
"default_wood.png",
"beds_bed_side1.png",
"beds_bed_side1.png^[transformFX",
"default_wood.png",
"beds_bed_foot.png",
},
top = {
"beds_bed_top2.png",
"default_wood.png",
"beds_bed_side2.png",
"beds_bed_side2.png^[transformFX",
"beds_bed_head.png",
"default_wood.png",
}
},
nodebox = {
bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
},
top = {
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
}
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
{"", "", "group:stick"},
{"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"},
},
})
-- Simple shaped bed
beds.register_bed("beds:bed", {
description = "Simple Bed",
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {
"beds_bed_top_bottom.png^[transformR90",
"default_wood.png",
"beds_bed_side_bottom_r.png",
"beds_bed_side_bottom_r.png^[transformfx",
"beds_transparent.png",
"beds_bed_side_bottom.png"
},
top = {
"beds_bed_top_top.png^[transformR90",
"default_wood.png",
"beds_bed_side_top_r.png",
"beds_bed_side_top_r.png^[transformfx",
"beds_bed_side_top.png",
"beds_transparent.png",
}
},
nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
recipe = {
{"wool:red", "wool:red", "wool:white"},
{"group:wood", "group:wood", "group:wood"}
},
})
-- Aliases for PilzAdam's beds mod
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "beds:fancy_bed_bottom",
burntime = 13,
})
minetest.register_craft({
type = "fuel",
recipe = "beds:bed_bottom",
burntime = 12,
})

2
mods/beds/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
wool

220
mods/beds/functions.lua Normal file
View File

@ -0,0 +1,220 @@
local pi = math.pi
local player_in_bed = 0
local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
if enable_respawn == nil then
enable_respawn = true
end
-- Helper functions
local function get_look_yaw(pos)
local n = minetest.get_node(pos)
if n.param2 == 1 then
return pi / 2, n.param2
elseif n.param2 == 3 then
return -pi / 2, n.param2
elseif n.param2 == 0 then
return pi, n.param2
else
return 0, n.param2
end
end
local function is_night_skip_enabled()
local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
if enable_night_skip == nil then
enable_night_skip = true
end
return enable_night_skip
end
local function check_in_beds(players)
local in_bed = beds.player
if not players then
players = minetest.get_connected_players()
end
for n, player in ipairs(players) do
local name = player:get_player_name()
if not in_bed[name] then
return false
end
end
return #players > 0
end
local function lay_down(player, pos, bed_pos, state, skip)
local name = player:get_player_name()
local hud_flags = player:hud_get_flags()
if not player or not name then
return
end
-- stand up
if state ~= nil and not state then
local p = beds.pos[name] or nil
if beds.player[name] ~= nil then
beds.player[name] = nil
player_in_bed = player_in_bed - 1
end
-- skip here to prevent sending player specific changes (used for leaving players)
if skip then
return
end
if p then
player:setpos(p)
end
-- physics, eye_offset, etc
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_horizontal(math.random(1, 180) / 100)
default.player_attached[name] = false
player:set_physics_override(1, 1, 1)
hud_flags.wielditem = true
default.player_set_animation(player, "stand" , 30)
-- lay down
else
beds.player[name] = 1
beds.pos[name] = pos
player_in_bed = player_in_bed + 1
-- physics, eye_offset, etc
player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0})
local yaw, param2 = get_look_yaw(bed_pos)
player:set_look_horizontal(yaw)
local dir = minetest.facedir_to_dir(param2)
local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2}
player:set_physics_override(0, 0, 0)
player:setpos(p)
default.player_attached[name] = true
hud_flags.wielditem = false
default.player_set_animation(player, "lay" , 0)
end
player:hud_set_flags(hud_flags)
end
local function update_formspecs(finished)
local ges = #minetest.get_connected_players()
local form_n
local is_majority = (ges / 2) < player_in_bed
if finished then
form_n = beds.formspec .. "label[2.7,11; Good morning.]"
else
form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) ..
" of " .. tostring(ges) .. " players are in bed]"
if is_majority and is_night_skip_enabled() then
form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]"
end
end
for name,_ in pairs(beds.player) do
minetest.show_formspec(name, "beds_form", form_n)
end
end
-- Public functions
function beds.kick_players()
for name, _ in pairs(beds.player) do
local player = minetest.get_player_by_name(name)
lay_down(player, nil, nil, false)
end
end
function beds.skip_night()
minetest.set_timeofday(0.23)
end
function beds.on_rightclick(pos, player)
local name = player:get_player_name()
local ppos = player:getpos()
local tod = minetest.get_timeofday()
if tod > 0.2 and tod < 0.805 then
if beds.player[name] then
lay_down(player, nil, nil, false)
end
minetest.chat_send_player(name, "You can only sleep at night.")
return
end
-- move to bed
if not beds.player[name] then
lay_down(player, ppos, pos)
beds.set_spawns() -- save respawn positions when entering bed
else
lay_down(player, nil, nil, false)
end
if not is_sp then
update_formspecs(false)
end
-- skip the night and let all players stand up
if check_in_beds() then
minetest.after(2, function()
if not is_sp then
update_formspecs(is_night_skip_enabled())
end
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end)
end
end
-- Callbacks
-- Only register respawn callback if respawn enabled
if enable_respawn then
-- respawn player at bed if enabled and valid position is found
minetest.register_on_respawnplayer(function(player)
local name = player:get_player_name()
local pos = beds.spawn[name]
if pos then
player:setpos(pos)
return true
end
end)
end
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
lay_down(player, nil, nil, false, true)
beds.player[name] = nil
if check_in_beds() then
minetest.after(2, function()
update_formspecs(is_night_skip_enabled())
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end)
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "beds_form" then
return
end
if fields.quit or fields.leave then
lay_down(player, nil, nil, false)
update_formspecs(false)
end
if fields.force then
update_formspecs(is_night_skip_enabled())
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end
end)

17
mods/beds/init.lua Normal file
View File

@ -0,0 +1,17 @@
beds = {}
beds.player = {}
beds.pos = {}
beds.spawn = {}
beds.formspec = "size[8,15;true]" ..
"bgcolor[#080808BB; true]" ..
"button_exit[2,12;4,0.75;leave;Leave Bed]"
local modpath = minetest.get_modpath("beds")
-- Load files
dofile(modpath .. "/functions.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/beds.lua")
dofile(modpath .. "/spawns.lua")

60
mods/beds/license.txt Normal file
View File

@ -0,0 +1,60 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2014-2016 BlockMen
Copyright (C) 2014-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2014-2016 BlockMen
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

63
mods/beds/spawns.lua Normal file
View File

@ -0,0 +1,63 @@
local world_path = minetest.get_worldpath()
local org_file = world_path .. "/beds_spawns"
local file = world_path .. "/beds_spawns"
local bkwd = false
-- check for PA's beds mod spawns
local cf = io.open(world_path .. "/beds_player_spawns", "r")
if cf ~= nil then
io.close(cf)
file = world_path .. "/beds_player_spawns"
bkwd = true
end
function beds.read_spawns()
local spawns = beds.spawn
local input = io.open(file, "r")
if input and not bkwd then
repeat
local x = input:read("*n")
if x == nil then
break
end
local y = input:read("*n")
local z = input:read("*n")
local name = input:read("*l")
spawns[name:sub(2)] = {x = x, y = y, z = z}
until input:read(0) == nil
io.close(input)
elseif input and bkwd then
beds.spawn = minetest.deserialize(input:read("*all"))
input:close()
beds.save_spawns()
os.rename(file, file .. ".backup")
file = org_file
end
end
beds.read_spawns()
function beds.save_spawns()
if not beds.spawn then
return
end
local data = {}
local output = io.open(org_file, "w")
for k, v in pairs(beds.spawn) do
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k))
end
output:write(table.concat(data))
io.close(output)
end
function beds.set_spawns()
for name,_ in pairs(beds.player) do
local player = minetest.get_player_by_name(name)
local p = player:getpos()
-- but don't change spawn location if borrowing a bed
if not minetest.is_protected(p, name) then
beds.spawn[name] = p
end
end
beds.save_spawns()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

15
mods/boats/README.txt Normal file
View File

@ -0,0 +1,15 @@
Minetest Game mod: boats
========================
See license.txt for license information.
Authors of source code
----------------------
Originally by PilzAdam (MIT)
Various Minetest developers and contributors (MIT)
Authors of media (textures and model)
-------------------------------------
Textures: Zeg9 (CC BY-SA 3.0)
Model: thetoon and Zeg9 (CC BY-SA 3.0),
modified by PavelS(SokolovPavel) (CC BY-SA 3.0),
modified by sofar (CC BY-SA 3.0)

1
mods/boats/depends.txt Normal file
View File

@ -0,0 +1 @@
default

271
mods/boats/init.lua Normal file
View File

@ -0,0 +1,271 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
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 ^ 2 + v.z ^ 2)
end
--
-- Boat entity
--
local boat = {
physical = true,
-- Warning: Do not change the position of the collisionbox top surface,
-- lowering it causes the boat to fall through the world if underwater
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "boats_boat.obj",
textures = {"default_wood.png"},
driver = nil,
v = 0,
last_v = 0,
removed = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
default.player_attached[name] = false
default.player_set_animation(clicker, "stand" , 30)
local pos = clicker:getpos()
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
minetest.after(0.1, function()
clicker:setpos(pos)
end)
elseif not self.driver then
local attach = clicker:get_attach()
if attach and attach:get_luaentity() then
local luaentity = attach:get_luaentity()
if luaentity.driver then
luaentity.driver = nil
end
clicker:set_detach()
end
self.driver = clicker
clicker:set_attach(self.object, "",
{x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
default.player_attached[name] = true
minetest.after(0.2, function()
default.player_set_animation(clicker, "sit" , 30)
end)
clicker:set_look_horizontal(self.object:getyaw())
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
self.v = tonumber(staticdata)
end
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher)
if not puncher or not puncher:is_player() or self.removed then
return
end
if self.driver and puncher == self.driver then
self.driver = nil
puncher:set_detach()
default.player_attached[puncher:get_player_name()] = false
end
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
or not inv:contains_item("main", "boats:boat") then
local leftover = inv:add_item("main", "boats:boat")
-- if no room in inventory add a replacement boat to the world
if not leftover:is_empty() then
minetest.add_item(self.object:getpos(), leftover)
end
end
-- delay remove to ensure player is detached
minetest.after(0.1, function()
self.object:remove()
end)
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:getvelocity()) * get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
local yaw = self.object:getyaw()
if ctrl.up then
self.v = self.v + 0.1
elseif ctrl.down then
self.v = self.v - 0.1
end
if ctrl.left then
if self.v < 0 then
self.object:setyaw(yaw - (1 + dtime) * 0.03)
else
self.object:setyaw(yaw + (1 + dtime) * 0.03)
end
elseif ctrl.right then
if self.v < 0 then
self.object:setyaw(yaw + (1 + dtime) * 0.03)
else
self.object:setyaw(yaw - (1 + dtime) * 0.03)
end
end
end
local velo = self.object:getvelocity()
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
self.object:setpos(self.object:getpos())
return
end
local s = get_sign(self.v)
self.v = self.v - 0.02 * s
if s ~= get_sign(self.v) then
self.object:setvelocity({x = 0, y = 0, z = 0})
self.v = 0
return
end
if math.abs(self.v) > 5 then
self.v = 5 * get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y - 0.5
local new_velo
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
else
p.y = p.y + 1
if is_water(p) then
local y = self.object:getvelocity().y
if y >= 5 then
y = 5
elseif y < 0 then
new_acce = {x = 0, y = 20, z = 0}
else
new_acce = {x = 0, y = 5, z = 0}
end
new_velo = get_velocity(self.v, self.object:getyaw(), y)
self.object:setpos(self.object:getpos())
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y) + 0.5
self.object:setpos(pos)
new_velo = get_velocity(self.v, self.object:getyaw(), 0)
else
new_velo = get_velocity(self.v, self.object:getyaw(),
self.object:getvelocity().y)
self.object:setpos(self.object:getpos())
end
end
end
self.object:setvelocity(new_velo)
self.object:setacceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = "Boat",
inventory_image = "boats_inventory.png",
wield_image = "boats_wield.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
groups = {flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
if not is_water(pointed_thing.under) then
return itemstack
end
pointed_thing.under.y = pointed_thing.under.y + 0.5
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
if boat then
boat:setyaw(placer:get_look_horizontal())
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
{"", "", "" },
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})
minetest.register_craft({
type = "fuel",
recipe = "boats:boat",
burntime = 20,
})

63
mods/boats/license.txt Normal file
View File

@ -0,0 +1,63 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 PilzAdam
Copyright (C) 2012-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures and model)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2012-2016 Zeg9
Copyright (C) 2012-2016 thetoon
Copyright (C) 2012-2016 PavelS(SokolovPavel)
Copyright (C) 2016 sofar (sofar@foo-projects.org)
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,358 @@
# Blender v2.76 (sub 11) OBJ File: 'boat.blend'
# www.blender.org
mtllib boat.mtl
o boats_boat
v -6.786140 -3.033999 -9.415440
v -6.786140 -1.967150 -9.415440
v -6.786140 -1.967150 8.793510
v -6.786140 -3.033999 8.793510
v 5.732520 -1.967150 -9.415440
v 5.732520 -3.033999 -9.415440
v 5.732520 -3.033999 8.793510
v 5.732520 -1.967150 8.793510
v -2.233900 -3.033999 -9.415440
v -2.233900 -1.967150 -9.415440
v -2.233900 -1.967150 8.793510
v -2.233900 -3.033999 8.793510
v 2.318340 -3.033999 -9.415440
v 2.318340 -1.967150 -9.415440
v 2.318340 -1.967150 8.793510
v 2.318340 -3.033999 8.793510
v -3.371960 -3.033999 8.793510
v -3.371960 -1.967150 8.793510
v -3.371960 -1.967150 -9.415440
v -3.371960 -3.033999 -9.415440
v 2.318340 0.276645 8.793510
v 1.180280 -1.967150 8.793510
v 5.732520 0.276645 8.793510
v 5.732520 1.039180 8.793510
v 6.870580 0.276645 8.793510
v 6.870580 -1.967150 8.793510
v 2.318340 1.039180 8.793510
v 1.180280 0.276645 8.793510
v 1.180280 1.039180 8.793510
v 1.180280 -3.033999 8.793510
v -2.233900 0.276645 8.793510
v -3.371960 0.276645 8.793510
v -2.233900 1.039180 8.793510
v -3.371960 1.039180 8.793510
v -6.786140 0.276645 8.793510
v -7.786200 0.276645 8.793510
v -7.786200 -1.967150 8.793510
v -6.786140 1.039180 8.793510
v 1.180280 -1.967150 -9.415440
v 1.180280 -3.033999 -9.415440
v 2.318340 0.276645 -9.415440
v 1.180280 0.276645 -9.415440
v 2.318340 1.039180 -9.415440
v 5.732520 0.276645 -9.415440
v 6.870580 -1.967150 -9.415440
v 5.732520 1.039180 -9.415440
v 6.870580 0.276645 -9.415440
v 0.042220 1.039180 -9.415440
v 1.180280 1.039180 -9.415440
v 0.042220 -1.967150 -9.415440
v -1.095840 -1.967150 -9.415440
v -2.233900 0.276645 -9.415440
v -3.371960 0.276645 -9.415440
v -2.233900 1.039180 -9.415440
v -1.095840 1.039180 -9.415440
v -3.371960 1.039180 -9.415440
v -6.786140 0.276645 -9.415440
v -6.786140 1.039180 -9.415440
v -7.786200 -1.967150 -9.415440
v -7.786200 0.276645 -9.415440
v -1.095840 0.156645 -12.044100
v -1.095840 -4.601110 -9.415440
v -1.095840 1.039181 -10.802900
v -1.095840 2.868579 -10.802900
v -1.095840 2.868580 -7.883420
v -1.095840 3.746069 -12.034100
v -1.095840 3.746070 -7.883420
v -1.095840 0.156645 -14.294900
v -1.095840 -4.601110 -14.284900
v 0.042220 -4.601110 -14.284900
v 0.042220 -4.601110 -9.415440
v 0.042220 1.039181 -10.802900
v 0.042220 0.156645 -12.044100
v 0.042220 2.868579 -10.802900
v 0.042220 0.156645 -14.294900
v 0.042220 3.746069 -12.034100
v 0.042220 3.746070 -7.883420
v 0.042220 2.868580 -7.883420
v -1.096322 -3.033999 -9.415440
v 0.044046 -3.035397 -9.415440
vt 1.000000 0.187500
vt -1.000000 0.312500
vt 1.000000 0.312500
vt 0.687500 1.000000
vt 0.500000 0.875000
vt 0.500000 0.625000
vt -1.000000 0.062500
vt 1.000000 0.062500
vt 1.000000 -0.000000
vt -1.000000 0.125000
vt 1.000000 0.125000
vt 0.437500 0.125000
vt 0.312500 0.500000
vt 0.312500 0.125000
vt 1.000000 0.625000
vt -1.000000 0.500000
vt 1.000000 0.500000
vt 0.187500 0.687500
vt -0.187500 0.687500
vt -0.187500 0.312500
vt 1.000000 0.812500
vt -1.000000 0.937500
vt -1.000000 0.812500
vt 0.812500 0.687500
vt 1.187500 0.687500
vt 0.812500 0.312500
vt 1.000000 0.562500
vt 0.312500 0.437500
vt 1.000000 0.437500
vt 1.000000 0.750000
vt -1.000000 0.875000
vt -1.000000 0.750000
vt -1.000000 1.000000
vt 1.000000 1.000000
vt 0.437500 0.625000
vt 0.562500 0.437500
vt 0.562500 0.625000
vt -1.000000 0.437500
vt -1.000000 0.000000
vt 0.500000 0.062500
vt 0.375000 0.750000
vt 0.500000 0.750000
vt -1.000000 0.250000
vt -1.000000 0.687500
vt 1.000000 0.687500
vt 0.625000 0.375000
vt 1.000000 0.375000
vt 1.000000 0.250000
vt 1.000000 0.937500
vt 0.437500 0.812500
vt 0.312500 0.312500
vt 0.312500 0.812500
vt 0.437500 0.312500
vt 0.437500 0.437500
vt 0.687500 0.812500
vt 0.000000 0.687500
vt 0.000000 0.812500
vt -1.000000 0.562500
vt 0.875000 0.812500
vt 0.875000 0.687500
vt 0.250000 0.312500
vt 0.562500 0.187500
vt 0.250000 0.187500
vt -1.000000 0.187500
vt 0.312500 0.625000
vt 0.312500 0.187500
vt 0.312500 -0.187500
vt 1.000000 -0.187500
vt 0.687500 0.500000
vt -0.000000 1.000000
vt 0.000000 0.875000
vt 0.437500 0.500000
vt -1.000000 0.625000
vt 0.812500 0.187500
vt 1.187500 0.187500
vt 1.187500 0.312500
vt 1.312500 0.312500
vt 1.312500 0.687500
vt 0.687500 0.187500
vt 0.687500 0.312500
vt 1.187500 0.812500
vt 0.812500 0.812500
vt 0.187500 0.312500
vt 0.312500 0.687500
vt 0.687500 0.687500
vt -0.187500 0.187500
vt 0.187500 0.187500
vt -0.312500 0.687500
vt -0.312500 0.312500
vt 0.187500 0.812500
vt -0.187500 0.812500
vt 0.437500 0.687500
vt 0.437500 0.187500
vt 0.562500 0.812500
vt 0.562500 0.687500
vt 0.312500 0.562500
vt 1.000000 0.875000
vt 0.375000 0.062500
vt -1.000000 0.375000
vt 0.625000 0.500000
vt 0.875000 0.562500
vt 0.937500 0.812500
vt 0.937500 0.687500
vt 0.875000 0.937500
vt 0.562500 0.312500
vn -1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 -0.002100 -1.000000
vn 0.001200 -1.000000 0.000000
vn 0.000000 0.002800 -1.000000
vn -0.001200 -1.000000 0.000200
g boats_boat_boats_boat_None
usemtl None
s off
f 41/1/1 27/2/1 43/3/1
f 76/4/2 74/5/2 72/6/2
f 8/7/2 6/1/2 5/8/2
f 15/9/1 13/10/1 16/11/1
f 51/12/3 71/13/3 50/14/3
f 56/15/2 32/16/2 53/17/2
f 15/18/3 8/19/3 23/20/3
f 22/21/2 40/22/2 39/23/2
f 19/24/4 2/25/4 53/26/4
f 70/27/5 62/28/5 69/29/5
f 11/30/5 19/31/5 10/32/5
f 4/15/5 20/33/5 17/34/5
f 72/35/3 64/36/3 63/37/3
f 13/8/5 7/38/5 16/7/5
f 23/39/6 47/11/6 44/9/6
f 68/40/7 70/41/7 69/42/7
f 80/43/8 40/10/8 30/11/8
f 3/15/1 1/32/1 4/30/1
f 20/44/2 18/27/2 17/45/2
f 74/17/5 65/46/5 64/47/5
f 31/43/1 54/47/1 52/48/1
f 22/47/5 14/43/5 15/48/5
f 46/1/2 23/7/2 44/8/2
f 57/21/1 38/22/1 58/49/1
f 61/50/9 76/51/9 73/52/9
f 37/45/5 2/23/5 3/21/5
f 78/28/3 67/53/3 65/54/3
f 64/5/1 66/4/1 63/6/1
f 76/55/6 67/56/6 77/57/6
f 47/17/2 26/10/2 45/11/2
f 5/16/5 26/47/5 8/17/5
f 33/58/6 48/59/6 55/60/6
f 29/38/2 42/3/2 49/29/2
f 32/44/6 52/21/6 53/45/6
f 58/15/6 34/33/6 56/34/6
f 27/7/6 46/29/6 43/8/6
f 73/61/6 68/62/6 61/63/6
f 21/58/6 42/29/6 28/38/6
f 11/29/1 9/58/1 12/27/1
f 59/45/1 36/2/1 60/3/1
f 60/9/6 35/10/6 57/11/6
f 41/1/1 21/64/1 27/2/1
f 72/6/2 48/65/2 50/66/2
f 50/66/2 71/67/2 70/68/2
f 70/68/2 75/17/2 73/69/2
f 76/4/2 77/70/2 74/5/2
f 77/70/2 78/71/2 74/5/2
f 50/66/2 70/68/2 73/69/2
f 73/69/2 76/4/2 72/6/2
f 72/6/2 50/66/2 73/69/2
f 8/7/2 7/64/2 6/1/2
f 15/9/1 14/39/1 13/10/1
f 51/12/3 62/72/3 71/13/3
f 56/15/2 34/73/2 32/16/2
f 32/26/3 34/74/3 38/75/3
f 35/76/3 36/77/3 37/78/3
f 32/26/3 38/75/3 35/76/3
f 29/66/3 33/79/3 31/80/3
f 32/26/3 35/76/3 3/25/3
f 28/51/3 29/66/3 31/80/3
f 31/80/3 32/26/3 18/24/3
f 3/25/3 4/81/3 17/82/3
f 35/76/3 37/78/3 3/25/3
f 21/83/3 28/51/3 22/84/3
f 3/25/3 17/82/3 18/24/3
f 11/85/3 12/55/3 30/52/3
f 32/26/3 3/25/3 18/24/3
f 11/85/3 30/52/3 22/84/3
f 31/80/3 18/24/3 11/85/3
f 24/86/3 27/87/3 21/83/3
f 28/51/3 31/80/3 11/85/3
f 11/85/3 22/84/3 28/51/3
f 24/86/3 21/83/3 23/20/3
f 26/88/3 25/89/3 23/20/3
f 23/20/3 21/83/3 15/18/3
f 15/18/3 16/90/3 7/91/3
f 21/83/3 22/84/3 15/18/3
f 8/19/3 26/88/3 23/20/3
f 15/18/3 7/91/3 8/19/3
f 22/21/2 30/49/2 40/22/2
f 47/89/4 45/88/4 5/19/4
f 5/19/4 6/91/4 13/90/4
f 5/19/4 13/90/4 14/18/4
f 44/20/4 47/89/4 5/19/4
f 43/87/4 46/86/4 44/20/4
f 41/83/4 43/87/4 44/20/4
f 44/20/4 5/19/4 14/18/4
f 39/84/4 40/52/4 80/50/4
f 44/20/4 14/18/4 41/83/4
f 42/51/4 41/83/4 39/84/4
f 39/84/4 80/50/4 50/92/4
f 41/83/4 14/18/4 39/84/4
f 48/93/4 49/66/4 42/51/4
f 50/92/4 48/93/4 42/51/4
f 80/50/4 79/94/4 50/92/4
f 50/92/4 42/51/4 39/84/4
f 54/79/4 55/62/4 52/80/4
f 50/92/4 79/94/4 51/95/4
f 52/80/4 55/62/4 51/95/4
f 51/95/4 79/94/4 10/85/4
f 79/94/4 9/55/4 10/85/4
f 53/26/4 52/80/4 10/85/4
f 58/75/4 56/74/4 53/26/4
f 59/78/4 60/77/4 57/76/4
f 57/76/4 58/75/4 53/26/4
f 52/80/4 51/95/4 10/85/4
f 19/24/4 20/82/4 1/81/4
f 53/26/4 10/85/4 19/24/4
f 59/78/4 57/76/4 2/25/4
f 19/24/4 1/81/4 2/25/4
f 2/25/4 57/76/4 53/26/4
f 70/27/5 71/96/5 62/28/5
f 11/30/5 18/97/5 19/31/5
f 4/15/5 1/73/5 20/33/5
f 72/35/3 74/54/3 64/36/3
f 13/8/5 6/29/5 7/38/5
f 23/39/6 25/10/6 47/11/6
f 68/40/7 75/98/7 70/41/7
f 30/11/5 12/17/5 79/99/5
f 79/99/10 80/43/10 30/11/10
f 12/17/5 9/16/5 79/99/5
f 3/15/1 2/73/1 1/32/1
f 20/44/2 19/58/2 18/27/2
f 74/17/5 78/100/5 65/46/5
f 31/43/1 33/99/1 54/47/1
f 22/47/5 39/99/5 14/43/5
f 46/1/2 24/64/2 23/7/2
f 57/21/1 35/23/1 38/22/1
f 61/50/9 66/53/9 76/51/9
f 37/45/5 59/44/5 2/23/5
f 78/28/3 77/51/3 67/53/3
f 62/67/1 51/66/1 69/68/1
f 51/66/1 55/65/1 63/6/1
f 68/17/1 69/68/1 61/69/1
f 61/69/1 69/68/1 51/66/1
f 61/69/1 51/66/1 63/6/1
f 65/71/1 67/70/1 64/5/1
f 61/69/1 63/6/1 66/4/1
f 64/5/1 67/70/1 66/4/1
f 76/55/6 66/85/6 67/56/6
f 47/17/2 25/16/2 26/10/2
f 5/16/5 45/99/5 26/47/5
f 55/60/6 54/101/6 33/58/6
f 33/58/6 29/22/6 48/59/6
f 48/59/6 72/102/6 63/103/6
f 29/22/6 49/104/6 48/59/6
f 48/59/6 63/103/6 55/60/6
f 29/38/2 28/2/2 42/3/2
f 32/44/6 31/23/6 52/21/6
f 58/15/6 38/73/6 34/33/6
f 27/7/6 24/38/6 46/29/6
f 73/61/6 75/105/6 68/62/6
f 21/58/6 41/27/6 42/29/6
f 11/29/1 10/38/1 9/58/1
f 59/45/1 37/44/1 36/2/1
f 60/9/6 36/39/6 35/10/6

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

13
mods/bucket/README.txt Normal file
View File

@ -0,0 +1,13 @@
Minetest Game mod: bucket
=========================
See license.txt for license information.
Authors of source code
----------------------
Kahrl <kahrl@gmx.net> (LGPL 2.1)
celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
Various Minetest developers and contributors (LGPL 2.1)
Authors of media (textures)
---------------------------
ElementW (CC BY-SA 3.0)

2
mods/bucket/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default

215
mods/bucket/init.lua Normal file
View File

@ -0,0 +1,215 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
}
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a bucket")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- name = text description of the bucket item
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
-- source neighbour, even if defined as 'liquid_renewable = false'.
-- Needed to avoid creating holes in sloping rivers.
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
groups, force_renew)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
force_renew = force_renew,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
user and not user:get_player_control().sneak then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack)
end
local lpos
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
lpos = pointed_thing.under
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
lpos = pointed_thing.above
node = minetest.get_node_or_nil(lpos)
local above_ndef = node and minetest.registered_nodes[node.name]
if not above_ndef or not above_ndef.buildable_to then
-- do not remove the bucket with the liquid
return itemstack
end
end
if check_protection(lpos, user
and user:get_player_name()
or "", "place "..source) then
return
end
minetest.set_node(lpos, {name = source})
return ItemStack("bucket:bucket_empty")
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Bucket",
inventory_image = "bucket.png",
stack_max = 99,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
return user:get_wielded_item()
elseif pointed_thing.type ~= "node" then
-- do nothing if it's neither object nor node
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count()
if liquiddef ~= nil
and liquiddef.itemname ~= nil
and node.name == liquiddef.source then
if check_protection(pointed_thing.under,
user:get_player_name(),
"take ".. node.name) then
return
end
-- default set to return filled bucket
local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket
if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname)
else
local pos = user:getpos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end
-- force_renew requires a source neighbour
local source_neighbor = false
if liquiddef.force_renew then
source_neighbor =
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
end
if not (source_neighbor and liquiddef.force_renew) then
minetest.add_node(pointed_thing.under, {name = "air"})
end
return ItemStack(giving_back)
else
-- non-liquid nodes will have their on_punch triggered
local node_def = minetest.registered_nodes[node.name]
if node_def then
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
end
return user:get_wielded_item()
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
"Water Bucket",
{water_bucket = 1}
)
bucket.register_liquid(
"default:river_water_source",
"default:river_water_flowing",
"bucket:bucket_river_water",
"bucket_river_water.png",
"River Water Bucket",
{water_bucket = 1},
true
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
"Lava Bucket"
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})

51
mods/bucket/license.txt Normal file
View File

@ -0,0 +1,51 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2011-2016 Various Minetest developers and contributors
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2015-2016 ElementW
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

22
mods/carts/README.txt Normal file
View File

@ -0,0 +1,22 @@
Carts (formerly boost_cart)
==========================
Carts, based almost entirely on the mod boost_cart [1], which
itself is based on (and fully compatible with) the carts mod [2].
The model was originally designed by stujones11 [3] (CC-0).
Cart textures are based on original work from PixelBOX (WTFPL).
[1] https://github.com/SmallJoker/boost_cart/
[2] https://github.com/PilzAdam/carts/
[3] https://github.com/stujones11/railcart/
Features
----------
- A fast cart for your railway or roller coaster (up to 7 m/s!)
- Boost and brake rails
- Rail junction switching with the 'right-left' walking keys
- Handbrake with the 'back' key

403
mods/carts/cart_entity.lua Normal file
View File

@ -0,0 +1,403 @@
local cart_entity = {
physical = false, -- otherwise going uphill breaks
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "carts_cart.b3d",
visual_size = {x=1, y=1},
textures = {"carts_cart.png"},
driver = nil,
punched = false, -- used to re-send velocity and position
velocity = {x=0, y=0, z=0}, -- only used on punch
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch
old_pos = nil,
old_switch = 0,
railtype = nil,
attached_items = {}
}
function cart_entity:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self.driver and player_name == self.driver then
self.driver = nil
carts:manage_attachment(clicker, nil)
elseif not self.driver then
self.driver = player_name
carts:manage_attachment(clicker, self.object)
end
end
function cart_entity:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if string.sub(staticdata, 1, string.len("return")) ~= "return" then
return
end
local data = minetest.deserialize(staticdata)
if not data or type(data) ~= "table" then
return
end
self.railtype = data.railtype
if data.old_dir then
self.old_dir = data.old_dir
end
if data.old_vel then
self.old_vel = data.old_vel
end
end
function cart_entity:get_staticdata()
return minetest.serialize({
railtype = self.railtype,
old_dir = self.old_dir,
old_vel = self.old_vel
})
end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
if not self.railtype then
local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
-- Punched by non-player
if not puncher or not puncher:is_player() then
local cart_dir = carts:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
self.velocity = vector.multiply(cart_dir, 2)
self.punched = true
return
end
-- Player digs cart by sneak-punch
if puncher:get_player_control().sneak then
if self.sound_handle then
minetest.sound_stop(self.sound_handle)
end
-- Detach driver and items
if self.driver then
if self.old_pos then
self.object:setpos(self.old_pos)
end
local player = minetest.get_player_by_name(self.driver)
carts:manage_attachment(player, nil)
end
for _,obj_ in ipairs(self.attached_items) do
if obj_ then
obj_:set_detach()
end
end
-- Pick up cart
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(puncher:get_player_name()))
or not inv:contains_item("main", "carts:cart") then
local leftover = inv:add_item("main", "carts:cart")
-- If no room in inventory add a replacement cart to the world
if not leftover:is_empty() then
minetest.add_item(self.object:getpos(), leftover)
end
end
self.object:remove()
return
end
-- Player punches cart to alter velocity
local vel = self.object:getvelocity()
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > carts.punch_speed_max then
return
end
end
local punch_dir = carts:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = carts:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
local f = 2 * (time_from_last_punch / punch_interval)
self.velocity = vector.multiply(cart_dir, f)
self.old_dir = cart_dir
self.punched = true
end
local function rail_on_step_event(handler, obj, dtime)
if handler then
handler(obj, dtime)
end
end
-- sound refresh interval = 1.0sec
local function rail_sound(self, dtime)
if not self.sound_ttl then
self.sound_ttl = 1.0
return
elseif self.sound_ttl > 0 then
self.sound_ttl = self.sound_ttl - dtime
return
end
self.sound_ttl = 1.0
if self.sound_handle then
local handle = self.sound_handle
self.sound_handle = nil
minetest.after(0.2, minetest.sound_stop, handle)
end
local vel = self.object:getvelocity()
local speed = vector.length(vel)
if speed > 0 then
self.sound_handle = minetest.sound_play(
"carts_cart_moving", {
object = self.object,
gain = (speed / carts.speed_max) / 2,
loop = true,
})
end
end
local function get_railparams(pos)
local node = minetest.get_node(pos)
return carts.railparams[node.name] or {}
end
local function rail_on_step(self, dtime)
local vel = self.object:getvelocity()
if self.punched then
vel = vector.add(vel, self.velocity)
self.object:setvelocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then
return
end
local pos = self.object:getpos()
local update = {}
-- stop cart if velocity vector flips
if self.old_vel and self.old_vel.y == 0 and
(self.old_vel.x * vel.x < 0 or self.old_vel.z * vel.z < 0) then
self.old_vel = {x = 0, y = 0, z = 0}
self.old_pos = pos
self.object:setvelocity(vector.new())
self.object:setacceleration(vector.new())
rail_on_step_event(get_railparams(pos).on_step, self, dtime)
return
end
self.old_vel = vector.new(vel)
if self.old_pos and not self.punched then
local flo_pos = vector.round(pos)
local flo_old = vector.round(self.old_pos)
if vector.equals(flo_pos, flo_old) then
-- Do not check one node multiple times
return
end
end
local ctrl, player
-- Get player controls
if self.driver then
player = minetest.get_player_by_name(self.driver)
if player then
ctrl = player:get_player_control()
end
end
if self.old_pos then
-- Detection for "skipping" nodes
local found_path = carts:pathfinder(
pos, self.old_pos, self.old_dir, ctrl, self.old_switch, self.railtype
)
if not found_path then
-- No rail found: reset back to the expected position
pos = vector.new(self.old_pos)
update.pos = true
end
end
local cart_dir = carts:velocity_to_dir(vel)
local railparams
-- dir: New moving direction of the cart
-- switch_keys: Currently pressed L/R key, used to ignore the key on the next rail node
local dir, switch_keys = carts:get_rail_direction(
pos, cart_dir, ctrl, self.old_switch, self.railtype
)
local new_acc = {x=0, y=0, z=0}
if vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x = 0, y = 0, z = 0}
pos = vector.round(pos)
update.pos = true
update.vel = true
else
-- Direction change detected
if not vector.equals(dir, self.old_dir) then
vel = vector.multiply(dir, math.abs(vel.x + vel.z))
update.vel = true
if dir.y ~= self.old_dir.y then
pos = vector.round(pos)
update.pos = true
end
end
-- Center on the rail
if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then
pos.x = math.floor(pos.x + 0.5)
update.pos = true
end
if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then
pos.z = math.floor(pos.z + 0.5)
update.pos = true
end
-- Slow down or speed up..
local acc = dir.y * -4.0
-- Get rail for corrected position
railparams = get_railparams(pos)
-- no need to check for railparams == nil since we always make it exist.
local speed_mod = railparams.acceleration
if speed_mod and speed_mod ~= 0 then
-- Try to make it similar to the original carts mod
acc = acc + speed_mod
else
-- Handbrake or coast
if ctrl and ctrl.down then
acc = acc - 3
else
acc = acc - 0.4
end
end
new_acc = vector.multiply(dir, acc)
end
-- Limits
local max_vel = carts.speed_max
for _, v in pairs({"x","y","z"}) do
if math.abs(vel[v]) > max_vel then
vel[v] = carts:get_sign(vel[v]) * max_vel
new_acc[v] = 0
update.vel = true
end
end
self.object:setacceleration(new_acc)
self.old_pos = vector.new(pos)
if not vector.equals(dir, {x=0, y=0, z=0}) then
self.old_dir = vector.new(dir)
end
self.old_switch = switch_keys
if self.punched then
-- Collect dropped items
for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and
obj_:get_luaentity() and
not obj_:get_luaentity().physical_state and
obj_:get_luaentity().name == "__builtin:item" then
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
self.attached_items[#self.attached_items + 1] = obj_
end
end
self.punched = false
update.vel = true
end
railparams = railparams or get_railparams(pos)
if not (update.vel or update.pos) then
rail_on_step_event(railparams.on_step, self, dtime)
return
end
local yaw = 0
if self.old_dir.x < 0 then
yaw = 0.5
elseif self.old_dir.x > 0 then
yaw = 1.5
elseif self.old_dir.z < 0 then
yaw = 1
end
self.object:setyaw(yaw * math.pi)
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
self.object:setvelocity(vel)
if update.pos then
self.object:setpos(pos)
end
-- call event handler
rail_on_step_event(railparams.on_step, self, dtime)
end
function cart_entity:on_step(dtime)
rail_on_step(self, dtime)
rail_sound(self, dtime)
end
minetest.register_entity("carts:cart", cart_entity)
minetest.register_craftitem("carts:cart", {
description = "Cart (Sneak+Click to pick up)",
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
wield_image = "carts_cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if not pointed_thing.type == "node" then
return
end
if carts:is_rail(pointed_thing.under) then
minetest.add_entity(pointed_thing.under, "carts:cart")
elseif carts:is_rail(pointed_thing.above) then
minetest.add_entity(pointed_thing.above, "carts:cart")
else
return
end
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
{pos = pointed_thing.above})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(placer:get_player_name())) then
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})

1
mods/carts/depends.txt Normal file
View File

@ -0,0 +1 @@
default

221
mods/carts/functions.lua Normal file
View File

@ -0,0 +1,221 @@
function carts:get_sign(z)
if z == 0 then
return 0
else
return z / math.abs(z)
end
end
function carts:manage_attachment(player, obj)
if not player then
return
end
local status = obj ~= nil
local player_name = player:get_player_name()
if default.player_attached[player_name] == status then
return
end
default.player_attached[player_name] = status
if status then
player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0})
player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0})
else
player:set_detach()
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
end
end
function carts:velocity_to_dir(v)
if math.abs(v.x) > math.abs(v.z) then
return {x=carts:get_sign(v.x), y=carts:get_sign(v.y), z=0}
else
return {x=0, y=carts:get_sign(v.y), z=carts:get_sign(v.z)}
end
end
function carts:is_rail(pos, railtype)
local node = minetest.get_node(pos).name
if node == "ignore" then
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(pos, pos)
local area = VoxelArea:new{
MinEdge = emin,
MaxEdge = emax,
}
local data = vm:get_data()
local vi = area:indexp(pos)
node = minetest.get_name_from_content_id(data[vi])
end
if minetest.get_item_group(node, "rail") == 0 then
return false
end
if not railtype then
return true
end
return minetest.get_item_group(node, "connect_to_raillike") == railtype
end
function carts:check_front_up_down(pos, dir_, check_up, railtype)
local dir = vector.new(dir_)
local cur
-- Front
dir.y = 0
cur = vector.add(pos, dir)
if carts:is_rail(cur, railtype) then
return dir
end
-- Up
if check_up then
dir.y = 1
cur = vector.add(pos, dir)
if carts:is_rail(cur, railtype) then
return dir
end
end
-- Down
dir.y = -1
cur = vector.add(pos, dir)
if carts:is_rail(cur, railtype) then
return dir
end
return nil
end
function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
local pos = vector.round(pos_)
local cur
local left_check, right_check = true, true
-- Check left and right
local left = {x=0, y=0, z=0}
local right = {x=0, y=0, z=0}
if dir.z ~= 0 and dir.x == 0 then
left.x = -dir.z
right.x = dir.z
elseif dir.x ~= 0 and dir.z == 0 then
left.z = dir.x
right.z = -dir.x
end
if ctrl then
if old_switch == 1 then
left_check = false
elseif old_switch == 2 then
right_check = false
end
if ctrl.left and left_check then
cur = carts:check_front_up_down(pos, left, false, railtype)
if cur then
return cur, 1
end
left_check = false
end
if ctrl.right and right_check then
cur = carts:check_front_up_down(pos, right, false, railtype)
if cur then
return cur, 2
end
right_check = true
end
end
-- Normal
cur = carts:check_front_up_down(pos, dir, true, railtype)
if cur then
return cur
end
-- Left, if not already checked
if left_check then
cur = carts:check_front_up_down(pos, left, false, railtype)
if cur then
return cur
end
end
-- Right, if not already checked
if right_check then
cur = carts:check_front_up_down(pos, right, false, railtype)
if cur then
return cur
end
end
-- Backwards
if not old_switch then
cur = carts:check_front_up_down(pos, {
x = -dir.x,
y = dir.y,
z = -dir.z
}, true, railtype)
if cur then
return cur
end
end
return {x=0, y=0, z=0}
end
function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
local pos = vector.round(pos_)
local pf_pos = vector.round(old_pos)
local pf_dir = vector.new(old_dir)
for i = 1, 3 do
if vector.equals(pf_pos, pos) then
-- Success! Cart moved on correctly
return true
end
pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
-- No way forwards
return false
end
pf_pos = vector.add(pf_pos, pf_dir)
end
-- Cart not found
return false
end
function carts:register_rail(name, def_overwrite, railparams)
local def = {
drawtype = "raillike",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
sounds = default.node_sound_metal_defaults()
}
for k, v in pairs(def_overwrite) do
def[k] = v
end
if not def.inventory_image then
def.wield_image = def.tiles[1]
def.inventory_image = def.tiles[1]
end
if railparams then
carts.railparams[name] = table.copy(railparams)
end
minetest.register_node(name, def)
end
function carts:get_rail_groups(additional_groups)
-- Get the default rail groups and add more when a table is given
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1}
if type(additional_groups) == "table" then
for k, v in pairs(additional_groups) do
groups[k] = v
end
end
return groups
end

20
mods/carts/init.lua Normal file
View File

@ -0,0 +1,20 @@
carts = {}
carts.modpath = minetest.get_modpath("carts")
carts.railparams = {}
-- Maximal speed of the cart in m/s (min = -1)
carts.speed_max = 7
-- Set to -1 to disable punching the cart from inside (min = -1)
carts.punch_speed_max = 5
dofile(carts.modpath.."/functions.lua")
dofile(carts.modpath.."/rails.lua")
-- Support for non-default games
if not default.player_attached then
default.player_attached = {}
end
dofile(carts.modpath.."/cart_entity.lua")

54
mods/carts/license.txt Normal file
View File

@ -0,0 +1,54 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 PilzAdam
Copyright (C) 2014-2016 SmallJoker
Copyright (C) 2012-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media
-----------------
CC-0, see: https://creativecommons.org/share-your-work/public-domain/cc0/, except
if other license is mentioned.
Authors
---------
Originally from PixelBOX (Gambit):
carts_cart_side.png
carts_cart_top.png
carts_cart_front.png*
carts_cart.png*
sofar + stujones11:
carts_cart.b3d and carts_cart.blend
hexafraction, modified by sofar
carts_rail_*.png
http://www.freesound.org/people/YleArkisto/sounds/253159/ - YleArkisto - CC-BY-3.0
carts_cart_moving.*.ogg

Binary file not shown.

Binary file not shown.

59
mods/carts/rails.lua Normal file
View File

@ -0,0 +1,59 @@
carts:register_rail("carts:rail", {
description = "Rail",
tiles = {
"carts_rail_straight.png", "carts_rail_curved.png",
"carts_rail_t_junction.png", "carts_rail_crossing.png"
},
inventory_image = "carts_rail_straight.png",
wield_image = "carts_rail_straight.png",
groups = carts:get_rail_groups(),
}, {})
minetest.register_craft({
output = "carts:rail 18",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
}
})
minetest.register_alias("default:rail", "carts:rail")
carts:register_rail("carts:powerrail", {
description = "Powered rail",
tiles = {
"carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png",
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
},
groups = carts:get_rail_groups(),
}, {acceleration = 5})
minetest.register_craft({
output = "carts:powerrail 18",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
}
})
carts:register_rail("carts:brakerail", {
description = "Brake rail",
tiles = {
"carts_rail_straight_brk.png", "carts_rail_curved_brk.png",
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
},
groups = carts:get_rail_groups(),
}, {acceleration = -3})
minetest.register_craft({
output = "carts:brakerail 18",
recipe = {
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
}
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

9
mods/coffin/README.txt Normal file
View File

@ -0,0 +1,9 @@
Minetest 0.4 mod: coffin
========================
License of source code and textures:
-----------------------------------
Copyright (C) 2013-2014 BlockMen
WTFPL

2
mods/coffin/depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
ruins

88
mods/coffin/init.lua Normal file
View File

@ -0,0 +1,88 @@
minetest.register_node("coffin:gravestone", {
description = "Gravestone",
tiles = {"default_stone.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {dig_immediate = 1, cracky = 3},
sounds = default.node_sound_stone_defaults(),
drop = "default:cobble",
drawtype = "nodebox",
node_box = {type = "fixed",
fixed = {
{-0.5,-0.5,-0.1,0.5,-0.3,0.5},
{-0.3,-0.3,0.1,0.3,0.7,0.3},
}
}
})
minetest.register_node("coffin:coffin", {
description = "Coffin",
tiles = {
"coffin_top.png",
"coffin_top.png",
"coffin_side.png",
"coffin_side.png",
"coffin_side.png",
"coffin_side.png",
},
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2},
sounds = default.node_sound_wood_defaults({
dug = {name = "ruins_chest_break", gain = 0.6},
}),
drop = "default:stick 2",
after_dig_node = default.drop_node_inventory(),
})
minetest.register_alias("bones:bones", "coffin:coffin")
minetest.register_alias("bones:gravestone", "coffin:gravestone")
minetest.register_on_dieplayer(function(player)
minetest.after(0.5, function()
if minetest.setting_getbool("creative_mode") then
return
end
local pos = player:getpos()
pos.x = math.floor(pos.x+0.5)
pos.y = math.floor(pos.y-0.5)
pos.z = math.floor(pos.z+0.5)
local param2 = minetest.dir_to_facedir(player:get_look_dir())
local nn = minetest.get_node(pos).name
if minetest.registered_nodes[nn].can_dig and
not minetest.registered_nodes[nn].can_dig(pos, player) then
local player_inv = player:get_inventory()
for i=1,player_inv:get_size("main") do
player_inv:set_stack("main", i, nil)
end
for i=1,player_inv:get_size("craft") do
player_inv:set_stack("craft", i, nil)
end
return
end
minetest.dig_node(pos)
minetest.add_node(pos, {name="coffin:coffin", param2=param2})
pos.y = pos.y+1
minetest.set_node(pos, {name="coffin:gravestone", param2=param2})
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "RIP "..player:get_player_name())
pos.y = pos.y-1
meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local player_inv = player:get_inventory()
inv:set_size("main", 8*4)
local empty_list = inv:get_list("main")
inv:set_list("main", player_inv:get_list("main"))
player_inv:set_list("main", empty_list)
for i=1,player_inv:get_size("craft") do
inv:add_item("main", player_inv:get_stack("craft", i))
player_inv:set_stack("craft", i, nil)
end
end)
end)

Some files were not shown because too many files have changed in this diff Show More