master
runs 2019-07-31 00:23:34 +02:00
parent ee690c23e8
commit a661f0a611
42 changed files with 2954 additions and 2042 deletions

View File

@ -240,6 +240,7 @@ function mobkit.get_spawn_pos_abr(dtime,intrvl,radius,chance,reduction)
end
elseif liquidflag then --added petz
return pos2, liquidflag --added petz
end
end
end

View File

@ -1,3 +1,682 @@
Models, icons and textures by runs.
License: GPLv3
---
--- Models, icons and textures by runs.
---
---
--- License:
---
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://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) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://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:
<program> Copyright (C) <year> <name of author>
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
<https://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
<https://www.gnu.org/licenses/why-not-lgpl.html>.

File diff suppressed because it is too large Load Diff

139
petz/api_breed.lua Normal file
View File

@ -0,0 +1,139 @@
local modpath, S = ...
petz.breed = function(self, clicker, wielded_item, wielded_item_name)
if self.is_rut == false and self.is_pregnant == false then
wielded_item:take_item()
clicker:set_wielded_item(wielded_item)
self.is_rut = true
mobkit.remember(self, "is_rut", self.is_rut)
petz.do_particles_effect(self.object, self.object:get_pos(), "heart")
petz.do_sound_effect("object", self.object, "petz_"..self.type.."_moaning")
else
if self.is_rut then
minetest.chat_send_player(clicker:get_player_name(), S("This animal is already rut."))
else
minetest.chat_send_player(clicker:get_player_name(), S("This animal is already pregnant."))
end
end
end
petz.pony_breed = function(self, clicker, wielded_item, wielded_item_name)
if wielded_item_name == "petz:glass_syringe" and self.is_male== true then
local new_wielded_item = ItemStack("petz:glass_syringe_sperm")
local meta = new_wielded_item:get_meta()
meta:set_int("max_speed_forward", self.max_speed_forward)
meta:set_int("max_speed_reverse", self.max_speed_reverse)
meta:set_int("accel", self.accel)
clicker:set_wielded_item(new_wielded_item)
elseif wielded_item_name == "petz:glass_syringe_sperm" and self.is_male== false then
if self.is_pregnant == false and self.pregnant_count > 0 then
self.is_pregnant = true
mobkit.remember(self, "is_pregnant", self.is_pregnant)
self.pregnant_count = self.pregnant_count - 1
mobkit.remember(self, "pregnant_count", self.pregnant_count)
local meta = wielded_item:get_meta()
local max_speed_forward = meta:get_int("max_speed_forward")
local max_speed_reverse = meta:get_int("max_speed_reverse")
local accel = meta:get_int("accel")
petz.init_mountable_pregnancy(self, max_speed_forward, max_speed_reverse, accel)
petz.do_particles_effect(self.object, self.object:get_pos(), "pregnant".."_"..self.type)
end
clicker:set_wielded_item("petz:glass_syringe")
end
end
petz.childbirth = function(self, father)
local pos = self.object:get_pos()
self.is_pregnant = false
mobkit.remember(self, "is_pregnant", self.is_pregnant)
local baby_properties = {}
baby_properties["baby_born"] = true
if father and father.genes then
baby_properties["gen1_father"] = father.genes["gen1"]
baby_properties["gen2_father"] = father.genes["gen2"]
else
baby_properties["gen1_father"] = math.random(1, #self.skin_colors-1)
baby_properties["gen2_father"] = math.random(1, #self.skin_colors-1)
end
if self and self.genes then
baby_properties["gen1_mother"] = self.genes["gen1"]
baby_properties["gen2_mother"] = self.genes["gen2"]
else
baby_properties["gen1_mother"] = math.random(1, #self.skin_colors-1)
baby_properties["gen2_mother"] = math.random(1, #self.skin_colors-1)
end
local baby_type = "petz:"..self.type
if self.type == "elephant_female" then
if math.random(1, 2) == 1 then
baby_type = "petz:elephant" --could be a baby male elephant
end
end
local baby = minetest.add_entity(pos, baby_type, minetest.serialize(baby_properties))
local baby_entity = baby:get_luaentity()
baby_entity.is_baby = true
mobkit.remember(baby_entity, "is_baby", baby_entity.is_baby)
if not(self.owner== nil) and not(self.owner== "") then
baby_entity.tamed = true
mobkit.remember(baby_entity, "tamed", baby_entity.tamed)
baby_entity.owner = self.owner
mobkit.remember(baby_entity, "owner", baby_entity.owner)
end
return baby_entity
end
petz.init_pregnancy = function(self, father)
minetest.after(petz.settings.pregnancy_time, function(self, father)
if not(self.object:get_pos() == nil) then
local baby_entity = petz.childbirth(self, father)
end
end, self, father)
end
petz.init_mountable_pregnancy = function(self, max_speed_forward, max_speed_reverse, accel)
minetest.after(petz.settings.pregnancy_time, function(self, max_speed_forward, max_speed_reverse, accel)
if not(self.object:get_pos() == nil) then
local baby_entity = petz.childbirth(self)
--Set the genetics accordingly the father and the mother
local random_number = math.random(-1, 1)
local new_max_speed_forward = petz.round((max_speed_forward + self.max_speed_forward)/2, 0) + random_number
if new_max_speed_forward <= 0 then
new_max_speed_forward = 0
elseif new_max_speed_forward > 10 then
new_max_speed_forward = 10
end
local new_max_speed_reverse = petz.round((max_speed_reverse + self.max_speed_reverse)/2, 0) + random_number
if new_max_speed_reverse <= 0 then
new_max_speed_reverse = 0
elseif new_max_speed_reverse > 10 then
new_max_speed_reverse = 10
end
local new_accel = petz.round((accel + self.accel)/2, 0) + random_number
if new_accel <= 0 then
new_accel = 0
elseif new_accel > 10 then
new_accel = 10
end
baby_entity.max_speed_forward = new_max_speed_forward
mobkit.remember(baby_entity, "max_speed_forward", baby_entity.max_speed_forward)
baby_entity.max_speed_reverse = new_max_speed_reverse
mobkit.remember(baby_entity, "max_speed_reverse", baby_entity.max_speed_reverse)
baby_entity.accel = new_accel
mobkit.remember(baby_entity, "accel", baby_entity.accel)
end
end, self, max_speed_forward, max_speed_reverse, accel)
end
petz.init_growth = function(self)
minetest.after(petz.settings.growth_time, function(self)
if not(self.object:get_pos() == nil) then
self.is_baby = false
mobkit.remember(self, "is_baby", self.is_baby)
petz.set_properties(self, {
jump = false,
is_baby = false,
visual_size = self.visual_size,
collisionbox = self.collisionbox
})
end
end, self)
end

124
petz/api_capture.lua Normal file
View File

@ -0,0 +1,124 @@
local modpath, S = ...
--
-- Register Egg
--
petz.set_owner = function(self, placer_name)
-- set owner if not a monster
if self.is_wild == false then
self.owner = placer_name
mobkit.remember(self, "owner", self.owner)
self.tamed = true
mobkit.remember(self, "tamed", self.tamed)
end
end
function petz:register_egg(pet_name, desc, inv_img, no_creative)
local grp = {spawn_egg = 1}
minetest.register_craftitem(pet_name .. "_set", { -- register new spawn egg containing mob information
description = S("@1 (", desc)..S("Tamed")..")",
inventory_image = inv_img,
groups = {spawn_egg = 2},
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
local spawn_pos = pointed_thing.above
-- am I clicking on something with existing on_rightclick function?
local under = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[under.name]
if def and def.on_rightclick then
return def.on_rightclick(pointed_thing.under, under, placer, itemstack)
end
if spawn_pos and not minetest.is_protected(spawn_pos, placer:get_player_name()) then
if not minetest.registered_entities[pet_name] then
return
end
spawn_pos = petz.pos_to_spawn(pet_name, spawn_pos)
local meta = itemstack:get_meta()
local meta_table = meta:to_table()
local sdata = minetest.serialize(meta_table)
local mob = minetest.add_entity(spawn_pos, pet_name, sdata)
local ent = mob:get_luaentity()
petz.set_owner(ent, placer:get_player_name()) --set owner
itemstack:take_item() -- since mob is unique we remove egg once spawned
end
return itemstack
end,
})
end
petz.check_capture_items = function(self, wielded_item_name, clicker, check_inv_room)
local capture_item_type
if wielded_item_name == "mobs:lasso" or wielded_item_name == "petz:lasso" then
capture_item_type = "lasso"
elseif (wielded_item_name == "mobs:net") or (wielded_item_name == "fireflies:bug_net") then
capture_item_type = "net"
else
return false
end
if capture_item_type == self.capture_item then
if check_inv_room == true then
--check for room in inventory
local inv = clicker:get_inventory()
if inv:room_for_item("main", ItemStack("air")) then
return true
else
minetest.chat_send_player(clicker:get_player_name(), S("No room in your inventory to capture it."))
return false
end
else
return true
end
else
return false
end
end
petz.capture = function(self, clicker, put_in_inventory)
local new_stack = ItemStack(self.name .. "_set") -- add special mob egg with all mob information
local stack_meta = new_stack:get_meta()
--local sett ="---TABLE---: "
for key, value in pairs(self) do
local t = type(value)
if t ~= "function" and t ~= "nil" and t ~= "userdata" then
stack_meta:set_string(key, self[key])
--sett= sett .. ", ".. tostring(key).." : ".. tostring(self[key])
--minetest.chat_send_player("singleplayer", sett)
end
end
--Save some extra values-->
stack_meta:set_string("captured", "true") --mark as captured
stack_meta:set_string("texture_no", tostring(self.texture_no)) --Save the current texture_no
stack_meta:set_string("tamed", tostring(self.tamed)) --Save if tamed
stack_meta:set_string("tag", self.tag) --Save the current tag
stack_meta:set_string("show_tag", tostring(self.show_tag))
stack_meta:set_string("dreamcatcher", tostring(self.dreamcatcher))
if self.type == 'lamb' then
stack_meta:set_string("shaved", tostring(self.shaved)) --Save if shaved
elseif self.is_mountable == true then
stack_meta:set_string("saddle", tostring(self.saddle))
stack_meta:set_string("saddlebag", tostring(self.saddlebag))
stack_meta:set_string("saddlebag_inventory", minetest.serialize(self.saddlebag_inventory))
stack_meta:set_string("max_speed_forward", tostring(self.max_speed_forward))
stack_meta:set_string("max_speed_reverse", tostring(self.max_speed_reverse))
stack_meta:set_string("accel", tostring(self.accel))
end
if self.breed == true then
stack_meta:set_string("is_male", tostring(self.is_male))
stack_meta:set_string("is_rut", tostring(self.is_rut))
stack_meta:set_string("is_baby", tostring(self.is_baby))
stack_meta:set_string("is_pregnant", tostring(self.is_pregnant))
stack_meta:set_string("pregnant_count", tostring(self.pregnant_count))
stack_meta:set_string("genes", minetest.serialize(self.genes))
end
if put_in_inventory == true then
local inv = clicker:get_inventory()
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(clicker:get_pos(), new_stack)
end
end
self.object:remove()
return stack_meta
end

29
petz/api_dam_beaver.lua Normal file
View File

@ -0,0 +1,29 @@
local modpath, S = ...
--
--Create Dam Beaver Mechanics
--
petz.create_dam = function(self, pos)
if petz.settings.beaver_create_dam == true and self.dam_created == false then --a beaver can create only one dam
if math.random(1, 60000) > 1 then --chance of the dam to be created
return false
end
local pos_underwater = { --check if water below (when the beaver is still terrestrial but float in the surface of the water)
x = pos.x,
y = pos.y - 4.5,
z = pos.z,
}
if minetest.get_node(pos_underwater).name == "default:sand" then
local pos_dam = { --check if water below (when the beaver is still terrestrial but float in the surface of the water)
x = pos.x,
y = pos.y - 2.0,
z = pos.z,
}
minetest.place_schematic(pos_dam, modpath..'/schematics/beaver_dam.mts', 0, nil, true)
self.dam_created = true
return true
end
end
return false
end

25
petz/api_dreamcatcher.lua Normal file
View File

@ -0,0 +1,25 @@
local modpath, S = ...
--
-- Dreamcatcher (protector for Petz)
--
petz.put_dreamcatcher = function(self, clicker, wielded_item, wielded_item_name)
if self.dreamcatcher == true then
minetest.chat_send_player(clicker:get_player_name(), S("This pet already has a Dreamcatcher."))
return
end
wielded_item:take_item() --quit one from player's inventory
clicker:set_wielded_item(wielded_item)
self.dreamcatcher = true
mobkit.remember(self, "dreamcatcher", self.dreamcatcher)
petz.do_sound_effect("object", self.object, "petz_magical_chime")
petz.do_particles_effect(self.object, self.object:get_pos(), "dreamcatcher")
end
petz.drop_dreamcatcher = function(self)
if self.dreamcatcher == true then --drop the dreamcatcher
minetest.add_item(self.object:get_pos(), "petz:dreamcatcher")
self.dreamcatcher = false
mobkit.remember(self, "dreamcatcher", self.dreamcatcher)
end
end

34
petz/api_drops.lua Normal file
View File

@ -0,0 +1,34 @@
local modpath, S = ...
petz.drop_items = function(self)
if not self.drops or #self.drops == 0 then -- check for nil or no drops
return
end
if self.child then -- no drops for child mobs
return
end
local death_by_player = self.was_killed_by_player or nil -- was mob killed by player?
local obj, item, num
local pos = self.object:get_pos()
for n = 1, #self.drops do
if math.random(1, self.drops[n].chance) == 1 then
num = math.random(self.drops[n].min or 0, self.drops[n].max or 1)
item = self.drops[n].name
if death_by_player then -- only drop rare items (drops.min=0) if killed by player
obj = minetest.add_item(pos, ItemStack(item .. " " .. num))
elseif self.drops[n].min ~= 0 then
obj = minetest.add_item(pos, ItemStack(item .. " " .. num))
end
if obj and obj:get_luaentity() then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 6,
z = math.random(-10, 10) / 9,
})
elseif obj then
obj:remove() -- item does not exist
end
end
end
self.drops = {}
end

29
petz/api_eggs.lua Normal file
View File

@ -0,0 +1,29 @@
local modpath, S = ...
--Lay Egg
petz.lay_egg = function(self)
local pos = self.object:get_pos()
if math.random(1, petz.settings.lay_egg_chance) == 1 then
minetest.add_item(self.object:get_pos(), "petz:"..self.type.."_egg") --chicken egg!
end
local lay_range = 1
local nearby_nodes = minetest.find_nodes_in_area(
{x = pos.x - lay_range, y = pos.y - 1, z = pos.z - lay_range},
{x = pos.x + lay_range, y = pos.y + 1, z = pos.z + lay_range},
"petz:ducky_nest")
if #nearby_nodes > 1 then
local nest_to_lay = nearby_nodes[math.random(1, #nearby_nodes)]
minetest.set_node(nest_to_lay, {name= "petz:"..self.type.."_nest_egg"})
end
end
--Extract Egg from a Nest
petz.extract_egg_from_nest = function(self, pos, player, egg_type)
local inv = player:get_inventory()
if inv:room_for_item("main", egg_type) then
inv:add_item("main", egg_type) --add the egg to the player's inventory
minetest.set_node(pos, {name= "petz:ducky_nest"}) --Replace the node to a empty nest
else
minetest.chat_send_player(player:get_player_name(), "No room in your inventory for the egg.")
end
end

88
petz/api_feed_tame.lua Normal file
View File

@ -0,0 +1,88 @@
local modpath, S, creative_mode = ...
--
--Feed/Tame Function
--
petz.feed_tame = function(self, clicker, wielded_item, wielded_item_name, feed_count, tame)
-- Can eat/tame with item in hand
if self.follow == wielded_item_name then
if creative_mode == false then -- if not in creative then take item
wielded_item:take_item()
clicker:set_wielded_item(wielded_item)
end
mobkit.heal(self, 4)
petz.update_nametag(self)
if self.hp >= self.max_hp then
self.hp = self.max_hp
minetest.chat_send_player(clicker:get_player_name(), S("@1 at full health (@2)", self.type, tostring(self.hp)))
end
if self.tamed== true then
petz.update_nametag(self)
end
-- Feed and Tame
self.food_count = self.food_count + 1
mobkit.remember(self, "food_count", self.food_count)
if self.food_count >= feed_count then
self.food_count = 0
mobkit.remember(self, "food_count", 0)
if tame then
if self.tamed == false then
self.tamed = true
mobkit.remember(self, "tamed", true)
if not(self.owner) or self.owner == "" then
self.owner = clicker:get_player_name()
mobkit.remember(self, "owner", self.owner)
end
minetest.chat_send_player(clicker:get_player_name(), S("@1 has been tamed!", self.type))
mobkit.clear_queue_high(self) -- clear behaviour (i.e. it was running away)
if petz.settings.tamagochi_mode == true then
self.init_timer = true
end
end
end
end
mobkit.make_sound(self, "moaning")
return true
end
return false
end
--
--Tame with a whip mechanic
--
-- Whip/lashing behaviour
petz.do_lashing = function(self)
if self.lashed == false then
self.lashed = true
mobkit.remember(self, "lashed", self.lashed)
end
petz.do_sound_effect("object", self.object, "petz_"..self.type.."_moaning")
end
petz.tame_whip= function(self, hitter)
local wielded_item_name= hitter:get_wielded_item():get_name()
if (wielded_item_name == "petz:whip") then
if self.tamed == false then
--The mob can be tamed lashed with a whip
self.lashing_count = self.lashing_count + 1
if self.lashing_count >= petz.settings.lashing_tame_count then
self.lashing_count = 0
mobkit.remember(self, "lashing_count", self.lashing_count)
self.tamed = true
mobkit.remember(self, "tamed", self.tamed)
self.owner = hitter:get_player_name()
mobkit.remember(self, "owner", self.owner)
minetest.chat_send_player(self.owner, S("A").." "..self.type.." "..S("has been tamed."))
mobkit.clear_queue_high(self) -- do not attack
end
else
if (petz.settings.tamagochi_mode == true) and (self.owner == hitter:get_player_name()) then
petz.do_lashing(self)
end
end
petz.do_sound_effect("object", user, "petz_whip")
end
end

290
petz/api_forms.lua Normal file
View File

@ -0,0 +1,290 @@
local modpath, S = ...
petz.create_form = function(player_name)
local pet = petz.pet[player_name]
local form_size = {w = 4, h = 3}
local hungrystuff_pos = {x= 0, y = 0}
local buttonexit_pos = {x = 1, y = 6}
local form_title = ""
local tamagochi_form_stuff = ''
local affinity_stuff = ''
local form_orders = ''
local more_form_orders = ''
local final_form = ''
local pet_icon = "image[0,0;1,1;petz_spawnegg_"..pet.type..".png]"
if pet.affinity == nil then
pet.affinity = 0
end
if petz.settings.tamagochi_mode == true then
form_size.w= form_size.w + 1
if pet.has_affinity == true then
form_title = S("Orders")
hungrystuff_pos = {x= 3, y = 2}
affinity_stuff =
"image[3,3;1,1;petz_affinity_heart.png]"..
"label[4,3;".. tostring(pet.affinity).."%]"
else
form_size.w= form_size.w
form_size.h= form_size.h + 1
form_title = S("Status")
hungrystuff_pos = {x= 1, y = 3}
end
tamagochi_form_stuff =
pet_icon ..
"label[1,2;".. form_title .."]"..
"image[".. hungrystuff_pos.x ..",".. hungrystuff_pos.y ..";1,1;petz_pet_bowl_inv.png]"..
affinity_stuff
local hungry_label = ""
if pet.fed == false then
hungry_label = "Hungry"
else
hungry_label = "Satiated"
end
tamagochi_form_stuff = tamagochi_form_stuff .. "label[".. hungrystuff_pos.x +1 ..",".. hungrystuff_pos.y ..";"..S(hungry_label).."]"
else
tamagochi_form_stuff = pet_icon
if pet.has_affinity == true then
tamagochi_form_stuff = tamagochi_form_stuff .. "label[1,2;".. S("Orders") .."]"
end
end
if pet.is_pet == true and pet.tamed == true then
if not(pet.tag) then
pet.tag = ""
end
local selected
if pet.show_tag == true then
selected = "true"
else
selected = "false"
end
if pet.dreamcatcher == true then
tamagochi_form_stuff = tamagochi_form_stuff..
"image_button_exit[4,0;1,1;petz_dreamcatcher.png;btn_dreamcatcher;]"
end
tamagochi_form_stuff = tamagochi_form_stuff..
"field[1,1;2,1;ipt_name;"..S("Name")..":"..";"..pet.tag.."]"..
"checkbox[3,1;btn_show_tag;"..S("Show tag")..";"..selected.."]"
end
if pet.breed == true then --Show the Gender
local gender = ''
if pet.is_male == true then
gender = S("Male")
else
gender = S("Female")
end
tamagochi_form_stuff = tamagochi_form_stuff..
"label[3,0;"..gender.."]"
local pregnant_icon_x
local pregnant_icon_y
local pregnant_text_x
local pregnant_text_y
local infertile_text_x
local infertile_text_y
if pet.is_mountable == true or pet.type == "elephant" then
pregnant_icon_x = 3
pregnant_icon_y = 5
pregnant_text_x = 4
pregnant_text_y = 5
infertile_text_x = 3
infertile_text_y = 5
else
pregnant_icon_x = 3
pregnant_icon_y = 2
pregnant_text_x = 4
pregnant_text_y = 2
infertile_text_x = 3
infertile_text_y = 3
end
if pet.is_male == false and pet.is_pregnant == true then
tamagochi_form_stuff = tamagochi_form_stuff..
"image["..pregnant_icon_x..","..pregnant_icon_y..";1,1;petz_"..pet.type.."_pregnant_icon.png]"..
"label["..pregnant_text_x..","..pregnant_text_y..";"..S("Pregnant").."]"
elseif pet.is_male == false and pet.pregnant_count <= 0 then
tamagochi_form_stuff = tamagochi_form_stuff..
"label["..infertile_text_x..","..infertile_text_y..";"..S("Infertile").."]"
end
end
if pet.type == "parrot" then
form_size.h = form_size.h + 1
buttonexit_pos.y = buttonexit_pos.y + 1
more_form_orders = more_form_orders..
"button_exit[0,6;1,1;btn_alight;"..S("Alight").."]" ..
"button_exit[1,6;1,1;btn_fly;"..S("Fly").."]"..
"button_exit[2,6;2,1;btn_perch_shoulder;"..S("Perch on shoulder").."]"
elseif pet.is_mountable == true then
more_form_orders = more_form_orders..
"image[3,4;1,1;petz_"..pet.type.."_velocity_icon.png]"..
"label[4,4;".. tostring(pet.max_speed_forward).."/"..tostring(pet.max_speed_reverse)..'/'..tostring(pet.accel).."]"
if pet.has_saddlebag == true and pet.saddlebag == true then
more_form_orders = more_form_orders..
"image_button[5,0;1,1;petz_saddlebag.png;btn_saddlebag;]"
end
end
if pet.give_orders == true then
form_size.h= form_size.h + 4
form_size.w= form_size.w + 1
form_orders =
"button_exit[0,3;3,1;btn_followme;"..S("Follow me").."]"..
"button_exit[0,4;3,1;btn_standhere;"..S("Stand here").."]"..
"button_exit[0,5;3,1;btn_ownthing;"..S("Do your own thing").."]"..
more_form_orders
else
if petz.settings.tamagochi_mode == true then
buttonexit_pos.y = buttonexit_pos.y - 2
form_size.h= form_size.h + 1
else
buttonexit_pos.y = buttonexit_pos.y - 4
form_size.w= form_size.w + 1
end
end
final_form =
"size["..form_size.w..","..form_size.h..";]"..
tamagochi_form_stuff..
form_orders..
"button_exit["..buttonexit_pos.x..","..buttonexit_pos.y..";1,1;btn_close;"..S("Close").."]"
return final_form
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if (formname ~= "petz:form_orders") then
return false
end
local player_name = player:get_player_name()
local pet = petz.pet[player_name]
if pet and pet.object then
if fields.btn_followme then
if not(pet.can_fly) then
mobkit.clear_queue_low(pet)
mobkit.hq_follow(pet, 15, player)
end
elseif fields.btn_standhere then
mobkit.clear_queue_high(pet)
petz.stand(pet)
mobkit.lq_idle(pet, 2400)
if pet.can_fly == true then
if mobkit.node_name_in(pet, "below") == "air" then
mobkit.animate(pet, "fly")
else
mobkit.animate(pet, "stand")
end
end
elseif fields.btn_ownthing then
mobkit.clear_queue_low(pet)
petz.ownthing(pet)
elseif fields.btn_alight then
mobkit.clear_queue_low(pet)
mobkit.clear_queue_high(pet)
if not(mobkit.node_name_in(pet, "below") == "air") then
mobkit.animate(pet, "fly")
end
mobkit.hq_alight(pet, 0)
elseif fields.btn_fly then
mobkit.clear_queue_low(pet)
mobkit.clear_queue_high(pet)
pet.mov_status = "free"
mobkit.hq_fly(pet, 0)
minetest.after(2.5, function(pet)
mobkit.clear_queue_low(pet)
pet.object:set_acceleration({ x = 0, y = 0, z = 0 })
pet.object:set_velocity({ x = 0, y = 0, z = 0 })
end, pet)
elseif fields.btn_perch_shoulder then
pet.object:set_attach(player, "Arm_Left", {x=0.5,y=-6.25,z=0}, {x=0,y=0,z=180})
mobkit.animate(pet, "stand")
minetest.after(120.0, function(pet)
pet.object:set_detach()
end, pet)
elseif fields.btn_show_tag then
pet.show_tag = petz.to_boolean(fields.btn_show_tag)
mobkit.remember(pet, "show_tag", pet.show_tag)
elseif fields.btn_dreamcatcher then
petz.drop_dreamcatcher(pet)
elseif fields.btn_saddlebag then
--Load the inventory from the petz
local inv = minetest.get_inventory({ type="detached", name="saddlebag_inventory" })
inv:set_list("saddlebag", {})
if pet.saddlebag_inventory then
for key, value in pairs(pet.saddlebag_inventory) do
inv:set_stack("saddlebag", key, value)
end
end
--Show the inventory:
local formspec = "size[8,8;]"..
"image[3,0;1,1;petz_saddle.png]"..
"label[4,0;"..S("Saddlebag").."]"..
"list[detached:saddlebag_inventory;saddlebag;0,1;8,2;]"..
"list[current_player;main;0,4;8,4;]"
minetest.show_formspec(player_name, "petz:saddlebag_inventory", formspec)
end
if fields.ipt_name then
pet.tag = minetest.formspec_escape(string.sub(fields.ipt_name, 1 , 12))
mobkit.remember(pet, "tag", pet.tag)
end
petz.update_nametag(pet)
return true
else
return false
end
end)
--On receive fields
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "petz:saddlebag_inventory" then
return false
end
--Save the saddlebag content
local player_name = player:get_player_name()
local ent = petz.pet[player_name]
if ent and ent.object then
local inv = minetest.get_inventory({ type="detached", name="saddlebag_inventory" })
local itemstacks_table = {}
local inv_size = inv:get_size("saddlebag")
if inv_size > 0 then
for i = 1, inv_size do
itemstacks_table[i] = inv:get_stack("saddlebag", i):to_table()
end
ent.saddlebag_inventory = itemstacks_table
mobkit.remember(ent, "saddlebag_inventory", itemstacks_table)
end
end
return true
end)
--Saddlebag detached inventory
local function allow_put(pos, listname, index, stack, player)
return stack:get_count()
end
petz.create_detached_saddlebag_inventory = function(name)
local saddlebag_inventory = minetest.create_detached_inventory(name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
local stack = inv:get_stack(from_list, from_index)
return allow_put(pos, to_list, to_index, stack, player)
end,
allow_put = function(inv, listname, index, stack, player)
return stack:get_count()
end,
allow_take = function(inv, listname, index, stack, player)
return stack:get_count()
end,
})
-- Size and width of saddlebag inventory
saddlebag_inventory:set_size("saddlebag", 16)
saddlebag_inventory:set_width("saddlebag", 8)
end
petz.create_detached_saddlebag_inventory("saddlebag_inventory")
petz.ownthing = function(self)
self.mov_status = "free"
mobkit.hq_roam(self, 0)
mobkit.clear_queue_high(self)
end
petz.stand = function(self)
self.mov_status = "stand"
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
mobkit.clear_queue_high(self)
end

View File

@ -0,0 +1,45 @@
local modpath, S = ...
--
--Helper Functions
--
function petz:split(inSplitPattern, outResults)
if not inSplitPattern then
inSplitPattern = ','
end
if not outResults then
outResults = { }
end
self = self:gsub("%s+", "") --firstly trim spaces
local theStart = 1
local theSplitStart, theSplitEnd = string.find(self, inSplitPattern, theStart)
while theSplitStart do
table.insert(outResults, string.sub(self, theStart, theSplitStart-1))
theStart = theSplitEnd + 1
theSplitStart, theSplitEnd = string.find(self, inSplitPattern, theStart)
end
table.insert(outResults, string.sub(self, theStart))
return outResults
end
function petz.to_boolean(val)
if val and (val == "true" or val == 1) then
return true
else
return false
end
end
function petz.is_night()
local timeofday = minetest.get_timeofday() * 24000
if (timeofday < 4500) or (timeofday > 19500) then
return true
else
return false
end
end
function petz.round(x, n)
return x>=0 and math.floor(x+0.5) or math.ceil(x-0.5)
end

360
petz/api_init_prop.lua Normal file
View File

@ -0,0 +1,360 @@
local modpath, S = ...
--
--'set_initial_properties' is call by 'on_activate' for each pet
--
petz.set_random_gender = function()
if math.random(1, 2) == 1 then
return true
else
return false
end
end
petz.get_second_gen = function(self)
return math.random(1, #self.skin_colors-1)
end
petz.genetics_texture = function(self)
if self.type == "lamb" then
if self.genes["gen1"] == 1 or self.genes["gen2"] == 1 then
return 1 --white
elseif self.genes["gen1"] == 2 or self.genes["gen2"] == 2 then
return 2 --light gray
elseif self.genes["gen1"] == 3 or self.genes["gen2"] == 3 then
return 3 --dark gray
elseif self.genes["gen1"] == 4 or self.genes["gen2"] == 4 then
return 4 --brown
else
return 5 --vanilla mutation
end
elseif self.type == "elephant" then
if self.genes["gen1"] == 1 or self.genes["gen2"] == 1 then
return 1 --default
else
return 2 --white mutation
end
elseif self.type == "camel" then
if self.genes["gen1"] == 1 or self.genes["gen2"] == 1 then
return 1 --camel
elseif self.genes["gen1"] == 2 or self.genes["gen2"] == 2 then
return 2 --camel dark
else
return 3 --white mutation
end
end
end
petz.load_vars = function(self)
--Only specific mobs
if self.type == "lamb" then
self.shaved = mobkit.recall(self, "shaved") or false
self.food_count_wool = mobkit.recall(self, "food_count_wool") or 0
elseif self.is_mountable == true then
self.saddle = mobkit.recall(self, "saddle") or false
self.saddlebag = mobkit.recall(self, "saddlebag") or false
self.driver = mobkit.recall(self, "driver") or nil
self.max_speed_forward = mobkit.recall(self, "max_speed_forward") or 1
self.max_speed_reverse = mobkit.recall(self, "max_speed_reverse") or 1
self.accel = mobkit.recall(self, "accel") or 1
if self.has_saddlebag == true then
self.saddlebag_inventory = mobkit.recall(self, "saddlebag_inventory") or nil
end
elseif self.type == "puppy" then
self.square_ball_attached = false --cos the square ball is detached when die/leave server...
elseif self.type == "wolf" then
self.wolf_to_puppy_count = mobkit.recall(self, "wolf_to_puppy_count") or petz.settings.wolf_to_puppy_count
end
if self.milkable == true then
self.milked = mobkit.recall(self, "milked") or false
end
--Mobs that can have babies
if self.breed == true then
self.is_male = mobkit.recall(self, "is_male") or false
self.is_rut = mobkit.recall(self, "is_rut") or false
self.is_pregnant = mobkit.recall(self, "is_pregnant") or false
self.pregnant_count = mobkit.recall(self, "pregnant_count") or petz.settings.pregnant_count
self.is_baby = mobkit.recall(self, "is_baby") or false
self.genes = mobkit.recall(self, "genes") or {}
end
--All the mobs
self.tag = mobkit.recall(self, "tag") or ""
self.show_tag = mobkit.recall(self, "show_tag") or false
self.tamed = mobkit.recall(self, "tamed") or false
self.owner = mobkit.recall(self, "owner") or nil
self.affinity = mobkit.recall(self, "affinity") or 100
self.fed = mobkit.recall(self, "fed") or true
self.brushed = mobkit.recall(self, "brushed") or false
if self.is_wild == true then
self.lashed = mobkit.recall(self, "lashed") or false
self.lashing_count = mobkit.recall(self, "lashing_count") or 0
end
self.food_count = mobkit.recall(self, "food_count") or 0
self.beaver_oil_applied = mobkit.recall(self, "beaver_oil_applied") or false
self.child = mobkit.recall(self, "child") or false
self.dreamcatcher = mobkit.recall(self, "dreamcatcher") or false
end
function petz.set_initial_properties(self, staticdata, dtime_s)
local static_data_table = minetest.deserialize(staticdata)
local captured_mob = false
local baby_born = false
--minetest.chat_send_player("singleplayer", staticdata)
if static_data_table and static_data_table["fields"] and static_data_table["fields"]["captured"] then
captured_mob = true
elseif static_data_table and static_data_table["baby_born"] and static_data_table["baby_born"] == true then
baby_born = true
end
if mobkit.recall(self, "set_vars") == nil and captured_mob == false then --set some vars
--Mob Specific
--Lamb
if self.type == "lamb" and petz.settings.type_model == "mesh" then --set a random color
local random_number = math.random(1, 15)
if random_number == 1 then
self.texture_no = 4 --brown
elseif random_number >= 2 and random_number <= 4 then
self.texture_no = 3 --drak grey
elseif random_number >= 5 and random_number <= 7 then
self.texture_no = 2 --grey
else
self.texture_no = 1 --white, from 8 to 15
end
self.food_count_wool = 0
mobkit.remember(self, "food_count_wool", self.food_count_wool)
self.shaved = false
mobkit.remember(self, "shaved", self.shaved)
elseif self.type == "elephant" then
self.texture_no = math.random(1, #self.skin_colors-1) --set a random texture
elseif self.type == "puppy" then
self.square_ball_attached = false
mobkit.remember(self, "square_ball_attached", self.square_ball_attached)
elseif self.type == "wolf" then
self.wolf_to_puppy_count = petz.settings.wolf_to_puppy_count
mobkit.remember(self, "wolf_to_puppy_count", self.wolf_to_puppy_count)
elseif self.is_mountable == true then
if baby_born == false then
self.max_speed_forward= math.random(2, 4) --set a random velocity for walk and run
mobkit.remember(self, "max_speed_forward", self.max_speed_forward)
self.max_speed_reverse= math.random(2, 4)
mobkit.remember(self, "max_speed_reverse", self.max_speed_reverse)
self.accel= math.random(2, 4)
mobkit.remember(self, "accel", self.accel)
end
self.texture_no = math.random(1, #self.skin_colors-1) --set a random texture
self.driver = nil
mobkit.remember(self, "driver", self.driver)
--Saddlebag
if self.has_saddlebag == true then
self.saddlebag_ref = nil
self.saddlebag_inventory = {}
mobkit.remember(self, "saddlebag_inventory", self.saddlebag_inventory)
end
end
--Mobs that can have babies
if self.breed == true then
if self.is_male == nil then
self.is_male = petz.set_random_gender() --set a random gender
end
mobkit.remember(self, "is_male", self.is_male)
self.is_rut = false
mobkit.remember(self, "is_rut", self.is_rut)
self.is_pregnant = false
mobkit.remember(self, "is_pregnant", self.is_pregnant)
self.pregnant_count = petz.settings.pregnant_count
mobkit.remember(self, "pregnant_count", self.pregnant_count)
self.is_baby = false
mobkit.remember(self, "is_baby", self.is_baby)
--Genetics
self.genes = {}
if not(self.type == "pony") then
local genes_mutation = false
if math.random(1, 200) == 1 then
genes_mutation = true
end
if genes_mutation == false then
if baby_born == false then
self.genes["gen1"] = self.texture_no
self.genes["gen2"] = petz.get_second_gen(self)
else
if math.random(1, 2) == 1 then
self.genes["gen1"] = static_data_table["gen1_father"]
else
self.genes["gen1"] = static_data_table["gen2_father"]
end
if math.random(1, 2) == 1 then
self.genes["gen2"] = static_data_table["gen1_mother"]
else
self.genes["gen2"] = static_data_table["gen2_mother"]
end
self.texture_no = petz.genetics_texture(self)
end
else -- mutation
local mutation_gen = #self.skin_colors --the last skin is always the mutation
self.genes["gen1"] = mutation_gen --white
self.genes["gen2"] = mutation_gen --white
self.texture_no = mutation_gen -- white
end
end
mobkit.remember(self, "genes", self.genes)
end
--ALL the mobs
if not(self.texture_no) then --for piggy, moth... petz with only one texture
self.texture_no = 1
end
self.set_vars = true
mobkit.remember(self, "set_vars", self.set_vars)
self.tag = ""
mobkit.remember(self, "tag", self.tag)
self.show_tag = false
mobkit.remember(self, "show_tag", self.show_tag)
self.tamed = false
mobkit.remember(self, "tamed", self.tamed)
self.owner = ""
mobkit.remember(self, "owner", self.owner)
self.food_count = 0
mobkit.remember(self, "food_count", self.food_count)
self.was_killed_by_player = false
mobkit.remember(self, "was_killed_by_player", self.was_killed_by_player)
self.dreamcatcher = false
mobkit.remember(self, "dreamcatcher", self.dreamcatcher)
if self.init_timer== true then
petz.init_timer(self)
end
if self.has_affinity == true then
self.affinity = 100
mobkit.remember(self, "affinity", self.affinity)
end
if self.is_wild == true then
self.lashed = false
mobkit.remember(self, "lashed", self.lashed)
self.lashing_count = 0
mobkit.remember(self, "lashing_count", self.lashing_count)
end
elseif captured_mob == false then
petz.load_vars(self) --Load memory variables
--
--CAPTURED MOBS
--
else
--Mob Specific
if self.type == "lamb" then --Lamb
self.food_count_wool = tonumber(static_data_table["fields"]["food_count_wool"])
mobkit.remember(self, "food_count_wool", self.food_count_wool)
self.shaved = petz.to_boolean(static_data_table["fields"]["shaved"])
mobkit.remember(self, "shaved", self.shaved)
elseif self.type == "wolf" then
self.wolf_to_puppy_count = tonumber(static_data_table["fields"]["wolf_to_puppy_count"])
mobkit.remember(self, "wolf_to_puppy_count", self.wolf_to_puppy_count)
elseif self.is_mountable == true then
self.saddle = petz.to_boolean(static_data_table["fields"]["saddle"])
self.saddlebag = petz.to_boolean(static_data_table["fields"]["saddlebag"])
self.saddlebag_inventory = minetest.deserialize(static_data_table["fields"]["saddlebag_inventory"])
self.max_speed_forward = tonumber(static_data_table["fields"]["max_speed_forward"] )
mobkit.remember(self, "max_speed_forward", self.max_speed_forward)
self.max_speed_reverse = tonumber(static_data_table["fields"]["max_speed_reverse"])
mobkit.remember(self, "max_speed_reverse", self.max_speed_reverse)
self.accel = tonumber(static_data_table["fields"]["accel"])
mobkit.remember(self, "accel", self.accel)
mobkit.remember(self, "saddle", false) --no shaddle
mobkit.remember(self, "driver", nil) --no driver
end
--Mobs that can have babies
if self.breed == true then
self.is_male = petz.to_boolean(static_data_table["fields"]["is_male"])
mobkit.remember(self, "is_male", self.is_male)
self.is_rut = petz.to_boolean(static_data_table["fields"]["is_rut"])
mobkit.remember(self, "is_rut", self.is_rut)
self.is_pregnant = petz.to_boolean(static_data_table["fields"]["is_pregnant"])
mobkit.remember(self, "is_pregnant", self.is_pregnant)
self.is_baby = petz.to_boolean(static_data_table["fields"]["is_baby"])
mobkit.remember(self, "is_baby", self.is_baby)
self.pregnant_count = tonumber(static_data_table["fields"]["pregnant_count"])
mobkit.remember(self, "pregnant_count", self.pregnant_count)
self.genes = minetest.deserialize(static_data_table["fields"]["genes"])
mobkit.remember(self, "genes", self.genes)
end
--ALL the mobs
self.texture_no = tonumber(static_data_table["fields"]["texture_no"])
self.set_vars = true
mobkit.remember(self, "set_vars", self.set_vars)
self.tag = static_data_table["fields"]["tag"]
mobkit.remember(self, "tag", self.tag)
self.show_tag = petz.to_boolean(static_data_table["fields"]["show_tag"])
mobkit.remember(self, "dreamcatcher", self.dreamcatcher)
self.dreamcatcher = petz.to_boolean(static_data_table["fields"]["dreamcatcher"])
mobkit.remember(self, "show_tag", self.show_tag)
self.tamed = petz.to_boolean(static_data_table["fields"]["tamed"])
mobkit.remember(self, "tamed", self.tamed)
self.owner = static_data_table["fields"]["owner"]
mobkit.remember(self, "owner", self.owner)
self.food_count = tonumber(static_data_table["fields"]["food_count"])
mobkit.remember(self, "food_count", self.food_count)
if self.has_affinity == true then
self.affinity = tonumber(static_data_table["fields"]["affinity"])
mobkit.remember(self, "affinity", self.affinity)
end
if self.is_wild == true then
self.lashed = false
mobkit.remember(self, "lashed", self.lashed)
self.lashing_count = tonumber(static_data_table["fields"]["lashing_count"] )
mobkit.remember(self, "lashing_count", self.lashing_count)
end
end
--Custom textures
if captured_mob == true or self.breed == true then
local texture
---
---DELETE FROM THIS LINE...
---
if self.type == "lamb" or self.type == "pony" then
if self.texture_no == nil then
self.texture_no = math.random(1, #self.skin_colors)
end
end
----
----TO THIS LINE
----
--Mob Specific
--Lamb
if self.type == "lamb" then
local shaved_string = ""
if self.shaved == true then
shaved_string = "_shaved"
end
texture = "petz_lamb".. shaved_string .."_"..self.skin_colors[self.texture_no]..".png"
elseif self.is_mountable == true then
if self.saddle then
texture = "petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png" .. "^petz_"..self.type.."_saddle.png"
else
texture = "petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png"
end
if self.saddlebag then
texture = texture .. "^petz_"..self.type.."_saddlebag.png"
end
else
texture = self.textures[self.texture_no]
end
mobkit.remember(self, "texture_no", self.texture_no)
petz.set_properties(self, {textures = {texture}})
end
if self.breed == true then
if self.is_pregnant == true then
if self.is_mountable == true then
petz.init_mountable_pregnancy(self, self.max_speed_forward, self.max_speed_reverse, self.accel)
else
petz.init_pregnancy(self)
end
elseif (self.is_baby == true) or (baby_born == true) then
petz.set_properties(self, {
visual_size = self.visual_size_baby,
collisionbox = self.collisionbox_baby
})
petz.init_growth(self)
end
end
--ALL the mobs
if self.is_pet and self.tamed then
petz.update_nametag(self)
end
end

73
petz/api_mount.lua Normal file
View File

@ -0,0 +1,73 @@
local modpath, S = ...
--
-- Mount Engine
--
petz.mount = function(self, clicker, wielded_item, wielded_item_name)
if self.tamed and self.owner == clicker:get_player_name() then
if self.driver and clicker == self.driver then -- detatch player already riding horse
petz.detach(clicker, {x = 1, y = 0, z = 1})
mobkit.clear_queue_low(self)
return false
elseif (self.saddle or self.saddlebag) and wielded_item_name == "petz:shears" then
if self.saddle then
minetest.add_item(self.object:get_pos(), "petz:saddle")
self.saddle = false
mobkit.remember(self, "saddle", self.saddle)
end
if self.saddlebag then
minetest.add_item(self.object:get_pos(), "petz:saddlebag")
self.saddlebag = false
mobkit.remember(self, "saddlebag", self.saddlebag)
end
petz.set_properties(self, {textures = {"petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png"}})
return false
elseif (not(self.driver) and not(self.is_baby)) and ((wielded_item_name == "petz:saddle") or (wielded_item_name == "petz:saddlebag")) then -- Put on saddle if tamed
local put_saddle = false
if wielded_item_name == "petz:saddle" and not(self.saddle) then
put_saddle = true
elseif wielded_item_name == "petz:saddlebag" and not(self.saddlebag) and not(self.type == "pony") then
put_saddle = true
end
if put_saddle == true then
petz.put_saddle(self, clicker, wielded_item, wielded_item_name)
return false
end
elseif not self.driver and self.saddle then -- Mount petz
petz.set_properties(self, {stepheight = 1.1})
petz.attach(self, clicker)
return false
else
return true
end
else
return true
end
end
petz.put_saddle = function(self, clicker, wielded_item, wielded_item_name)
local saddle_type = ""
local another_saddle = ""
if wielded_item_name == "petz:saddle" then
saddle_type = "saddle"
self.saddle = true
mobkit.remember(self, "saddle", self.saddle)
if self.saddlebag == true then
another_saddle = "^petz_"..self.type.."_saddlebag.png"
end
else
saddle_type = "saddlebag"
self.saddlebag = true
mobkit.remember(self, "saddlebag", self.saddlebag)
if self.saddle == true then
another_saddle = "^petz_"..self.type.."_saddle.png"
end
end
local texture = "petz_"..self.type.."_"..self.skin_colors[self.texture_no]..".png" .. "^petz_"..self.type.."_"..saddle_type..".png"..another_saddle
petz.set_properties(self, {textures = {texture}})
if not minetest.settings:get_bool("creative_mode") then
wielded_item:take_item()
clicker:set_wielded_item(wielded_item)
end
end

15
petz/api_nametag.lua Normal file
View File

@ -0,0 +1,15 @@
local modpath, S = ...
petz.update_nametag = function(self)
local name_tag
if self.show_tag == true and self.tag and not(self.tag == "") then
name_tag = self.tag
self.object:set_nametag_attributes({text = name_tag ..""..tostring(self.hp).."/"..tostring(self.max_hp),})
else
self.object:set_nametag_attributes({text = "",})
end
end
petz.delete_nametag = function(self)
self.object:set_nametag_attributes({text = nil,})
end

59
petz/api_on_die.lua Normal file
View File

@ -0,0 +1,59 @@
local modpath, S = ...
--
--on_die event for all the mobs
--
petz.on_die = function(self)
--Specific of each mob
if self.is_mountable == true then
if self.saddle then -- drop saddle when petz is killed while riding
minetest.add_item(self.object:get_pos(), "petz:saddle")
end
if self.saddlebag then -- drop saddlebag
minetest.add_item(self.object:get_pos(), "petz:saddlebag")
end
-- Drop the items from petz inventory
local inv = minetest.get_inventory({ type="detached", name="saddlebag_inventory" })
inv:set_list("saddlebag", {})
if self.saddlebag_inventory then
for key, value in pairs(self.saddlebag_inventory) do
inv:set_stack("saddlebag", key, value)
end
for i = 1, inv:get_size("saddlebag") do
local stack = inv:get_stack("saddlebag", i)
if stack:get_count() > 0 then
minetest.item_drop(stack, self.object, self.object:get_pos())
end
end
end
elseif self.type == "puppy" then
if self.square_ball_attached == true and self.attached_squared_ball then
self.attached_squared_ball.object:set_detach()
end
end
petz.drop_dreamcatcher(self)
if self.can_fly then
self.can_fly = false
end
--For all the mobs
local props = self.object:get_properties()
props.collisionbox[2] = props.collisionbox[1]
petz.set_properties(self, {collisionbox=props.collisionbox})
petz.drop_items(self)
mobkit.clear_queue_high(self)
mobkit.hq_die(self)
petz.pet[self.owner]= nil
end
petz.was_killed_by_player = function(self, puncher)
if self.hp <= 0 then
if puncher:is_player() then
return true
else
return false
end
else
return false
end
end

77
petz/api_on_punch.lua Normal file
View File

@ -0,0 +1,77 @@
local modpath, S = ...
petz.calculate_damage = function(tool_capabilities)
local damage_points
if tool_capabilities.damage_groups["fleshy"] ~= nil or tool_capabilities.damage_groups["fleshy"] ~= "" then
damage_points = tool_capabilities.damage_groups["fleshy"] or 0
--minetest.chat_send_player("singleplayer", "hp : "..tostring(damage_points))
else
damage_points = 0
end
return damage_points
end
petz.kick_back= function(self, dir)
local hvel = vector.multiply(vector.normalize({x=dir.x,y=0,z=dir.z}),4)
self.object:set_velocity({x=hvel.x,y=2,z=hvel.z})
end
petz.lookat=function(self, pos2)
local pos1=self.object:get_pos()
local vec = {x=pos1.x-pos2.x, y=pos1.y-pos2.y, z=pos1.z-pos2.z}
local yaw = math.atan(vec.z/vec.x)-math.pi/2
if pos1.x >= pos2.x then
yaw = yaw+math.pi
end
self.object:set_yaw(yaw+math.pi)
end
petz.afraid= function(self, pos)
petz.lookat(self, pos)
local x = self.object:get_velocity().x
local z = self.object:get_velocity().z
local hvel = vector.multiply(vector.normalize({x= x, y= 0 ,z= z}), 4)
mobkit.clear_queue_high(self)
self.object:set_velocity({x= hvel.x, y= 0, z= hvel.z})
end
petz.punch_tamagochi = function (self, puncher)
if petz.settings.tamagochi_mode == true then
if self.owner == puncher:get_player_name() then
if self.affinity == nil then
self.affinity = 100
end
petz.set_affinity(self, false, 20)
end
end
end
--
--on_punch event for all the Mobs
--
function petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
if mobkit.is_alive(self) then
if self.is_wild == true then
petz.tame_whip(self, puncher)
end
if type(puncher) == 'userdata' and puncher:is_player() then
if self.dreamcatcher == true and self.owner ~= puncher:get_player_name() then --The dreamcatcher protects the petz
return
end
petz.punch_tamagochi(self, puncher) --decrease affinity when in Tamagochi mode
mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1)
petz.update_nametag(self)
self.was_killed_by_player = petz.was_killed_by_player(self, puncher)
end
petz.kick_back(self, dir) -- kickback
petz.do_sound_effect("object", self.object, "petz_default_punch")
if self.hp <= 0 and self.driver then --important for mountable petz!
petz.force_detach(self.driver)
end
if self.tamed == false and self.attack_player == false then --if you hit it, will attack player
self.attack_player = true
mobkit.clear_queue_high(self)
end
end
end

111
petz/api_on_rightclick.lua Normal file
View File

@ -0,0 +1,111 @@
local modpath, S = ...
--
--on_rightclick event for all the Mobs
--
petz.on_rightclick = function(self, clicker)
if not(clicker:is_player()) then
return false
end
local player_name = clicker:get_player_name()
local wielded_item = clicker:get_wielded_item()
local wielded_item_name = wielded_item:get_name()
local show_form = false
if ((self.is_pet == true) and (self.owner == player_name) and (self.can_be_brushed == true))-- If brushing or spread beaver oil
and ((wielded_item_name == "petz:hairbrush") or (wielded_item_name == "petz:beaver_oil")) then
if petz.settings.tamagochi_mode == true then
if wielded_item_name == "petz:hairbrush" then
if self.brushed == false then
petz.set_affinity(self, true, 5)
self.brushed = true
mobkit.remember(self, "brushed", self.brushed)
else
minetest.chat_send_player(self.owner, S("Your").." "..self.type.." "..S("had already been brushed."))
end
else --it's beaver_oil
if self.beaver_oil_applied == false then
petz.set_affinity(self, true, 20)
self.beaver_oil_applied = true
mobkit.remember(self, "beaver_oil_applied", self.beaver_oil_applied)
else
minetest.chat_send_player(self.owner, S("Your").." "..self.type.." "..S("had already been spreaded with beaver oil."))
end
end
end
petz.do_sound_effect("object", self.object, "petz_brushing")
petz.do_particles_effect(self.object, self.object:get_pos(), "star")
--If feeded
elseif petz.feed_tame(self, clicker, wielded_item, wielded_item_name, 5, true) then
if petz.settings.tamagochi_mode == true and self.fed == false then
petz.set_affinity(self, true, 5)
self.fed = true
mobkit.remember(self, "fed", self.fed)
end
petz.refill(self) --Refill wool, milk or nothing
if self.type == "wolf" and wielded_item_name == "petz:bone" then
petz.wolf_to_puppy(self, player_name)
end
petz.do_sound_effect("object", self.object, "petz_"..self.type.."_moaning")
petz.do_particles_effect(self.object, self.object:get_pos(), "heart")
elseif petz.check_capture_items(self, wielded_item_name, clicker, true) == true then
local player_name = clicker:get_player_name()
if (self.is_pet == true and self.owner and self.owner ~= player_name and petz.settings.rob_mobs == false) then
minetest.chat_send_player(player_name, S("You are not the owner of the").." "..self.type..".")
return
end
if self.owner== nil or self.owner== "" or (self.owner ~= player_name and petz.settings.rob_mobs == true) then
self.tamed = true
mobkit.remember(self, "tamed", self.tamed )
self.owner = player_name
mobkit.remember(self, "owner", self.owner)
end
petz.capture(self, clicker, true)
minetest.chat_send_player("singleplayer", S("Your").." "..self.type.." "..S("has been captured")..".")
elseif self.breed and wielded_item_name == petz.settings[self.type.."_breed"] and not(self.is_baby) and self.type ~= "pony" then
petz.breed(self, clicker, wielded_item, wielded_item_name)
elseif (wielded_item_name == "petz:dreamcatcher") and (self.tamed == true) and (self.is_pet == true) and (self.owner == player_name) then
petz.put_dreamcatcher(self, clicker, wielded_item, wielded_item_name)
--
--Pet Specifics
--below here
elseif self.type == "lamb" then
if (wielded_item_name == "mobs:shears" or wielded_item_name == "petz:shears") and clicker:get_inventory() and not self.shaved then
petz.lamb_wool_shave(self, clicker) --shear it!
else
show_form = true
end
elseif self.milkable == true and wielded_item_name == "bucket:bucket_empty" and clicker:get_inventory() then
if not(self.milked) then
petz.milk_milk(self, clicker)
else
minetest.chat_send_player(clicker:get_player_name(), S("This animal has already been milked."))
end
elseif self.type == "pony" and (wielded_item_name == "petz:glass_syringe" or wielded_item_name == "petz:glass_syringe_sperm") then
if not(self.is_baby) then
petz.pony_breed(self, clicker, wielded_item, wielded_item_name)
end
elseif self.type == "moth" and (wielded_item_name == "vessels:glass_bottle") then
--capture the moth in the bottle
local new_stack = ItemStack("petz:bottle_moth") -- add special mob egg with all mob information
local stack_meta = new_stack:get_meta()
stack_meta = petz.capture(self, clicker, false)
local inv = clicker:get_inventory()
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(clicker:get_pos(), new_stack)
end
elseif self.is_mountable == true then
show_form = petz.mount(self, clicker, wielded_item, wielded_item_name)
--Else open the Form
else
show_form = true
end
if show_form == true then
if (self.tamed == true) and (self.is_pet == true) and (self.owner == player_name) then
petz.pet[player_name]= self
minetest.show_formspec(player_name, "petz:form_orders", petz.create_form(player_name))
end
end
end

74
petz/api_particles.lua Normal file
View File

@ -0,0 +1,74 @@
local modpath, S = ...
--
--Particle Effects
--
petz.do_particles_effect = function(obj, pos, particle_type)
local minpos
minpos = {
x = pos.x,
y = pos.y,
z = pos.z
}
local maxpos
maxpos = {
x = minpos.x+0.4,
y = minpos.y-0.5,
z = minpos.z+0.4
}
local texture_name
local particles_amount
local min_size
local max_size
if particle_type == "star" then
texture_name = "petz_star_particle.png"
particles_amount = 20
min_size = 1.0
max_size = 1.5
elseif particle_type == "heart" then
texture_name = "petz_affinity_heart.png"
particles_amount = 10
min_size = 1.0
max_size = 1.5
elseif particle_type == "pregnant_pony" then
texture_name = "petz_pony_pregnant_icon.png"
particles_amount = 10
min_size = 5.0
max_size = 6.0
elseif particle_type == "pregnant_lamb" then
texture_name = "petz_lamb_pregnant_icon.png"
particles_amount = 10
min_size = 5.0
max_size = 6.0
elseif particle_type == "pregnant_camel" then
texture_name = "petz_camel_pregnant_icon.png"
particles_amount = 10
min_size = 5.0
max_size = 6.0
elseif particle_type == "dreamcatcher" then
texture_name = "petz_dreamcatcher_particle.png"
particles_amount = 15
min_size = 1.0
max_size = 2.0
end
minetest.add_particlespawner({
--attached = obj,
amount = particles_amount,
time = 1.5,
minpos = minpos,
maxpos = maxpos,
--minvel = {x=1, y=0, z=1},
--maxvel = {x=1, y=0, z=1},
--minacc = {x=1, y=0, z=1},
--maxacc = {x=1, y=0, z=1},
minexptime = 1,
maxexptime = 1,
minsize = min_size,
maxsize =max_size,
collisiondetection = false,
vertical = false,
texture = texture_name,
glow = 14
})
end

36
petz/api_replace.lua Normal file
View File

@ -0,0 +1,36 @@
local modpath, S = ...
--
--Replace Engine
--
petz.replace = function(self)
if not self.replace_rate or not self.replace_what or self.child == true or self.object:get_velocity().y ~= 0 or math.random(1, self.replace_rate) > 1 then
return
end
local pos = self.object:get_pos()
local what, with, y_offset
if type(self.replace_what[1]) == "table" then
local num = math.random(#self.replace_what)
what = self.replace_what[num][1] or ""
with = self.replace_what[num][2] or ""
y_offset = self.replace_what[num][3] or 0
else
what = self.replace_what
with = self.replace_with or ""
y_offset = self.replace_offset or 0
end
pos.y = pos.y + y_offset
if #minetest.find_nodes_in_area(pos, pos, what) > 0 then
local oldnode = {name = what}
local newnode = {name = with}
local on_replace_return
if self.on_replace then
on_replace_return = self:on_replace(pos, oldnode, newnode)
end
if on_replace_return ~= false then
minetest.set_node(pos, {name = with})
petz.refill(self) --Refill wool, milk or nothing
end
end
end

29
petz/api_sound.lua Normal file
View File

@ -0,0 +1,29 @@
local modpath, S = ...
--
--Sound System
--
petz.random_mob_sound = function(self)
local random_number = math.random(1, petz.settings.misc_sound_chance)
if random_number == 1 then
if self.sounds and self.sounds['misc'] then
petz.mob_sound(self, self.sounds['misc'], 1.0, 10)
end
end
end
-- play sound
petz.mob_sound = function(self, sound, _gain, _max_hear_distance)
if sound then
minetest.sound_play(sound, {object = self.object, gain = _gain, max_hear_distance = _max_hear_distance})
end
end
petz.do_sound_effect = function(dest, dest_name, soundfile)
minetest.sound_play(soundfile, {dest = dest_name, gain = 0.4})
end
petz.set_properties = function(self, properties)
self.object:set_properties(properties)
end

156
petz/api_squareball.lua Normal file
View File

@ -0,0 +1,156 @@
local modpath, S = ...
--
--Square Ball Game for the Puppy
--
function petz.spawn_square_ball(user, strength)
local pos = user:get_pos()
pos.y = pos.y + 1.5 -- camera offset
local dir = user:get_look_dir()
local yaw = user:get_look_horizontal()
local obj = minetest.add_entity(pos, "petz:ent_square_ball")
if not obj then
return
end
obj:get_luaentity().shooter_name = user:get_player_name()
obj:set_yaw(yaw - 0.5 * math.pi)
obj:set_velocity(vector.multiply(dir, strength))
return true
end
minetest.register_node("petz:square_ball", {
description = S("Square Ball (use to throw)"),
--inventory_image = "petz_square_ball.png",
tiles = {"petz_square_ball.png", "petz_square_ball.png", "petz_square_ball.png", "petz_square_ball.png",
"petz_square_ball.png", "petz_square_ball.png"},
visual_scale = 0.35,
is_ground_content = false,
groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
sounds = default.node_sound_wood_defaults(),
on_use = function(itemstack, user, pointed_thing)
local strength = 20
if not petz.spawn_square_ball(user, strength) then
return -- something failed
end
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({
type = "shaped",
output = 'petz:square_ball',
recipe = {
{'wool:blue', 'wool:white', 'wool:red'},
{'wool:white', 'farming:string', 'wool:white'},
{'wool:yellow', 'wool:white', 'wool:white'},
}
})
petz.attach_squareball = function(self, thing_ent, thing_ref, shooter_name)
self.object:set_properties({visual = "cube", physical = true, visual_size = {x = 0.045, y = 0.045},
textures = {"petz_square_ball.png", "petz_square_ball.png", "petz_square_ball.png", "petz_square_ball.png",
"petz_square_ball.png", "petz_square_ball.png"}, groups = {immortal = 1}, collisionbox = {-0.15, -0.15, -0.15, 0.15, 0.15, 0.15},})
self.object:set_attach(thing_ref, "head", {x=-0.0, y=0.5, z=-0.45}, {x=0, y=0, z=0})
thing_ent.square_ball_attached = true
thing_ent.attached_squared_ball = self
mobkit.remember(thing_ent, "square_ball_attached", thing_ent.square_ball_attached)
mobkit.make_sound(thing_ent, "moaning")
if shooter_name then
local player = minetest.get_player_by_name(shooter_name)
if player then
mobkit.clear_queue_low(thing_ent)
mobkit.hq_follow(thing_ent, 15, player)
self.shooter_name = "" --disable de 'on_step' event
end
end
end
minetest.register_entity("petz:ent_square_ball", {
hp_max = 4, -- possible to catch the arrow (pro skills)
physical = false, -- use Raycast
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
visual = "wielditem",
textures = {"petz:square_ball"},
visual_size = {x = 0.2, y = 0.15},
old_pos = nil,
shooter_name = "",
parent_entity = nil,
waiting_for_removal = false,
on_activate = function(self)
self.object:set_acceleration({x = 0, y = -9.81, z = 0})
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
return false
end,
on_rightclick = function(self, clicker)
if self.object:get_attach() then --if attached
local attach = self.object:get_attach()
local inv = clicker:get_inventory()
local new_stack = "petz:square_ball"
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
local parent_pos = attach:get_pos()
minetest.add_item(parent_pos, new_stack)
end
self.object:set_detach()
local parent_ent = attach:get_luaentity()
parent_ent.square_ball_attached = false
parent_ent.attached_squared_ball = nil
mobkit.clear_queue_low(parent_ent)
petz.ownthing(parent_ent)
self.object:remove() --remove the square ball
mobkit.clear_queue_low(parent_ent)
petz.ownthing(parent_ent)
end
end,
on_step = function(self, dtime)
if self.shooter_name == "" then
if self.object:get_attach() == nil then
self.object:remove()
end
return
end
if self.waiting_for_removal then
self.object:remove()
return
end
local pos = self.object:get_pos()
self.old_pos = self.old_pos or pos
local cast = minetest.raycast(self.old_pos, pos, true, false)
local thing = cast:next()
while thing do
if thing.type == "object" and thing.ref ~= self.object then
--minetest.chat_send_player("singleplayer", thing.type)
local thing_ent = thing.ref:get_luaentity()
if not(thing.ref:is_player()) and not(thing.ref:get_player_name() == self.shooter_name)
and (thing_ent.type == "puppy") and not(thing_ent.square_ball_attached) then
petz.attach_squareball(self, thing_ent, thing.ref, self.shooter_name)
return
end
elseif thing.type == "node" then
local name = minetest.get_node(thing.under).name
if minetest.registered_items[name].walkable then
itemstack_squareball = ItemStack("petz:square_ball")
--local meta = itemstack_squareball:get_meta()
--meta:set_string("shooter_name", self.shooter_name)
minetest.item_drop(itemstack_squareball,
nil, vector.round(self.old_pos))
self.waiting_for_removal = true
self.object:remove()
return
end
end
thing = cast:next()
end
self.old_pos = pos
end,
})

126
petz/api_tamagochi.lua Normal file
View File

@ -0,0 +1,126 @@
local modpath, S = ...
--
--The Tamagochi Mode
--
-- Increase/Descrease the pet affinity
petz.set_affinity = function(self, increase, amount)
local new_affinity
if increase == true then
new_affinity = self.affinity + amount
else
new_affinity = self.affinity - amount
end
if new_affinity > 100 then
new_affinity = 100
elseif new_affinity < 0 then
new_affinity = 0
end
self.affinity = new_affinity
mobkit.remember(self, "affinity", self.affinity)
end
--The Tamagochi Timer
petz.init_timer = function(self)
if (petz.settings.tamagochi_mode == true) and (self.tamed == true) and (self.init_timer == true) then
petz.timer(self)
return true
else
return false
end
end
--
--Tamagochi Mode Timer
--
petz.timer = function(self)
minetest.after(petz.settings.tamagochi_check_time, function(self)
if not(self.object== nil) then
if (not(minetest.is_singleplayer())) and (petz.settings.tamagochi_check_if_player_online == true) then
if minetest.player_exists(self.owner) == false then --if pet owner is not online
return
end
end
local pos = self.object:get_pos()
if not(pos == nil) then --important for if the pet dies
local pos_below = {
x = pos.x,
y = pos.y - 1.5,
z = pos.z,
}
local node = minetest.get_node_or_nil(pos_below)
--minetest.chat_send_player(self.owner, petz.settings.tamagochi_safe_node)
for i = 1, #petz.settings.tamagochi_safe_nodes do --loop thru all safe nodes
if node and (node.name == petz.settings.tamagochi_safe_nodes[i]) then
self.init_timer = true
mobkit.remember(self, "init_timer", self.init_timer)
return
end
end
else --if the pos is nil, it means that the pet died before 'minetest.after_effect'
self.init_timer = false
mobkit.remember(self, "init_timer", self.init_timer) --so no more timer
return
end
--Decrease affinitty always a bit amount because the pet lost some affinitty
if self.has_affinity == true then
petz.set_affinity(self, false, 10)
end
--Decrease health if pet has not fed
if self.fed == false then
local damage_amount = - petz.settings.tamagochi_hunger_damage
mobkit.hurt(self, damage_amount)
petz.update_nametag(self)
if (self.hp > 0) and (self.has_affinity == true) then
petz.set_affinity(self, false, 33)
end
else
self.fed = false
mobkit.remember(self, "fed", self.fed) --Reset the variable
end
--If the pet has not brushed
if self.can_be_brushed == true then
if self.brushed == false then
if self.has_affinity == true then
petz.set_affinity(self, false, 20)
end
else
self.brushed = false
mobkit.remember(self, "brushed", self.brushed) --Reset the variable
end
end
--If the petz is a lion had to been lashed
if self.type== "lion" then
if self.lashed == false then
petz.set_affinity(self, false, 25)
else
self.lashed = false
mobkit.remember(self, "lashed", self.lashed)
end
end
--If the pet starves to death
if self.hp <= 0 then
minetest.chat_send_player(self.owner, S("Your").. " "..self.type.." "..S("has starved to death!!!"))
self.init_timer = false -- no more timing
--I the pet get bored of you
elseif (self.has_affinity == true) and (self.affinity == 0) then
minetest.chat_send_player(self.owner, S("Your").." "..self.type.." "..S("has abandoned you!!!"))
petz.delete_nametag(self)
self.owner = "" --the pet abandon you
mobkit.remember(self, "owner", self.owner)
self.tamed = false
mobkit.remember(self, "tamed", self.tamed)
petz.drop_dreamcatcher(self)
self.init_timer = false -- no more timing
--Else reinit the timer, to check again in the future
else
self.init_timer = true
end
end
end, self)
self.init_timer = false --the timer is reinited in the minetest.after function
end

View File

@ -0,0 +1,17 @@
local modpath, S = ...
petz.wolf_to_puppy= function(self, player_name)
self.wolf_to_puppy_count = self.wolf_to_puppy_count - 1
mobkit.remember(self, "wolf_to_puppy_count", self.wolf_to_puppy_count)
if self.wolf_to_puppy_count <= 0 then
local pos = self.object:get_pos()
local puppy = minetest.add_entity(pos, "petz:puppy")
local puppy_entity = puppy:get_luaentity()
puppy_entity.tamed = true
mobkit.remember(puppy_entity, "tamed", puppy_entity.tamed)
puppy_entity.owner = player_name
mobkit.remember(puppy_entity, "owner", puppy_entity.owner)
self.object:remove()
minetest.chat_send_player(player_name , S("The wolf turn into puppy."))
end
end

86
petz/api_wool_milk.lua Normal file
View File

@ -0,0 +1,86 @@
local modpath, S = ...
---
---Refill lamb or milk
---
petz.refill = function(self)
if self.type == "lamb" then
petz.lamb_wool_regrow(self)
elseif self.milkable == true then
petz.milk_refill(self)
end
end
--
--Lamb Wool
--
petz.lamb_wool_regrow = function(self)
if self.shaved == false then --only count if the lamb is shaved
return
end
self.food_count_wool = self.food_count_wool + 1
mobkit.remember(self, "food_count_wool", self.food_count_wool)
if self.food_count_wool >= 5 then -- if lamb replaces 5x grass then it regrows wool
self.food_count_wool = 0
mobkit.remember(self, "food_count_wool", self.food_count_wool)
self.shaved = false
mobkit.remember(self, "shaved", self.shaved)
local lamb_texture = "petz_lamb_"..self.skin_colors[self.texture_no]..".png"
petz.set_properties(self, {textures = {lamb_texture}})
end
end
petz.lamb_wool_shave = function(self, clicker)
local inv = clicker:get_inventory()
local new_stack = "wool:"..self.skin_colors[self.texture_no]
if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack)
else
minetest.add_item(self.object:get_pos(), new_stack)
end
petz.do_sound_effect("object", self.object, "petz_lamb_moaning")
local lamb_texture = "petz_lamb_shaved_"..self.skin_colors[self.texture_no]..".png"
if petz.settings.type_model == "mesh" then
petz.set_properties(self, {textures = {lamb_texture}})
else
petz.set_properties(self, {tiles = petz.lamb.tiles_shaved})
end
petz.mob_sound(self, "petz_lamb_moaning.ogg", 1.0, 10)
self.shaved = true
mobkit.remember(self, "shaved", self.shaved)
self.food_count_wool = 0 --reset the food count
mobkit.remember(self, "food_count_wool", self.food_count_wool)
petz.afraid(self, clicker:get_pos())
end
---
--Calf Milk
---
petz.milk_refill = function(self)
self.food_count = self.food_count + 1
mobkit.remember(self, "food_count", self.food_count)
if self.food_count >= 5 then -- if calf replaces 5x grass then it refill milk
self.food_count = 0
mobkit.remember(self, "food_count", self.food_count)
self.milked = false
mobkit.remember(self, "milked", self.milked)
end
end
petz.milk_milk = function(self, clicker)
local inv = clicker:get_inventory()
if inv:room_for_item("main", "petz:bucket_milk") then
local wielded_item = clicker:get_wielded_item()
wielded_item:take_item()
clicker:set_wielded_item("petz:bucket_milk")
inv:add_item("main", wielded_item)
petz.do_sound_effect("object", self.object, "petz_"..self.type.."_moaning")
else
minetest.add_item(self:get_pos(), "petz:bucket_milk")
end
self.milked = true
mobkit.remember(self, "milked", self.milked)
end

View File

@ -278,12 +278,14 @@ minetest.register_tool("petz:shears", {
})
minetest.register_craft({
type = "shaped",
output = 'petz:shears',
recipe = {
{'', 'default:steel_ingot', ''},
{'', 'group:stick', 'default:steel_ingot'},
}
})
-- Lasso
minetest.register_tool("petz:lasso", {
description = S("Lasso"),
@ -401,3 +403,12 @@ minetest.register_node("petz:bottle_moth", {
--minetest.chat_send_player("singleplayer", meta:get_string("owner"))
end,
})
--Bonemeal support
if minetest.get_modpath("bonemeal") ~= nil then
minetest.register_craft({
type = "shapeless",
output = "bonemeal:bonemeal",
recipe = {"petz:bone"},
})
end

View File

@ -1,3 +1,5 @@
name = petz
description = Cute mobs for Minetest
depends = default, mobkit, stairs, dye, farming, vessels, wool
optional_depends = bonemeal

BIN
petz/models/petz_bat.b3d Normal file

Binary file not shown.

BIN
petz/models/petz_bat.blend Normal file

Binary file not shown.

BIN
petz/models/petz_bat.blend1 Normal file

Binary file not shown.

184
petz/models/petz_bat.obj Normal file
View File

@ -0,0 +1,184 @@
mtllib petz_bat.mtl
o converted_out
v 0.0625 -0.5 -0.0625
v 0.0625 -0.5 3.35276e-08
v 0.0625 -0.4375 3.35276e-08
v 0.0625 -0.4375 -0.0625
v 2.6077e-08 -0.5 -0.0625
v 2.6077e-08 -0.5 3.35276e-08
v 2.6077e-08 -0.4375 3.35276e-08
v 2.6077e-08 -0.4375 -0.0625
v -0.0625 -0.5 -0.0625
v -0.0625 -0.5 0
v -0.0625 -0.4375 0
v -0.0625 -0.4375 -0.0625
v -0.125 -0.5 -0.0625
v -0.125 -0.5 0
v -0.125 -0.4375 0
v -0.125 -0.4375 -0.0625
v 0.0625 -0.4375 -0.0625
v 0.0625 -0.4375 0
v 0.0625 -0.3125 0
v 0.0625 -0.3125 -0.0625
v -0.125 -0.4375 -0.0625
v -0.125 -0.4375 0
v -0.125 -0.3125 0
v -0.125 -0.3125 -0.0625
v 0.0625 -0.3125 -0.125
v 0.0625 -0.3125 0
v 0.0625 -0.125 0
v 0.0625 -0.125 -0.125
v -0.125 -0.3125 -0.125
v -0.125 -0.3125 0
v -0.125 -0.125 0
v -0.125 -0.125 -0.125
v 0.125 -0.375 -0.0625
v 0.125 -0.375 0.125
v 0.125 -0.3125 0.125
v 0.125 -0.3125 -0.0625
v 0.0625 -0.375 -0.0625
v 0.0625 -0.375 0.125
v 0.0625 -0.3125 0.125
v 0.0625 -0.3125 -0.0625
v 0.1875 -0.375 0
v 0.1875 -0.375 0.1875
v 0.1875 -0.3125 0.1875
v 0.1875 -0.3125 0
v 0.125 -0.375 0
v 0.125 -0.375 0.1875
v 0.125 -0.3125 0.1875
v 0.125 -0.3125 0
v 0.25 -0.375 0.0625
v 0.25 -0.375 0.25
v 0.25 -0.3125 0.25
v 0.25 -0.3125 0.0625
v 0.1875 -0.375 0.0625
v 0.1875 -0.375 0.25
v 0.1875 -0.3125 0.25
v 0.1875 -0.3125 0.0625
v -0.125 -0.375 -0.0625
v -0.125 -0.375 0.125
v -0.125 -0.3125 0.125
v -0.125 -0.3125 -0.0625
v -0.1875 -0.375 -0.0625
v -0.1875 -0.375 0.125
v -0.1875 -0.3125 0.125
v -0.1875 -0.3125 -0.0625
v -0.1875 -0.375 0
v -0.1875 -0.375 0.1875
v -0.1875 -0.3125 0.1875
v -0.1875 -0.3125 0
v -0.25 -0.375 0
v -0.25 -0.375 0.1875
v -0.25 -0.3125 0.1875
v -0.25 -0.3125 0
v -0.25 -0.375 0.0625
v -0.25 -0.375 0.25
v -0.25 -0.3125 0.25
v -0.25 -0.3125 0.0625
v -0.3125 -0.375 0.0625
v -0.3125 -0.375 0.25
v -0.3125 -0.3125 0.25
v -0.3125 -0.3125 0.0625
v 0.0625 -0.125 -0.125
v 0.0625 -0.125 -0.0625
v 0.0625 2.23517e-08 -0.0625
v 0.0625 2.23517e-08 -0.125
v 3.72529e-09 -0.125 -0.125
v 3.72529e-09 -0.125 -0.0625
v 3.72529e-09 2.23517e-08 -0.0625
v 3.72529e-09 2.23517e-08 -0.125
v -0.0625 -0.125 -0.125
v -0.0625 -0.125 -0.0625
v -0.0625 3.72529e-08 -0.0625
v -0.0625 3.72529e-08 -0.125
v -0.125 -0.125 -0.125
v -0.125 -0.125 -0.0625
v -0.125 3.72529e-08 -0.0625
v -0.125 3.72529e-08 -0.125
usemtl none
s off
g right_leg
f 1 2 3 4
f 5 6 7 8
f 1 4 8 5
f 2 3 7 6
f 1 2 6 5
f 4 3 7 8
g left_leg
f 9 10 11 12
f 13 14 15 16
f 9 12 16 13
f 10 11 15 14
f 9 10 14 13
f 12 11 15 16
g body
f 17 18 19 20
f 21 22 23 24
f 17 20 24 21
f 18 19 23 22
f 17 18 22 21
f 20 19 23 24
g head
f 25 26 27 28
f 29 30 31 32
f 25 28 32 29
f 26 27 31 30
f 25 26 30 29
f 28 27 31 32
g front_right_wing
f 33 34 35 36
f 37 38 39 40
f 33 36 40 37
f 34 35 39 38
f 33 34 38 37
f 36 35 39 40
g middle_right_wing
f 41 42 43 44
f 45 46 47 48
f 41 44 48 45
f 42 43 47 46
f 41 42 46 45
f 44 43 47 48
g back_right_wing
f 49 50 51 52
f 53 54 55 56
f 49 52 56 53
f 50 51 55 54
f 49 50 54 53
f 52 51 55 56
g front_left_leg
f 57 58 59 60
f 61 62 63 64
f 57 60 64 61
f 58 59 63 62
f 57 58 62 61
f 60 59 63 64
g middle_left_wing
f 65 66 67 68
f 69 70 71 72
f 65 68 72 69
f 66 67 71 70
f 65 66 70 69
f 68 67 71 72
g back_left_leg
f 73 74 75 76
f 77 78 79 80
f 73 76 80 77
f 74 75 79 78
f 73 74 78 77
f 76 75 79 80
g right_ear
f 81 82 83 84
f 85 86 87 88
f 81 84 88 85
f 82 83 87 86
f 81 82 86 85
f 84 83 87 88
g left_ear
f 89 90 91 92
f 93 94 95 96
f 89 92 96 93
f 90 91 95 94
f 89 90 94 93
f 92 91 95 96

BIN
petz/nodeboxes/petz_bat.nbe Normal file

Binary file not shown.

29
petz/pai_sound.lua Normal file
View File

@ -0,0 +1,29 @@
local modpath, S = ...
--
--Sound System
--
petz.random_mob_sound = function(self)
local random_number = math.random(1, petz.settings.misc_sound_chance)
if random_number == 1 then
if self.sounds and self.sounds['misc'] then
petz.mob_sound(self, self.sounds['misc'], 1.0, 10)
end
end
end
-- play sound
petz.mob_sound = function(self, sound, _gain, _max_hear_distance)
if sound then
minetest.sound_play(sound, {object = self.object, gain = _gain, max_hear_distance = _max_hear_distance})
end
end
petz.do_sound_effect = function(dest, dest_name, soundfile)
minetest.sound_play(soundfile, {dest = dest_name, gain = 0.4})
end
petz.set_properties = function(self, properties)
self.object:set_properties(properties)
end

BIN
petz/textures/petz_bat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

BIN
petz/textures/petz_bat2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB