It allows to control the ratio in which certain items will use the different outputs.
This is done by adding an item multiple times to the same filter.
Because of this, the hardcoded permutations are replaced with a Fisher-Yates-Shuffle.
This is theoretically a little bit slower; but according to my measurements, about one million of copy-shuffle operations can be executed per second (tested with a table length of four); so it doesn't seem to be a big problem.
Additionally, a bit of outdated information was removed from the manuals.
- Allow to use a prefix other than "techage:ta"
- Copy custom properties (starting with an underscore)
Additionally, some dead code (regarding on_recv_message) is removed; it had no effect.
Add support for reading distributor slot status. This action
is complementary to already present filter setting function.
'port' distributor message is modified to accept filter color
only (without '=on/off'), device returns selected filter state.
A wrapper function ($get_filter(...)) for Lua Controller and
condition selector for ICTA Controller are implemented as well.
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
Advantages:
* Code uses common functions for manual usage and automation where possible. This avoids forgetting half of the adjustments like it happened in #14
* Support for meta and wear
* Code duplication for the different automatic modes is reduced/avoided
Additionally, the `techage.item_image` function was adjusted:
* added support meta and wear
* removed duplicate stack size labels for non-tools with max_stack=1
* added optional parameter to "overwrite" stacksize for tools (necessary because of minetest limitations)
Quarry now digs nodes like a player.
Additionally, some possible causes for crashes are fixed.
E.g. the `inv` in the `after_dig_node` callbacks were not guaranteed to exist.
Please note that TA4 batteries that were dug before this change are considered as full.
Distributor iterates through filter indices always in the same order,
accidentally favouring certain ports. This is particularly noticeable
for 3 outputs configured with the same item - lowest numbered port
is receiving double quantity (TA2 distributor moves items in pack of 4).
Fix provided in this patch adds an extra mapping for filter indexing,
permutating randomly outputs with identical items so no ports are
preferred anymore.
Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>