[MOD 1.1] Inventory Sensor

Topics and discussion about specific mods
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Optera »

robot256 wrote: Sun Mar 17, 2019 2:11 am (this is kerboom, on my new non-throwaway account that won't let me PM yet.)

Hey Optera, I made a mod to replace Multidirectional Trains! I'm going to post it soon, but I used your "copyPrototype.lua" file for my first hack-job and won't include that without getting your permission. Would that be okay with you? Reading your mod (and Noxy's) was really helpful to learn what I'm doing. Thanks again for maintaining some awesome mods!
I moved copyPrototype into public Domain from whatever license it inherited.
Feel free to use it as long as you keep that header.
Here is the updated one from Loader Redux: https://github.com/Yousei9/Loader-Redux ... totype.lua
robot256
Filter Inserter
Filter Inserter
Posts: 933
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by robot256 »

Thanks! It's live now. Let me know what you think :D

viewtopic.php?f=190&t=67943
Shadefang
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed Aug 17, 2016 3:20 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Shadefang »

Would it be possible to have the sensor detect if there is a player in the vehicle?
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Optera »

Would be possible, but I'm not sure how much performance this costs.
Krid
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Apr 08, 2019 1:02 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Krid »

Hi, i tried to create a as much as possible automated Botntetwork Exchange Point. (Mainly to avoid bots going over hostile Territory and Wall Maintenance)
But i would like to be able to use it also if i am Inserting facorys or mining Equipment to just work without setting Constant Combinators or such stuff. (Just placing down an Blueprint and finished ..)

The Inventory Sensor does Great Things for me. But i am not able to read unfullfilled requests from Requester chests in the Logistics network of my Roboports.

For me not obtainable values are:
- Unfullfilled Requests in Requester Boxes
Optional:
- Number of Cells (Roboports) in current Network (to calc the Robot Amount, but available Statistic could also do the Job)

Optional interesting Values would be:
- all current Network Roboport Inventory (Bots and Repair Packs)
- all Unfullfilled Requests in current Network

If you know a solution please give me a pointer otherwise see this Post as an Feature Request. (if its possible)

To get an Idea what i am Trying my current Blue Print and some Screens.



Part of my Setup
Image
the Request i had to "emulate" with an Constant Combinator
Image

Thanks
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Optera »

Short answer:
No, Inventory sensor will not contain logistic network data.

Long answer:
Accessing Logistic Network data from mods is currently terribly cumbersome and very performance heavy.

There are no events raised when logistic cells (roboport area) connect and separate, making caching anything impossible.

To get current requests mods have to aggregate each single requester in LuaLogisticNetwork.requesters or potentially LuaLogisticNetwork.requester_points.
To get unfulfilled requests a mod could at least get all available items with LuaLogisticNetwork.get_contents(), but that probably will not include items currently in transit.
Krid
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Apr 08, 2019 1:02 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Krid »

Ok, Thank you.
gridstop
Inserter
Inserter
Posts: 47
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by gridstop »

The sensor already reads the fluid boxes of fluid wagons and assembly machines, but could you add normal fluid storage tanks to the supported items? I've been hacking it in by hand. I've been using it to work around the horrible floating point truncation when connecting wires to tanks. Honestly it might be nice to read the fluid of anything with a fluid box. Pipe, pump, pipe to ground, etc...

Being able to read momentary drops in flamethrower turret fluid box (as it draws from its internal buffer) could let you create auto power-down laser walls and the like too.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.6

Post by Optera »

I had an agreement with the author of a fluid sensor to let his mod do fluid readings for pipes and tanks.
If that mod was abandoned I can easily add that functionality to IS.

Since you are annoyed by fluid rounding, please push this thread to get rid of it.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16/0.17] Inventory Sensor 1.7.3

Post by Optera »

I've added storage tanks, boilers and generators for now.
Reading from any pipe seems excessive in most cases you want to know whats inside producing, consuming or storage entity.
gridstop
Inserter
Inserter
Posts: 47
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by gridstop »

Thanks! Works great.
I was going to ask if there was a way to show when the fluid box is locked to a resource (due to a source or sink) but truly has 0 contents (sensor shows nothing and entity itself shows 0.0 of the locked fluid type on the tooltip). Even if you can sense it I'm not sure what you'd report it as, -1 or something? But then I realized, what could you even really do with this information, nothing really.

Hopefully, we'll be blissfully unburdened of this nonsense with the fluid redesign. I've seen cases where a small (9 entities) fluid network remains locked even with no sources or sinks and a creative mod fluid void attached, which is really frustrating. I do a lot of builds with crafting combinator changing recipes and the fluid stuff has made it really, really difficult.
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by mrvn »

gridstop wrote: Tue Apr 16, 2019 3:26 am Thanks! Works great.
I was going to ask if there was a way to show when the fluid box is locked to a resource (due to a source or sink) but truly has 0 contents (sensor shows nothing and entity itself shows 0.0 of the locked fluid type on the tooltip). Even if you can sense it I'm not sure what you'd report it as, -1 or something? But then I realized, what could you even really do with this information, nothing really.

Hopefully, we'll be blissfully unburdened of this nonsense with the fluid redesign. I've seen cases where a small (9 entities) fluid network remains locked even with no sources or sinks and a creative mod fluid void attached, which is really frustrating. I do a lot of builds with crafting combinator changing recipes and the fluid stuff has made it really, really difficult.
Use case:
- Program a pump to unload a fluid wagon if the fluid in question is the one the pipe expects.
- Request the liquid at the LTN station that the pipe expects.

Both cases come down to having a fluid station that you do not have to program. Just paste it somewhere, connect the pipe and it magically switches to the right liquid.
rasmi
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Jul 25, 2019 9:19 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by rasmi »

Hi Optera,

Could you please apply this patch to inventory sensors? It adds reading how many stacks this inventory support (if it is possible to read, as I understood only wagons can provide this).

Use cases are to do some advanced calculations on LTN providers to make sure each wagon is loaded correctly. (I can explain a bit more what is my design\idea, if you're interested)

I'm not a native not in German not in English, so translation may be wrong. I don't know French at all, so I didn't even try. :-)

Thanks!
Attachments
inventory_sensor_stack_size_feature.txt
Patch for stack count signal
(5.29 KiB) Downloaded 131 times
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by mrvn »

rasmi wrote: Thu Jul 25, 2019 9:30 am Hi Optera,

Could you please apply this patch to inventory sensors? It adds reading how many stacks this inventory support (if it is possible to read, as I understood only wagons can provide this).

Use cases are to do some advanced calculations on LTN providers to make sure each wagon is loaded correctly. (I can explain a bit more what is my design\idea, if you're interested)

I'm not a native not in German not in English, so translation may be wrong. I don't know French at all, so I didn't even try. :-)

Thanks!
Like when you make a train with a cargo wagon mkI and cargo wagon mkIII then you want to load only 1/3rd in the smaller one?
rasmi
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Jul 25, 2019 9:19 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by rasmi »

Exactly.

I can ofc use decoded train poisition, but it is a bit tedious — in heavy modded game there are dozen of different wagon types. And with Yuoki trains there are DOZENS of wagon types. :-) Also there are of cource a few other different approaches to deal with this problem, like locked slot per wagon and modular chests, balancing and etc... But I have a design in mind which I currently testing that should deal with these problems better.

And the proposed change is very trivial, it do not introduce any additional ticks, just a new signal and reading wagon capacity when sensor is reading wagon inventory. So even if my current design really sucks, then may be somebody else will have a use of this.
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by mrvn »

While your idea is probably worth while I simply avoid that problem.

Never build a train with mixed wagons. I also always put the locomotives at the same place and never where some other train has a wagon. And for bidirectional I always build palindrom. Longer trains I now build by simply connecting 2 short ones. So 2x LCCC becomes LCCCLCCC. Makes it simpler to expand existing stations without screwing up existing trains.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by Optera »

I don't see value in mixing wagons of different capacities.
All it does is making life hard on yourself, and requiring additional features and runtime in mods.

Especially when LTN tries merging multiple items, the logic to load correctly into each wagon becomes a nightmare.
rasmi
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Jul 25, 2019 9:19 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by rasmi »

OK, I didn't carefully read what mrvn have wrote. Sorry about that.

No, mixing different wagons with different capacity in one train is also good and achievable goal, but the first intention was to support one station serving uniform but different trains. Like whole first train is MkI and the second train is MkII.

I understood that I need this while doing the following design: I get LTN output, get wagon capacity and see how much items I can fit in this current wagon. Then I send a reminder to the next calculation unit. How do I know how much items I can fit into one wagon if I don't know its capacity? Here capacity signal comes in handy.

Anyway, the modification I made it is working for me and I my intention was to make it public so may be someone else will find it useful. You don't need to put me on "thanks" or "author" list or anything like that. When you will be deciding to apply or not apply this thing, just consider that there is at least one user who find it useful.

Thanks.
mrvn
Smart Inserter
Smart Inserter
Posts: 5881
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by mrvn »

rasmi wrote: Thu Jul 25, 2019 8:02 pm OK, I didn't carefully read what mrvn have wrote. Sorry about that.

No, mixing different wagons with different capacity in one train is also good and achievable goal, but the first intention was to support one station serving uniform but different trains. Like whole first train is MkI and the second train is MkII.

I understood that I need this while doing the following design: I get LTN output, get wagon capacity and see how much items I can fit in this current wagon. Then I send a reminder to the next calculation unit. How do I know how much items I can fit into one wagon if I don't know its capacity? Here capacity signal comes in handy.

Anyway, the modification I made it is working for me and I my intention was to make it public so may be someone else will find it useful. You don't need to put me on "thanks" or "author" list or anything like that. When you will be deciding to apply or not apply this thing, just consider that there is at least one user who find it useful.

Thanks.
Huh? I think you are totally over complicating things.

A train arrives at the station. LTN says to load 32400. You enable all insterers for all wagons until the LTN stops shows 32400 items in the train. All this needs is one arithmetic combinator to do "each * -1 = each". You don't even need inventory sensors. You simply load.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [MOD 0.16 / 0.17] Inventory Sensor 1.7.3

Post by Optera »

rasmi wrote: Thu Jul 25, 2019 8:02 pm OK, I didn't carefully read what mrvn have wrote. Sorry about that.

No, mixing different wagons with different capacity in one train is also good and achievable goal, but the first intention was to support one station serving uniform but different trains. Like whole first train is MkI and the second train is MkII.

I understood that I need this while doing the following design: I get LTN output, get wagon capacity and see how much items I can fit in this current wagon. Then I send a reminder to the next calculation unit. How do I know how much items I can fit into one wagon if I don't know its capacity? Here capacity signal comes in handy.

Anyway, the modification I made it is working for me and I my intention was to make it public so may be someone else will find it useful. You don't need to put me on "thanks" or "author" list or anything like that. When you will be deciding to apply or not apply this thing, just consider that there is at least one user who find it useful.

Thanks.
You certainly are overthinking things. LTN already does all that for you.

All you need in is a single arithmetic combinator controlling filter inserters for loading and unloading. See my designs here: viewtopic.php?f=214&t=51073#p297643
This will work as long as each wagon on a train has the same capacity and is loaded with the same speed. Having station buffer chests balanced also helps, I recommend wide chest spanning the whole train length.
Post Reply

Return to “Mods”