mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-06-29 14:50:41 +02:00
Compare commits
1 Commits
2021-02-19
...
nalc-1.0
Author | SHA1 | Date | |
---|---|---|---|
c93df73a5c |
961
LICENSE
961
LICENSE
@ -1,12 +1,534 @@
|
|||||||
License for code: LGPL 3.0
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
License for media and all other assets: CC-by-SA 4.0
|
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.
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
[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.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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!
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Some code in lua_tube.lua is copied from The Mesecons Mod for Minetest:
|
||||||
|
|
||||||
|
License of source code
|
||||||
|
----------------------
|
||||||
|
Copyright (C) 2011-2016 Mesecons Mod Developer Team and contributors
|
||||||
|
|
||||||
|
This program is free software; you can redistribute the Mesecons Mod and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public License version 3
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the
|
||||||
|
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@ -169,432 +691,3 @@ apply, that proxy's public statement of acceptance of any version is
|
|||||||
permanent authorization for you to choose that version for the
|
permanent authorization for you to choose that version for the
|
||||||
Library.
|
Library.
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Attribution-ShareAlike 4.0 International
|
|
||||||
|
|
||||||
=======================================================================
|
|
||||||
|
|
||||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
|
||||||
does not provide legal services or legal advice. Distribution of
|
|
||||||
Creative Commons public licenses does not create a lawyer-client or
|
|
||||||
other relationship. Creative Commons makes its licenses and related
|
|
||||||
information available on an "as-is" basis. Creative Commons gives no
|
|
||||||
warranties regarding its licenses, any material licensed under their
|
|
||||||
terms and conditions, or any related information. Creative Commons
|
|
||||||
disclaims all liability for damages resulting from their use to the
|
|
||||||
fullest extent possible.
|
|
||||||
|
|
||||||
Using Creative Commons Public Licenses
|
|
||||||
|
|
||||||
Creative Commons public licenses provide a standard set of terms and
|
|
||||||
conditions that creators and other rights holders may use to share
|
|
||||||
original works of authorship and other material subject to copyright
|
|
||||||
and certain other rights specified in the public license below. The
|
|
||||||
following considerations are for informational purposes only, are not
|
|
||||||
exhaustive, and do not form part of our licenses.
|
|
||||||
|
|
||||||
Considerations for licensors: Our public licenses are
|
|
||||||
intended for use by those authorized to give the public
|
|
||||||
permission to use material in ways otherwise restricted by
|
|
||||||
copyright and certain other rights. Our licenses are
|
|
||||||
irrevocable. Licensors should read and understand the terms
|
|
||||||
and conditions of the license they choose before applying it.
|
|
||||||
Licensors should also secure all rights necessary before
|
|
||||||
applying our licenses so that the public can reuse the
|
|
||||||
material as expected. Licensors should clearly mark any
|
|
||||||
material not subject to the license. This includes other CC-
|
|
||||||
licensed material, or material used under an exception or
|
|
||||||
limitation to copyright. More considerations for licensors:
|
|
||||||
wiki.creativecommons.org/Considerations_for_licensors
|
|
||||||
|
|
||||||
Considerations for the public: By using one of our public
|
|
||||||
licenses, a licensor grants the public permission to use the
|
|
||||||
licensed material under specified terms and conditions. If
|
|
||||||
the licensor's permission is not necessary for any reason--for
|
|
||||||
example, because of any applicable exception or limitation to
|
|
||||||
copyright--then that use is not regulated by the license. Our
|
|
||||||
licenses grant only permissions under copyright and certain
|
|
||||||
other rights that a licensor has authority to grant. Use of
|
|
||||||
the licensed material may still be restricted for other
|
|
||||||
reasons, including because others have copyright or other
|
|
||||||
rights in the material. A licensor may make special requests,
|
|
||||||
such as asking that all changes be marked or described.
|
|
||||||
Although not required by our licenses, you are encouraged to
|
|
||||||
respect those requests where reasonable. More considerations
|
|
||||||
for the public:
|
|
||||||
wiki.creativecommons.org/Considerations_for_licensees
|
|
||||||
|
|
||||||
=======================================================================
|
|
||||||
|
|
||||||
Creative Commons Attribution-ShareAlike 4.0 International Public
|
|
||||||
License
|
|
||||||
|
|
||||||
By exercising the Licensed Rights (defined below), You accept and agree
|
|
||||||
to be bound by the terms and conditions of this Creative Commons
|
|
||||||
Attribution-ShareAlike 4.0 International Public License ("Public
|
|
||||||
License"). To the extent this Public License may be interpreted as a
|
|
||||||
contract, You are granted the Licensed Rights in consideration of Your
|
|
||||||
acceptance of these terms and conditions, and the Licensor grants You
|
|
||||||
such rights in consideration of benefits the Licensor receives from
|
|
||||||
making the Licensed Material available under these terms and
|
|
||||||
conditions.
|
|
||||||
|
|
||||||
|
|
||||||
Section 1 -- Definitions.
|
|
||||||
|
|
||||||
a. Adapted Material means material subject to Copyright and Similar
|
|
||||||
Rights that is derived from or based upon the Licensed Material
|
|
||||||
and in which the Licensed Material is translated, altered,
|
|
||||||
arranged, transformed, or otherwise modified in a manner requiring
|
|
||||||
permission under the Copyright and Similar Rights held by the
|
|
||||||
Licensor. For purposes of this Public License, where the Licensed
|
|
||||||
Material is a musical work, performance, or sound recording,
|
|
||||||
Adapted Material is always produced where the Licensed Material is
|
|
||||||
synched in timed relation with a moving image.
|
|
||||||
|
|
||||||
b. Adapter's License means the license You apply to Your Copyright
|
|
||||||
and Similar Rights in Your contributions to Adapted Material in
|
|
||||||
accordance with the terms and conditions of this Public License.
|
|
||||||
|
|
||||||
c. BY-SA Compatible License means a license listed at
|
|
||||||
creativecommons.org/compatiblelicenses, approved by Creative
|
|
||||||
Commons as essentially the equivalent of this Public License.
|
|
||||||
|
|
||||||
d. Copyright and Similar Rights means copyright and/or similar rights
|
|
||||||
closely related to copyright including, without limitation,
|
|
||||||
performance, broadcast, sound recording, and Sui Generis Database
|
|
||||||
Rights, without regard to how the rights are labeled or
|
|
||||||
categorized. For purposes of this Public License, the rights
|
|
||||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
|
||||||
Rights.
|
|
||||||
|
|
||||||
e. Effective Technological Measures means those measures that, in the
|
|
||||||
absence of proper authority, may not be circumvented under laws
|
|
||||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
|
||||||
Treaty adopted on December 20, 1996, and/or similar international
|
|
||||||
agreements.
|
|
||||||
|
|
||||||
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
|
||||||
any other exception or limitation to Copyright and Similar Rights
|
|
||||||
that applies to Your use of the Licensed Material.
|
|
||||||
|
|
||||||
g. License Elements means the license attributes listed in the name
|
|
||||||
of a Creative Commons Public License. The License Elements of this
|
|
||||||
Public License are Attribution and ShareAlike.
|
|
||||||
|
|
||||||
h. Licensed Material means the artistic or literary work, database,
|
|
||||||
or other material to which the Licensor applied this Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
i. Licensed Rights means the rights granted to You subject to the
|
|
||||||
terms and conditions of this Public License, which are limited to
|
|
||||||
all Copyright and Similar Rights that apply to Your use of the
|
|
||||||
Licensed Material and that the Licensor has authority to license.
|
|
||||||
|
|
||||||
j. Licensor means the individual(s) or entity(ies) granting rights
|
|
||||||
under this Public License.
|
|
||||||
|
|
||||||
k. Share means to provide material to the public by any means or
|
|
||||||
process that requires permission under the Licensed Rights, such
|
|
||||||
as reproduction, public display, public performance, distribution,
|
|
||||||
dissemination, communication, or importation, and to make material
|
|
||||||
available to the public including in ways that members of the
|
|
||||||
public may access the material from a place and at a time
|
|
||||||
individually chosen by them.
|
|
||||||
|
|
||||||
l. Sui Generis Database Rights means rights other than copyright
|
|
||||||
resulting from Directive 96/9/EC of the European Parliament and of
|
|
||||||
the Council of 11 March 1996 on the legal protection of databases,
|
|
||||||
as amended and/or succeeded, as well as other essentially
|
|
||||||
equivalent rights anywhere in the world.
|
|
||||||
|
|
||||||
m. You means the individual or entity exercising the Licensed Rights
|
|
||||||
under this Public License. Your has a corresponding meaning.
|
|
||||||
|
|
||||||
|
|
||||||
Section 2 -- Scope.
|
|
||||||
|
|
||||||
a. License grant.
|
|
||||||
|
|
||||||
1. Subject to the terms and conditions of this Public License,
|
|
||||||
the Licensor hereby grants You a worldwide, royalty-free,
|
|
||||||
non-sublicensable, non-exclusive, irrevocable license to
|
|
||||||
exercise the Licensed Rights in the Licensed Material to:
|
|
||||||
|
|
||||||
a. reproduce and Share the Licensed Material, in whole or
|
|
||||||
in part; and
|
|
||||||
|
|
||||||
b. produce, reproduce, and Share Adapted Material.
|
|
||||||
|
|
||||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
|
||||||
Exceptions and Limitations apply to Your use, this Public
|
|
||||||
License does not apply, and You do not need to comply with
|
|
||||||
its terms and conditions.
|
|
||||||
|
|
||||||
3. Term. The term of this Public License is specified in Section
|
|
||||||
6(a).
|
|
||||||
|
|
||||||
4. Media and formats; technical modifications allowed. The
|
|
||||||
Licensor authorizes You to exercise the Licensed Rights in
|
|
||||||
all media and formats whether now known or hereafter created,
|
|
||||||
and to make technical modifications necessary to do so. The
|
|
||||||
Licensor waives and/or agrees not to assert any right or
|
|
||||||
authority to forbid You from making technical modifications
|
|
||||||
necessary to exercise the Licensed Rights, including
|
|
||||||
technical modifications necessary to circumvent Effective
|
|
||||||
Technological Measures. For purposes of this Public License,
|
|
||||||
simply making modifications authorized by this Section 2(a)
|
|
||||||
(4) never produces Adapted Material.
|
|
||||||
|
|
||||||
5. Downstream recipients.
|
|
||||||
|
|
||||||
a. Offer from the Licensor -- Licensed Material. Every
|
|
||||||
recipient of the Licensed Material automatically
|
|
||||||
receives an offer from the Licensor to exercise the
|
|
||||||
Licensed Rights under the terms and conditions of this
|
|
||||||
Public License.
|
|
||||||
|
|
||||||
b. Additional offer from the Licensor -- Adapted Material.
|
|
||||||
Every recipient of Adapted Material from You
|
|
||||||
automatically receives an offer from the Licensor to
|
|
||||||
exercise the Licensed Rights in the Adapted Material
|
|
||||||
under the conditions of the Adapter's License You apply.
|
|
||||||
|
|
||||||
c. No downstream restrictions. You may not offer or impose
|
|
||||||
any additional or different terms or conditions on, or
|
|
||||||
apply any Effective Technological Measures to, the
|
|
||||||
Licensed Material if doing so restricts exercise of the
|
|
||||||
Licensed Rights by any recipient of the Licensed
|
|
||||||
Material.
|
|
||||||
|
|
||||||
6. No endorsement. Nothing in this Public License constitutes or
|
|
||||||
may be construed as permission to assert or imply that You
|
|
||||||
are, or that Your use of the Licensed Material is, connected
|
|
||||||
with, or sponsored, endorsed, or granted official status by,
|
|
||||||
the Licensor or others designated to receive attribution as
|
|
||||||
provided in Section 3(a)(1)(A)(i).
|
|
||||||
|
|
||||||
b. Other rights.
|
|
||||||
|
|
||||||
1. Moral rights, such as the right of integrity, are not
|
|
||||||
licensed under this Public License, nor are publicity,
|
|
||||||
privacy, and/or other similar personality rights; however, to
|
|
||||||
the extent possible, the Licensor waives and/or agrees not to
|
|
||||||
assert any such rights held by the Licensor to the limited
|
|
||||||
extent necessary to allow You to exercise the Licensed
|
|
||||||
Rights, but not otherwise.
|
|
||||||
|
|
||||||
2. Patent and trademark rights are not licensed under this
|
|
||||||
Public License.
|
|
||||||
|
|
||||||
3. To the extent possible, the Licensor waives any right to
|
|
||||||
collect royalties from You for the exercise of the Licensed
|
|
||||||
Rights, whether directly or through a collecting society
|
|
||||||
under any voluntary or waivable statutory or compulsory
|
|
||||||
licensing scheme. In all other cases the Licensor expressly
|
|
||||||
reserves any right to collect such royalties.
|
|
||||||
|
|
||||||
|
|
||||||
Section 3 -- License Conditions.
|
|
||||||
|
|
||||||
Your exercise of the Licensed Rights is expressly made subject to the
|
|
||||||
following conditions.
|
|
||||||
|
|
||||||
a. Attribution.
|
|
||||||
|
|
||||||
1. If You Share the Licensed Material (including in modified
|
|
||||||
form), You must:
|
|
||||||
|
|
||||||
a. retain the following if it is supplied by the Licensor
|
|
||||||
with the Licensed Material:
|
|
||||||
|
|
||||||
i. identification of the creator(s) of the Licensed
|
|
||||||
Material and any others designated to receive
|
|
||||||
attribution, in any reasonable manner requested by
|
|
||||||
the Licensor (including by pseudonym if
|
|
||||||
designated);
|
|
||||||
|
|
||||||
ii. a copyright notice;
|
|
||||||
|
|
||||||
iii. a notice that refers to this Public License;
|
|
||||||
|
|
||||||
iv. a notice that refers to the disclaimer of
|
|
||||||
warranties;
|
|
||||||
|
|
||||||
v. a URI or hyperlink to the Licensed Material to the
|
|
||||||
extent reasonably practicable;
|
|
||||||
|
|
||||||
b. indicate if You modified the Licensed Material and
|
|
||||||
retain an indication of any previous modifications; and
|
|
||||||
|
|
||||||
c. indicate the Licensed Material is licensed under this
|
|
||||||
Public License, and include the text of, or the URI or
|
|
||||||
hyperlink to, this Public License.
|
|
||||||
|
|
||||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
|
||||||
reasonable manner based on the medium, means, and context in
|
|
||||||
which You Share the Licensed Material. For example, it may be
|
|
||||||
reasonable to satisfy the conditions by providing a URI or
|
|
||||||
hyperlink to a resource that includes the required
|
|
||||||
information.
|
|
||||||
|
|
||||||
3. If requested by the Licensor, You must remove any of the
|
|
||||||
information required by Section 3(a)(1)(A) to the extent
|
|
||||||
reasonably practicable.
|
|
||||||
|
|
||||||
b. ShareAlike.
|
|
||||||
|
|
||||||
In addition to the conditions in Section 3(a), if You Share
|
|
||||||
Adapted Material You produce, the following conditions also apply.
|
|
||||||
|
|
||||||
1. The Adapter's License You apply must be a Creative Commons
|
|
||||||
license with the same License Elements, this version or
|
|
||||||
later, or a BY-SA Compatible License.
|
|
||||||
|
|
||||||
2. You must include the text of, or the URI or hyperlink to, the
|
|
||||||
Adapter's License You apply. You may satisfy this condition
|
|
||||||
in any reasonable manner based on the medium, means, and
|
|
||||||
context in which You Share Adapted Material.
|
|
||||||
|
|
||||||
3. You may not offer or impose any additional or different terms
|
|
||||||
or conditions on, or apply any Effective Technological
|
|
||||||
Measures to, Adapted Material that restrict exercise of the
|
|
||||||
rights granted under the Adapter's License You apply.
|
|
||||||
|
|
||||||
|
|
||||||
Section 4 -- Sui Generis Database Rights.
|
|
||||||
|
|
||||||
Where the Licensed Rights include Sui Generis Database Rights that
|
|
||||||
apply to Your use of the Licensed Material:
|
|
||||||
|
|
||||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
|
||||||
to extract, reuse, reproduce, and Share all or a substantial
|
|
||||||
portion of the contents of the database;
|
|
||||||
|
|
||||||
b. if You include all or a substantial portion of the database
|
|
||||||
contents in a database in which You have Sui Generis Database
|
|
||||||
Rights, then the database in which You have Sui Generis Database
|
|
||||||
Rights (but not its individual contents) is Adapted Material,
|
|
||||||
|
|
||||||
including for purposes of Section 3(b); and
|
|
||||||
c. You must comply with the conditions in Section 3(a) if You Share
|
|
||||||
all or a substantial portion of the contents of the database.
|
|
||||||
|
|
||||||
For the avoidance of doubt, this Section 4 supplements and does not
|
|
||||||
replace Your obligations under this Public License where the Licensed
|
|
||||||
Rights include other Copyright and Similar Rights.
|
|
||||||
|
|
||||||
|
|
||||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
|
||||||
|
|
||||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
|
||||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
|
||||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
||||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
|
||||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
|
||||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
|
||||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
|
||||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
|
||||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
|
||||||
|
|
||||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
|
||||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
|
||||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
|
||||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
|
||||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
|
||||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
|
||||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
|
||||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
|
||||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
|
||||||
|
|
||||||
c. The disclaimer of warranties and limitation of liability provided
|
|
||||||
above shall be interpreted in a manner that, to the extent
|
|
||||||
possible, most closely approximates an absolute disclaimer and
|
|
||||||
waiver of all liability.
|
|
||||||
|
|
||||||
|
|
||||||
Section 6 -- Term and Termination.
|
|
||||||
|
|
||||||
a. This Public License applies for the term of the Copyright and
|
|
||||||
Similar Rights licensed here. However, if You fail to comply with
|
|
||||||
this Public License, then Your rights under this Public License
|
|
||||||
terminate automatically.
|
|
||||||
|
|
||||||
b. Where Your right to use the Licensed Material has terminated under
|
|
||||||
Section 6(a), it reinstates:
|
|
||||||
|
|
||||||
1. automatically as of the date the violation is cured, provided
|
|
||||||
it is cured within 30 days of Your discovery of the
|
|
||||||
violation; or
|
|
||||||
|
|
||||||
2. upon express reinstatement by the Licensor.
|
|
||||||
|
|
||||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
|
||||||
right the Licensor may have to seek remedies for Your violations
|
|
||||||
of this Public License.
|
|
||||||
|
|
||||||
c. For the avoidance of doubt, the Licensor may also offer the
|
|
||||||
Licensed Material under separate terms or conditions or stop
|
|
||||||
distributing the Licensed Material at any time; however, doing so
|
|
||||||
will not terminate this Public License.
|
|
||||||
|
|
||||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
|
||||||
License.
|
|
||||||
|
|
||||||
|
|
||||||
Section 7 -- Other Terms and Conditions.
|
|
||||||
|
|
||||||
a. The Licensor shall not be bound by any additional or different
|
|
||||||
terms or conditions communicated by You unless expressly agreed.
|
|
||||||
|
|
||||||
b. Any arrangements, understandings, or agreements regarding the
|
|
||||||
Licensed Material not stated herein are separate from and
|
|
||||||
independent of the terms and conditions of this Public License.
|
|
||||||
|
|
||||||
|
|
||||||
Section 8 -- Interpretation.
|
|
||||||
|
|
||||||
a. For the avoidance of doubt, this Public License does not, and
|
|
||||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
|
||||||
conditions on any use of the Licensed Material that could lawfully
|
|
||||||
be made without permission under this Public License.
|
|
||||||
|
|
||||||
b. To the extent possible, if any provision of this Public License is
|
|
||||||
deemed unenforceable, it shall be automatically reformed to the
|
|
||||||
minimum extent necessary to make it enforceable. If the provision
|
|
||||||
cannot be reformed, it shall be severed from this Public License
|
|
||||||
without affecting the enforceability of the remaining terms and
|
|
||||||
conditions.
|
|
||||||
|
|
||||||
c. No term or condition of this Public License will be waived and no
|
|
||||||
failure to comply consented to unless expressly agreed to by the
|
|
||||||
Licensor.
|
|
||||||
|
|
||||||
d. Nothing in this Public License constitutes or may be interpreted
|
|
||||||
as a limitation upon, or waiver of, any privileges and immunities
|
|
||||||
that apply to the Licensor or You, including from the legal
|
|
||||||
processes of any jurisdiction or authority.
|
|
||||||
|
|
||||||
|
|
||||||
=======================================================================
|
|
||||||
|
|
||||||
Creative Commons is not a party to its public
|
|
||||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
|
||||||
its public licenses to material it publishes and in those instances
|
|
||||||
will be considered the “Licensor.” The text of the Creative Commons
|
|
||||||
public licenses is dedicated to the public domain under the CC0 Public
|
|
||||||
Domain Dedication. Except for the limited purpose of indicating that
|
|
||||||
material is shared under a Creative Commons public license or as
|
|
||||||
otherwise permitted by the Creative Commons policies published at
|
|
||||||
creativecommons.org/policies, Creative Commons does not authorize the
|
|
||||||
use of the trademark "Creative Commons" or any other trademark or logo
|
|
||||||
of Creative Commons without its prior written consent including,
|
|
||||||
without limitation, in connection with any unauthorized modifications
|
|
||||||
to any of its public licenses or any other arrangements,
|
|
||||||
understandings, or agreements concerning use of licensed material. For
|
|
||||||
the avoidance of doubt, this paragraph does not form part of the
|
|
||||||
public licenses.
|
|
||||||
|
|
||||||
Creative Commons may be contacted at creativecommons.org.
|
|
||||||
|
2
README
2
README
@ -1,7 +1,7 @@
|
|||||||
This mod uses nodeboxes to supply a complete set of 3D pipes and tubes,
|
This mod uses nodeboxes to supply a complete set of 3D pipes and tubes,
|
||||||
along devices that work with them.
|
along devices that work with them.
|
||||||
|
|
||||||
See https://gitlab.com/VanessaE/pipeworks/wikis/ for detailed information about usage of this mod.
|
See https://github.com/VanessaE/pipeworks/wiki/ for detailed information about usage of this mod.
|
||||||
|
|
||||||
Unlike the previous version of this mod, these pipes are rounded, and when
|
Unlike the previous version of this mod, these pipes are rounded, and when
|
||||||
placed, they'll automatically join together as needed. Pipes can go vertically
|
placed, they'll automatically join together as needed. Pipes can go vertically
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local autocrafterCache = {} -- caches some recipe data to avoid to call the slow function minetest.get_craft_result() every second
|
local autocrafterCache = {} -- caches some recipe data to avoid to call the slow function minetest.get_craft_result() every second
|
||||||
|
|
||||||
local craft_time = 1
|
local craft_time = 1
|
||||||
@ -17,7 +16,7 @@ end
|
|||||||
local function get_item_info(stack)
|
local function get_item_info(stack)
|
||||||
local name = stack:get_name()
|
local name = stack:get_name()
|
||||||
local def = minetest.registered_items[name]
|
local def = minetest.registered_items[name]
|
||||||
local description = def and def.description or S("Unknown item")
|
local description = def and def.description or "Unknown item"
|
||||||
return description, name
|
return description, name
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ local function autocraft(inventory, craft)
|
|||||||
end
|
end
|
||||||
-- consume material
|
-- consume material
|
||||||
for itemname, number in pairs(consumption) do
|
for itemname, number in pairs(consumption) do
|
||||||
for _ = 1, number do -- We have to do that since remove_item does not work if count > stack_max
|
for i = 1, number do -- We have to do that since remove_item does not work if count > stack_max
|
||||||
inventory:remove_item("src", ItemStack(itemname))
|
inventory:remove_item("src", ItemStack(itemname))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -67,13 +66,16 @@ local function run_autocrafter(pos, elapsed)
|
|||||||
local inventory = meta:get_inventory()
|
local inventory = meta:get_inventory()
|
||||||
local craft = get_craft(pos, inventory)
|
local craft = get_craft(pos, inventory)
|
||||||
local output_item = craft.output.item
|
local output_item = craft.output.item
|
||||||
|
-- NALC: existence de limitgroup ?
|
||||||
|
local limitcraft = minetest.get_item_group(output_item:get_name(), "limitcraft") or 0
|
||||||
-- only use crafts that have an actual result
|
-- only use crafts that have an actual result
|
||||||
if output_item:is_empty() then
|
-- NALC: ou si l'item n'est pas dans le group limitcraft
|
||||||
meta:set_string("infotext", S("unconfigured Autocrafter: unknown recipe"))
|
if output_item:is_empty() or limitcraft > 0 then
|
||||||
|
meta:set_string("infotext", "unconfigured Autocrafter: unknown recipe")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
for _ = 1, math.floor(elapsed/craft_time) do
|
for step = 1, math.floor(elapsed/craft_time) do
|
||||||
local continue = autocraft(inventory, craft)
|
local continue = autocraft(inventory, craft)
|
||||||
if not continue then return false end
|
if not continue then return false end
|
||||||
end
|
end
|
||||||
@ -102,10 +104,11 @@ local function after_recipe_change(pos, inventory)
|
|||||||
if inventory:is_empty("recipe") then
|
if inventory:is_empty("recipe") then
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
autocrafterCache[minetest.hash_node_position(pos)] = nil
|
autocrafterCache[minetest.hash_node_position(pos)] = nil
|
||||||
meta:set_string("infotext", S("unconfigured Autocrafter"))
|
meta:set_string("infotext", "unconfigured Autocrafter")
|
||||||
inventory:set_stack("output", 1, "")
|
inventory:set_stack("output", 1, "")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local recipe_changed = false
|
||||||
local recipe = inventory:get_list("recipe")
|
local recipe = inventory:get_list("recipe")
|
||||||
|
|
||||||
local hash = minetest.hash_node_position(pos)
|
local hash = minetest.hash_node_position(pos)
|
||||||
@ -126,7 +129,7 @@ local function after_recipe_change(pos, inventory)
|
|||||||
craft = craft or get_craft(pos, inventory, hash)
|
craft = craft or get_craft(pos, inventory, hash)
|
||||||
local output_item = craft.output.item
|
local output_item = craft.output.item
|
||||||
local description, name = get_item_info(output_item)
|
local description, name = get_item_info(output_item)
|
||||||
meta:set_string("infotext", S("'@1' Autocrafter (@2)", description, name))
|
meta:set_string("infotext", string.format("'%s' Autocrafter (%s)", description, name))
|
||||||
inventory:set_stack("output", 1, output_item)
|
inventory:set_stack("output", 1, output_item)
|
||||||
|
|
||||||
after_inventory_change(pos)
|
after_inventory_change(pos)
|
||||||
@ -190,8 +193,8 @@ local function update_meta(meta, enabled)
|
|||||||
"listring[context;dst]" ..
|
"listring[context;dst]" ..
|
||||||
"listring[current_player;main]"
|
"listring[current_player;main]"
|
||||||
if minetest.get_modpath("digilines") then
|
if minetest.get_modpath("digilines") then
|
||||||
fs = fs.."field[1,3.5;4,1;channel;"..S("Channel")..";${channel}]"
|
fs = fs.."field[1,3.5;4,1;channel;Channel;${channel}]"
|
||||||
fs = fs.."button_exit[5,3.2;2,1;save;"..S("Save").."]"
|
fs = fs.."button_exit[5,3.2;2,1;save;Save]"
|
||||||
end
|
end
|
||||||
meta:set_string("formspec",fs)
|
meta:set_string("formspec",fs)
|
||||||
|
|
||||||
@ -200,13 +203,13 @@ local function update_meta(meta, enabled)
|
|||||||
-- this might be more written code, but actually executes less
|
-- this might be more written code, but actually executes less
|
||||||
local output = meta:get_inventory():get_stack("output", 1)
|
local output = meta:get_inventory():get_stack("output", 1)
|
||||||
if output:is_empty() then -- doesn't matter if paused or not
|
if output:is_empty() then -- doesn't matter if paused or not
|
||||||
meta:set_string("infotext", S("unconfigured Autocrafter"))
|
meta:set_string("infotext", "unconfigured Autocrafter")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local description, name = get_item_info(output)
|
local description, name = get_item_info(output)
|
||||||
local infotext = enabled and S("'@1' Autocrafter (@2)", description, name)
|
local infotext = enabled and string.format("'%s' Autocrafter (%s)", description, name)
|
||||||
or S("paused '@1' Autocrafter", description)
|
or string.format("paused '%s' Autocrafter", description)
|
||||||
|
|
||||||
meta:set_string("infotext", infotext)
|
meta:set_string("infotext", infotext)
|
||||||
return enabled
|
return enabled
|
||||||
@ -226,7 +229,7 @@ local function upgrade_autocrafter(pos, meta)
|
|||||||
update_meta(meta, true)
|
update_meta(meta, true)
|
||||||
|
|
||||||
if meta:get_string("virtual_items") == "1" then -- we are version 2
|
if meta:get_string("virtual_items") == "1" then -- we are version 2
|
||||||
-- we already dropped stuff, so lets remove the metadatasetting (we are not being called again for this node)
|
-- we allready dropped stuff, so lets remove the metadatasetting (we are not being called again for this node)
|
||||||
meta:set_string("virtual_items", "")
|
meta:set_string("virtual_items", "")
|
||||||
else -- we are version 1
|
else -- we are version 1
|
||||||
local recipe = inv:get_list("recipe")
|
local recipe = inv:get_list("recipe")
|
||||||
@ -248,7 +251,7 @@ local function upgrade_autocrafter(pos, meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("pipeworks:autocrafter", {
|
minetest.register_node("pipeworks:autocrafter", {
|
||||||
description = S("Autocrafter"),
|
description = "Autocrafter",
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {"pipeworks_autocrafter.png"},
|
tiles = {"pipeworks_autocrafter.png"},
|
||||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
@ -388,27 +391,6 @@ minetest.register_node("pipeworks:autocrafter", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
after_recipe_change(pos,inv)
|
after_recipe_change(pos,inv)
|
||||||
elseif msg == "get_recipe" then
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local recipe = {}
|
|
||||||
for y=0,2,1 do
|
|
||||||
local row = {}
|
|
||||||
for x=1,3,1 do
|
|
||||||
local slot = y*3+x
|
|
||||||
table.insert(row, inv:get_stack("recipe",slot):get_name())
|
|
||||||
end
|
|
||||||
table.insert(recipe, row)
|
|
||||||
end
|
|
||||||
local setchan = meta:get_string("channel")
|
|
||||||
local output = inv:get_stack("output", 1)
|
|
||||||
digiline:receptor_send(pos, digiline.rules.default, setchan, {
|
|
||||||
recipe = recipe,
|
|
||||||
result = {
|
|
||||||
name = output:get_name(),
|
|
||||||
count = output:get_count(),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
elseif msg == "off" then
|
elseif msg == "off" then
|
||||||
update_meta(meta, false)
|
update_meta(meta, false)
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
@ -428,7 +410,7 @@ minetest.register_craft( {
|
|||||||
output = "pipeworks:autocrafter 2",
|
output = "pipeworks:autocrafter 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" },
|
{ "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" },
|
||||||
{ "basic_materials:plastic_sheet", "default:steel_ingot", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting" },
|
||||||
{ "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" }
|
{ "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -53,35 +53,34 @@ local function tube_autoroute(pos)
|
|||||||
}
|
}
|
||||||
-- xm = 1, xp = 2, ym = 3, yp = 4, zm = 5, zp = 6
|
-- xm = 1, xp = 2, ym = 3, yp = 4, zm = 5, zp = 6
|
||||||
|
|
||||||
local adjlist = {} -- this will be used in item_transport
|
local positions = {}
|
||||||
|
local nodes = {}
|
||||||
for i, adj in ipairs(adjustments) do
|
for i, adj in ipairs(adjustments) do
|
||||||
local position = vector.add(pos, adj)
|
positions[i] = vector.add(pos, adj)
|
||||||
local node = minetest.get_node(position)
|
nodes[i] = minetest.get_node(positions[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, node in ipairs(nodes) do
|
||||||
local idef = minetest.registered_nodes[node.name]
|
local idef = minetest.registered_nodes[node.name]
|
||||||
-- handle the tubes themselves
|
-- handle the tubes themselves
|
||||||
if is_tube(node.name) then
|
if is_tube(node.name) then
|
||||||
active[i] = 1
|
active[i] = 1
|
||||||
table.insert(adjlist, adj)
|
|
||||||
-- handle new style connectors
|
-- handle new style connectors
|
||||||
elseif idef and idef.tube and idef.tube.connect_sides then
|
elseif idef and idef.tube and idef.tube.connect_sides then
|
||||||
if idef.tube.connect_sides[nodeside(node, vector.multiply(adj, -1))] then
|
local dir = adjustments[i]
|
||||||
|
if idef.tube.connect_sides[nodeside(node, vector.multiply(dir, -1))] then
|
||||||
active[i] = 1
|
active[i] = 1
|
||||||
table.insert(adjlist, adj)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.get_meta(pos):set_string("adjlist", minetest.serialize(adjlist))
|
|
||||||
|
|
||||||
-- all sides checked, now figure which tube to use.
|
-- all sides checked, now figure which tube to use.
|
||||||
|
|
||||||
local nodedef = minetest.registered_nodes[nctr.name]
|
local nodedef = minetest.registered_nodes[nctr.name]
|
||||||
local basename = nodedef.basename
|
local basename = nodedef.basename
|
||||||
if nodedef.style == "old" then
|
if nodedef.style == "old" then
|
||||||
local nsurround = ""
|
local nsurround = ""
|
||||||
for _, n in ipairs(active) do
|
for i, n in ipairs(active) do
|
||||||
nsurround = nsurround..n
|
nsurround = nsurround..n
|
||||||
end
|
end
|
||||||
nctr.name = basename.."_"..nsurround
|
nctr.name = basename.."_"..nsurround
|
||||||
@ -112,22 +111,6 @@ function pipeworks.after_dig(pos)
|
|||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Screwdriver calls this function before rotating a node.
|
|
||||||
-- However, connections must be updated *after* the node is rotated
|
|
||||||
-- So, this function does the rotation itself and returns `true`.
|
|
||||||
-- (Note: screwdriver already checks for protected areas.)
|
|
||||||
|
|
||||||
-- This should only be used for tubes that don't autoconnect.
|
|
||||||
-- (For example, one-way tubes.)
|
|
||||||
-- Autoconnecting tubes will just revert back to their original state
|
|
||||||
-- when they are updated.
|
|
||||||
function pipeworks.on_rotate(pos, node, user, mode, new_param2)
|
|
||||||
node.param2 = new_param2
|
|
||||||
minetest.swap_node(pos, node)
|
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("mesecons_mvps") then
|
if minetest.get_modpath("mesecons_mvps") then
|
||||||
mesecon.register_on_mvps_move(function(moved_nodes)
|
mesecon.register_on_mvps_move(function(moved_nodes)
|
||||||
for _, n in ipairs(moved_nodes) do
|
for _, n in ipairs(moved_nodes) do
|
||||||
|
16
common.lua
16
common.lua
@ -86,9 +86,10 @@ function pipeworks.table_contains(tbl, element)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function pipeworks.table_extend(tbl, tbl2)
|
function pipeworks.table_extend(tbl, tbl2)
|
||||||
local oldlength = #tbl
|
local index = #tbl + 1
|
||||||
for i = 1,#tbl2 do
|
for _, elt in ipairs(tbl2) do
|
||||||
tbl[oldlength + i] = tbl2[i]
|
tbl[index] = elt
|
||||||
|
index = index + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ local fs_helpers = {}
|
|||||||
pipeworks.fs_helpers = fs_helpers
|
pipeworks.fs_helpers = fs_helpers
|
||||||
function fs_helpers.on_receive_fields(pos, fields)
|
function fs_helpers.on_receive_fields(pos, fields)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
for field in pairs(fields) do
|
for field, value in pairs(fields) do
|
||||||
if pipeworks.string_startswith(field, "fs_helpers_cycling:") then
|
if pipeworks.string_startswith(field, "fs_helpers_cycling:") then
|
||||||
local l = field:split(":")
|
local l = field:split(":")
|
||||||
local new_value = tonumber(l[2])
|
local new_value = tonumber(l[2])
|
||||||
@ -223,7 +224,7 @@ function pipeworks.create_fake_player(def, is_dynamic)
|
|||||||
return self._inventory:set_stack(def.wield_list,
|
return self._inventory:set_stack(def.wield_list,
|
||||||
self._wield_index, item)
|
self._wield_index, item)
|
||||||
end
|
end
|
||||||
self._wielded_item = ItemStack(item)
|
_wielded_item = ItemStack(item)
|
||||||
end,
|
end,
|
||||||
get_wielded_item = function(self, item)
|
get_wielded_item = function(self, item)
|
||||||
if self._inventory and def.wield_list then
|
if self._inventory and def.wield_list then
|
||||||
@ -242,18 +243,17 @@ function pipeworks.create_fake_player(def, is_dynamic)
|
|||||||
set_bone_position = delay(),
|
set_bone_position = delay(),
|
||||||
hud_change = delay(),
|
hud_change = delay(),
|
||||||
}
|
}
|
||||||
|
local _trash
|
||||||
-- Getter & setter functions
|
-- Getter & setter functions
|
||||||
p.get_inventory_formspec, p.set_inventory_formspec
|
p.get_inventory_formspec, p.set_inventory_formspec
|
||||||
= get_set_wrap("formspec", is_dynamic)
|
= get_set_wrap("formspec", is_dynamic)
|
||||||
p.get_breath, p.set_breath = get_set_wrap("breath", is_dynamic)
|
p.get_breath, p.set_breath = get_set_wrap("breath", is_dynamic)
|
||||||
p.get_hp, p.set_hp = get_set_wrap("hp", is_dynamic)
|
p.get_hp, p.set_hp = get_set_wrap("hp", is_dynamic)
|
||||||
p.get_pos, p.set_pos = get_set_wrap("pos", is_dynamic)
|
p.get_pos, p.set_pos = get_set_wrap("pos", is_dynamic)
|
||||||
|
_trash, p.move_to = get_set_wrap("pos", is_dynamic)
|
||||||
p.get_wield_index, p.set_wield_index = get_set_wrap("wield_index", true)
|
p.get_wield_index, p.set_wield_index = get_set_wrap("wield_index", true)
|
||||||
p.get_properties, p.set_properties = get_set_wrap("properties", false)
|
p.get_properties, p.set_properties = get_set_wrap("properties", false)
|
||||||
|
|
||||||
-- For players, move_to and get_pos do the same
|
|
||||||
p.move_to = p.get_pos
|
|
||||||
|
|
||||||
-- Backwards compatibilty
|
-- Backwards compatibilty
|
||||||
p.getpos = p.get_pos
|
p.getpos = p.get_pos
|
||||||
p.setpos = p.set_pos
|
p.setpos = p.set_pos
|
||||||
|
@ -65,7 +65,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
|
|
||||||
open_chests[pn] = nil
|
open_chests[pn] = nil
|
||||||
for _, v in pairs(open_chests) do
|
for k, v in pairs(open_chests) do
|
||||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -77,8 +77,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
pipeworks.after_place(pos)
|
pipeworks.after_place(pos)
|
||||||
end)
|
end)
|
||||||
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||||
elseif pipeworks.may_configure(pos, player) then
|
end
|
||||||
-- Pipeworks Switch
|
|
||||||
|
-- Pipeworks Switch
|
||||||
|
if pipeworks.may_configure(pos, player) and not fields.quit then
|
||||||
fs_helpers.on_receive_fields(pos, fields)
|
fs_helpers.on_receive_fields(pos, fields)
|
||||||
minetest.show_formspec(player:get_player_name(), "pipeworks:chest_formspec", get_chest_formspec(pos))
|
minetest.show_formspec(player:get_player_name(), "pipeworks:chest_formspec", get_chest_formspec(pos))
|
||||||
end
|
end
|
||||||
@ -144,8 +146,7 @@ override_protected = {
|
|||||||
input_inventory = "main",
|
input_inventory = "main",
|
||||||
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1}
|
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1}
|
||||||
},
|
},
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig
|
||||||
on_rotate = pipeworks.on_rotate
|
|
||||||
}
|
}
|
||||||
override = {
|
override = {
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -189,8 +190,7 @@ override = {
|
|||||||
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1}
|
connect_sides = {left = 1, right = 1, back = 1, bottom = 1, top = 1}
|
||||||
},
|
},
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig
|
||||||
on_rotate = pipeworks.on_rotate
|
|
||||||
}
|
}
|
||||||
--[[local override_common = {
|
--[[local override_common = {
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ override.tiles = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Add the extra groups
|
-- Add the extra groups
|
||||||
for _,v in ipairs({override_protected, override, override_open, override_protected_open}) do
|
for i,v in ipairs({override_protected, override, override_open, override_protected_open}) do
|
||||||
v.groups.tubedevice = 1
|
v.groups.tubedevice = 1
|
||||||
v.groups.tubedevice_receiver = 1
|
v.groups.tubedevice_receiver = 1
|
||||||
end
|
end
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
|
|
||||||
-- this file is basically a modified copy of
|
-- this file is basically a modified copy of
|
||||||
-- minetest_game/mods/default/furnaces.lua
|
-- minetest_game/mods/default/furnaces.lua
|
||||||
|
|
||||||
-- translation support
|
|
||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local DS = minetest.get_translator("default")
|
|
||||||
|
|
||||||
local fs_helpers = pipeworks.fs_helpers
|
local fs_helpers = pipeworks.fs_helpers
|
||||||
|
|
||||||
local tube_entry = "^pipeworks_tube_connection_stony.png"
|
tube_entry = "^pipeworks_tube_connection_stony.png"
|
||||||
|
|
||||||
local function active_formspec(fuel_percent, item_percent, pos, meta)
|
local function active_formspec(fuel_percent, item_percent, pos, meta)
|
||||||
local formspec =
|
local formspec =
|
||||||
@ -39,7 +36,7 @@ local function active_formspec(fuel_percent, item_percent, pos, meta)
|
|||||||
pipeworks.button_off,
|
pipeworks.button_off,
|
||||||
pipeworks.button_on
|
pipeworks.button_on
|
||||||
}
|
}
|
||||||
).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]"
|
).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -70,7 +67,7 @@ local function inactive_formspec(pos, meta)
|
|||||||
pipeworks.button_off,
|
pipeworks.button_off,
|
||||||
pipeworks.button_on
|
pipeworks.button_on
|
||||||
}
|
}
|
||||||
).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]"
|
).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,7 +90,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|||||||
if listname == "fuel" then
|
if listname == "fuel" then
|
||||||
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||||
if inv:is_empty("src") then
|
if inv:is_empty("src") then
|
||||||
meta:set_string("infotext", DS("Furnace is empty"))
|
meta:set_string("infotext", "Furnace is empty")
|
||||||
end
|
end
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
else
|
else
|
||||||
@ -222,40 +219,40 @@ local function furnace_node_timer(pos, elapsed)
|
|||||||
if cookable then
|
if cookable then
|
||||||
item_percent = math.floor(src_time / cooked.time * 100)
|
item_percent = math.floor(src_time / cooked.time * 100)
|
||||||
if item_percent > 100 then
|
if item_percent > 100 then
|
||||||
item_state = DS("100% (output full)")
|
item_state = "100% (output full)"
|
||||||
else
|
else
|
||||||
item_state = DS("@1%", item_percent)
|
item_state = item_percent .. "%"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if srclist[1]:is_empty() then
|
if srclist[1]:is_empty() then
|
||||||
item_state = DS("Empty")
|
item_state = "Empty"
|
||||||
else
|
else
|
||||||
item_state = DS("Not cookable")
|
item_state = "Not cookable"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local fuel_state = DS("Empty")
|
local fuel_state = "Empty"
|
||||||
local active = DS("Furnace inactive")
|
local active = "inactive "
|
||||||
local result = false
|
local result = false
|
||||||
|
|
||||||
if fuel_totaltime ~= 0 then
|
if fuel_totaltime ~= 0 then
|
||||||
active = DS("Furnace active")
|
active = "active "
|
||||||
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
|
||||||
fuel_state = DS("@1%", fuel_percent)
|
fuel_state = fuel_percent .. "%"
|
||||||
formspec = active_formspec(fuel_percent, item_percent, pos, meta)
|
formspec = active_formspec(fuel_percent, item_percent, pos, meta)
|
||||||
swap_node(pos, "default:furnace_active")
|
swap_node(pos, "default:furnace_active")
|
||||||
-- make sure timer restarts automatically
|
-- make sure timer restarts automatically
|
||||||
result = true
|
result = true
|
||||||
else
|
else
|
||||||
if not fuellist[1]:is_empty() then
|
if not fuellist[1]:is_empty() then
|
||||||
fuel_state = DS("@1%", "0")
|
fuel_state = "0%"
|
||||||
end
|
end
|
||||||
swap_node(pos, "default:furnace")
|
swap_node(pos, "default:furnace")
|
||||||
-- stop timer on the inactive furnace
|
-- stop timer on the inactive furnace
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
local infotext = active.." "..DS("(Item: @1; Fuel: @2)", item_state, fuel_state)
|
local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")"
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Set meta values
|
-- Set meta values
|
||||||
@ -274,7 +271,7 @@ end
|
|||||||
--
|
--
|
||||||
|
|
||||||
minetest.register_node(":default:furnace", {
|
minetest.register_node(":default:furnace", {
|
||||||
description = DS("Furnace"),
|
description = "Furnace",
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_furnace_top.png"..tube_entry,
|
"default_furnace_top.png"..tube_entry,
|
||||||
"default_furnace_bottom.png"..tube_entry,
|
"default_furnace_bottom.png"..tube_entry,
|
||||||
@ -358,12 +355,11 @@ minetest.register_node(":default:furnace", {
|
|||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
end,
|
end,
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig
|
||||||
on_rotate = pipeworks.on_rotate
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(":default:furnace_active", {
|
minetest.register_node(":default:furnace_active", {
|
||||||
description = DS("Furnace"),
|
description = "Furnace",
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_furnace_top.png"..tube_entry,
|
"default_furnace_top.png"..tube_entry,
|
||||||
"default_furnace_bottom.png"..tube_entry,
|
"default_furnace_bottom.png"..tube_entry,
|
||||||
@ -432,7 +428,6 @@ minetest.register_node(":default:furnace_active", {
|
|||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
end,
|
end,
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig
|
||||||
on_rotate = pipeworks.on_rotate
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
85
crafts.lua
85
crafts.lua
@ -85,3 +85,88 @@ minetest.register_craft( {
|
|||||||
{ "pipeworks:pipe_1_empty" }
|
{ "pipeworks:pipe_1_empty" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Crafting recipes for pneumatic tubes
|
||||||
|
|
||||||
|
-- If homedecor is not installed, we need to register its crafting chain for
|
||||||
|
-- plastic sheeting so that pipeworks remains compatible with it.
|
||||||
|
|
||||||
|
if minetest.get_modpath("homedecor") == nil then
|
||||||
|
|
||||||
|
minetest.register_craftitem(":homedecor:oil_extract", {
|
||||||
|
description = "Oil extract",
|
||||||
|
inventory_image = "homedecor_oil_extract.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem(":homedecor:paraffin", {
|
||||||
|
description = "Unprocessed paraffin",
|
||||||
|
inventory_image = "homedecor_paraffin.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_alias("homedecor:plastic_base", "homedecor:paraffin")
|
||||||
|
|
||||||
|
minetest.register_craftitem(":homedecor:plastic_sheeting", {
|
||||||
|
description = "Plastic sheet",
|
||||||
|
inventory_image = "homedecor_plastic_sheeting.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "homedecor:oil_extract 4",
|
||||||
|
recipe = {
|
||||||
|
"group:leaves",
|
||||||
|
"group:leaves",
|
||||||
|
"group:leaves",
|
||||||
|
"group:leaves",
|
||||||
|
"group:leaves",
|
||||||
|
"group:leaves"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "homedecor:paraffin",
|
||||||
|
recipe = "homedecor:oil_extract",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "homedecor:plastic_sheeting",
|
||||||
|
recipe = "homedecor:paraffin",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:oil_extract",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:paraffin",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:plastic_sheeting",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- crafting items for creating node breakers
|
||||||
|
minetest.register_craftitem("pipeworks:gear", {
|
||||||
|
description = "Gear",
|
||||||
|
inventory_image = "pipeworks_gear.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "pipeworks:gear 6",
|
||||||
|
recipe = {
|
||||||
|
{ "", "default:steel_ingot", "" },
|
||||||
|
{ "default:steel_ingot","default:stone", "default:steel_ingot" },
|
||||||
|
{ "", "default:steel_ingot", "" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
|
|
||||||
local straight = function(pos, node, velocity, stack) return {velocity} end
|
local straight = function(pos, node, velocity, stack) return {velocity} end
|
||||||
|
|
||||||
minetest.register_node("pipeworks:steel_block_embedded_tube", {
|
minetest.register_node("pipeworks:steel_block_embedded_tube", {
|
||||||
description = S("Airtight steelblock embedded tube"),
|
description = "Airtight steelblock embedded tube",
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_steel_block.png", "default_steel_block.png",
|
"default_steel_block.png", "default_steel_block.png",
|
||||||
"default_steel_block.png", "default_steel_block.png",
|
"default_steel_block.png", "default_steel_block.png",
|
||||||
@ -26,7 +24,6 @@ minetest.register_node("pipeworks:steel_block_embedded_tube", {
|
|||||||
},
|
},
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
@ -47,7 +44,7 @@ local pane_box = {
|
|||||||
}
|
}
|
||||||
minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
description = S("Airtight panel embedded tube"),
|
description = "Airtight panel embedded tube ",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_pane_embedded_tube_sides.png^[transformR90",
|
"pipeworks_pane_embedded_tube_sides.png^[transformR90",
|
||||||
"pipeworks_pane_embedded_tube_sides.png^[transformR90",
|
"pipeworks_pane_embedded_tube_sides.png^[transformR90",
|
||||||
@ -74,7 +71,6 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
|||||||
},
|
},
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
|
4
depends.txt
Normal file
4
depends.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
default
|
||||||
|
mesecons
|
||||||
|
mesecons_mvps
|
||||||
|
digilines?
|
1
description.txt
Normal file
1
description.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them.
|
121
devices.lua
121
devices.lua
@ -1,4 +1,3 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local new_flow_logic_register = pipeworks.flowables.register
|
local new_flow_logic_register = pipeworks.flowables.register
|
||||||
|
|
||||||
local polys = ""
|
local polys = ""
|
||||||
@ -10,7 +9,7 @@ function pipeworks.fix_after_rotation(pos, node, user, mode, new_param2)
|
|||||||
|
|
||||||
if string.find(node.name, "spigot") then new_param2 = new_param2 % 4 end
|
if string.find(node.name, "spigot") then new_param2 = new_param2 % 4 end
|
||||||
|
|
||||||
local newnode = string.gsub(node.name, "_on", "_off")
|
newnode = string.gsub(node.name, "_on", "_off")
|
||||||
minetest.swap_node(pos, { name = newnode, param2 = new_param2 })
|
minetest.swap_node(pos, { name = newnode, param2 = new_param2 })
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ end
|
|||||||
function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
|
function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
local playername = placer:get_player_name()
|
local playername = placer:get_player_name()
|
||||||
if not minetest.is_protected(pointed_thing.under, playername)
|
if not minetest.is_protected(pointed_thing.under, playername)
|
||||||
and not minetest.is_protected(pointed_thing.above, playername) then
|
and not minetest.is_protected(pointed_thing.above, playername) then
|
||||||
|
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
@ -36,7 +35,9 @@ function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
|
|||||||
local under = pointed_thing.under
|
local under = pointed_thing.under
|
||||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
local undernode = minetest.get_node(under)
|
local undernode = minetest.get_node(under)
|
||||||
|
local abovenode = minetest.get_node(above)
|
||||||
local uname = undernode.name
|
local uname = undernode.name
|
||||||
|
local aname = abovenode.name
|
||||||
local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
|
local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
|
||||||
local pos1 = above
|
local pos1 = above
|
||||||
|
|
||||||
@ -103,7 +104,6 @@ if minetest.get_modpath("mesecons") then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
local pipes_devicelist = {
|
local pipes_devicelist = {
|
||||||
"pump",
|
"pump",
|
||||||
"valve",
|
"valve",
|
||||||
@ -119,15 +119,14 @@ local pipes_devicelist = {
|
|||||||
"storage_tank_9",
|
"storage_tank_9",
|
||||||
"storage_tank_10"
|
"storage_tank_10"
|
||||||
}
|
}
|
||||||
--]]
|
|
||||||
|
|
||||||
-- Now define the nodes.
|
-- Now define the nodes.
|
||||||
|
|
||||||
local states = { "on", "off" }
|
local states = { "on", "off" }
|
||||||
|
local dgroups = ""
|
||||||
|
|
||||||
for s in ipairs(states) do
|
for s in ipairs(states) do
|
||||||
|
|
||||||
local dgroups
|
|
||||||
if states[s] == "off" then
|
if states[s] == "off" then
|
||||||
dgroups = {snappy=3, pipe=1}
|
dgroups = {snappy=3, pipe=1}
|
||||||
else
|
else
|
||||||
@ -136,14 +135,14 @@ for s in ipairs(states) do
|
|||||||
|
|
||||||
local pumpname = "pipeworks:pump_"..states[s]
|
local pumpname = "pipeworks:pump_"..states[s]
|
||||||
minetest.register_node(pumpname, {
|
minetest.register_node(pumpname, {
|
||||||
description = S("Pump/Intake Module"),
|
description = "Pump/Intake Module",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_pump"..polys..".obj",
|
mesh = "pipeworks_pump"..polys..".obj",
|
||||||
tiles = { "pipeworks_pump_"..states[s]..".png" },
|
tiles = { "pipeworks_pump_"..states[s]..".png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = dgroups,
|
groups = dgroups,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { top = 1 },
|
pipe_connections = { top = 1 },
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -179,7 +178,7 @@ for s in ipairs(states) do
|
|||||||
|
|
||||||
local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty"
|
local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty"
|
||||||
minetest.register_node(nodename_valve_empty, {
|
minetest.register_node(nodename_valve_empty, {
|
||||||
description = S("Valve"),
|
description = "Valve",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_valve_"..states[s]..polys..".obj",
|
mesh = "pipeworks_valve_"..states[s]..polys..".obj",
|
||||||
tiles = { "pipeworks_valve.png" },
|
tiles = { "pipeworks_valve.png" },
|
||||||
@ -187,15 +186,15 @@ for s in ipairs(states) do
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||||
},
|
},
|
||||||
collision_box = {
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||||
},
|
},
|
||||||
groups = dgroups,
|
groups = dgroups,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -225,7 +224,7 @@ end
|
|||||||
|
|
||||||
local nodename_valve_loaded = "pipeworks:valve_on_loaded"
|
local nodename_valve_loaded = "pipeworks:valve_on_loaded"
|
||||||
minetest.register_node(nodename_valve_loaded, {
|
minetest.register_node(nodename_valve_loaded, {
|
||||||
description = S("Valve"),
|
description = "Valve",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_valve_on"..polys..".obj",
|
mesh = "pipeworks_valve_on"..polys..".obj",
|
||||||
tiles = { "pipeworks_valve.png" },
|
tiles = { "pipeworks_valve.png" },
|
||||||
@ -233,15 +232,15 @@ minetest.register_node(nodename_valve_loaded, {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||||
},
|
},
|
||||||
collision_box = {
|
collision_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
||||||
},
|
},
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -273,7 +272,7 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_valve_loaded, true
|
|||||||
|
|
||||||
-- FIXME: should this do anything useful in the new flow logic?
|
-- FIXME: should this do anything useful in the new flow logic?
|
||||||
minetest.register_node("pipeworks:grating", {
|
minetest.register_node("pipeworks:grating", {
|
||||||
description = S("Decorative grating"),
|
description = "Decorative grating",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_grating_top.png",
|
"pipeworks_grating_top.png",
|
||||||
"pipeworks_grating_sides.png",
|
"pipeworks_grating_sides.png",
|
||||||
@ -290,7 +289,7 @@ minetest.register_node("pipeworks:grating", {
|
|||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { top = 1 },
|
pipe_connections = { top = 1 },
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -306,7 +305,7 @@ minetest.register_node("pipeworks:grating", {
|
|||||||
|
|
||||||
local nodename_spigot_empty = "pipeworks:spigot"
|
local nodename_spigot_empty = "pipeworks:spigot"
|
||||||
minetest.register_node(nodename_spigot_empty, {
|
minetest.register_node(nodename_spigot_empty, {
|
||||||
description = S("Spigot outlet"),
|
description = "Spigot outlet",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_spigot"..polys..".obj",
|
mesh = "pipeworks_spigot"..polys..".obj",
|
||||||
tiles = { "pipeworks_spigot.png" },
|
tiles = { "pipeworks_spigot.png" },
|
||||||
@ -314,7 +313,7 @@ minetest.register_node(nodename_spigot_empty, {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { left=1, right=1, front=1, back=1,
|
pipe_connections = { left=1, right=1, front=1, back=1,
|
||||||
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
||||||
@ -337,7 +336,7 @@ minetest.register_node(nodename_spigot_empty, {
|
|||||||
|
|
||||||
local nodename_spigot_loaded = "pipeworks:spigot_pouring"
|
local nodename_spigot_loaded = "pipeworks:spigot_pouring"
|
||||||
minetest.register_node(nodename_spigot_loaded, {
|
minetest.register_node(nodename_spigot_loaded, {
|
||||||
description = S("Spigot outlet"),
|
description = "Spigot outlet",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_spigot_pouring"..polys..".obj",
|
mesh = "pipeworks_spigot_pouring"..polys..".obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -356,7 +355,7 @@ minetest.register_node(nodename_spigot_loaded, {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { left=1, right=1, front=1, back=1,
|
pipe_connections = { left=1, right=1, front=1, back=1,
|
||||||
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
||||||
@ -403,14 +402,14 @@ local panel_cbox = {
|
|||||||
|
|
||||||
local nodename_panel_empty = "pipeworks:entry_panel_empty"
|
local nodename_panel_empty = "pipeworks:entry_panel_empty"
|
||||||
minetest.register_node(nodename_panel_empty, {
|
minetest.register_node(nodename_panel_empty, {
|
||||||
description = S("Airtight Pipe entry/exit"),
|
description = "Airtight Pipe entry/exit",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_entry_panel"..polys..".obj",
|
mesh = "pipeworks_entry_panel"..polys..".obj",
|
||||||
tiles = { "pipeworks_entry_panel.png" },
|
tiles = { "pipeworks_entry_panel.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -423,14 +422,14 @@ minetest.register_node(nodename_panel_empty, {
|
|||||||
|
|
||||||
local nodename_panel_loaded = "pipeworks:entry_panel_loaded"
|
local nodename_panel_loaded = "pipeworks:entry_panel_loaded"
|
||||||
minetest.register_node(nodename_panel_loaded, {
|
minetest.register_node(nodename_panel_loaded, {
|
||||||
description = S("Airtight Pipe entry/exit"),
|
description = "Airtight Pipe entry/exit",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_entry_panel"..polys..".obj",
|
mesh = "pipeworks_entry_panel"..polys..".obj",
|
||||||
tiles = { "pipeworks_entry_panel.png" },
|
tiles = { "pipeworks_entry_panel.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -449,7 +448,7 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_panel_loaded, true
|
|||||||
|
|
||||||
local nodename_sensor_empty = "pipeworks:flow_sensor_empty"
|
local nodename_sensor_empty = "pipeworks:flow_sensor_empty"
|
||||||
minetest.register_node(nodename_sensor_empty, {
|
minetest.register_node(nodename_sensor_empty, {
|
||||||
description = S("Flow Sensor"),
|
description = "Flow Sensor",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_flow_sensor"..polys..".obj",
|
mesh = "pipeworks_flow_sensor"..polys..".obj",
|
||||||
tiles = { "pipeworks_flow_sensor_off.png" },
|
tiles = { "pipeworks_flow_sensor_off.png" },
|
||||||
@ -457,7 +456,7 @@ minetest.register_node(nodename_sensor_empty, {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -465,7 +464,7 @@ minetest.register_node(nodename_sensor_empty, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_off(pos, pipeworks.mesecons_rules)
|
mesecon.receptor_off(pos, rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -488,7 +487,7 @@ minetest.register_node(nodename_sensor_empty, {
|
|||||||
|
|
||||||
local nodename_sensor_loaded = "pipeworks:flow_sensor_loaded"
|
local nodename_sensor_loaded = "pipeworks:flow_sensor_loaded"
|
||||||
minetest.register_node(nodename_sensor_loaded, {
|
minetest.register_node(nodename_sensor_loaded, {
|
||||||
description = S("Flow sensor (on)"),
|
description = "Flow sensor (on)",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_flow_sensor"..polys..".obj",
|
mesh = "pipeworks_flow_sensor"..polys..".obj",
|
||||||
tiles = { "pipeworks_flow_sensor_on.png" },
|
tiles = { "pipeworks_flow_sensor_on.png" },
|
||||||
@ -496,7 +495,7 @@ minetest.register_node(nodename_sensor_loaded, {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -504,7 +503,7 @@ minetest.register_node(nodename_sensor_loaded, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
mesecon.receptor_on(pos, rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -537,18 +536,18 @@ new_flow_logic_register.transition_simple_set(sensor_pressure_set, { mesecons=pi
|
|||||||
|
|
||||||
-- TODO flow-logic-stub: these don't currently do anything under the new flow logic.
|
-- TODO flow-logic-stub: these don't currently do anything under the new flow logic.
|
||||||
for fill = 0, 10 do
|
for fill = 0, 10 do
|
||||||
local filldesc=S("empty")
|
local filldesc="empty"
|
||||||
local sgroups = {snappy=3, pipe=1, tankfill=fill+1}
|
local sgroups = {snappy=3, pipe=1, tankfill=fill+1}
|
||||||
local image = nil
|
local image = nil
|
||||||
|
|
||||||
if fill ~= 0 then
|
if fill ~= 0 then
|
||||||
filldesc=S("@1% full", 10*fill)
|
filldesc=fill.."0% full"
|
||||||
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
|
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
|
||||||
image = "pipeworks_storage_tank_fittings.png"
|
image = "pipeworks_storage_tank_fittings.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("pipeworks:expansion_tank_"..fill, {
|
minetest.register_node("pipeworks:expansion_tank_"..fill, {
|
||||||
description = S("Expansion Tank (@1)", filldesc),
|
description = "Expansion Tank ("..filldesc..")... You hacker, you.",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_storage_tank_fittings.png",
|
"pipeworks_storage_tank_fittings.png",
|
||||||
"pipeworks_storage_tank_fittings.png",
|
"pipeworks_storage_tank_fittings.png",
|
||||||
@ -561,7 +560,7 @@ for fill = 0, 10 do
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
drop = "pipeworks:storage_tank_0",
|
drop = "pipeworks:storage_tank_0",
|
||||||
pipe_connections = { top = 1, bottom = 1},
|
pipe_connections = { top = 1, bottom = 1},
|
||||||
@ -576,7 +575,7 @@ for fill = 0, 10 do
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("pipeworks:storage_tank_"..fill, {
|
minetest.register_node("pipeworks:storage_tank_"..fill, {
|
||||||
description = S("Fluid Storage Tank (@1)", filldesc),
|
description = "Fluid Storage Tank ("..filldesc..")",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_storage_tank_fittings.png",
|
"pipeworks_storage_tank_fittings.png",
|
||||||
"pipeworks_storage_tank_fittings.png",
|
"pipeworks_storage_tank_fittings.png",
|
||||||
@ -589,7 +588,7 @@ for fill = 0, 10 do
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = sgroups,
|
groups = sgroups,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
drop = "pipeworks:storage_tank_0",
|
drop = "pipeworks:storage_tank_0",
|
||||||
pipe_connections = { top = 1, bottom = 1},
|
pipe_connections = { top = 1, bottom = 1},
|
||||||
@ -608,14 +607,14 @@ end
|
|||||||
|
|
||||||
local nodename_fountain_empty = "pipeworks:fountainhead"
|
local nodename_fountain_empty = "pipeworks:fountainhead"
|
||||||
minetest.register_node(nodename_fountain_empty, {
|
minetest.register_node(nodename_fountain_empty, {
|
||||||
description = S("Fountainhead"),
|
description = "Fountainhead",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_fountainhead"..polys..".obj",
|
mesh = "pipeworks_fountainhead"..polys..".obj",
|
||||||
tiles = { "pipeworks_fountainhead.png" },
|
tiles = { "pipeworks_fountainhead.png" },
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { bottom = 1 },
|
pipe_connections = { bottom = 1 },
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -626,7 +625,7 @@ minetest.register_node(nodename_fountain_empty, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
mesecon.receptor_on(pos, rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -642,14 +641,14 @@ minetest.register_node(nodename_fountain_empty, {
|
|||||||
|
|
||||||
local nodename_fountain_loaded = "pipeworks:fountainhead_pouring"
|
local nodename_fountain_loaded = "pipeworks:fountainhead_pouring"
|
||||||
minetest.register_node(nodename_fountain_loaded, {
|
minetest.register_node(nodename_fountain_loaded, {
|
||||||
description = S("Fountainhead"),
|
description = "Fountainhead",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_fountainhead"..polys..".obj",
|
mesh = "pipeworks_fountainhead"..polys..".obj",
|
||||||
tiles = { "pipeworks_fountainhead.png" },
|
tiles = { "pipeworks_fountainhead.png" },
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
pipe_connections = { bottom = 1 },
|
pipe_connections = { bottom = 1 },
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -661,7 +660,7 @@ minetest.register_node(nodename_fountain_loaded, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
mesecon.receptor_on(pos, rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -692,14 +691,14 @@ local sp_cbox = {
|
|||||||
|
|
||||||
local nodename_sp_empty = "pipeworks:straight_pipe_empty"
|
local nodename_sp_empty = "pipeworks:straight_pipe_empty"
|
||||||
minetest.register_node(nodename_sp_empty, {
|
minetest.register_node(nodename_sp_empty, {
|
||||||
description = S("Straight-only Pipe"),
|
description = "Straight-only Pipe",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_straight_pipe"..polys..".obj",
|
mesh = "pipeworks_straight_pipe"..polys..".obj",
|
||||||
tiles = { "pipeworks_straight_pipe_empty.png" },
|
tiles = { "pipeworks_straight_pipe_empty.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1},
|
groups = {snappy=3, pipe=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -707,21 +706,19 @@ minetest.register_node(nodename_sp_empty, {
|
|||||||
end,
|
end,
|
||||||
selection_box = sp_cbox,
|
selection_box = sp_cbox,
|
||||||
collision_box = sp_cbox,
|
collision_box = sp_cbox,
|
||||||
on_rotate = pipeworks.fix_after_rotation,
|
on_rotate = pipeworks.fix_after_rotation
|
||||||
check_for_pole = pipeworks.check_for_vert_pipe,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_pipe
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local nodename_sp_loaded = "pipeworks:straight_pipe_loaded"
|
local nodename_sp_loaded = "pipeworks:straight_pipe_loaded"
|
||||||
minetest.register_node(nodename_sp_loaded, {
|
minetest.register_node(nodename_sp_loaded, {
|
||||||
description = S("Straight-only Pipe"),
|
description = "Straight-only Pipe",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "pipeworks_straight_pipe"..polys..".obj",
|
mesh = "pipeworks_straight_pipe"..polys..".obj",
|
||||||
tiles = { "pipeworks_straight_pipe_loaded.png" },
|
tiles = { "pipeworks_straight_pipe_loaded.png" },
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -730,9 +727,7 @@ minetest.register_node(nodename_sp_loaded, {
|
|||||||
selection_box = sp_cbox,
|
selection_box = sp_cbox,
|
||||||
collision_box = sp_cbox,
|
collision_box = sp_cbox,
|
||||||
drop = "pipeworks:straight_pipe_empty",
|
drop = "pipeworks:straight_pipe_empty",
|
||||||
on_rotate = pipeworks.fix_after_rotation,
|
on_rotate = pipeworks.fix_after_rotation
|
||||||
check_for_pole = pipeworks.check_for_vert_pipe,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_pipe
|
|
||||||
})
|
})
|
||||||
|
|
||||||
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true)
|
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true)
|
||||||
@ -743,3 +738,21 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_sp_loaded, true)
|
|||||||
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
|
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
|
||||||
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")
|
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = "pipeworks:rotate_valves_flowsensors",
|
||||||
|
label = "Flip pipeworks valves and flow sensors around X/Z",
|
||||||
|
run_at_every_load = false,
|
||||||
|
nodenames = {
|
||||||
|
"pipeworks:flow_sensor_empty",
|
||||||
|
"pipeworks:flow_sensor_loaded",
|
||||||
|
"pipeworks:valve_off_empty",
|
||||||
|
"pipeworks:valve_on_empty",
|
||||||
|
"pipeworks:valve_off_loaded",
|
||||||
|
},
|
||||||
|
action = function(pos, node)
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
local newdir = { x=dir.z, y=dir.y, z=dir.x }
|
||||||
|
local newfdir = minetest.dir_to_facedir(newdir)
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = newfdir })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
@ -1,48 +1,51 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local fs_helpers = pipeworks.fs_helpers
|
local fs_helpers = pipeworks.fs_helpers
|
||||||
|
|
||||||
|
local function delay(x)
|
||||||
|
return (function() return x end)
|
||||||
|
end
|
||||||
|
|
||||||
local function set_filter_infotext(data, meta)
|
local function set_filter_infotext(data, meta)
|
||||||
local infotext = S("@1 Filter-Injector", data.wise_desc)
|
local infotext = data.wise_desc.." Filter-Injector"
|
||||||
if meta:get_int("slotseq_mode") == 2 then
|
if meta:get_int("slotseq_mode") == 2 then
|
||||||
infotext = infotext .. " "..S("(slot #@1 next)", meta:get_int("slotseq_index"))
|
infotext = infotext .. " (slot #"..meta:get_int("slotseq_index").." next)"
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", infotext)
|
meta:set_string("infotext", infotext)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_filter_formspec(data, meta)
|
local function set_filter_formspec(data, meta)
|
||||||
local itemname = S("@1 Filter-Injector", data.wise_desc)
|
local itemname = data.wise_desc.." Filter-Injector"
|
||||||
|
|
||||||
local formspec
|
local formspec
|
||||||
if data.digiline then
|
if data.digiline then
|
||||||
formspec = "size[8,2.7]"..
|
formspec = "size[8,2.7]"..
|
||||||
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
|
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
|
||||||
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
|
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
|
||||||
"field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]"..
|
"field[0.3,1.5;8.0,1;channel;Channel;${channel}]"..
|
||||||
fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode",
|
fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode",
|
||||||
{S("Sequence slots by Priority"),
|
{"Sequence slots by Priority",
|
||||||
S("Sequence slots Randomly"),
|
"Sequence slots Randomly",
|
||||||
S("Sequence slots by Rotation")})..
|
"Sequence slots by Rotation"})..
|
||||||
fs_helpers.cycling_button(meta, "button[4,2;4,1", "exmatch_mode",
|
fs_helpers.cycling_button(meta, "button[4,2;4,1", "exmatch_mode",
|
||||||
{S("Exact match - off"),
|
{"Exact match - off",
|
||||||
S("Exact match - on")})
|
"Exact match - on "})
|
||||||
else
|
else
|
||||||
local exmatch_button = ""
|
local exmatch_button = ""
|
||||||
if data.stackwise then
|
if data.stackwise then
|
||||||
exmatch_button =
|
exmatch_button =
|
||||||
fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode",
|
fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode",
|
||||||
{S("Exact match - off"),
|
{"Exact match - off",
|
||||||
S("Exact match - on")})
|
"Exact match - on "})
|
||||||
end
|
end
|
||||||
|
|
||||||
formspec = "size[8,8.5]"..
|
formspec = "size[8,8.5]"..
|
||||||
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
|
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
|
||||||
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
|
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
|
||||||
"label[0,1;"..S("Prefer item types:").."]"..
|
"label[0,1;Prefer item types:]"..
|
||||||
"list[context;main;0,1.5;8,2;]"..
|
"list[context;main;0,1.5;8,2;]"..
|
||||||
fs_helpers.cycling_button(meta, "button[0,3.5;4,1", "slotseq_mode",
|
fs_helpers.cycling_button(meta, "button[0,3.5;4,1", "slotseq_mode",
|
||||||
{S("Sequence slots by Priority"),
|
{"Sequence slots by Priority",
|
||||||
S("Sequence slots Randomly"),
|
"Sequence slots Randomly",
|
||||||
S("Sequence slots by Rotation")})..
|
"Sequence slots by Rotation"})..
|
||||||
exmatch_button..
|
exmatch_button..
|
||||||
"list[current_player;main;0,4.5;8,4;]" ..
|
"list[current_player;main;0,4.5;8,4;]" ..
|
||||||
"listring[]"
|
"listring[]"
|
||||||
@ -50,6 +53,116 @@ local function set_filter_formspec(data, meta)
|
|||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- todo SOON: this function has *way too many* parameters
|
||||||
|
local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all,digiline)
|
||||||
|
local sposes = {}
|
||||||
|
if not frominvname or not frominv:get_list(frominvname) then return end
|
||||||
|
for spos,stack in ipairs(frominv:get_list(frominvname)) do
|
||||||
|
local matches
|
||||||
|
if filterfor == "" then
|
||||||
|
matches = stack:get_name() ~= ""
|
||||||
|
else
|
||||||
|
local fname = filterfor.name
|
||||||
|
local fgroup = filterfor.group
|
||||||
|
local fwear = filterfor.wear
|
||||||
|
local fmetadata = filterfor.metadata
|
||||||
|
matches = (not fname -- If there's a name filter,
|
||||||
|
or stack:get_name() == fname) -- it must match.
|
||||||
|
|
||||||
|
and (not fgroup -- If there's a group filter,
|
||||||
|
or (type(fgroup) == "string" -- it must be a string
|
||||||
|
and minetest.get_item_group( -- and it must match.
|
||||||
|
stack:get_name(), fgroup) ~= 0))
|
||||||
|
|
||||||
|
and (not fwear -- If there's a wear filter:
|
||||||
|
or (type(fwear) == "number" -- If it's a number,
|
||||||
|
and stack:get_wear() == fwear) -- it must match.
|
||||||
|
or (type(fwear) == "table" -- If it's a table:
|
||||||
|
and (not fwear[1] -- If there's a lower bound,
|
||||||
|
or (type(fwear[1]) == "number" -- it must be a number
|
||||||
|
and fwear[1] <= stack:get_wear())) -- and it must be <= the actual wear.
|
||||||
|
and (not fwear[2] -- If there's an upper bound
|
||||||
|
or (type(fwear[2]) == "number" -- it must be a number
|
||||||
|
and stack:get_wear() < fwear[2])))) -- and it must be > the actual wear.
|
||||||
|
-- If the wear filter is of any other type, fail.
|
||||||
|
--
|
||||||
|
and (not fmetadata -- If there's a matadata filter,
|
||||||
|
or (type(fmetadata) == "string" -- it must be a string
|
||||||
|
and stack:get_metadata() == fmetadata)) -- and it must match.
|
||||||
|
end
|
||||||
|
if matches then table.insert(sposes, spos) end
|
||||||
|
end
|
||||||
|
if #sposes == 0 then return false end
|
||||||
|
if slotseq_mode == 1 then
|
||||||
|
for i = #sposes, 2, -1 do
|
||||||
|
local j = math.random(i)
|
||||||
|
local t = sposes[j]
|
||||||
|
sposes[j] = sposes[i]
|
||||||
|
sposes[i] = t
|
||||||
|
end
|
||||||
|
elseif slotseq_mode == 2 then
|
||||||
|
local headpos = filtmeta:get_int("slotseq_index")
|
||||||
|
table.sort(sposes, function (a, b)
|
||||||
|
if a >= headpos then
|
||||||
|
if b < headpos then return true end
|
||||||
|
else
|
||||||
|
if b >= headpos then return false end
|
||||||
|
end
|
||||||
|
return a < b
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
for _, spos in ipairs(sposes) do
|
||||||
|
local stack = frominv:get_stack(frominvname, spos)
|
||||||
|
local doRemove = stack:get_count()
|
||||||
|
if fromtube.can_remove then
|
||||||
|
doRemove = fromtube.can_remove(frompos, fromnode, stack, dir, frominvname, spos)
|
||||||
|
elseif fromdef.allow_metadata_inventory_take then
|
||||||
|
doRemove = fromdef.allow_metadata_inventory_take(frompos, frominvname,spos, stack, fakePlayer)
|
||||||
|
end
|
||||||
|
-- stupid lack of continue statements grumble
|
||||||
|
if doRemove > 0 then
|
||||||
|
if slotseq_mode == 2 then
|
||||||
|
local nextpos = spos + 1
|
||||||
|
if nextpos > frominv:get_size(frominvname) then
|
||||||
|
nextpos = 1
|
||||||
|
end
|
||||||
|
filtmeta:set_int("slotseq_index", nextpos)
|
||||||
|
set_filter_infotext(data, filtmeta)
|
||||||
|
end
|
||||||
|
local item
|
||||||
|
local count
|
||||||
|
if all then
|
||||||
|
count = math.min(stack:get_count(), doRemove)
|
||||||
|
if filterfor.count and (filterfor.count > 1 or digiline) then
|
||||||
|
if exmatch_mode ~= 0 and filterfor.count > count then
|
||||||
|
return false -- not enough, fail
|
||||||
|
else
|
||||||
|
-- limit quantity to filter amount
|
||||||
|
count = math.min(filterfor.count, count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
count = 1
|
||||||
|
end
|
||||||
|
if fromtube.remove_items then
|
||||||
|
-- it could be the entire stack...
|
||||||
|
item = fromtube.remove_items(frompos, fromnode, stack, dir, count, frominvname, spos)
|
||||||
|
else
|
||||||
|
item = stack:take_item(count)
|
||||||
|
frominv:set_stack(frominvname, spos, stack)
|
||||||
|
if fromdef.on_metadata_inventory_take then
|
||||||
|
fromdef.on_metadata_inventory_take(frompos, frominvname, spos, item, fakePlayer)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
|
||||||
|
local start_pos = vector.add(frompos, dir)
|
||||||
|
local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item, fakePlayer:get_player_name())
|
||||||
|
return true-- only fire one item, please
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local function punch_filter(data, filtpos, filtnode, msg)
|
local function punch_filter(data, filtpos, filtnode, msg)
|
||||||
local filtmeta = minetest.get_meta(filtpos)
|
local filtmeta = minetest.get_meta(filtpos)
|
||||||
local filtinv = filtmeta:get_inventory()
|
local filtinv = filtmeta:get_inventory()
|
||||||
@ -65,6 +178,8 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
if not fromdef then return end
|
if not fromdef then return end
|
||||||
local fromtube = fromdef.tube
|
local fromtube = fromdef.tube
|
||||||
local input_special_cases = {
|
local input_special_cases = {
|
||||||
|
["technic:mv_furnace"] = "dst",
|
||||||
|
["technic:mv_furnace_active"] = "dst",
|
||||||
["technic:mv_electric_furnace"] = "dst",
|
["technic:mv_electric_furnace"] = "dst",
|
||||||
["technic:mv_electric_furnace_active"] = "dst",
|
["technic:mv_electric_furnace_active"] = "dst",
|
||||||
["technic:mv_alloy_furnace"] = "dst",
|
["technic:mv_alloy_furnace"] = "dst",
|
||||||
@ -78,14 +193,6 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
["technic:mv_grinder"] = "dst",
|
["technic:mv_grinder"] = "dst",
|
||||||
["technic:mv_grinder_active"] = "dst",
|
["technic:mv_grinder_active"] = "dst",
|
||||||
["technic:tool_workshop"] = "src",
|
["technic:tool_workshop"] = "src",
|
||||||
["technic:mv_freezer"] = "dst",
|
|
||||||
["technic:mv_freezer_active"] = "dst",
|
|
||||||
["technic:hv_electric_furnace"] = "dst",
|
|
||||||
["technic:hv_electric_furnace_active"] = "dst",
|
|
||||||
["technic:hv_compressor"] = "dst",
|
|
||||||
["technic:hv_compressor_active"] = "dst",
|
|
||||||
["technic:hv_grinder"] = "dst",
|
|
||||||
["technic:hv_grinder_active"] = "dst"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- make sure there's something appropriate to inject the item into
|
-- make sure there's something appropriate to inject the item into
|
||||||
@ -105,7 +212,7 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
if not (fromtube and fromtube.input_inventory) then return end
|
if not (fromtube and fromtube.input_inventory) then return end
|
||||||
|
|
||||||
local slotseq_mode
|
local slotseq_mode
|
||||||
local exmatch_mode
|
local exact_match
|
||||||
|
|
||||||
local filters = {}
|
local filters = {}
|
||||||
if data.digiline then
|
if data.digiline then
|
||||||
@ -142,10 +249,10 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
|
|
||||||
local exmatch = msg.exmatch
|
local exmatch = msg.exmatch
|
||||||
local t_exmatch = type(exmatch)
|
local t_exmatch = type(exmatch)
|
||||||
if t_exmatch == "number" and (exmatch == 0 or exmatch == 1) then
|
if t_exmatch == "number" and exmatch >= 0 and exmatch <= 1 then
|
||||||
exmatch_mode = exmatch
|
exact_match = exmatch
|
||||||
elseif t_exmatch == "boolean" then
|
elseif t_exmatch == "boolean" then
|
||||||
exmatch_mode = exmatch and 1 or 0
|
exact_match = exmatch and 1 or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local slotseq_index = msg.slotseq_index
|
local slotseq_index = msg.slotseq_index
|
||||||
@ -162,11 +269,11 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
filtmeta:set_int("slotseq_mode", slotseq_mode)
|
filtmeta:set_int("slotseq_mode", slotseq_mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
if exmatch_mode ~= nil then
|
if exact_match ~= nil then
|
||||||
filtmeta:set_int("exmatch_mode", exmatch_mode)
|
filtmeta:set_int("exmatch_mode", exact_match)
|
||||||
end
|
end
|
||||||
|
|
||||||
if slotseq_mode ~= nil or exmatch_mode ~= nil then
|
if slotseq_mode ~= nil or exact_match ~= nil then
|
||||||
set_filter_formspec(data, filtmeta)
|
set_filter_formspec(data, filtmeta)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -204,8 +311,8 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
slotseq_mode = filtmeta:get_int("slotseq_mode")
|
slotseq_mode = filtmeta:get_int("slotseq_mode")
|
||||||
end
|
end
|
||||||
|
|
||||||
if exmatch_mode == nil then
|
if exact_match == nil then
|
||||||
exmatch_mode = filtmeta:get_int("exmatch_mode")
|
exact_match = filtmeta:get_int("exmatch_mode")
|
||||||
end
|
end
|
||||||
|
|
||||||
local frominv
|
local frominv
|
||||||
@ -219,121 +326,10 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
frominv = frommeta:get_inventory()
|
frominv = frommeta:get_inventory()
|
||||||
end
|
end
|
||||||
if fromtube.before_filter then fromtube.before_filter(frompos) end
|
if fromtube.before_filter then fromtube.before_filter(frompos) end
|
||||||
|
|
||||||
local function grabAndFire(frominvname, filterfor)
|
|
||||||
local sposes = {}
|
|
||||||
if not frominvname or not frominv:get_list(frominvname) then return end
|
|
||||||
for spos,stack in ipairs(frominv:get_list(frominvname)) do
|
|
||||||
local matches
|
|
||||||
if filterfor == "" then
|
|
||||||
matches = stack:get_name() ~= ""
|
|
||||||
else
|
|
||||||
local fname = filterfor.name
|
|
||||||
local fgroup = filterfor.group
|
|
||||||
local fwear = filterfor.wear
|
|
||||||
local fmetadata = filterfor.metadata
|
|
||||||
matches = (not fname -- If there's a name filter,
|
|
||||||
or stack:get_name() == fname) -- it must match.
|
|
||||||
|
|
||||||
and (not fgroup -- If there's a group filter,
|
|
||||||
or (type(fgroup) == "string" -- it must be a string
|
|
||||||
and minetest.get_item_group( -- and it must match.
|
|
||||||
stack:get_name(), fgroup) ~= 0))
|
|
||||||
|
|
||||||
and (not fwear -- If there's a wear filter:
|
|
||||||
or (type(fwear) == "number" -- If it's a number,
|
|
||||||
and stack:get_wear() == fwear) -- it must match.
|
|
||||||
or (type(fwear) == "table" -- If it's a table:
|
|
||||||
and (not fwear[1] -- If there's a lower bound,
|
|
||||||
or (type(fwear[1]) == "number" -- it must be a number
|
|
||||||
and fwear[1] <= stack:get_wear())) -- and it must be <= the actual wear.
|
|
||||||
and (not fwear[2] -- If there's an upper bound
|
|
||||||
or (type(fwear[2]) == "number" -- it must be a number
|
|
||||||
and stack:get_wear() < fwear[2])))) -- and it must be > the actual wear.
|
|
||||||
-- If the wear filter is of any other type, fail.
|
|
||||||
|
|
||||||
and (not fmetadata -- If there's a metadata filter,
|
|
||||||
or (type(fmetadata) == "string" -- it must be a string
|
|
||||||
and stack:get_metadata() == fmetadata)) -- and it must match.
|
|
||||||
end
|
|
||||||
if matches then table.insert(sposes, spos) end
|
|
||||||
end
|
|
||||||
if #sposes == 0 then return false end
|
|
||||||
if slotseq_mode == 1 then
|
|
||||||
for i = #sposes, 2, -1 do
|
|
||||||
local j = math.random(i)
|
|
||||||
local t = sposes[j]
|
|
||||||
sposes[j] = sposes[i]
|
|
||||||
sposes[i] = t
|
|
||||||
end
|
|
||||||
elseif slotseq_mode == 2 then
|
|
||||||
local headpos = filtmeta:get_int("slotseq_index")
|
|
||||||
table.sort(sposes, function (a, b)
|
|
||||||
if a >= headpos then
|
|
||||||
if b < headpos then return true end
|
|
||||||
else
|
|
||||||
if b >= headpos then return false end
|
|
||||||
end
|
|
||||||
return a < b
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
for _, spos in ipairs(sposes) do
|
|
||||||
local stack = frominv:get_stack(frominvname, spos)
|
|
||||||
local doRemove = stack:get_count()
|
|
||||||
if fromtube.can_remove then
|
|
||||||
doRemove = fromtube.can_remove(frompos, fromnode, stack, dir, frominvname, spos)
|
|
||||||
elseif fromdef.allow_metadata_inventory_take then
|
|
||||||
doRemove = fromdef.allow_metadata_inventory_take(frompos, frominvname,spos, stack, fakePlayer)
|
|
||||||
end
|
|
||||||
-- stupid lack of continue statements grumble
|
|
||||||
if doRemove > 0 then
|
|
||||||
if slotseq_mode == 2 then
|
|
||||||
local nextpos = spos + 1
|
|
||||||
if nextpos > frominv:get_size(frominvname) then
|
|
||||||
nextpos = 1
|
|
||||||
end
|
|
||||||
filtmeta:set_int("slotseq_index", nextpos)
|
|
||||||
set_filter_infotext(data, filtmeta)
|
|
||||||
end
|
|
||||||
local item
|
|
||||||
local count
|
|
||||||
if data.stackwise then
|
|
||||||
count = math.min(stack:get_count(), doRemove)
|
|
||||||
if filterfor.count and (filterfor.count > 1 or data.digiline) then
|
|
||||||
if exmatch_mode ~= 0 and filterfor.count > count then
|
|
||||||
return false -- not enough, fail
|
|
||||||
else
|
|
||||||
-- limit quantity to filter amount
|
|
||||||
count = math.min(filterfor.count, count)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
count = 1
|
|
||||||
end
|
|
||||||
if fromtube.remove_items then
|
|
||||||
-- it could be the entire stack...
|
|
||||||
item = fromtube.remove_items(frompos, fromnode, stack, dir, count, frominvname, spos)
|
|
||||||
else
|
|
||||||
item = stack:take_item(count)
|
|
||||||
frominv:set_stack(frominvname, spos, stack)
|
|
||||||
if fromdef.on_metadata_inventory_take then
|
|
||||||
fromdef.on_metadata_inventory_take(frompos, frominvname, spos, item, fakePlayer)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
|
|
||||||
local start_pos = vector.add(frompos, dir)
|
|
||||||
pipeworks.tube_inject_item(pos, start_pos, dir, item,
|
|
||||||
fakePlayer:get_player_name())
|
|
||||||
return true -- only fire one item, please
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do
|
for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do
|
||||||
local done = false
|
local done = false
|
||||||
for _, filterfor in ipairs(filters) do
|
for _, filterfor in ipairs(filters) do
|
||||||
if grabAndFire(frominvname, filterfor) then
|
if grabAndFire(data, slotseq_mode, exact_match, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise, data.digiline) then
|
||||||
done = true
|
done = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -346,23 +342,23 @@ end
|
|||||||
for _, data in ipairs({
|
for _, data in ipairs({
|
||||||
{
|
{
|
||||||
name = "filter",
|
name = "filter",
|
||||||
wise_desc = S("Itemwise"),
|
wise_desc = "Itemwise",
|
||||||
stackwise = false,
|
stackwise = false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "mese_filter",
|
name = "mese_filter",
|
||||||
wise_desc = S("Stackwise"),
|
wise_desc = "Stackwise",
|
||||||
stackwise = true,
|
stackwise = true,
|
||||||
},
|
},
|
||||||
{ -- register even if no digilines
|
{ -- register even if no digilines
|
||||||
name = "digiline_filter",
|
name = "digiline_filter",
|
||||||
wise_desc = S("Digiline"),
|
wise_desc = "Digiline",
|
||||||
stackwise = true,
|
stackwise = true,
|
||||||
digiline = true,
|
digiline = true,
|
||||||
},
|
},
|
||||||
}) do
|
}) do
|
||||||
local node = {
|
local node = {
|
||||||
description = S("@1 Filter-Injector", data.wise_desc),
|
description = data.wise_desc.." Filter-Injector",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_"..data.name.."_top.png",
|
"pipeworks_"..data.name.."_top.png",
|
||||||
"pipeworks_"..data.name.."_top.png",
|
"pipeworks_"..data.name.."_top.png",
|
||||||
@ -387,7 +383,6 @@ for _, data in ipairs({
|
|||||||
pipeworks.after_place(pos)
|
pipeworks.after_place(pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate,
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
if not pipeworks.may_configure(pos, player) then
|
if not pipeworks.may_configure(pos, player) then
|
||||||
return 0
|
return 0
|
||||||
@ -477,18 +472,18 @@ end
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:filter 2",
|
output = "pipeworks:filter 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" },
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" },
|
||||||
{ "group:stick", "default:mese_crystal", "basic_materials:plastic_sheet" },
|
{ "group:stick", "default:mese_crystal", "homedecor:plastic_sheeting" },
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:mese_filter 2",
|
output = "pipeworks:mese_filter 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" },
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" },
|
||||||
{ "group:stick", "default:mese", "basic_materials:plastic_sheet" },
|
{ "group:stick", "default:mese", "homedecor:plastic_sheeting" },
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -496,9 +491,9 @@ if minetest.get_modpath("digilines") then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:digiline_filter 2",
|
output = "pipeworks:digiline_filter 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" },
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" },
|
||||||
{ "group:stick", "digilines:wire_std_00000000", "basic_materials:plastic_sheet" },
|
{ "group:stick", "digilines:wire_std_00000000", "homedecor:plastic_sheeting" },
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }
|
{ "default:steel_ingot", "default:steel_ingot", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -60,8 +60,8 @@ pipeworks.check_for_inflows = function(pos,node)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if newnode then
|
if newnode then
|
||||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||||
minetest.get_meta(pos):set_string("source",minetest.pos_to_string(source))
|
minetest.get_meta(pos):set_string("source",minetest.pos_to_string(source))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -75,15 +75,15 @@ pipeworks.check_sources = function(pos,node)
|
|||||||
newnode = string.gsub(node.name,"loaded","empty")
|
newnode = string.gsub(node.name,"loaded","empty")
|
||||||
end
|
end
|
||||||
|
|
||||||
if newnode then
|
if newnode then
|
||||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||||
minetest.get_meta(pos):set_string("source","")
|
minetest.get_meta(pos):set_string("source","")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeworks.spigot_check = function(pos, node)
|
pipeworks.spigot_check = function(pos, node)
|
||||||
local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
|
local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
|
||||||
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
|
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
|
||||||
local spigotname = minetest.get_node(pos).name
|
local spigotname = minetest.get_node(pos).name
|
||||||
local fdir=node.param2 % 4
|
local fdir=node.param2 % 4
|
||||||
local check = {
|
local check = {
|
||||||
@ -113,7 +113,7 @@ end
|
|||||||
|
|
||||||
pipeworks.fountainhead_check = function(pos, node)
|
pipeworks.fountainhead_check = function(pos, node)
|
||||||
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
||||||
if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
|
if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
|
||||||
local fountainhead_name = minetest.get_node(pos).name
|
local fountainhead_name = minetest.get_node(pos).name
|
||||||
local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
if near_node and string.find(near_node.name, "_loaded") then
|
if near_node and string.find(near_node.name, "_loaded") then
|
||||||
|
24
init.lua
24
init.lua
@ -3,12 +3,15 @@
|
|||||||
-- This mod supplies various steel pipes and plastic pneumatic tubes
|
-- This mod supplies various steel pipes and plastic pneumatic tubes
|
||||||
-- and devices that they can connect to.
|
-- and devices that they can connect to.
|
||||||
--
|
--
|
||||||
|
-- License: WTFPL
|
||||||
|
--
|
||||||
|
|
||||||
pipeworks = {}
|
pipeworks = {}
|
||||||
|
|
||||||
|
local DEBUG = false
|
||||||
|
|
||||||
pipeworks.worldpath = minetest.get_worldpath()
|
pipeworks.worldpath = minetest.get_worldpath()
|
||||||
pipeworks.modpath = minetest.get_modpath("pipeworks")
|
pipeworks.modpath = minetest.get_modpath("pipeworks")
|
||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
|
|
||||||
dofile(pipeworks.modpath.."/default_settings.lua")
|
dofile(pipeworks.modpath.."/default_settings.lua")
|
||||||
-- Read the external config file if it exists.
|
-- Read the external config file if it exists.
|
||||||
@ -44,7 +47,7 @@ pipeworks.liquid_texture = "default_water.png"
|
|||||||
pipeworks.button_off = {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}
|
pipeworks.button_off = {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"}
|
||||||
pipeworks.button_on = {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}
|
pipeworks.button_on = {text="", texture="pipeworks_button_on.png", addopts="false;false;pipeworks_button_interm.png"}
|
||||||
pipeworks.button_base = "image_button[0,4.3;1,0.6"
|
pipeworks.button_base = "image_button[0,4.3;1,0.6"
|
||||||
pipeworks.button_label = "label[0.9,4.31;"..S("Allow splitting incoming stacks from tubes").."]"
|
pipeworks.button_label = "label[0.9,4.31;Allow splitting incoming stacks from tubes]"
|
||||||
|
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
|
|
||||||
@ -69,8 +72,8 @@ function pipeworks.may_configure(pos, player)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
|
|
||||||
if owner ~= "" and owner == name then -- wielders and filters
|
if owner ~= "" then -- wielders and filters
|
||||||
return true
|
return owner == name
|
||||||
end
|
end
|
||||||
return not minetest.is_protected(pos, name)
|
return not minetest.is_protected(pos, name)
|
||||||
end
|
end
|
||||||
@ -101,10 +104,6 @@ if pipeworks.toggles.finite_water == nil then
|
|||||||
dofile(pipeworks.modpath.."/autodetect-finite-water.lua")
|
dofile(pipeworks.modpath.."/autodetect-finite-water.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("signs_lib") then
|
|
||||||
dofile(pipeworks.modpath.."/signs_compat.lua")
|
|
||||||
end
|
|
||||||
|
|
||||||
dofile(pipeworks.modpath.."/common.lua")
|
dofile(pipeworks.modpath.."/common.lua")
|
||||||
dofile(pipeworks.modpath.."/models.lua")
|
dofile(pipeworks.modpath.."/models.lua")
|
||||||
dofile(pipeworks.modpath.."/autoplace_pipes.lua")
|
dofile(pipeworks.modpath.."/autoplace_pipes.lua")
|
||||||
@ -136,16 +135,15 @@ dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua")
|
|||||||
if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
|
if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
|
||||||
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
|
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
|
||||||
if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end
|
if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end
|
||||||
|
|
||||||
if pipeworks.enable_redefines then
|
if pipeworks.enable_redefines then
|
||||||
dofile(pipeworks.modpath.."/compat-chests.lua")
|
dofile(pipeworks.modpath.."/compat-chests.lua")
|
||||||
dofile(pipeworks.modpath.."/compat-furnaces.lua")
|
dofile(pipeworks.modpath.."/compat-furnaces.lua")
|
||||||
end
|
end
|
||||||
if pipeworks.enable_autocrafter then dofile(pipeworks.modpath.."/autocrafter.lua") end
|
if pipeworks.enable_autocrafter then dofile(pipeworks.modpath.."/autocrafter.lua") end
|
||||||
if pipeworks.enable_lua_tube and
|
if pipeworks.enable_lua_tube then dofile(pipeworks.modpath.."/lua_tube.lua") end
|
||||||
(minetest.get_modpath("mesecons") or minetest.get_modpath("digilines")) then
|
|
||||||
dofile(pipeworks.modpath.."/lua_tube.lua")
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
|
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
|
||||||
|
|
||||||
minetest.log("info", "Pipeworks loaded!")
|
print("Pipeworks loaded!")
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ end
|
|||||||
-- both optional w/ sensible defaults and fallback to normal allow_* function
|
-- both optional w/ sensible defaults and fallback to normal allow_* function
|
||||||
-- XXX: possibly change insert_object to insert_item
|
-- XXX: possibly change insert_object to insert_item
|
||||||
|
|
||||||
local default_adjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
|
local adjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
|
||||||
|
|
||||||
function pipeworks.notvel(tbl, vel)
|
function pipeworks.notvel(tbl, vel)
|
||||||
local tbl2={}
|
local tbl2={}
|
||||||
@ -42,7 +42,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
tube_item_count = {}
|
tube_item_count = {}
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
if entity.name == "pipeworks:tubed_item" then
|
if entity.name == "pipeworks:tubed_item" then
|
||||||
local h = minetest.hash_node_position(vector.round(entity._pos))
|
local h = minetest.hash_node_position(vector.round(entity._pos))
|
||||||
tube_item_count[h] = (tube_item_count[h] or 0) + 1
|
tube_item_count[h] = (tube_item_count[h] or 0) + 1
|
||||||
@ -61,7 +61,7 @@ local crunch_tube = function(pos, cnode, cmeta)
|
|||||||
local itemcount = tube_item_count[h] or 0
|
local itemcount = tube_item_count[h] or 0
|
||||||
if itemcount > max_tube_limit then
|
if itemcount > max_tube_limit then
|
||||||
cmeta:set_string("the_tube_was", minetest.serialize(cnode))
|
cmeta:set_string("the_tube_was", minetest.serialize(cnode))
|
||||||
pipeworks.logger("Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")")
|
print("[Pipeworks] Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")")
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end
|
end
|
||||||
@ -80,9 +80,6 @@ local function go_next_compat(pos, cnode, cmeta, cycledir, vel, stack, owner)
|
|||||||
if minetest.registered_nodes[cnode.name] and minetest.registered_nodes[cnode.name].tube and minetest.registered_nodes[cnode.name].tube.can_go then
|
if minetest.registered_nodes[cnode.name] and minetest.registered_nodes[cnode.name].tube and minetest.registered_nodes[cnode.name].tube.can_go then
|
||||||
can_go = minetest.registered_nodes[cnode.name].tube.can_go(pos, cnode, vel, stack)
|
can_go = minetest.registered_nodes[cnode.name].tube.can_go(pos, cnode, vel, stack)
|
||||||
else
|
else
|
||||||
local adjlist_string = minetest.get_meta(pos):get_string("adjlist")
|
|
||||||
local adjlist = minetest.deserialize(adjlist_string) or default_adjlist -- backward compat: if not found, use old behavior: all directions
|
|
||||||
|
|
||||||
can_go = pipeworks.notvel(adjlist, vel)
|
can_go = pipeworks.notvel(adjlist, vel)
|
||||||
end
|
end
|
||||||
-- can_go() is expected to return an array-like table of candidate offsets.
|
-- can_go() is expected to return an array-like table of candidate offsets.
|
||||||
@ -194,7 +191,6 @@ minetest.register_entity("pipeworks:tubed_item", {
|
|||||||
|
|
||||||
from_data = function(self, itemstring)
|
from_data = function(self, itemstring)
|
||||||
local stack = ItemStack(itemstring)
|
local stack = ItemStack(itemstring)
|
||||||
--[[
|
|
||||||
local itemtable = stack:to_table()
|
local itemtable = stack:to_table()
|
||||||
local itemname = nil
|
local itemname = nil
|
||||||
if itemtable then
|
if itemtable then
|
||||||
@ -206,7 +202,6 @@ minetest.register_entity("pipeworks:tubed_item", {
|
|||||||
item_texture = minetest.registered_items[itemname].inventory_image
|
item_texture = minetest.registered_items[itemname].inventory_image
|
||||||
item_type = minetest.registered_items[itemname].type
|
item_type = minetest.registered_items[itemname].type
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
is_visible = true,
|
is_visible = true,
|
||||||
textures = {stack:get_name()}
|
textures = {stack:get_name()}
|
||||||
@ -355,10 +350,8 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
|||||||
-- compatible with Minetest 0.4.13.
|
-- compatible with Minetest 0.4.13.
|
||||||
-- Using item_drop here makes Minetest 0.4.13 crash.
|
-- Using item_drop here makes Minetest 0.4.13 crash.
|
||||||
local dropped_item = minetest.add_item(self.start_pos, stack)
|
local dropped_item = minetest.add_item(self.start_pos, stack)
|
||||||
if dropped_item then
|
dropped_item:set_velocity(vector.multiply(velocity, 5))
|
||||||
dropped_item:set_velocity(vector.multiply(velocity, 5))
|
self:remove()
|
||||||
self:remove()
|
|
||||||
end
|
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
velocity = vector.multiply(velocity, -1)
|
velocity = vector.multiply(velocity, -1)
|
||||||
@ -393,7 +386,7 @@ if minetest.get_modpath("mesecons_mvps") then
|
|||||||
for _, n in ipairs(moved_nodes) do
|
for _, n in ipairs(moved_nodes) do
|
||||||
moved[minetest.hash_node_position(n.oldpos)] = vector.subtract(n.pos, n.oldpos)
|
moved[minetest.hash_node_position(n.oldpos)] = vector.subtract(n.pos, n.oldpos)
|
||||||
end
|
end
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
if entity.name == "pipeworks:tubed_item" then
|
if entity.name == "pipeworks:tubed_item" then
|
||||||
local pos = entity:get_pos()
|
local pos = entity:get_pos()
|
||||||
local rpos = vector.round(pos)
|
local rpos = vector.round(pos)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
|
|
||||||
if not minetest.get_modpath("auto_tree_tap") and
|
if not minetest.get_modpath("auto_tree_tap") and
|
||||||
minetest.get_modpath("technic") then
|
minetest.get_modpath("technic") then
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -21,7 +20,7 @@ if not minetest.get_modpath("auto_tree_tap") and
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(":auto_tree_tap:off", {
|
minetest.register_node(":auto_tree_tap:off", {
|
||||||
description = S("Auto-Tap"),
|
description = "Auto-Tap",
|
||||||
tiles = {"pipeworks_nodebreaker_top_off.png","pipeworks_nodebreaker_bottom_off.png","pipeworks_nodebreaker_side2_off.png","pipeworks_nodebreaker_side1_off.png",
|
tiles = {"pipeworks_nodebreaker_top_off.png","pipeworks_nodebreaker_bottom_off.png","pipeworks_nodebreaker_side2_off.png","pipeworks_nodebreaker_side1_off.png",
|
||||||
"pipeworks_nodebreaker_back.png","pipeworks_nodebreaker_front_off.png"},
|
"pipeworks_nodebreaker_back.png","pipeworks_nodebreaker_front_off.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
@ -38,10 +37,10 @@ if not minetest.get_modpath("auto_tree_tap") and
|
|||||||
after_place_node = function (pos, placer)
|
after_place_node = function (pos, placer)
|
||||||
pipeworks.scan_for_tube_objects(pos, placer)
|
pipeworks.scan_for_tube_objects(pos, placer)
|
||||||
local placer_pos = placer:get_pos()
|
local placer_pos = placer:get_pos()
|
||||||
|
|
||||||
--correct for the player's height
|
--correct for the player's height
|
||||||
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
|
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
|
||||||
|
|
||||||
--correct for 6d facedir
|
--correct for 6d facedir
|
||||||
if placer_pos then
|
if placer_pos then
|
||||||
local dir = {
|
local dir = {
|
||||||
|
@ -1,112 +0,0 @@
|
|||||||
# textdomain: pipeworks
|
|
||||||
|
|
||||||
# License: CC-by-SA 4.0
|
|
||||||
# Author: Louis Royer <4259825-lroyer@users.noreply.gitlab.com>
|
|
||||||
|
|
||||||
## digilines interfacing
|
|
||||||
Channel=Canal
|
|
||||||
|
|
||||||
## init
|
|
||||||
Allow splitting incoming stacks from tubes=Séparer les piles venant des tubes
|
|
||||||
|
|
||||||
## autocrafter
|
|
||||||
Unknown item=Item inconnu
|
|
||||||
unconfigured Autocrafter: unknown recipe=Autocrafteur non-configuré : recette inconnue
|
|
||||||
unconfigured Autocrafter=Autocrafteur non-configuré
|
|
||||||
'@1' Autocrafter (@2)=Autocrafteur de '@1' (@2)
|
|
||||||
Save=Valider
|
|
||||||
paused '@1' Autocrafter=Autocrafteur de '@1' en pause
|
|
||||||
Autocrafter=Autocrafteur
|
|
||||||
|
|
||||||
## compat-furnaces
|
|
||||||
Allow splitting incoming material (not fuel) stacks from tubes=Séparer les piles (sauf le carburant) venant des tubes
|
|
||||||
|
|
||||||
## decorative tubes
|
|
||||||
Airtight steelblock embedded tube=Tube hermétique intégré à un bloc d’acier
|
|
||||||
Airtight panel embedded tube=Tube hermétique intégré à un panneau
|
|
||||||
|
|
||||||
## devices
|
|
||||||
Pump/Intake Module=Module de pompage et d’admission
|
|
||||||
Valve=Vanne
|
|
||||||
Decorative grating=Grillage décoratif
|
|
||||||
Spigot outlet=Sortie de robinet
|
|
||||||
Airtight Pipe entry/exit=Extrémité de tube hermétique
|
|
||||||
Flow Sensor=Détecteur de débit
|
|
||||||
Flow sensor (on)=Détecteur de débit (actif)
|
|
||||||
empty=vide
|
|
||||||
@1% full=plein à @1 %
|
|
||||||
Expansion Tank (@1)=Réservoir d’expansion (@1)
|
|
||||||
Fluid Storage Tank (@1)=Réservoir de liquides (@1)
|
|
||||||
Fountainhead=Tête de fontaine
|
|
||||||
Straight-only Pipe=Tuyau droit
|
|
||||||
|
|
||||||
## filter-injector
|
|
||||||
(slot #@1 next)=(slot suivant : #@1)
|
|
||||||
@1 Filter-Injector=Filtre-injecteur @1
|
|
||||||
Sequence slots by Priority=Ordonner par priorité
|
|
||||||
Sequence slots Randomly=Ordonner aléatoirement
|
|
||||||
Sequence slots by Rotation=Ordonner en rotation
|
|
||||||
Exact match - off=Filtrage inactif
|
|
||||||
Exact match - on=Filtrage actif
|
|
||||||
Prefer item types:=Items à filtrer :
|
|
||||||
Itemwise=par item
|
|
||||||
Stackwise=par piles d’items
|
|
||||||
Digiline=digiline
|
|
||||||
|
|
||||||
## legacy
|
|
||||||
Auto-Tap=Robinet d’arbre automatique
|
|
||||||
|
|
||||||
## pipes
|
|
||||||
Pipe Segment=Segment de tuyau
|
|
||||||
Pipe Segment (legacy)=Segment de tuyau (obsolète)
|
|
||||||
|
|
||||||
|
|
||||||
## routing tubes
|
|
||||||
Pneumatic tube segment=Segment de tuyau pneumatique
|
|
||||||
Broken Tube=Tuyau cassé
|
|
||||||
High Priority Tube Segment=Segment de tuyau haute priorité
|
|
||||||
Accelerating Pneumatic Tube Segment=Segment de tuyau pneumatique accélérante
|
|
||||||
Crossing Pneumatic Tube Segment=Intersection de tuyau pneumatique
|
|
||||||
One way tube=Tuyau unidirectionnel
|
|
||||||
|
|
||||||
## signal tubes
|
|
||||||
Detecting Pneumatic Tube Segment on=Segment de tuyau pneumatique avec détecteur (actif)
|
|
||||||
Detecting Pneumatic Tube Segment=Segment de tuyau pneumatique avec détecteur
|
|
||||||
Digiline Detecting Pneumatic Tube Segment=Segment de tuyau pneumatique avec détecteur digiline
|
|
||||||
Digiline Detecting Tube=Tuyau avec détecteur digiline
|
|
||||||
Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur
|
|
||||||
Conducting Pneumatic Tube Segment on=Segment de tuyau pneumatique conducteur actif
|
|
||||||
Digiline Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur digiline
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur mesecon et digiline
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment on=Segment de tuyau pneumatique conducteur mesecon et digiline (actif)
|
|
||||||
|
|
||||||
## sorting tubes
|
|
||||||
Sorting Pneumatic Tube Segment=Segment de tuyau pneumatique triant
|
|
||||||
Sorting pneumatic tube=Tuyau pneumatique triant
|
|
||||||
|
|
||||||
## teleport tube
|
|
||||||
Receive=Reception
|
|
||||||
channels are public by default=Les canaux sont publics par défaut
|
|
||||||
use <player>:<channel> for fully private channels=Utilisez <joueur>:<canal> pour un canal entièrement privé
|
|
||||||
use <player>;<channel> for private receivers=Utilisez <joueur>;<canal> pour une réception privée
|
|
||||||
Teleporting Pneumatic Tube Segment=Segment de tuyau pneumatique téléporteur
|
|
||||||
unconfigured Teleportation Tube=Tuyau téléporteur non-configuré
|
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=Désolé, le canal '@1' est réservé exclusivement à l’utilisateur @2.
|
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=Désolé, la réception depuis le canal '@1' est réservée pour @2.
|
|
||||||
Teleportation Tube @1 on '@2'=Tuyau de téléportation @1 sur '@2'
|
|
||||||
|
|
||||||
## trashcan
|
|
||||||
Trash Can=Poubelle
|
|
||||||
|
|
||||||
## tube registration
|
|
||||||
Pneumatic tube segment (legacy)=Segment de tuyau pneumatique (obsolète)
|
|
||||||
|
|
||||||
## vacuum tubes
|
|
||||||
Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant réglable
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=Segment de tuyau pneumatique aspirant réglable (@1 m)
|
|
||||||
|
|
||||||
## wielder
|
|
||||||
Node Breaker=Casseur de blocs
|
|
||||||
Deployer=Poseur de blocs
|
|
||||||
Dispenser=Distributeur
|
|
@ -1,110 +0,0 @@
|
|||||||
# textdomain: pipeworks
|
|
||||||
# License: CC-by-SA 4.0
|
|
||||||
# Author: pevernow <3450354617@qq.com>
|
|
||||||
|
|
||||||
## digilines interfacing
|
|
||||||
Channel=频道
|
|
||||||
|
|
||||||
## init
|
|
||||||
Allow splitting incoming stacks from tubes=允许从管道中拆分传入堆栈
|
|
||||||
|
|
||||||
## autocrafter
|
|
||||||
Unknown item=通道
|
|
||||||
unconfigured Autocrafter: unknown recipe=未配置的自动工作台: 未知配方
|
|
||||||
unconfigured Autocrafter=未配置的自动工作台
|
|
||||||
'@1' Autocrafter (@2)=自动工作台 '@1' (@2)
|
|
||||||
Save=保存
|
|
||||||
paused '@1' Autocrafter=暂停的自动工作台
|
|
||||||
Autocrafter=自动工作台
|
|
||||||
|
|
||||||
## compat-furnaces
|
|
||||||
Allow splitting incoming material (not fuel) stacks from tubes=允许从管子中分离进来的材料(不是燃料)堆
|
|
||||||
|
|
||||||
## decorative tubes
|
|
||||||
Airtight steelblock embedded tube=密封嵌入式铁块管道
|
|
||||||
Airtight panel embedded tube=密封嵌入式片状管道
|
|
||||||
|
|
||||||
## devices
|
|
||||||
Pump/Intake Module=泵/进气模块
|
|
||||||
Valve=阀门
|
|
||||||
Decorative grating=Decorative grating
|
|
||||||
Spigot outlet=龙头
|
|
||||||
Airtight Pipe entry/exit=密闭管进/出
|
|
||||||
Flow Sensor=流量传感器
|
|
||||||
Flow sensor (on)=流量传感器(上)
|
|
||||||
empty=空的
|
|
||||||
@1% full=满的@1 %
|
|
||||||
Expansion Tank (@1)=扩展水箱 (@1)
|
|
||||||
Fluid Storage Tank (@1)=储液罐 (@1)
|
|
||||||
Fountainhead=源泉
|
|
||||||
Straight-only Pipe=直管
|
|
||||||
## filter-injector
|
|
||||||
(slot #@1 next)=(下一个插槽 : #@1)
|
|
||||||
@1 Filter-Injector=@1取物器
|
|
||||||
Sequence slots by Priority=优先顺序排列
|
|
||||||
Sequence slots Randomly=随机排列时隙
|
|
||||||
Sequence slots by Rotation=旋转顺序槽
|
|
||||||
Exact match - off=完全匹配-关闭
|
|
||||||
Exact match - on=完全匹配-开启
|
|
||||||
Prefer item types:=偏好物品类型 :
|
|
||||||
Itemwise=逐项
|
|
||||||
Stackwise=堆叠方式
|
|
||||||
Digiline=Digiline
|
|
||||||
|
|
||||||
## legacy
|
|
||||||
Auto-Tap=自动轴阀
|
|
||||||
|
|
||||||
## pipes
|
|
||||||
Pipe Segment=管道
|
|
||||||
Pipe Segment (legacy)=管道(旧版)
|
|
||||||
|
|
||||||
|
|
||||||
## routing tubes
|
|
||||||
Pneumatic tube segment=普通管道
|
|
||||||
Broken Tube=断管
|
|
||||||
High Priority Tube Segment=高优先级管段
|
|
||||||
Accelerating Pneumatic Tube Segment=加速管道
|
|
||||||
Crossing Pneumatic Tube Segment=定向管道
|
|
||||||
One way tube=单向管
|
|
||||||
|
|
||||||
## signal tubes
|
|
||||||
Detecting Pneumatic Tube Segment on=检测管道(运行中)
|
|
||||||
Detecting Pneumatic Tube Segment=检测管道
|
|
||||||
Digiline Detecting Pneumatic Tube Segment=Digiline检测管道
|
|
||||||
Digiline Detecting Tube=Digiline检测管
|
|
||||||
Conducting Pneumatic Tube Segment=传导管道
|
|
||||||
Conducting Pneumatic Tube Segment on=传导管道(运行中)
|
|
||||||
Digiline Conducting Pneumatic Tube Segment=Digiline传导式气动管道
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment=Mesecon和Digiline传导管道
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment on=Mesecon和Digiline传导管道(运行中)
|
|
||||||
|
|
||||||
## sorting tubes
|
|
||||||
Sorting Pneumatic Tube Segment=分类管道
|
|
||||||
Sorting pneumatic tube=分类管道
|
|
||||||
|
|
||||||
## teleport tube
|
|
||||||
Receive=接收
|
|
||||||
channels are public by default=频道默认为公开
|
|
||||||
use <player>:<channel> for fully private channels=将<player>:<channel>用于完全私人的频道
|
|
||||||
use <player>;<channel> for private receivers=使用<player>;<channel>作为私人接收器
|
|
||||||
Teleporting Pneumatic Tube Segment=传送管道
|
|
||||||
unconfigured Teleportation Tube=未配置的传送管道
|
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=抱歉,频道‘@1’保留供‘@2’专用
|
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=抱歉,从频道'@1'接收的内容已保留给'@2'
|
|
||||||
Teleportation Tube @1 on '@2'=传送管'@1'在'@2'上
|
|
||||||
|
|
||||||
## trashcan
|
|
||||||
Trash Can=垃圾箱
|
|
||||||
|
|
||||||
## tube registration
|
|
||||||
Pneumatic tube segment (legacy)=普通管道(旧式)
|
|
||||||
|
|
||||||
## vacuum tubes
|
|
||||||
Vacuuming Pneumatic Tube Segment=拾取管道
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=高级拾取管道
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=高级拾取管道(@1m)
|
|
||||||
|
|
||||||
## wielder
|
|
||||||
Node Breaker=方块破坏器
|
|
||||||
Deployer=放置器
|
|
||||||
Dispenser=投掷器
|
|
@ -1,112 +0,0 @@
|
|||||||
# textdomain: pipeworks
|
|
||||||
|
|
||||||
# License: CC-by-SA 4.0
|
|
||||||
# Author:
|
|
||||||
|
|
||||||
## digilines interfacing
|
|
||||||
Channel=
|
|
||||||
|
|
||||||
## init
|
|
||||||
Allow splitting incoming stacks from tubes=
|
|
||||||
|
|
||||||
## autocrafter
|
|
||||||
Unknown item=
|
|
||||||
unconfigured Autocrafter: unknown recipe=
|
|
||||||
unconfigured Autocrafter=
|
|
||||||
'@1' Autocrafter (@2)=
|
|
||||||
Save=
|
|
||||||
paused '@1' Autocrafter=
|
|
||||||
Autocrafter=
|
|
||||||
|
|
||||||
## compat-furnaces
|
|
||||||
Allow splitting incoming material (not fuel) stacks from tubes=
|
|
||||||
|
|
||||||
## decorative tubes
|
|
||||||
Airtight steelblock embedded tube=
|
|
||||||
Airtight panel embedded tube=
|
|
||||||
|
|
||||||
## devices
|
|
||||||
Pump/Intake Module=
|
|
||||||
Valve=
|
|
||||||
Decorative grating=
|
|
||||||
Spigot outlet=
|
|
||||||
Airtight Pipe entry/exit=
|
|
||||||
Flow Sensor=
|
|
||||||
Flow sensor (on)=
|
|
||||||
empty=
|
|
||||||
@1% full=
|
|
||||||
Expansion Tank (@1)=
|
|
||||||
Fluid Storage Tank (@1)=
|
|
||||||
Fountainhead=
|
|
||||||
Straight-only Pipe=
|
|
||||||
|
|
||||||
## filter-injector
|
|
||||||
(slot #@1 next)=
|
|
||||||
@1 Filter-Injector=
|
|
||||||
Sequence slots by Priority=
|
|
||||||
Sequence slots Randomly=
|
|
||||||
Sequence slots by Rotation=
|
|
||||||
Exact match - off=
|
|
||||||
Exact match - on=
|
|
||||||
Prefer item types:=
|
|
||||||
Itemwise=
|
|
||||||
Stackwise=
|
|
||||||
Digiline=
|
|
||||||
|
|
||||||
## legacy
|
|
||||||
Auto-Tap=
|
|
||||||
|
|
||||||
## pipes
|
|
||||||
Pipe Segment=
|
|
||||||
Pipe Segment (legacy)=
|
|
||||||
|
|
||||||
|
|
||||||
## routing tubes
|
|
||||||
Pneumatic tube segment=
|
|
||||||
Broken Tube=
|
|
||||||
High Priority Tube Segment=
|
|
||||||
Accelerating Pneumatic Tube Segment=
|
|
||||||
Crossing Pneumatic Tube Segment=
|
|
||||||
One way tube=
|
|
||||||
|
|
||||||
## signal tubes
|
|
||||||
Detecting Pneumatic Tube Segment on=
|
|
||||||
Detecting Pneumatic Tube Segment=
|
|
||||||
Digiline Detecting Pneumatic Tube Segment=
|
|
||||||
Digiline Detecting Tube=
|
|
||||||
Conducting Pneumatic Tube Segment=
|
|
||||||
Conducting Pneumatic Tube Segment on=
|
|
||||||
Digiline Conducting Pneumatic Tube Segment=
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment=
|
|
||||||
Mesecon and Digiline Conducting Pneumatic Tube Segment on=
|
|
||||||
|
|
||||||
## sorting tubes
|
|
||||||
Sorting Pneumatic Tube Segment=
|
|
||||||
Sorting pneumatic tube=
|
|
||||||
|
|
||||||
## teleport tube
|
|
||||||
Receive=
|
|
||||||
channels are public by default=
|
|
||||||
use <player>:<channel> for fully private channels=
|
|
||||||
use <player>;<channel> for private receivers=
|
|
||||||
Teleporting Pneumatic Tube Segment=
|
|
||||||
unconfigured Teleportation Tube=
|
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=
|
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=
|
|
||||||
Teleportation Tube @1 on '@2'=
|
|
||||||
|
|
||||||
## trashcan
|
|
||||||
Trash Can=
|
|
||||||
|
|
||||||
## tube registration
|
|
||||||
Pneumatic tube segment (legacy)=
|
|
||||||
|
|
||||||
## vacuum tubes
|
|
||||||
Vacuuming Pneumatic Tube Segment=
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=
|
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=
|
|
||||||
|
|
||||||
## wielder
|
|
||||||
Node Breaker=
|
|
||||||
Deployer=
|
|
||||||
Dispenser=
|
|
383
lua_tube.lua
383
lua_tube.lua
@ -13,10 +13,8 @@
|
|||||||
-- newport = merge_port_states(state1, state2): just does result = state1 or state2 for every port
|
-- newport = merge_port_states(state1, state2): just does result = state1 or state2 for every port
|
||||||
-- set_port(pos, rule, state): activates/deactivates the mesecons according to the port states
|
-- set_port(pos, rule, state): activates/deactivates the mesecons according to the port states
|
||||||
-- set_port_states(pos, ports): Applies new port states to a Luacontroller at pos
|
-- set_port_states(pos, ports): Applies new port states to a Luacontroller at pos
|
||||||
-- run_inner(pos, code, event): runs code on the controller at pos and event
|
-- run(pos): runs the code in the controller at pos
|
||||||
-- reset_formspec(pos, code, errmsg): installs new code and prints error messages, without resetting LCID
|
-- reset_meta(pos, code, errmsg): performs a software-reset, installs new code and prints error messages
|
||||||
-- reset_meta(pos, code, errmsg): performs a software-reset, installs new code and prints error message
|
|
||||||
-- run(pos, event): a wrapper for run_inner which gets code & handles errors via reset_meta
|
|
||||||
-- resetn(pos): performs a hardware reset, turns off all ports
|
-- resetn(pos): performs a hardware reset, turns off all ports
|
||||||
--
|
--
|
||||||
-- The Sandbox
|
-- The Sandbox
|
||||||
@ -26,7 +24,7 @@
|
|||||||
-- use too much memory from the sandbox.
|
-- use too much memory from the sandbox.
|
||||||
-- You can add more functions to the environment
|
-- You can add more functions to the environment
|
||||||
-- (see where local env is defined)
|
-- (see where local env is defined)
|
||||||
-- Something nice to play is appending minetest.env to it.
|
-- Something nice to play is is appending minetest.env to it.
|
||||||
|
|
||||||
local BASENAME = "pipeworks:lua_tube"
|
local BASENAME = "pipeworks:lua_tube"
|
||||||
|
|
||||||
@ -39,23 +37,6 @@ local rules = {
|
|||||||
white = {x = 0, y = 0, z = 1, name = "white"},
|
white = {x = 0, y = 0, z = 1, name = "white"},
|
||||||
}
|
}
|
||||||
|
|
||||||
local digiline_rules_luatube = {
|
|
||||||
{x=0, y=0, z=-1},
|
|
||||||
{x=1, y=0, z=0},
|
|
||||||
{x=-1, y=0, z=0},
|
|
||||||
{x=0, y=0, z=1},
|
|
||||||
{x=1, y=1, z=0},
|
|
||||||
{x=1, y=-1, z=0},
|
|
||||||
{x=-1, y=1, z=0},
|
|
||||||
{x=-1, y=-1, z=0},
|
|
||||||
{x=0, y=1, z=1},
|
|
||||||
{x=0, y=-1, z=1},
|
|
||||||
{x=0, y=1, z=-1},
|
|
||||||
{x=0, y=-1, z=-1},
|
|
||||||
-- vertical connectivity
|
|
||||||
{x=0, y=1, z=0},
|
|
||||||
{x=0, y=-1, z=0},
|
|
||||||
}
|
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
-- Action stuff --
|
-- Action stuff --
|
||||||
@ -79,7 +60,7 @@ local function update_real_port_states(pos, rule_name, new_state)
|
|||||||
if rule_name.x == nil then
|
if rule_name.x == nil then
|
||||||
for _, rname in ipairs(rule_name) do
|
for _, rname in ipairs(rule_name) do
|
||||||
local port = pos_to_side[rname.x + (2 * rname.y) + (3 * rname.z) + 4]
|
local port = pos_to_side[rname.x + (2 * rname.y) + (3 * rname.z) + 4]
|
||||||
L[port] = (new_state == "on") and 1 or 0
|
L[port] = (newstate == "on") and 1 or 0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local port = pos_to_side[rule_name.x + (2 * rule_name.y) + (3 * rule_name.z) + 4]
|
local port = pos_to_side[rule_name.x + (2 * rule_name.y) + (3 * rule_name.z) + 4]
|
||||||
@ -170,7 +151,7 @@ local function set_port_states(pos, ports)
|
|||||||
-- Solution / Workaround:
|
-- Solution / Workaround:
|
||||||
-- Remember which output was turned off and ignore next "off" event.
|
-- Remember which output was turned off and ignore next "off" event.
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local ign = minetest.deserialize(meta:get_string("ignore_offevents"), true) or {}
|
local ign = minetest.deserialize(meta:get_string("ignore_offevents")) or {}
|
||||||
if ports.red and not vports.red and not mesecon.is_powered(pos, rules.red) then ign.red = true end
|
if ports.red and not vports.red and not mesecon.is_powered(pos, rules.red) then ign.red = true end
|
||||||
if ports.blue and not vports.blue and not mesecon.is_powered(pos, rules.blue) then ign.blue = true end
|
if ports.blue and not vports.blue and not mesecon.is_powered(pos, rules.blue) then ign.blue = true end
|
||||||
if ports.yellow and not vports.yellow and not mesecon.is_powered(pos, rules.yellow) then ign.yellow = true end
|
if ports.yellow and not vports.yellow and not mesecon.is_powered(pos, rules.yellow) then ign.yellow = true end
|
||||||
@ -216,7 +197,7 @@ end
|
|||||||
|
|
||||||
local function ignore_event(event, meta)
|
local function ignore_event(event, meta)
|
||||||
if event.type ~= "off" then return false end
|
if event.type ~= "off" then return false end
|
||||||
local ignore_offevents = minetest.deserialize(meta:get_string("ignore_offevents"), true) or {}
|
local ignore_offevents = minetest.deserialize(meta:get_string("ignore_offevents")) or {}
|
||||||
if ignore_offevents[event.pin.name] then
|
if ignore_offevents[event.pin.name] then
|
||||||
ignore_offevents[event.pin.name] = nil
|
ignore_offevents[event.pin.name] = nil
|
||||||
meta:set_string("ignore_offevents", minetest.serialize(ignore_offevents))
|
meta:set_string("ignore_offevents", minetest.serialize(ignore_offevents))
|
||||||
@ -229,11 +210,7 @@ end
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function safe_print(param)
|
local function safe_print(param)
|
||||||
local string_meta = getmetatable("")
|
|
||||||
local sandbox = string_meta.__index
|
|
||||||
string_meta.__index = string -- Leave string sandbox temporarily
|
|
||||||
print(dump(param))
|
print(dump(param))
|
||||||
string_meta.__index = sandbox -- Restore string sandbox
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function safe_date()
|
local function safe_date()
|
||||||
@ -273,7 +250,6 @@ local function remove_functions(x)
|
|||||||
local seen = {}
|
local seen = {}
|
||||||
|
|
||||||
local function rfuncs(x)
|
local function rfuncs(x)
|
||||||
if x == nil then return end
|
|
||||||
if seen[x] then return end
|
if seen[x] then return end
|
||||||
seen[x] = true
|
seen[x] = true
|
||||||
if type(x) ~= "table" then return end
|
if type(x) ~= "table" then return end
|
||||||
@ -297,179 +273,51 @@ local function remove_functions(x)
|
|||||||
return x
|
return x
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The setting affects API so is not intended to be changeable at runtime
|
local function get_interrupt(pos)
|
||||||
local get_interrupt
|
-- iid = interrupt id
|
||||||
if mesecon.setting("luacontroller_lightweight_interrupts", false) then
|
local function interrupt(time, iid)
|
||||||
-- use node timer
|
if type(time) ~= "number" then return end
|
||||||
get_interrupt = function(pos, itbl, send_warning)
|
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
||||||
return (function(time, iid)
|
mesecon.queue:add_action(pos, "pipeworks:lc_tube_interrupt", {luac_id, iid}, time, iid, 1)
|
||||||
if type(time) ~= "number" then error("Delay must be a number") end
|
|
||||||
if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end
|
|
||||||
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- use global action queue
|
|
||||||
-- itbl: Flat table of functions to run after sandbox cleanup, used to prevent various security hazards
|
|
||||||
get_interrupt = function(pos, itbl, send_warning)
|
|
||||||
-- iid = interrupt id
|
|
||||||
local function interrupt(time, iid)
|
|
||||||
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
|
||||||
-- Hence the values get moved out. Should take less time than original, so totally compatible
|
|
||||||
if type(time) ~= "number" then error("Delay must be a number") end
|
|
||||||
table.insert(itbl, function ()
|
|
||||||
-- Outside string metatable sandbox, can safely run this now
|
|
||||||
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
|
||||||
-- Check if IID is dodgy, so you can't use interrupts to store an infinite amount of data.
|
|
||||||
-- Note that this is safe from alter-after-free because this code gets run after the sandbox has ended.
|
|
||||||
-- This runs outside of the timer and *shouldn't* harm perf. unless dodgy data is being sent in the first place
|
|
||||||
iid = remove_functions(iid)
|
|
||||||
local msg_ser = minetest.serialize(iid)
|
|
||||||
if #msg_ser <= mesecon.setting("luacontroller_interruptid_maxlen", 256) then
|
|
||||||
mesecon.queue:add_action(pos, "pipeworks:lc_tube_interrupt", {luac_id, iid}, time, iid, 1)
|
|
||||||
else
|
|
||||||
send_warning("An interrupt ID was too large!")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return interrupt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Given a message object passed to digiline_send, clean it up into a form
|
|
||||||
-- which is safe to transmit over the network and compute its "cost" (a very
|
|
||||||
-- rough estimate of its memory usage).
|
|
||||||
--
|
|
||||||
-- The cleaning comprises the following:
|
|
||||||
-- 1. Functions (and userdata, though user scripts ought not to get hold of
|
|
||||||
-- those in the first place) are removed, because they break the model of
|
|
||||||
-- Digilines as a network that carries basic data, and they could exfiltrate
|
|
||||||
-- references to mutable objects from one Luacontroller to another, allowing
|
|
||||||
-- inappropriate high-bandwidth, no-wires communication.
|
|
||||||
-- 2. Tables are duplicated because, being mutable, they could otherwise be
|
|
||||||
-- modified after the send is complete in order to change what data arrives
|
|
||||||
-- at the recipient, perhaps in violation of the previous cleaning rule or
|
|
||||||
-- in violation of the message size limit.
|
|
||||||
--
|
|
||||||
-- The cost indication is only approximate; it’s not a perfect measurement of
|
|
||||||
-- the number of bytes of memory used by the message object.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- msg -- the message to clean
|
|
||||||
-- back_references -- for internal use only; do not provide
|
|
||||||
--
|
|
||||||
-- Returns:
|
|
||||||
-- 1. The cleaned object.
|
|
||||||
-- 2. The approximate cost of the object.
|
|
||||||
local function clean_and_weigh_digiline_message(msg, back_references)
|
|
||||||
local t = type(msg)
|
|
||||||
if t == "string" then
|
|
||||||
-- Strings are immutable so can be passed by reference, and cost their
|
|
||||||
-- length plus the size of the Lua object header (24 bytes on a 64-bit
|
|
||||||
-- platform) plus one byte for the NUL terminator.
|
|
||||||
return msg, #msg + 25
|
|
||||||
elseif t == "number" then
|
|
||||||
-- Numbers are passed by value so need not be touched, and cost 8 bytes
|
|
||||||
-- as all numbers in Lua are doubles.
|
|
||||||
return msg, 8
|
|
||||||
elseif t == "boolean" then
|
|
||||||
-- Booleans are passed by value so need not be touched, and cost 1
|
|
||||||
-- byte.
|
|
||||||
return msg, 1
|
|
||||||
elseif t == "table" then
|
|
||||||
-- Tables are duplicated. Check if this table has been seen before
|
|
||||||
-- (self-referential or shared table); if so, reuse the cleaned value
|
|
||||||
-- of the previous occurrence, maintaining table topology and avoiding
|
|
||||||
-- infinite recursion, and charge zero bytes for this as the object has
|
|
||||||
-- already been counted.
|
|
||||||
back_references = back_references or {}
|
|
||||||
local bref = back_references[msg]
|
|
||||||
if bref then
|
|
||||||
return bref, 0
|
|
||||||
end
|
|
||||||
-- Construct a new table by cleaning all the keys and values and adding
|
|
||||||
-- up their costs, plus 8 bytes as a rough estimate of table overhead.
|
|
||||||
local cost = 8
|
|
||||||
local ret = {}
|
|
||||||
back_references[msg] = ret
|
|
||||||
for k, v in pairs(msg) do
|
|
||||||
local k_cost, v_cost
|
|
||||||
k, k_cost = clean_and_weigh_digiline_message(k, back_references)
|
|
||||||
v, v_cost = clean_and_weigh_digiline_message(v, back_references)
|
|
||||||
if k ~= nil and v ~= nil then
|
|
||||||
-- Only include an element if its key and value are of legal
|
|
||||||
-- types.
|
|
||||||
ret[k] = v
|
|
||||||
end
|
|
||||||
-- If we only counted the cost of a table element when we actually
|
|
||||||
-- used it, we would be vulnerable to the following attack:
|
|
||||||
-- 1. Construct a huge table (too large to pass the cost limit).
|
|
||||||
-- 2. Insert it somewhere in a table, with a function as a key.
|
|
||||||
-- 3. Insert it somewhere in another table, with a number as a key.
|
|
||||||
-- 4. The first occurrence doesn’t pay the cost because functions
|
|
||||||
-- are stripped and therefore the element is dropped.
|
|
||||||
-- 5. The second occurrence doesn’t pay the cost because it’s in
|
|
||||||
-- back_references.
|
|
||||||
-- By counting the costs regardless of whether the objects will be
|
|
||||||
-- included, we avoid this attack; it may overestimate the cost of
|
|
||||||
-- some messages, but only those that won’t be delivered intact
|
|
||||||
-- anyway because they contain illegal object types.
|
|
||||||
cost = cost + k_cost + v_cost
|
|
||||||
end
|
|
||||||
return ret, cost
|
|
||||||
else
|
|
||||||
return nil, 0
|
|
||||||
end
|
end
|
||||||
|
return interrupt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- itbl: Flat table of functions to run after sandbox cleanup, used to prevent various security hazards
|
local function get_digiline_send(pos)
|
||||||
local function get_digiline_send(pos, itbl, send_warning)
|
if not digiline then return end
|
||||||
if not minetest.global_exists("digilines") then return end
|
|
||||||
local chan_maxlen = mesecon.setting("luacontroller_digiline_channel_maxlen", 256)
|
|
||||||
local maxlen = mesecon.setting("luacontroller_digiline_maxlen", 50000)
|
|
||||||
return function(channel, msg)
|
return function(channel, msg)
|
||||||
-- NOTE: This runs within string metatable sandbox, so don't *rely* on anything of the form (""):y
|
|
||||||
-- or via anything that could.
|
|
||||||
-- Make sure channel is string, number or boolean
|
-- Make sure channel is string, number or boolean
|
||||||
if type(channel) == "string" then
|
if (type(channel) ~= "string" and type(channel) ~= "number" and type(channel) ~= "boolean") then
|
||||||
if #channel > chan_maxlen then
|
|
||||||
send_warning("Channel string too long.")
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
elseif (type(channel) ~= "string" and type(channel) ~= "number" and type(channel) ~= "boolean") then
|
|
||||||
send_warning("Channel must be string, number or boolean.")
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local msg_cost
|
-- It is technically possible to send functions over the wire since
|
||||||
msg, msg_cost = clean_and_weigh_digiline_message(msg)
|
-- the high performance impact of stripping those from the data has
|
||||||
if msg == nil or msg_cost > maxlen then
|
-- been decided to not be worth the added realism.
|
||||||
send_warning("Message was too complex, or contained invalid data.")
|
-- Make sure serialized version of the data is not insanely long to
|
||||||
|
-- prevent DoS-like attacks
|
||||||
|
local msg_ser = minetest.serialize(msg)
|
||||||
|
if #msg_ser > mesecon.setting("luacontroller_digiline_maxlen", 50000) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(itbl, function ()
|
minetest.after(0, function()
|
||||||
-- Runs outside of string metatable sandbox
|
digilines.receptor_send(pos, digiline.rules.default, channel, msg)
|
||||||
local luac_id = minetest.get_meta(pos):get_int("luac_id")
|
|
||||||
mesecon.queue:add_action(pos, "pipeworks:lt_digiline_relay", {channel, luac_id, msg})
|
|
||||||
end)
|
end)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local safe_globals = {
|
local safe_globals = {
|
||||||
-- Don't add pcall/xpcall unless willing to deal with the consequences (unless very careful, incredibly likely to allow killing server indirectly)
|
|
||||||
"assert", "error", "ipairs", "next", "pairs", "select",
|
"assert", "error", "ipairs", "next", "pairs", "select",
|
||||||
"tonumber", "tostring", "type", "unpack", "_VERSION"
|
"tonumber", "tostring", "type", "unpack", "_VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
local function create_environment(pos, mem, event, itbl, send_warning)
|
local function create_environment(pos, mem, event)
|
||||||
-- Make sure the tube hasn't broken.
|
|
||||||
local vports = minetest.registered_nodes[minetest.get_node(pos).name].virtual_portstates
|
|
||||||
if not vports then return {} end
|
|
||||||
|
|
||||||
-- Gather variables for the environment
|
-- Gather variables for the environment
|
||||||
|
local vports = minetest.registered_nodes[minetest.get_node(pos).name].virtual_portstates
|
||||||
local vports_copy = {}
|
local vports_copy = {}
|
||||||
for k, v in pairs(vports) do vports_copy[k] = v end
|
for k, v in pairs(vports) do vports_copy[k] = v end
|
||||||
local rports = get_real_port_states(pos)
|
local rports = get_real_port_states(pos)
|
||||||
@ -484,8 +332,8 @@ local function create_environment(pos, mem, event, itbl, send_warning)
|
|||||||
heat = mesecon.get_heat(pos),
|
heat = mesecon.get_heat(pos),
|
||||||
heat_max = mesecon.setting("overheat_max", 20),
|
heat_max = mesecon.setting("overheat_max", 20),
|
||||||
print = safe_print,
|
print = safe_print,
|
||||||
interrupt = get_interrupt(pos, itbl, send_warning),
|
interrupt = get_interrupt(pos),
|
||||||
digiline_send = get_digiline_send(pos, itbl, send_warning),
|
digiline_send = get_digiline_send(pos),
|
||||||
string = {
|
string = {
|
||||||
byte = string.byte,
|
byte = string.byte,
|
||||||
char = string.char,
|
char = string.char,
|
||||||
@ -573,11 +421,10 @@ local function create_sandbox(code, env)
|
|||||||
jit.off(f, true)
|
jit.off(f, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local maxevents = mesecon.setting("luacontroller_maxevents", 10000)
|
|
||||||
return function(...)
|
return function(...)
|
||||||
-- NOTE: This runs within string metatable sandbox, so the setting's been moved out for safety
|
|
||||||
-- Use instruction counter to stop execution
|
-- Use instruction counter to stop execution
|
||||||
-- after luacontroller_maxevents
|
-- after luacontroller_maxevents
|
||||||
|
local maxevents = mesecon.setting("luacontroller_maxevents", 10000)
|
||||||
debug.sethook(timeout, "", maxevents)
|
debug.sethook(timeout, "", maxevents)
|
||||||
local ok, ret = pcall(f, ...)
|
local ok, ret = pcall(f, ...)
|
||||||
debug.sethook() -- Clear hook
|
debug.sethook() -- Clear hook
|
||||||
@ -588,7 +435,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function load_memory(meta)
|
local function load_memory(meta)
|
||||||
return minetest.deserialize(meta:get_string("lc_memory"), true) or {}
|
return minetest.deserialize(meta:get_string("lc_memory")) or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -598,7 +445,6 @@ local function save_memory(pos, meta, mem)
|
|||||||
|
|
||||||
if (#memstring <= memsize_max) then
|
if (#memstring <= memsize_max) then
|
||||||
meta:set_string("lc_memory", memstring)
|
meta:set_string("lc_memory", memstring)
|
||||||
meta:mark_as_private("lc_memory")
|
|
||||||
else
|
else
|
||||||
print("Error: lua_tube memory overflow. "..memsize_max.." bytes available, "
|
print("Error: lua_tube memory overflow. "..memsize_max.." bytes available, "
|
||||||
..#memstring.." required. Controller overheats.")
|
..#memstring.." required. Controller overheats.")
|
||||||
@ -606,42 +452,26 @@ local function save_memory(pos, meta, mem)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns success (boolean), errmsg (string), retval(any, return value of the user supplied code)
|
|
||||||
-- run (as opposed to run_inner) is responsible for setting up meta according to this output
|
local function run(pos, event)
|
||||||
local function run_inner(pos, code, event)
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
-- Note: These return success, presumably to avoid changing LC ID.
|
if overheat(pos) then return end
|
||||||
if overheat(pos) then return true, "", nil end
|
if ignore_event(event, meta) then return end
|
||||||
if ignore_event(event, meta) then return true, "", nil end
|
|
||||||
|
|
||||||
-- Load code & mem from meta
|
-- Load code & mem from meta
|
||||||
local mem = load_memory(meta)
|
local mem = load_memory(meta)
|
||||||
local code = meta:get_string("code")
|
local code = meta:get_string("code")
|
||||||
|
|
||||||
-- 'Last warning' label.
|
|
||||||
local warning = ""
|
|
||||||
local function send_warning(str)
|
|
||||||
warning = "Warning: " .. str
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create environment
|
-- Create environment
|
||||||
local itbl = {}
|
local env = create_environment(pos, mem, event)
|
||||||
local env = create_environment(pos, mem, event, itbl, send_warning)
|
|
||||||
|
|
||||||
-- Create the sandbox and execute code
|
-- Create the sandbox and execute code
|
||||||
local f, msg = create_sandbox(code, env)
|
local f, msg = create_sandbox(code, env)
|
||||||
if not f then return false, msg, nil end
|
if not f then return false, msg end
|
||||||
-- Start string true sandboxing
|
local succ, msg = pcall(f)
|
||||||
local onetruestring = getmetatable("")
|
if not succ then return false, msg end
|
||||||
-- If a string sandbox is already up yet inconsistent, something is very wrong
|
|
||||||
assert(onetruestring.__index == string)
|
|
||||||
onetruestring.__index = env.string
|
|
||||||
local success, msg = pcall(f)
|
|
||||||
onetruestring.__index = string
|
|
||||||
-- End string true sandboxing
|
|
||||||
if not success then return false, msg, nil end
|
|
||||||
if type(env.port) ~= "table" then
|
if type(env.port) ~= "table" then
|
||||||
return false, "Ports set are invalid.", nil
|
return false, "Ports set are invalid."
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Actually set the ports
|
-- Actually set the ports
|
||||||
@ -650,81 +480,35 @@ local function run_inner(pos, code, event)
|
|||||||
-- Save memory. This may burn the luacontroller if a memory overflow occurs.
|
-- Save memory. This may burn the luacontroller if a memory overflow occurs.
|
||||||
save_memory(pos, meta, env.mem)
|
save_memory(pos, meta, env.mem)
|
||||||
|
|
||||||
-- Execute deferred tasks
|
return succ, msg
|
||||||
for _, v in ipairs(itbl) do
|
|
||||||
local failure = v()
|
|
||||||
if failure then
|
|
||||||
return false, failure, nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true, warning, msg
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function reset_formspec(meta, code, errmsg)
|
mesecon.queue:add_function("pipeworks:lc_tube_interrupt", function (pos, luac_id, iid)
|
||||||
meta:set_string("code", code)
|
-- There is no lua_tube anymore / it has been reprogrammed / replaced / burnt
|
||||||
meta:mark_as_private("code")
|
if (minetest.get_meta(pos):get_int("luac_id") ~= luac_id) then return end
|
||||||
code = minetest.formspec_escape(code or "")
|
if (minetest.registered_nodes[minetest.get_node(pos).name].is_burnt) then return end
|
||||||
errmsg = minetest.formspec_escape(tostring(errmsg or ""))
|
run(pos, {type = "interrupt", iid = iid})
|
||||||
meta:set_string("formspec", "size[12,10]"
|
end)
|
||||||
.."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"
|
|
||||||
.."label[0.1,8.3;"..errmsg.."]"
|
|
||||||
.."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"
|
|
||||||
.."image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]"
|
|
||||||
.."image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function reset_meta(pos, code, errmsg)
|
local function reset_meta(pos, code, errmsg)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
reset_formspec(meta, code, errmsg)
|
meta:set_string("code", code)
|
||||||
|
code = minetest.formspec_escape(code or "")
|
||||||
|
errmsg = minetest.formspec_escape(tostring(errmsg or ""))
|
||||||
|
meta:set_string("formspec", "size[12,10]"..
|
||||||
|
"background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]"..
|
||||||
|
"textarea[0.2,0.2;12.2,9.5;code;;"..code.."]"..
|
||||||
|
"image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]"..
|
||||||
|
"image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]"..
|
||||||
|
"label[0.1,9;"..errmsg.."]")
|
||||||
meta:set_int("luac_id", math.random(1, 65535))
|
meta:set_int("luac_id", math.random(1, 65535))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Wraps run_inner with LC-reset-on-error
|
|
||||||
local function run(pos, event)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local code = meta:get_string("code")
|
|
||||||
local ok, errmsg, retval = run_inner(pos, code, event)
|
|
||||||
if not ok then
|
|
||||||
reset_meta(pos, code, errmsg)
|
|
||||||
else
|
|
||||||
reset_formspec(meta, code, errmsg)
|
|
||||||
end
|
|
||||||
return ok, errmsg, retval
|
|
||||||
end
|
|
||||||
|
|
||||||
local function reset(pos)
|
local function reset(pos)
|
||||||
set_port_states(pos, {red = false, blue = false, yellow = false,
|
set_port_states(pos, {red = false, blue = false, yellow = false,
|
||||||
green = false, black = false, white = false})
|
green = false, black = false, white = false})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos)
|
|
||||||
if minetest.registered_nodes[minetest.get_node(pos).name].is_burnt then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
run(pos, {type="interrupt"})
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------
|
|
||||||
-- A.Queue callbacks --
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
mesecon.queue:add_function("pipeworks:lc_tube_interrupt", function (pos, luac_id, iid)
|
|
||||||
-- There is no lua_tube anymore / it has been reprogrammed / replaced / burnt
|
|
||||||
if (minetest.get_meta(pos):get_int("luac_id") ~= luac_id) then return end
|
|
||||||
if (minetest.registered_nodes[minetest.get_node(pos).name].is_burnt) then return end
|
|
||||||
run(pos, {type="interrupt", iid = iid})
|
|
||||||
end)
|
|
||||||
|
|
||||||
mesecon.queue:add_function("pipeworks:lt_digiline_relay", function (pos, channel, luac_id, msg)
|
|
||||||
if not digiline then return end
|
|
||||||
-- This check is only really necessary because in case of server crash, old actions can be thrown into the future
|
|
||||||
if (minetest.get_meta(pos):get_int("luac_id") ~= luac_id) then return end
|
|
||||||
if (minetest.registered_nodes[minetest.get_node(pos).name].is_burnt) then return end
|
|
||||||
-- The actual work
|
|
||||||
digiline:receptor_send(pos, digiline_rules_luatube, channel, msg)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
-- Node Registration --
|
-- Node Registration --
|
||||||
@ -754,26 +538,10 @@ local digiline = {
|
|||||||
receptor = {},
|
receptor = {},
|
||||||
effector = {
|
effector = {
|
||||||
action = function(pos, node, channel, msg)
|
action = function(pos, node, channel, msg)
|
||||||
msg = clean_and_weigh_digiline_message(msg)
|
|
||||||
run(pos, {type = "digiline", channel = channel, msg = msg})
|
run(pos, {type = "digiline", channel = channel, msg = msg})
|
||||||
end
|
end
|
||||||
},
|
}
|
||||||
wire = {
|
|
||||||
rules = pipeworks.digilines_rules
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local function get_program(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
return meta:get_string("code")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_program(pos, code)
|
|
||||||
reset(pos)
|
|
||||||
reset_meta(pos, code)
|
|
||||||
return run(pos, {type="program"})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function on_receive_fields(pos, form_name, fields, sender)
|
local function on_receive_fields(pos, form_name, fields, sender)
|
||||||
if not fields.program then
|
if not fields.program then
|
||||||
return
|
return
|
||||||
@ -783,10 +551,12 @@ local function on_receive_fields(pos, form_name, fields, sender)
|
|||||||
minetest.record_protection_violation(pos, name)
|
minetest.record_protection_violation(pos, name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ok, err = set_program(pos, fields.code)
|
reset(pos)
|
||||||
if not ok then
|
reset_meta(pos, fields.code)
|
||||||
-- it's not an error from the server perspective
|
local succ, err = run(pos, {type="program"})
|
||||||
minetest.log("action", "Lua controller programming error: " .. tostring(err))
|
if not succ then
|
||||||
|
print(err)
|
||||||
|
reset_meta(pos, fields.code, err)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -922,11 +692,7 @@ for white = 0, 1 do
|
|||||||
receptor = {
|
receptor = {
|
||||||
state = mesecon.state.on,
|
state = mesecon.state.on,
|
||||||
rules = output_rules[cid]
|
rules = output_rules[cid]
|
||||||
},
|
}
|
||||||
luacontroller = {
|
|
||||||
get_program = get_program,
|
|
||||||
set_program = set_program,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node(node_name, {
|
minetest.register_node(node_name, {
|
||||||
@ -934,7 +700,6 @@ for white = 0, 1 do
|
|||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
|
||||||
groups = groups,
|
groups = groups,
|
||||||
drop = BASENAME.."000000",
|
drop = BASENAME.."000000",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -961,7 +726,6 @@ for white = 0, 1 do
|
|||||||
pipeworks.after_dig(pos, node)
|
pipeworks.after_dig(pos, node)
|
||||||
end,
|
end,
|
||||||
is_luacontroller = true,
|
is_luacontroller = true,
|
||||||
on_timer = node_timer,
|
|
||||||
tubelike = 1,
|
tubelike = 1,
|
||||||
tube = {
|
tube = {
|
||||||
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
||||||
@ -969,13 +733,13 @@ for white = 0, 1 do
|
|||||||
can_go = function(pos, node, velocity, stack)
|
can_go = function(pos, node, velocity, stack)
|
||||||
local src = {name = nil}
|
local src = {name = nil}
|
||||||
-- add color of the incoming tube explicitly; referring to rules, in case they change later
|
-- add color of the incoming tube explicitly; referring to rules, in case they change later
|
||||||
for _, rule in pairs(rules) do
|
for color, rule in pairs(rules) do
|
||||||
if (-velocity.x == rule.x and -velocity.y == rule.y and -velocity.z == rule.z) then
|
if (-velocity.x == rule.x and -velocity.y == rule.y and -velocity.z == rule.z) then
|
||||||
src.name = rule.name
|
src.name = rule.name
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local succ, _, msg = run(pos, {
|
local succ, msg = run(pos, {
|
||||||
type = "item",
|
type = "item",
|
||||||
pin = src,
|
pin = src,
|
||||||
itemstring = stack:to_string(),
|
itemstring = stack:to_string(),
|
||||||
@ -993,7 +757,15 @@ for white = 0, 1 do
|
|||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if not intensity or intensity > 1 + 3^0.5 then
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return
|
return {string.format("%s_%s", name, dropname)}
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
|
end,
|
||||||
|
on_blast = function(pos, intensity)
|
||||||
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return {string.format("%s_%s", name, dropname)}
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
@ -1041,7 +813,6 @@ minetest.register_node(BASENAME .. "_burnt", {
|
|||||||
tiles = tiles_burnt,
|
tiles = tiles_burnt,
|
||||||
is_burnt = true,
|
is_burnt = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
|
||||||
groups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory=1},
|
groups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory=1},
|
||||||
drop = BASENAME.."000000",
|
drop = BASENAME.."000000",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -1070,7 +841,7 @@ minetest.register_node(BASENAME .. "_burnt", {
|
|||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if not intensity or intensity > 1 + 3^0.5 then
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return
|
return {string.format("%s_%s", name, dropname)}
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
|
@ -9,16 +9,16 @@ local filename = minetest.get_worldpath().."/luaentities"
|
|||||||
local function read_file()
|
local function read_file()
|
||||||
local f = io.open(filename, "r")
|
local f = io.open(filename, "r")
|
||||||
if f == nil then return {} end
|
if f == nil then return {} end
|
||||||
local t = f:read("*all")
|
local t = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
if t == "" or t == nil then return {} end
|
if t == "" or t == nil then return {} end
|
||||||
return minetest.deserialize(t) or {}
|
return minetest.deserialize(t) or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function write_file(tbl)
|
local function write_file(tbl)
|
||||||
local f = io.open(filename, "w")
|
local f = io.open(filename, "w")
|
||||||
f:write(minetest.serialize(tbl))
|
f:write(minetest.serialize(tbl))
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function read_entities()
|
local function read_entities()
|
||||||
@ -36,7 +36,7 @@ local function read_entities()
|
|||||||
y=math.min(30927,y)
|
y=math.min(30927,y)
|
||||||
z=math.min(30927,z)
|
z=math.min(30927,z)
|
||||||
|
|
||||||
entity.start_pos.x = x
|
entity.start_pos.x = x
|
||||||
entity.start_pos.y = y
|
entity.start_pos.y = y
|
||||||
entity.start_pos.z = z
|
entity.start_pos.z = z
|
||||||
|
|
||||||
@ -46,11 +46,6 @@ local function read_entities()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function write_entities()
|
local function write_entities()
|
||||||
if not luaentity.entities then
|
|
||||||
-- This can happen if crashing on startup, causing another error that
|
|
||||||
-- masks the original one. Return gracefully in that case instead.
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
setmetatable(entity, nil)
|
setmetatable(entity, nil)
|
||||||
for _, attached in pairs(entity._attached_entities) do
|
for _, attached in pairs(entity._attached_entities) do
|
||||||
@ -211,7 +206,7 @@ local entitydef_default = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
get_velocity = function(self)
|
get_velocity = function(self)
|
||||||
return vector.new(self._velocity)
|
return vector.new(self._velocity)
|
||||||
end,
|
end,
|
||||||
set_velocity = function(self, velocity)
|
set_velocity = function(self, velocity)
|
||||||
self._velocity = vector.new(velocity)
|
self._velocity = vector.new(velocity)
|
||||||
@ -289,7 +284,7 @@ function luaentity.add_entity(pos, name)
|
|||||||
_acceleration = {x = 0, y = 0, z = 0},
|
_acceleration = {x = 0, y = 0, z = 0},
|
||||||
_attached_entities = {},
|
_attached_entities = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
local prototype = luaentity.registered_entities[name]
|
local prototype = luaentity.registered_entities[name]
|
||||||
setmetatable(entity, prototype) -- Default to prototype for other methods
|
setmetatable(entity, prototype) -- Default to prototype for other methods
|
||||||
luaentity.entities[index] = entity
|
luaentity.entities[index] = entity
|
||||||
@ -318,20 +313,19 @@ end
|
|||||||
function luaentity.get_objects_inside_radius(pos, radius)
|
function luaentity.get_objects_inside_radius(pos, radius)
|
||||||
local objects = {}
|
local objects = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
if vector.distance(pos, entity:get_pos()) <= radius then
|
if vector.distance(pos, entity:get_pos()) <= radius then
|
||||||
objects[index] = entity
|
objects[index] = entity
|
||||||
index = index + 1
|
index = index + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return objects
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local move_entities_globalstep_part2 = function(dtime)
|
local move_entities_globalstep_part2 = function(dtime)
|
||||||
if not luaentity.entities then
|
if not luaentity.entities then
|
||||||
luaentity.entities = read_entities()
|
luaentity.entities = read_entities()
|
||||||
end
|
end
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
local master = entity._attached_entities_master
|
local master = entity._attached_entities_master
|
||||||
local master_def = master and entity._attached_entities[master]
|
local master_def = master and entity._attached_entities[master]
|
||||||
local master_entity = master_def and master_def.entity
|
local master_entity = master_def and master_def.entity
|
||||||
@ -341,8 +335,6 @@ local move_entities_globalstep_part2 = function(dtime)
|
|||||||
entity._velocity = master_entity:get_velocity()
|
entity._velocity = master_entity:get_velocity()
|
||||||
entity._acceleration = master_entity:get_acceleration()
|
entity._acceleration = master_entity:get_acceleration()
|
||||||
else
|
else
|
||||||
entity._velocity = entity._velocity or vector.new(0,0,0)
|
|
||||||
entity._acceleration = entity._acceleration or vector.new(0,0,0)
|
|
||||||
entity._pos = vector.add(vector.add(
|
entity._pos = vector.add(vector.add(
|
||||||
entity._pos,
|
entity._pos,
|
||||||
vector.multiply(entity._velocity, dtime)),
|
vector.multiply(entity._velocity, dtime)),
|
||||||
|
4
mod.conf
4
mod.conf
@ -1,5 +1 @@
|
|||||||
name = pipeworks
|
name = pipeworks
|
||||||
description = This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them.
|
|
||||||
depends = default, basic_materials, screwdriver
|
|
||||||
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib
|
|
||||||
min_minetest_version = 5.2.0
|
|
||||||
|
41
pipes.lua
41
pipes.lua
@ -1,5 +1,4 @@
|
|||||||
-- This file supplies the steel pipes
|
-- This file supplies the steel pipes
|
||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
|
|
||||||
local REGISTER_COMPATIBILITY = true
|
local REGISTER_COMPATIBILITY = true
|
||||||
|
|
||||||
@ -11,11 +10,11 @@ local new_flow_logic_register = pipeworks.flowables.register
|
|||||||
local polys = ""
|
local polys = ""
|
||||||
if pipeworks.enable_lowpoly then polys = "_lowpoly" end
|
if pipeworks.enable_lowpoly then polys = "_lowpoly" end
|
||||||
|
|
||||||
--~ local vti = {4, 3, 2, 1, 6, 5}
|
local vti = {4, 3, 2, 1, 6, 5}
|
||||||
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
|
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
|
||||||
for index, connects in ipairs(cconnects) do
|
for index, connects in ipairs(cconnects) do
|
||||||
local outsel = {}
|
local outsel = {}
|
||||||
|
|
||||||
local jx = 0
|
local jx = 0
|
||||||
local jy = 0
|
local jy = 0
|
||||||
local jz = 0
|
local jz = 0
|
||||||
@ -30,25 +29,23 @@ for index, connects in ipairs(cconnects) do
|
|||||||
table.insert(outsel, pipeworks.pipe_selectboxes[v])
|
table.insert(outsel, pipeworks.pipe_selectboxes[v])
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
if #connects == 1 then
|
if #connects == 1 then
|
||||||
local v = connects[1]
|
local v = connects[1]
|
||||||
v = v-1 + 2*(v%2) -- Opposite side
|
v = v-1 + 2*(v%2) -- Opposite side
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
||||||
local pipedesc = S("Pipe Segment").." "..dump(connects)
|
local pipedesc = "Pipe segement".." "..dump(connects).."... You hacker, you."
|
||||||
|
|
||||||
if #connects == 0 then
|
if #connects == 0 then
|
||||||
pgroups = {snappy = 3, tube = 1}
|
pgroups = {snappy = 3, tube = 1}
|
||||||
pipedesc = S("Pipe Segment")
|
pipedesc = "Pipe segment"
|
||||||
end
|
end
|
||||||
|
|
||||||
local outimg_e = { "pipeworks_pipe_plain.png" }
|
local outimg_e = { "pipeworks_pipe_plain.png" }
|
||||||
local outimg_l = { "pipeworks_pipe_plain.png" }
|
local outimg_l = { "pipeworks_pipe_plain.png" }
|
||||||
|
|
||||||
if index == 3 then
|
if index == 3 then
|
||||||
outimg_e = { "pipeworks_pipe_3_empty.png" }
|
outimg_e = { "pipeworks_pipe_3_empty.png" }
|
||||||
outimg_l = { "pipeworks_pipe_3_loaded.png" }
|
outimg_l = { "pipeworks_pipe_3_loaded.png" }
|
||||||
end
|
end
|
||||||
@ -76,7 +73,7 @@ for index, connects in ipairs(cconnects) do
|
|||||||
fixed = outsel
|
fixed = outsel
|
||||||
},
|
},
|
||||||
groups = pgroups,
|
groups = pgroups,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
drop = "pipeworks:pipe_1_empty",
|
drop = "pipeworks:pipe_1_empty",
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -85,12 +82,9 @@ for index, connects in ipairs(cconnects) do
|
|||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
on_rotate = false,
|
on_rotate = false
|
||||||
check_for_pole = pipeworks.check_for_vert_pipe,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_pipe,
|
|
||||||
pipenumber = index
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
||||||
|
|
||||||
minetest.register_node("pipeworks:pipe_"..index.."_loaded", {
|
minetest.register_node("pipeworks:pipe_"..index.."_loaded", {
|
||||||
@ -110,7 +104,7 @@ for index, connects in ipairs(cconnects) do
|
|||||||
fixed = outsel
|
fixed = outsel
|
||||||
},
|
},
|
||||||
groups = pgroups,
|
groups = pgroups,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
drop = "pipeworks:pipe_1_empty",
|
drop = "pipeworks:pipe_1_empty",
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -120,12 +114,9 @@ for index, connects in ipairs(cconnects) do
|
|||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
on_rotate = false,
|
on_rotate = false
|
||||||
check_for_pole = pipeworks.check_for_vert_pipe,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_pipe,
|
|
||||||
pipenumber = index
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local emptypipe = "pipeworks:pipe_"..index.."_empty"
|
local emptypipe = "pipeworks:pipe_"..index.."_empty"
|
||||||
local fullpipe = "pipeworks:pipe_"..index.."_loaded"
|
local fullpipe = "pipeworks:pipe_"..index.."_loaded"
|
||||||
table.insert(pipes_empty_nodenames, emptypipe)
|
table.insert(pipes_empty_nodenames, emptypipe)
|
||||||
@ -143,7 +134,7 @@ if REGISTER_COMPATIBILITY then
|
|||||||
drawtype = "airlike",
|
drawtype = "airlike",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
description = S("Pipe Segment (legacy)"),
|
description = "Pipe Segment (legacy)",
|
||||||
groups = {not_in_creative_inventory = 1, pipe_to_update = 1},
|
groups = {not_in_creative_inventory = 1, pipe_to_update = 1},
|
||||||
drop = "pipeworks:pipe_1_empty",
|
drop = "pipeworks:pipe_1_empty",
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
@ -241,7 +232,7 @@ minetest.register_abm({
|
|||||||
nodenames = {"pipeworks:spigot","pipeworks:spigot_pouring"},
|
nodenames = {"pipeworks:spigot","pipeworks:spigot_pouring"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
pipeworks.spigot_check(pos,node)
|
pipeworks.spigot_check(pos,node)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -250,7 +241,7 @@ minetest.register_abm({
|
|||||||
nodenames = {"pipeworks:fountainhead","pipeworks:fountainhead_pouring"},
|
nodenames = {"pipeworks:fountainhead","pipeworks:fountainhead_pouring"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
pipeworks.fountainhead_check(pos,node)
|
pipeworks.fountainhead_check(pos,node)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -29,7 +29,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
--~ local formatvec = function(vec) local sep="," return "("..tostring(vec.x)..sep..tostring(vec.y)..sep..tostring(vec.z)..")" end
|
local formatvec = function(vec) local sep="," return "("..tostring(vec.x)..sep..tostring(vec.y)..sep..tostring(vec.z)..")" end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ end
|
|||||||
local check_for_liquids_v2 = function(pos, limit)
|
local check_for_liquids_v2 = function(pos, limit)
|
||||||
local coords = make_coords_offsets(pos, false)
|
local coords = make_coords_offsets(pos, false)
|
||||||
local total = 0
|
local total = 0
|
||||||
for _, tpos in ipairs(coords) do
|
for index, tpos in ipairs(coords) do
|
||||||
if total >= limit then break end
|
if total >= limit then break end
|
||||||
local name = minetest.get_node(tpos).name
|
local name = minetest.get_node(tpos).name
|
||||||
if name == "default:water_source" then
|
if name == "default:water_source" then
|
||||||
@ -69,13 +69,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- logging is unreliable when something is crashing...
|
-- logging is unreliable when something is crashing...
|
||||||
--[[
|
|
||||||
local nilexplode = function(caller, label, value)
|
local nilexplode = function(caller, label, value)
|
||||||
if value == nil then
|
if value == nil then
|
||||||
error(caller..": "..label.." was nil")
|
error(caller..": "..label.." was nil")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -153,7 +151,7 @@ local get_neighbour_positions = function(pos, node)
|
|||||||
|
|
||||||
-- then, check each possible neighbour to see if they can be reached from this node.
|
-- then, check each possible neighbour to see if they can be reached from this node.
|
||||||
local connections = {}
|
local connections = {}
|
||||||
for _, offset in ipairs(candidates) do
|
for index, offset in ipairs(candidates) do
|
||||||
local npos = vector.add(pos, offset)
|
local npos = vector.add(pos, offset)
|
||||||
local neighbour = minetest.get_node(npos)
|
local neighbour = minetest.get_node(npos)
|
||||||
local nodename = neighbour.name
|
local nodename = neighbour.name
|
||||||
@ -187,12 +185,13 @@ flowlogic.balance_pressure = function(pos, node, currentpressure)
|
|||||||
-- local dname = "flowlogic.balance_pressure()@"..formatvec(pos).." "
|
-- local dname = "flowlogic.balance_pressure()@"..formatvec(pos).." "
|
||||||
-- check the pressure of all nearby flowable nodes, and average it out.
|
-- check the pressure of all nearby flowable nodes, and average it out.
|
||||||
|
|
||||||
|
-- pressure handles to average over
|
||||||
|
local connections = {}
|
||||||
-- unconditionally include self in nodes to average over.
|
-- unconditionally include self in nodes to average over.
|
||||||
-- result of averaging will be returned as new pressure for main flow logic callback
|
-- result of averaging will be returned as new pressure for main flow logic callback
|
||||||
local totalv = currentpressure
|
local totalv = currentpressure
|
||||||
local totalc = 1
|
local totalc = 1
|
||||||
|
|
||||||
-- pressure handles to average over
|
|
||||||
local connections = get_neighbour_positions(pos, node)
|
local connections = get_neighbour_positions(pos, node)
|
||||||
|
|
||||||
-- for each neighbour, add neighbour's pressure to the total to balance out
|
-- for each neighbour, add neighbour's pressure to the total to balance out
|
||||||
@ -288,7 +287,7 @@ flowlogic.run_output = function(pos, node, currentpressure, oldpressure, outputd
|
|||||||
local upper = outputdef.upper
|
local upper = outputdef.upper
|
||||||
local lower = outputdef.lower
|
local lower = outputdef.lower
|
||||||
local result = currentpressure
|
local result = currentpressure
|
||||||
local threshold
|
local threshold = nil
|
||||||
if finitemode then threshold = lower else threshold = upper end
|
if finitemode then threshold = lower else threshold = upper end
|
||||||
if currentpressure > threshold then
|
if currentpressure > threshold then
|
||||||
local takenpressure = outputdef.outputfn(pos, node, currentpressure, finitemode)
|
local takenpressure = outputdef.outputfn(pos, node, currentpressure, finitemode)
|
||||||
@ -317,7 +316,7 @@ flowlogic.run_transition = function(node, currentpressure)
|
|||||||
local nodename_prev = simplesetdef[1].nodename
|
local nodename_prev = simplesetdef[1].nodename
|
||||||
local result_nodename = node.name
|
local result_nodename = node.name
|
||||||
|
|
||||||
for _, element in ipairs(simplesetdef) do
|
for index, element in ipairs(simplesetdef) do
|
||||||
-- find the highest element that is below the current pressure.
|
-- find the highest element that is below the current pressure.
|
||||||
local threshold = element.threshold
|
local threshold = element.threshold
|
||||||
if threshold > currentpressure then
|
if threshold > currentpressure then
|
||||||
@ -339,9 +338,7 @@ flowlogic.run_transition = function(node, currentpressure)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not found then
|
if not found then
|
||||||
pipeworks.logger("flowlogic.run_transition() BUG no transition " ..
|
pipeworks.logger("flowlogic.run_transition() BUG no transition definitions found! nodename="..nodename.." currentpressure="..tostring(currentpressure))
|
||||||
"definitions found! node.name=" .. node.name ..
|
|
||||||
" currentpressure=" .. tostring(currentpressure))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -26,8 +26,8 @@ local insertbase = function(nodename)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local regwarning = function(kind, nodename)
|
local regwarning = function(kind, nodename)
|
||||||
--~ local tail = ""
|
local tail = ""
|
||||||
--~ if pipeworks.toggles.pipe_mode ~= "pressure" then tail = " but pressure logic not enabled" end
|
if pipeworks.toggles.pipe_mode ~= "pressure" then tail = " but pressure logic not enabled" end
|
||||||
--pipeworks.logger(kind.." flow logic registry requested for "..nodename..tail)
|
--pipeworks.logger(kind.." flow logic registry requested for "..nodename..tail)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ register.directional_horizonal_rotate = function(nodename, doubleended)
|
|||||||
end
|
end
|
||||||
local directionfn = function(node, direction)
|
local directionfn = function(node, direction)
|
||||||
local result = false
|
local result = false
|
||||||
for _, endvec in ipairs(getends(node)) do
|
for index, endvec in ipairs(getends(node)) do
|
||||||
if vector.equals(direction, endvec) then result = true end
|
if vector.equals(direction, endvec) then result = true end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
-- the default tube and default textures
|
-- the default tube and default textures
|
||||||
pipeworks.register_tube("pipeworks:tube", S("Pneumatic tube segment"))
|
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment")
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:tube_1 6",
|
output = "pipeworks:tube_1 6",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "", "", "" },
|
{ "", "", "" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local nodecolor = 0xffff3030
|
local nodecolor = 0xffff3030
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:broken_tube", {
|
pipeworks.register_tube("pipeworks:broken_tube", {
|
||||||
description = S("Broken Tube"),
|
description = "Broken Tube (you hacker you)",
|
||||||
plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
|
plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
|
||||||
noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
|
noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } },
|
||||||
ends = { { name = "pipeworks_broken_tube_end.png", color = nodecolor } },
|
ends = { { name = "pipeworks_broken_tube_end.png", color = nodecolor } },
|
||||||
@ -35,7 +35,7 @@ pipeworks.register_tube("pipeworks:broken_tube", {
|
|||||||
local itemstack = puncher:get_wielded_item()
|
local itemstack = puncher:get_wielded_item()
|
||||||
local wieldname = itemstack:get_name()
|
local wieldname = itemstack:get_name()
|
||||||
local playername = puncher:get_player_name()
|
local playername = puncher:get_player_name()
|
||||||
local log_msg = playername.." struck a broken tube at "..minetest.pos_to_string(pos).."\n"
|
print("[Pipeworks] "..playername.." struck a broken tube at "..minetest.pos_to_string(pos))
|
||||||
if wieldname == "anvil:hammer"
|
if wieldname == "anvil:hammer"
|
||||||
or wieldname == "cottages:hammer"
|
or wieldname == "cottages:hammer"
|
||||||
or wieldname == "glooptest:hammer_steel"
|
or wieldname == "glooptest:hammer_steel"
|
||||||
@ -47,17 +47,17 @@ pipeworks.register_tube("pipeworks:broken_tube", {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
|
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
|
||||||
if was_node and was_node ~= "" then
|
if was_node and was_node ~= "" then
|
||||||
pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
|
print(" with "..wieldname.." to repair it.")
|
||||||
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
|
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
itemstack:add_wear(1000)
|
itemstack:add_wear(1000)
|
||||||
puncher:set_wielded_item(itemstack)
|
puncher:set_wielded_item(itemstack)
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
pipeworks.logger(log_msg.." but it can't be repaired.")
|
print(" but it can't be repaired.")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.")
|
print(" with "..wieldname.." but that tool is too weak.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ pipeworks.register_tube("pipeworks:broken_tube", {
|
|||||||
if pipeworks.enable_priority_tube then
|
if pipeworks.enable_priority_tube then
|
||||||
local color = "#ff3030:128"
|
local color = "#ff3030:128"
|
||||||
pipeworks.register_tube("pipeworks:priority_tube", {
|
pipeworks.register_tube("pipeworks:priority_tube", {
|
||||||
description = S("High Priority Tube Segment"),
|
description = "High Priority Tube Segment",
|
||||||
inventory_image = "pipeworks_tube_inv.png^[colorize:" .. color,
|
inventory_image = "pipeworks_tube_inv.png^[colorize:" .. color,
|
||||||
plain = { { name = "pipeworks_tube_plain.png", color = nodecolor } },
|
plain = { { name = "pipeworks_tube_plain.png", color = nodecolor } },
|
||||||
noctr = { { name = "pipeworks_tube_noctr.png", color = nodecolor } },
|
noctr = { { name = "pipeworks_tube_noctr.png", color = nodecolor } },
|
||||||
@ -82,16 +82,16 @@ if pipeworks.enable_priority_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:priority_tube_1 6",
|
output = "pipeworks:priority_tube_1 6",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "default:gold_ingot", "", "default:gold_ingot" },
|
{ "default:gold_ingot", "", "default:gold_ingot" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_accelerator_tube then
|
if pipeworks.enable_accelerator_tube then
|
||||||
pipeworks.register_tube("pipeworks:accelerator_tube", {
|
pipeworks.register_tube("pipeworks:accelerator_tube", {
|
||||||
description = S("Accelerating Pneumatic Tube Segment"),
|
description = "Accelerating Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_accelerator_tube_inv.png",
|
inventory_image = "pipeworks_accelerator_tube_inv.png",
|
||||||
plain = { "pipeworks_accelerator_tube_plain.png" },
|
plain = { "pipeworks_accelerator_tube_plain.png" },
|
||||||
noctr = { "pipeworks_accelerator_tube_noctr.png" },
|
noctr = { "pipeworks_accelerator_tube_noctr.png" },
|
||||||
@ -107,16 +107,16 @@ if pipeworks.enable_accelerator_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:accelerator_tube_1 2",
|
output = "pipeworks:accelerator_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
|
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_crossing_tube then
|
if pipeworks.enable_crossing_tube then
|
||||||
pipeworks.register_tube("pipeworks:crossing_tube", {
|
pipeworks.register_tube("pipeworks:crossing_tube", {
|
||||||
description = S("Crossing Pneumatic Tube Segment"),
|
description = "Crossing Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_crossing_tube_inv.png",
|
inventory_image = "pipeworks_crossing_tube_inv.png",
|
||||||
plain = { "pipeworks_crossing_tube_plain.png" },
|
plain = { "pipeworks_crossing_tube_plain.png" },
|
||||||
noctr = { "pipeworks_crossing_tube_noctr.png" },
|
noctr = { "pipeworks_crossing_tube_noctr.png" },
|
||||||
@ -138,7 +138,7 @@ end
|
|||||||
|
|
||||||
if pipeworks.enable_one_way_tube then
|
if pipeworks.enable_one_way_tube then
|
||||||
minetest.register_node("pipeworks:one_way_tube", {
|
minetest.register_node("pipeworks:one_way_tube", {
|
||||||
description = S("One way tube"),
|
description = "One way tube",
|
||||||
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
|
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
|
||||||
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
|
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -161,16 +161,13 @@ if pipeworks.enable_one_way_tube then
|
|||||||
},
|
},
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate,
|
|
||||||
check_for_pole = pipeworks.check_for_vert_tube,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_tube
|
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pipeworks:one_way_tube 2",
|
output = "pipeworks:one_way_tube 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "group:stick", "default:mese_crystal", "basic_materials:plastic_sheet" },
|
{ "group:stick", "default:mese_crystal", "homedecor:plastic_sheeting" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
if pipeworks.enable_detector_tube then
|
if pipeworks.enable_detector_tube then
|
||||||
local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step"))
|
local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step"))
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_on", {
|
pipeworks.register_tube("pipeworks:detector_tube_on", {
|
||||||
description = S("Detecting Pneumatic Tube Segment on"),
|
description = "Detecting Pneumatic Tube Segment on (you hacker you)",
|
||||||
inventory_image = "pipeworks_detector_tube_inv.png",
|
inventory_image = "pipeworks_detector_tube_inv.png",
|
||||||
plain = { "pipeworks_detector_tube_plain.png" },
|
plain = { "pipeworks_detector_tube_plain.png" },
|
||||||
node_def = {
|
node_def = {
|
||||||
@ -41,7 +40,7 @@ if pipeworks.enable_detector_tube then
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_off", {
|
pipeworks.register_tube("pipeworks:detector_tube_off", {
|
||||||
description = S("Detecting Pneumatic Tube Segment"),
|
description = "Detecting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_detector_tube_inv.png",
|
inventory_image = "pipeworks_detector_tube_inv.png",
|
||||||
plain = { "pipeworks_detector_tube_plain.png" },
|
plain = { "pipeworks_detector_tube_plain.png" },
|
||||||
node_def = {
|
node_def = {
|
||||||
@ -61,9 +60,9 @@ if pipeworks.enable_detector_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:detector_tube_off_1 2",
|
output = "pipeworks:detector_tube_off_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "mesecons:mesecon", "mesecons_materials:silicon", "mesecons:mesecon" },
|
{ "mesecons:mesecon", "mesecons_materials:silicon", "mesecons:mesecon" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -71,7 +70,7 @@ end
|
|||||||
local digiline_enabled = minetest.get_modpath("digilines") ~= nil
|
local digiline_enabled = minetest.get_modpath("digilines") ~= nil
|
||||||
if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
||||||
pipeworks.register_tube("pipeworks:digiline_detector_tube", {
|
pipeworks.register_tube("pipeworks:digiline_detector_tube", {
|
||||||
description = S("Digiline Detecting Pneumatic Tube Segment"),
|
description = "Digiline Detecting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_digiline_detector_tube_inv.png",
|
inventory_image = "pipeworks_digiline_detector_tube_inv.png",
|
||||||
plain = { "pipeworks_digiline_detector_tube_plain.png" },
|
plain = { "pipeworks_digiline_detector_tube_plain.png" },
|
||||||
node_def = {
|
node_def = {
|
||||||
@ -80,7 +79,7 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
|||||||
|
|
||||||
local setchan = meta:get_string("channel")
|
local setchan = meta:get_string("channel")
|
||||||
|
|
||||||
digiline:receptor_send(pos, digiline.rules.default, setchan, stack:to_table())
|
digiline:receptor_send(pos, digiline.rules.default, setchan, stack:to_string())
|
||||||
|
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
||||||
end},
|
end},
|
||||||
@ -88,9 +87,9 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[8.6,2.2]"..
|
"size[8.6,2.2]"..
|
||||||
"field[0.6,0.6;8,1;channel;"..S("Channel")..";${channel}]"..
|
"field[0.6,0.6;8,1;channel;Channel:;${channel}]"..
|
||||||
"image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]"..
|
"image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]"..
|
||||||
"label[1.6,1.2;"..S("Digiline Detecting Tube").."]"
|
"label[1.6,1.2;Digiline Detecting Tube]"
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
@ -103,10 +102,7 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
|||||||
receptor = {},
|
receptor = {},
|
||||||
effector = {
|
effector = {
|
||||||
action = function(pos,node,channel,msg) end
|
action = function(pos,node,channel,msg) end
|
||||||
},
|
}
|
||||||
wire = {
|
|
||||||
rules = pipeworks.digilines_rules
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -114,16 +110,16 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:digiline_detector_tube_1 2",
|
output = "pipeworks:digiline_detector_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "digilines:wire_std_00000000", "mesecons_materials:silicon", "digilines:wire_std_00000000" },
|
{ "digilines:wire_std_00000000", "mesecons_materials:silicon", "digilines:wire_std_00000000" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_conductor_tube then
|
if pipeworks.enable_conductor_tube then
|
||||||
pipeworks.register_tube("pipeworks:conductor_tube_off", {
|
pipeworks.register_tube("pipeworks:conductor_tube_off", {
|
||||||
description = S("Conducting Pneumatic Tube Segment"),
|
description = "Conducting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_conductor_tube_inv.png",
|
inventory_image = "pipeworks_conductor_tube_inv.png",
|
||||||
short = "pipeworks_conductor_tube_short.png",
|
short = "pipeworks_conductor_tube_short.png",
|
||||||
plain = { "pipeworks_conductor_tube_plain.png" },
|
plain = { "pipeworks_conductor_tube_plain.png" },
|
||||||
@ -137,7 +133,7 @@ if pipeworks.enable_conductor_tube then
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
pipeworks.register_tube("pipeworks:conductor_tube_on", {
|
pipeworks.register_tube("pipeworks:conductor_tube_on", {
|
||||||
description = S("Conducting Pneumatic Tube Segment on"),
|
description = "Conducting Pneumatic Tube Segment on (you hacker you)",
|
||||||
inventory_image = "pipeworks_conductor_tube_inv.png",
|
inventory_image = "pipeworks_conductor_tube_inv.png",
|
||||||
short = "pipeworks_conductor_tube_short.png",
|
short = "pipeworks_conductor_tube_short.png",
|
||||||
plain = { "pipeworks_conductor_tube_on_plain.png" },
|
plain = { "pipeworks_conductor_tube_on_plain.png" },
|
||||||
@ -161,7 +157,7 @@ end
|
|||||||
|
|
||||||
if digiline_enabled and pipeworks.enable_digiline_conductor_tube then
|
if digiline_enabled and pipeworks.enable_digiline_conductor_tube then
|
||||||
pipeworks.register_tube("pipeworks:digiline_conductor_tube", {
|
pipeworks.register_tube("pipeworks:digiline_conductor_tube", {
|
||||||
description = S("Digiline Conducting Pneumatic Tube Segment"),
|
description = "Digiline Conducting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
inventory_image = "pipeworks_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
||||||
short = "pipeworks_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
short = "pipeworks_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
||||||
plain = {"pipeworks_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
plain = {"pipeworks_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
||||||
@ -179,7 +175,7 @@ end
|
|||||||
if digiline_enabled and pipeworks.enable_digiline_conductor_tube and
|
if digiline_enabled and pipeworks.enable_digiline_conductor_tube and
|
||||||
pipeworks.enable_conductor_tube then
|
pipeworks.enable_conductor_tube then
|
||||||
pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_off", {
|
pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_off", {
|
||||||
description = S("Mesecon and Digiline Conducting Pneumatic Tube Segment"),
|
description = "Mesecon and Digiline Conducting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
||||||
short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
||||||
plain = {"pipeworks_conductor_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
plain = {"pipeworks_conductor_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
||||||
@ -196,7 +192,7 @@ if digiline_enabled and pipeworks.enable_digiline_conductor_tube and
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_on", {
|
pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_on", {
|
||||||
description = S("Mesecon and Digiline Conducting Pneumatic Tube Segment on"),
|
description = "Mesecon and Digiline Conducting Pneumatic Tube Segment on (you hacker you)",
|
||||||
inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png",
|
||||||
short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png",
|
||||||
plain = {"pipeworks_conductor_tube_on_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
plain = {"pipeworks_conductor_tube_on_plain.png^pipeworks_digiline_conductor_tube_plain.png"},
|
||||||
|
241
signs_compat.lua
241
signs_compat.lua
@ -1,241 +0,0 @@
|
|||||||
-- This file adds placement rules for signs_lib, if present
|
|
||||||
|
|
||||||
local spv = {
|
|
||||||
[4] = true,
|
|
||||||
[6] = true,
|
|
||||||
[8] = true,
|
|
||||||
[10] = true,
|
|
||||||
[13] = true,
|
|
||||||
[15] = true,
|
|
||||||
[17] = true,
|
|
||||||
[19] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local sphns = {
|
|
||||||
[1] = true,
|
|
||||||
[3] = true,
|
|
||||||
[5] = true,
|
|
||||||
[7] = true,
|
|
||||||
[9] = true,
|
|
||||||
[11] = true,
|
|
||||||
[21] = true,
|
|
||||||
[23] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local sphew = {
|
|
||||||
[0] = true,
|
|
||||||
[2] = true,
|
|
||||||
[12] = true,
|
|
||||||
[14] = true,
|
|
||||||
[16] = true,
|
|
||||||
[18] = true,
|
|
||||||
[20] = true,
|
|
||||||
[22] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local owtv = {
|
|
||||||
[5] = true,
|
|
||||||
[7] = true,
|
|
||||||
[9] = true,
|
|
||||||
[11] = true,
|
|
||||||
[12] = true,
|
|
||||||
[14] = true,
|
|
||||||
[16] = true,
|
|
||||||
[18] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local owtns = {
|
|
||||||
[0] = true,
|
|
||||||
[2] = true,
|
|
||||||
[4] = true,
|
|
||||||
[6] = true,
|
|
||||||
[8] = true,
|
|
||||||
[10] = true,
|
|
||||||
[20] = true,
|
|
||||||
[22] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local owtew = {
|
|
||||||
[1] = true,
|
|
||||||
[3] = true,
|
|
||||||
[13] = true,
|
|
||||||
[15] = true,
|
|
||||||
[17] = true,
|
|
||||||
[19] = true,
|
|
||||||
[21] = true,
|
|
||||||
[23] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local vert_n = {
|
|
||||||
[3] = {[5] = true},
|
|
||||||
[6] = {[9] = true, [12] = true, [16] = true},
|
|
||||||
[7] = {[9] = true, [11] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local vert_e = {
|
|
||||||
[3] = {[5] = true},
|
|
||||||
[6] = {[5] = true, [9] = true, [16] = true},
|
|
||||||
[7] = {[7] = true, [11] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local vert_s = {
|
|
||||||
[3] = {[5] = true},
|
|
||||||
[6] = {[5] = true, [12] = true, [16] = true},
|
|
||||||
[7] = {[5] = true, [7] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local vert_w = {
|
|
||||||
[3] = {[5] = true},
|
|
||||||
[6] = {[5] = true, [9] = true, [12] = true},
|
|
||||||
[7] = {[5] = true, [9] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local horiz_n = {
|
|
||||||
[3] = {[0] = true},
|
|
||||||
[6] = {[0] = true, [4] = true, [20] = true},
|
|
||||||
[7] = {[2] = true, [10] = true},
|
|
||||||
[8] = {[0] = true},
|
|
||||||
[9] = {[2] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local horiz_e = {
|
|
||||||
[3] = {[1] = true},
|
|
||||||
[6] = {[1] = true, [17] = true, [21] = true},
|
|
||||||
[7] = {[3] = true, [19] = true},
|
|
||||||
[8] = {[1] = true},
|
|
||||||
[9] = {[3] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local horiz_s = {
|
|
||||||
[3] = {[0] = true},
|
|
||||||
[6] = {[0] = true, [8] = true, [20] = true},
|
|
||||||
[7] = {[0] = true, [4] = true},
|
|
||||||
[8] = {[0] = true},
|
|
||||||
[9] = {[0] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local horiz_w = {
|
|
||||||
[3] = {[1] = true},
|
|
||||||
[6] = {[1] = true, [13] = true, [21] = true},
|
|
||||||
[7] = {[1] = true, [13] = true},
|
|
||||||
[8] = {[1] = true},
|
|
||||||
[9] = {[1] = true},
|
|
||||||
}
|
|
||||||
|
|
||||||
local function get_sign_dir(node, def)
|
|
||||||
if (node.param2 == 4 and def.paramtype2 == "wallmounted")
|
|
||||||
or (node.param2 == 0 and def.paramtype2 ~= "wallmounted") then
|
|
||||||
return {["N"] = true}
|
|
||||||
elseif (node.param2 == 2 and def.paramtype2 == "wallmounted")
|
|
||||||
or (node.param2 == 1 and def.paramtype2 ~= "wallmounted") then
|
|
||||||
return {["E"] = true}
|
|
||||||
elseif (node.param2 == 5 and def.paramtype2 == "wallmounted")
|
|
||||||
or (node.param2 == 2 and def.paramtype2 ~= "wallmounted") then
|
|
||||||
return {["S"] = true}
|
|
||||||
elseif node.param2 == 3 then
|
|
||||||
return {["W"] = true}
|
|
||||||
end
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
In the functions below:
|
|
||||||
|
|
||||||
pos: the (real) position of the placed sign
|
|
||||||
node: the sign node itself
|
|
||||||
def: its definition
|
|
||||||
|
|
||||||
ppos: the position of the pointed node (pipe/tube)
|
|
||||||
pnode: the node itself
|
|
||||||
pdef: its definition
|
|
||||||
|
|
||||||
--]]
|
|
||||||
|
|
||||||
|
|
||||||
-- pipes
|
|
||||||
|
|
||||||
function pipeworks.check_for_vert_pipe(pos, node, def, ppos, pnode, pdef)
|
|
||||||
local signdir = get_sign_dir(node, def)
|
|
||||||
local pipenumber = pdef.pipenumber
|
|
||||||
local pipedir = pnode.param2
|
|
||||||
if string.find(pnode.name, "straight_pipe") and spv[pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["N"] and vert_n[pipenumber] and vert_n[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["E"] and vert_e[pipenumber] and vert_e[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["S"] and vert_s[pipenumber] and vert_s[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["W"] and vert_w[pipenumber] and vert_w[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function pipeworks.check_for_horiz_pipe(pos, node, def, ppos, pnode, pdef)
|
|
||||||
local signdir = get_sign_dir(node, def)
|
|
||||||
local pipenumber = pdef.pipenumber
|
|
||||||
local pipedir = pnode.param2
|
|
||||||
if string.find(pnode.name, "straight_pipe") then
|
|
||||||
if (signdir["N"] or signdir["S"]) and sphns[pipedir] then
|
|
||||||
return true
|
|
||||||
elseif (signdir["E"] or signdir["W"]) and sphew[pipedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
elseif signdir["N"] and horiz_n[pipenumber] and horiz_n[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["E"] and horiz_e[pipenumber] and horiz_e[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["S"] and horiz_s[pipenumber] and horiz_s[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["W"] and horiz_w[pipenumber] and horiz_w[pipenumber][pipedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- tubes
|
|
||||||
|
|
||||||
function pipeworks.check_for_vert_tube(pos, node, def, ppos, pnode, pdef)
|
|
||||||
local signdir = get_sign_dir(node, def)
|
|
||||||
local tubenumber = pdef.tubenumber
|
|
||||||
local tubedir = pnode.param2
|
|
||||||
if pnode.name == "pipeworks:one_way_tube" and owtv[tubedir] then
|
|
||||||
return true
|
|
||||||
elseif tubenumber == 2 and (tubedir == 5 or tubedir == 7) then -- it's a stub pointing up or down
|
|
||||||
return true
|
|
||||||
elseif signdir["N"] and vert_n[tubenumber] and vert_n[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["E"] and vert_e[tubenumber] and vert_e[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["S"] and vert_s[tubenumber] and vert_s[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["W"] and vert_w[tubenumber] and vert_w[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function pipeworks.check_for_horiz_tube(pos, node, def, ppos, pnode, pdef)
|
|
||||||
local signdir = get_sign_dir(node, def)
|
|
||||||
local tubenumber = pdef.tubenumber
|
|
||||||
local tubedir = pnode.param2
|
|
||||||
if tubenumber == 2 then -- it'a a stub pointing sideways
|
|
||||||
if (tubedir == 0 or tubedir == 2) and (signdir["N"] or signdir["S"]) then
|
|
||||||
return true
|
|
||||||
elseif (tubedir == 1 or tubedir == 3) and (signdir["E"] or signdir["W"]) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
elseif pnode.name == "pipeworks:one_way_tube" then
|
|
||||||
if (signdir["N"] or signdir["S"]) and owtns[tubedir] then
|
|
||||||
return true
|
|
||||||
elseif (signdir["E"] or signdir["W"]) and owtew[tubedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
elseif signdir["N"] and horiz_n[tubenumber] and horiz_n[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["E"] and horiz_e[tubenumber] and horiz_e[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["S"] and horiz_s[tubenumber] and horiz_s[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
elseif signdir["W"] and horiz_w[tubenumber] and horiz_w[tubenumber][tubedir] then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,4 +1,3 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local fs_helpers = pipeworks.fs_helpers
|
local fs_helpers = pipeworks.fs_helpers
|
||||||
|
|
||||||
if pipeworks.enable_mese_tube then
|
if pipeworks.enable_mese_tube then
|
||||||
@ -56,7 +55,7 @@ if pipeworks.enable_mese_tube then
|
|||||||
end
|
end
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:mese_tube", {
|
pipeworks.register_tube("pipeworks:mese_tube", {
|
||||||
description = S("Sorting Pneumatic Tube Segment"),
|
description = "Sorting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_mese_tube_inv.png",
|
inventory_image = "pipeworks_mese_tube_inv.png",
|
||||||
noctr = {"pipeworks_mese_tube_noctr_1.png", "pipeworks_mese_tube_noctr_2.png", "pipeworks_mese_tube_noctr_3.png",
|
noctr = {"pipeworks_mese_tube_noctr_1.png", "pipeworks_mese_tube_noctr_2.png", "pipeworks_mese_tube_noctr_3.png",
|
||||||
"pipeworks_mese_tube_noctr_4.png", "pipeworks_mese_tube_noctr_5.png", "pipeworks_mese_tube_noctr_6.png"},
|
"pipeworks_mese_tube_noctr_4.png", "pipeworks_mese_tube_noctr_5.png", "pipeworks_mese_tube_noctr_6.png"},
|
||||||
@ -108,7 +107,7 @@ if pipeworks.enable_mese_tube then
|
|||||||
inv:set_size("line"..tostring(i), 6*1)
|
inv:set_size("line"..tostring(i), 6*1)
|
||||||
end
|
end
|
||||||
update_formspec(pos)
|
update_formspec(pos)
|
||||||
meta:set_string("infotext", S("Sorting pneumatic tube"))
|
meta:set_string("infotext", "Sorting pneumatic tube")
|
||||||
end,
|
end,
|
||||||
on_punch = update_formspec,
|
on_punch = update_formspec,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
@ -154,9 +153,9 @@ if pipeworks.enable_mese_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:mese_tube_000000 2",
|
output = "pipeworks:mese_tube_000000 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "", "default:mese_crystal", "" },
|
{ "", "default:mese_crystal", "" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local filename=minetest.get_worldpath() .. "/teleport_tubes"
|
local filename=minetest.get_worldpath() .. "/teleport_tubes"
|
||||||
|
|
||||||
local tp_tube_db = nil -- nil forces a read
|
local tp_tube_db = nil -- nil forces a read
|
||||||
@ -23,7 +22,7 @@ end
|
|||||||
local function migrate_tube_db()
|
local function migrate_tube_db()
|
||||||
local tmp_db = {}
|
local tmp_db = {}
|
||||||
tp_tube_db.version = nil
|
tp_tube_db.version = nil
|
||||||
for _, val in pairs(tp_tube_db) do
|
for key, val in pairs(tp_tube_db) do
|
||||||
if(val.channel ~= "") then -- skip unconfigured tubes
|
if(val.channel ~= "") then -- skip unconfigured tubes
|
||||||
tmp_db[hash(val)] = val
|
tmp_db[hash(val)] = val
|
||||||
end
|
end
|
||||||
@ -128,19 +127,19 @@ local function update_meta(meta, can_receive)
|
|||||||
meta:set_int("can_receive", can_receive and 1 or 0)
|
meta:set_int("can_receive", can_receive and 1 or 0)
|
||||||
local cr_state = can_receive and "on" or "off"
|
local cr_state = can_receive and "on" or "off"
|
||||||
meta:set_string("formspec","size[8.6,2.2]"..
|
meta:set_string("formspec","size[8.6,2.2]"..
|
||||||
"field[0.6,0.6;7,1;channel;"..S("Channel")..";${channel}]"..
|
"field[0.6,0.6;7,1;channel;Channel:;${channel}]"..
|
||||||
"label[7.3,0;"..S("Receive").."]"..
|
"label[7.3,0;Receive]"..
|
||||||
"image_button[7.3,0.3;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
|
"image_button[7.3,0.3;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
|
||||||
"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
|
"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
|
||||||
"label[1.6,1.2;"..S("channels are public by default").."]" ..
|
"label[1.6,1.2;channels are public by default]" ..
|
||||||
"label[1.6,1.5;"..S("use <player>:<channel> for fully private channels").."]" ..
|
"label[1.6,1.5;use <player>:<channel> for fully private channels]" ..
|
||||||
"label[1.6,1.8;"..S("use <player>\\;<channel> for private receivers").."]" ..
|
"label[1.6,1.8;use <player>\\;<channel> for private receivers]" ..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img)
|
default.gui_bg_img)
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:teleport_tube", {
|
pipeworks.register_tube("pipeworks:teleport_tube", {
|
||||||
description = S("Teleporting Pneumatic Tube Segment"),
|
description = "Teleporting Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_teleport_tube_inv.png",
|
inventory_image = "pipeworks_teleport_tube_inv.png",
|
||||||
noctr = { "pipeworks_teleport_tube_noctr.png" },
|
noctr = { "pipeworks_teleport_tube_noctr.png" },
|
||||||
plain = { "pipeworks_teleport_tube_plain.png" },
|
plain = { "pipeworks_teleport_tube_plain.png" },
|
||||||
@ -170,7 +169,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
update_meta(meta, true)
|
update_meta(meta, true)
|
||||||
meta:set_string("infotext", S("unconfigured Teleportation Tube"))
|
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos,formname,fields,sender)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
if not fields.channel -- ignore escaping or clientside manipulation of the form
|
if not fields.channel -- ignore escaping or clientside manipulation of the form
|
||||||
@ -190,14 +189,12 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
if name and mode and name ~= sender_name then
|
if name and mode and name ~= sender_name then
|
||||||
--channels starting with '[name]:' can only be used by the named player
|
--channels starting with '[name]:' can only be used by the named player
|
||||||
if mode == ":" then
|
if mode == ":" then
|
||||||
minetest.chat_send_player(sender_name, S("Sorry, channel '@1' is reserved for exclusive use by @2",
|
minetest.chat_send_player(sender_name, "Sorry, channel '"..new_channel.."' is reserved for exclusive use by "..name)
|
||||||
new_channel, name))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
--channels starting with '[name];' can be used by other players, but cannot be received from
|
--channels starting with '[name];' can be used by other players, but cannot be received from
|
||||||
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
|
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
|
||||||
minetest.chat_send_player(sender_name, S("Sorry, receiving from channel '@1' is reserved for @2",
|
minetest.chat_send_player(sender_name, "Sorry, receiving from channel '"..new_channel.."' is reserved for "..name)
|
||||||
new_channel, name))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -229,11 +226,11 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
if channel ~= "" then
|
if channel ~= "" then
|
||||||
set_tube(pos, channel, can_receive)
|
set_tube(pos, channel, can_receive)
|
||||||
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
|
local cr_description = (can_receive == 1) and "sending and receiving" or "sending"
|
||||||
meta:set_string("infotext", S("Teleportation Tube @1 on '@2'", cr_description, channel))
|
meta:set_string("infotext", string.format("Teleportation Tube %s on '%s'", cr_description, channel))
|
||||||
else
|
else
|
||||||
-- remove empty channel tubes, to not have to search through them
|
-- remove empty channel tubes, to not have to search through them
|
||||||
remove_tube(pos)
|
remove_tube(pos)
|
||||||
meta:set_string("infotext", S("unconfigured Teleportation Tube"))
|
meta:set_string("infotext", "unconfigured Teleportation Tube")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -245,9 +242,9 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:teleport_tube_1 2",
|
output = "pipeworks:teleport_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "default:desert_stone", "default:mese", "default:desert_stone" },
|
{ "default:desert_stone", "default:mese", "default:desert_stone" },
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -261,11 +258,3 @@ if minetest.get_modpath("mesecons_mvps") ~= nil then
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Expose teleport tube database API for other mods
|
|
||||||
pipeworks.tptube = {
|
|
||||||
hash = hash,
|
|
||||||
save_tube_db = save_tube_db,
|
|
||||||
get_db = function() return tp_tube_db or read_tube_db() end,
|
|
||||||
tp_tube_db_version = tp_tube_db_version
|
|
||||||
}
|
|
||||||
|
BIN
textures/pipeworks_gear.png
Normal file
BIN
textures/pipeworks_gear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
19
trashcan.lua
19
trashcan.lua
@ -1,7 +1,6 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
minetest.register_node("pipeworks:trashcan", {
|
minetest.register_node("pipeworks:trashcan", {
|
||||||
description = S("Trash Can"),
|
description = "Trash Can",
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {
|
tiles = {
|
||||||
"pipeworks_trashcan_bottom.png",
|
"pipeworks_trashcan_bottom.png",
|
||||||
"pipeworks_trashcan_bottom.png",
|
"pipeworks_trashcan_bottom.png",
|
||||||
@ -9,21 +8,21 @@ minetest.register_node("pipeworks:trashcan", {
|
|||||||
"pipeworks_trashcan_side.png",
|
"pipeworks_trashcan_side.png",
|
||||||
"pipeworks_trashcan_side.png",
|
"pipeworks_trashcan_side.png",
|
||||||
"pipeworks_trashcan_side.png",
|
"pipeworks_trashcan_side.png",
|
||||||
},
|
},
|
||||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
tube = {
|
tube = {
|
||||||
insert_object = function(pos, node, stack, direction)
|
insert_object = function(pos, node, stack, direction)
|
||||||
return ItemStack("")
|
return ItemStack("")
|
||||||
end,
|
end,
|
||||||
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
|
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
|
||||||
priority = 1, -- Lower than anything else
|
priority = 1, -- Lower than anything else
|
||||||
},
|
},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[8,7]"..
|
"size[8,7]"..
|
||||||
"item_image[0,0;1,1;pipeworks:trashcan]"..
|
"item_image[0,0;1,1;pipeworks:trashcan]"..
|
||||||
"label[1,0;"..S("Trash Can").."]"..
|
"label[1,0;Trash Can]"..
|
||||||
"list[context;trash;3.5,1;1,1;]"..
|
"list[context;trash;3.5,1;1,1;]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
@ -31,9 +30,9 @@ minetest.register_node("pipeworks:trashcan", {
|
|||||||
default.get_hotbar_bg(0,3) ..
|
default.get_hotbar_bg(0,3) ..
|
||||||
"list[current_player;main;0,3;8,4;]" ..
|
"list[current_player;main;0,3;8,4;]" ..
|
||||||
"listring[]")
|
"listring[]")
|
||||||
meta:set_string("infotext", S("Trash Can"))
|
meta:set_string("infotext", "Trash Can")
|
||||||
meta:get_inventory():set_size("trash", 1)
|
meta:get_inventory():set_size("trash", 1)
|
||||||
end,
|
end,
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
@ -44,7 +43,7 @@ minetest.register_node("pipeworks:trashcan", {
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pipeworks:trashcan",
|
output = "pipeworks:trashcan",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{ "default:steel_ingot", "", "default:steel_ingot" },
|
{ "default:steel_ingot", "", "default:steel_ingot" },
|
||||||
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
-- This file supplies the various kinds of pneumatic tubes
|
-- This file supplies the various kinds of pneumatic tubes
|
||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
|
|
||||||
local tubenodes = {}
|
local tubenodes = {}
|
||||||
pipeworks.tubenodes = tubenodes
|
pipeworks.tubenodes = tubenodes
|
||||||
@ -57,8 +56,8 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
|||||||
end
|
end
|
||||||
|
|
||||||
local tgroups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory = 1}
|
local tgroups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory = 1}
|
||||||
local tubedesc = string.format("%s %s", desc, dump(connects))
|
local tubedesc = string.format("%s %s... You hacker, you.", desc, dump(connects))
|
||||||
local iimg = type(plain[1]) == "table" and plain[1].name or plain[1]
|
local iimg = plain[1]
|
||||||
local wscale = {x = 1, y = 1, z = 1}
|
local wscale = {x = 1, y = 1, z = 1}
|
||||||
|
|
||||||
if #connects == 0 then
|
if #connects == 0 then
|
||||||
@ -109,7 +108,6 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
|||||||
},
|
},
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = false,
|
|
||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if not intensity or intensity > 1 + 3^0.5 then
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
@ -117,10 +115,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
|||||||
end
|
end
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end,
|
end
|
||||||
check_for_pole = pipeworks.check_for_vert_tube,
|
|
||||||
check_for_horiz_pole = pipeworks.check_for_horiz_tube,
|
|
||||||
tubenumber = tonumber(tname)
|
|
||||||
}
|
}
|
||||||
if style == "6d" then
|
if style == "6d" then
|
||||||
nodedef.paramtype2 = "facedir"
|
nodedef.paramtype2 = "facedir"
|
||||||
@ -198,7 +193,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
|
|||||||
wield_image = inv,
|
wield_image = inv,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
description = S("Pneumatic tube segment (legacy)"),
|
description = "Pneumatic tube segment (legacy)",
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
groups = {not_in_creative_inventory = 1, tube_to_update = 1, tube = 1},
|
groups = {not_in_creative_inventory = 1, tube_to_update = 1, tube = 1},
|
||||||
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
|
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
if pipeworks.enable_sand_tube then
|
if pipeworks.enable_sand_tube then
|
||||||
pipeworks.register_tube("pipeworks:sand_tube", {
|
pipeworks.register_tube("pipeworks:sand_tube", {
|
||||||
description = S("Vacuuming Pneumatic Tube Segment"),
|
description = "Vacuuming Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_sand_tube_inv.png",
|
inventory_image = "pipeworks_sand_tube_inv.png",
|
||||||
short = "pipeworks_sand_tube_short.png",
|
short = "pipeworks_sand_tube_short.png",
|
||||||
noctr = {"pipeworks_sand_tube_noctr.png"},
|
noctr = {"pipeworks_sand_tube_noctr.png"},
|
||||||
@ -13,9 +12,9 @@ if pipeworks.enable_sand_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:sand_tube_1 2",
|
output = "pipeworks:sand_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
|
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
|
||||||
{"group:sand", "group:sand", "group:sand"},
|
{"group:sand", "group:sand", "group:sand"},
|
||||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"}
|
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ end
|
|||||||
|
|
||||||
if pipeworks.enable_mese_sand_tube then
|
if pipeworks.enable_mese_sand_tube then
|
||||||
pipeworks.register_tube("pipeworks:mese_sand_tube", {
|
pipeworks.register_tube("pipeworks:mese_sand_tube", {
|
||||||
description = S("Adjustable Vacuuming Pneumatic Tube Segment"),
|
description = "Adjustable Vacuuming Pneumatic Tube Segment",
|
||||||
inventory_image = "pipeworks_mese_sand_tube_inv.png",
|
inventory_image = "pipeworks_mese_sand_tube_inv.png",
|
||||||
short = "pipeworks_mese_sand_tube_short.png",
|
short = "pipeworks_mese_sand_tube_short.png",
|
||||||
noctr = {"pipeworks_mese_sand_tube_noctr.png"},
|
noctr = {"pipeworks_mese_sand_tube_noctr.png"},
|
||||||
@ -45,7 +44,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
"field[1.3,0.4;1,1;dist;radius;${dist}]"..
|
"field[1.3,0.4;1,1;dist;radius;${dist}]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img)
|
default.gui_bg_img)
|
||||||
meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment"))
|
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos,formname,fields,sender)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
if not pipeworks.may_configure(pos, sender) then return end
|
if not pipeworks.may_configure(pos, sender) then return end
|
||||||
@ -55,7 +54,7 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
dist = math.max(0, dist)
|
dist = math.max(0, dist)
|
||||||
dist = math.min(8, dist)
|
dist = math.min(8, dist)
|
||||||
meta:set_int("dist", dist)
|
meta:set_int("dist", dist)
|
||||||
meta:set_string("infotext", (S("Adjustable Vacuuming Pneumatic Tube Segment (@1m)", dist)))
|
meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -64,9 +63,9 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "pipeworks:mese_sand_tube_1 2",
|
output = "pipeworks:mese_sand_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
|
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||||
{"group:sand", "default:mese_crystal", "group:sand" },
|
{"group:sand", "default:mese_crystal", "group:sand" },
|
||||||
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
|
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
41
wielder.lua
41
wielder.lua
@ -1,6 +1,9 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
|
||||||
local assumed_eye_pos = vector.new(0, 1.5, 0)
|
local assumed_eye_pos = vector.new(0, 1.5, 0)
|
||||||
|
|
||||||
|
local function vector_copy(v)
|
||||||
|
return { x = v.x, y = v.y, z = v.z }
|
||||||
|
end
|
||||||
|
|
||||||
local function delay(x)
|
local function delay(x)
|
||||||
return (function() return x end)
|
return (function() return x end)
|
||||||
end
|
end
|
||||||
@ -36,7 +39,7 @@ local can_tool_dig_node = function(nodename, toolcaps, toolname)
|
|||||||
-- but a player holding one can - the game seems to fall back to the hand.
|
-- but a player holding one can - the game seems to fall back to the hand.
|
||||||
-- fall back to checking the hand's properties if the tool isn't the correct one.
|
-- fall back to checking the hand's properties if the tool isn't the correct one.
|
||||||
local hand_caps = minetest.registered_items[""].tool_capabilities
|
local hand_caps = minetest.registered_items[""].tool_capabilities
|
||||||
diggable = minetest.get_dig_params(nodegroups, hand_caps).diggable
|
diggable = minetest.get_dig_params(nodegroups, hand_caps)
|
||||||
end
|
end
|
||||||
return diggable
|
return diggable
|
||||||
end
|
end
|
||||||
@ -231,7 +234,6 @@ local function register_wielder(data)
|
|||||||
end
|
end
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end,
|
end,
|
||||||
on_rotate = pipeworks.on_rotate,
|
|
||||||
on_punch = data.fixup_node,
|
on_punch = data.fixup_node,
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
if not pipeworks.may_configure(pos, player) then return 0 end
|
if not pipeworks.may_configure(pos, player) then return 0 end
|
||||||
@ -256,7 +258,7 @@ if pipeworks.enable_node_breaker then
|
|||||||
local wield_inv_name = "pick"
|
local wield_inv_name = "pick"
|
||||||
data = {
|
data = {
|
||||||
name_base = name_base,
|
name_base = name_base,
|
||||||
description = S("Node Breaker"),
|
description = "Node Breaker",
|
||||||
texture_base = "pipeworks_nodebreaker",
|
texture_base = "pipeworks_nodebreaker",
|
||||||
texture_stateful = { top = true, bottom = true, side2 = true, side1 = true, front = true },
|
texture_stateful = { top = true, bottom = true, side2 = true, side1 = true, front = true },
|
||||||
tube_connect_sides = { top=1, bottom=1, left=1, right=1, back=1 },
|
tube_connect_sides = { top=1, bottom=1, left=1, right=1, back=1 },
|
||||||
@ -329,27 +331,14 @@ if pipeworks.enable_node_breaker then
|
|||||||
virtplayer:set_wielded_item(wieldstack)
|
virtplayer:set_wielded_item(wieldstack)
|
||||||
else
|
else
|
||||||
local under_node = minetest.get_node(pointed_thing.under)
|
local under_node = minetest.get_node(pointed_thing.under)
|
||||||
local def = minetest.registered_nodes[under_node.name]
|
local on_dig = (minetest.registered_nodes[under_node.name] or {on_dig=minetest.node_dig}).on_dig
|
||||||
if not def then
|
-- check that the current tool is capable of destroying the target node.
|
||||||
-- do not dig an unknown node
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- check that the current tool is capable of destroying the
|
|
||||||
-- target node.
|
|
||||||
-- if we can't, don't dig, and leave the wield stack unchanged.
|
-- if we can't, don't dig, and leave the wield stack unchanged.
|
||||||
-- note that wieldstack:get_tool_capabilities() returns hand
|
-- note that wieldstack:get_tool_capabilities() returns hand properties if the item has none of it's own.
|
||||||
-- properties if the item has none of it's own.
|
if can_tool_dig_node(under_node.name, wieldstack:get_tool_capabilities(), wieldstack:get_name()) then
|
||||||
if can_tool_dig_node(under_node.name,
|
on_dig(pointed_thing.under, under_node, virtplayer)
|
||||||
wieldstack:get_tool_capabilities(),
|
|
||||||
wieldstack:get_name()) then
|
|
||||||
def.on_dig(pointed_thing.under, under_node, virtplayer)
|
|
||||||
local sound = def.sounds and def.sounds.dug
|
|
||||||
if sound then
|
|
||||||
minetest.sound_play(sound.name,
|
|
||||||
{pos=pointed_thing.under, gain=sound.gain})
|
|
||||||
end
|
|
||||||
wieldstack = virtplayer:get_wielded_item()
|
wieldstack = virtplayer:get_wielded_item()
|
||||||
--~ else
|
else
|
||||||
--pipeworks.logger(dname.."couldn't dig node!")
|
--pipeworks.logger(dname.."couldn't dig node!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -374,7 +363,7 @@ if pipeworks.enable_node_breaker then
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pipeworks:nodebreaker_off",
|
output = "pipeworks:nodebreaker_off",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "basic_materials:gear_steel", "basic_materials:gear_steel", "basic_materials:gear_steel" },
|
{ "pipeworks:gear", "pipeworks:gear", "pipeworks:gear" },
|
||||||
{ "default:stone", "mesecons:piston", "default:stone" },
|
{ "default:stone", "mesecons:piston", "default:stone" },
|
||||||
{ "group:wood", "mesecons:mesecon", "group:wood" },
|
{ "group:wood", "mesecons:mesecon", "group:wood" },
|
||||||
}
|
}
|
||||||
@ -405,7 +394,7 @@ end
|
|||||||
if pipeworks.enable_deployer then
|
if pipeworks.enable_deployer then
|
||||||
register_wielder({
|
register_wielder({
|
||||||
name_base = "pipeworks:deployer",
|
name_base = "pipeworks:deployer",
|
||||||
description = S("Deployer"),
|
description = "Deployer",
|
||||||
texture_base = "pipeworks_deployer",
|
texture_base = "pipeworks_deployer",
|
||||||
texture_stateful = { front = true },
|
texture_stateful = { front = true },
|
||||||
tube_connect_sides = { back=1 },
|
tube_connect_sides = { back=1 },
|
||||||
@ -438,7 +427,7 @@ end
|
|||||||
if pipeworks.enable_dispenser then
|
if pipeworks.enable_dispenser then
|
||||||
register_wielder({
|
register_wielder({
|
||||||
name_base = "pipeworks:dispenser",
|
name_base = "pipeworks:dispenser",
|
||||||
description = S("Dispenser"),
|
description = "Dispenser",
|
||||||
texture_base = "pipeworks_dispenser",
|
texture_base = "pipeworks_dispenser",
|
||||||
texture_stateful = { front = true },
|
texture_stateful = { front = true },
|
||||||
tube_connect_sides = { back=1 },
|
tube_connect_sides = { back=1 },
|
||||||
|
Reference in New Issue
Block a user