Name: Advanced Inserter
Description: An inserter whose filters are controllable by the circuit network.
License: MIT
Version: 0.2.0
Release: 2016-04-18
Tested-With-Factorio-Version: 0.12.29
Category: Item
Tags: Inserter, Circuit Network
Download-Url: https://github.com/JC3/AdvancedInserter ... _0.2.0.zip
Website: https://github.com/JC3/AdvancedInserter
License
License
Copyright (c) 2016, Jason Cipriani
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2016, Jason Cipriani
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Long description
Long description
This inserter is a smart inserter that will load specific items in response to circuit network events. It is unlocked with Advanced Electronics.
Usage:
There is one slight difference vs. a smart inserter: This inserter will function if no circuit/logistic condition is set. This is intentional. It's generally the desired behavior, in the code I fudge the signal to anything > 0 if no signals are set, so you can just hook it up, set the filters, and go without having to set a circuit condition on every one also.
This is made with a lot of hacks to work around API limitations. This is also my first mod, so be warned that while some of these hacks are definitely workarounds for game limitations, others may be workarounds for me merely not being aware that there's a better way to do things. Pull requests welcome.
There are a number of GUI and electricity related... quirks. They're listed in the issues section below. If you want more information about why things are the way they are please see the comments at the top of control.lua, then feel free to ask/comment/rant here.
Brief summary of how this is implemented:
If something like this already exists, well... fist bump to that author.
This inserter is a smart inserter that will load specific items in response to circuit network events. It is unlocked with Advanced Electronics.
Usage:
- Set the filter slots to the items you want this inserter to handle (up to 5).
- Optionally set the circuit and logistics network conditions, which behave like the usual smart inserter.
- Connect it to a circuit network.
- The inserter will load any of the filtered items as long as they have a matching signal on the circuit network with value > 0.
- Smart Loader (+ cargo wagon's vanilla slot filters)
- Logistics Combinators (if you want to control this with logistics network signals)
There is one slight difference vs. a smart inserter: This inserter will function if no circuit/logistic condition is set. This is intentional. It's generally the desired behavior, in the code I fudge the signal to anything > 0 if no signals are set, so you can just hook it up, set the filters, and go without having to set a circuit condition on every one also.
This is made with a lot of hacks to work around API limitations. This is also my first mod, so be warned that while some of these hacks are definitely workarounds for game limitations, others may be workarounds for me merely not being aware that there's a better way to do things. Pull requests welcome.
There are a number of GUI and electricity related... quirks. They're listed in the issues section below. If you want more information about why things are the way they are please see the comments at the top of control.lua, then feel free to ask/comment/rant here.
Brief summary of how this is implemented:
- An invisible inserter sits on top of the real inserter to provide a filter selection GUI that is not affected by the programmatically controlled filter slots of the real inserter. This is the source of most of the GUI oddities.
- Circuit network conditions are evaluated by temporarily setting circuit conditions on the inserter then reading back their evaluated state, then using this to contorl the real inserter's filter slots.
If something like this already exists, well... fist bump to that author.
Pictures
Pictures
Todo: Better picture.
Todo: Better picture.
Example
Example
Here is a basic example save game. It's not very fancy. To use:
Here is a basic example save game. It's not very fancy. To use:
- I've already set some item counts in the constant combinator but you can adjust.
- Press play on the train and send it to the "drop off" station.
- The inserters will do their thing.
- When they're finished you can remove some items from the chests if you want and they'll refill as needed.
Known Issues
Known Issues
There are some known issues that I can't really do much about. They're mostly not noticeable during normal game play, just GUI quirks. None have any effect on the functionality of the inserter. See the aforementioned comments at the top of control.lua for the reasons why these exists:
There are some known issues that I can't really do much about. They're mostly not noticeable during normal game play, just GUI quirks. None have any effect on the functionality of the inserter. See the aforementioned comments at the top of control.lua for the reasons why these exists:
- Electricity usage stats are weird. An extra smart inserter per advanced inserter is added to the power consumption chart counts, although generally they'll be so low on the list as to not matter.
- Related, the mouse-over power info is totally borked since its for the facade not the real inserter, and we have to have the real inserter have the actual info (not the facade) so that it maintains a reasonable power usage profile while running.
- When you open the settings GUI, the sprite is blank. This is because it's for the invisible facade. There's no way to avoid this.
- The filter overlay icons in detail view are a bit messy because there are two inserters on top of eachother (one with your filters set, the other with filters turning on/off as needed).
Version history
Version history
0.1.0 (2016-Apr-17): Initial Release
0.2.0 (2016-Apr-18): Greatly simplified code now that I know that circuit conditions are evaluated immediately without waiting a tick. Removed all the hidden lamp hacks.
0.1.0 (2016-Apr-17): Initial Release
0.2.0 (2016-Apr-18): Greatly simplified code now that I know that circuit conditions are evaluated immediately without waiting a tick. Removed all the hidden lamp hacks.