Commit iniziale.
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
Minetest block_league
|
||||
Copyright (C) 2020 Marco
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
Minetest block_league Copyright (C) 2020 Marco
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,34 @@
|
|||
# Minetest Block League
|
||||
|
||||
S4 League inspired shooter minigame for Minetest.
|
||||
|
||||
### Dependencies
|
||||
* [achievements_lib](https://gitlab.com/zughy-friends-minetest/achievements_lib) by me
|
||||
* [arena_lib](https://gitlab.com/zughy-friends-minetest/arena_lib/) by me and friends
|
||||
* (already inside) [ChatCMDBuilder](https://github.com/rubenwardy/ChatCmdBuilder/) by rubenwardy
|
||||
* [controls](https://github.com/Arcelmi/minetest-controls) by Arcelmi
|
||||
* [panel_lib](https://gitlab.com/zughy-friends-minetest/panel_lib) by me and friends
|
||||
|
||||
|
||||
### Resources
|
||||
2D Graphic assets by me
|
||||
3D models by Scarecrow
|
||||
Bouncer sound by [iozonic](https://freesound.org/people/iozonic/sounds/380763/)
|
||||
HMG shooting sound by [tcpp](https://freesound.org/people/tcpp/sounds/105025/)
|
||||
Pixelgun shooting sound by [debsound](https://freesound.org/people/debsound/sounds/339169/)
|
||||
Rocket launcher shooting sound by [Audionautics](https://freesound.org/people/Audionautics/sounds/171655/)
|
||||
Shotgun shooting sound by [coolguy](https://freesound.org/people/coolguy244e/sounds/266977/)
|
||||
Shotgun reloading sound by [jeseid77](https://freesound.org/people/jeseid77/sounds/86246/)
|
||||
SMG shooting sound by [kafokafo](https://freesound.org/people/kafokafo/sounds/128229/)
|
||||
Hit sound by [cabled_mess](https://freesound.org/people/cabled_mess/sounds/350926/)
|
||||
Kill sound by [jmayoff](https://freesound.org/people/jmayoff/sounds/255156/)
|
||||
Voice acting clips by [EFlexMusic](https://freesound.org/people/EFlexMusic/)
|
||||
Crowd cheering by [wangzhuokun](https://freesound.org/people/wangzhuokun/sounds/442583/)
|
||||
Crowd "oh no" by [dobroide](https://freesound.org/people/dobroide/sounds/35034/)
|
||||
Ball "resetting" voice by [tim.kahn](https://freesound.org/people/tim.kahn/sounds/107546/)
|
||||
|
||||
Most audio files have been tweaked by me
|
||||
|
||||
---
|
||||
|
||||
Images and models are under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
|
|
@ -0,0 +1,108 @@
|
|||
local S = minetest.get_translator("block_league")
|
||||
|
||||
function block_league.weapons_hud_create(p_name)
|
||||
|
||||
local inv = minetest.get_player_by_name(p_name):get_inventory()
|
||||
local sub_img_elems = {}
|
||||
local sub_txt_elems = {}
|
||||
local offset = -120
|
||||
for i = 0,inv:get_size("main"),1 do
|
||||
local stack = inv:get_stack("main", i)
|
||||
local item_name = stack:get_name()
|
||||
local definition = minetest.registered_nodes[item_name]
|
||||
if definition ~= nil and (definition.throwable_by_hand ~= nil or definition.bullet ~= nil) then
|
||||
sub_img_elems[item_name .. "_icon"] = {
|
||||
scale = { x = 2, y = 2 },
|
||||
offset = { x = 10, y = offset },
|
||||
alignment = { x = 1, y = 0 },
|
||||
text = definition.inventory_image,
|
||||
z_index = 1
|
||||
}
|
||||
sub_img_elems[item_name .. "_bg"] = {
|
||||
scale = { x = 2, y = 2 },
|
||||
offset = { x = 10, y = offset },
|
||||
alignment = { x = 1, y = 0 },
|
||||
text = "background_weapons.png",
|
||||
z_index = 0
|
||||
}
|
||||
|
||||
local conto = 0
|
||||
if definition.bullet then
|
||||
for i=0,inv:get_size("main"),1 do
|
||||
local stack = inv:get_stack("main", i)
|
||||
local item_name = stack:get_name()
|
||||
if item_name == definition.bullet then
|
||||
conto = stack:get_count()
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local conto_proiettili = definition.throwable_by_hand and stack:get_count() or conto
|
||||
--[[
|
||||
sub_txt_elems[definition.name .. "_count_txt"] = {
|
||||
alignment = { x = 1, y = 0 },
|
||||
offset = { x = 50, y = offset },
|
||||
--text = ((definition.consume_bullets or definition.consume_on_throw) and conto_proiettili or "-1") .. " | " .. (definition.reload and definition.reload or "-1"),
|
||||
text = (definition.consume_bullets or definition.consume_on_throw) and conto_proiettili or "-1",
|
||||
z_index = 1
|
||||
}]]
|
||||
|
||||
sub_txt_elems[definition.name .. "_reload_txt"] = {
|
||||
alignment = { x = 3, y = 0 },
|
||||
offset = { x = 50, y = offset },
|
||||
text = definition.reload and definition.reload or "-1",
|
||||
z_index = 1
|
||||
}
|
||||
offset = offset - 50
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local panel = Panel:new({
|
||||
name = "bullets_hud",
|
||||
player = p_name,
|
||||
bg = "",
|
||||
position = { x = 0, y = 1 },
|
||||
alignment = { x = -1, y = 0 },
|
||||
title = "",
|
||||
|
||||
sub_img_elems = sub_img_elems,
|
||||
|
||||
sub_txt_elems = sub_txt_elems
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
function get_bullet_count(definition, inv)
|
||||
if definition.throwable_by_hand then
|
||||
return stack:get_count()
|
||||
else
|
||||
local conto = 0
|
||||
if definition.bullet then
|
||||
for i=0,inv:get_size("main"),1 do
|
||||
local stack = inv:get_stack("main", i)
|
||||
local item_name = stack:get_name()
|
||||
if item_name == definition.bullet then
|
||||
return stack:get_count()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function block_league.weapons_hud_update(arena, p_name, item_name, bullet_count, reload_count)
|
||||
local definition = minetest.registered_nodes[item_name]
|
||||
local panel = panel_lib.get_panel(p_name, "bullets_hud")
|
||||
panel:update(nil,
|
||||
{
|
||||
--[[
|
||||
[definition.name .. "_count_txt"] = {
|
||||
--text = ((bullet_count ~= nil) and bullet_count or (panel[definition.name .. "_count_txt"].text - 1)) .. " | " .. ((reload_count ~= nil) and reload_count or (panel[definition.name .. "_reload_txt"].text - 1))
|
||||
text = (bullet_count ~= nil) and bullet_count or (panel[definition.name .. "_count_txt"].text ~= "-1" and (panel[definition.name .. "_count_txt"].text - 1) or "-1")
|
||||
},]]
|
||||
|
||||
[definition.name .. "_reload_txt"] = {
|
||||
text = (reload_count ~= nil) and reload_count or (panel[definition.name .. "_reload_txt"].text ~= "-1" and (panel[definition.name .. "_reload_txt"].text - 1) or "- 1")
|
||||
}
|
||||
})
|
||||
end
|
|
@ -0,0 +1,118 @@
|
|||
local function new_HUD() return end
|
||||
|
||||
local saved_huds = {} -- p_name = {indexes}
|
||||
local show_time = {} -- p_name = time
|
||||
|
||||
-- la istanzio ogni volta tramite new_HUD
|
||||
local HUD = {
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.5, y = 0.25},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "",
|
||||
scale = { x = 4, y = 4},
|
||||
number = 0xFFFFFF,
|
||||
}
|
||||
|
||||
|
||||
|
||||
function block_league.HUD_achievements_create(p_name)
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
local basic_HUD = new_HUD(HUD)
|
||||
local slot_ID = player:hud_add(basic_HUD)
|
||||
|
||||
saved_huds[p_name] = {slot_ID}
|
||||
show_time[p_name] = 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.show_achievement(mod_key, p_name, achvmt_ID)
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
local last_ID = saved_huds[p_name][#saved_huds[p_name]] -- prendo l'ultimo elemento della lista
|
||||
local last_HUD = player:hud_get(last_ID)
|
||||
local img = achievements_lib.get_achievement(mod_key, achvmt_ID).img
|
||||
|
||||
-- se già sta mostrando un achievement, slitto la HUD
|
||||
if player:hud_get(last_ID).text ~= "" then
|
||||
|
||||
show_time[p_name] = show_time[p_name] + 2.5
|
||||
|
||||
local shift = 0.05
|
||||
local length = #saved_huds[p_name]
|
||||
|
||||
-- ridichiaro perché l'ultimo indice è cambiato se un altro achievement è
|
||||
-- stato impilato
|
||||
last_HUD = player:hud_get(saved_huds[p_name][length])
|
||||
|
||||
for i = 0, length-1 do
|
||||
local idx = saved_huds[p_name][length-i]
|
||||
player:hud_change(idx, "position", { x = player:hud_get(idx).position.x - shift, y = 0.25})
|
||||
end
|
||||
|
||||
-- sistemo i valori del nuovo slot
|
||||
local new_HUD = new_HUD(HUD)
|
||||
new_HUD.position.x = last_HUD.position.x + shift
|
||||
new_HUD.text = img
|
||||
|
||||
-- lo aggiungo
|
||||
local new_slot_ID = player:hud_add(new_HUD)
|
||||
|
||||
table.insert(saved_huds[p_name], new_slot_ID)
|
||||
|
||||
else
|
||||
player:hud_change(last_ID, "text", img)
|
||||
end
|
||||
|
||||
-- lo uso per verificare che questo achievement sia stato l'ultimo aggiunto dopo
|
||||
-- i 2.5 secondi dell'after. Perché ogni achievement nuovo incrementa show_time
|
||||
local current_time = show_time[p_name]
|
||||
|
||||
-- le immagini spariscono dopo 2.5 secondi
|
||||
minetest.after(2.5, function()
|
||||
|
||||
-- se non è online, annullo
|
||||
if minetest.get_player_by_name(p_name) == nil then return end
|
||||
|
||||
-- se ha ottenuto un nuovo achievement, annullo
|
||||
if current_time ~= show_time[p_name] then return end
|
||||
|
||||
-- se ha più achievement a schermo, rimuovo gli slot tranne il primo
|
||||
if #saved_huds[p_name] > 1 then
|
||||
for i = 2, #saved_huds[p_name] do
|
||||
player:hud_remove(saved_huds[p_name][i])
|
||||
end
|
||||
end
|
||||
|
||||
local original_ID = saved_huds[p_name][1]
|
||||
|
||||
-- resetto tutto
|
||||
player:hud_change(original_ID, "text", "")
|
||||
player:hud_change(original_ID, "position", { x = 0.5, y = 0.25 })
|
||||
show_time[p_name] = 0
|
||||
|
||||
|
||||
saved_huds[p_name] = {original_ID}
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function new_HUD(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[new_HUD(orig_key)] = new_HUD(orig_value)
|
||||
end
|
||||
setmetatable(copy, new_HUD(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
|
@ -0,0 +1,52 @@
|
|||
local saved_huds = {} -- p_name = {indexes}
|
||||
|
||||
|
||||
|
||||
function block_league.HUD_broadcast_create(p_name)
|
||||
|
||||
local HUD = {
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.5, y = 0.35},
|
||||
alignment = { x = 0, y = 0},
|
||||
text = "",
|
||||
size = { x = 2 },
|
||||
number = "0xFFFFFF"
|
||||
}
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
local HUD_ID = player:hud_add(HUD)
|
||||
|
||||
saved_huds[p_name] = HUD_ID
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.HUD_broadcast_remove(p_name)
|
||||
|
||||
minetest.get_player_by_name(p_name):hud_remove(saved_huds[p_name])
|
||||
saved_huds[p_name] = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.HUD_broadcast_player(p_name, msg, duration, hex_color)
|
||||
|
||||
local HUD_ID = saved_huds[p_name]
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
local hex_color = hex_color == nil and "0xFFFFFF" or hex_color
|
||||
|
||||
player:hud_change(HUD_ID, "text", msg)
|
||||
player:hud_change(HUD_ID, "number", hex_color)
|
||||
|
||||
minetest.after(duration, function()
|
||||
|
||||
if not minetest.get_player_by_name(p_name) then return end -- potrebbe essersi disconnesso
|
||||
if not player:hud_get(HUD_ID) then return end -- potrebbe essere uscito dalla partita (che rimuove la HUD)
|
||||
|
||||
local current_message = player:hud_get(HUD_ID).text
|
||||
if msg == current_message then
|
||||
player:hud_change(HUD_ID, "text", "")
|
||||
end
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
function block_league.energy_create(arena, p_name)
|
||||
local panel = Panel:new({
|
||||
name = "blockleague_energy",
|
||||
player = p_name,
|
||||
bg = "",
|
||||
title = "",
|
||||
position = { x = 0.5, y = 1 },
|
||||
alignment = { x = 0, y = 0 },
|
||||
sub_img_elems = {
|
||||
energy_indicator = {
|
||||
scale = {x = 1/5, y = 1.7},
|
||||
offset = {x = 0, y = -110},
|
||||
alignment = { x = 0, y = 0 },
|
||||
text = "block_league_hud_panel_playerindicator.png"
|
||||
},
|
||||
},
|
||||
sub_txt_elems = {
|
||||
energy_clmn = {
|
||||
alignment = { x = 0, y = 1 },
|
||||
offset = {x = 0, y = -118},
|
||||
text = ""
|
||||
},
|
||||
}
|
||||
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
function block_league.energy_update(arena, p_name)
|
||||
|
||||
local panel = panel_lib.get_panel(p_name, "blockleague_energy")
|
||||
|
||||
panel:update(nil,
|
||||
{energy_clmn = {
|
||||
text = arena.players[p_name].energy
|
||||
}}
|
||||
)
|
||||
panel:update(nil,
|
||||
{energy_indicator = {
|
||||
scale = {x = arena.players[p_name].energy/5, y = 1.7},
|
||||
}}
|
||||
)
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,147 @@
|
|||
|
||||
function block_league.scoreboard_create(arena, p_name)
|
||||
local panel = Panel:new({
|
||||
name = "blockleague_scoreboard",
|
||||
player = p_name,
|
||||
bg_scale = { x = 45, y = 28 },
|
||||
position = { x = 0.5, y = 0.5 },
|
||||
alignment = { x = 0, y = 0 },
|
||||
title = "PLAYERS\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\tKILLS\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\tDEATHS",
|
||||
title_offset = { x = 0, y = -150},
|
||||
title_color = 0xdff6f5,
|
||||
|
||||
sub_img_elems = {
|
||||
player_indicator = {
|
||||
scale = {x = 44, y = 1.7},
|
||||
offset = {x = 0, y = -121},
|
||||
alignment = { x = 0, y = 0 },
|
||||
text = "block_league_hud_panel_playerindicator_teams.png"
|
||||
},
|
||||
team_indicator_red = {
|
||||
scale = {x = 44, y = 1.7},
|
||||
offset = {x = 0, y = -121},
|
||||
alignment = { x = 0, y = 0 },
|
||||
text = "block_league_hud_panel_teamindicator_red.png"
|
||||
},
|
||||
team_indicator_blue = {
|
||||
scale = {x = 44, y = 1.7},
|
||||
offset = {x = 0, y = -121},
|
||||
alignment = { x = 0, y = 0 },
|
||||
text = "block_league_hud_panel_teamindicator_blue.png"
|
||||
},
|
||||
},
|
||||
|
||||
sub_txt_elems = {
|
||||
players_clmn = {
|
||||
alignment = { x = 0, y = 1 },
|
||||
offset = {x = -250, y = -130},
|
||||
text = "player"
|
||||
},
|
||||
kls_clmn = {
|
||||
alignment = { x = 0, y = 1 },
|
||||
offset = {x = 0, y = -130},
|
||||
text = "0"
|
||||
},
|
||||
dts_clmn = {
|
||||
alignment = { x = 0, y = 1 },
|
||||
offset = {x = 250, y = -130},
|
||||
text = "0"
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.scoreboard_update(arena)
|
||||
|
||||
local plyrs_clmn = ""
|
||||
local kills_clmn = ""
|
||||
local deaths_clmn = ""
|
||||
|
||||
-- creo una tabella per avere i giocatori ordinati con nome come KEY
|
||||
local players_idx = {}
|
||||
local bar_red = -121
|
||||
local bar_blue = -121
|
||||
|
||||
local bar_pos = -121 -- posizione Y più alta della barra per evidenziare il giocatore client
|
||||
local dist_between_bars = 36 -- distanza Y tra un giocatore e l'altro (equivalente a "\n\n")
|
||||
|
||||
local sorted_teams = {}
|
||||
|
||||
-- ordino i team
|
||||
for id, team in pairs(arena.teams) do
|
||||
--salvo anche l'id del team così da non dover iterare di nuovo
|
||||
table.insert(sorted_teams, {name = team.name, kills = team.kills, deaths = team.deaths, id = id})
|
||||
end
|
||||
|
||||
-- determino come stampare i team seguiti dai giocatori
|
||||
for _, team in pairs(sorted_teams) do
|
||||
plyrs_clmn = plyrs_clmn .. S("Team") .. " " .. team.name .. "\n\n"
|
||||
kills_clmn = kills_clmn .. team.kills .. "\n\n"
|
||||
deaths_clmn = deaths_clmn .. team.deaths .. "\n\n"
|
||||
|
||||
if team.name == S("red") then
|
||||
bar_red = bar_pos
|
||||
elseif team.name == S("blue") then
|
||||
bar_blue = bar_pos
|
||||
end
|
||||
bar_pos = bar_pos + dist_between_bars
|
||||
|
||||
local sorted_players = {}
|
||||
|
||||
for _, pl_name in pairs(arena_lib.get_players_in_team(arena, team.id)) do
|
||||
table.insert(sorted_players, {pl_name, arena.players[pl_name].kills, arena.players[pl_name].deaths})
|
||||
end
|
||||
|
||||
table.sort(sorted_players, function (a,b) return a[2] > b[2] end)
|
||||
|
||||
-- creo le stringhe dei giocatori
|
||||
for _, stats in pairs(sorted_players) do
|
||||
|
||||
plyrs_clmn = plyrs_clmn .. stats[1] .. "\n\n"
|
||||
kills_clmn = kills_clmn .. stats[2] .. "\n\n"
|
||||
deaths_clmn = deaths_clmn .. stats[3] .. "\n\n"
|
||||
|
||||
players_idx[stats[1]] = bar_pos
|
||||
bar_pos = bar_pos + dist_between_bars
|
||||
|
||||
end
|
||||
|
||||
plyrs_clmn = plyrs_clmn .. "\n\n"
|
||||
kills_clmn = kills_clmn .. "\n\n"
|
||||
deaths_clmn = deaths_clmn .. "\n\n"
|
||||
bar_pos = bar_pos + dist_between_bars
|
||||
|
||||
end
|
||||
|
||||
-- aggiorno il pannello
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
local panel = panel_lib.get_panel(pl_name, "blockleague_scoreboard")
|
||||
local bar_height = players_idx[pl_name] -- l'altezza della barra che segnala al client dove si trova nel panello
|
||||
|
||||
panel:update(nil,
|
||||
|
||||
{players_clmn = {
|
||||
text = plyrs_clmn
|
||||
},
|
||||
kls_clmn = {
|
||||
text = kills_clmn
|
||||
},
|
||||
dts_clmn = {
|
||||
text = deaths_clmn
|
||||
}},
|
||||
|
||||
{player_indicator = {
|
||||
offset = { x = 0, y = bar_height }
|
||||
},
|
||||
team_indicator_red = {
|
||||
offset = { x = 0, y = bar_red }
|
||||
},
|
||||
team_indicator_blue = {
|
||||
offset = { x = 0, y = bar_blue }
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,51 @@
|
|||
function block_league.HUD_teams_score_create(p_name)
|
||||
|
||||
local panel = Panel:new({
|
||||
name = "blockleague_teams_score",
|
||||
player = p_name,
|
||||
position = { x = 0.5, y = 0},
|
||||
alignment = { x = 0, y = 0},
|
||||
bg = "",
|
||||
bg_scale = { x = 15, y = 6},
|
||||
title = "",
|
||||
|
||||
sub_txt_elems = {
|
||||
team_red_score = {
|
||||
offset = { x = -50, y = 25 },
|
||||
size = { x = 3 },
|
||||
number = "0xFF0000",
|
||||
text = "0"
|
||||
},
|
||||
team_blue_score = {
|
||||
offset = { x = 50, y = 25 },
|
||||
size = { x = 3 },
|
||||
number = "0x00FFFF",
|
||||
text = "0"
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
function block_league.HUD_teams_score_update(arena, p_name, teamID)
|
||||
|
||||
local panel = panel_lib.get_panel(p_name, "blockleague_teams_score")
|
||||
local score = 0
|
||||
|
||||
if arena.mod == 1 then
|
||||
score = arena.teams[teamID].TDs
|
||||
else
|
||||
score = arena.teams[teamID].kills
|
||||
end
|
||||
|
||||
if teamID == 1 then
|
||||
panel:update(nil,
|
||||
{team_red_score = {
|
||||
text = score
|
||||
}})
|
||||
else
|
||||
panel:update(nil,
|
||||
{team_blue_score = {
|
||||
text = score
|
||||
}})
|
||||
end
|
||||
end
|
|
@ -0,0 +1,263 @@
|
|||
local S = minetest.get_translator("block_league")
|
||||
|
||||
local function reset_meta() end
|
||||
|
||||
|
||||
|
||||
arena_lib.on_load("block_league", function(arena)
|
||||
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
|
||||
reset_meta(pl_name)
|
||||
|
||||
block_league.HUD_broadcast_create(pl_name)
|
||||
block_league.scoreboard_create(arena, pl_name)
|
||||
block_league.HUD_teams_score_create(pl_name)
|
||||
block_league.energy_create(arena, pl_name)
|
||||
|
||||
|
||||
panel_lib.get_panel(pl_name, "blockleague_teams_score"):show()
|
||||
panel_lib.get_panel(pl_name, "blockleague_energy"):show()
|
||||
|
||||
minetest.sound_play("block_league_voice_countdown", {
|
||||
to_player = pl_name,
|
||||
})
|
||||
|
||||
-- non crea E aggiorna l'HUD al tempo stesso, dacché l'after...
|
||||
minetest.after(0.1, function()
|
||||
block_league.energy_update(arena, pl_name)
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
minetest.after(0.01, function()
|
||||
block_league.scoreboard_update(arena)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
function block_league.add_default_weapons(inv, arena)
|
||||
local default_weapons = {"block_league:smg", "block_league:sword", "block_league:pixelgun", "block_league:bouncer"}
|
||||
for i, weapon_name in pairs(default_weapons) do
|
||||
inv:add_item("main", ItemStack(weapon_name))
|
||||
end
|
||||
end
|
||||
|
||||
function block_league.remove_default_weapons(inv, arena)
|
||||
local default_weapons = {"block_league:smg", "block_league:sword", "block_league:pixelgun", "block_league:bouncer"}
|
||||
for i, weapon_name in pairs(default_weapons) do
|
||||
inv:remove_item("main", ItemStack(weapon_name .. "99"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
arena_lib.on_start("block_league", function(arena)
|
||||
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
|
||||
local player = minetest.get_player_by_name(pl_name)
|
||||
block_league.add_default_weapons(player:get_inventory(), arena)
|
||||
block_league.weapons_hud_create(pl_name)
|
||||
panel_lib.get_panel(pl_name, "bullets_hud"):show()
|
||||
|
||||
player:set_physics_override({
|
||||
speed = arena.high_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
|
||||
minetest.sound_play("block_league_voice_fight", {
|
||||
to_player = pl_name,
|
||||
})
|
||||
|
||||
player:set_armor_groups({immortal = nil})
|
||||
|
||||
end
|
||||
|
||||
if arena.prototipo_spawn ~= nil then
|
||||
local pos1 = {x = arena.prototipo_spawn.x - 1, y = arena.prototipo_spawn.y - 1, z = arena.prototipo_spawn.z - 1}
|
||||
local pos2 = {x = arena.prototipo_spawn.x + 1, y = arena.prototipo_spawn.y + 1, z = arena.prototipo_spawn.z + 1}
|
||||
--minetest.load_area(pos1, pos2)
|
||||
--minetest.emerge_area(pos1, pos2)
|
||||
minetest.forceload_block(pos1, pos2)
|
||||
minetest.after(3, function()
|
||||
local ent = minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
end)
|
||||
end
|
||||
|
||||
block_league.energy_refill(arena)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_join("block_league", function(p_name, arena)
|
||||
|
||||
reset_meta(p_name)
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
|
||||
block_league.HUD_broadcast_create(p_name)
|
||||
block_league.scoreboard_create(arena, p_name)
|
||||
block_league.HUD_teams_score_create(p_name)
|
||||
block_league.energy_create(arena, p_name)
|
||||
|
||||
panel_lib.get_panel(p_name, "blockleague_teams_score"):show()
|
||||
panel_lib.get_panel(p_name, "blockleague_energy"):show()
|
||||
|
||||
block_league.add_default_weapons(player:get_inventory(), arena)
|
||||
block_league.weapons_hud_create(p_name)
|
||||
panel_lib.get_panel(p_name, "bullets_hud"):show()
|
||||
|
||||
player:set_physics_override({
|
||||
speed = arena.high_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
|
||||
minetest.sound_play("block_league_voice_fight", {
|
||||
to_player = p_name,
|
||||
})
|
||||
|
||||
player:set_armor_groups({immortal = nil})
|
||||
|
||||
minetest.after(0.01, function()
|
||||
block_league.energy_update(arena, p_name)
|
||||
block_league.scoreboard_update(arena)
|
||||
block_league.HUD_teams_score_update(arena, p_name, arena.players[p_name].teamID)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_celebration("block_league", function(arena, winner_name)
|
||||
|
||||
--block_league.add_xp(winner_name, 50)
|
||||
|
||||
minetest.after(0.01, function()
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
|
||||
local inv = minetest.get_player_by_name(pl_name):get_inventory()
|
||||
|
||||
block_league.remove_default_weapons(inv, arena)
|
||||
inv:add_item("main", ItemStack("block_league:match_over"))
|
||||
|
||||
local player = minetest.get_player_by_name(pl_name)
|
||||
player:set_armor_groups({immortal=1})
|
||||
|
||||
panel_lib.get_panel(pl_name, "blockleague_scoreboard"):show()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_end("block_league", function(arena, players)
|
||||
|
||||
for pl_name, stats in pairs(players) do
|
||||
|
||||
--local stats = panel_lib.get_panel(pl_name, "blockleague_stats")
|
||||
local scoreboard = panel_lib.get_panel(pl_name, "blockleague_scoreboard")
|
||||
local team_score = panel_lib.get_panel(pl_name, "blockleague_teams_score")
|
||||
|
||||
--stats:remove()
|
||||
scoreboard:remove()
|
||||
team_score:remove()
|
||||
panel_lib.get_panel(pl_name, "bullets_hud"):remove()
|
||||
block_league.HUD_broadcast_remove(pl_name)
|
||||
panel_lib.get_panel(pl_name, "blockleague_energy"):remove()
|
||||
|
||||
block_league.update_storage(pl_name)
|
||||
|
||||
local player = minetest.get_player_by_name(pl_name)
|
||||
player:set_armor_groups({immortal = nil})
|
||||
|
||||
-- se non c'è hub_manager, resetto la fisica
|
||||
if not minetest.get_modpath("hub_manager") then
|
||||
minetest.get_player_by_name(pl_name):set_physics_override({
|
||||
speed = 1,
|
||||
jump = 1,
|
||||
gravity = 1,
|
||||
sneak_glitch = false
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_death("block_league", function(arena, p_name, reason)
|
||||
|
||||
-- se muoio suicida, perdo una kill
|
||||
if reason.type == "fall" or reason.player_name == p_name then
|
||||
|
||||
local p_stats = arena.players[p_name]
|
||||
|
||||
p_stats.kills = p_stats.kills - 1
|
||||
local team = arena.teams[p_stats.teamID]
|
||||
team.deaths = team.deaths + 1
|
||||
block_league.scoreboard_update(arena)
|
||||
block_league.subtract_exp(p_name, 10)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
arena_lib.on_quit("block_league", function(arena, p_name)
|
||||
|
||||
--local stats = panel_lib.get_panel(p_name, "blockleague_stats")
|
||||
local scoreboard = panel_lib.get_panel(p_name, "blockleague_scoreboard")
|
||||
local team_score = panel_lib.get_panel(p_name, "blockleague_teams_score")
|
||||
|
||||
--stats:remove()
|
||||
scoreboard:remove()
|
||||
team_score:remove()
|
||||
panel_lib.get_panel(p_name, "bullets_hud"):remove()
|
||||
panel_lib.get_panel(p_name, "blockleague_energy"):remove()
|
||||
block_league.HUD_broadcast_remove(p_name)
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
|
||||
player:set_armor_groups({immortal = nil})
|
||||
player:get_meta():set_int("blockleague_has_ball", 0)
|
||||
|
||||
-- se non c'è hub_manager, resetto la fisica
|
||||
if not minetest.get_modpath("hub_manager") then
|
||||
minetest.get_player_by_name(p_name):set_physics_override({
|
||||
speed = 1,
|
||||
jump = 1,
|
||||
gravity = 1,
|
||||
sneak_glitch = false
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function reset_meta(p_name)
|
||||
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
|
||||
player:get_meta():set_int("blockleague_has_ball", 0)
|
||||
player:get_meta():set_int("blockleague_weap_delay", 0)
|
||||
player:get_meta():set_int("blockleague_weap_secondary_delay", 0)
|
||||
player:get_meta():set_int("blockleague_bouncer_delay", 0)
|
||||
player:get_meta():set_int("blockleague_death_delay", 0)
|
||||
player:get_meta():set_int("reloading", 0)
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
-- for any override of arena_lib's properties
|
|
@ -0,0 +1,24 @@
|
|||
function block_league.immunity(player)
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
local immunity_time = arena_lib.get_arena_by_player(p_name).immunity_time
|
||||
local immunity_ID = 0
|
||||
|
||||
player:set_armor_groups({immortal=1})
|
||||
|
||||
-- in caso uno spari, perda l'immunità, muoia subito e resusciti, il tempo d'immunità riparte da capo.
|
||||
-- Ne tengo traccia con un metadato che comparo nell'after
|
||||
immunity_ID = player:get_meta():get_int("immunity_ID") + 1
|
||||
player:get_meta():set_int("immunity_ID", immunity_ID)
|
||||
|
||||
minetest.after(immunity_time, function()
|
||||
if not player or not player:get_meta() then return end -- potrebbe essersi disconnesso
|
||||
if immunity_ID == player:get_meta():get_int("immunity_ID") then
|
||||
if player:get_armor_groups().immortal and player:get_armor_groups().immortal == 1 then
|
||||
player:set_armor_groups({immortal = nil})
|
||||
end
|
||||
player:get_meta():set_int("immunity_ID", 0)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
|
@ -0,0 +1,402 @@
|
|||
local S = minetest.get_translator("block_league")
|
||||
|
||||
local function cast_entity_ray() end
|
||||
local function check_for_touchdown() end
|
||||
local function add_point() end
|
||||
local function announce_ball_possession_change() end
|
||||
|
||||
|
||||
-- entità
|
||||
local ball = {
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
visual = "cube",
|
||||
visual_size = {x = 1.0, y = 1.0, z = 1.0},
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
|
||||
textures = {
|
||||
"block_league_bullet_rocket.png",
|
||||
"block_league_bullet_rocket.png",
|
||||
"block_league_bullet_rocket.png",
|
||||
"block_league_bullet_rocket.png",
|
||||
"block_league_bullet_rocket.png",
|
||||
"block_league_bullet_rocket.png",
|
||||
},
|
||||
timer_limit = 10,
|
||||
},
|
||||
|
||||
wielder = nil,
|
||||
team_name = nil,
|
||||
timer_bool = false,
|
||||
timer = 0,
|
||||
has_scored = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- eseguito quando l'entità viene distrutta
|
||||
function ball:_destroy()
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:get_staticdata()
|
||||
if self == nil or self.arena == nil then return end
|
||||
return self.wielder
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:on_activate(staticdata, d_time)
|
||||
if staticdata ~= nil then
|
||||
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", staticdata)
|
||||
|
||||
if arena == nil or not arena.in_game then
|
||||
self:_destroy()
|
||||
return
|
||||
end
|
||||
|
||||
self.wielder = nil
|
||||
self.team_name = nil
|
||||
self.timer_bool = false
|
||||
self.timer = 0
|
||||
self.arena = arena
|
||||
|
||||
local velocity = self.object:get_velocity()
|
||||
|
||||
velocity.y = velocity.y + 1
|
||||
cast_entity_ray(self.object)
|
||||
|
||||
self.object:set_velocity(velocity)
|
||||
minetest.after(1, function()
|
||||
if self.object ~= nil then
|
||||
velocity = self.object:get_velocity()
|
||||
if velocity ~= nil then
|
||||
velocity.y = -velocity.y
|
||||
self.object:set_velocity(velocity)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
else --se gli staticdata sono nil
|
||||
self:_destroy()
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:on_step(d_time, moveresult)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", self.arena.name)
|
||||
|
||||
if not arena or not arena.in_game then
|
||||
self:_destroy()
|
||||
return
|
||||
end
|
||||
|
||||
--se nessuno la sta portando a spasso...
|
||||
if self.wielder == nil then
|
||||
|
||||
-- se il timer per il reset è attivo, controllo a che punto sta
|
||||
if self.timer_bool then
|
||||
self.timer = self.timer + d_time
|
||||
if self.timer > self.initial_properties.timer_limit then
|
||||
self:reset()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local objects = minetest.get_objects_inside_radius(pos, 1.5)
|
||||
|
||||
-- se nel suo raggio trova un giocatore in vita, si attacca
|
||||
for i, object in pairs(objects) do
|
||||
if object:is_player() and object:get_hp() > 0 then
|
||||
|
||||
self:attach(object)
|
||||
return
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local velocity = self.object:get_velocity()
|
||||
|
||||
-- sennò oscilla
|
||||
for index, table in pairs(moveresult.collisions) do
|
||||
if table.type == "node" and table.axis == "y" then
|
||||
velocity.y = -table.old_velocity.y
|
||||
self.object:set_velocity(velocity)
|
||||
minetest.after(1, function()
|
||||
if self.object ~= nil then
|
||||
velocity = self.object:get_velocity()
|
||||
if velocity ~= nil then
|
||||
velocity.y = -velocity.y
|
||||
self.object:set_velocity(velocity)
|
||||
end
|
||||
end
|
||||
end)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- se ce l'ha qualcuno
|
||||
else
|
||||
|
||||
local wielder = self.wielder
|
||||
local w_name = wielder:get_player_name()
|
||||
|
||||
-- se il giocatore è morto, si sgancia e torna a oscillare
|
||||
if wielder:get_hp() <= 0 then
|
||||
if wielder:get_pos().y < arena.min_y then
|
||||
self:reset()
|
||||
return end
|
||||
self:detach()
|
||||
|
||||
local velocity = self.object:get_velocity()
|
||||
|
||||
velocity.y = velocity.y + 1
|
||||
self.object:set_velocity(velocity)
|
||||
minetest.after(1, function()
|
||||
if self.object ~= nil then
|
||||
velocity = self.object:get_velocity()
|
||||
if velocity ~= nil then
|
||||
velocity.y = -velocity.y
|
||||
self.object:set_velocity(velocity)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local w_pos = wielder:get_pos()
|
||||
|
||||
-- se il giocatore è vivo
|
||||
if w_pos == nil then return end
|
||||
|
||||
local goal = self.team_name == S("red") and arena.destinazione_red or arena.destinazione_blue
|
||||
|
||||
check_for_touchdown(id, arena, self, wielder, w_pos, goal)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:attach(player)
|
||||
|
||||
local arena = self.arena
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
announce_ball_possession_change(arena, p_name)
|
||||
|
||||
player:get_meta():set_int("blockleague_has_ball", 1)
|
||||
block_league.energy_drain(arena, p_name)
|
||||
|
||||
self.object:set_attach(player, "Head", {x=0, y=5.5, z=0}, {x=0, y=0, z=0})
|
||||
self.wielder = player
|
||||
|
||||
local teamID = arena.players[p_name].teamID
|
||||
|
||||
self.team_name = arena.teams[teamID].name
|
||||
self.timer_bool = false
|
||||
self.timer = 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:detach()
|
||||
|
||||
local player = self.wielder
|
||||
|
||||
announce_ball_possession_change(self.arena, player:get_player_name(), true)
|
||||
|
||||
player:get_meta():set_int("blockleague_has_ball", 0)
|
||||
player:set_physics_override({
|
||||
speed = 0,
|
||||
jump = 0
|
||||
})
|
||||
|
||||
self.object:set_detach()
|
||||
self.wielder = nil
|
||||
self.timer_bool = true
|
||||
self.timer = 0
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ball:reset()
|
||||
|
||||
local arena = self.arena
|
||||
|
||||
-- annuncio
|
||||
for pl_name, _ in pairs(arena.players) do
|
||||
minetest.sound_play("blockleague_ball_reset", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "Ball reset", 3)
|
||||
end
|
||||
|
||||
if ball.wielder then
|
||||
ball.wielder:set_physics_override({
|
||||
speed = arena.high_speed,
|
||||
jump = 1.5
|
||||
})
|
||||
end
|
||||
|
||||
self:_destroy()
|
||||
minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function cast_entity_ray(ent)
|
||||
minetest.add_particlespawner({
|
||||
attached = ent, -- If defined, particle positions, velocities and accelerations are relative to this object's position and yaw
|
||||
amount = 10,
|
||||
time = 0,
|
||||
minpos = {x=0, y=1, z=0},
|
||||
maxpos = {x=0, y=1, z=0},
|
||||
minvel = vector.multiply({x= 0, y = 1, z = 0}, 30),
|
||||
maxvel = vector.multiply({x= 0, y = 1, z = 0}, 30),
|
||||
minsize = 20,
|
||||
maxsize = 20,
|
||||
vertical = true,
|
||||
texture = "block_league_raggio_palla.png"
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
function check_for_touchdown(id, arena, ball, wielder, w_pos, goal)
|
||||
|
||||
if
|
||||
math.abs(w_pos.x - goal.x) <= 1.5 and
|
||||
math.abs(w_pos.z - goal.z) <= 1.5 and
|
||||
w_pos.y >= goal.y - 1 and
|
||||
w_pos.y <= goal.y + 3 then
|
||||
|
||||
add_point(wielder:get_player_name(), arena)
|
||||
|
||||
wielder:set_physics_override({
|
||||
speed = arena.high_speed,
|
||||
jump = 1.5
|
||||
})
|
||||
wielder:get_meta():set_int("blockleague_has_ball", 0)
|
||||
|
||||
local arena = arena
|
||||
arena.weapons_disabled = true
|
||||
minetest.after(5, function()
|
||||
teleport_players(arena)
|
||||
local pos1 = {x = arena.prototipo_spawn.x - 1, y = arena.prototipo_spawn.y - 1, z = arena.prototipo_spawn.z - 1}
|
||||
local pos2 = {x = arena.prototipo_spawn.x + 1, y = arena.prototipo_spawn.y + 1, z = arena.prototipo_spawn.z + 1}
|
||||
--minetest.load_area(pos1, pos2)
|
||||
minetest.forceload_block(pos1, pos2)
|
||||
--minetest.emerge_area(pos1, pos2)
|
||||
minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
arena.weapons_disabled = false
|
||||
end)
|
||||
|
||||
ball:_destroy()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function teleport_players(arena)
|
||||
for id, team in pairs(arena.teams) do
|
||||
local players = arena_lib.get_players_in_team(arena, id, true)
|
||||
for index, player in pairs(players) do
|
||||
player:set_hp(20)
|
||||
local p_name = player:get_player_name()
|
||||
arena.players[p_name].energy = 100
|
||||
player:get_meta():set_int("reloading", 0)
|
||||
panel_lib.get_panel(p_name, "bullets_hud"):remove()
|
||||
arena.players[p_name].weapons_reload = {}
|
||||
block_league.weapons_hud_create(p_name)
|
||||
panel_lib.get_panel(p_name, "bullets_hud"):show()
|
||||
block_league.energy_update(arena, p_name)
|
||||
player:set_pos(arena_lib.get_random_spawner(arena, id))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function add_point(w_name, arena)
|
||||
|
||||
local teamID = arena.players[w_name].teamID
|
||||
local enemy_teamID = teamID == 1 and 2 or 1
|
||||
local team = arena_lib.get_players_in_team(arena, teamID)
|
||||
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
|
||||
|
||||
for _, pl_name in pairs(team) do
|
||||
minetest.sound_play("block_league_crowd_cheer", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "NICE POINT!", 3, "0x43e6FF")
|
||||
end
|
||||
|
||||
for _, pl_name in pairs(enemy_team) do
|
||||
minetest.sound_play("block_league_crowd_ohno", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "ENEMY TEAM SCORED...", 3, "0xFF5D43")
|
||||
end
|
||||
|
||||
arena.teams[teamID].TDs = arena.teams[teamID].TDs + 1
|
||||
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
block_league.HUD_teams_score_update(arena, pl_name, teamID)
|
||||
end
|
||||
|
||||
-- se i TD della squadra raggiungono il cap, vince
|
||||
if arena.teams[teamID].TDs == arena.score_cap then
|
||||
arena_lib.load_celebration("block_league", arena, {w_name})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function announce_ball_possession_change(arena, w_name, is_ball_lost)
|
||||
|
||||
local teamID = arena.players[w_name].teamID
|
||||
local enemy_teamID = teamID == 1 and 2 or 1
|
||||
local team = arena_lib.get_players_in_team(arena, teamID)
|
||||
local enemy_team = arena_lib.get_players_in_team(arena, enemy_teamID)
|
||||
|
||||
if is_ball_lost then
|
||||
for _, pl_name in pairs(team) do
|
||||
minetest.sound_play("block_league_crowd_ohno", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "Your team lost the ball!", 3, "0xFF5D43")
|
||||
end
|
||||
|
||||
for _, pl_name in pairs(enemy_team) do
|
||||
minetest.sound_play("block_league_crowd_cheer", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "Enemy team lost the ball!", 3, "0x43e6FF")
|
||||
end
|
||||
else
|
||||
for _, pl_name in pairs(team) do
|
||||
minetest.sound_play("block_league_crowd_cheer", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "Your team got the ball!", 3, "0x43e6FF")
|
||||
end
|
||||
block_league.HUD_broadcast_player(w_name, "You got the ball!", 3, "0x43e6FF")
|
||||
|
||||
for _, pl_name in pairs(enemy_team) do
|
||||
minetest.sound_play("block_league_crowd_ohno", {to_player = pl_name})
|
||||
block_league.HUD_broadcast_player(pl_name, "Enemy team got the ball!", 3, "0xFF5D43")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_entity("block_league:prototipo", ball)
|
|
@ -0,0 +1,49 @@
|
|||
local recursive_time = 0.1
|
||||
|
||||
|
||||
|
||||
function block_league.energy_refill(arena)
|
||||
|
||||
if not arena.in_game then return end
|
||||
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
|
||||
local player = minetest.get_player_by_name(pl_name)
|
||||
local health = player:get_hp()
|
||||
|
||||
-- se è vivo
|
||||
if health > 0 then
|
||||
if player:get_meta() and player:get_meta():get_int("blockleague_has_ball") == 0 and arena.players[pl_name].energy < arena.max_energy then
|
||||
arena.players[pl_name].energy = arena.players[pl_name].energy + 1
|
||||
block_league.energy_update(arena, pl_name)
|
||||
end
|
||||
|
||||
if player:get_pos().y < arena.min_y then
|
||||
player:set_hp(0)
|
||||
player:get_meta():set_int("blockleague_has_ball", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(recursive_time, function() block_league.energy_refill(arena) end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.energy_drain(arena, w_name)
|
||||
|
||||
-- per vedere se è online devo per forza fare minetest.ecc, dacché è inutile passare l'intero giocatore come parametro (dato che mi serve il nome)
|
||||
local wielder = minetest.get_player_by_name(w_name)
|
||||
|
||||
if not arena.in_game or not wielder or wielder:get_meta():get_int("blockleague_has_ball") == 0 then return end
|
||||
|
||||
if arena.players[w_name].energy > 0 then
|
||||
arena.players[w_name].energy = arena.players[w_name].energy -1
|
||||
block_league.energy_update(arena, w_name)
|
||||
else
|
||||
wielder:set_physics_override({speed = arena.low_speed})
|
||||
return
|
||||
end
|
||||
|
||||
minetest.after(recursive_time, function() block_league.energy_drain(arena, w_name) end)
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
minetest.register_tool("block_league:bouncer", {
|
||||
description = "Bouncer",
|
||||
drawtype = "mesh",
|
||||
mesh = "block_league_pixelgun.obj",
|
||||
tiles = {"block_league_pixelgun.png"},
|
||||
wield_scale = {x=1.3, y=1.3, z=1.3},
|
||||
inventory_image = "block_league_bouncer.png",
|
||||
jump_height = 5,
|
||||
groups = {oddly_breakable_by_hand = "2"},
|
||||
on_drop = function() end,
|
||||
on_place = function() end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
----- gestione delay dell'arma -----
|
||||
if user:get_meta():get_int("blockleague_bouncer_delay") == 1 or user:get_meta():get_int("blockleague_death_delay") == 1 then return end
|
||||
|
||||
user:get_meta():set_int("blockleague_bouncer_delay", 1)
|
||||
|
||||
minetest.after(0.3, function()
|
||||
user:get_meta():set_int("blockleague_bouncer_delay", 0)
|
||||
end)
|
||||
----- fine gestione delay -----
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena then return end
|
||||
|
||||
-- se non ha abbastanza energia o non sta puntando un nodo, annullo
|
||||
if not (arena.players[p_name].energy >= 20) or pointed_thing.type ~= "node" then return end
|
||||
|
||||
local dir = user:get_look_dir()
|
||||
local knockback = user:get_player_velocity().y < 1 and -15 or -10
|
||||
|
||||
user:add_player_velocity(vector.multiply(dir, knockback))
|
||||
minetest.sound_play("block_league_bouncer", {to_player = p_name, max_hear_distance = 5})
|
||||
|
||||
arena.players[p_name].energy = arena.players[p_name].energy - 20
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,330 @@
|
|||
function block_league.register_bullet(name, def)
|
||||
minetest.register_node(name,{
|
||||
name = name,
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
wield_scale = def.wield_scale,
|
||||
|
||||
drawtype = def.mesh and "mesh" or "item",
|
||||
mesh = def.mesh or nil,
|
||||
tiles = def.tiles or nil,
|
||||
wield_image = def.wield_image or nil,
|
||||
|
||||
impaling = def.impaling,
|
||||
knockback = def.knockback,
|
||||
decrease_damage_with_distance = def.decrease_damage_with_distance,
|
||||
bullet_damage = def.bullet_damage,
|
||||
bullet_trail = def.bullet_trail,
|
||||
bullet = def.bullet,
|
||||
|
||||
stack_max = def.stack_max,
|
||||
on_drop = function() end,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if def.throwable_by_hand then
|
||||
local inv = user:get_inventory()
|
||||
|
||||
-- se sono immune e sparo, perdo l'immunità
|
||||
if user:get_armor_groups().immortal and user:get_armor_groups().immortal == 1 then
|
||||
user:set_armor_groups({immortal = nil})
|
||||
end
|
||||
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
-- Check if the player is in the arena and is fighting, if not it exits
|
||||
if not arena_lib.is_player_in_arena(p_name) then return end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return end
|
||||
|
||||
if def.consume_on_throw then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
block_league.shoot_bullet(name, def, nil, itemstack, user, pointed_thing)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
if def.throwable_by_hand then
|
||||
local inv = user:get_inventory()
|
||||
|
||||
-- se sono immune e sparo, perdo l'immunità
|
||||
if user:get_armor_groups().immortal and user:get_armor_groups().immortal == 1 then
|
||||
user:set_armor_groups({immortal = nil})
|
||||
end
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
-- Check if the player is in the arena and is fighting, if not it exits
|
||||
if not arena_lib.is_player_in_arena(p_name) then return end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return end
|
||||
|
||||
if def.consume_on_throw then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
block_league.shoot_bullet(name, def, nil, itemstack, user, pointed_thing)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
if def.shootable then
|
||||
-- Ottiene la definizione dell'entità
|
||||
local bullet_entity = bullet_set_entity(name, def)
|
||||
-- Registra l'entità
|
||||
minetest.register_entity(name .. "_entity", bullet_entity)
|
||||
end
|
||||
end
|
||||
|
||||
function bullet_set_entity(name, def)
|
||||
local bullet_entity = {
|
||||
initial_properties = {
|
||||
name = name,
|
||||
bullet_speed = def.bullet.bullet_speed,
|
||||
bullet_explosion_damage = def.bullet.bullet_explosion_damage,
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
visual_size = def.bullet.visual_size,
|
||||
collisionbox = def.bullet.collisionbox,
|
||||
|
||||
visual = def.bullet.mesh and "mesh" or "item",
|
||||
mesh = def.bullet.mesh,
|
||||
textures = def.bullet.textures,
|
||||
wield_item = name,
|
||||
bullet_explosion_texture = def.bullet.bullet_explosion_texture,
|
||||
bullet_speed = def.bullet.bullet_speed,
|
||||
explode_on_contact = def.bullet.explode_on_contact,
|
||||
bullet_explosion_range = def.bullet.bullet_explosion_range,
|
||||
gravity = def.bullet.gravity,
|
||||
on_right_click = def.bullet.on_right_click,
|
||||
on_destroy = def.bullet.on_destroy,
|
||||
duration = def.duration,
|
||||
bullet_trail = def.bullet_trail,
|
||||
bullet_damage = def.bullet_damage,
|
||||
is_bullet = true
|
||||
}
|
||||
}
|
||||
|
||||
function bullet_entity:_destroy()
|
||||
-- Crea le particelle dell'esplosione
|
||||
spawn_particles_sphere(self.object:get_pos(), self.initial_properties.bullet_explosion_texture)
|
||||
-- Se ha una funzione apposita da usare quando esplode la esegue
|
||||
if self.initial_properties.on_destroy then
|
||||
self.initial_properties.on_destroy(self)
|
||||
end
|
||||
|
||||
-- Distrugge l'entità
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
-- Ottiene gli staticdata ogni 18 secondi circa
|
||||
function bullet_entity:get_staticdata(self)
|
||||
if self == nil or self.p_name == nil then return end
|
||||
return self.p_name
|
||||
end
|
||||
|
||||
-- L'entità esplode quando colpita
|
||||
function bullet_entity:on_punch()
|
||||
if self.initial_properties.on_right_click then
|
||||
self.initial_properties.on_right_click(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- quando si istanzia un'entità
|
||||
function bullet_entity:on_activate(staticdata)
|
||||
|
||||
if staticdata ~= "" and staticdata ~= nil then
|
||||
self.p_name = staticdata -- nome utente come staticdata
|
||||
self.lifetime = 0 -- tempo in aria
|
||||
self.sliding = 0 -- se sta scivolando
|
||||
self.particle = 0 -- contatore di buffer per le particelle della granata
|
||||
self.object:set_armor_groups({immortal = 1}) -- lo imposta come immortale
|
||||
else -- se non ci sono gli staticdata necessari allora rimuove l'entità
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function bullet_entity:on_step(dtime, moveresult)
|
||||
self.lifetime = self.lifetime + dtime
|
||||
|
||||
if self.lifetime >= self.initial_properties.duration then
|
||||
-- ESPLODE
|
||||
self:_destroy()
|
||||
return
|
||||
end
|
||||
local obj = self.object
|
||||
local velocity = obj:get_velocity()
|
||||
local pos = obj:getpos()
|
||||
-- Controlla che il timer per mostrare le particelle che tracciano la granata sia superiore al valore definito e che eista una definizione delle particelle da creare
|
||||
if self.initial_properties.bullet_trail and self.particle >= self.initial_properties.bullet_trail.interval then
|
||||
-- Imposta il timer a 0
|
||||
self.particle = 0
|
||||
-- Aggiunge le particelle di tracciamento
|
||||
minetest.add_particle({
|
||||
pos = obj:get_pos(),
|
||||
velocity = vector.divide(velocity, 2),
|
||||
acceleration = vector.divide(obj:get_acceleration(), -5),
|
||||
expirationtime = self.initial_properties.bullet_trail.life,
|
||||
size = self.initial_properties.bullet_trail.size,
|
||||
collisiondetection = false,
|
||||
collision_removal = false,
|
||||
vertical = false,
|
||||
texture = self.initial_properties.bullet_trail.image,
|
||||
glow = self.initial_properties.bullet_trail.glow
|
||||
})
|
||||
-- Controlla che il timer per mostrare le particelle che tracciano la granata sia inferiore al valore definito e che eista una definizione delle particelle da creare
|
||||
elseif self.initial_properties.bullet_trail and self.particle < self.initial_properties.bullet_trail.interval then
|
||||
-- Incrementa il timer
|
||||
self.particle = self.particle + 1
|
||||
end
|
||||
|
||||
|
||||
if self.initial_properties.explode_on_contact then
|
||||
-- controlla se collide con qualcosa
|
||||
if moveresult.collides == true then
|
||||
local buffer_boolean = false
|
||||
for k, collision in pairs(moveresult.collisions) do
|
||||
|
||||
--object è l'oggetto(player/entità) con cui collide il proiettile
|
||||
if collision.object then
|
||||
--controlla se è un player
|
||||
if collision.object:is_player() then
|
||||
|
||||
if collision.object:get_player_name() ~= self.p_name then
|
||||
block_league.shoot(minetest.get_player_by_name(self.p_name), collision.object, self.initial_properties.bullet_damage, 0, false)
|
||||
buffer_boolean = true
|
||||
elseif collision.object:get_player_name() == self.p_name then
|
||||
|
||||
if self.lifetime < (15 / self.initial_properties.bullet_speed) then
|
||||
obj:set_velocity({
|
||||
x=(collision.old_velocity.x),
|
||||
y=(collision.old_velocity.y),
|
||||
z=(collision.old_velocity.z),
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif collision.object:get_luaentity() then
|
||||
--quando non è un player allora è una entity quindi la memorizzo per alleggerire il numero di accessi
|
||||
local entity = collision.object:get_luaentity()
|
||||
--i prossimi 2 check servono a verificare l'entità sia un proiettile
|
||||
if entity and entity.initial_properties ~= nil then
|
||||
|
||||
if entity.initial_properties.is_bullet then
|
||||
--distrugge sia il proiettile con cui collide che se stesso
|
||||
buffer_boolean = true
|
||||
entity:_destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif collision.type == "node" then
|
||||
buffer_boolean = true
|
||||
end
|
||||
|
||||
end
|
||||
if buffer_boolean then
|
||||
self:_destroy()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
if moveresult.collides and moveresult.collisions[1] and not vector.equals(moveresult.collisions[1].old_velocity, velocity) and vector.distance(moveresult.collisions[1].old_velocity, velocity) > 4 then
|
||||
if math.abs(moveresult.collisions[1].old_velocity.x - velocity.x) > 5 then -- Controlla se c'è stata una grande riduzione di velocità
|
||||
velocity.x = moveresult.collisions[1].old_velocity.x * (self.initial_properties.gravity and -0.5 or -1) -- Inverte la velocità e la riduce
|
||||
end
|
||||
|
||||
if math.abs(moveresult.collisions[1].old_velocity.y - velocity.y) > 5 then -- Controlla se c'è stata una grande riduzione di velocità
|
||||
velocity.y = moveresult.collisions[1].old_velocity.y * (self.initial_properties.gravity and -0.3 or -1) -- Inverte la velocità e la riduce
|
||||
end
|
||||
|
||||
if math.abs(moveresult.collisions[1].old_velocity.z - velocity.z) > 5 then -- Controlla se c'è stata una grande riduzione di velocità
|
||||
velocity.z = moveresult.collisions[1].old_velocity.z * (self.initial_properties.gravity and -0.5 or -1) -- Inverte la velocità e la riduce
|
||||
end
|
||||
|
||||
obj:set_velocity(velocity)
|
||||
end
|
||||
if self.initial_properties.gravity then
|
||||
if self.sliding == 0 and velocity.y == 0 then -- Controlla se la granata sta scivolando
|
||||
self.sliding = 1 -- Attiva l'attrito
|
||||
elseif self.sliding > 0 and velocity.y ~= 0 then
|
||||
self.sliding = 0 -- Non influisce sull'attrito
|
||||
end
|
||||
|
||||
if self.sliding > 1 then -- Sta scivolando?
|
||||
if vector.distance(vector.new(), velocity) <= 1 and not vector.equals(velocity, vector.new()) then -- Se la granata si muove a malapena
|
||||
obj:set_velocity(vector.new(0, -9.8, 0)) -- Si assicura sia ferma
|
||||
obj:set_acceleration(vector.new())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.initial_properties.gravity then
|
||||
local direction = vector.normalize(velocity)
|
||||
local node = minetest.get_node(pos)
|
||||
local speed = vector.length(velocity)
|
||||
local drag = math.max(minetest.registered_nodes[node.name].liquid_viscosity, 0.1) * self.sliding -- Ottiene l'attrito generato dal liquido che attraversa
|
||||
local yaw = minetest.dir_to_yaw(direction)
|
||||
local pitch = math.acos(velocity.y/speed) - math.pi/3
|
||||
-- Controlla che il pitch sia un numero
|
||||
if tostring(pitch) ~= 'nan' then
|
||||
obj:set_rotation({x = 0, y = yaw + math.pi/2, z = pitch}) -- Imposta la rotazione
|
||||
end
|
||||
|
||||
local acceleration = vector.multiply(velocity, -drag)
|
||||
|
||||
acceleration.x = acceleration.x * (self.sliding * 10 * 2 + 1) -- Modifica la x in base a se sta scivolando o meno
|
||||
acceleration.y = acceleration.y - 10 * ((7 - drag) / 7) -- Perdita in altezza del proiettile in base all' attrito
|
||||
acceleration.z = acceleration.z * (self.sliding * 10 * 2 + 1) -- Modifica la Z in base a se sta scivolando o meno
|
||||
|
||||
-- Controlla che l'accelerazione sia un numero
|
||||
if tostring(acceleration) ~= 'nan' then
|
||||
obj:set_acceleration(acceleration) -- Imposta l'accelerazione
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- Restituisce la definizione dell'entità
|
||||
return bullet_entity
|
||||
|
||||
end
|
||||
|
||||
-- Aggiunge le particelle dell'esplosione
|
||||
function spawn_particles_sphere(pos, particle_texture)
|
||||
if not pos then return end
|
||||
minetest.add_particlespawner({
|
||||
amount = 80,
|
||||
time = .1,
|
||||
minpos = {x=pos.x,y=pos.y,z=pos.z},
|
||||
maxpos = {x=pos.x,y=pos.y,z=pos.z},
|
||||
minvel = {x=-4, y=-4, z=-4},
|
||||
maxvel = {x=4, y=4, z=4},
|
||||
minacc = {x=0, y=-0.4, z=0},
|
||||
maxacc = {x=0, y=-0.8, z=0},
|
||||
minexptime = .5,
|
||||
maxexptime = .5,
|
||||
minsize = 1,
|
||||
maxsize = 5,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle_texture,
|
||||
})
|
||||
|
||||
end
|
|
@ -0,0 +1,42 @@
|
|||
block_league.register_bullet("block_league:grenade", {
|
||||
description = "grenade",
|
||||
mesh = "block_league_grenade.obj",
|
||||
tiles = {"block_league_grenade.png"},
|
||||
wield_scale = {x=1.5, y=1.5, z=1.5},
|
||||
inventory_image = "block_league_grenade_icon.png",
|
||||
stack_max = 99,
|
||||
impaling = false,
|
||||
throwable_by_hand = true,
|
||||
bullet_damage = 10,
|
||||
decrease_damage_with_distance = false,
|
||||
bullet_trail = {
|
||||
image = "block_league_bullet_rocket.png",
|
||||
life = 1,
|
||||
size = 2,
|
||||
glow = 0,
|
||||
interval = 5,
|
||||
amount = 20,
|
||||
},
|
||||
knockback = 0,
|
||||
duration = 1.5,
|
||||
shootable = true,
|
||||
bullet = {
|
||||
bullet_speed = 17,
|
||||
bullet_explosion_damage = 16,
|
||||
|
||||
visual_size = {x=7, y=7, z=7},
|
||||
mesh = "block_league_grenade.obj",
|
||||
bullet_explosion_texture = "block_league_rocket_particle.png",
|
||||
explode_on_contact = false,
|
||||
textures = {"block_league_grenade.png"},
|
||||
collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.2, 0.2},
|
||||
bullet_explosion_range = 4,
|
||||
gravity = true,
|
||||
on_destroy = block_league.grenade_explode,
|
||||
on_right_click = function(self)
|
||||
self:_destroy()
|
||||
end
|
||||
|
||||
},
|
||||
|
||||
})
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
block_league.register_weapon("block_league:grenade_launcher", {
|
||||
description = S("Grenade Launcher"),
|
||||
mesh = "block_league_rocketlauncher.obj",
|
||||
tiles = {"block_league_rocketlauncher.png"},
|
||||
wield_scale = {x=1.3, y=1.3, z=1.3},
|
||||
inventory_image = "block_league_grenade_launcher.png",
|
||||
|
||||
weap_delay = 0.8,
|
||||
weap_sound_shooting = "block_league_rocketlauncher_shoot",
|
||||
continuos_fire = false,
|
||||
slow_down_when_firing = false,
|
||||
consume_bullets = false,
|
||||
type = 2,
|
||||
launching_force = 10,
|
||||
|
||||
bullet = "block_league:grenade",
|
||||
|
||||
})
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
block_league.register_weapon("block_league:pixelgun", {
|
||||
|
||||
--Definizione apparenza
|
||||
description = S("pixelgun"),
|
||||
mesh = "block_league_pixelgun.obj",
|
||||
tiles = {"block_league_pixelgun.png"},
|
||||
wield_scale = {x=1.3, y=1.3, z=1.3},
|
||||
inventory_image = "block_league_pixelgun_icon.png",
|
||||
weap_sound_shooting = "block_league_pixelgun_shoot",
|
||||
consume_bullets = false,
|
||||
reload = 4,
|
||||
reload_delay = 4,
|
||||
type = 1,
|
||||
weap_delay = 0.9,
|
||||
slow_down_when_firing = true,
|
||||
continuos_fire = false,
|
||||
bullet = "block_league:pixelgun_bullet",
|
||||
|
||||
range = 100, --Se non hitscan calcolarsi il tempo necessario per percorrere quello
|
||||
--spazio in base alla velocità
|
||||
})
|
|
@ -0,0 +1,25 @@
|
|||
block_league.register_bullet("block_league:pixelgun_bullet", {
|
||||
description = "proiettile pixelgun",
|
||||
mesh = "block_league_grenade.obj",
|
||||
tiles = {"block_league_grenade.png"},
|
||||
wield_scale = {x=1.5, y=1.5, z=1.5},
|
||||
inventory_image = "block_league_grenade_icon.png",
|
||||
stack_max = 99,
|
||||
throwable_by_hand = false,
|
||||
impaling = true,
|
||||
knockback = 0,
|
||||
decrease_damage_with_distance = false,
|
||||
bullet_damage = 777,
|
||||
shootable = false,
|
||||
bullet_trail = {
|
||||
image = "block_league_pixelgun_trail.png",
|
||||
life = 1,
|
||||
size = 2,
|
||||
glow = 0,
|
||||
interval = 5,
|
||||
amount = 20,
|
||||
},
|
||||
|
||||
|
||||
|
||||
})
|
|
@ -0,0 +1,43 @@
|
|||
block_league.register_bullet("block_league:rocket",{
|
||||
description = "rocket",
|
||||
mesh = "block_league_rocket.obj",
|
||||
wield_scale = {x=1, y=1, z=1},
|
||||
tiles = {"block_league_bullet_rocket.png"},
|
||||
stack_max = 99,
|
||||
-- {xmin, ymin, zmin, xmax, ymax, zmax}
|
||||
bullet_damage = 10,
|
||||
throwable_by_hand = false,
|
||||
duration = 5,
|
||||
impaling = false,
|
||||
decrease_damage_with_distance = false,
|
||||
bullet_trail = {
|
||||
image = "block_league_bullet_rocket.png",
|
||||
life = 1,
|
||||
size = 2,
|
||||
glow = 0,
|
||||
interval = 5,
|
||||
amount = 20,
|
||||
},
|
||||
knockback = 0,
|
||||
shootable = true,
|
||||
|
||||
bullet = {
|
||||
|
||||
mesh = "block_league_rocket.obj",
|
||||
visual_size = {x=1, y=1, z=1},
|
||||
textures = {"block_league_bullet_rocket.png"},
|
||||
|
||||
bullet_explosion_texture = "block_league_rocket_particle.png",
|
||||
bullet_speed = 30,
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
bullet_explosion_range = 4,
|
||||
bullet_explosion_damage = 10,
|
||||
on_destroy = block_league.explode,
|
||||
on_right_click = function(self)
|
||||
self:_destroy()
|
||||
end,
|
||||
explode_on_contact = true,
|
||||
gravity = false,
|
||||
}
|
||||
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
block_league.register_weapon("block_league:rocket_launcher", {
|
||||
description = S("Rocket Launcher"),
|
||||
mesh = "block_league_rocketlauncher.obj",
|
||||
tiles = {"block_league_rocketlauncher.png"},
|
||||
wield_scale = {x=1.3, y=1.3, z=1.3},
|
||||
inventory_image = "block_league_rocketlauncher_icon.png",
|
||||
|
||||
weap_delay = 0.8,
|
||||
weap_sound_shooting = "block_league_rocketlauncher_shoot",
|
||||
type = 2,
|
||||
continuos_fire = true,
|
||||
slow_down_when_firing = false,
|
||||
consume_bullets = false,
|
||||
launching_force = 10,
|
||||
bullet = "block_league:rocket",
|
||||
|
||||
})
|
|
@ -0,0 +1,107 @@
|
|||
block_league.register_weapon("block_league:nomearma", {
|
||||
|
||||
description = "descrizione", --Descrizione
|
||||
inventory_image = "inventory_image.png", --Immagine nell'inventario
|
||||
wield_scale = {x=1, y=1, z=1}, --Dimensione in mano
|
||||
|
||||
--Se si vuole l'arma 3D
|
||||
mesh = "mesh.obj", --Modello
|
||||
tiles = {"tiles.png"}, --Textures del modello
|
||||
|
||||
--Se si vuole l'arma 2D
|
||||
wield_image = "wield_image.png", --Immagine da mostrare in mano
|
||||
|
||||
weap_sound_shooting = "weap_sound_shooting", --Suono quando si usa l'arma
|
||||
weap_delay = 10, --Delay tra gli spari
|
||||
weap_secondary_delay = 2, --Delay tra l'uso del destro
|
||||
|
||||
|
||||
type = 1, --1) Hitscan 2) Entity based 3) Sword
|
||||
range = 100, --Range nel quale opera il raggio hitscan
|
||||
continuos_fire = false, --Se può sparare tenendo premuto il sinistro
|
||||
slow_down_when_firing = true, --Se rallentare chi spara
|
||||
consume_bullets = true, --Se usa proiettili
|
||||
reload = 0, --Dopo quanti colpi ricaricare
|
||||
reload_delay = 5,
|
||||
bullet = "block_league:nomeproiettile", --Che proiettile/granata spara aka quello che viene consumato all'uso
|
||||
on_right_click = function(arena, name, def, itemstack, user, pointed_thing) end, --Cosa fare quando si clicca destro
|
||||
|
||||
type = 2, --1) Hitscan 2) Entity based 3) Sword
|
||||
continuos_fire = false, --Se può sparare tenendo premuto il sinistro
|
||||
slow_down_when_firing = true, --Se rallentare chi spara
|
||||
consume_bullets = true, --Se usa proiettili
|
||||
reload = 0, --Dopo quanti colpi ricaricare
|
||||
reload_delay = 5,
|
||||
launching_force = 10,
|
||||
bullet = "block_league:nomeproiettile", --Che proiettile/granata spara
|
||||
on_right_click = function(arena, name, def, itemstack, user, pointed_thing) end, --Cosa fare quando si clicca destro
|
||||
|
||||
type = 3, --1) Hitscan 2) Entity based 3) Sword
|
||||
weap_damage = 10, --Danno inflitto
|
||||
knockback = 0, --Il contraccolpo da applicare al bersaglio
|
||||
on_right_click = function(arena, name, def, itemstack, user, pointed_thing) end, --Cosa fare quando si clicca destro
|
||||
|
||||
})
|
||||
|
||||
|
||||
block_league.register_bullet("block_league:nomeproiettile", {
|
||||
description = "descrizione", --Descrizione
|
||||
inventory_image = "inventory_image.png", --Immagine nell'inventario
|
||||
wield_scale = {x=1, y=1, z=1}, --Dimensione in mano
|
||||
|
||||
--Se si vuole il proiettile 3D
|
||||
mesh = "mesh.obj", --Modello
|
||||
tiles = {"tiles.png"}, --Textures del modello
|
||||
|
||||
--Se si vuole il proiettile 2D
|
||||
wield_image = "wield_image.png", --Immagine da mostrare in mano
|
||||
|
||||
stack_max = 99, --Numero massimo di proiettili possedibili
|
||||
|
||||
throwable_by_hand = true, --Se si può lanciare a mano
|
||||
consume_on_throw = true,
|
||||
|
||||
impaling = true, --Se può attraversare il bersaglio NB: Utilizzabile solo con proiettili hitscan
|
||||
knockback = 0, --Il contraccolpo da applicare al bersaglio
|
||||
decrease_damage_with_distance = true, --Se il danno diminuisce con la distanza
|
||||
bullet_damage = 10, --Danno inflitto
|
||||
bullet_trail = {
|
||||
image = "weap_trail.png",
|
||||
life = 1,
|
||||
size = 2,
|
||||
glow = 0,
|
||||
interval = 5,
|
||||
amount = 20,
|
||||
},
|
||||
|
||||
duration = 10, --Tempo di vita dell'entità (da spostare dentro bullet)
|
||||
|
||||
bullet = {
|
||||
|
||||
visual_size = {x=7, y=7, z=7}, --Dimensione in aria
|
||||
collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.2, 0.2},
|
||||
|
||||
--Se si vuole il proiettile 3D
|
||||
mesh = "mesh.obj", --Modello
|
||||
textures = {"textures.png"}, --Textures del modello
|
||||
|
||||
--Se si vuole il proiettile 2D
|
||||
--Si può lasciare vuoto, prenderà in automatico la texture dell'item
|
||||
|
||||
explode_on_contact = true, --Se rimbalza quando si scontra con qualcosa
|
||||
|
||||
bullet_explosion_damage = 10, --Danno inflitto con l'esplosione
|
||||
bullet_explosion_range = 4, --Raggio dell'esplosione
|
||||
bullet_explosion_texture = "explosion_texture.png",
|
||||
|
||||
bullet_speed = 30, --Velocità a cui lanciare/sparare il proiettile
|
||||
|
||||
gravity = true, --Se la gravità ha effetto sul proiettile
|
||||
|
||||
on_right_click = block_league.bullet_right_click, --Cosa fare quando si clicca destro sul proiettile
|
||||
on_destroy = block_league.bullet_on_destroy,
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
block_league.register_weapon("block_league:smg", {
|
||||
|
||||
description = S("Sub Machine Gun"),
|
||||
wield_image = "block_league_smg.png",
|
||||
wield_scale = {x=1, y=1, z=1},
|
||||
inventory_image = "block_league_smg.png",
|
||||
|
||||
weap_sound_shooting = "block_league_smg_shoot",
|
||||
type = 1,
|
||||
weap_delay = 0.1,
|
||||
slow_down_when_firing = true,
|
||||
continuos_fire = true,
|
||||
bullet = "block_league:smg_bullet",
|
||||
|
||||
consume_bullets = false,
|
||||
reload = 30,
|
||||
reload_delay = 2,
|
||||
|
||||
range = 30, --Se non hitscan calcolarsi il tempo necessario per percorrere quello
|
||||
--spazio in base alla velocità
|
||||
})
|
|
@ -0,0 +1,25 @@
|
|||
block_league.register_bullet("block_league:smg_bullet", {
|
||||
description = S("Proiettile SMG"),
|
||||
wield_image = "block_league_smg.png",
|
||||
wield_scale = {x=1, y=1, z=1},
|
||||
inventory_image = "block_league_smg.png",
|
||||
|
||||
stack_max = 99,
|
||||
throwable_by_hand = false,
|
||||
impaling = false,
|
||||
knockback = 0,
|
||||
decrease_damage_with_distance = true,
|
||||
bullet_damage = 3,
|
||||
shootable = false,
|
||||
bullet_trail = {
|
||||
image = "block_league_smg_trail.png",
|
||||
life = 1,
|
||||
size = 2,
|
||||
glow = 0,
|
||||
interval = 5,
|
||||
amount = 5,
|
||||
},
|
||||
|
||||
|
||||
|
||||
})
|
|
@ -0,0 +1,48 @@
|
|||
block_league.register_weapon("block_league:sword", {
|
||||
|
||||
description = "Spada",
|
||||
inventory_image = "block_league_sword.png",
|
||||
wield_scale = {x=1.3, y=1.3, z=1.3},
|
||||
wield_image = "block_league_sword.png",
|
||||
|
||||
weap_delay = 2,
|
||||
weap_secondary_delay = 3,
|
||||
|
||||
type = 3,
|
||||
weap_damage = 7,
|
||||
knockback = 40,
|
||||
on_right_click = function(arena, name, def, itemstack, user, pointed_thing)
|
||||
|
||||
local dir = user:get_look_dir()
|
||||
local pos = user:get_pos()
|
||||
local pos_head = {x = pos.x, y = pos.y+1.475, z = pos.z}
|
||||
local pointed_players = block_league.get_pointed_players(pos_head, dir, 0, 5, user, nil, true)
|
||||
|
||||
dir.y = 0
|
||||
|
||||
local player_vel = user:get_player_velocity()
|
||||
local sprint = vector.multiply(dir,18)
|
||||
|
||||
user:add_player_velocity(sprint)
|
||||
player_vel = vector.multiply(player_vel, -0.7)
|
||||
user:add_player_velocity(player_vel)
|
||||
user:set_physics_override({
|
||||
speed = 0.5,
|
||||
jump = 0
|
||||
})
|
||||
|
||||
minetest.after(2.5, function()
|
||||
if user then
|
||||
local vel = user:get_meta():get_int("blockleague_has_ball") == 0 and arena.high_speed or arena.low_speed
|
||||
user:set_physics_override({
|
||||
speed = vel,
|
||||
jump = 1.5
|
||||
})
|
||||
end
|
||||
|
||||
end)
|
||||
if not pointed_players then return end
|
||||
block_league.shoot(user, pointed_players, def.weap_damage, def.knockback, false)
|
||||
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,676 @@
|
|||
function block_league.register_weapon(name, def)
|
||||
minetest.register_node(name, {
|
||||
name = name,
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
wield_scale = def.wield_scale,
|
||||
|
||||
drawtype = def.mesh and "mesh" or "item",
|
||||
mesh = def.mesh or nil,
|
||||
tiles = def.tiles or nil,
|
||||
wield_image = def.wield_image or nil,
|
||||
|
||||
weap_sound_shooting = def.weap_sound_shooting or nil,
|
||||
weap_trail = def.weap_trail or nil,
|
||||
weap_damage = def.weap_damage or nil,
|
||||
consume_bullets = def.consume_bullets or nil,
|
||||
bullet = def.bullet or nil,
|
||||
reload = def.reload or nil,
|
||||
|
||||
on_drop = function(itemstack, user, pointed_thing)
|
||||
|
||||
weapon_reload(user, def, name)
|
||||
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
|
||||
if not def.on_right_click then return end
|
||||
----- gestione delay dell'arma -----
|
||||
if user:get_meta():get_int("blockleague_weap_secondary_delay") == 1 or
|
||||
user:get_meta():get_int("blockleague_death_delay") == 1 then
|
||||
return end
|
||||
|
||||
user:get_meta():set_int("blockleague_weap_secondary_delay", 1)
|
||||
|
||||
local inv = user:get_inventory()
|
||||
|
||||
minetest.after(def.weap_secondary_delay, function()
|
||||
if user then
|
||||
if inv:contains_item("main", "block_league:match_over") then return end
|
||||
user:get_meta():set_int("blockleague_weap_secondary_delay", 0)
|
||||
end
|
||||
end)
|
||||
----- fine gestione delay -----
|
||||
|
||||
-- se sono immune e sparo, perdo l'immunità
|
||||
if user:get_armor_groups().immortal and user:get_armor_groups().immortal == 1 then
|
||||
user:set_armor_groups({immortal = nil})
|
||||
end
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
-- Check if the player is in the arena and is fighting, if not it exits
|
||||
if not arena_lib.is_player_in_arena(p_name) then return end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return end
|
||||
|
||||
if def.on_right_click then
|
||||
def.on_right_click(arena, name, def, itemstack, user, pointed_thing)
|
||||
end
|
||||
end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
|
||||
if not gestione_sparo(p_name, user, def, name, nil) then return end
|
||||
|
||||
if def.weap_sound_shooting then
|
||||
-- riproduzione suono
|
||||
minetest.sound_play(def.weap_sound_shooting, {
|
||||
to_player = p_name,
|
||||
max_hear_distance = 5,
|
||||
})
|
||||
end
|
||||
if def.slow_down_when_firing then
|
||||
user:set_physics_override({
|
||||
speed = arena_lib.get_arena_by_player(p_name).low_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
end
|
||||
|
||||
shoot_generic(def, p_name, itemstack, user, pointed_thing)
|
||||
|
||||
if def.continuos_fire then
|
||||
controls.register_on_hold(function(player, key, time)
|
||||
if key~="LMB" then return end
|
||||
|
||||
local inv = player:get_inventory()
|
||||
|
||||
local wielditem = player:get_wielded_item()
|
||||
if wielditem:get_name()==name then
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
if not gestione_sparo(p_name, player, def, name, inv) then return end
|
||||
|
||||
if def.weap_sound_shooting then
|
||||
-- riproduzione suono
|
||||
minetest.sound_play(def.weap_sound_shooting, {
|
||||
to_player = p_name,
|
||||
max_hear_distance = 5,
|
||||
})
|
||||
end
|
||||
|
||||
shoot_generic(def, p_name, itemstack, player, pointed_thing)
|
||||
|
||||
elseif def.slow_down_when_firing and player:get_meta():get_int("blockleague_has_ball") == 0 and arena_lib.is_player_in_arena(p_name) then
|
||||
if player then
|
||||
player:set_physics_override({
|
||||
speed = arena_lib.get_arena_by_player(p_name).high_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
controls.register_on_release(function(player, key, time)
|
||||
if key~="LMB" then return end
|
||||
local inv = player:get_inventory()
|
||||
local wielditem = player:get_wielded_item()
|
||||
if wielditem:get_name()==name then
|
||||
|
||||
if def.slow_down_when_firing and player:get_meta():get_int("blockleague_has_ball") == 0 then
|
||||
minetest.after(0.1, function()
|
||||
if player then
|
||||
player:set_physics_override({
|
||||
speed = arena_lib.get_arena_by_player(player:get_player_name()).high_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
elseif def.slow_down_when_firing and player:get_meta():get_int("blockleague_has_ball") == 0 and arena_lib.is_player_in_arena(player:get_player_name()) then
|
||||
if player then
|
||||
player:set_physics_override({
|
||||
speed = arena_lib.get_arena_by_player(player:get_player_name()).high_speed,
|
||||
jump = 1.5,
|
||||
gravity = 1.15,
|
||||
sneak_glitch = true,
|
||||
new_move = true
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
end,
|
||||
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
if not def.on_right_click then return end
|
||||
----- gestione delay dell'arma -----
|
||||
if user:get_meta():get_int("blockleague_weap_secondary_delay") == 1 or
|
||||
user:get_meta():get_int("blockleague_death_delay") == 1 then
|
||||
return end
|
||||
|
||||
user:get_meta():set_int("blockleague_weap_secondary_delay", 1)
|
||||
|
||||
local inv = user:get_inventory()
|
||||
|
||||
minetest.after(def.weap_secondary_delay, function()
|
||||
if user then
|
||||
if inv:contains_item("main", "block_league:match_over") then return end
|
||||
user:get_meta():set_int("blockleague_weap_secondary_delay", 0)
|
||||
end
|
||||
end)
|
||||
----- fine gestione delay -----
|
||||
|
||||
-- se sono immune e sparo, perdo l'immunità
|
||||
if user:get_armor_groups().immortal and user:get_armor_groups().immortal == 1 then
|
||||
user:set_armor_groups({immortal = nil})
|
||||
end
|
||||
|
||||
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
-- Check if the player is in the arena and is fighting, if not it exits
|
||||
if not arena_lib.is_player_in_arena(p_name) then return end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return end
|
||||
|
||||
if def.on_right_click then
|
||||
def.on_right_click(arena, name, def, itemstack, user, pointed_thing)
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
function weapon_reload(user, def, name)
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not arena_lib.is_player_in_arena(p_name) then return false end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return end
|
||||
|
||||
if def.type == 3 then return end
|
||||
|
||||
if def.reload and def.reload > 0 and user:get_meta():get_int("reloading") == 0 then
|
||||
user:get_meta():set_int("reloading", 1)
|
||||
minetest.after(def.reload_delay, function()
|
||||
if user and user:get_meta() then
|
||||
local inv = user:get_inventory()
|
||||
if inv:contains_item("main", "block_league:match_over") then return false end
|
||||
user:get_meta():set_int("blockleague_weap_delay", 0)
|
||||
user:get_meta():set_int("reloading", 0)
|
||||
block_league.weapons_hud_update(arena, p_name, name, nil, def.reload)
|
||||
arena.players[p_name].weapons_reload[name] = 0
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function gestione_sparo(p_name, user, def, name, inv)
|
||||
-- Check if the player is in the arena and is fighting, if not it exits
|
||||
if not arena_lib.is_player_in_arena(p_name) then return false end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
----- gestione delay dell'arma -----
|
||||
if user:get_meta():get_int("blockleague_weap_delay") == 1 or
|
||||
user:get_meta():get_int("blockleague_death_delay") == 1 or
|
||||
user:get_meta():get_int("reloading") == 1 then
|
||||
return false end
|
||||
|
||||
user:get_meta():set_int("blockleague_weap_delay", 1)
|
||||
if def.reload then
|
||||
if not arena.players[p_name].weapons_reload[name] then
|
||||
arena.players[p_name].weapons_reload[name] = 0
|
||||
end
|
||||
end
|
||||
|
||||
if not inv then
|
||||
inv = user:get_inventory()
|
||||
end
|
||||
|
||||
minetest.after(def.weap_delay, function()
|
||||
if user and user:get_meta() then
|
||||
if inv:contains_item("main", "block_league:match_over") then return false end
|
||||
if def.reload and user:get_meta():get_int("reloading") == 0 then
|
||||
user:get_meta():set_int("blockleague_weap_delay", 0)
|
||||
elseif not def.reload then
|
||||
user:get_meta():set_int("blockleague_weap_delay", 0)
|
||||
end
|
||||
end
|
||||
end)
|
||||
----- fine gestione delay -----
|
||||
|
||||
-- se sono immune e sparo, perdo l'immunità
|
||||
if user:get_armor_groups().immortal and user:get_armor_groups().immortal == 1 then
|
||||
user:set_armor_groups({immortal = nil})
|
||||
end
|
||||
|
||||
|
||||
if not arena or not arena.in_game or user:get_hp() <= 0 or arena.weapons_disabled then return false end
|
||||
|
||||
if def.consume_bullets then
|
||||
if inv:contains_item("main", def.bullet) then
|
||||
inv:remove_item("main", def.bullet)
|
||||
block_league.weapons_hud_update(arena, p_name, name, nil, nil)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if def.reload and def.reload > 0 then
|
||||
arena.players[p_name].weapons_reload[name] = arena.players[p_name].weapons_reload[name] + 1
|
||||
if arena.players[p_name].weapons_reload[name] == def.reload and user:get_meta():get_int("reloading") == 0 then
|
||||
user:get_meta():set_int("reloading", 1)
|
||||
minetest.after(def.reload_delay, function()
|
||||
if user and user:get_meta() then
|
||||
if inv:contains_item("main", "block_league:match_over") then return false end
|
||||
user:get_meta():set_int("blockleague_weap_delay", 0)
|
||||
user:get_meta():set_int("reloading", 0)
|
||||
block_league.weapons_hud_update(arena, p_name, name, nil, def.reload)
|
||||
arena.players[p_name].weapons_reload[name] = 0
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
if def.type and def.type ~= 3 then
|
||||
block_league.weapons_hud_update(arena, p_name, name, nil, nil)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function shoot_generic(def, name, itemstack, user, pointed_thing)
|
||||
if def.type == 1 or def.type == 2 then
|
||||
local bullet_definition = def.bullet and minetest.registered_nodes[def.bullet] or nil
|
||||
if def.type == 1 then
|
||||
block_league.shoot_hitscan(name, def, bullet_definition, itemstack, user, pointed_thing)
|
||||
elseif def.type == 2 then
|
||||
block_league.shoot_bullet(name, def, bullet_definition, itemstack, user, pointed_thing)
|
||||
end
|
||||
elseif def.type == 3 then
|
||||
if pointed_thing.type == "object" and pointed_thing.ref:is_player() then
|
||||
local dir = user:get_look_dir()
|
||||
block_league.shoot(user, pointed_thing.ref, def.weap_damage, def.knockback, false, dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function block_league.shoot_hitscan(name, def, bullet_definition, itemstack, user, pointed_thing)
|
||||
local dir = user:get_look_dir()
|
||||
local pos = user:get_pos()
|
||||
local pos_head = {x = pos.x, y = pos.y+1.475, z = pos.z}
|
||||
local pointed_players = block_league.get_pointed_players(pos_head, dir, 0, def.range, user, bullet_definition.bullet_trail, bullet_definition.impaling)
|
||||
if pointed_players then
|
||||
block_league.shoot(user, pointed_players, bullet_definition.bullet_damage, bullet_definition.knockback, bullet_definition.decrease_damage_with_distance)
|
||||
end
|
||||
end
|
||||
|
||||
function block_league.shoot_bullet(name, def, def2, itemstack, user, pointed_thing)
|
||||
local yaw = user:get_look_horizontal()
|
||||
local pitch = user:get_look_vertical()
|
||||
local dir = user:get_look_dir()
|
||||
local pos = user:get_pos()
|
||||
local pos_head = {x = pos.x, y = pos.y + user:get_properties().eye_height, z = pos.z}
|
||||
local username = user:get_player_name()
|
||||
local bullet_name = nil
|
||||
local speed = nil
|
||||
|
||||
if def2 then
|
||||
bullet_name = (def2.name and def2.name or name) .. '_entity'
|
||||
speed = def2.bullet.bullet_speed + def.launching_force
|
||||
else
|
||||
bullet_name = (def.name and def.name or name) .. '_entity'
|
||||
speed = def.bullet.bullet_speed
|
||||
end
|
||||
|
||||
local bullet = minetest.add_entity(pos_head, bullet_name, username)
|
||||
|
||||
bullet:set_velocity({
|
||||
x=(dir.x * speed),
|
||||
y=(dir.y * speed),
|
||||
z=(dir.z * speed),
|
||||
})
|
||||
|
||||
--local rotation = vector.new(0, yaw + math.pi/2, pitch + math.pi/6)
|
||||
local rotation = ({x = -pitch, y = yaw, z = 0})
|
||||
bullet:set_rotation(rotation)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
function block_league.get_dist(pos1, pos2)
|
||||
local lenx = math.abs(pos1.x - pos2.x)
|
||||
local leny = math.abs(pos1.y - pos2.y)
|
||||
local lenz = math.abs(pos1.z - pos2.z)
|
||||
local hypot = math.sqrt((lenx * lenx) + (lenz * lenz))
|
||||
local dist = math.sqrt((hypot * hypot) + (leny * leny))
|
||||
return dist
|
||||
end
|
||||
|
||||
--Ritorna la direzione da un punto ad un altro.
|
||||
function block_league.get_dir_from_pos(pos1, pos2)
|
||||
local dir = vector.subtract(pos1,pos2)
|
||||
return dir
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- ritorna un array di player con il numero di player trovati a index 1. Se non
|
||||
-- trova player diversi da se stessi ritorna nil
|
||||
function block_league.get_pointed_players(head_pos, dir, dist1, dist2, user, particle, trafigge)
|
||||
local p1 = vector.add(head_pos, vector.multiply(dir, dist1))
|
||||
--block_league.mostra_posizione(p1, 100)
|
||||
local p2 = vector.add(head_pos, vector.multiply(dir, dist2))
|
||||
--block_league.mostra_posizione(p2, 100)
|
||||
local ray = minetest.raycast(p1, p2, true, false)
|
||||
|
||||
local players = {}
|
||||
|
||||
-- check su ogni cosa attraversata dal raycast (p1 a p2)
|
||||
for hit in ray do
|
||||
-- se è un oggetto
|
||||
if hit.type == "object" then
|
||||
if hit.ref then
|
||||
-- se è un giocatore
|
||||
if hit.ref:is_player() then
|
||||
-- e non è colui che spara
|
||||
if hit.ref ~= user then
|
||||
table.insert(players, hit.ref)
|
||||
end
|
||||
elseif hit.ref:get_luaentity() then
|
||||
local entity = hit.ref:get_luaentity()
|
||||
if entity.initial_properties ~= nil then
|
||||
|
||||
if entity.initial_properties.is_bullet or entity.initial_properties.is_grenade then
|
||||
--distrugge sia il proiettile con cui collide che se stesso
|
||||
entity.old_p_name = entity.p_name
|
||||
entity.p_name = user:get_player_name()
|
||||
|
||||
entity:_destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- se è un nodo mi fermo, e ritorno l'array se > 0 (ovvero ha trovato giocatori)
|
||||
if hit.type == "node" then
|
||||
if #players > 0 then
|
||||
if particle ~= nil and particle ~= false then
|
||||
if not trafigge then
|
||||
local dist3 = block_league.get_dist(head_pos, players[1]:get_pos())
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, dist2),
|
||||
maxvel = vector.multiply(dir, dist2),
|
||||
minexptime = dist3/(dist2 * 1.5),
|
||||
maxexptime = dist3/(dist2 * 1.5),
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
else
|
||||
local dist3 = block_league.get_dist(head_pos, hit.intersection_point)
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, dist2),
|
||||
maxvel = vector.multiply(dir, dist2),
|
||||
minexptime = dist3/(dist2 * 1.5),
|
||||
maxexptime = dist3/(dist2 * 1.5),
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
end
|
||||
end
|
||||
return players
|
||||
else
|
||||
if particle ~= nil and particle ~= false then
|
||||
local dist3 = block_league.get_dist(head_pos, hit.intersection_point)
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, dist2),
|
||||
maxvel = vector.multiply(dir, dist2),
|
||||
minexptime = dist3/(dist2 * 1.5),
|
||||
maxexptime = dist3/(dist2 * 1.5),
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- se ho sparato a qualcuno puntando in aria (quindi senza incrociare blocchi)
|
||||
if #players > 0 then
|
||||
if trafigge then
|
||||
if particle ~= nil and particle ~= false then
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, 120),
|
||||
maxvel = vector.multiply(dir, 120),
|
||||
minexptime = dist2/120,
|
||||
maxexptime = dist2/120,
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
end
|
||||
return players
|
||||
else
|
||||
if particle ~= nil and particle ~= false then
|
||||
|
||||
local dist3 = block_league.get_dist(head_pos, players[1]:get_pos())
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, dist2),
|
||||
maxvel = vector.multiply(dir, dist2),
|
||||
minexptime = dist3/(dist2 * 1.5),
|
||||
maxexptime = dist3/(dist2 * 1.5),
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
|
||||
end
|
||||
return {players[1]}
|
||||
end
|
||||
else
|
||||
if particle ~= nil and particle ~= false then
|
||||
minetest.add_particlespawner({
|
||||
amount = particle.amount,
|
||||
time = 0.3,
|
||||
minpos = p1,
|
||||
maxpos = p1,
|
||||
minvel = vector.multiply(dir, 120),
|
||||
maxvel = vector.multiply(dir, 120),
|
||||
minexptime = dist2/120,
|
||||
maxexptime = dist2/120,
|
||||
size = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = particle.image,
|
||||
--texture = "block_league_pixelgun_trail.png"
|
||||
})
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--block_league.shoot(user, pointed_players, bullet_definition.bullet_damage, bullet_definition.knockback, bullet_definition.decrease_damage_with_distance)
|
||||
-- può avere uno o più target: formato ObjectRef
|
||||
function block_league.shoot(user, targets, damage, knockback, decrease_damage_with_distance, knockback_dir)
|
||||
local p_name = user:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
local killed_players = 0
|
||||
|
||||
if not arena or arena.in_queue or arena.in_loading or arena.in_celebration then return end
|
||||
|
||||
if type(targets) ~= "table" then
|
||||
targets = {targets}
|
||||
end
|
||||
|
||||
-- per ogni giocatore colpito
|
||||
for _, target in pairs(targets) do
|
||||
|
||||
if target:get_hp() <= 0 then return end
|
||||
|
||||
-- controllo le immunità
|
||||
if target:get_inventory():contains_item("main", "arena_lib:immunity") then
|
||||
--TODO: sostituire con un suono
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#d7ded7", S("You can't hit @1 due to immunity", target:get_player_name())))
|
||||
return end
|
||||
|
||||
local t_name = target:get_player_name()
|
||||
|
||||
-- se player e target sono nella stessa squadra, annullo
|
||||
if arena_lib.is_player_in_same_team(arena, p_name, t_name) then return end
|
||||
|
||||
-- eventuale knockback
|
||||
if knockback > 0 and knockback_dir then
|
||||
local knk= vector.multiply(knockback_dir,knockback)
|
||||
target:add_player_velocity(knk)
|
||||
end
|
||||
|
||||
local remaining_HP = target:get_hp() - damage
|
||||
|
||||
-- applico il danno
|
||||
|
||||
target:set_hp(remaining_HP, {type = "set_hp", player_name = p_name})
|
||||
|
||||
-- se è ancora vivo, riproduco suono danno
|
||||
if target:get_hp() > 0 then
|
||||
minetest.sound_play("block_league_hit", {
|
||||
to_player = p_name,
|
||||
max_hear_distance = 1,
|
||||
})
|
||||
-- sennò kaputt
|
||||
else
|
||||
kill(arena, p_name, target)
|
||||
if t_name ~= p_name then
|
||||
killed_players = killed_players +1
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- calcoli post-danno
|
||||
after_shoot(arena, p_name, killed_players)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function after_shoot(arena, p_name, killed_players)
|
||||
|
||||
-- eventuale achievement doppia/tripla uccisione
|
||||
if killed_players > 1 then
|
||||
|
||||
if killed_players == 2 then
|
||||
block_league.add_achievement(p_name, 1)
|
||||
elseif killed_players >= 3 then
|
||||
block_league.add_achievement(p_name, 2)
|
||||
end
|
||||
|
||||
arena_lib.send_message_players_in_arena(arena, minetest.colorize("#eea160", p_name .. " ") .. minetest.colorize("#d7ded7", S("has killed @1 players in a row!", killed_players)))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function kill(arena, p_name, target)
|
||||
|
||||
-- riproduco suono morte
|
||||
minetest.sound_play("block_league_kill", {
|
||||
to_player = p_name,
|
||||
max_hear_distance = 1,
|
||||
})
|
||||
|
||||
local t_name = target:get_player_name()
|
||||
|
||||
if t_name ~= p_name then
|
||||
|
||||
-- informo dell'uccisione
|
||||
block_league.HUD_broadcast_player(p_name, S("YOU'VE KILLED @1", t_name), 2.5)
|
||||
minetest.chat_send_player(t_name, minetest.colorize("#d7ded7", S("You've been killed by @1", minetest.colorize("#eea160", p_name))))
|
||||
|
||||
local p_stats = arena.players[p_name]
|
||||
local team = arena.teams[arena.players[p_name].teamID]
|
||||
|
||||
-- aggiungo la kill
|
||||
team.kills = team.kills +1
|
||||
p_stats.kills = p_stats.kills +1
|
||||
|
||||
-- aggiorno HUD
|
||||
block_league.scoreboard_update(arena)
|
||||
for pl_name, stats in pairs(arena.players) do
|
||||
block_league.HUD_teams_score_update(arena, pl_name, p_stats.teamID)
|
||||
end
|
||||
|
||||
-- se è DM e il cap è raggiunto, finisce match
|
||||
if arena.mod == 2 then
|
||||
local team = arena.teams[arena.players[p_name].teamID]
|
||||
if team.kills == arena.score_cap then
|
||||
local mod = arena_lib.get_mod_by_player(p_name)
|
||||
arena_lib.load_celebration(mod, arena, {p_name})
|
||||
end
|
||||
end
|
||||
else
|
||||
block_league.HUD_broadcast_player(t_name, S("You've killed yourself"), 2.5)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,113 @@
|
|||
block_league.explode = function(self)
|
||||
local explosion_range = self.initial_properties.bullet_explosion_range
|
||||
local explosion_damage = self.initial_properties.bullet_explosion_damage
|
||||
local origin = self.object:get_pos()
|
||||
local p_name = self.p_name
|
||||
if origin == nil then return end
|
||||
if origin.x == nil or origin.y == nil or origin.z == nil then return end
|
||||
|
||||
local objs = minetest.env:get_objects_inside_radius(origin, explosion_range)
|
||||
local entities = {}
|
||||
-- Se ho colpito qualcosa
|
||||
if objs then
|
||||
for _, obj in ipairs(objs) do
|
||||
if obj:is_player() then
|
||||
|
||||
local p_pos = obj:get_pos()
|
||||
local lenx = math.abs(p_pos.x - origin.x)
|
||||
local leny = math.abs(p_pos.y - origin.y)
|
||||
local lenz = math.abs(p_pos.z - origin.z)
|
||||
local hypot = math.sqrt((lenx * lenx) + (lenz * lenz))
|
||||
local dist = math.sqrt((hypot * hypot) + (leny * leny))
|
||||
local damage = explosion_damage - (explosion_damage * dist / explosion_range)
|
||||
local target_name = obj:get_player_name()
|
||||
|
||||
|
||||
if self.old_p_name and p_name == target_name then
|
||||
p_name = self.old_p_name
|
||||
end
|
||||
|
||||
-- Se colpisco me stesso, prendo 1/5 di danno
|
||||
if (target_name ~= p_name) then
|
||||
block_league.shoot(minetest.get_player_by_name(p_name), obj, damage, 0, false)
|
||||
else
|
||||
block_league.shoot(minetest.get_player_by_name(p_name), obj, (damage/5), 0, false)
|
||||
end
|
||||
|
||||
elseif obj ~= self.object and obj:get_luaentity() then
|
||||
local entity = obj:get_luaentity()
|
||||
table.insert(entities, entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #entities == 0 then return end
|
||||
self.object:remove()
|
||||
for _,entity in pairs(entities) do
|
||||
if entity.initial_properties ~= nil then
|
||||
if entity.initial_properties.is_bullet then
|
||||
|
||||
entity.old_p_name = entity.p_name
|
||||
entity.p_name = p_name
|
||||
|
||||
entity:_destroy()
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
block_league.grenade_explode = function(self)
|
||||
local explosion_range = self.initial_properties.bullet_explosion_range
|
||||
local explosion_damage = self.initial_properties.bullet_explosion_damage
|
||||
local origin = self.object:get_pos()
|
||||
local p_name = self.p_name
|
||||
if origin == nil then return end
|
||||
if origin.x == nil or origin.y == nil or origin.z == nil then return end
|
||||
|
||||
local objs = minetest.env:get_objects_inside_radius(origin, explosion_range)
|
||||
local entities = {}
|
||||
-- Se ho colpito qualcosa
|
||||
if objs then
|
||||
for _, obj in ipairs(objs) do
|
||||
if obj:is_player() then
|
||||
|
||||
local p_pos = obj:get_pos()
|
||||
local lenx = math.abs(p_pos.x - origin.x)
|
||||
local leny = math.abs(p_pos.y - origin.y)
|
||||
local lenz = math.abs(p_pos.z - origin.z)
|
||||
local hypot = math.sqrt((lenx * lenx) + (lenz * lenz))
|
||||
local dist = math.sqrt((hypot * hypot) + (leny * leny))
|
||||
local damage = explosion_damage - (explosion_damage * dist / explosion_range)
|
||||
local target_name = obj:get_player_name()
|
||||
|
||||
if self.old_p_name and p_name == target_name then
|
||||
p_name = self.old_p_name
|
||||
end
|
||||
|
||||
block_league.shoot(minetest.get_player_by_name(p_name), obj, damage, 0, false)
|
||||
|
||||
elseif obj ~= self.object and obj:get_luaentity() then
|
||||
|
||||
local entity = obj:get_luaentity()
|
||||
table.insert(entities, entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #entities == 0 then return end
|
||||
self.object:remove()
|
||||
for _,entity in pairs(entities) do
|
||||
if entity.initial_properties ~= nil then
|
||||
if entity.initial_properties.is_bullet then
|
||||
|
||||
entity.old_p_name = entity.p_name
|
||||
entity.p_name = p_name
|
||||
|
||||
entity:_destroy()
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,50 @@
|
|||
--
|
||||
-- ATTENZIONE: questa classe funziona da magazzino per gli achievement. Se
|
||||
-- invece si vuole vederne la parte grafica (come quando appaiono a schermo),
|
||||
-- vedere /_HUD/hud_achievements.lua
|
||||
|
||||
local S = minetest.get_translator("block_league")
|
||||
|
||||
local achievements = {
|
||||
[1] = { name = S("two in one"), img = "block_league_achievement_doublekill.png" },
|
||||
[2] = { name = S("three in one"), img = "block_league_achievement_triplekill.png" }
|
||||
}
|
||||
local access_key = achievements_lib.register_achievements("block_league", achievements)
|
||||
|
||||
|
||||
|
||||
function block_league.add_achievement(p_name, achvmt_ID)
|
||||
achievements_lib.add_achievement(p_name, access_key, achvmt_ID)
|
||||
block_league.show_achievement(access_key, p_name, achvmt_ID)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.list_achievements(sender, t_name)
|
||||
|
||||
local p_name = t_name or sender
|
||||
|
||||
-- se il giocatore non esiste, annullo
|
||||
if not achievements_lib.is_player_in_storage(p_name, "block_league") then
|
||||
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This player doesn't exist!")))
|
||||
return end
|
||||
|
||||
local p_achievements = achievements_lib.get_player_achievements(p_name, access_key)
|
||||
local current_achievements = 0
|
||||
local achievements_to_text = "\n"
|
||||
|
||||
for i = 1, #achievements do
|
||||
if p_achievements[i] then
|
||||
achievements_to_text = achievements_to_text .. minetest.colorize("#b6d53c", "[X] " .. achievements[i].name) .. "\n"
|
||||
current_achievements = current_achievements +1
|
||||
else
|
||||
achievements_to_text = achievements_to_text .. minetest.colorize("#cfc6b8", "[ ] " .. achievements[i].name) .. "\n"
|
||||
end
|
||||
end
|
||||
|
||||
minetest.chat_send_player(sender,
|
||||
minetest.colorize("#cfc6b8", "====================================") .. "\n" ..
|
||||
minetest.colorize("#eea160", S("@1 ACHIEVEMENTS", p_name) .. ": " .. current_achievements .. "/" .. #achievements) .. achievements_to_text
|
||||
)
|
||||
|
||||
end
|
|
@ -0,0 +1,306 @@
|
|||
ChatCmdBuilder = {}
|
||||
|
||||
function ChatCmdBuilder.new(name, func, def)
|
||||
def = def or {}
|
||||
local cmd = ChatCmdBuilder.build(func)
|
||||
cmd.def = def
|
||||
def.func = cmd.run
|
||||
minetest.register_chatcommand(name, def)
|
||||
return cmd
|
||||
end
|
||||
|
||||
local STATE_READY = 1
|
||||
local STATE_PARAM = 2
|
||||
local STATE_PARAM_TYPE = 3
|
||||
local bad_chars = {}
|
||||
bad_chars["("] = true
|
||||
bad_chars[")"] = true
|
||||
bad_chars["."] = true
|
||||
bad_chars["%"] = true
|
||||
bad_chars["+"] = true
|
||||
bad_chars["-"] = true
|
||||
bad_chars["*"] = true
|
||||
bad_chars["?"] = true
|
||||
bad_chars["["] = true
|
||||
bad_chars["^"] = true
|
||||
bad_chars["$"] = true
|
||||
local function escape(char)
|
||||
if bad_chars[char] then
|
||||
return "%" .. char
|
||||
else
|
||||
return char
|
||||
end
|
||||
end
|
||||
|
||||
local dprint = function() end
|
||||
|
||||
ChatCmdBuilder.types = {
|
||||
pos = "%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?",
|
||||
text = "(.+)",
|
||||
number = "(%-?[%d.]+)",
|
||||
int = "(%-?[%d]+)",
|
||||
word = "([^ ]+)",
|
||||
alpha = "([A-Za-z]+)",
|
||||
modname = "([a-z0-9_]+)",
|
||||
alphascore = "([A-Za-z_]+)",
|
||||
alphanumeric = "([A-Za-z0-9]+)",
|
||||
username = "([A-Za-z0-9-_]+)",
|
||||
}
|
||||
|
||||
function ChatCmdBuilder.build(func)
|
||||
local cmd = {
|
||||
_subs = {}
|
||||
}
|
||||
function cmd:sub(route, func, def)
|
||||
dprint("Parsing " .. route)
|
||||
|
||||
def = def or {}
|
||||
if string.trim then
|
||||
route = string.trim(route)
|
||||
end
|
||||
|
||||
local sub = {
|
||||
pattern = "^",
|
||||
params = {},
|
||||
func = func
|
||||
}
|
||||
|
||||
-- End of param reached: add it to the pattern
|
||||
local param = ""
|
||||
local param_type = ""
|
||||
local should_be_eos = false
|
||||
local function finishParam()
|
||||
if param ~= "" and param_type ~= "" then
|
||||
dprint(" - Found param " .. param .. " type " .. param_type)
|
||||
|
||||
local pattern = ChatCmdBuilder.types[param_type]
|
||||
if not pattern then
|
||||
error("Unrecognised param_type=" .. param_type)
|
||||
end
|
||||
|
||||
sub.pattern = sub.pattern .. pattern
|
||||
|
||||
table.insert(sub.params, param_type)
|
||||
|
||||
param = ""
|
||||
param_type = ""
|
||||
end
|
||||
end
|
||||
|
||||
-- Iterate through the route to find params
|
||||
local state = STATE_READY
|
||||
local catching_space = false
|
||||
local match_space = " " -- change to "%s" to also catch tabs and newlines
|
||||
local catch_space = match_space.."+"
|
||||
for i = 1, #route do
|
||||
local c = route:sub(i, i)
|
||||
if should_be_eos then
|
||||
error("Should be end of string. Nothing is allowed after a param of type text.")
|
||||
end
|
||||
|
||||
if state == STATE_READY then
|
||||
if c == ":" then
|
||||
dprint(" - Found :, entering param")
|
||||
state = STATE_PARAM
|
||||
param_type = "word"
|
||||
catching_space = false
|
||||
elseif c:match(match_space) then
|
||||
print(" - Found space")
|
||||
if not catching_space then
|
||||
catching_space = true
|
||||
sub.pattern = sub.pattern .. catch_space
|
||||
end
|
||||
else
|
||||
catching_space = false
|
||||
sub.pattern = sub.pattern .. escape(c)
|
||||
end
|
||||
elseif state == STATE_PARAM then
|
||||
if c == ":" then
|
||||
dprint(" - Found :, entering param type")
|
||||
state = STATE_PARAM_TYPE
|
||||
param_type = ""
|
||||
elseif c:match(match_space) then
|
||||
print(" - Found whitespace, leaving param")
|
||||
state = STATE_READY
|
||||
finishParam()
|
||||
catching_space = true
|
||||
sub.pattern = sub.pattern .. catch_space
|
||||
elseif c:match("%W") then
|
||||
dprint(" - Found nonalphanum, leaving param")
|
||||
state = STATE_READY
|
||||
finishParam()
|
||||
sub.pattern = sub.pattern .. escape(c)
|
||||
else
|
||||
param = param .. c
|
||||
end
|
||||
elseif state == STATE_PARAM_TYPE then
|
||||
if c:match(match_space) then
|
||||
print(" - Found space, leaving param type")
|
||||
state = STATE_READY
|
||||
finishParam()
|
||||
catching_space = true
|
||||
sub.pattern = sub.pattern .. catch_space
|
||||
elseif c:match("%W") then
|
||||
dprint(" - Found nonalphanum, leaving param type")
|
||||
state = STATE_READY
|
||||
finishParam()
|
||||
sub.pattern = sub.pattern .. escape(c)
|
||||
else
|
||||
param_type = param_type .. c
|
||||
end
|
||||
end
|
||||
end
|
||||
dprint(" - End of route")
|
||||
finishParam()
|
||||
sub.pattern = sub.pattern .. "$"
|
||||
dprint("Pattern: " .. sub.pattern)
|
||||
|
||||
table.insert(self._subs, sub)
|
||||
end
|
||||
|
||||
if func then
|
||||
func(cmd)
|
||||
end
|
||||
|
||||
cmd.run = function(name, param)
|
||||
for i = 1, #cmd._subs do
|
||||
local sub = cmd._subs[i]
|
||||
local res = { string.match(param, sub.pattern) }
|
||||
if #res > 0 then
|
||||
local pointer = 1
|
||||
local params = { name }
|
||||
for j = 1, #sub.params do
|
||||
local param = sub.params[j]
|
||||
if param == "pos" then
|
||||
local pos = {
|
||||
x = tonumber(res[pointer]),
|
||||
y = tonumber(res[pointer + 1]),
|
||||
z = tonumber(res[pointer + 2])
|
||||
}
|
||||
table.insert(params, pos)
|
||||
pointer = pointer + 3
|
||||
elseif param == "number" or param == "int" then
|
||||
table.insert(params, tonumber(res[pointer]))
|
||||
pointer = pointer + 1
|
||||
else
|
||||
table.insert(params, res[pointer])
|
||||
pointer = pointer + 1
|
||||
end
|
||||
end
|
||||
if table.unpack then
|
||||
-- lua 5.2 or later
|
||||
return sub.func(table.unpack(params))
|
||||
else
|
||||
-- lua 5.1 or earlier
|
||||
return sub.func(unpack(params))
|
||||
end
|
||||
end
|
||||
end
|
||||
return false, "Invalid command"
|
||||
end
|
||||
|
||||
return cmd
|
||||
end
|
||||
|
||||
local function run_tests()
|
||||
if not (ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("bar :one and :two:word", function(name, one, two)
|
||||
if name == "singleplayer" and one == "abc" and two == "def" then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
end)).run("singleplayer", "bar abc and def") then
|
||||
error("Test 1 failed")
|
||||
end
|
||||
|
||||
local move = ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("move :target to :pos:pos", function(name, target, pos)
|
||||
if name == "singleplayer" and target == "player1" and
|
||||
pos.x == 0 and pos.y == 1 and pos.z == 2 then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
end).run
|
||||
if not move("singleplayer", "move player1 to 0,1,2") then
|
||||
error("Test 2 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to (0,1,2)") then
|
||||
error("Test 3 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to 0, 1,2") then
|
||||
error("Test 4 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to 0 ,1, 2") then
|
||||
error("Test 5 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to 0, 1, 2") then
|
||||
error("Test 6 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to 0 ,1 ,2") then
|
||||
error("Test 7 failed")
|
||||
end
|
||||
if not move("singleplayer", "move player1 to ( 0 ,1 ,2)") then
|
||||
error("Test 8 failed")
|
||||
end
|
||||
if move("singleplayer", "move player1 to abc,def,sdosd") then
|
||||
error("Test 9 failed")
|
||||
end
|
||||
if move("singleplayer", "move player1 to abc def sdosd") then
|
||||
error("Test 10 failed")
|
||||
end
|
||||
|
||||
if not (ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("does :one:int plus :two:int equal :three:int", function(name, one, two, three)
|
||||
if name == "singleplayer" and one + two == three then
|
||||
return true
|
||||
end
|
||||
end)
|
||||
end)).run("singleplayer", "does 1 plus 2 equal 3") then
|
||||
error("Test 11 failed")
|
||||
end
|
||||
|
||||
local checknegint = ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("checknegint :x:int", function(name, x)
|
||||
return x
|
||||
end)
|
||||
end).run
|
||||
if checknegint("checker","checknegint -2") ~= -2 then
|
||||
error("Test 12 failed")
|
||||
end
|
||||
|
||||
local checknegnumber = ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("checknegnumber :x:number", function(name, x)
|
||||
return x
|
||||
end)
|
||||
end).run
|
||||
if checknegnumber("checker","checknegnumber -3.3") ~= -3.3 then
|
||||
error("Test 13 failed")
|
||||
end
|
||||
|
||||
local checknegpos = ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("checknegpos :pos:pos", function(name, pos)
|
||||
return pos
|
||||
end)
|
||||
end).run
|
||||
local negpos = checknegpos("checker","checknegpos (-13.3,-4.6,-1234.5)")
|
||||
if negpos.x ~= -13.3 or negpos.y ~= -4.6 or negpos.z ~= -1234.5 then
|
||||
error("Test 14 failed")
|
||||
end
|
||||
|
||||
local checktypes = ChatCmdBuilder.build(function(cmd)
|
||||
cmd:sub("checktypes :int:int :number:number :pos:pos :word:word :text:text", function(name, int, number, pos, word, text)
|
||||
return int, number, pos.x, pos.y, pos.z, word, text
|
||||
end)
|
||||
end).run
|
||||
local int, number, posx, posy, posz, word, text
|
||||
int, number, posx, posy, posz, word, text = checktypes("checker","checktypes -1 -2.4 (-3,-5.3,6.12) some text to finish off with")
|
||||
--dprint(int, number, posx, posy, posz, word, text)
|
||||
if int ~= -1 or number ~= -2.4 or posx ~= -3 or posy ~= -5.3 or posz ~= 6.12 or word ~= "some" or text ~= "text to finish off with" then
|
||||
error("Test 15 failed")
|
||||
end
|
||||
dprint("All tests passed")
|
||||
|
||||
end
|
||||
if not minetest then
|
||||
run_tests()
|
||||
end
|
|
@ -0,0 +1,180 @@
|
|||
S = minetest.get_translator("block_league")
|
||||
|
||||
local mod = "block_league"
|
||||
|
||||
ChatCmdBuilder.new("bleagueadmin", function(cmd)
|
||||
|
||||
-- creazione arene
|
||||
cmd:sub("create :arena :tipologia:int", function(sender, arena_name, tipologia)
|
||||
arena_lib.create_arena(sender, mod, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "mod" , tipologia)
|
||||
end)
|
||||
|
||||
cmd:sub("create :arena :minplayers:int :maxplayers:int :tipologia:int", function(sender, arena_name, min_players, max_players, tipologia)
|
||||
arena_lib.create_arena(sender, mod, arena_name, min_players, max_players)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "mod" , tipologia)
|
||||
end)
|
||||
|
||||
cmd:sub("create :arena :minplayers:int :maxplayers:int :scorecap:int :tipologia:int", function(sender, arena_name, min_players, max_players, score_cap, tipologia)
|
||||
arena_lib.create_arena(sender, mod, arena_name, min_players, max_players)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "mod" , tipologia)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "score_cap" , score_cap)
|
||||
end)
|
||||
|
||||
-- rimozione arene
|
||||
cmd:sub("remove :arena", function(sender, arena_name)
|
||||
arena_lib.remove_arena(sender, mod, arena_name)
|
||||
end)
|
||||
|
||||
-- rinominazione arene
|
||||
cmd:sub("rename :arena :newname", function(sender, arena_name, new_name)
|
||||
arena_lib.rename_arena(sender, mod, arena_name, new_name)
|
||||
end)
|
||||
|
||||
--
|
||||
cmd:sub("properties :arena :property :newvalue:text", function(sender, arena_name, property, new_value)
|
||||
arena_lib.change_arena_properties(sender, mod, arena_name, property, new_value)
|
||||
end)
|
||||
|
||||
-- cambio giocatori minimi/massimi
|
||||
cmd:sub("setplayers :arena :minplayers:int :maxplayers:int", function(sender, arena_name, min_players, max_players)
|
||||
arena_lib.change_players_amount(sender, mod, arena_name, min_players, max_players)
|
||||
end)
|
||||
|
||||
-- abilitazione/disabilitazione team per arena (enable 0 o 1)
|
||||
cmd:sub("toggleteams :arena :enable:int", function(sender, arena_name, enable)
|
||||
arena_lib.toggle_teams_per_arena(sender, mod, arena_name, enable)
|
||||
end)
|
||||
|
||||
-- lista arene
|
||||
cmd:sub("list", function(sender)
|
||||
arena_lib.print_arenas(sender, mod)
|
||||
end)
|
||||
|
||||
-- info su un'arena specifica
|
||||
cmd:sub("info :arena", function(sender, arena_name)
|
||||
arena_lib.print_arena_info(sender, mod, arena_name)
|
||||
end)
|
||||
|
||||
-- info su stats partita
|
||||
cmd:sub("score :arena", function(sender, arena_name)
|
||||
arena_lib.print_arena_stats(sender, mod, arena_name)
|
||||
end)
|
||||
|
||||
|
||||
-- modifiche arena
|
||||
--editor
|
||||
cmd:sub("edit :arena", function(sender, arena)
|
||||
arena_lib.enter_editor(sender, mod, arena)
|
||||
end)
|
||||
|
||||
--inline
|
||||
-- cartello arena
|
||||
cmd:sub("setsign :arena", function(sender, arena)
|
||||
arena_lib.set_sign(sender, nil, nil, mod, arena)
|
||||
end)
|
||||
|
||||
-- spawner (ie. deleteall)
|
||||
cmd:sub("setspawn :arena :param:word :ID:int", function(sender, arena, param, ID)
|
||||
arena_lib.set_spawner(sender, mod, arena, nil, param, ID)
|
||||
end)
|
||||
|
||||
-- spawner (ie. deleteall)
|
||||
cmd:sub("setspawn :arena :team:word :param:word :ID:int", function(sender, arena, team_name, param, ID)
|
||||
arena_lib.set_spawner(sender, mod, arena, team_name, param, ID)
|
||||
end)
|
||||
|
||||
cmd:sub("setspawn :arena", function(sender, arena)
|
||||
arena_lib.set_spawner(sender, mod, arena)
|
||||
end)
|
||||
|
||||
-- teletrasporto
|
||||
cmd:sub("tp :arena", function(sender, arena)
|
||||
arena_lib.teleport_in_arena(sender, mod, arena)
|
||||
end)
|
||||
|
||||
-- abilitazione e disabilitazione arene
|
||||
cmd:sub("enable :arena", function(sender, arena)
|
||||
arena_lib.enable_arena(sender, mod, arena)
|
||||
end)
|
||||
|
||||
cmd:sub("disable :arena", function(sender, arena)
|
||||
arena_lib.disable_arena(sender, mod, arena)
|
||||
end)
|
||||
|
||||
cmd:sub("adddestination :arena :team", function(sender, arena_name, team)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
if team == "red" then
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_red" , pos)
|
||||
print("Aggiunta destinazione red")
|
||||
else
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_blue" , pos)
|
||||
print("Aggiunta destinazione blue")
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
--Rimuove la destinazione.
|
||||
cmd:sub("removedestination :arena :team", function(sender, arena_name, team)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
if team == "red" then
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_red" , {})
|
||||
print("Rimossa destinazione red")
|
||||
else
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_blue" , {})
|
||||
print("Rimossa destinazione blue")
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
cmd:sub("addspawn :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "prototipo_spawn" , pos)
|
||||
print("Aggiunto spawn")
|
||||
|
||||
end)
|
||||
|
||||
cmd:sub("removespawn :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "prototipo_spawn" , {})
|
||||
print("Rimosso spawn")
|
||||
end)
|
||||
|
||||
cmd:sub("addminy :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "min_y" , pos.y)
|
||||
print("Aggiunta y minima")
|
||||
|
||||
end)
|
||||
|
||||
cmd:sub("removeminy :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "min_y" , 0)
|
||||
print("Rimossa y minima")
|
||||
end)
|
||||
|
||||
|
||||
end, {
|
||||
description = S("mod management"),
|
||||
privs = { block_league_admin = true }
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
ChatCmdBuilder.new("bleague", function(cmd)
|
||||
cmd:sub("achievements", function(sender)
|
||||
block_league.list_achievements(sender)
|
||||
end)
|
||||
|
||||
cmd:sub("achievements :playername", function(sender, p_name)
|
||||
block_league.list_achievements(sender, p_name)
|
||||
end)
|
||||
|
||||
end,{})
|
|
@ -0,0 +1,33 @@
|
|||
block_league.players = {} -- KEY: p_name, INDEX: {lv (int), xp (int), kills (int), time_playing (int)}
|
||||
|
||||
local storage = minetest.get_mod_storage()
|
||||
|
||||
|
||||
|
||||
function block_league.init_storage()
|
||||
|
||||
-- carico tutti i giocatori
|
||||
for pl_name, pl_stats in pairs(storage:to_table().fields) do
|
||||
block_league.players[pl_name] = minetest.deserialize(pl_stats)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.add_player_to_storage(p_name)
|
||||
block_league.players[p_name] = {LV = 0, XP = 0, KILLS = 0, TIME_PLAYING = 0}
|
||||
storage:set_string(p_name, minetest.serialize(block_league.players[p_name]))
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.update_storage(p_name)
|
||||
storage:set_string( p_name, minetest.serialize(block_league.players[p_name]))
|
||||
end
|
||||
|
||||
|
||||
|
||||
function block_league.is_player_in_storage(p_name)
|
||||
return storage:get_string(p_name) ~= ""
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
achievements_lib
|
||||
arena_lib
|
||||
controls
|
||||
panel_lib
|
|
@ -0,0 +1,13 @@
|
|||
-- EXP is disabled right now as we haven't decided yet what purpose should have,
|
||||
-- aside as a barrier for future ranked games
|
||||
|
||||
function block_league.add_xp(p_name, xp)
|
||||
block_league.players[p_name].XP = block_league.players[p_name].XP + xp
|
||||
end
|
||||
|
||||
function block_league.subtract_exp(p_name, xp)
|
||||
block_league.players[p_name].XP = block_league.players[p_name].XP - xp
|
||||
if block_league.players[p_name].XP < 0 then
|
||||
block_league.players[p_name].XP = 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,93 @@
|
|||
block_league = {}
|
||||
local S = minetest.get_translator("block_league")
|
||||
|
||||
arena_lib.register_minigame("block_league", {
|
||||
prefix = "[block_league] ",
|
||||
teams = {
|
||||
S("red"),
|
||||
S("blue")
|
||||
},
|
||||
teams_color_overlay = {
|
||||
"red",
|
||||
"blue"
|
||||
},
|
||||
hub_spawn_point = { x = 8, y = 6, z = 4 },
|
||||
join_while_in_progress = true,
|
||||
celebration_time = 5,
|
||||
|
||||
disabled_damage_types = {
|
||||
"fall"
|
||||
},
|
||||
properties = {
|
||||
-- 1 = Touchdown
|
||||
-- 2 = Deathmatch
|
||||
mod = 1,
|
||||
score_cap = 10,
|
||||
max_energy = 100,
|
||||
immunity_time = 6,
|
||||
destinazione_red = {"lol"},
|
||||
destinazione_blue = {"lol"},
|
||||
prototipo_spawn = {"lol"},
|
||||
min_y = 0,
|
||||
high_speed = 2.5,
|
||||
low_speed = 1.5,
|
||||
},
|
||||
temp_properties = {
|
||||
weapons_disabled = false,
|
||||
},
|
||||
team_properties = {
|
||||
TDs = 0,
|
||||
kills = 0,
|
||||
deaths = 0
|
||||
},
|
||||
player_properties = {
|
||||
energy = 100,
|
||||
weapons_reload = {},
|
||||
}
|
||||
})
|
||||
|
||||
-- load other scripts
|
||||
|
||||
dofile(minetest.get_modpath("block_league") .. "/achievements.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/chatcmdbuilder.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/commands.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/database_manager.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/exp_manager.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/input_manager.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/items.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/player_manager.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/privs.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/utils.lua")
|
||||
|
||||
-- arena_lib
|
||||
dofile(minetest.get_modpath("block_league") .. "/_arena_lib/arena_manager.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_arena_lib/arena_properties.lua")
|
||||
-- HUD
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/hud_achievements.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/hud_broadcast.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/hud_energy.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/hud_scoreboard.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/hud_teams_score.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_HUD/bullets_hud.lua")
|
||||
-- abstract weapons
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/bullets.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/weapons.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/weapons_utils.lua")
|
||||
-- weapons
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/bouncer.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/grenade.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/grenade_launcher.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/pixelgun.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/pixelgun_bullet.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/rocket.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/rocket_launcher.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/sword.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/smg.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_weapons/smg_bullet.lua")
|
||||
-- misc
|
||||
dofile(minetest.get_modpath("block_league") .. "/_misc/ball.lua")
|
||||
dofile(minetest.get_modpath("block_league") .. "/_misc/energy.lua")
|
||||
-- immunity
|
||||
dofile(minetest.get_modpath("block_league") .. "/_immunity/immunity.lua")
|
||||
|
||||
block_league.init_storage()
|
|
@ -0,0 +1,19 @@
|
|||
controls.register_on_press(function(player, key)
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
if key == "aux1" and arena_lib.is_player_in_arena(p_name, "block_league") and not arena_lib.get_arena_by_player(p_name).in_celebration then
|
||||
panel_lib.get_panel(p_name, "blockleague_scoreboard"):show()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
controls.register_on_release(function(player, key)
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
if key == "aux1" and arena_lib.is_player_in_arena(p_name, "block_league") and not arena_lib.get_arena_by_player(p_name).in_celebration then
|
||||
panel_lib.get_panel(p_name, "blockleague_scoreboard"):hide()
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
minetest.register_tool("block_league:match_over", {
|
||||
|
||||
description = S("THE END!"),
|
||||
inventory_image = "block_league_match_over.png",
|
||||
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"},
|
||||
|
||||
})
|
|
@ -0,0 +1,52 @@
|
|||
# version 1.0.0
|
||||
# author(s): Zughy
|
||||
# reviewer(s):
|
||||
# textdomain: block_league
|
||||
|
||||
# init.lua
|
||||
red=rossa
|
||||
blue=blu
|
||||
|
||||
# scoreboard.lua
|
||||
Team=Squadra
|
||||
|
||||
# achievements.lua
|
||||
killing spree=serie d'uccisioni
|
||||
unstoppable=inarrestabile
|
||||
bloodbath=furia omicida
|
||||
shutdown!=spento!
|
||||
first blood=primo sangue
|
||||
two in one=due in uno
|
||||
three in one=tre in uno
|
||||
[!] This player doesn't exist!=[!] Questo giocatore non esiste!
|
||||
@1 ACHIEVEMENTS=PRESTIGI DI @1
|
||||
|
||||
# commands.lua
|
||||
mod management=gestione della mod
|
||||
|
||||
# items.lua
|
||||
THE END!=FINE DEI GIOCHI!
|
||||
|
||||
# privs.lua
|
||||
It allows to use the /block_leagueadmin command=Permette di usare il comando /block_leagueadmin
|
||||
|
||||
# _arena_lib/arena_manager.lua
|
||||
Score to win=Punti per la vittoria
|
||||
|
||||
# _weapons/pixelgun.lua
|
||||
pixelgun=pixelgun
|
||||
|
||||
# _weapons/rocket_launcher.lua
|
||||
Rocket Launcher=Lanciarazzi
|
||||
|
||||
# _weapons/weapons.lua
|
||||
You can't hit @1 due to immunity=Non puoi colpire @1, è immune
|
||||
has been stopped by @1=è stato fermato da @1
|
||||
has killed @1 players in a row!=ha ucciso @1 giocatori in un colpo!
|
||||
YOU'VE KILLED @1=HAI UCCISO @1
|
||||
You've been killed by @1=Sei stato ucciso da @1
|
||||
drew first blood=ha versato il primo sangue
|
||||
is on a @1=è in una @1
|
||||
is @1=è @1
|
||||
made a @1=è una @1
|
||||
You've killed yourself=Ti sei ucciso da solo
|
|
@ -0,0 +1,52 @@
|
|||
# version 1.0.0
|
||||
# author(s):
|
||||
# reviewer(s):
|
||||
# textdomain: block_league
|
||||
|
||||
# init.lua
|
||||
red=
|
||||
blue=
|
||||
|
||||
# scoreboard.lua
|
||||
Team=
|
||||
|
||||
# achievements.lua
|
||||
killing spree=
|
||||
unstoppable=
|
||||
bloodbath=
|
||||
shutdown!=
|
||||
first blood=
|
||||
two in one=
|
||||
three in one=
|
||||
[!] This player doesn't exist!=
|
||||
@1 ACHIEVEMENTS=
|
||||
|
||||
# commands.lua
|
||||
mod management=
|
||||
|
||||
# items.lua
|
||||
THE END!=
|
||||
|
||||
# privs.lua
|
||||
It allows to use the /block_leagueadmin command=
|
||||
|
||||
# _arena_lib/arena_manager.lua
|
||||
Score to win=
|
||||
|
||||
# _weapons/pixelgun.lua
|
||||
pixelgun=
|
||||
|
||||
# _weapons/rocket_launcher.lua
|
||||
Rocket Launcher=
|
||||
|
||||
# _weapons/weapons.lua
|
||||
You can't hit @1 due to immunity=
|
||||
has been stopped by @1=
|
||||
has killed @1 players in a row!=
|
||||
YOU'VE KILLED @1=
|
||||
You've been killed by @1=
|
||||
drew first blood=
|
||||
is on a @1=
|
||||
is @1=
|
||||
made a @1=
|
||||
You've killed yourself=
|
|
@ -0,0 +1,263 @@
|
|||
# Blender v2.81 (sub 16) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib s4_grenade.mtl
|
||||
o cube
|
||||
v -0.270601 0.156305 0.031250
|
||||
v -0.216475 0.125055 0.031250
|
||||
v -0.270601 0.156305 -0.031250
|
||||
v -0.216475 0.125055 -0.031250
|
||||
v -0.270633 0.156250 -0.031250
|
||||
v -0.216506 0.125000 -0.031250
|
||||
v -0.270633 0.156250 0.031250
|
||||
v -0.216506 0.125000 0.031250
|
||||
vt 0.718750 0.062500
|
||||
vt 0.718750 0.031250
|
||||
vt 0.750000 0.062500
|
||||
vt 0.750000 0.031250
|
||||
vt 0.250000 0.781250
|
||||
vt 0.250000 0.750000
|
||||
vt 0.281250 0.781250
|
||||
vt 0.281250 0.750000
|
||||
vn 0.5000 0.8660 0.0000
|
||||
vn -0.5000 -0.8660 0.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 2/2/1 4/4/1 3/3/1
|
||||
f 5/5/2 6/6/2 7/7/2
|
||||
f 6/6/2 8/8/2 7/7/2
|
||||
o cube.000
|
||||
v -0.227998 0.167719 0.031250
|
||||
v -0.227945 0.167688 0.031250
|
||||
v -0.227998 0.167719 -0.156250
|
||||
v -0.227945 0.167688 -0.156250
|
||||
v -0.259248 0.113593 -0.156250
|
||||
v -0.259195 0.113562 -0.156250
|
||||
v -0.259248 0.113593 0.031250
|
||||
v -0.259195 0.113562 0.031250
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.281250 0.687500
|
||||
vt 0.281250 0.593750
|
||||
vt 0.312500 0.687500
|
||||
vt 0.312500 0.593750
|
||||
vt 0.187500 0.812500
|
||||
vt 0.187500 0.781250
|
||||
vt 0.218750 0.812500
|
||||
vt 0.218750 0.781250
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 1.000000
|
||||
vn 0.5000 0.8660 0.0000
|
||||
vn -0.5000 -0.8660 0.0000
|
||||
vn -0.5003 -0.8659 0.0000
|
||||
vn -0.8660 0.5000 0.0000
|
||||
vn 0.8660 -0.5000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 9/9/3 10/10/3 11/11/3
|
||||
f 10/10/3 12/12/3 11/11/3
|
||||
f 13/13/4 14/14/4 15/15/5
|
||||
f 14/14/4 16/16/5 15/15/5
|
||||
f 13/17/6 15/18/6 11/19/6
|
||||
f 15/18/6 9/20/6 11/19/6
|
||||
f 16/21/7 14/22/7 10/23/7
|
||||
f 14/22/7 12/24/7 10/23/7
|
||||
f 15/25/8 16/26/8 9/27/8
|
||||
f 16/26/8 10/28/8 9/27/8
|
||||
f 11/29/9 12/30/9 13/31/9
|
||||
f 12/30/9 14/32/9 13/31/9
|
||||
o cube.001
|
||||
v -0.259195 0.113562 -0.156187
|
||||
v 0.119691 -0.105188 -0.156188
|
||||
v -0.227945 0.167688 -0.156187
|
||||
v 0.150941 -0.051062 -0.156188
|
||||
v -0.227945 0.167688 -0.156250
|
||||
v 0.150941 -0.051062 -0.156250
|
||||
v -0.259195 0.113562 -0.156250
|
||||
v 0.119691 -0.105188 -0.156250
|
||||
vt 0.250000 0.812500
|
||||
vt 0.250000 0.593750
|
||||
vt 0.281250 0.812500
|
||||
vt 0.281250 0.593750
|
||||
vt 0.250000 0.812500
|
||||
vt 0.250000 0.593750
|
||||
vt 0.281250 0.812500
|
||||
vt 0.281250 0.593750
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 17/33/10 18/34/10 19/35/10
|
||||
f 18/34/10 20/36/10 19/35/10
|
||||
f 21/37/11 22/38/11 23/39/11
|
||||
f 22/38/11 24/40/11 23/39/11
|
||||
o cube.002
|
||||
v -0.154006 0.233253 0.125000
|
||||
v -0.045753 0.170753 0.125000
|
||||
v -0.154006 0.233253 -0.125000
|
||||
v -0.045753 0.170753 -0.125000
|
||||
v -0.279006 0.016747 -0.125000
|
||||
v -0.170753 -0.045753 -0.125000
|
||||
v -0.279006 0.016747 0.125000
|
||||
v -0.170753 -0.045753 0.125000
|
||||
vt 0.000000 0.875000
|
||||
vt 0.000000 0.812500
|
||||
vt 0.125000 0.875000
|
||||
vt 0.125000 0.812500
|
||||
vt 0.000000 0.875000
|
||||
vt 0.000000 0.812500
|
||||
vt 0.125000 0.875000
|
||||
vt 0.125000 0.812500
|
||||
vt 0.000000 1.000000
|
||||
vt 0.125000 1.000000
|
||||
vt 0.250000 1.000000
|
||||
vt 0.250000 0.875000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.875000
|
||||
vt 0.250000 0.875000
|
||||
vt 0.250000 0.812500
|
||||
vt 0.250000 0.875000
|
||||
vt 0.250000 0.812500
|
||||
vn 0.5000 0.8660 0.0000
|
||||
vn -0.5000 -0.8660 -0.0000
|
||||
vn -0.8660 0.5000 0.0000
|
||||
vn 0.8660 -0.5000 -0.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 25/41/12 26/42/12 27/43/12
|
||||
f 26/42/12 28/44/12 27/43/12
|
||||
f 29/45/13 30/46/13 31/47/13
|
||||
f 30/46/13 32/48/13 31/47/13
|
||||
f 29/45/14 31/49/14 27/43/14
|
||||
f 31/49/14 25/50/14 27/43/14
|
||||
f 32/51/15 30/52/15 26/53/15
|
||||
f 30/52/15 28/54/15 26/53/15
|
||||
f 31/47/16 32/48/16 25/55/16
|
||||
f 32/48/16 26/56/16 25/55/16
|
||||
f 27/43/17 28/44/17 29/57/17
|
||||
f 28/44/17 30/58/17 29/57/17
|
||||
o cube.003
|
||||
v 0.387260 -0.079247 0.125000
|
||||
v 0.495513 -0.141747 0.125000
|
||||
v 0.387260 -0.079247 -0.125000
|
||||
v 0.495513 -0.141747 -0.125000
|
||||
v 0.262260 -0.295753 -0.125000
|
||||
v 0.370513 -0.358253 -0.125000
|
||||
v 0.262260 -0.295753 0.125000
|
||||
v 0.370513 -0.358253 0.125000
|
||||
vt 0.000000 0.875000
|
||||
vt 0.000000 0.812500
|
||||
vt 0.125000 0.875000
|
||||
vt 0.125000 0.812500
|
||||
vt 0.000000 0.875000
|
||||
vt 0.000000 0.812500
|
||||
vt 0.125000 0.875000
|
||||
vt 0.125000 0.812500
|
||||
vt 0.000000 1.000000
|
||||
vt 0.125000 1.000000
|
||||
vt 0.250000 1.000000
|
||||
vt 0.250000 0.875000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.875000
|
||||
vt 0.250000 0.875000
|
||||
vt 0.250000 0.812500
|
||||
vt 0.250000 0.875000
|
||||
vt 0.250000 0.812500
|
||||
vn 0.5000 0.8660 0.0000
|
||||
vn -0.5000 -0.8660 0.0000
|
||||
vn -0.8660 0.5000 0.0000
|
||||
vn 0.8660 -0.5000 0.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 33/59/18 34/60/18 35/61/18
|
||||
f 34/60/18 36/62/18 35/61/18
|
||||
f 37/63/19 38/64/19 39/65/19
|
||||
f 38/64/19 40/66/19 39/65/19
|
||||
f 37/63/20 39/67/20 35/61/20
|
||||
f 39/67/20 33/68/20 35/61/20
|
||||
f 40/69/21 38/70/21 34/71/21
|
||||
f 38/70/21 36/72/21 34/71/21
|
||||
f 39/65/22 40/66/22 33/73/22
|
||||
f 40/66/22 34/74/22 33/73/22
|
||||
f 35/61/23 36/62/23 37/75/23
|
||||
f 36/62/23 38/76/23 37/75/23
|
||||
o cube.004
|
||||
v -0.061378 0.143690 0.093750
|
||||
v 0.371635 -0.106310 0.093750
|
||||
v -0.061378 0.143690 -0.093750
|
||||
v 0.371635 -0.106310 -0.093750
|
||||
v -0.155128 -0.018690 -0.093750
|
||||
v 0.277885 -0.268690 -0.093750
|
||||
v -0.155128 -0.018690 0.093750
|
||||
v 0.277885 -0.268690 0.093750
|
||||
vt 0.000000 0.812500
|
||||
vt 0.000000 0.562500
|
||||
vt 0.093750 0.812500
|
||||
vt 0.093750 0.562500
|
||||
vt 0.000000 0.812500
|
||||
vt 0.000000 0.562500
|
||||
vt 0.093750 0.812500
|
||||
vt 0.093750 0.562500
|
||||
vt 0.187500 0.812500
|
||||
vt 0.000000 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.187500 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.187500 0.812500
|
||||
vt 0.000000 0.812500
|
||||
vt 0.187500 0.812500
|
||||
vt 0.187500 0.562500
|
||||
vt 0.187500 0.812500
|
||||
vt 0.187500 0.562500
|
||||
vn 0.5000 0.8660 -0.0000
|
||||
vn -0.5000 -0.8660 0.0000
|
||||
vn -0.8660 0.5000 0.0000
|
||||
vn 0.8660 -0.5000 0.0000
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn -0.0000 0.0000 -1.0000
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 41/77/24 42/78/24 43/79/24
|
||||
f 42/78/24 44/80/24 43/79/24
|
||||
f 45/81/25 46/82/25 47/83/25
|
||||
f 46/82/25 48/84/25 47/83/25
|
||||
f 45/81/26 47/85/26 43/86/26
|
||||
f 47/85/26 41/87/26 43/86/26
|
||||
f 48/88/27 46/89/27 42/90/27
|
||||
f 46/89/27 44/91/27 42/90/27
|
||||
f 47/83/28 48/84/28 41/92/28
|
||||
f 48/84/28 42/93/28 41/92/28
|
||||
f 43/79/29 44/80/29 45/94/29
|
||||
f 44/80/29 46/95/29 45/94/29
|
||||
o cube.005
|
||||
v -0.317558 0.075089 0.000024
|
||||
v -0.255418 0.039213 0.173251
|
||||
v -0.223808 0.237469 0.000024
|
||||
v -0.161668 0.201592 0.173251
|
||||
vt 0.281250 0.500000
|
||||
vt 0.281250 0.593750
|
||||
vt 0.187500 0.500000
|
||||
vt 0.187500 0.593750
|
||||
vn -0.8001 0.4619 0.3827
|
||||
usemtl m_0
|
||||
s 1
|
||||
f 49/96/30 50/97/30 51/98/30
|
||||
f 50/97/30 52/99/30 51/98/30
|
|
@ -0,0 +1,452 @@
|
|||
# Blender v2.82 (sub 7) OBJ File: 'untitled.blend'
|
||||
# www.blender.org
|
||||
mtllib untitled.mtl
|
||||
o cube
|
||||
v -0.049010 0.252991 0.093750
|
||||
v 0.056644 0.026414 0.093750
|
||||
v 0.064278 0.305818 0.093750
|
||||
v 0.169933 0.079241 0.093750
|
||||
v 0.064278 0.305818 -0.093750
|
||||
v 0.169933 0.079241 -0.093750
|
||||
v -0.049010 0.252991 -0.093750
|
||||
v 0.056644 0.026414 -0.093750
|
||||
v 0.090692 0.249174 0.062500
|
||||
v 0.143519 0.135885 0.062500
|
||||
v 0.600490 0.486896 0.062500
|
||||
v 0.653317 0.373608 0.062500
|
||||
v 0.600490 0.486896 -0.062500
|
||||
v 0.653317 0.373608 -0.062500
|
||||
v 0.090692 0.249174 -0.062500
|
||||
v 0.143519 0.135885 -0.062500
|
||||
v -0.192529 0.117105 0.062500
|
||||
v -0.086875 -0.109472 0.062500
|
||||
v 0.090692 0.249174 0.062500
|
||||
v 0.196346 0.022597 0.062500
|
||||
v 0.090692 0.249174 -0.062500
|
||||
v 0.196346 0.022597 -0.062500
|
||||
v -0.192529 0.117105 -0.062500
|
||||
v -0.086875 -0.109472 -0.062500
|
||||
v -0.168277 0.043438 0.063125
|
||||
v -0.317911 -0.367677 0.063125
|
||||
v 0.007916 -0.020690 0.063125
|
||||
v -0.141718 -0.431806 0.063125
|
||||
v 0.007916 -0.020690 -0.063125
|
||||
v -0.141718 -0.431806 -0.063125
|
||||
v -0.168277 0.043438 -0.063125
|
||||
v -0.317911 -0.367677 -0.063125
|
||||
v 0.434374 0.547358 0.000062
|
||||
v 0.487201 0.434069 0.000062
|
||||
v 0.547663 0.600185 0.000062
|
||||
v 0.600490 0.486896 0.000062
|
||||
v 0.547663 0.600185 0.000000
|
||||
v 0.600490 0.486896 0.000000
|
||||
v 0.434374 0.547358 0.000000
|
||||
v 0.487201 0.434069 0.000000
|
||||
v -0.143519 -0.135885 0.000688
|
||||
v -0.011451 -0.419106 0.000688
|
||||
v 0.139702 -0.003817 0.000687
|
||||
v 0.271770 -0.287038 0.000687
|
||||
v 0.139702 -0.003817 0.000625
|
||||
v 0.271770 -0.287038 0.000625
|
||||
v -0.143519 -0.135885 0.000625
|
||||
v -0.011451 -0.419106 0.000625
|
||||
v -0.445520 0.068095 0.000625
|
||||
v -0.313452 -0.215126 0.000625
|
||||
v -0.218943 0.173750 0.000625
|
||||
v -0.086875 -0.109472 0.000625
|
||||
v -0.218943 0.173750 0.000000
|
||||
v -0.086875 -0.109472 -0.000000
|
||||
v -0.445520 0.068095 0.000000
|
||||
v -0.313452 -0.215126 -0.000000
|
||||
v 0.566442 0.264136 0.031250
|
||||
v 0.592856 0.207492 0.031250
|
||||
v 0.623087 0.290550 0.031250
|
||||
v 0.649500 0.233906 0.031250
|
||||
v 0.623087 0.290550 -0.031250
|
||||
v 0.649500 0.233906 -0.031250
|
||||
v 0.566442 0.264136 -0.031250
|
||||
v 0.592856 0.207492 -0.031250
|
||||
v -0.275587 0.147336 0.093750
|
||||
v -0.196346 -0.022597 0.093750
|
||||
v -0.049010 0.252991 0.093750
|
||||
v 0.030231 0.083058 0.093750
|
||||
v -0.049010 0.252991 -0.093750
|
||||
v 0.030231 0.083058 -0.093750
|
||||
v -0.275587 0.147336 -0.093750
|
||||
v -0.196346 -0.022597 -0.093750
|
||||
v 0.117105 0.192529 0.093750
|
||||
v 0.196346 0.022597 0.093750
|
||||
v 0.513615 0.377425 0.093750
|
||||
v 0.592856 0.207492 0.093750
|
||||
v 0.513615 0.377425 -0.093750
|
||||
v 0.592856 0.207492 -0.093750
|
||||
v 0.117105 0.192529 -0.093750
|
||||
v 0.196346 0.022597 -0.093750
|
||||
vt 0.078109 0.859375
|
||||
vt 0.078109 0.796953
|
||||
vt 0.109219 0.859375
|
||||
vt 0.109219 0.796953
|
||||
vt 0.031250 0.859375
|
||||
vt 0.031250 0.797156
|
||||
vt 0.062094 0.859375
|
||||
vt 0.062094 0.797156
|
||||
vt 0.062500 0.921891
|
||||
vt 0.062500 0.890859
|
||||
vt 0.109125 0.921891
|
||||
vt 0.109125 0.890859
|
||||
vt 0.000000 0.921891
|
||||
vt 0.000000 0.890797
|
||||
vt 0.046703 0.921891
|
||||
vt 0.046703 0.890797
|
||||
vt 0.062500 1.000000
|
||||
vt 0.062500 0.937563
|
||||
vt 0.109234 1.000000
|
||||
vt 0.109234 0.937563
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.937563
|
||||
vt 0.046750 1.000000
|
||||
vt 0.046750 0.937563
|
||||
vt 0.031250 0.593750
|
||||
vt 0.031250 0.562688
|
||||
vt 0.171844 0.593750
|
||||
vt 0.171844 0.562688
|
||||
vt 0.031250 0.640625
|
||||
vt 0.031250 0.609516
|
||||
vt 0.171828 0.640625
|
||||
vt 0.171828 0.609516
|
||||
vt 0.093703 0.546938
|
||||
vt 0.093703 0.406437
|
||||
vt 0.124891 0.546938
|
||||
vt 0.124891 0.406437
|
||||
vt 0.140625 0.546891
|
||||
vt 0.140625 0.406406
|
||||
vt 0.171875 0.546891
|
||||
vt 0.171875 0.406406
|
||||
vt 0.031234 0.687547
|
||||
vt 0.031234 0.656359
|
||||
vt 0.062406 0.687547
|
||||
vt 0.062406 0.656359
|
||||
vt 0.078062 0.687547
|
||||
vt 0.078062 0.656406
|
||||
vt 0.109203 0.687547
|
||||
vt 0.109203 0.656406
|
||||
vt 0.125000 0.796875
|
||||
vt 0.125000 0.734563
|
||||
vt 0.203000 0.796875
|
||||
vt 0.203000 0.734563
|
||||
vt 0.125000 0.875000
|
||||
vt 0.125000 0.812688
|
||||
vt 0.203000 0.875000
|
||||
vt 0.203000 0.812688
|
||||
vt 0.031250 0.781250
|
||||
vt 0.031250 0.703188
|
||||
vt 0.062438 0.781250
|
||||
vt 0.062438 0.703188
|
||||
vt 0.078125 0.781250
|
||||
vt 0.078125 0.703188
|
||||
vt 0.109312 0.781250
|
||||
vt 0.109312 0.703188
|
||||
vt 0.171875 0.718750
|
||||
vt 0.171875 0.656375
|
||||
vt 0.203063 0.718750
|
||||
vt 0.203063 0.656375
|
||||
vt 0.125000 0.718750
|
||||
vt 0.125000 0.656375
|
||||
vt 0.156062 0.718750
|
||||
vt 0.156062 0.656375
|
||||
vt 0.484188 0.765672
|
||||
vt 0.374953 0.765672
|
||||
vt 0.484188 0.718891
|
||||
vt 0.374953 0.718891
|
||||
vt 0.374953 0.781359
|
||||
vt 0.484250 0.781359
|
||||
vt 0.374953 0.828156
|
||||
vt 0.484250 0.828156
|
||||
vt 0.624984 0.781359
|
||||
vt 0.624984 0.828156
|
||||
vt 0.593734 0.781359
|
||||
vt 0.593734 0.828156
|
||||
vt 0.593750 0.765625
|
||||
vt 0.593750 0.718859
|
||||
vt 0.624937 0.765625
|
||||
vt 0.624937 0.718859
|
||||
vt 0.546844 0.828156
|
||||
vt 0.546844 0.718859
|
||||
vt 0.578094 0.828156
|
||||
vt 0.578094 0.718859
|
||||
vt 0.531203 0.718859
|
||||
vt 0.531203 0.828156
|
||||
vt 0.499953 0.718859
|
||||
vt 0.499953 0.828156
|
||||
vt 0.250000 0.703125
|
||||
vt 0.250000 0.671953
|
||||
vt 0.281188 0.703125
|
||||
vt 0.281188 0.671953
|
||||
vt 0.250000 0.750016
|
||||
vt 0.250000 0.718781
|
||||
vt 0.281188 0.750016
|
||||
vt 0.281188 0.718781
|
||||
vt 0.847640 0.179734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.179734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.179734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.179734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.117218
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.117218
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.117218
|
||||
vt 0.847640 0.117218
|
||||
vt 0.734344 0.828156
|
||||
vt 0.734344 0.750094
|
||||
vt 0.812406 0.828156
|
||||
vt 0.812406 0.750094
|
||||
vt 0.640625 0.828156
|
||||
vt 0.640625 0.750141
|
||||
vt 0.718641 0.828156
|
||||
vt 0.718641 0.750141
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.367218
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.367218
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.367218
|
||||
vt 0.847640 0.367218
|
||||
vt 0.250000 0.515625
|
||||
vt 0.250000 0.437594
|
||||
vt 0.312391 0.515625
|
||||
vt 0.312391 0.437594
|
||||
vt 0.187469 0.515688
|
||||
vt 0.187469 0.437797
|
||||
vt 0.249719 0.515688
|
||||
vt 0.249719 0.437797
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.847640 0.429734
|
||||
vt 0.847640 0.054781
|
||||
vt 0.125000 0.347672
|
||||
vt 0.125000 0.035187
|
||||
vt 0.140625 0.347672
|
||||
vt 0.140625 0.035187
|
||||
vt 0.847640 0.367218
|
||||
vt 0.847640 0.367218
|
||||
vt 0.218734 0.828125
|
||||
vt 0.218734 0.812516
|
||||
vt 0.234359 0.828125
|
||||
vt 0.234359 0.812516
|
||||
vt 0.218734 0.781266
|
||||
vt 0.218734 0.765641
|
||||
vt 0.234359 0.781266
|
||||
vt 0.234359 0.765641
|
||||
vt 0.218734 0.765641
|
||||
vt 0.234359 0.781266
|
||||
vt 0.234359 0.765641
|
||||
vt 0.218734 0.765625
|
||||
vt 0.218734 0.750063
|
||||
vt 0.234297 0.765625
|
||||
vt 0.234297 0.750063
|
||||
vt 0.218734 0.828125
|
||||
vt 0.218734 0.812516
|
||||
vt 0.234359 0.828125
|
||||
vt 0.234359 0.812516
|
||||
vt 0.187484 0.640625
|
||||
vt 0.187484 0.593750
|
||||
vt 0.249953 0.640625
|
||||
vt 0.249953 0.593750
|
||||
vt 0.187484 0.578141
|
||||
vt 0.187484 0.531281
|
||||
vt 0.249953 0.578141
|
||||
vt 0.249953 0.531281
|
||||
vt 0.265594 0.625047
|
||||
vt 0.265594 0.562594
|
||||
vt 0.312375 0.625047
|
||||
vt 0.312375 0.562594
|
||||
vt 0.328109 0.625000
|
||||
vt 0.328109 0.562531
|
||||
vt 0.374984 0.625000
|
||||
vt 0.374984 0.562531
|
||||
vt 0.031250 0.546891
|
||||
vt 0.031250 0.500016
|
||||
vt 0.078109 0.546891
|
||||
vt 0.078109 0.500016
|
||||
vt 0.031188 0.484422
|
||||
vt 0.031188 0.437562
|
||||
vt 0.078047 0.484422
|
||||
vt 0.078047 0.437562
|
||||
vt 0.124969 1.000000
|
||||
vt 0.124969 0.953281
|
||||
vt 0.234125 1.000000
|
||||
vt 0.234125 0.953281
|
||||
vt 0.125000 0.937500
|
||||
vt 0.125000 0.890813
|
||||
vt 0.234062 0.937500
|
||||
vt 0.234062 0.890813
|
||||
vt 0.250000 1.000000
|
||||
vt 0.250000 0.890813
|
||||
vt 0.296688 1.000000
|
||||
vt 0.296688 0.890813
|
||||
vt 0.250000 0.875000
|
||||
vt 0.250000 0.765750
|
||||
vt 0.296750 0.875000
|
||||
vt 0.296750 0.765750
|
||||
vt 0.375000 1.000000
|
||||
vt 0.375000 0.953188
|
||||
vt 0.421750 1.000000
|
||||
vt 0.421750 0.953188
|
||||
vt 0.312484 1.000000
|
||||
vt 0.312484 0.953188
|
||||
vt 0.359234 1.000000
|
||||
vt 0.359234 0.953188
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.984375
|
||||
vt 0.015625 1.000000
|
||||
vt 0.015625 0.984375
|
||||
vn 0.0000 -0.0000 1.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn -0.4226 0.9063 0.0000
|
||||
vn 0.4226 -0.9063 -0.0000
|
||||
vn -0.9063 -0.4226 0.0000
|
||||
vn 0.9063 0.4226 0.0000
|
||||
vn 0.3420 0.9397 0.0000
|
||||
vn -0.3420 -0.9397 0.0000
|
||||
vn -0.9397 0.3420 0.0000
|
||||
vn 0.9397 -0.3420 0.0000
|
||||
g cube_cube_0
|
||||
usemtl 0
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 2/2/1 4/4/1 3/3/1
|
||||
f 5/5/2 6/6/2 7/7/2
|
||||
f 6/6/2 8/8/2 7/7/2
|
||||
f 5/9/3 7/10/3 3/11/3
|
||||
f 7/10/3 1/12/3 3/11/3
|
||||
f 8/13/4 6/14/4 2/15/4
|
||||
f 6/14/4 4/16/4 2/15/4
|
||||
f 7/17/5 8/18/5 1/19/5
|
||||
f 8/18/5 2/20/5 1/19/5
|
||||
f 3/21/6 4/22/6 5/23/6
|
||||
f 4/22/6 6/24/6 5/23/6
|
||||
f 9/25/1 10/26/1 11/27/1
|
||||
f 10/26/1 12/28/1 11/27/1
|
||||
f 13/29/2 14/30/2 15/31/2
|
||||
f 14/30/2 16/32/2 15/31/2
|
||||
f 13/33/3 15/34/3 11/35/3
|
||||
f 15/34/3 9/36/3 11/35/3
|
||||
f 16/37/4 14/38/4 10/39/4
|
||||
f 14/38/4 12/40/4 10/39/4
|
||||
f 15/41/5 16/42/5 9/43/5
|
||||
f 16/42/5 10/44/5 9/43/5
|
||||
f 11/45/6 12/46/6 13/47/6
|
||||
f 12/46/6 14/48/6 13/47/6
|
||||
f 17/49/1 18/50/1 19/51/1
|
||||
f 18/50/1 20/52/1 19/51/1
|
||||
f 21/53/2 22/54/2 23/55/2
|
||||
f 22/54/2 24/56/2 23/55/2
|
||||
f 21/57/3 23/58/3 19/59/3
|
||||
f 23/58/3 17/60/3 19/59/3
|
||||
f 24/61/4 22/62/4 18/63/4
|
||||
f 22/62/4 20/64/4 18/63/4
|
||||
f 23/65/5 24/66/5 17/67/5
|
||||
f 24/66/5 18/68/5 17/67/5
|
||||
f 19/69/6 20/70/6 21/71/6
|
||||
f 20/70/6 22/72/6 21/71/6
|
||||
f 25/73/1 26/74/1 27/75/1
|
||||
f 26/74/1 28/76/1 27/75/1
|
||||
f 29/77/2 30/78/2 31/79/2
|
||||
f 30/78/2 32/80/2 31/79/2
|
||||
f 29/81/7 31/82/7 27/83/7
|
||||
f 31/82/7 25/84/7 27/83/7
|
||||
f 32/85/8 30/86/8 26/87/8
|
||||
f 30/86/8 28/88/8 26/87/8
|
||||
f 31/89/9 32/90/9 25/91/9
|
||||
f 32/90/9 26/92/9 25/91/9
|
||||
f 27/93/10 28/94/10 29/95/10
|
||||
f 28/94/10 30/96/10 29/95/10
|
||||
f 33/97/1 34/98/1 35/99/1
|
||||
f 34/98/1 36/100/1 35/99/1
|
||||
f 37/101/2 38/102/2 39/103/2
|
||||
f 38/102/2 40/104/2 39/103/2
|
||||
f 37/105/3 39/106/3 35/107/3
|
||||
f 39/106/3 33/108/3 35/107/3
|
||||
f 40/109/4 38/110/4 34/111/4
|
||||
f 38/110/4 36/112/4 34/111/4
|
||||
f 39/113/5 40/114/5 33/115/5
|
||||
f 40/114/5 34/116/5 33/115/5
|
||||
f 35/117/6 36/112/6 37/118/6
|
||||
f 36/112/6 38/110/6 37/118/6
|
||||
f 41/119/1 42/120/1 43/121/1
|
||||
f 42/120/1 44/122/1 43/121/1
|
||||
f 45/123/2 46/124/2 47/125/2
|
||||
f 46/124/2 48/126/2 47/125/2
|
||||
f 45/127/3 47/128/3 43/129/3
|
||||
f 47/128/3 41/130/3 43/129/3
|
||||
f 48/131/4 46/132/4 42/133/4
|
||||
f 46/132/4 44/134/4 42/133/4
|
||||
f 47/135/5 48/136/5 41/137/5
|
||||
f 48/136/5 42/138/5 41/137/5
|
||||
f 43/139/6 44/134/6 45/140/6
|
||||
f 44/134/6 46/132/6 45/140/6
|
||||
f 49/141/1 50/142/1 51/143/1
|
||||
f 50/142/1 52/144/1 51/143/1
|
||||
f 53/145/2 54/146/2 55/147/2
|
||||
f 54/146/2 56/148/2 55/147/2
|
||||
f 53/149/3 55/150/3 51/151/3
|
||||
f 55/150/3 49/152/3 51/151/3
|
||||
f 56/153/4 54/154/4 50/155/4
|
||||
f 54/154/4 52/156/4 50/155/4
|
||||
f 55/157/5 56/158/5 49/159/5
|
||||
f 56/158/5 50/160/5 49/159/5
|
||||
f 51/161/6 52/156/6 53/162/6
|
||||
f 52/156/6 54/154/6 53/162/6
|
||||
f 57/163/1 58/164/1 59/165/1
|
||||
f 58/164/1 60/166/1 59/165/1
|
||||
f 61/167/2 62/168/2 63/169/2
|
||||
f 62/168/2 64/170/2 63/169/2
|
||||
f 61/167/3 63/171/3 59/172/3
|
||||
f 63/171/3 57/173/3 59/172/3
|
||||
f 64/174/4 62/175/4 58/176/4
|
||||
f 62/175/4 60/177/4 58/176/4
|
||||
f 59/178/6 60/179/6 61/180/6
|
||||
f 60/179/6 62/181/6 61/180/6
|
||||
f 65/182/1 66/183/1 67/184/1
|
||||
f 66/183/1 68/185/1 67/184/1
|
||||
f 69/186/2 70/187/2 71/188/2
|
||||
f 70/187/2 72/189/2 71/188/2
|
||||
f 69/190/3 71/191/3 67/192/3
|
||||
f 71/191/3 65/193/3 67/192/3
|
||||
f 72/194/4 70/195/4 66/196/4
|
||||
f 70/195/4 68/197/4 66/196/4
|
||||
f 71/198/5 72/199/5 65/200/5
|
||||
f 72/199/5 66/201/5 65/200/5
|
||||
f 67/202/6 68/203/6 69/204/6
|
||||
f 68/203/6 70/205/6 69/204/6
|
||||
f 73/206/1 74/207/1 75/208/1
|
||||
f 74/207/1 76/209/1 75/208/1
|
||||
f 77/210/2 78/211/2 79/212/2
|
||||
f 78/211/2 80/213/2 79/212/2
|
||||
f 77/214/3 79/215/3 75/216/3
|
||||
f 79/215/3 73/217/3 75/216/3
|
||||
f 80/218/4 78/219/4 74/220/4
|
||||
f 78/219/4 76/221/4 74/220/4
|
||||
f 79/222/5 80/223/5 73/224/5
|
||||
f 80/223/5 74/225/5 73/224/5
|
||||
f 75/226/6 76/227/6 77/228/6
|
||||
f 76/227/6 78/229/6 77/228/6
|
||||
g cube_cube
|
||||
usemtl (null)
|
||||
f 63/230/5 64/231/5 57/232/5
|
||||
f 64/231/5 58/233/5 57/232/5
|
|
@ -0,0 +1,54 @@
|
|||
# Blender v2.82 (sub 7) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib rocket.mtl
|
||||
o Cube
|
||||
v 1.000000 1.000000 -1.000000
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 4.633310
|
||||
v -1.000000 1.000000 4.633310
|
||||
v 1.000000 1.000000 4.633310
|
||||
v 1.000000 -1.000000 4.633310
|
||||
vt 0.625000 0.500000
|
||||
vt 0.875000 0.500000
|
||||
vt 0.875000 0.750000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.375000 0.000000
|
||||
vt 0.625000 0.000000
|
||||
vt 0.625000 0.250000
|
||||
vt 0.375000 0.250000
|
||||
vt 0.125000 0.500000
|
||||
vt 0.375000 0.500000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.375000 0.750000
|
||||
vt 0.625000 0.750000
|
||||
vt 0.625000 1.000000
|
||||
vt 0.375000 1.000000
|
||||
vt 0.125000 0.750000
|
||||
vt 0.875000 0.750000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
usemtl Material
|
||||
s off
|
||||
f 1/1/1 5/2/1 7/3/1 3/4/1
|
||||
f 7/5/2 8/6/2 9/7/2 10/8/2
|
||||
f 8/6/2 7/5/2 5/9/2 6/10/2
|
||||
f 6/11/3 2/12/3 4/13/3 8/14/3
|
||||
f 2/12/4 1/1/4 3/4/4 4/13/4
|
||||
f 6/10/5 5/9/5 1/1/5 2/12/5
|
||||
f 12/15/6 11/16/6 10/17/6 9/18/6
|
||||
f 8/14/3 4/13/3 12/15/3 9/19/3
|
||||
f 3/4/1 7/3/1 10/20/1 11/16/1
|
||||
f 4/13/4 3/4/4 11/16/4 12/15/4
|
|
@ -0,0 +1,420 @@
|
|||
# Blender v2.82 (sub 7) OBJ File: 'bazooka.blend'
|
||||
# www.blender.org
|
||||
mtllib bazooka.mtl
|
||||
o cube
|
||||
v -0.498160 0.167536 0.187500
|
||||
v -0.366091 -0.115685 0.187500
|
||||
v 0.068283 0.431672 0.187500
|
||||
v 0.200351 0.148451 0.187500
|
||||
v 0.068283 0.431672 -0.125000
|
||||
v 0.200351 0.148451 -0.125000
|
||||
v -0.498160 0.167536 -0.125000
|
||||
v -0.366091 -0.115685 -0.125000
|
||||
v -1.007958 -0.070187 0.187500
|
||||
v -0.875890 -0.353408 0.187500
|
||||
v -0.951314 -0.043773 0.187500
|
||||
v -0.819245 -0.326994 0.187500
|
||||
v -0.951314 -0.043773 -0.125000
|
||||
v -0.819245 -0.326994 -0.125000
|
||||
v -1.007958 -0.070187 -0.125000
|
||||
v -0.875890 -0.353408 -0.125000
|
||||
v 0.465359 0.616832 0.187500
|
||||
v 0.597427 0.333611 0.187500
|
||||
v 0.691936 0.722487 0.187500
|
||||
v 0.824004 0.439265 0.187500
|
||||
v 0.691936 0.722487 -0.125000
|
||||
v 0.824004 0.439265 -0.125000
|
||||
v 0.465359 0.616832 -0.125000
|
||||
v 0.597427 0.333611 -0.125000
|
||||
v -0.938107 -0.072095 0.156250
|
||||
v -0.832452 -0.298672 0.156250
|
||||
v 0.477999 0.588246 0.156250
|
||||
v 0.583654 0.361669 0.156250
|
||||
v 0.477999 0.588246 -0.093750
|
||||
v 0.583654 0.361669 -0.093750
|
||||
v -0.938107 -0.072095 -0.093750
|
||||
v -0.832452 -0.298672 -0.093750
|
||||
v -0.309447 -0.089272 0.093750
|
||||
v -0.256620 -0.202560 0.093750
|
||||
v 0.143707 0.122038 0.093750
|
||||
v 0.196534 0.008749 0.093750
|
||||
v 0.143707 0.122038 -0.031250
|
||||
v 0.196534 0.008749 -0.031250
|
||||
v -0.309447 -0.089272 -0.031250
|
||||
v -0.256620 -0.202560 -0.031250
|
||||
v 0.130500 0.150360 0.062500
|
||||
v 0.156913 0.093715 0.062500
|
||||
v 0.527009 0.335255 0.062500
|
||||
v 0.553423 0.278611 0.062500
|
||||
v 0.527009 0.335255 -0.000000
|
||||
v 0.553423 0.278611 -0.000000
|
||||
v 0.130500 0.150360 -0.000000
|
||||
v 0.156913 0.093715 -0.000000
|
||||
v 0.300433 0.229601 0.093750
|
||||
v 0.353260 0.116312 0.093750
|
||||
v 0.470365 0.308842 0.093750
|
||||
v 0.523193 0.195553 0.093750
|
||||
v 0.470365 0.308842 -0.031250
|
||||
v 0.523193 0.195553 -0.031250
|
||||
v 0.300433 0.229601 -0.031250
|
||||
v 0.353260 0.116312 -0.031250
|
||||
v 0.381582 0.129519 0.062500
|
||||
v 0.513650 -0.153702 0.062500
|
||||
v 0.494870 0.182346 0.062500
|
||||
v 0.626939 -0.100875 0.062500
|
||||
v 0.494870 0.182346 -0.000000
|
||||
v 0.626939 -0.100875 -0.000000
|
||||
v 0.381582 0.129519 -0.000000
|
||||
v 0.513650 -0.153702 -0.000000
|
||||
v -0.013313 -0.036324 0.062500
|
||||
v 0.000318 -0.348527 0.062500
|
||||
v 0.111568 -0.030872 0.062500
|
||||
v 0.125199 -0.343074 0.062500
|
||||
v 0.111568 -0.030872 -0.000000
|
||||
v 0.125199 -0.343074 -0.000000
|
||||
v -0.013313 -0.036324 -0.000000
|
||||
v 0.000318 -0.348527 0.000000
|
||||
v 0.196534 0.008749 0.031250
|
||||
v 0.249361 -0.104539 0.031250
|
||||
v 0.026601 -0.070492 0.031250
|
||||
v 0.079429 -0.183780 0.031250
|
||||
vt 0.671859 0.734375
|
||||
vt 0.671859 0.656563
|
||||
vt 0.827906 0.734375
|
||||
vt 0.827906 0.656563
|
||||
vt 0.671844 0.828156
|
||||
vt 0.671844 0.750234
|
||||
vt 0.827875 0.828156
|
||||
vt 0.827875 0.750234
|
||||
vt 0.749953 0.640656
|
||||
vt 0.749953 0.484578
|
||||
vt 0.827969 0.640656
|
||||
vt 0.827969 0.484578
|
||||
vt 0.656187 0.640656
|
||||
vt 0.656187 0.484578
|
||||
vt 0.734062 0.640656
|
||||
vt 0.734062 0.484578
|
||||
vt 0.578125 0.828156
|
||||
vt 0.578125 0.750281
|
||||
vt 0.655984 0.828156
|
||||
vt 0.655984 0.750281
|
||||
vt 0.578125 0.734375
|
||||
vt 0.578125 0.656406
|
||||
vt 0.655937 0.734375
|
||||
vt 0.655937 0.656406
|
||||
vt 0.937453 0.421875
|
||||
vt 0.937453 0.344109
|
||||
vt 0.953062 0.421875
|
||||
vt 0.953062 0.344109
|
||||
vt 0.968734 0.421875
|
||||
vt 0.968734 0.344016
|
||||
vt 0.984359 0.421875
|
||||
vt 0.984359 0.344016
|
||||
vt 0.843734 0.421875
|
||||
vt 0.843734 0.406266
|
||||
vt 0.921703 0.421875
|
||||
vt 0.921703 0.406266
|
||||
vt 0.843734 0.359375
|
||||
vt 0.843734 0.343766
|
||||
vt 0.921609 0.359375
|
||||
vt 0.921609 0.343766
|
||||
vt 0.843703 0.421922
|
||||
vt 0.843703 0.344109
|
||||
vt 0.921625 0.421922
|
||||
vt 0.921625 0.344109
|
||||
vt 0.843734 0.421875
|
||||
vt 0.843734 0.343906
|
||||
vt 0.921562 0.421875
|
||||
vt 0.921562 0.343906
|
||||
vt 0.015594 0.921922
|
||||
vt 0.015594 0.844109
|
||||
vt 0.077875 0.921922
|
||||
vt 0.077875 0.844109
|
||||
vt 0.156203 0.921922
|
||||
vt 0.156203 0.844000
|
||||
vt 0.218484 0.921922
|
||||
vt 0.218484 0.844000
|
||||
vt 0.078078 0.984406
|
||||
vt 0.078078 0.922125
|
||||
vt 0.156000 0.984406
|
||||
vt 0.156000 0.922125
|
||||
vt 0.078078 0.843797
|
||||
vt 0.078078 0.781516
|
||||
vt 0.155891 0.843797
|
||||
vt 0.155891 0.781516
|
||||
vt 0.078125 0.921875
|
||||
vt 0.078125 0.844016
|
||||
vt 0.155984 0.921875
|
||||
vt 0.155984 0.844016
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.922078
|
||||
vt 0.077813 1.000000
|
||||
vt 0.077813 0.922078
|
||||
vt 0.593734 0.906266
|
||||
vt 0.593734 0.844016
|
||||
vt 0.984203 0.906266
|
||||
vt 0.984203 0.844016
|
||||
vt 0.593672 0.984453
|
||||
vt 0.593672 0.922188
|
||||
vt 0.984047 0.984453
|
||||
vt 0.984047 0.922188
|
||||
vt 0.843703 0.828141
|
||||
vt 0.843703 0.437719
|
||||
vt 0.906031 0.828141
|
||||
vt 0.906031 0.437719
|
||||
vt 0.921828 0.828141
|
||||
vt 0.921828 0.437719
|
||||
vt 0.984156 0.828141
|
||||
vt 0.984156 0.437719
|
||||
vt 0.296875 0.921891
|
||||
vt 0.296875 0.859594
|
||||
vt 0.312344 0.921891
|
||||
vt 0.312344 0.859594
|
||||
vt 0.093734 0.906266
|
||||
vt 0.093734 0.859531
|
||||
vt 0.140375 0.906266
|
||||
vt 0.140375 0.859531
|
||||
vt 0.703062 0.468766
|
||||
vt 0.703062 0.437828
|
||||
vt 0.827875 0.468766
|
||||
vt 0.827875 0.437828
|
||||
vt 0.671859 0.640656
|
||||
vt 0.671859 0.562781
|
||||
vt 0.718484 0.640656
|
||||
vt 0.718484 0.562781
|
||||
vt 0.609375 0.703125
|
||||
vt 0.609375 0.390734
|
||||
vt 0.640562 0.703125
|
||||
vt 0.640562 0.390734
|
||||
vt 0.671859 0.609406
|
||||
vt 0.671859 0.531438
|
||||
vt 0.718531 0.609406
|
||||
vt 0.718531 0.531438
|
||||
vt 0.671859 0.593766
|
||||
vt 0.671859 0.531500
|
||||
vt 0.687297 0.593766
|
||||
vt 0.687297 0.531500
|
||||
vt 0.671859 0.625000
|
||||
vt 0.671859 0.562688
|
||||
vt 0.687234 0.625000
|
||||
vt 0.687234 0.562688
|
||||
vt 0.656234 0.640656
|
||||
vt 0.656234 0.484672
|
||||
vt 0.734156 0.640656
|
||||
vt 0.734156 0.484672
|
||||
vt 0.656234 0.640656
|
||||
vt 0.656234 0.484625
|
||||
vt 0.734156 0.640656
|
||||
vt 0.734156 0.484625
|
||||
vt 0.609375 0.703125
|
||||
vt 0.609375 0.390734
|
||||
vt 0.640562 0.703125
|
||||
vt 0.640562 0.390734
|
||||
vt 0.656234 0.640656
|
||||
vt 0.734156 0.640656
|
||||
vt 0.734156 0.484625
|
||||
vt 0.296875 0.921891
|
||||
vt 0.296875 0.859594
|
||||
vt 0.312344 0.921891
|
||||
vt 0.312344 0.859594
|
||||
vt 0.656234 0.640656
|
||||
vt 0.656234 0.484672
|
||||
vt 0.734062 0.640656
|
||||
vt 0.734062 0.484672
|
||||
vt 0.687453 0.625000
|
||||
vt 0.687453 0.562734
|
||||
vt 0.734125 0.625000
|
||||
vt 0.734125 0.562734
|
||||
vt 0.656219 0.640656
|
||||
vt 0.656219 0.547141
|
||||
vt 0.718484 0.640656
|
||||
vt 0.718484 0.547141
|
||||
vt 0.609375 0.703125
|
||||
vt 0.609375 0.390734
|
||||
vt 0.640562 0.703125
|
||||
vt 0.640562 0.390734
|
||||
vt 0.671859 0.625000
|
||||
vt 0.671859 0.531438
|
||||
vt 0.718531 0.625000
|
||||
vt 0.718531 0.531438
|
||||
vt 0.656219 0.593766
|
||||
vt 0.656219 0.531500
|
||||
vt 0.671641 0.593766
|
||||
vt 0.671641 0.531500
|
||||
vt 0.671859 0.640656
|
||||
vt 0.671859 0.578328
|
||||
vt 0.687234 0.640656
|
||||
vt 0.687234 0.578328
|
||||
vt 0.578125 0.640656
|
||||
vt 0.578125 0.562781
|
||||
vt 0.609203 0.640656
|
||||
vt 0.609203 0.562781
|
||||
vt 0.609344 0.562547
|
||||
vt 0.609344 0.484719
|
||||
vt 0.640281 0.562547
|
||||
vt 0.640281 0.484719
|
||||
vt 0.609375 0.703125
|
||||
vt 0.609375 0.390734
|
||||
vt 0.640562 0.703125
|
||||
vt 0.640562 0.390734
|
||||
vt 0.609344 0.640656
|
||||
vt 0.609344 0.594016
|
||||
vt 0.640328 0.640656
|
||||
vt 0.640328 0.594016
|
||||
vt 0.609344 0.640656
|
||||
vt 0.609344 0.578391
|
||||
vt 0.624766 0.640656
|
||||
vt 0.624766 0.578391
|
||||
vt 0.593734 0.640656
|
||||
vt 0.593734 0.562734
|
||||
vt 0.609344 0.640656
|
||||
vt 0.609344 0.562734
|
||||
vt 0.578016 0.640703
|
||||
vt 0.578016 0.562969
|
||||
vt 0.608906 0.640703
|
||||
vt 0.608906 0.562969
|
||||
vt 0.609344 0.562547
|
||||
vt 0.609344 0.484625
|
||||
vt 0.640375 0.562547
|
||||
vt 0.640375 0.484625
|
||||
vt 0.609375 0.703125
|
||||
vt 0.609375 0.390734
|
||||
vt 0.640562 0.703125
|
||||
vt 0.640562 0.390734
|
||||
vt 0.609344 0.640656
|
||||
vt 0.609344 0.562688
|
||||
vt 0.640375 0.640656
|
||||
vt 0.640375 0.562688
|
||||
vt 0.609375 0.640656
|
||||
vt 0.609375 0.562781
|
||||
vt 0.624969 0.640656
|
||||
vt 0.624969 0.562781
|
||||
vt 0.593734 0.640656
|
||||
vt 0.593734 0.562734
|
||||
vt 0.609344 0.640656
|
||||
vt 0.656187 0.453156
|
||||
vt 0.656187 0.422266
|
||||
vt 0.702734 0.453156
|
||||
vt 0.702734 0.422266
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn -0.0000 -0.0000 -1.0000
|
||||
vn -0.4226 0.9063 0.0000
|
||||
vn 0.4226 -0.9063 0.0000
|
||||
vn -0.9063 -0.4226 0.0000
|
||||
vn 0.9063 0.4226 -0.0000
|
||||
vn -0.0436 0.9990 -0.0000
|
||||
vn 0.0436 -0.9990 0.0000
|
||||
vn -0.9990 -0.0436 0.0000
|
||||
vn 0.9990 0.0436 0.0000
|
||||
usemtl Material
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 2/2/1 4/4/1 3/3/1
|
||||
f 5/5/2 6/6/2 7/7/2
|
||||
f 6/6/2 8/8/2 7/7/2
|
||||
f 5/9/3 7/10/3 3/11/3
|
||||
f 7/10/3 1/12/3 3/11/3
|
||||
f 8/13/4 6/14/4 2/15/4
|
||||
f 6/14/4 4/16/4 2/15/4
|
||||
f 7/17/5 8/18/5 1/19/5
|
||||
f 8/18/5 2/20/5 1/19/5
|
||||
f 3/21/6 4/22/6 5/23/6
|
||||
f 4/22/6 6/24/6 5/23/6
|
||||
f 9/25/1 10/26/1 11/27/1
|
||||
f 10/26/1 12/28/1 11/27/1
|
||||
f 13/29/2 14/30/2 15/31/2
|
||||
f 14/30/2 16/32/2 15/31/2
|
||||
f 13/33/3 15/34/3 11/35/3
|
||||
f 15/34/3 9/36/3 11/35/3
|
||||
f 16/37/4 14/38/4 10/39/4
|
||||
f 14/38/4 12/40/4 10/39/4
|
||||
f 15/41/5 16/42/5 9/43/5
|
||||
f 16/42/5 10/44/5 9/43/5
|
||||
f 11/45/6 12/46/6 13/47/6
|
||||
f 12/46/6 14/48/6 13/47/6
|
||||
f 17/49/1 18/50/1 19/51/1
|
||||
f 18/50/1 20/52/1 19/51/1
|
||||
f 21/53/2 22/54/2 23/55/2
|
||||
f 22/54/2 24/56/2 23/55/2
|
||||
f 21/57/3 23/58/3 19/59/3
|
||||
f 23/58/3 17/60/3 19/59/3
|
||||
f 24/61/4 22/62/4 18/63/4
|
||||
f 22/62/4 20/64/4 18/63/4
|
||||
f 23/65/5 24/66/5 17/67/5
|
||||
f 24/66/5 18/68/5 17/67/5
|
||||
f 19/69/6 20/70/6 21/71/6
|
||||
f 20/70/6 22/72/6 21/71/6
|
||||
f 25/73/1 26/74/1 27/75/1
|
||||
f 26/74/1 28/76/1 27/75/1
|
||||
f 29/77/2 30/78/2 31/79/2
|
||||
f 30/78/2 32/80/2 31/79/2
|
||||
f 29/81/3 31/82/3 27/83/3
|
||||
f 31/82/3 25/84/3 27/83/3
|
||||
f 32/85/4 30/86/4 26/87/4
|
||||
f 30/86/4 28/88/4 26/87/4
|
||||
f 31/89/5 32/90/5 25/91/5
|
||||
f 32/90/5 26/92/5 25/91/5
|
||||
f 27/93/6 28/94/6 29/95/6
|
||||
f 28/94/6 30/96/6 29/95/6
|
||||
f 33/97/1 34/98/1 35/99/1
|
||||
f 34/98/1 36/100/1 35/99/1
|
||||
f 37/101/2 38/102/2 39/103/2
|
||||
f 38/102/2 40/104/2 39/103/2
|
||||
f 37/105/3 39/106/3 35/107/3
|
||||
f 39/106/3 33/108/3 35/107/3
|
||||
f 40/109/4 38/110/4 34/111/4
|
||||
f 38/110/4 36/112/4 34/111/4
|
||||
f 39/113/5 40/114/5 33/115/5
|
||||
f 40/114/5 34/116/5 33/115/5
|
||||
f 35/117/6 36/118/6 37/119/6
|
||||
f 36/118/6 38/120/6 37/119/6
|
||||
f 41/121/1 42/122/1 43/123/1
|
||||
f 42/122/1 44/124/1 43/123/1
|
||||
f 45/125/2 46/126/2 47/127/2
|
||||
f 46/126/2 48/128/2 47/127/2
|
||||
f 45/129/3 47/130/3 43/131/3
|
||||
f 47/130/3 41/132/3 43/131/3
|
||||
f 48/133/4 46/126/4 42/134/4
|
||||
f 46/126/4 44/135/4 42/134/4
|
||||
f 47/136/5 48/137/5 41/138/5
|
||||
f 48/137/5 42/139/5 41/138/5
|
||||
f 43/140/6 44/141/6 45/142/6
|
||||
f 44/141/6 46/143/6 45/142/6
|
||||
f 49/144/1 50/145/1 51/146/1
|
||||
f 50/145/1 52/147/1 51/146/1
|
||||
f 53/148/2 54/149/2 55/150/2
|
||||
f 54/149/2 56/151/2 55/150/2
|
||||
f 53/152/3 55/153/3 51/154/3
|
||||
f 55/153/3 49/155/3 51/154/3
|
||||
f 56/156/4 54/157/4 50/158/4
|
||||
f 54/157/4 52/159/4 50/158/4
|
||||
f 55/160/5 56/161/5 49/162/5
|
||||
f 56/161/5 50/163/5 49/162/5
|
||||
f 51/164/6 52/165/6 53/166/6
|
||||
f 52/165/6 54/167/6 53/166/6
|
||||
f 57/168/1 58/169/1 59/170/1
|
||||
f 58/169/1 60/171/1 59/170/1
|
||||
f 61/172/2 62/173/2 63/174/2
|
||||
f 62/173/2 64/175/2 63/174/2
|
||||
f 61/176/3 63/177/3 59/178/3
|
||||
f 63/177/3 57/179/3 59/178/3
|
||||
f 64/180/4 62/181/4 58/182/4
|
||||
f 62/181/4 60/183/4 58/182/4
|
||||
f 63/184/5 64/185/5 57/186/5
|
||||
f 64/185/5 58/187/5 57/186/5
|
||||
f 59/188/6 60/189/6 61/190/6
|
||||
f 60/189/6 62/191/6 61/190/6
|
||||
f 65/192/1 66/193/1 67/194/1
|
||||
f 66/193/1 68/195/1 67/194/1
|
||||
f 69/196/2 70/197/2 71/198/2
|
||||
f 70/197/2 72/199/2 71/198/2
|
||||
f 69/200/7 71/201/7 67/202/7
|
||||
f 71/201/7 65/203/7 67/202/7
|
||||
f 72/204/8 70/205/8 66/206/8
|
||||
f 70/205/8 68/207/8 66/206/8
|
||||
f 71/208/9 72/209/9 65/210/9
|
||||
f 72/209/9 66/211/9 65/210/9
|
||||
f 67/212/10 68/213/10 69/214/10
|
||||
f 68/213/10 70/205/10 69/214/10
|
||||
f 73/215/2 74/216/2 75/217/2
|
||||
f 74/216/2 76/218/2 75/217/2
|
|
@ -0,0 +1,116 @@
|
|||
local function death_delay() end
|
||||
local function remove_weapons() end
|
||||
|
||||
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
-- se non è nello storage degli achievement, lo aggiungo
|
||||
if not achievements_lib.is_player_in_storage(p_name, "block_league") then
|
||||
achievements_lib.add_player_to_storage(p_name, "block_league")
|
||||
end
|
||||
|
||||
-- se non è nello storage della mod, lo aggiungo
|
||||
if not block_league.is_player_in_storage(p_name) then
|
||||
block_league.add_player_to_storage(p_name)
|
||||
end
|
||||
|
||||
-- genero l'HUD per gli achievement
|
||||
block_league.HUD_achievements_create(p_name)
|
||||
|
||||
-- resetto la velocità se non c'è hub_manager
|
||||
if not minetest.get_modpath("hub_manager") then
|
||||
player:set_physics_override({
|
||||
speed = 1,
|
||||
jump = 1,
|
||||
gravity = 1,
|
||||
})
|
||||
end
|
||||
|
||||
-- non è possibile modificare l'inventario da offline. Se sono crashati o hanno chiuso il gioco in partita,
|
||||
-- questo è l'unico modo per togliere loro l'arma
|
||||
remove_weapons(player:get_inventory())
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
|
||||
local p_name = player:get_player_name()
|
||||
|
||||
if not arena_lib.is_player_in_arena(p_name, "block_league") then return end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
arena.players[p_name].energy = 100
|
||||
block_league.energy_update(arena, p_name)
|
||||
player:get_meta():set_int("blockleague_death_delay", 1)
|
||||
arena.players[p_name].weapons_reload = {}
|
||||
|
||||
minetest.after(6, function()
|
||||
if not player or not player:get_meta() then return end
|
||||
player:get_meta():set_int("blockleague_death_delay", 0)
|
||||
player:get_meta():set_int("reloading", 0)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
|
||||
if not arena_lib.is_player_in_arena(player:get_player_name(), "block_league") then return end
|
||||
|
||||
local pos = player:get_pos()
|
||||
|
||||
death_delay(player, pos)
|
||||
local arena = arena_lib.get_arena_by_player(player:get_player_name())
|
||||
player:set_physics_override({
|
||||
speed = arena.high_speed,
|
||||
jump = 1.5
|
||||
})
|
||||
|
||||
local pl_name = player:get_player_name()
|
||||
panel_lib.get_panel(pl_name, "bullets_hud"):remove()
|
||||
|
||||
block_league.weapons_hud_create(pl_name)
|
||||
panel_lib.get_panel(pl_name, "bullets_hud"):show()
|
||||
|
||||
block_league.immunity(player)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
---------------FUNZIONI LOCALI----------------
|
||||
----------------------------------------------
|
||||
|
||||
function death_delay(player, pos)
|
||||
if player and player:get_meta() then
|
||||
local delay = player:get_meta():get_int("blockleague_death_delay")
|
||||
if delay == 1 and arena_lib.is_player_in_arena(player:get_player_name(), "block_league") then
|
||||
player:set_pos(pos)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
minetest.after(0.1, function() death_delay(player, pos) end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function remove_weapons(inv)
|
||||
|
||||
inv:remove_item("main", ItemStack("block_league:smg"))
|
||||
inv:remove_item("main", ItemStack("block_league:sword"))
|
||||
inv:remove_item("main", ItemStack("block_league:pixelgun"))
|
||||
inv:remove_item("main", ItemStack("block_league:rocket_launcher"))
|
||||
inv:remove_item("main", ItemStack("block_league:match_over"))
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
minetest.register_privilege("block_league_admin", {
|
||||
|
||||
description = S("It allows to use the /block_leagueadmin command")
|
||||
|
||||
})
|
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 473 B |
After Width: | Height: | Size: 278 B |
After Width: | Height: | Size: 399 B |
After Width: | Height: | Size: 126 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 367 B |
After Width: | Height: | Size: 184 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 173 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 82 B |
After Width: | Height: | Size: 211 B |
After Width: | Height: | Size: 655 B |
After Width: | Height: | Size: 187 B |
After Width: | Height: | Size: 110 B |
After Width: | Height: | Size: 586 B |
After Width: | Height: | Size: 121 B |
After Width: | Height: | Size: 637 B |
After Width: | Height: | Size: 208 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 118 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 149 B |
|
@ -0,0 +1,21 @@
|
|||
-- debug se devo mostrare una posizione
|
||||
function block_league.mostra_posizione(pos, tempo)
|
||||
minetest.add_particlespawner({
|
||||
amount = 80,
|
||||
time = .1,
|
||||
minpos = {x=pos.x,y=pos.y,z=pos.z},
|
||||
maxpos = {x=pos.x,y=pos.y,z=pos.z},
|
||||
minvel = {x=0, y=0, z=0},
|
||||
maxvel = {x=0, y=0, z=0},
|
||||
minacc = {x=0, y=-0, z=0},
|
||||
maxacc = {x=0, y=-0, z=0},
|
||||
minexptime = tempo,
|
||||
maxexptime = tempo,
|
||||
minsize = 2,
|
||||
maxsize = 2,
|
||||
collisiondetection = false,
|
||||
vertical = false,
|
||||
texture = "block_league_rocket_particle.png",
|
||||
})
|
||||
|
||||
end
|