The new function has no API compatibility with the old one, so give it
a different name to avoid confusion among caller mods, which need to
change their usage. Have a function under the old name that outputs a
helpful error message.
The filter-injectors used to always prefer to take items from the
beginning of the source inventory. Because items also tend to get placed
at the beginning of an inventory, this could lead to a chest+injector
buffer only passing through a trickle of one type of item, where other
item types are flowing in and getting later inventory slots. So now,
the sequencing of source inventory slots is configurable, per-injector,
by form. In addition to the old priority mode, there's now a random
mode and a rotation mode.
Incidentally refactor the filter-injector code, to avoid duplication
between the itemwise and stackwise variants.
Previously, some tube types were named based on their function, and others
based on some arbitrarily-chosen material used in their construction,
with no meaningful system governing which was in each category. With this
change they are consistently named according to function. Naming style
is also made consistent in the wording that identifies tubes as such,
and in capitalisation.
Use the "wielditem" visual type for non-node items, with a fixed 45
degree yaw. This matches the recent change of dropped-item entities from
"sprite" visual to "wielditem".
Also phase out "old new" API, leaving only the "tube_connects={}" method,
as nothing in technic or pipeworks uses it.
Fix a few more places where minetest.facedir_to_dir() was duplicated, since
that code is part of Minetest 0.4.8.
1) Refactor autoplace,
There was a lot of redundant code and like a dozen unneccessary string
scans for every node next to every tube placed! I put it all into
indexed tables and loops instead of bizarre and unexplainable variable
names and copy and pasted code. There was also no support for notifying
a chest when an item has been taken from it by a filter, so I added
something for that.
I also thought it prudent to fall back on the
allow_metadata_inventory_take function should a special can_remove not
exist. In fact if can_insert doesn't exist, it calls
allow_metadata_inventory_put instead.
I also added a thing for allowing pipes to attach to nodes of other
modules, without having to hard code type all those node names into
autoplace.lua. Basically node.tube.collects(i,param2) and i is the
direction from the pipe and param2 is the param2 of what it's pointing
at.
I also abstracted the inscrutable correlation between i and
param2 by trial and error (and the paramwand mod) into understandable
functions. There was no pipeworks namespace so I created it, and put
these functions into pipeworks.collects (as distinguished from a
node.tube.collects function, which uses those functions)
And now it's too late to cart my old clothes to the thrift store,
dangit.
2) My "node.tube.collects" idea might be redundant with the
node.tube.connect_sides thing, though possibly more versatile so I'll
leave it in.
3) I was using node.tube.connects and fancy functions for checking if it's
the sides or top or whatnot, and this connect_side thing came in. This
should make both my way and the way using connect_side work.
Also removed some debugging cruft