Inserters have wrong things in hand...
Moderator: Optera
Inserters have wrong things in hand...
... and again the same problem as always.
I have barells and some random other item in inventory.
First train gets barells, some (around 90!!!!!) barells are stuck inside the inserters.
Next train comes, wanna get some random item, get 9 to 10 slots filled with barells...
As far as i know, its not possible to not have that happen... correct? (besides only one station per item)
What about adding a (if that is posssible) script to just let all inserters swing one time back into their chest when the train leaves...? (easiest, coolest solution ever?!?!)
- if swing back is not possible, just cheat it back into the inventory?
I have barells and some random other item in inventory.
First train gets barells, some (around 90!!!!!) barells are stuck inside the inserters.
Next train comes, wanna get some random item, get 9 to 10 slots filled with barells...
As far as i know, its not possible to not have that happen... correct? (besides only one station per item)
What about adding a (if that is posssible) script to just let all inserters swing one time back into their chest when the train leaves...? (easiest, coolest solution ever?!?!)
- if swing back is not possible, just cheat it back into the inventory?
-
- Long Handed Inserter
- Posts: 93
- Joined: Fri Mar 01, 2019 7:56 am
- Contact:
Re: Inserters have wrong things in hand...
you want to have 1 reserved slot per item you want to insert into a wagon. This results in the overflow going into that slot (which only has a few items in it) and the inserter being empty and ready to pick up something else.
edit: reserved slots is a signal value by the way.
edit: reserved slots is a signal value by the way.
Re: Inserters have wrong things in hand...
i use reserved slots, for most items its just 1 slot, so that is working good, but is a complete shit if you load barells, becaus ei need to block 10 slots for this to work...
Re: Inserters have wrong things in hand...
For items with small stack sizes you can reduce inserter hand size or the number of inserters.
Neither of those suggestions is possible.
Re: Inserters have wrong things in hand...
why should that not be possible? e.g. as a extra mod
*on remove filter from filter inserter*
*remove item in hand* (or if possible swing back)
*on remove filter from filter inserter*
*remove item in hand* (or if possible swing back)
Re: Inserters have wrong things in hand...
The event you describe does not exist. A mod would have to cycle through all inserters on the map, read the settings and compare them to the setting from one tick ago. That would bring down any CPU even on a medium sized map. And inserter hand position as well as the item held by an inserter are not writable.
Re: Inserters have wrong things in hand...
If that event doesnt exist, then we can ask the devs to implement it.
Re: Inserters have wrong things in hand...
If that event doesnt exist, then we can ask the devs to implement it.
Also im not the expert to ask how to implement it the best way. Its just an idea, maybe someone can come up with an (technical) solution other then "DOENST WORK".
Also im not the expert to ask how to implement it the best way. Its just an idea, maybe someone can come up with an (technical) solution other then "DOENST WORK".
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Inserters have wrong things in hand...
Been asked, many times, I'm sure. The answer was no, because it would cripple game performance to have an event call on every single inserter swing and drop.
There is a technical solution: don't build train stops that don't work very well.
Re: Inserters have wrong things in hand...
Locked slots and inserter hand size limits already provide a very good workaround for that particular problem. Set up 10 inserters per wagon with a hand size of 2 and you will never need more than 2 reserved slots. And yes, that makes loading slightly slower. The other option is to use only one type of barrel on that stop. Speed vs cost/footprint is the trade-off you have to make.
I am not saying it is a bad idea. I also understand that as a non-modder, you can't know what is and isn't possible. But sometimes there is no solution to a problem. As far as I am aware (and I do consider myself a decent modder), this is one of those cases. Within the current API there is simply no way to do what you suggest. And any API request that would impact inserter performance is going to be shot down on sight. You are of course free to try and come up with something that proves me wrong.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Inserters have wrong things in hand...
on_train_changed_state does exist, maybe not the cheapest if you have several hundred trains but it exists. So i'd say it certainly is in the realm of the possible to make inserters "swing back" *once* by teleporting the items back into the buffer chest when a train leaves. Not sure how likely it generally is that there is space left in the buffer chest though, mine are usually full. And without space it's pointless. And it would need to be a junky solution where they only swing back if the held item doesn't match the current filters.eduran wrote: ↑Sat Jun 01, 2019 2:40 pmThe event you describe does not exist. A mod would have to cycle through all inserters on the map, read the settings and compare them to the setting from one tick ago. That would bring down any CPU even on a medium sized map. And inserter hand position as well as the item held by an inserter are not writable.
Filtered wagons or seperate stops are a much easier solution for sure. Wasn't there even some mod that could circuit-control wagon filters?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Inserters have wrong things in hand...
Given a train that just changed state, how do you find the station's inserters?eradicator wrote: ↑Sat Jun 01, 2019 6:36 pmon_train_changed_state does exist, maybe not the cheapest if you have several hundred trains but it exists.
Re: Inserters have wrong things in hand...
Like i said, i have no mod expierince.eduran wrote: ↑Sat Jun 01, 2019 8:10 pmGiven a train that just changed state, how do you find the station's inserters?eradicator wrote: ↑Sat Jun 01, 2019 6:36 pmon_train_changed_state does exist, maybe not the cheapest if you have several hundred trains but it exists.
What i was thinking was something like on_filterinserter_change_filter - if that is not there already, then it can get added if we ask devs, maybe.
So basically a hook (?) when a filter in a inserter gets changed (after train leaves, the filter inserters should get their filter settings removed, right?)
So on on_filterinserter_change_filter
1.) If it gets changed from SOMETHING to NOTHING
- If nothing "in hand", do NOTHING
-> check if something "in hand", if so, "swing back" (or if that is not possible, teleport, put into internal inventory or just destroy - what ever is possibel idk)
- That there is space in the inventory is super easy to archive in using wires to only allow something in if its less then X..
2.) If it gets changed from NOTHING to Something
-> do nothing
So it should only be called when filter inserters get filters changed (usually shouldnt hapen often and nroamly only on train stops, right?)
I hate this - i call it - flame.There is a technical solution: don't build train stops that don't work very well.
This is not because the station is wrong, its because its a problem. I already said that i know i can build 192839182348120312 seperate stations, but i dont want to. The station desgin, is btw, just from the "use this LTN stations if you have problems thread".
Its like oh doctor if i move my head it hurts and doctor says: then DONT MOVE your HEAD!
Re: Inserters have wrong things in hand...
Sounds more likenuhll wrote: ↑Sat Jun 01, 2019 9:05 pmI hate this - i call it - flame.There is a technical solution: don't build train stops that don't work very well.
This is not because the station is wrong, its because its a problem. I already said that i know i can build 192839182348120312 seperate stations, but i dont want to. The station desgin, is btw, just from the "use this LTN stations if you have problems thread".
Its like oh doctor if i move my head it hurts and doctor says: then DONT MOVE your HEAD!
"Doctor my head hurts"
"Stop hitting it against the wall"
Like you said you are no developer. Events like on_inserter_idle or on_inserter_filter_changed would fire so often it would utterly tank performance for everyone so Wube will never add those.
Use my designs and set locked slots to stacks all inserters of a the station load per inserter cycle * items, problem solved.
My Mods: mods.factorio.com
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Inserters have wrong things in hand...
Get the inserters:eduran wrote: ↑Sat Jun 01, 2019 8:10 pmGiven a train that just changed state, how do you find the station's inserters?eradicator wrote: ↑Sat Jun 01, 2019 6:36 pmon_train_changed_state does exist, maybe not the cheapest if you have several hundred trains but it exists.
on_train_changed_state -> event.train -> for x in train.cargo_wagons -> cargo.wagon.surface.find_entities_filtered{area=double_box_size(cargo_wagon.prototype.collision_box),type=inserter}
Check if inserters are the ones you want:
inserter.drop_target == cargo_wagon
(this is probably untrue if the train already left one tick before, timinig might be solvable)
or
is_position_inside_box(inserter.drop_position,cargo_wagon.collision_box)
(this is easier as in one tick the wagon position won't change that much)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Inserters have wrong things in hand...
I dont think on_inserter_filter_changed would fire that often in a normal world.Optera wrote: ↑Sun Jun 02, 2019 4:05 amSounds more likenuhll wrote: ↑Sat Jun 01, 2019 9:05 pmI hate this - i call it - flame.There is a technical solution: don't build train stops that don't work very well.
This is not because the station is wrong, its because its a problem. I already said that i know i can build 192839182348120312 seperate stations, but i dont want to. The station desgin, is btw, just from the "use this LTN stations if you have problems thread".
Its like oh doctor if i move my head it hurts and doctor says: then DONT MOVE your HEAD!
"Doctor my head hurts"
"Stop hitting it against the wall"
Like you said you are no developer. Events like on_inserter_idle or on_inserter_filter_changed would fire so often it would utterly tank performance for everyone so Wube will never add those.
Use my designs and set locked slots to stacks all inserters of a the station load per inserter cycle * items, problem solved.
I mean, how often do your filters get changed? If u have like 100 stations, maybe 20 filter (* 20 inserters) a minute?
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Inserters have wrong things in hand...
I'll be betting 1M green circuits that the answer is going to be "No." with at most one sentence of explanation, containing the word "performance".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Inserters have wrong things in hand...
In a normal megabase, you DONT change filters?eradicator wrote: ↑Fri Jun 07, 2019 10:12 amI'll be betting 1M green circuits that the answer is going to be "No." with at most one sentence of explanation, containing the word "performance".
Only on train stations, what is the problem??? You most likly dont have 1000 stations working at the same time, changing constantly filters?!
Also it dont need to fire on filter change, just on filter remove.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Inserters have wrong things in hand...
Ever heared of "smart smelting"?
Also i'm just predicting results. I don't have a "problem".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.