Empty-inventory-slot reader

This is the place to request new mods or give ideas about what could be done.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Empty-inventory-slot reader

Post by Pi-C »

Honktown wrote: Thu Jan 30, 2020 3:07 pm
mrvn wrote: Thu Jan 30, 2020 2:26 pm
Olacken wrote: Thu Jan 30, 2020 1:45 pm I was not proposing to replace the train stop I was suggesting to replace the track under the stop
And how would that work with wooden rails (where I don't have steel rails for ages so no sensors) or powered rails (where the sensor rail breaks the power flow)?
I wouldn't think have a circuit specification requires power, but that'd be one of those annoying "did the devs really do that" behaviors
I think the problem is more when you're using powered rails instead of power poles to transmit electricity to your outposts, a non-powered rail will break the supply down the line (you'd need to hook up power again on the other side of the special rail).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

Pi-C wrote: Thu Jan 30, 2020 3:17 pm
Honktown wrote: Thu Jan 30, 2020 3:07 pm
mrvn wrote: Thu Jan 30, 2020 2:26 pm
Olacken wrote: Thu Jan 30, 2020 1:45 pm I was not proposing to replace the train stop I was suggesting to replace the track under the stop
And how would that work with wooden rails (where I don't have steel rails for ages so no sensors) or powered rails (where the sensor rail breaks the power flow)?
I wouldn't think have a circuit specification requires power, but that'd be one of those annoying "did the devs really do that" behaviors
I think the problem is more when you're using powered rails instead of power poles to transmit electricity to your outposts, a non-powered rail will break the supply down the line (you'd need to hook up power again on the other side of the special rail).
Hmmm. If the circuit-capable prototypes are copied from existing rails, I don't imagine there would be a conflict, but I haven't tried making a circuit-capable rail, nor done anything to make wagon-reading functions.
I have mods! I guess!
Link
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Empty-inventory-slot reader

Post by mrvn »

Honktown wrote: Thu Jan 30, 2020 3:20 pm
Pi-C wrote: Thu Jan 30, 2020 3:17 pm
Honktown wrote: Thu Jan 30, 2020 3:07 pm
mrvn wrote: Thu Jan 30, 2020 2:26 pm
Olacken wrote: Thu Jan 30, 2020 1:45 pm I was not proposing to replace the train stop I was suggesting to replace the track under the stop
And how would that work with wooden rails (where I don't have steel rails for ages so no sensors) or powered rails (where the sensor rail breaks the power flow)?
I wouldn't think have a circuit specification requires power, but that'd be one of those annoying "did the devs really do that" behaviors
I think the problem is more when you're using powered rails instead of power poles to transmit electricity to your outposts, a non-powered rail will break the supply down the line (you'd need to hook up power again on the other side of the special rail).
Hmmm. If the circuit-capable prototypes are copied from existing rails, I don't imagine there would be a conflict, but I haven't tried making a circuit-capable rail, nor done anything to make wagon-reading functions.
The problem is more that for every clone of the prototype you make a sensor from you might also need to make a sensor version of. So if you add a sensor to the vanilla train stop you need to detect LTN and also add one to the LTN stop. If you modify rails then you have to detect every clone of a rail and maybe add a sensor there too. That quickly becomes unmanagable.

Modifying something basic like a stop or rail has too many interactions with other mods. The idea of using a circuit connection on the other hand would only minimally conflict with other mods. But at the cost of making it hard to find the wire. Something to consider if you want to implement this idea anyway.
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

mrvn wrote: Thu Jan 30, 2020 3:51 pm The problem is more that for every clone of the prototype you make a sensor from you might also need to make a sensor version of. So if you add a sensor to the vanilla train stop you need to detect LTN and also add one to the LTN stop. If you modify rails then you have to detect every clone of a rail and maybe add a sensor there too. That quickly becomes unmanagable.

Modifying something basic like a stop or rail has too many interactions with other mods. The idea of using a circuit connection on the other hand would only minimally conflict with other mods. But at the cost of making it hard to find the wire. Something to consider if you want to implement this idea anyway.
Train stops would have a lot of potential for conflict. Rails on the other hand would have less (I could see someone detecting rails to do something, but fewer than would use train stops).

It's not complicated/expensive to add a lot of prototypes and make them craftable, people handle color palettes of belts/inserters/assemblers etc just fine (a mod I use can add over 300+ recipes and item prototypes, though they're usually in their own category).

Maybe mix the ideas: add combinators for 1-N, and they read from the connected rail stop wagons. If a custom gui is added, then only one combinator is needed: select a rail stop on the connected circuit network (add a button to search the network, so we don't have to do it on gui opened or other condition) and then enter a number to read from that wagon if present.

On train entered a stop, we if (station_table["station_name"]), and if the rail stop has assigned combinators, attach the wagon to associated combinators and define them in the update table. on tick, update the signals for combinators with attached wagons (for _, combinator in pairs(active_table). On a train leaving a known station, remove the combinators from the on_tick update table (active_combinators[entity_id] = nil). We don't need to dissociate the wagon from the combinators, because they're not functioning until the next train stop, where only combinators who were assigned a "new" wagon are entered into the on_tick update signal table (so even if say, combinator wagon 4 had an invalid wagon, it wouldn't be passed for updating).

In this way, prototypes are minimized, there's no automatic searching/updating of connections, and the most expensive bit is exactly where we need it: updating the signals, and knowing if a train stop needs to activate combinators.

Edit: typos, added a tiny bit for thoroughness
Last edited by Honktown on Thu Jan 30, 2020 6:49 pm, edited 1 time in total.
I have mods! I guess!
Link
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

I'll add: to distinguish the signals individually, the combinator could be double-sided, so we can have unique colors for output, or have one connection, but the outputs are on a fixed color (so green wires could be for train stop, and red for signal from that combinator, sent to inserters or whatever).

Edit: if we hijack constant combinators, we don't even need a new combinator :) , the gui could trigger on opening a combinator gui, and signal assignment could be to that combinators output. We'd still need to fix the color output of the signal, or suffer a little bit of on_tick performance if we added buttons to detect stations on network on color red/green, and output to color red/green.

We could even go wireless! Detect when a train station or wagon GUI is opened, and use that with the indicated combinator instead of a circuit network. A second mod could be made, so a checkbox could be used to watch for entities opened or selected, and then we can assign an arbitrary combinator (however we want: remember any combinator we specify, only a combinator we're open in, etc) and un-track on specific conditions (train associated with wagon left station, miner is empty, connected pole has no signal anymore - wouldn't be able to re-trigger in the pole case without constantly checking or having something else).

Wireless/Arbitrary signalling. Someone can probably think of a better name but I could see where it would be very useful, though not as performance-friendly as using the base circuit network.
I have mods! I guess!
Link
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Try this one: https://mods.factorio.com/mod/EmptySlotsReader

It can also read players' inventory, cargo wagon's inventory or locomotive fuel inventory.

By megabases slower reaction, but same UPS.
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

darkfrei wrote: Mon Feb 03, 2020 2:05 pm Try this one: https://mods.factorio.com/mod/EmptySlotsReader

It can also read players' inventory, cargo wagon's inventory or locomotive fuel inventory.

By megabases slower reaction, but same UPS.
what're you think you're doin', Buster?
image
I have mods! I guess!
Link
Pi-C
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Empty-inventory-slot reader

Post by Pi-C »

darkfrei wrote: Mon Feb 03, 2020 2:05 pm Try this one: https://mods.factorio.com/mod/EmptySlotsReader

It can also read players' inventory, cargo wagon's inventory or locomotive fuel inventory.

By megabases slower reaction, but same UPS.
Thanks, looks quite nice so far! (I just put it next to some chests for testing -- can't use it in my real game yet as I'm still waiting for many mods to update.) It even reads the contents of furnaces and boilers, so can be used practically everywhere in the factor, not only for trains. Because of this versatility, I see no need to ask for other signals (using "T" for "Total" would be bad if you'd meant the EmptySlotsReader to be used with trains only because we'd have to make sure it doesn't interfere with the stations' signal for the train ID). Looking forward to continuing my game so I can use it! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Pi-C
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Empty-inventory-slot reader

Post by Pi-C »

Honktown wrote: Mon Feb 03, 2020 2:34 pm
image
Looking promising as well. So you can read the number of wagons in a train? Oh, I get it -- you've to set for each station how many wagons the train going there will have? Would such settings be copied if you make a blueprint of a station? Guess I'll have to check out this mod as well.

Anyway, don't worry about darkfrei having made a similar mod: One can be used everywhere, the other is specialized and could save work (less entities to place, not one sensor per wagon), so I see no reason not to use both mods in the same game. :-D
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

Pi-C wrote: Mon Feb 03, 2020 3:16 pm
Honktown wrote: Mon Feb 03, 2020 2:34 pm
image
Looking promising as well. So you can read the number of wagons in a train? Oh, I get it -- you've to set for each station how many wagons the train going there will have? Would such settings be copied if you make a blueprint of a station? Guess I'll have to check out this mod as well.

Anyway, don't worry about darkfrei having made a similar mod: One can be used everywhere, the other is specialized and could save work (less entities to place, not one sensor per wagon), so I see no reason not to use both mods in the same game. :-D
The drop-down on the left selects the wagon specifically, so the combinator will wirelessly read wagon N. I'll be starting with [E]mpty spaces (point of the thread). Reading the wagon contents itself would be doable like how darkfrei maybe did it: add circuit behavior to wagons and snap a wire until wagon leaves (or maybe he just let's the wire go infinitely, if wires work moving entities? Hmmmmmmmmmmm now thare's something interesting). For more complex empty/partial-stack behavior, that'll require more. I'm definitely going for when trains come and go, and unfortunately there's a bunch of back-and-forth, because a combinator could become invalid, or a station, and when I get to it, the wagon being watched. Have to remember to clear the combinators output if station/wagon become invalid. Also I'm starting with the option to detach a combinator from watching a wagon (selecting "nil" instead of a number in the drop-down), without picking it up or anything. Spent way too long on the gui earlier : P
I have mods! I guess!
Link
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Pi-C wrote: Mon Feb 03, 2020 3:05 pm Thanks, looks quite nice so far! (I just put it next to some chests for testing -- can't use it in my real game yet as I'm still waiting for many mods to update.) It even reads the contents of furnaces and boilers, so can be used practically everywhere in the factor, not only for trains. Because of this versatility, I see no need to ask for other signals (using "T" for "Total" would be bad if you'd meant the EmptySlotsReader to be used with trains only because we'd have to make sure it doesn't interfere with the stations' signal for the train ID). Looking forward to continuing my game so I can use it! :-)
I can make an option to switch it in the mod settings, for example to "A" as "all" or just disable it.

Due the mod working i have idea that the combinator can calculate all item stacks in the chest:
if you have six used slots with 1 coal, 1 coal, 2 coals, 3 coals, 5 coals, 8 coals then the mod can give you "coal: 6", but not "coal: 20".
Pi-C
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Empty-inventory-slot reader

Post by Pi-C »

darkfrei wrote: Mon Feb 03, 2020 5:47 pm
Pi-C wrote: Mon Feb 03, 2020 3:05 pm Thanks, looks quite nice so far! (I just put it next to some chests for testing -- can't use it in my real game yet as I'm still waiting for many mods to update.) It even reads the contents of furnaces and boilers, so can be used practically everywhere in the factor, not only for trains. Because of this versatility, I see no need to ask for other signals (using "T" for "Total" would be bad if you'd meant the EmptySlotsReader to be used with trains only because we'd have to make sure it doesn't interfere with the stations' signal for the train ID). Looking forward to continuing my game so I can use it! :-)
I can make an option to switch it in the mod settings, for example to "A" as "all" or just disable it.
Switching the signals would be great. But why would you want to disable them? You need to output something, otherwise why use the mod at all?
Due the mod working i have idea that the combinator can calculate all item stacks in the chest:
if you have six used slots with 1 coal, 1 coal, 2 coals, 3 coals, 5 coals, 8 coals then the mod can give you "coal: 6", but not "coal: 20".
While this sounds like a nice-to-have feature, I can already see myself putting the sensors in front of some warehouses with 1800 slots each. It definitely would take a hefty bite out of UPS! :-D
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Pi-C wrote: Mon Feb 03, 2020 5:58 pm While this sounds like a nice-to-have feature, I can already see myself putting the sensors in front of some warehouses with 1800 slots each. It definitely would take a hefty bite out of UPS! :-D
It's possible to split this scanning, some spread by ticks. For example not more than 40 slots (cargo wagon size) per tick.
Alternative - Small Chests.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Empty-inventory-slot reader

Post by Pi-C »

darkfrei wrote: Mon Feb 03, 2020 6:42 pm
Pi-C wrote: Mon Feb 03, 2020 5:58 pm While this sounds like a nice-to-have feature, I can already see myself putting the sensors in front of some warehouses with 1800 slots each. It definitely would take a hefty bite out of UPS! :-D
It's possible to split this scanning, some spread by ticks. For example not more than 40 slots (cargo wagon size) per tick.
If you can do that? Something like tick spreading seems already to happen, although I haven't figured out that part of your code yet. :-)
Alternative - Small Chests.
Not an option for where I want to use ware houses: buffers in train stations. Also, they make it easy to filter different goods from different wagons for further belt-based distribution because you can fit several filter inserters around them. May be good for malls though, where only small amounts of everything are produced. Limiting a steel chest with 48 slots to just one or two seems a bit wasteful. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Pi-C wrote: Mon Feb 03, 2020 7:22 pm If you can do that? Something like tick spreading seems already to happen, although I haven't figured out that part of your code yet. :-)
It's possible, just while not ready, don't switch to the next ESR-handler.

Another solution is just support first n slots and last of them will be ignored. Or calculate the first n slots and last m slots, it's enough to understand that we have here something and if we have here free slots for new stuff.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Empty-inventory-slot reader

Post by eradicator »

Pi-C wrote: Mon Feb 03, 2020 5:58 pm While this sounds like a nice-to-have feature, I can already see myself putting the sensors in front of some warehouses with 1800 slots each. It definitely would take a hefty bite out of UPS! :-D
Inventories with too many slots are bad for UPS in general though. And if you start tick-distrubuting the scan wouldn't that cause weird inconsistencies in the response time of the sensor? Distribution as such isn't that difficult though. (viewtopic.php?p=312681#p312681)

(Edit: Moved half of my post back here after topics were split.)
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.
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

https://mods.factorio.com/mod/TrainWagonCombinators

YEET
gal_1.jpg
gal_1.jpg (886.4 KiB) Viewed 4476 times
I have mods! I guess!
Link
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Honktown wrote: Wed Feb 05, 2020 11:10 pm https://mods.factorio.com/mod/TrainWagonCombinators

YEET

gal_1.jpg
Is it not too complicated for people, that not read instructions?
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Empty-inventory-slot reader

Post by Honktown »

darkfrei wrote: Thu Feb 06, 2020 9:59 am
Honktown wrote: Wed Feb 05, 2020 11:10 pm https://mods.factorio.com/mod/TrainWagonCombinators

YEET

gal_1.jpg
Is it not too complicated for people, that not read instructions?
I don't know if you mean that I didn't read instructions, or are you asking about the mod?
I have mods! I guess!
Link
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Empty-inventory-slot reader

Post by darkfrei »

Honktown wrote: Thu Feb 06, 2020 10:48 am I don't know if you mean that I didn't read instructions, or are you asking about the mod?
I can expect that players, that have downloaded your mod, haven't read any tutorial how to use this mod.
Post Reply

Return to “Ideas and Requests For Mods”