Shia Inserter Cleaner

by Shia

Put items from inserter hands back to their pickup entity.

Utilities
6 years ago
0.15 - 0.16
6
Owner:
Shia
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
6 years ago
Latest Version:
0.7.3 (6 years ago)
Factorio version:
0.15 - 0.16
Downloaded by:
6 users

Adds the ability put items back into source-entities from inserter hands. So whenever I use the word "clean" this means, the item is put back into the entity it was picked from by the inserter

You can use it in 4 different ways (or any combination of it):

  1. automatic with trains:
    By activating this Setting in the mod settings, any train in automatic mode will clean the inserters around its cargo wagons when leaving a train stop. (Only horizontal or vertical wagons will be affected, even if the could be (un)loaded in their actual angle).
    Two settings do allow to change the boundaries around the cargo wagons (see picture 1)
    Initial settings: "Check trains directly = false", "width = 1" and "extend length = 0"

  2. as support via deconstruction planner:
    If enabled, deconstructing inserters will also clean them. No coal or other items in your bags just because you want to place an inserter a bit more to the left/right to get space for a different entity. Or simply removing misplaced inserters.
    Is set to "inserter and ground" also items placed on the ground (at the position the inserter would/has place(ed) them) will be put back into the entity they are from. You do not need bots for this, just the mark for deconstruction will clean it.
    Initial settings: "Use with deconstruction planner = false"

  3. via circuit nework (special combinator):
    Place the "Inserter Cleaner Combinator" in line with the inserters you want to be affected (works only in the direction it is facing, like in the pictures 2 and 3). Now add a "T" signal to it and the moment the "T" signal is 0 again, magic happens. All the inserters will be cleaned. ("T" signal set with the combinator itself will not be count if the combinator is turned "off") Normally stops at the first non-inserter space, but can be set to stop only if 2 inserters are missing in a row.
    Initial settings: "Ignore "OFF" = false" and "ignore one missing = false"

  4. via cleaner planner (planner you can create for free)
    Note: This works different as it only turn back items from inserters which are at the final drop position while the other 3 types use a trigger which also can clean while in motion (still this is not a problem).
    You can create the cleaning planner for free (production tab). Simply select the area (inserters) you want to clean automatically. Now, whenever they are not able to "put" an item (stack) somewhere, they get cleaned automatically. You also can set the count of inserters to be checked or the count of frames over which you want all inserters to be cleaned once. You are also able to set a small visual to know which inserters are set and which are not (will not show the ones only affected by the other cleaning types)
    Initial settings: "split by count = false", "Split value = 60" and "Visual indicator = "off""

General:
- You can check the "unlock chests" option to also input into locked slots in chests (see picture 3).
- If the inserter and the source entity is marked for deconstruction (the one the items would be cleaned to / the inserter got the item from) then no cleaning will be done. This is done on purpose (as it looks stupid to me and just would waste resources)
- While this should work for as good as all entities, it will never put items back to a belt (this would lead to more problems, then it would help in any way)
- You can set a visual which will run every time a cleaning is initiated (also runs when it was not successful / no items have been put back) - gives a better feeling of "something happened here"
Initial settings: "Use locked chest slots = false" and "Cleaning effect = "off""

Known issues:
- none right now
- wasn't able to run huge checks in 0.16, so I probably missed something (just tell me if)

Plans:
- More settings for users, like changing the signals or do it directly per combinator (is anyone still using this???)
- Find a reasonable way to activate/deactivate the behavior based on train/station (just give me ideas or request something)
- Find a better names??? (for settings and also the descriptions need to be improved... I'm not good at that part)

Change log:
0.7.3:
- noticed that that wagon direction is always 0 as it is now "orientation" ( silly me :p )

0.7.2:
- Changed prototypes (and everything else) to work correctly with to Factorio 0.16
- Changed the train checking to use "old_state" and deleted the list (better ups)
- Issue: changing "visual indicator" from something to "off" deleted "simple-entities" which did not belong to my mod => SOLVED!
- changed some parts of the code as the direction for cargo-wagons (and for some other entities) is different in 0.16

0.6.0:
- Issue: If no wires are connected to the combinator, nothing will happen => SOLVED!
- Issue: Some strange behavior on changing on/off of the combinator when also changing the setting to ignore this => SOLVED!
- Added: Selection tool to run cleanings in full automatic mode
- Added (prove of concept): Some visuals so you get some visual "feedback"

0.5.3:
- Issue: with deconstruction enabled an item on ground at drop position did not check correctly for the inserter pickup entity and crashed the game (read from nil) => SOLVED!
- Issue: sometimes nothing happened if the combinator was used for inserters close to a train and the option for trains changed midgame => SOLVED!
- tests to auto-check all inserters on all surfaces ran smoothly up to 5k inserters per tick (no other mods except Creative Mode enabled), will keep that in mind as a stand alone if someone really need something like that...

0.5.2:
- Issue: Does only turn items back into chests (no other entities) -> SOLVED! (let me know if it does not work for a specific entity)
- Issue: If the item has some kind of health (science packs, walls...) it will be reset to maximum -> SOLVED!
- Issue: Items which "contain" items will be empty (armor grid / Factorissimo buildings etc.) -> SOLVED! (Yes, even Factorissimo2 buildings containing entities are treated correctly)
- Added: cleans inserters marked for deconstruction
- Added: puts items from ground at the drop position of the inserter back
- Added: setting to extend the range around wagons in moving direction
- Added: localisation for German

0.2.0:
- Added the ability to directly work with trains
- split some functions to allow easier implementing of new features

0.1.1:
- Found small error in logic -> solved
- Changed the name to better fit it's behavior (still need a better name)

Some random information:
- The cleaning itself consumes surprisingly little resources (timed checks allowed to run on ~47k inserters without a noticeable lag / medium powered pc)
- While the train-way does have the highest impact (multiple surface.find_entities), due to the checks that avoid it from running when there is obviously no need, makes it the "cheapest" way of cleaning
- using the combinator way: turning the combinator to "off" will use less resources (you obviously need to set the "ignore "off" setting" to true)
- You can even clean back into cars
- Most time was used to "rewrite" the mod for easier implementation of new stuff... and everything "new" caused another "rewrite"...
- I'm still looking for a "simple" way to add an animation which can be turned on and off (without doing anything to anything to run the animation)