First upload: rescued from minetest forums, cos duane-r account repos were deleted
* taken from https://forum.minetest.net/viewtopic.php?f=9&t=15410
504
LICENSE
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
(This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.)
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{description}
|
||||||
|
Copyright (C) {year} {fullname}
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||||
|
USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random
|
||||||
|
Hacker.
|
||||||
|
|
||||||
|
{signature of Ty Coon}, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
23
README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# squaresville
|
||||||
|
|
||||||
|
Squaresville is a simplified world dominated by abandoned cities. In the same vein as Multi dimensions (though not compatible with it), it occupies a separate "dimension" which actually occurs high in the air (8000 meters, by default). In fact, there are two dimensions -- one with a pristine city, the other with a ruined one (at 10,000). You can teleport to them with the teleport command or create a "key to the city" or "broken key" to take you there and back.
|
||||||
|
|
||||||
|
The terrain is based on two-dimensional perlin noise for speed and simplicity. There are no caves, but you can use fun_caves when Squaresville is in singlenode mode. City areas are nearly flat -- only the wilderness has any shape at all. All the default biomes are reimplimented in lua, along with most of the stock decorations.
|
||||||
|
|
||||||
|
Houses will appear in the suburbs around the city. You can create new houses and save the schematic using the "/saveplot" command.
|
||||||
|
|
||||||
|
This is a work in progress.
|
||||||
|
|
||||||
|
![screenshot](https://raw.githubusercontent.com/duane-r/squaresville/screenshots/screenshot01.jpg)
|
||||||
|
|
||||||
|
![screenshot](https://raw.githubusercontent.com/duane-r/squaresville/screenshots/screenshot02.jpg)
|
||||||
|
|
||||||
|
![screenshot](https://raw.githubusercontent.com/duane-r/squaresville/screenshots/screenshot04.jpg)
|
||||||
|
|
||||||
|
The source is available on github.
|
||||||
|
|
||||||
|
Code: LGPL2, textures: CC-BY-SA and CC0
|
||||||
|
|
||||||
|
Mod dependencies: default, flowers, stairs
|
||||||
|
|
||||||
|
Download: https://github.com/duane-r/squaresville/archive/master.zip
|
1113
buildings.lua
Normal file
236
caves.lua
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
-- Squaresville terrain.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
local stone = {}
|
||||||
|
stone[minetest.get_content_id('default:stone')] = true
|
||||||
|
stone[minetest.get_content_id('default:sandstone')] = true
|
||||||
|
stone[minetest.get_content_id('default:desert_stone')] = true
|
||||||
|
local cave_fill = {}
|
||||||
|
cave_fill[minetest.get_content_id('air')] = true
|
||||||
|
cave_fill[minetest.get_content_id('default:water_source')] = true
|
||||||
|
local math_random = math.random
|
||||||
|
|
||||||
|
|
||||||
|
--minetest.register_ore({
|
||||||
|
-- ore_type = "scatter",
|
||||||
|
-- ore = "default:meselamp",
|
||||||
|
-- wherein = {"default:stone", "default:sandstone"},
|
||||||
|
-- clust_scarcity = DEBUG and (2 * 2 * 2) or (6 * 6 * 6),
|
||||||
|
-- clust_num_ores = 1,
|
||||||
|
-- clust_size = 1,
|
||||||
|
-- y_min = squaresville.baseline + squaresville.extent_bottom,
|
||||||
|
-- y_max = squaresville.baseline - 200,
|
||||||
|
--})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "blob",
|
||||||
|
ore = "default:desert_stone",
|
||||||
|
wherein = {"default:stone", "default:sandstone"},
|
||||||
|
clust_scarcity = 14 * 14 * 14,
|
||||||
|
clust_size = 15,
|
||||||
|
y_min = squaresville.baseline + squaresville.extent_bottom,
|
||||||
|
y_max = squaresville.baseline - 200,
|
||||||
|
noise_threshold = 0.0,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.2,
|
||||||
|
scale = 0.2,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 8401,
|
||||||
|
octaves = 1,
|
||||||
|
persist = 0.0
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "blob",
|
||||||
|
ore = "default:sandstone",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 14 * 14 * 14,
|
||||||
|
clust_size = 15,
|
||||||
|
y_min = squaresville.baseline + squaresville.extent_bottom,
|
||||||
|
y_max = squaresville.baseline - 200,
|
||||||
|
noise_threshold = 0.0,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.2,
|
||||||
|
scale = 0.2,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = -8771,
|
||||||
|
octaves = 1,
|
||||||
|
persist = 0.0
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "blob",
|
||||||
|
ore = "default:desert_stone",
|
||||||
|
wherein = {"default:stone", "default:sandstone"},
|
||||||
|
clust_scarcity = 14 * 14 * 14,
|
||||||
|
clust_size = 15,
|
||||||
|
y_min = squaresville.baseline_ruin + squaresville.extent_bottom_ruin,
|
||||||
|
y_max = squaresville.baseline_ruin - 200,
|
||||||
|
noise_threshold = 0.0,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.5,
|
||||||
|
scale = 0.3,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = 8401,
|
||||||
|
octaves = 1,
|
||||||
|
persist = 0.0
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "blob",
|
||||||
|
ore = "default:sandstone",
|
||||||
|
wherein = {"default:stone", "default:desert_stone"},
|
||||||
|
clust_scarcity = 14 * 14 * 14,
|
||||||
|
clust_size = 15,
|
||||||
|
y_min = squaresville.baseline_ruin + squaresville.extent_bottom_ruin,
|
||||||
|
y_max = squaresville.baseline_ruin - 200,
|
||||||
|
noise_threshold = 0.0,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.5,
|
||||||
|
scale = 0.3,
|
||||||
|
spread = {x = 15, y = 15, z = 15},
|
||||||
|
seed = -8771,
|
||||||
|
octaves = 1,
|
||||||
|
persist = 0.0
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local max_height = squaresville.max_height
|
||||||
|
|
||||||
|
local cave_1_map = {}
|
||||||
|
local cave_1_noise, river_noise
|
||||||
|
local cave_2_map = {}
|
||||||
|
local cave_2_noise, river_noise
|
||||||
|
local node = squaresville.node
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.caves = function(minp, maxp, data, p2data, area, remove_this_node, baseline, heightmap)
|
||||||
|
if not (minp and maxp and data and p2data and area and node and type(data) == 'table' and type(p2data) == 'table') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local max_height = -squaresville.max_height
|
||||||
|
for i = 1, #heightmap do
|
||||||
|
if heightmap[i] and heightmap[i] > max_height then
|
||||||
|
max_height = heightmap[i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if minp.y > math.max(max_height, baseline) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not squaresville.csize then
|
||||||
|
squaresville.csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||||
|
|
||||||
|
if not squaresville.csize then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (cave_1_noise and cave_2_noise) then
|
||||||
|
cave_1_noise = minetest.get_perlin_map(squaresville.cave_2_p, {x=squaresville.csize.x, y=squaresville.csize.z})
|
||||||
|
cave_2_noise = minetest.get_perlin_map(squaresville.cave_2_p, {x=squaresville.csize.y + 2, y=squaresville.csize.z})
|
||||||
|
|
||||||
|
if not (cave_1_noise and cave_2_noise) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
cave_1_map = cave_1_noise:get2dMap_flat({x=minp.x, y=minp.z}, cave_1_map)
|
||||||
|
cave_2_map = cave_2_noise:get2dMap_flat({x=minp.y - 1, y=math.floor(minp.z / squaresville.csize.z)}, cave_2_map)
|
||||||
|
|
||||||
|
local index1 = 0
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
local open_z_1 = math_random(6)
|
||||||
|
local open_z_2 = math_random(8, 12)
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
index1 = index1 + 1
|
||||||
|
local ivm = area:index(x, minp.y - 1, z)
|
||||||
|
local index2 = 0
|
||||||
|
local height = heightmap[index1] or baseline
|
||||||
|
local cave_top = height - 17
|
||||||
|
local water_or_lava = -1
|
||||||
|
|
||||||
|
if maxp.y < baseline then
|
||||||
|
water_or_lava = math.floor(math.abs(baseline - maxp.y) / 25)
|
||||||
|
end
|
||||||
|
|
||||||
|
--local cave_top_1 = cave_top
|
||||||
|
--local off = 0
|
||||||
|
--if (not squaresville.in_town) and x % 20 < 10 and z % 20 < open_z_2 and z % 20 > open_z_1 then
|
||||||
|
-- cave_top_1 = cave_top + 19
|
||||||
|
-- off = z % 20
|
||||||
|
-- if index1 + off > #cave_1_map then
|
||||||
|
-- off = 0
|
||||||
|
-- end
|
||||||
|
--end
|
||||||
|
|
||||||
|
for y = minp.y - 1, maxp.y + 1 do
|
||||||
|
index2 = index2 + 1
|
||||||
|
if y < cave_top or ((not squaresville.in_town) and y <= height + 1 and y >= cave_top and y < 10) then
|
||||||
|
if cave_1_map[index1] * cave_2_map[index2] > 0.2 - math.min(0, cave_top - y) / 10 then
|
||||||
|
if maxp.y > baseline or cave_2_map[index2] > 0 then
|
||||||
|
data[ivm] = node['air']
|
||||||
|
else
|
||||||
|
if y % 1000 > water_or_lava then
|
||||||
|
data[ivm] = node['default:water_source']
|
||||||
|
else
|
||||||
|
data[ivm] = node['default:lava_source']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif y < cave_top and cave_2_map[index2] > 0.65 then
|
||||||
|
data[ivm] = node['default:sandstone']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ivm = ivm + area.ystride
|
||||||
|
end
|
||||||
|
|
||||||
|
ivm = area:index(x, minp.y - 1, z)
|
||||||
|
local glow, timer = nil, math_random(200)
|
||||||
|
for y = minp.y - 1, maxp.y + 1 do
|
||||||
|
if y > maxp.y then
|
||||||
|
glow = nil
|
||||||
|
timer = 9999
|
||||||
|
elseif timer <= 0 then
|
||||||
|
if glow then
|
||||||
|
glow = nil
|
||||||
|
timer = math_random(200)
|
||||||
|
else
|
||||||
|
glow = true
|
||||||
|
timer = math_random(20)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
timer = timer - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if y < cave_top then
|
||||||
|
local sr = math_random(6)
|
||||||
|
if stone[data[ivm]] and cave_fill[data[ivm + area.ystride]] and sr == 1 then
|
||||||
|
data[ivm] = node['default:dirt']
|
||||||
|
if data[ivm + area.ystride] == node['air'] then
|
||||||
|
sr = math_random(5)
|
||||||
|
if sr == 1 then
|
||||||
|
data[ivm + area.ystride] = node['flowers:mushroom_brown']
|
||||||
|
elseif sr == 2 then
|
||||||
|
data[ivm + area.ystride] = node['flowers:mushroom_red']
|
||||||
|
end
|
||||||
|
elseif math_random(4) == 1 then
|
||||||
|
data[ivm + area.ystride] = node['squaresville:wet_fungus']
|
||||||
|
end
|
||||||
|
elseif stone[data[ivm]] and (cave_fill[data[ivm - 1]] or cave_fill[data[ivm + 1]] or cave_fill[data[ivm - area.zstride]] or cave_fill[data[ivm + area.zstride]] or ((cave_fill[data[ivm - area.ystride]] or cave_fill[data[ivm + area.ystride]]) and sr == 2)) and glow then
|
||||||
|
data[ivm] = node['squaresville:crystal_glow']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ivm = ivm + area.ystride
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
182
chat.lua
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
local node = squaresville.node
|
||||||
|
|
||||||
|
minetest.register_chatcommand("fixlight", {
|
||||||
|
params = "<radius>",
|
||||||
|
description = "attempt to fix light bugs",
|
||||||
|
privs = {},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not (player_name and type(player_name) == 'string' and player_name ~= '') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local privs = minetest.check_player_privs(player_name, {server=true})
|
||||||
|
if not privs then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
print('Fun Caves: '..player_name..' used the fixlight command')
|
||||||
|
local player = minetest.get_player_by_name(player_name)
|
||||||
|
if not player then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = player:getpos()
|
||||||
|
if not pos then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pos = vector.round(pos)
|
||||||
|
|
||||||
|
local radius = tonumber(param) or 50
|
||||||
|
radius = math.floor(radius)
|
||||||
|
local minp = vector.subtract(pos, radius)
|
||||||
|
local maxp = vector.add(pos, radius)
|
||||||
|
|
||||||
|
local vm = minetest.get_voxel_manip(minp, maxp)
|
||||||
|
if not vm then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--vm:set_lighting({day = 0, night = 0}, minp, maxp)
|
||||||
|
vm:calc_lighting(minp, maxp)
|
||||||
|
vm:update_liquids()
|
||||||
|
vm:write_to_map()
|
||||||
|
vm:update_map()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_chatcommand("flatten", {
|
||||||
|
params = "<radius>",
|
||||||
|
description = "flatten terrain",
|
||||||
|
privs = {},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not (player_name and type(player_name) == 'string' and player_name ~= '') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local privs = minetest.check_player_privs(player_name, {server=true})
|
||||||
|
if not privs then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
print('Fun Caves: '..player_name..' used the flatten command')
|
||||||
|
local player = minetest.get_player_by_name(player_name)
|
||||||
|
if not player then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = player:getpos()
|
||||||
|
if not pos then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pos = vector.round(pos)
|
||||||
|
|
||||||
|
local radius = tonumber(param) or 50
|
||||||
|
radius = math.floor(radius)
|
||||||
|
local minp = vector.subtract(pos, radius)
|
||||||
|
minp.y = minp.y - math.ceil(radius / 2)
|
||||||
|
local maxp = vector.add(pos, radius)
|
||||||
|
maxp.y = maxp.y + math.ceil(radius / 2)
|
||||||
|
|
||||||
|
local air = minetest.get_content_id('air')
|
||||||
|
local stone = minetest.get_content_id('default:stone')
|
||||||
|
local water = minetest.get_content_id('default:water_source')
|
||||||
|
|
||||||
|
local waters = {}
|
||||||
|
waters[minetest.get_content_id('default:water_source')] = true
|
||||||
|
waters[minetest.get_content_id('default:river_water_source')] = true
|
||||||
|
local stone_types = {'default:stone', 'default:desert_stone', 'default:sandstone', 'default:dirt', 'fun_caves:dirt', 'default:dirt_with_snow', 'default:dirt_with_grass', 'default:dirt_with_dry_grass', 'default:sand', 'default:desert_sand'}
|
||||||
|
local stones = {}
|
||||||
|
for i = 1, #stone_types do
|
||||||
|
stones[minetest.get_content_id(stone_types[i])] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local vm = minetest.get_voxel_manip(minp, maxp)
|
||||||
|
if not vm then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local emin, emax = vm:read_from_map(minp, maxp)
|
||||||
|
local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
local heightmap = {}
|
||||||
|
local height_avg = 0
|
||||||
|
local count = 0
|
||||||
|
local index = 1
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
local ivm = area:index(x, maxp.y, z)
|
||||||
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
if stones[data[ivm]] then
|
||||||
|
if y >= maxp.y then
|
||||||
|
minetest.chat_send_player(player_name, 'Terrain altitude exceeds the given radius.')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
heightmap[index] = y
|
||||||
|
height_avg = height_avg + heightmap[index]
|
||||||
|
count = count + 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
ivm = ivm - area.ystride
|
||||||
|
end
|
||||||
|
|
||||||
|
if not heightmap[index] then
|
||||||
|
minetest.chat_send_player(player_name, 'Terrain altitude exceeds the given radius.')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
index = index + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
height_avg = math.floor(height_avg / count + 0.5)
|
||||||
|
|
||||||
|
index = 1
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
local dz = z - minp.z
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
local dx = x - minp.x
|
||||||
|
local r = math.max(math.abs(radius - dx), math.abs(radius - dz)) / radius
|
||||||
|
local new_y = heightmap[index]
|
||||||
|
if r < 1 then
|
||||||
|
new_y = math.floor(heightmap[index] * r ^ 2 + height_avg * (1 - r ^ 2) + 0.5)
|
||||||
|
end
|
||||||
|
local delta = new_y - heightmap[index]
|
||||||
|
if delta > 0 then
|
||||||
|
local ivm = area:index(x, maxp.y, z)
|
||||||
|
for y = maxp.y - delta, new_y, -1 do
|
||||||
|
data[ivm] = data[ivm - area.ystride * delta]
|
||||||
|
ivm = ivm - area.ystride
|
||||||
|
end
|
||||||
|
elseif delta < 0 then
|
||||||
|
local ivm = area:index(x, new_y - 2, z)
|
||||||
|
for y = new_y - 2, maxp.y + delta do
|
||||||
|
data[ivm] = data[ivm - area.ystride * delta]
|
||||||
|
ivm = ivm + area.ystride
|
||||||
|
end
|
||||||
|
for y = maxp.y + delta + 1, maxp.y do
|
||||||
|
data[ivm] = air
|
||||||
|
ivm = ivm + area.ystride
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local ivm = area:index(x, minp.y, z)
|
||||||
|
for y = minp.y, maxp.y do
|
||||||
|
if y <= 1 and data[ivm] == air then
|
||||||
|
data[ivm] = water
|
||||||
|
elseif y > 1 and waters[data[ivm]] then
|
||||||
|
data[ivm] = air
|
||||||
|
end
|
||||||
|
ivm = ivm + area.ystride
|
||||||
|
end
|
||||||
|
|
||||||
|
index = index + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vm:set_data(data)
|
||||||
|
vm:calc_lighting(minp, maxp)
|
||||||
|
vm:update_liquids()
|
||||||
|
vm:write_to_map()
|
||||||
|
vm:update_map()
|
||||||
|
end,
|
||||||
|
})
|
543
deco.lua
Normal file
@ -0,0 +1,543 @@
|
|||||||
|
-- Squaresville deco.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
local dangerous = squaresville.dangerous_terrain
|
||||||
|
squaresville.decorations = {}
|
||||||
|
squaresville.decorations_schem = {}
|
||||||
|
|
||||||
|
local math_abs = math.abs
|
||||||
|
local math_floor = math.floor
|
||||||
|
|
||||||
|
|
||||||
|
for i = 2, 4 do
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_snow", "default:dirt_with_grass"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.012,
|
||||||
|
scale = 0.022,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = (84 - 7 * i),
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
|
||||||
|
y_min = 2,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = squaresville.path .. "/schematics/pine_tree"..i..".mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_grass"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.012,
|
||||||
|
scale = 0.022,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = (139 - 7 * i),
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = {"deciduous_forest", 'desertstone_grassland'},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = squaresville.path .. "/schematics/apple_tree"..i..".mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:dirt_with_grass"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 0.022,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = 119,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = {"deciduous_forest"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = squaresville.path .. "/schematics/cherry_tree.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_decoration({
|
||||||
|
deco_type = "schematic",
|
||||||
|
place_on = {"default:polluted_dirt"},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0.036,
|
||||||
|
scale = 0.022,
|
||||||
|
spread = {x = 250, y = 250, z = 250},
|
||||||
|
seed = 666,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = {"toxic_forest"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
schematic = squaresville.path .. "/schematics/decaying_tree.mts",
|
||||||
|
flags = "place_center_x, place_center_z",
|
||||||
|
rotation = "random",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
for _, odeco in pairs(minetest.registered_decorations) do
|
||||||
|
local deco = table.copy(odeco)
|
||||||
|
deco.place_on = table.copy(odeco.place_on)
|
||||||
|
deco.flags = {}
|
||||||
|
|
||||||
|
if odeco.biomes then
|
||||||
|
deco.biomes = {}
|
||||||
|
for _, b in pairs(odeco.biomes) do
|
||||||
|
deco.biomes[b] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if odeco.flags then
|
||||||
|
for f in odeco.flags:gmatch('[%w_]+') do
|
||||||
|
deco.flags[f] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local nod = minetest.registered_nodes[deco.decoration]
|
||||||
|
if nod and nod.groups and nod.groups.flower then
|
||||||
|
deco.flower = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if odeco.schematic then
|
||||||
|
deco.name = odeco.schematic:match('([%w_]+)%.mts') or odeco.schematic
|
||||||
|
elseif odeco.decoration and type(odeco.decoration) == 'string' then
|
||||||
|
deco.name = odeco.decoration:match('.*:([%w_]+)') or odeco.decoration
|
||||||
|
end
|
||||||
|
|
||||||
|
if deco.name == 'apple_tree' or deco.name == 'pine_tree' then
|
||||||
|
deco.noise_params.offset = 0.012
|
||||||
|
if deco.name == 'apple_tree' then
|
||||||
|
deco.biomes['desertstone_grassland'] = true
|
||||||
|
end
|
||||||
|
elseif deco.name == 'junglegrass' then
|
||||||
|
deco.biomes['desertstone_grassland'] = true
|
||||||
|
deco.place_on[#deco.place_on+1] = 'default:dirt_with_grass'
|
||||||
|
elseif deco.name == 'jungle_tree' then
|
||||||
|
deco.schematic = squaresville.path..'/schematics/jungle_tree_with_orchids.mts'
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.decorations[#squaresville.decorations+1] = deco
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.biomes = {}
|
||||||
|
local biomes = squaresville.biomes
|
||||||
|
local biome_names = {}
|
||||||
|
do
|
||||||
|
local biome_mod = {
|
||||||
|
tundra = { node_top = 'default:snowblock', depth_top = 1 },
|
||||||
|
rainforest = { civ = 'desertstone_grassland' },
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, obiome in pairs(minetest.registered_biomes) do
|
||||||
|
local biome = table.copy(obiome)
|
||||||
|
biomes[biome.name] = biome
|
||||||
|
biome_names[#biome_names+1] = biome.name
|
||||||
|
|
||||||
|
-- Make changes to biome values from biome_mod.
|
||||||
|
for n, bi in pairs(biome_mod) do
|
||||||
|
for i, rbi in pairs(biomes) do
|
||||||
|
if rbi.name == n then
|
||||||
|
for j, prop in pairs(bi) do
|
||||||
|
biomes[i][j] = prop
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
biomes["desertstone_grassland"] = {
|
||||||
|
name = "desertstone_grassland",
|
||||||
|
--node_dust = "",
|
||||||
|
node_top = "default:dirt_with_grass",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 1,
|
||||||
|
node_stone = "default:desert_stone",
|
||||||
|
node_riverbed = "default:sand",
|
||||||
|
depth_riverbed = 2,
|
||||||
|
--node_water_top = "",
|
||||||
|
--depth_water_top = ,
|
||||||
|
--node_water = "",
|
||||||
|
--node_river_water = "",
|
||||||
|
y_min = squaresville.max_height,
|
||||||
|
y_max = squaresville.max_height,
|
||||||
|
heat_point = 86,
|
||||||
|
humidity_point = 50,
|
||||||
|
}
|
||||||
|
|
||||||
|
if dangerous then
|
||||||
|
biomes["toxic_forest"] = {
|
||||||
|
name = "toxic_forest",
|
||||||
|
node_top = "squaresville:polluted_dirt",
|
||||||
|
danger = 3,
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "squaresville:polluted_dirt",
|
||||||
|
depth_filler = 1,
|
||||||
|
node_riverbed = "squaresville:polluted_dirt",
|
||||||
|
depth_riverbed = 1,
|
||||||
|
node_water = "squaresville:water_poison_source",
|
||||||
|
node_river_water = "squaresville:water_poison_source",
|
||||||
|
special_trees = {"decaying_tree"},
|
||||||
|
y_min = 1,
|
||||||
|
y_max = squaresville.max_height,
|
||||||
|
heat_point = 20,
|
||||||
|
humidity_point = 50,
|
||||||
|
}
|
||||||
|
|
||||||
|
biomes["toxic_forest_ocean"] = {
|
||||||
|
name = "toxic_forest_ocean",
|
||||||
|
node_top = "squaresville:polluted_dirt",
|
||||||
|
danger = 3,
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "squaresville:polluted_dirt",
|
||||||
|
depth_filler = 1,
|
||||||
|
node_riverbed = "squaresville:polluted_dirt",
|
||||||
|
depth_riverbed = 1,
|
||||||
|
node_water = "squaresville:water_poison_source",
|
||||||
|
node_river_water = "squaresville:water_poison_source",
|
||||||
|
y_min = -10,
|
||||||
|
y_max = 0,
|
||||||
|
heat_point = 20,
|
||||||
|
humidity_point = 50,
|
||||||
|
}
|
||||||
|
|
||||||
|
biomes["draconic"] = {
|
||||||
|
name = "draconic",
|
||||||
|
--node_dust = "",
|
||||||
|
node_top = "squaresville:cracked_stone",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "squaresville:granite",
|
||||||
|
depth_filler = 1,
|
||||||
|
node_stone = "squaresville:granite",
|
||||||
|
--node_water_top = "",
|
||||||
|
--depth_water_top = ,
|
||||||
|
--node_water = "",
|
||||||
|
node_river_water = "squaresville:basalt",
|
||||||
|
node_riverbed = "squaresville:basalt",
|
||||||
|
depth_riverbed = 2,
|
||||||
|
danger = 3,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = squaresville.max_height,
|
||||||
|
heat_point = 80,
|
||||||
|
humidity_point = 20,
|
||||||
|
}
|
||||||
|
|
||||||
|
biomes["draconic_ocean"] = {
|
||||||
|
name = "draconic_ocean",
|
||||||
|
--node_dust = "",
|
||||||
|
node_top = "squaresville:granite",
|
||||||
|
depth_top = 1,
|
||||||
|
danger = 3,
|
||||||
|
node_filler = "squaresville:granite",
|
||||||
|
depth_filler = 3,
|
||||||
|
node_stone = "squaresville:granite",
|
||||||
|
y_min = -20,
|
||||||
|
y_max = 0,
|
||||||
|
heat_point = 80,
|
||||||
|
humidity_point = 20,
|
||||||
|
}
|
||||||
|
|
||||||
|
biomes["bizarre"] = {
|
||||||
|
name = "bizarre",
|
||||||
|
--node_dust = "",
|
||||||
|
node_top = "squaresville:dirt_with_odd_grass",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "default:dirt",
|
||||||
|
depth_filler = 1,
|
||||||
|
node_stone = "squaresville:basalt",
|
||||||
|
--node_water_top = "",
|
||||||
|
--depth_water_top = ,
|
||||||
|
--node_water = "",
|
||||||
|
--node_river_water = "squaresville:basalt",
|
||||||
|
--node_riverbed = "squaresville:basalt",
|
||||||
|
--depth_riverbed = 2,
|
||||||
|
special_trees = {'fur_tree'},
|
||||||
|
danger = 3,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = squaresville.max_height,
|
||||||
|
heat_point = 60,
|
||||||
|
humidity_point = 70,
|
||||||
|
}
|
||||||
|
|
||||||
|
biomes["bizarre_ocean"] = {
|
||||||
|
name = "bizarre_ocean",
|
||||||
|
--node_dust = "",
|
||||||
|
node_top = "default:sand",
|
||||||
|
depth_top = 1,
|
||||||
|
danger = 3,
|
||||||
|
node_filler = "default:sand",
|
||||||
|
depth_filler = 3,
|
||||||
|
node_stone = "squaresville:basalt",
|
||||||
|
y_min = -20,
|
||||||
|
y_max = 0,
|
||||||
|
heat_point = 60,
|
||||||
|
humidity_point = 70,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function register_flower(name, desc, biomes, seed)
|
||||||
|
local groups = {}
|
||||||
|
groups.snappy = 3
|
||||||
|
groups.flammable = 2
|
||||||
|
groups.flower = 1
|
||||||
|
groups.flora = 1
|
||||||
|
groups.attached_node = 1
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:" .. name, {
|
||||||
|
description = desc,
|
||||||
|
drawtype = "plantlike",
|
||||||
|
waving = 1,
|
||||||
|
tiles = {"squaresville_" .. name .. ".png"},
|
||||||
|
inventory_image = "squaresville_" .. name .. ".png",
|
||||||
|
wield_image = "squaresville_" .. name .. ".png",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
stack_max = 99,
|
||||||
|
groups = groups,
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local bi = {}
|
||||||
|
if biomes then
|
||||||
|
bi = {}
|
||||||
|
for _, b in pairs(biomes) do
|
||||||
|
bi[b] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local def = {
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = {"default:dirt_with_grass", 'default:dirt_with_rainforest_litter'},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = -0.015,
|
||||||
|
scale = 0.025,
|
||||||
|
spread = {x = 200, y = 200, z = 200},
|
||||||
|
seed = seed,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.6
|
||||||
|
},
|
||||||
|
biomes = bi,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
decoration = "squaresville:"..name,
|
||||||
|
name = name,
|
||||||
|
flower = true,
|
||||||
|
}
|
||||||
|
squaresville.decorations[#squaresville.decorations+1] = def
|
||||||
|
|
||||||
|
if bi['rainforest'] then
|
||||||
|
def = table.copy(def)
|
||||||
|
def.noise_params = table.copy(def.noise_params)
|
||||||
|
def.noise_params.offset = 0.015
|
||||||
|
def.place_on = {'default:dirt_with_rainforest_litter'}
|
||||||
|
def.biomes = {['rainforest'] = true, ['rainforest_swamp'] = true}
|
||||||
|
squaresville.decorations[#squaresville.decorations+1] = def
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
register_flower("orchid", "Orchid", {"rainforest", "rainforest_swamp"}, 783)
|
||||||
|
register_flower("bird_of_paradise", "Bird of Paradise", {"rainforest", "desertstone_grassland"}, 798)
|
||||||
|
register_flower("gerbera", "Gerbera", {"savanna", "rainforest", "desertstone_grassland"}, 911)
|
||||||
|
|
||||||
|
|
||||||
|
local function register_decoration(deco, place_on, biomes, chance)
|
||||||
|
local bi = {}
|
||||||
|
if biomes then
|
||||||
|
bi = {}
|
||||||
|
for _, b in pairs(biomes) do
|
||||||
|
bi[b] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.decorations[#squaresville.decorations+1] = {
|
||||||
|
deco_type = "simple",
|
||||||
|
place_on = place_on,
|
||||||
|
sidelen = 16,
|
||||||
|
biomes = bi,
|
||||||
|
fill_ratio = chance,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
decoration = deco,
|
||||||
|
name = deco:match('[^:]+$'),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if dangerous then
|
||||||
|
--register_decoration('default:lava_source', 'squaresville:cracked_stone', {'draconic'}, 0.0005)
|
||||||
|
register_decoration('squaresville:blackened_shrub', 'squaresville:polluted_dirt', {'toxic_forest'}, 0.05)
|
||||||
|
register_decoration('flowers:mushroom_red', 'squaresville:polluted_dirt', {'toxic_forest'}, 0.05)
|
||||||
|
register_decoration('squaresville:strange_plant_1', 'squaresville:dirt_with_odd_grass', {'bizarre'}, 0.05)
|
||||||
|
register_decoration('squaresville:strange_plant_2', 'squaresville:dirt_with_odd_grass', {'bizarre'}, 0.05)
|
||||||
|
|
||||||
|
for i = 1, 4 do
|
||||||
|
register_decoration('squaresville:stone_spike_'..i, 'squaresville:cracked_stone', {'draconic'}, 0.02 / i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function place_deco(mg, ps, deco)
|
||||||
|
local data, a = mg.data, mg.area
|
||||||
|
local minp, maxp = mg.minp, mg.maxp
|
||||||
|
local heightmap, biomemap, schem = mg.heightmap, mg.biomemap, mg.schem
|
||||||
|
|
||||||
|
local csize = mg.csize
|
||||||
|
local sidelen = deco.sidelen or csize.x
|
||||||
|
local node = squaresville.node
|
||||||
|
local max_height = squaresville.max_height
|
||||||
|
|
||||||
|
local node_air = node['air']
|
||||||
|
local node_ignore = node['ignore']
|
||||||
|
local node_water = node['default:water_source']
|
||||||
|
|
||||||
|
if csize.x % sidelen ~= 0 then
|
||||||
|
sidelen = csize.x
|
||||||
|
end
|
||||||
|
|
||||||
|
local divlen = csize.x / sidelen
|
||||||
|
local area = sidelen * sidelen
|
||||||
|
|
||||||
|
for z0 = 0, divlen-1 do
|
||||||
|
for x0 = 0, divlen-1 do
|
||||||
|
local center = {
|
||||||
|
x=math_floor(minp.x + sidelen / 2 + sidelen * x0),
|
||||||
|
z=math_floor(minp.z + sidelen / 2 + sidelen * z0),
|
||||||
|
}
|
||||||
|
local min = {
|
||||||
|
x=minp.x + sidelen * x0,
|
||||||
|
z=minp.z + sidelen * z0,
|
||||||
|
}
|
||||||
|
local max = {
|
||||||
|
x=minp.x + sidelen + sidelen * x0 - 1,
|
||||||
|
z=minp.z + sidelen + sidelen * z0 - 1,
|
||||||
|
}
|
||||||
|
local nval = deco.noise_params and minetest.get_perlin(deco.noise_params):get2d({x=center.x, y=center.z}) or deco.fill_ratio
|
||||||
|
local deco_count = area * nval
|
||||||
|
if deco_count > 1 then
|
||||||
|
deco_count = math_floor(deco_count)
|
||||||
|
elseif deco_count > 0 then
|
||||||
|
if ps:next(1, 1000) <= deco_count * 1000 then
|
||||||
|
deco_count = 1
|
||||||
|
else
|
||||||
|
deco_count = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = 1, deco_count do
|
||||||
|
local x = ps:next(min.x, max.x)
|
||||||
|
local z = ps:next(min.z, max.z)
|
||||||
|
local mapindex = csize.x * (z - minp.z) + (x - minp.x) + 1
|
||||||
|
local y = -squaresville.max_height
|
||||||
|
if deco.liquid_surface then
|
||||||
|
print('Squaresville: Invalid liquid_surface parameter')
|
||||||
|
--y = find_liquid_surface()
|
||||||
|
elseif heightmap then
|
||||||
|
y = heightmap[mapindex]
|
||||||
|
else
|
||||||
|
print('Squaresville: Cannot generate heightmap')
|
||||||
|
--y = find_ground()
|
||||||
|
end
|
||||||
|
if y > -max_height and y < max_height and y >= minp.y and y <= maxp.y and y - mg.baseline >= (deco.y_min or -max_height) and y - mg.baseline <= (deco.y_max or max_height) then
|
||||||
|
local biome
|
||||||
|
if biomemap then
|
||||||
|
biome = biomemap[mapindex]
|
||||||
|
end
|
||||||
|
if not deco.biomes or deco.biomes[biome.name] then
|
||||||
|
local ivm = a:index(x, y, z)
|
||||||
|
if (not deco.place_on) or deco.place_on[data[ivm]] then
|
||||||
|
ivm = ivm + a.ystride
|
||||||
|
if deco.deco_type == 'schematic' then
|
||||||
|
local too_close
|
||||||
|
local size_s = deco.size_offset and ((deco.size_offset.x + 1) * (deco.size_offset.z + 1)) or 9
|
||||||
|
for _, s in ipairs(schem) do
|
||||||
|
local dx, dz = s.pos.x - x, s.pos.z - z
|
||||||
|
if dx * dx + dz * dz <= size_s then
|
||||||
|
too_close = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not too_close then
|
||||||
|
schem[#schem+1] = {def=deco, pos={x=x,y=y,z=z}}
|
||||||
|
end
|
||||||
|
elseif data[ivm] == node_air then
|
||||||
|
data[ivm] = node[deco.decoration]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local first_check = true
|
||||||
|
function squaresville.place_all_decorations(mg)
|
||||||
|
local ps = PcgRandom(mg.seed + 53)
|
||||||
|
|
||||||
|
for i, deco in pairs(squaresville.decorations) do
|
||||||
|
if first_check and deco.place_on then
|
||||||
|
local new_p = {}
|
||||||
|
if type(deco.place_on) ~= 'table' then
|
||||||
|
deco.place_on = {deco.place_on}
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, d in ipairs(deco.place_on) do
|
||||||
|
if type(d) == 'string' then
|
||||||
|
new_p[squaresville.node[d]] = squaresville.node[d]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
deco.place_on = new_p
|
||||||
|
end
|
||||||
|
|
||||||
|
place_deco(mg, ps, deco)
|
||||||
|
end
|
||||||
|
|
||||||
|
first_check = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- This lets rarer spawns overwrite the more common.
|
||||||
|
table.sort(squaresville.decorations, function(a, b)
|
||||||
|
if a.fill_ratio and b.fill_ratio and a.fill_ratio < b.fill_ratio then
|
||||||
|
return true
|
||||||
|
elseif a.fill_ratio and not b.fill_ratio then
|
||||||
|
return true
|
||||||
|
elseif b.fill_ratio and not a.fill_ratio then
|
||||||
|
return false
|
||||||
|
elseif not (a.fill_ratio or b.fill_ratio) and a.noise_params and b.noise_params and a.noise_params.scale + a.noise_params.offset > b.noise_params.scale + b.noise_params.offset then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end)
|
8
depends.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
default
|
||||||
|
beds
|
||||||
|
doors
|
||||||
|
flowers
|
||||||
|
stairs
|
||||||
|
xpanes?
|
||||||
|
booty?
|
||||||
|
bucket?
|
104
desolate.lua
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
-- Squaresville desolate.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
local cobble = squaresville.cobble
|
||||||
|
local desolation = squaresville.desolation
|
||||||
|
local ground_nodes = squaresville.ground_nodes
|
||||||
|
local math_random = math.random
|
||||||
|
local node = squaresville.node
|
||||||
|
|
||||||
|
local node_air = node['air']
|
||||||
|
local node_cobble = node['default:cobble']
|
||||||
|
local node_dirt = node['default:dirt']
|
||||||
|
local node_glowing_fungal_stone = node['squaresville:glowing_fungal_stone']
|
||||||
|
local node_gravel = node['default:gravel']
|
||||||
|
local node_light_panel = node['squaresville:light_panel']
|
||||||
|
local node_mossycobble = node['default:mossycobble']
|
||||||
|
local node_plate_glass = node['squaresville:plate_glass']
|
||||||
|
local node_snowblock = node['default:snowblock']
|
||||||
|
local node_stone_with_copper = node['default:stone_with_copper']
|
||||||
|
local node_stone_with_iron = node['default:stone_with_iron']
|
||||||
|
|
||||||
|
|
||||||
|
-- This table looks up the names of broken nodes.
|
||||||
|
local broken_node = setmetatable({}, {
|
||||||
|
__index = function(t, k)
|
||||||
|
if not (t and k and type(t) == 'table' and type(k) == 'number') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = minetest.get_name_from_content_id(k)
|
||||||
|
s = string.gsub(s, '.*:', 'squaresville:')..'_broken'
|
||||||
|
t[k] = k
|
||||||
|
if minetest.registered_nodes[s] then
|
||||||
|
t[k] = node[s]
|
||||||
|
end
|
||||||
|
|
||||||
|
return t[k]
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- This table looks up the properties of nodes.
|
||||||
|
local groups = setmetatable({}, {
|
||||||
|
__index = function(t, k)
|
||||||
|
if not (t and k and type(t) == 'table' and type(k) == 'string') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = minetest.get_name_from_content_id(k)
|
||||||
|
t[k] = minetest.registered_items[s].groups
|
||||||
|
return t[k]
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function squaresville.breaker(node_n, dy, humidity, desolation)
|
||||||
|
if desolation == 0 then
|
||||||
|
return node_n
|
||||||
|
end
|
||||||
|
|
||||||
|
local dry = 100 - humidity + dy
|
||||||
|
|
||||||
|
local sr = math_random(50)
|
||||||
|
local goff = 1
|
||||||
|
dry = dry + 1
|
||||||
|
|
||||||
|
if node_n == node_light_panel then
|
||||||
|
sr = 1
|
||||||
|
elseif node_n == node_plate_glass then
|
||||||
|
goff = 3
|
||||||
|
end
|
||||||
|
|
||||||
|
if not ground_nodes[node_n] and node_n ~= node_snowblock and sr <= desolation * goff then
|
||||||
|
return node_air
|
||||||
|
elseif not ground_nodes[node_n] and cobble and sr <= desolation * 3 and groups[node_n].cracky then
|
||||||
|
sr = math_random(700)
|
||||||
|
if sr == 1 then
|
||||||
|
sr = math_random(4)
|
||||||
|
if sr == 1 then
|
||||||
|
return node_stone_with_copper
|
||||||
|
else
|
||||||
|
return node_stone_with_iron
|
||||||
|
end
|
||||||
|
elseif sr <= 15 then
|
||||||
|
return node_glowing_fungal_stone
|
||||||
|
elseif sr <= 40 then
|
||||||
|
return node_gravel
|
||||||
|
elseif sr <= 140 then
|
||||||
|
return node_dirt
|
||||||
|
else
|
||||||
|
if sr <= dry * 10 then
|
||||||
|
return node_cobble
|
||||||
|
else
|
||||||
|
return node_mossycobble
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif sr <= desolation * 5 then
|
||||||
|
return broken_node[node_n]
|
||||||
|
end
|
||||||
|
|
||||||
|
return node_n
|
||||||
|
end
|
287
init.lua
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
-- Squaresville init.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
squaresville = {}
|
||||||
|
squaresville.version = '1.0'
|
||||||
|
squaresville.path = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
squaresville.world = minetest.get_worldpath()
|
||||||
|
|
||||||
|
squaresville.baseline = 8100 -- the altitude of the squaresville "dimension"
|
||||||
|
squaresville.baseline_ruin = 10000 -- how far up to the ruin "dimension"
|
||||||
|
squaresville.extent_bottom = -500 -- how far down to make the squaresville
|
||||||
|
squaresville.extent_bottom_ruin = -500 -- how far down to make the squaresville
|
||||||
|
squaresville.extent_top = 500 -- how far up to make it
|
||||||
|
squaresville.extent_top_ruin = 500 -- how far up to make it
|
||||||
|
|
||||||
|
squaresville.attenuation = 50 -- distance to blend terrain with cities: 50
|
||||||
|
squaresville.block_size = 60 -- size of a city block: 60
|
||||||
|
squaresville.city_blocks = 2 -- radius of city blocks per city: 2
|
||||||
|
squaresville.civ_base = 8
|
||||||
|
squaresville.lake_depth = 3 -- rough depth of upland water: 3
|
||||||
|
squaresville.max_height = 31000 -- maximum extent of the world
|
||||||
|
squaresville.river_base = 1
|
||||||
|
squaresville.river_cutoff = 3 -- 3
|
||||||
|
squaresville.river_scale = 15
|
||||||
|
squaresville.road_size = 7 -- width of roads (should be odd): 7
|
||||||
|
squaresville.suburb_blocks = 2 -- radius of suburb blocks per city: 2
|
||||||
|
squaresville.suburb_humidity = 60 -- amount of watering city dwellers do: 60
|
||||||
|
squaresville.terrain_scale = 50 -- typical maximum altitude of terrain: 50
|
||||||
|
squaresville.terrain_scale_2 = 50
|
||||||
|
squaresville.town_tree_thinning = 5
|
||||||
|
squaresville.tree_spacing = 5 -- typical distance between trees: 5
|
||||||
|
squaresville.water_level_base_mod = 1 -- height of water table: 1
|
||||||
|
squaresville.wild_size = 8 -- distance between cities: 8
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.noise = {}
|
||||||
|
|
||||||
|
squaresville.noise['ground_1'] = { def = {offset = squaresville.water_level_base_mod, scale = squaresville.terrain_scale, seed = 4382, spread = {x = 1033, y = 1033, z = 1033}, octaves = 5, persist = 0.6, lacunarity = 2.0} }
|
||||||
|
squaresville.noise['ground_2'] = { def = {offset = 0, scale = squaresville.terrain_scale_2, seed = 1005, spread = {x = 251, y = 251, z = 251}, octaves = 5, persist = 0.6, lacunarity = 2.0} }
|
||||||
|
squaresville.noise['heat_1'] = { def = {offset = 50, scale = 50, seed = 5349, spread = {x = 1000, y = 1000, z = 1000}, octaves = 3, persist = 0.5, lacunarity = 2} }
|
||||||
|
squaresville.noise['heat_2'] = { def = {offset = 0, scale = 1.5, seed = 13, spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1.0, lacunarity = 2} }
|
||||||
|
squaresville.noise['humidity_1'] = { def = {offset = 50, scale = 50, seed = 842, spread = {x = 1000, y = 1000, z = 1000}, octaves = 3, persist = 0.5, lacunarity = 2} }
|
||||||
|
squaresville.noise['humidity_2'] = { def = {offset = 0, scale = 1.5, seed = 90003, spread = {x = 8, y = 8, z = 8}, octaves = 2, persist = 1.0, lacunarity = 2} }
|
||||||
|
squaresville.noise['river'] = { def = {offset = 0, scale = squaresville.river_scale, seed = -6819, spread = {x = 451, y = 451, z = 451}, octaves = 3, persist = 1, lacunarity = 2.0} }
|
||||||
|
squaresville.noise['ruin'] = { def = {offset = 25, scale = 15, seed = 4877, spread = {x = 240, y = 240, z = 240}, octaves = 4, persist = 1, lacunarity = 2.0} }
|
||||||
|
--squaresville.cave_1_p = {offset = 0, scale = 1, seed = 4382, spread = {x = 41, y = 41, z = 41}, octaves = 3, persist = 1.0, lacunarity = 2.0}
|
||||||
|
--squaresville.cave_2_p = {offset = 0, scale = 1, seed = -6119, spread = {x = 41, y = 41, z = 41}, octaves = 3, persist = 1.0, lacunarity = 2.0}
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.block_plus_road_size = squaresville.road_size + squaresville.block_size
|
||||||
|
squaresville.city_limits = squaresville.block_plus_road_size * squaresville.city_blocks
|
||||||
|
squaresville.city_limits_plus_road_size = squaresville.city_limits + squaresville.road_size
|
||||||
|
squaresville.half_road_size = math.floor(squaresville.road_size / 2)
|
||||||
|
squaresville.half_terrain_scale_neg = squaresville.terrain_scale / -2
|
||||||
|
squaresville.half_terrain_scale = squaresville.terrain_scale / 2
|
||||||
|
squaresville.house_schematics = {}
|
||||||
|
squaresville.river_scale_less_one = squaresville.river_scale - 0.99
|
||||||
|
squaresville.river_zone = squaresville.river_scale + squaresville.river_cutoff - 1
|
||||||
|
squaresville.suburb_limits = squaresville.city_limits + squaresville.block_plus_road_size * squaresville.suburb_blocks
|
||||||
|
squaresville.suburb_limits_plus_road_size = squaresville.suburb_limits + squaresville.road_size
|
||||||
|
squaresville.wild_limits = squaresville.suburb_limits * squaresville.wild_size
|
||||||
|
squaresville.center_add = squaresville.max_height + squaresville.half_road_size + squaresville.wild_limits / 2
|
||||||
|
|
||||||
|
squaresville.time_buildings = 0
|
||||||
|
squaresville.time_caves = 0
|
||||||
|
squaresville.time_env_noise = 0
|
||||||
|
squaresville.time_moria = 0
|
||||||
|
squaresville.time_overhead = 0
|
||||||
|
squaresville.time_schem = 0
|
||||||
|
squaresville.time_terrain = 0
|
||||||
|
squaresville.time_trees = 0
|
||||||
|
squaresville.time_y_loop = 0
|
||||||
|
squaresville.time_zigg = 0
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.vacancies = tonumber(minetest.setting_get('squaresville_vacancies')) or 8
|
||||||
|
if squaresville.vacancies < 0 or squaresville.vacancies > 10 then
|
||||||
|
squaresville.vacancies = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.desolation = tonumber(minetest.setting_get('squaresville_desolation')) or 0
|
||||||
|
if squaresville.desolation < 0 or squaresville.desolation > 10 then
|
||||||
|
squaresville.desolation = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.light_panels = minetest.setting_getbool('squaresville_light_panels')
|
||||||
|
if squaresville.light_panels == nil then
|
||||||
|
squaresville.light_panels = true
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.single_node = minetest.setting_getbool('squaresville_single_node')
|
||||||
|
if squaresville.single_node == nil then
|
||||||
|
squaresville.single_node = false
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.single_node_ruin = minetest.setting_getbool('squaresville_single_node_ruin')
|
||||||
|
if squaresville.single_node_ruin == nil then
|
||||||
|
squaresville.single_node_ruin = false
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.no_buildings = minetest.setting_getbool('squaresville_no_buildings')
|
||||||
|
if squaresville.no_buildings == nil then
|
||||||
|
squaresville.no_buildings = false
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.dangerous_terrain = true
|
||||||
|
|
||||||
|
|
||||||
|
if squaresville.single_node_ruin then
|
||||||
|
-- Set mapgen parameters to singlenode
|
||||||
|
squaresville.baseline_ruin = 0
|
||||||
|
squaresville.extent_bottom_ruin = -31000
|
||||||
|
minetest.register_on_mapgen_init(function(mgparams)
|
||||||
|
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"})
|
||||||
|
end)
|
||||||
|
elseif squaresville.single_node then
|
||||||
|
-- Set mapgen parameters to singlenode
|
||||||
|
squaresville.baseline_ruin = 8000
|
||||||
|
squaresville.baseline = 0
|
||||||
|
squaresville.extent_bottom = -31000
|
||||||
|
minetest.register_on_mapgen_init(function(mgparams)
|
||||||
|
minetest.set_mapgen_params({mgname="singlenode", flags="nolight"})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Modify a node to add a group
|
||||||
|
function minetest.add_group(node_name, groups)
|
||||||
|
local def = minetest.registered_items[node_name]
|
||||||
|
if not (node_name and def and groups and type(groups) == 'table') then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local def_groups = def.groups or {}
|
||||||
|
for group, value in pairs(groups) do
|
||||||
|
if value ~= 0 then
|
||||||
|
def_groups[group] = value
|
||||||
|
else
|
||||||
|
def_groups[group] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.override_item(node_name, {groups = def_groups})
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath('booty') then
|
||||||
|
squaresville.clone_node = booty.clone_node
|
||||||
|
squaresville.node = booty.node
|
||||||
|
else
|
||||||
|
function squaresville.clone_node(name)
|
||||||
|
if not (name and type(name) == 'string') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.registered_nodes[name]
|
||||||
|
local node2 = table.copy(node)
|
||||||
|
return node2
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This tables looks up nodes that aren't already stored.
|
||||||
|
squaresville.node = setmetatable({}, {
|
||||||
|
__index = function(t, k)
|
||||||
|
if not (t and k and type(t) == 'table' and type(k) == 'string') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
t[k] = minetest.get_content_id(k)
|
||||||
|
return t[k]
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
local node = squaresville.node
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.surround = function(node, data, area, ivm)
|
||||||
|
if not (node and data and area and ivm and type(data) == 'table' and type(ivm) == 'number') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check to make sure that a plant root is fully surrounded.
|
||||||
|
-- This is due to the kludgy way you have to make water plants
|
||||||
|
-- in minetest, to avoid bubbles.
|
||||||
|
for x1 = -1,1,2 do
|
||||||
|
local n = data[ivm+x1]
|
||||||
|
if n == node['default:river_water_source'] or n == node['default:water_source'] or n == node['air'] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for z1 = -area.zstride,area.zstride,2*area.zstride do
|
||||||
|
local n = data[ivm+z1]
|
||||||
|
if n == node['default:river_water_source'] or n == node['default:water_source'] or n == node['air'] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- These nodes will have their on_construct method called
|
||||||
|
-- when placed by the mapgen (to start timers).
|
||||||
|
squaresville.construct_nodes = {}
|
||||||
|
function squaresville.add_construct(node_name)
|
||||||
|
squaresville.construct_nodes[node[node_name]] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function squaresville.get_desolation(baseline, danger)
|
||||||
|
local desolation = 0
|
||||||
|
if baseline == squaresville.baseline then
|
||||||
|
if squaresville.dangerous_terrain then
|
||||||
|
if squaresville.pr then
|
||||||
|
desolation = danger * 2 - squaresville.pr:next(1, 5)
|
||||||
|
else
|
||||||
|
desolation = danger * 2 - 3
|
||||||
|
end
|
||||||
|
desolation = math.max(0, desolation)
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
elseif squaresville.desolation == 0 then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return desolation
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
dofile(squaresville.path .. '/nodes.lua')
|
||||||
|
|
||||||
|
|
||||||
|
local ground_nodes = {}
|
||||||
|
ground_nodes[node['default:dirt']] = true
|
||||||
|
ground_nodes[node['default:stone']] = true
|
||||||
|
ground_nodes[node['default:dirt_with_grass']] = true
|
||||||
|
ground_nodes[node['default:dirt_with_snow']] = true
|
||||||
|
ground_nodes[node['squaresville:polluted_dirt']] = true
|
||||||
|
ground_nodes[node['squaresville:cracked_stone']] = true
|
||||||
|
ground_nodes[node['squaresville:granite']] = true
|
||||||
|
ground_nodes[node['squaresville:basalt']] = true
|
||||||
|
ground_nodes[node['squaresville:dirt_with_odd_grass']] = true
|
||||||
|
squaresville.ground_nodes = ground_nodes
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath('booty') then
|
||||||
|
booty.add_ground_node('squaresville:concrete')
|
||||||
|
booty.add_ground_node('squaresville:concrete_broken')
|
||||||
|
booty.add_ground_node('squaresville:sidewalk')
|
||||||
|
booty.add_ground_node('squaresville:sidewalk_broken')
|
||||||
|
booty.add_ground_node('squaresville:floor_ceiling')
|
||||||
|
booty.add_ground_node('squaresville:floor_ceiling_broken')
|
||||||
|
for i = 2, 5 do
|
||||||
|
booty.add_ground_node('squaresville:concrete'..i)
|
||||||
|
booty.add_ground_node('squaresville:concrete'..i..'_broken')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
dofile(squaresville.path .. '/desolate.lua')
|
||||||
|
dofile(squaresville.path .. '/deco.lua')
|
||||||
|
dofile(squaresville.path .. '/schematics.lua')
|
||||||
|
dofile(squaresville.path .. '/mapgen.lua')
|
||||||
|
dofile(squaresville.path .. '/trans.lua')
|
||||||
|
dofile(squaresville.path .. "/chat.lua")
|
||||||
|
|
||||||
|
|
||||||
|
if squaresville.spawnplayer and squaresville.single_node then
|
||||||
|
minetest.register_on_newplayer(squaresville.spawnplayer)
|
||||||
|
minetest.register_on_respawnplayer(squaresville.spawnplayer)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
print('time buildings: '..math.floor(1000 * squaresville.time_buildings / squaresville.chunks))
|
||||||
|
print('time caves: '..math.floor(1000 * squaresville.time_caves / squaresville.chunks))
|
||||||
|
print('time environ noise: '..math.floor(1000 * squaresville.time_env_noise / squaresville.chunks))
|
||||||
|
print('time moria: '..math.floor(1000 * squaresville.time_moria / squaresville.chunks))
|
||||||
|
print('time overhead: '..math.floor(1000 * squaresville.time_overhead / squaresville.chunks))
|
||||||
|
print('time schematics: '..math.floor(1000 * squaresville.time_schem / squaresville.chunks))
|
||||||
|
print('time terrain: '..math.floor(1000 * squaresville.time_terrain / squaresville.chunks))
|
||||||
|
print('time big trees: '..math.floor(1000 * squaresville.time_trees / squaresville.chunks))
|
||||||
|
print('time y loop: '..math.floor(1000 * squaresville.time_y_loop / squaresville.chunks))
|
||||||
|
print('time ziggurats: '..math.floor(1000 * squaresville.time_zigg / squaresville.chunks))
|
||||||
|
print('chunks: '..squaresville.chunks)
|
||||||
|
end)
|
1228
mapgen.lua
Normal file
626
nodes.lua
Normal file
@ -0,0 +1,626 @@
|
|||||||
|
-- Squaresville nodes.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
local newnode
|
||||||
|
local light_max = default.light_max or 10
|
||||||
|
local node = squaresville.node
|
||||||
|
|
||||||
|
local darkening = 0
|
||||||
|
if squaresville.desolation > 0 then
|
||||||
|
darkening = 100
|
||||||
|
end
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:stone")
|
||||||
|
newnode.diggable = false
|
||||||
|
newnode.groups = {}
|
||||||
|
minetest.register_node("squaresville:bedrock", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:road', {
|
||||||
|
description = 'Road',
|
||||||
|
tiles = {'squaresville_tarmac.png'},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 2, level = 1},
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node('squaresville:road')
|
||||||
|
newnode.tiles = {'squaresville_tarmac.png^[brighten'}
|
||||||
|
minetest.register_node('squaresville:road_white', newnode)
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:road_broken', {
|
||||||
|
description = 'Road',
|
||||||
|
tiles = {'squaresville_tarmac.png^squaresville_broken_3.png'},
|
||||||
|
paramtype = 'light',
|
||||||
|
drawtype = 'nodebox',
|
||||||
|
node_box = { type = 'fixed',
|
||||||
|
fixed = {
|
||||||
|
{0.5, 0.3, 0.5, -0.5, -0.5, -0.5}
|
||||||
|
},
|
||||||
|
is_ground_content = false,
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 2, level = 1},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:road_yellow_line', {
|
||||||
|
description = 'Road',
|
||||||
|
tiles = {'squaresville_tarmac_yellow_line.png'},
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 2, level = 1},
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
--minetest.register_node('squaresville:concrete', {
|
||||||
|
-- description = 'Concrete',
|
||||||
|
-- tiles = {'default_stone.png'},
|
||||||
|
-- groups = {cracky = 3, level=1, stone = 1},
|
||||||
|
-- drop = 'default:cobble',
|
||||||
|
-- sounds = default.node_sound_stone_defaults(),
|
||||||
|
-- is_ground_content = false,
|
||||||
|
--})
|
||||||
|
newnode = squaresville.clone_node('default:stone')
|
||||||
|
newnode.description = 'Concrete'
|
||||||
|
newnode.is_ground_content = false
|
||||||
|
newnode.drop = 'default:cobble'
|
||||||
|
minetest.register_node('squaresville:concrete', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete')
|
||||||
|
newnode.tiles = {'default_stone.png^squaresville_broken_3_low.png'}
|
||||||
|
minetest.register_node('squaresville:concrete_broken', newnode)
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#964B00:40'}
|
||||||
|
minetest.register_node('squaresville:concrete2', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#FF0000:20'}
|
||||||
|
minetest.register_node('squaresville:concrete3', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#4682B4:10'}
|
||||||
|
minetest.register_node('squaresville:concrete4', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#000000:40'}
|
||||||
|
minetest.register_node('squaresville:concrete5', newnode)
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete_broken')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#964B00:40^squaresville_broken_3_low.png'}
|
||||||
|
minetest.register_node('squaresville:concrete2_broken', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete_broken')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#FF0000:20^squaresville_broken_3_low.png'}
|
||||||
|
minetest.register_node('squaresville:concrete3_broken', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete_broken')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#4682B4:10^squaresville_broken_3_low.png'}
|
||||||
|
minetest.register_node('squaresville:concrete4_broken', newnode)
|
||||||
|
newnode = squaresville.clone_node('squaresville:concrete_broken')
|
||||||
|
newnode.tiles = {'default_stone.png^[colorize:#000000:40^squaresville_broken_3_low.png'}
|
||||||
|
minetest.register_node('squaresville:concrete5_broken', newnode)
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:light_panel', {
|
||||||
|
description = 'Light Panel',
|
||||||
|
tiles = {'default_sandstone.png'},
|
||||||
|
light_source = 14,
|
||||||
|
paramtype = 'light',
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
drawtype = 'nodebox',
|
||||||
|
node_box = { type = 'fixed',
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.48, 0.5},
|
||||||
|
} },
|
||||||
|
groups = {cracky = 3, level=1, oddly_breakable_by_hand = 1},
|
||||||
|
drop = 'squaresville:light_panel_broken',
|
||||||
|
on_place = minetest.rotate_and_place,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node('squaresville:light_panel')
|
||||||
|
newnode.light_source = 0
|
||||||
|
minetest.register_node("squaresville:light_panel_broken", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
-- ice, thin -- transparent
|
||||||
|
minetest.register_node('squaresville:thin_ice', {
|
||||||
|
description = 'Thin Ice',
|
||||||
|
tiles = {'caverealms_thin_ice.png'},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=3},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
use_texture_alpha = true,
|
||||||
|
light_source = 1,
|
||||||
|
drawtype = 'glasslike',
|
||||||
|
sunlight_propagates = true,
|
||||||
|
freezemelt = 'default:water_source',
|
||||||
|
paramtype = 'light',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:plate_glass', {
|
||||||
|
description = 'Plate Glass',
|
||||||
|
drawtype = 'glasslike',
|
||||||
|
paramtype = 'light',
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {'squaresville_plate_glass.png'},
|
||||||
|
light_source = 1,
|
||||||
|
use_texture_alpha = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky = 3, level=2},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node('squaresville:plate_glass')
|
||||||
|
newnode.tiles = {'squaresville_plate_glass_broken.png'}
|
||||||
|
newnode.walkable = false
|
||||||
|
minetest.register_node('squaresville:plate_glass_broken', newnode)
|
||||||
|
minetest.register_alias('squaresville:glass_broken', 'squaresville:plate_glass_broken')
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:floor_ceiling', {
|
||||||
|
description = 'Floor/Ceiling',
|
||||||
|
tiles = {'squaresville_floor.png^[colorize:#000000:'..darkening, 'squaresville_ceiling.png', 'default_stone.png'},
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
groups = {cracky = 3, level=1, flammable = 3},
|
||||||
|
drop = 'default:cobble',
|
||||||
|
drop = {
|
||||||
|
max_items = 3,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
items = {'default:cobble',},
|
||||||
|
rarity = 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {'default:copper_ingot',},
|
||||||
|
rarity = 6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node('squaresville:floor_ceiling')
|
||||||
|
newnode.tiles = {'squaresville_floor.png^[colorize:#000000:'..darkening..'^squaresville_broken_3.png', 'squaresville_ceiling.png^squaresville_broken_3.png', 'default_stone.png^squaresville_broken_3.png'}
|
||||||
|
minetest.register_node('squaresville:floor_ceiling_broken', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:roof', {
|
||||||
|
description = 'Roof',
|
||||||
|
tiles = {'squaresville_tarmac.png', 'squaresville_ceiling.png', 'default_stone.png'},
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
groups = {cracky = 3, level=1, flammable = 3},
|
||||||
|
drop = 'default:cobble',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
minetest.register_node('squaresville:roof_broken', {
|
||||||
|
description = 'Roof',
|
||||||
|
tiles = {'squaresville_tarmac.png^squaresville_broken_3.png', 'squaresville_ceiling.png^squaresville_broken_3.png', 'default_stone.png'},
|
||||||
|
paramtype = 'light',
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
drawtype = 'nodebox',
|
||||||
|
drop = 'default:cobble',
|
||||||
|
node_box = { type = 'fixed',
|
||||||
|
fixed = {
|
||||||
|
{0.5, 0.3, 0.5, -0.5, -0.5, -0.5}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 3, level=1, flammable = 3},
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:sidewalk', {
|
||||||
|
description = 'Sidewalk',
|
||||||
|
tiles = {'squaresville_sidewalk.png'},
|
||||||
|
groups = {cracky = 3, level=1, stone = 1},
|
||||||
|
drop = 'default:cobble',
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
is_ground_content = false,
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node('squaresville:sidewalk')
|
||||||
|
newnode.tiles = {'squaresville_sidewalk.png^squaresville_broken_3.png'}
|
||||||
|
minetest.register_node('squaresville:sidewalk_broken', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:gargoyle', {
|
||||||
|
description = 'Concrete',
|
||||||
|
tiles = {'default_stone.png^[colorize:#000000:60'},
|
||||||
|
paramtype = 'light',
|
||||||
|
paramtype2 = 'facedir',
|
||||||
|
drawtype = 'nodebox',
|
||||||
|
node_box = { type = 'fixed',
|
||||||
|
fixed = {
|
||||||
|
{0.2, 0.23, -0.17, -0.1, -0.5, 0.17}, -- body f
|
||||||
|
{-0.1, -0.07, -0.17, -0.27, -0.5, 0.17}, -- body r
|
||||||
|
{0.17, 0.5, -0.07, 0, 0.23, 0.07}, -- head
|
||||||
|
{0.27, 0.2, 0.1, 0.13, -0.5, 0.23}, -- leg fl
|
||||||
|
{0.27, 0.2, -0.23, 0.13, -0.5, -0.1}, -- leg fr
|
||||||
|
{0.03, -0.1, 0.17, -0.2, -0.5, 0.27}, -- leg rl
|
||||||
|
{0.03, -0.1, -0.27, -0.2, -0.5, -0.17}, -- leg rl
|
||||||
|
{-0.1, 0.23, -0.4, -0.17, 0.13, 0.4}, -- wing u
|
||||||
|
{-0.1, 0.13, -0.3, -0.17, 0.03, 0.3}, -- wing u
|
||||||
|
} },
|
||||||
|
groups = {cracky = 3, level=1, stone = 1},
|
||||||
|
drop = 'default:cobble',
|
||||||
|
on_place = minetest.rotate_and_place,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:plaster", {
|
||||||
|
description = "Plaster",
|
||||||
|
tiles = {"default_desert_stone.png^[colorize:#8C8175:225"},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 3, level = 0, flammable = 2, oddly_breakable_by_hand = 1},
|
||||||
|
})
|
||||||
|
newnode = squaresville.clone_node("squaresville:plaster")
|
||||||
|
newnode.tiles = {"(default_desert_stone.png^[colorize:#8C8175:225)^squaresville_broken_3_low.png"}
|
||||||
|
minetest.register_node("squaresville:plaster_broken", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("stairs:stair_stone")
|
||||||
|
newnode.description = "Concrete Stair"
|
||||||
|
newnode.groups.flammable = 3
|
||||||
|
newnode.drop = "stairs:stair_stone"
|
||||||
|
minetest.register_node("squaresville:concrete_stair", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:carpet", {
|
||||||
|
description = "Carpet",
|
||||||
|
tiles = {"wool_blue.png", "default_stone.png", "default_stone.png"},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky = 2, level = 1},
|
||||||
|
})
|
||||||
|
minetest.register_alias("squaresville:carpet_broken", "default:stone")
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:glass")
|
||||||
|
newnode.description = "Glowing Crystal"
|
||||||
|
--newnode.tiles = {"squaresville_plate_glass.png^colorize:#FFFF00,150",}
|
||||||
|
newnode.tiles = {"squaresville_crystal.png",}
|
||||||
|
newnode.light_source = 10
|
||||||
|
minetest.register_node("squaresville:crystal_glow", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.registered_items['underworlds:glowing_fungal_stone'] then
|
||||||
|
minetest.register_alias("squaresville:glowing_fungal_stone", 'underworlds:glowing_fungal_stone')
|
||||||
|
minetest.register_alias("squaresville:glowing_fungus", 'underworlds:glowing_fungus')
|
||||||
|
else
|
||||||
|
-- Glowing fungal stone provides an eerie light.
|
||||||
|
minetest.register_node("squaresville:glowing_fungal_stone", {
|
||||||
|
description = "Glowing Fungal Stone",
|
||||||
|
tiles = {"default_stone.png^vmg_glowing_fungal.png",},
|
||||||
|
is_ground_content = true,
|
||||||
|
light_source = light_max - 4,
|
||||||
|
groups = {cracky=3, stone=1},
|
||||||
|
drop = {items={ {items={"default:cobble"},}, {items={"squaresville:glowing_fungus",},},},},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Glowing fungus grows underground.
|
||||||
|
minetest.register_craftitem("squaresville:glowing_fungus", {
|
||||||
|
description = "Glowing Fungus",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
paramtype = "light",
|
||||||
|
tiles = {"vmg_glowing_fungus.png"},
|
||||||
|
inventory_image = "vmg_glowing_fungus.png",
|
||||||
|
groups = {dig_immediate = 3},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:wet_fungus", {
|
||||||
|
description = "Leaves",
|
||||||
|
--drawtype = "allfaces_optional",
|
||||||
|
--waving = 1,
|
||||||
|
tiles = {"wet_fungus_2.png"},
|
||||||
|
--special_tiles = {"wet_fungus_2.png"},
|
||||||
|
--paramtype = "light",
|
||||||
|
--is_ground_content = false,
|
||||||
|
groups = {snappy = 3},
|
||||||
|
drop = '',
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Polluted dirt
|
||||||
|
newnode = squaresville.clone_node("default:dirt")
|
||||||
|
newnode.description = "Polluted Dirt"
|
||||||
|
newnode.tiles = {"default_dirt.png^[colorize:#100020:100"}
|
||||||
|
newnode.groups.soil = 0
|
||||||
|
minetest.register_node("squaresville:polluted_dirt", newnode)
|
||||||
|
|
||||||
|
-- Bare branches
|
||||||
|
minetest.register_node('squaresville:sticks_default', {
|
||||||
|
description = 'Sticks',
|
||||||
|
drawtype = 'allfaces_optional',
|
||||||
|
waving = 1,
|
||||||
|
visual_scale = 1.3,
|
||||||
|
tiles = {'squaresville_dry_twigs.png'},
|
||||||
|
paramtype = 'light',
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = 'default:stick 2',
|
||||||
|
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Black leaves
|
||||||
|
newnode = squaresville.clone_node("default:leaves")
|
||||||
|
newnode.description = "Blackened Leaves"
|
||||||
|
newnode.tiles = {"default_leaves.png^[colorize:#100020:200"}
|
||||||
|
newnode.special_tiles = {"default_leaves_simple.png^[colorize:#100020:200"}
|
||||||
|
newnode.groups = {snappy = 3, flammable = 2}
|
||||||
|
minetest.register_node("squaresville:leaves_black", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:water_source")
|
||||||
|
newnode.description = "Poisonous Water"
|
||||||
|
newnode.groups.poison = 3
|
||||||
|
--newnode.light_source = 6
|
||||||
|
newnode.liquid_alternative_flowing = "squaresville:water_poison_flowing"
|
||||||
|
newnode.liquid_alternative_source = "squaresville:water_poison_source"
|
||||||
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
||||||
|
--newnode.special_tiles[1].name = "squaresville_water_poison_source_animated.png"
|
||||||
|
newnode.tiles[1].name = "squaresville_water_poison_source_animated.png"
|
||||||
|
minetest.register_node("squaresville:water_poison_source", newnode)
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:water_flowing")
|
||||||
|
newnode.description = "Poisonous Water"
|
||||||
|
newnode.groups.poison = 3
|
||||||
|
--newnode.light_source = 6
|
||||||
|
newnode.liquid_alternative_flowing = "squaresville:water_poison_flowing"
|
||||||
|
newnode.liquid_alternative_source = "squaresville:water_poison_source"
|
||||||
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
||||||
|
--newnode.special_tiles[1].name = "squaresville_water_poison_flowing_animated.png"
|
||||||
|
newnode.tiles[1] = "squaresville_water_poison.png"
|
||||||
|
minetest.register_node("squaresville:water_poison_flowing", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:basalt", {
|
||||||
|
description = "Basalt",
|
||||||
|
tiles = {"squaresville_basalt.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1, level=2},
|
||||||
|
sounds = default.node_sound_stone_defaults({
|
||||||
|
footstep = {name="default_stone_footstep", gain=0.25},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
minetest.register_alias('squaresville:basalt_raw', 'squaresville:basalt')
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:granite", {
|
||||||
|
description = "Granite",
|
||||||
|
tiles = {"squaresville_granite.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1, level=3},
|
||||||
|
sounds = default.node_sound_stone_defaults({
|
||||||
|
footstep = {name="default_stone_footstep", gain=0.25},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
minetest.register_alias('squaresville:granite_raw', 'squaresville:granite')
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:stone")
|
||||||
|
newnode.tiles = {'squaresville_cracked_stone.png'}
|
||||||
|
minetest.register_node('squaresville:cracked_stone', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "default:lava_source",
|
||||||
|
wherein = "squaresville:cracked_stone",
|
||||||
|
clust_scarcity = 10 * 10 * 10,
|
||||||
|
clust_num_ores = 1,
|
||||||
|
clust_size = 1,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 10,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:dry_shrub")
|
||||||
|
newnode.tiles = {'squaresville_black_shrub.png'}
|
||||||
|
minetest.register_node('squaresville:blackened_shrub', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
local size_name = 1
|
||||||
|
for size = 1, 4 do
|
||||||
|
local name = 'squaresville:stone_spike_'..size_name
|
||||||
|
minetest.register_node(name, {
|
||||||
|
description = "Stone Spike",
|
||||||
|
tiles = {"squaresville_spike_1.png"},
|
||||||
|
inventory_image = "squaresville_spike_1.png",
|
||||||
|
wield_image = "squaresville_spike_1.png",
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
--light_source = 3,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
walkable = true,
|
||||||
|
buildable_to = true,
|
||||||
|
visual_scale = size,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.3*size, -0.5, -0.3*size, 0.3*size, -5/16, 0.3*size},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
size_name = size_name + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node('squaresville:fur_tree', {
|
||||||
|
description = "Fur Fronds",
|
||||||
|
tiles = {"squaresville_fur_frond.png"},
|
||||||
|
inventory_image = "squaresville_fur_frond.png",
|
||||||
|
wield_image = "squaresville_fur_frond.png",
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {choppy=3},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
--visual_scale = 2,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.1, -0.5, -0.1, 0.1, 0.5, 0.1},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:dirt_with_grass")
|
||||||
|
newnode.groups.spreading_dirt_type = nil
|
||||||
|
newnode.tiles = {"squaresville_odd_grass_1.png", "default_dirt.png",
|
||||||
|
{name = "default_dirt.png^squaresville_odd_grass_1.png",
|
||||||
|
tileable_vertical = false}}
|
||||||
|
minetest.register_node('squaresville:dirt_with_odd_grass', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:strange_plant_1", {
|
||||||
|
description = "Strange Plant",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
waving = 1,
|
||||||
|
tiles = {"squaresville_strange_plant_1.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = { snappy = 3, flower = 1, flora = 1, attached_node = 1, },
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:strange_plant_2", {
|
||||||
|
description = "Strange Plant",
|
||||||
|
drawtype = "plantlike",
|
||||||
|
waving = 1,
|
||||||
|
tiles = {"squaresville_strange_plant_2.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
groups = { snappy = 3, flora = 1, attached_node = 1, },
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--minetest.register_node("squaresville:cords", {
|
||||||
|
-- description = "Mushy Cords",
|
||||||
|
-- tiles = {"squaresville_cords_top.png", "squaresville_cords_top.png", "squaresville_cords.png"},
|
||||||
|
-- paramtype2 = "facedir",
|
||||||
|
-- is_ground_content = false,
|
||||||
|
-- groups = {tree = 1, fleshy = 2},
|
||||||
|
-- sounds = default.node_sound_leaves_defaults(),
|
||||||
|
-- on_place = minetest.rotate_node
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--newnode = squaresville.clone_node("default:water_source")
|
||||||
|
--newnode.description = "Water"
|
||||||
|
--newnode.drop = "default:water_source"
|
||||||
|
--newnode.pointable = true
|
||||||
|
--newnode.liquid_range = 0
|
||||||
|
--newnode.liquid_viscosity = 1
|
||||||
|
--newnode.liquid_renewable = false
|
||||||
|
--newnode.liquid_alternative_flowing = "chaos:weightless_water"
|
||||||
|
--newnode.liquid_alternative_source = "chaos:weightless_water"
|
||||||
|
--newnode.diggable = true
|
||||||
|
--newnode.buildable_to = false
|
||||||
|
--newnode.walkable = true
|
||||||
|
--newnode.groups = {}
|
||||||
|
--minetest.register_node("squaresville:pustule", newnode)
|
||||||
|
--
|
||||||
|
--if bucket and bucket.liquids then
|
||||||
|
-- bucket.liquids['squaresville:pustule'] = {
|
||||||
|
-- source = 'squaresville:pustule',
|
||||||
|
-- flowing = 'squaresville:pustule',
|
||||||
|
-- itemname = 'bucket:bucket_water',
|
||||||
|
-- }
|
||||||
|
--end
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node('air')
|
||||||
|
newnode.light_source = 14
|
||||||
|
minetest.register_node('squaresville:bright_air', newnode)
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:streetlight", {
|
||||||
|
description = "Streetlight",
|
||||||
|
tiles = {"squaresville_streetlight.png", 'squaresville_streetlight_bottom.png', 'squaresville_streetlight.png'},
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 14,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = { type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{0.1, 2.5, -0.1, -0.1, -0.5, 0.1},
|
||||||
|
{0.05, 2.5, -0.5, -0.05, 2.4, -0.1},
|
||||||
|
{0.1, 2.5, -0.7, -0.1, 2.35, -0.5},
|
||||||
|
} },
|
||||||
|
groups = {cracky = 2, level=2},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_place = minetest.rotate_and_place,
|
||||||
|
})
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("squaresville:streetlight")
|
||||||
|
newnode.light_source = 0
|
||||||
|
minetest.register_node("squaresville:streetlight_broken", newnode)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_node("squaresville:beacon_1", {
|
||||||
|
description = "Aircraft Beacon",
|
||||||
|
tiles = {"squaresville_beacon_1.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 14,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = { type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.05, -0.5, -0.05, 0.05, 0.3, 0.05},
|
||||||
|
{-0.15, 0.3, -0.15, 0.15, 0.5, 0.15},
|
||||||
|
} },
|
||||||
|
groups = {cracky = 2, level=2},
|
||||||
|
on_place = minetest.rotate_and_place,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node('default:apple')
|
||||||
|
newnode.tiles = {'squaresville_orange.png'}
|
||||||
|
newnode.inventory_image = "squaresville_orange.png"
|
||||||
|
newnode.description = 'Orange'
|
||||||
|
minetest.register_node('squaresville:orange', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node('default:apple')
|
||||||
|
newnode.tiles = {'squaresville_pear.png'}
|
||||||
|
newnode.inventory_image = "squaresville_pear.png"
|
||||||
|
newnode.description = 'Pear'
|
||||||
|
minetest.register_node('squaresville:pear', newnode)
|
||||||
|
|
||||||
|
|
||||||
|
for _, leaf in pairs({'default:leaves', 'default:pine_needles'}) do
|
||||||
|
local num = 1
|
||||||
|
for _, color in pairs({'FF0000', 'FFFF00', '00FF00'}) do
|
||||||
|
local newnode = squaresville.clone_node(leaf)
|
||||||
|
newnode.tiles = {newnode.tiles[1] .. '^[colorize:#' .. color .. ':15'}
|
||||||
|
local new_leaf_name = leaf:gsub('default', 'squaresville') .. '_alt_' .. num
|
||||||
|
minetest.register_node(new_leaf_name, newnode)
|
||||||
|
num = num + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
newnode = squaresville.clone_node("default:leaves")
|
||||||
|
newnode.description = "Cherry Blossoms"
|
||||||
|
newnode.tiles = {"squaresville_leaves_cherry.png"}
|
||||||
|
newnode.special_tiles = {"squaresville_leaves_cherry.png"}
|
||||||
|
newnode.groups = {snappy = 3, flammable = 2}
|
||||||
|
minetest.register_node("squaresville:leaves_cherry", newnode)
|
118
schematics.lua
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
-- Squaresville schematics.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
-- Do not distribute.
|
||||||
|
--dofile(squaresville.path..'/gpl3.lua')
|
||||||
|
|
||||||
|
|
||||||
|
-- Create and initialize a table for a schematic.
|
||||||
|
function squaresville.schematic_array(width, height, depth)
|
||||||
|
if not (width and height and depth and type(width) == 'number' and type(height) == 'number' and type(depth) == 'number') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dimensions of data array.
|
||||||
|
local s = {size={x=width, y=height, z=depth}}
|
||||||
|
s.data = {}
|
||||||
|
|
||||||
|
for z = 0,depth-1 do
|
||||||
|
for y = 0,height-1 do
|
||||||
|
for x = 0,width-1 do
|
||||||
|
local i = z*width*height + y*width + x + 1
|
||||||
|
s.data[i] = {}
|
||||||
|
s.data[i].name = "air"
|
||||||
|
s.data[i].param1 = 000
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
s.yslice_prob = {}
|
||||||
|
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local default_schematic_path = minetest.get_modpath("default").."/schematics/"
|
||||||
|
|
||||||
|
|
||||||
|
local function convert_mts(mts)
|
||||||
|
local sch = minetest.serialize_schematic(mts, 'lua', {})
|
||||||
|
sch = minetest.deserialize('return {'..sch..'}')
|
||||||
|
return sch.schematic
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.place_schematic = function(schem, ipos, vm, center)
|
||||||
|
local force_placement
|
||||||
|
local replacements = schem.replacements
|
||||||
|
local rot = schem.rotation
|
||||||
|
local size = schem.size or {x=0, z=0}
|
||||||
|
local pos = table.copy(ipos)
|
||||||
|
|
||||||
|
if center or (schem.flags and schem.flags['place_center_x']) then
|
||||||
|
if schem.size_offset then
|
||||||
|
pos.x = pos.x - schem.size_offset.x
|
||||||
|
else
|
||||||
|
pos.x = pos.x - math.floor(size.x / 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if center or (schem.flags and schem.flags['place_center_z']) then
|
||||||
|
if schem.size_offset then
|
||||||
|
pos.z = pos.z - schem.size_offset.z
|
||||||
|
else
|
||||||
|
pos.z = pos.z - math.floor(size.z / 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if schem.filename then
|
||||||
|
schem = schem.filename
|
||||||
|
elseif schem.schematic then
|
||||||
|
schem = schem.schematic
|
||||||
|
--else
|
||||||
|
--print('non-mts schematic? ')
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.place_schematic_on_vmanip(vm, pos, schem, rot, replacements, force_placement)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
squaresville.schematics = {}
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
for _, s in pairs(squaresville.decorations) do
|
||||||
|
if s.deco_type == 'schematic' then
|
||||||
|
local schem = convert_mts(s.schematic)
|
||||||
|
s.size = schem.size
|
||||||
|
if s.size then
|
||||||
|
s.size_offset = {x=math.floor(s.size.x / 2), y=math.floor(s.size.y / 2), z=math.floor(s.size.z / 2)}
|
||||||
|
if s.name == 'jungle_tree' then
|
||||||
|
s.size.x = 3
|
||||||
|
s.size.z = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
local w, h, d = 1, 8, 1
|
||||||
|
local s = squaresville.schematic_array(w, h, d)
|
||||||
|
|
||||||
|
for y = 0, math.floor(h/2)-1 do
|
||||||
|
s.data[0*d*h + y*d + 0 + 1].name = 'squaresville:fur_tree'
|
||||||
|
s.data[0*d*h + y*d + 0 + 1].param1 = 255
|
||||||
|
end
|
||||||
|
|
||||||
|
for y = 0, h-1 do
|
||||||
|
if y / 2 == math.floor(y / 2) then
|
||||||
|
s.yslice_prob[#s.yslice_prob+1] = {ypos=y,prob=170}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
squaresville.schematics['fur_tree'] = s
|
||||||
|
end
|
BIN
schematics/apple_tree2.mts
Normal file
BIN
schematics/apple_tree3.mts
Normal file
BIN
schematics/apple_tree4.mts
Normal file
BIN
schematics/cherry_tree.mts
Normal file
1
schematics/crappy_house_house.we
Normal file
BIN
schematics/decaying_tree.mts
Normal file
1
schematics/duane_glass_brick_barn_house.we
Normal file
BIN
schematics/jungle_tree_with_orchids.mts
Normal file
1
schematics/nathan_pond_house_house.we
Normal file
BIN
schematics/pine_tree2.mts
Normal file
BIN
schematics/pine_tree3.mts
Normal file
BIN
schematics/pine_tree4.mts
Normal file
21
settingtypes.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Reset to remove lights (for less cpu load).
|
||||||
|
squaresville_light_panels (Lighting Panels) bool true
|
||||||
|
|
||||||
|
# The degree of neglect and damage to inflict on the city.
|
||||||
|
# This varies from one to ten.
|
||||||
|
squaresville_desolation (Desolation) int 0
|
||||||
|
|
||||||
|
# The chance (in ten) that a given lot will be empty,
|
||||||
|
# rather than occupied by a building.
|
||||||
|
squaresville_vacancies (Vacancies) int 0
|
||||||
|
|
||||||
|
# Make Squaresville the main world, rather than
|
||||||
|
# using a standard mapgen.
|
||||||
|
squaresville_single_node (Single Node) bool false
|
||||||
|
|
||||||
|
# Make Squaresville ruins the main world, rather than
|
||||||
|
# using a standard mapgen.
|
||||||
|
squaresville_single_node_ruin (Single Node Ruin) bool false
|
||||||
|
|
||||||
|
# Don't generate roads or buildings.
|
||||||
|
squaresville_no_buildings (No Buildings) bool false
|
BIN
textures/caverealms_thin_ice.png
Normal file
After Width: | Height: | Size: 679 B |
1
textures/image_credits.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
All other textures are CC0.
|
BIN
textures/squaresville_basalt.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
textures/squaresville_beacon_1.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
textures/squaresville_bird_of_paradise.png
Normal file
After Width: | Height: | Size: 352 B |
BIN
textures/squaresville_black_shrub.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
textures/squaresville_broken_3.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
textures/squaresville_broken_3_low.png
Normal file
After Width: | Height: | Size: 808 B |
BIN
textures/squaresville_broken_key.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
textures/squaresville_ceiling.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
textures/squaresville_cracked_stone.png
Normal file
After Width: | Height: | Size: 718 B |
BIN
textures/squaresville_crystal.png
Normal file
After Width: | Height: | Size: 228 B |
BIN
textures/squaresville_dry_twigs.png
Normal file
After Width: | Height: | Size: 818 B |
BIN
textures/squaresville_floor.png
Normal file
After Width: | Height: | Size: 971 B |
BIN
textures/squaresville_fur_frond.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
textures/squaresville_gerbera.png
Normal file
After Width: | Height: | Size: 683 B |
BIN
textures/squaresville_granite.png
Normal file
After Width: | Height: | Size: 563 B |
BIN
textures/squaresville_key.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/squaresville_odd_grass_1.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
textures/squaresville_orange.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
textures/squaresville_orchid.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/squaresville_pear.png
Normal file
After Width: | Height: | Size: 437 B |
BIN
textures/squaresville_plate_glass.png
Normal file
After Width: | Height: | Size: 212 B |
BIN
textures/squaresville_plate_glass_broken.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
textures/squaresville_sidewalk.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/squaresville_spike_1.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
textures/squaresville_strange_plant_1.png
Normal file
After Width: | Height: | Size: 719 B |
BIN
textures/squaresville_strange_plant_2.png
Normal file
After Width: | Height: | Size: 937 B |
BIN
textures/squaresville_streetlight.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
textures/squaresville_streetlight_bottom.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
textures/squaresville_tarmac.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/squaresville_tarmac_yellow_line.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
textures/squaresville_water_poison.png
Normal file
After Width: | Height: | Size: 618 B |
BIN
textures/squaresville_water_poison_flowing_animated.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
textures/squaresville_water_poison_source_animated.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
textures/squaresville_window_broken.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
textures/wet_fungus_2.png
Normal file
After Width: | Height: | Size: 944 B |
90
trans.lua
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
-- Squaresville trans.lua
|
||||||
|
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
|
||||||
|
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)
|
||||||
|
|
||||||
|
|
||||||
|
local function teleport(user, ruin)
|
||||||
|
if not (user) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = user:get_player_name()
|
||||||
|
local pos = user:getpos()
|
||||||
|
if not (name and pos and name ~= '' and type(name) == 'string') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local newpos = {x=0,y=squaresville.baseline+2,z=0}
|
||||||
|
local wl = squaresville.wild_limits
|
||||||
|
local y = squaresville.baseline + 2
|
||||||
|
local extent_bottom = squaresville.extent_bottom
|
||||||
|
local extent_top = squaresville.extent_top
|
||||||
|
if ruin then
|
||||||
|
y = squaresville.baseline_ruin + 2
|
||||||
|
extent_bottom = squaresville.extent_bottom_ruin
|
||||||
|
extent_top = squaresville.extent_top_ruin
|
||||||
|
end
|
||||||
|
|
||||||
|
local tdx = math.floor((pos.x + wl / 2) / wl) * wl - 0
|
||||||
|
local tdz = math.floor((pos.z + wl / 2) / wl) * wl - 0
|
||||||
|
if pos.y < y + extent_bottom or pos.y > y + extent_top then
|
||||||
|
newpos = {x=tdx, y=y, z=tdz}
|
||||||
|
else
|
||||||
|
newpos = {x=tdx, y=120, z=tdz}
|
||||||
|
end
|
||||||
|
|
||||||
|
user:setpos(newpos)
|
||||||
|
print('Squaresville: '..name..' teleported to ('..newpos.x..','..newpos.y..','..newpos.z..')')
|
||||||
|
|
||||||
|
user:set_physics_override({gravity=0.1})
|
||||||
|
|
||||||
|
minetest.after(20, function()
|
||||||
|
user:set_physics_override({gravity=1})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem('squaresville:key', {
|
||||||
|
description = 'Key To The City',
|
||||||
|
drawtype = "plantlike",
|
||||||
|
paramtype = "light",
|
||||||
|
tiles = {'squaresville_key.png'},
|
||||||
|
inventory_image = 'squaresville_key.png',
|
||||||
|
groups = {dig_immediate = 3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
teleport(user, false)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem('squaresville:broken_key', {
|
||||||
|
description = 'Broken Key To The City',
|
||||||
|
drawtype = "plantlike",
|
||||||
|
paramtype = "light",
|
||||||
|
tiles = {'squaresville_broken_key.png'},
|
||||||
|
inventory_image = 'squaresville_broken_key.png',
|
||||||
|
groups = {dig_immediate = 3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
teleport(user, true)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'squaresville:key',
|
||||||
|
recipe = {
|
||||||
|
{'','default:obsidian_shard','default:copper_ingot'},
|
||||||
|
{'','default:steel_ingot',''},
|
||||||
|
{'','default:mese_crystal_fragment',''},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'squaresville:broken_key',
|
||||||
|
recipe = {
|
||||||
|
{'','default:obsidian_shard','default:coal_lump'},
|
||||||
|
{'','default:steel_ingot',''},
|
||||||
|
{'','default:mese_crystal_fragment',''},
|
||||||
|
}
|
||||||
|
})
|
48
ver50.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
diff --git a/deco.lua b/deco.lua
|
||||||
|
index ac67a82..105187a 100644
|
||||||
|
--- a/deco.lua
|
||||||
|
+++ b/deco.lua
|
||||||
|
@@ -119,7 +119,7 @@ do
|
||||||
|
|
||||||
|
if odeco.schematic then
|
||||||
|
deco.name = odeco.schematic:match('([%w_]+)%.mts') or odeco.schematic
|
||||||
|
- else
|
||||||
|
+ elseif odeco.decoration and type(odeco.decoration) == 'string' then
|
||||||
|
deco.name = odeco.decoration:match('.*:([%w_]+)') or odeco.decoration
|
||||||
|
end
|
||||||
|
|
||||||
|
diff --git a/init.lua b/init.lua
|
||||||
|
index 4dcab2d..2c7fbb0 100644
|
||||||
|
--- a/init.lua
|
||||||
|
+++ b/init.lua
|
||||||
|
@@ -162,7 +162,7 @@ else
|
||||||
|
-- This tables looks up nodes that aren't already stored.
|
||||||
|
squaresville.node = setmetatable({}, {
|
||||||
|
__index = function(t, k)
|
||||||
|
- if not (t and k and type(t) == 'table') then
|
||||||
|
+ if not (t and k and type(t) == 'table' and type(k) == 'string') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
diff --git a/nodes.lua b/nodes.lua
|
||||||
|
index 912f58a..a922b9a 100644
|
||||||
|
--- a/nodes.lua
|
||||||
|
+++ b/nodes.lua
|
||||||
|
@@ -358,7 +358,7 @@ newnode.groups.poison = 3
|
||||||
|
newnode.liquid_alternative_flowing = "squaresville:water_poison_flowing"
|
||||||
|
newnode.liquid_alternative_source = "squaresville:water_poison_source"
|
||||||
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
||||||
|
-newnode.special_tiles[1].name = "squaresville_water_poison_source_animated.png"
|
||||||
|
+--newnode.special_tiles[1].name = "squaresville_water_poison_source_animated.png"
|
||||||
|
newnode.tiles[1].name = "squaresville_water_poison_source_animated.png"
|
||||||
|
minetest.register_node("squaresville:water_poison_source", newnode)
|
||||||
|
|
||||||
|
@@ -369,7 +369,7 @@ newnode.groups.poison = 3
|
||||||
|
newnode.liquid_alternative_flowing = "squaresville:water_poison_flowing"
|
||||||
|
newnode.liquid_alternative_source = "squaresville:water_poison_source"
|
||||||
|
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
|
||||||
|
-newnode.special_tiles[1].name = "squaresville_water_poison_flowing_animated.png"
|
||||||
|
+--newnode.special_tiles[1].name = "squaresville_water_poison_flowing_animated.png"
|
||||||
|
newnode.tiles[1] = "squaresville_water_poison.png"
|
||||||
|
minetest.register_node("squaresville:water_poison_flowing", newnode)
|
||||||
|
|