[MOD 0.17] Inventory Sensor 1.7.3

Topics and discussion about specific mods
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2303
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.1.7

Post by steinio »

Optera wrote:Thanks for the flowers.

The reason why I changed the license is simple. Someone re-branded LTN and re-hosted it on the mods page as his own creation. (without asking ofc, as (L)GPL allows forgoing any form of manners apparently)
I always liked open source, but I also like to get credit for my work, so I pulled the plug and will only release projects where I sink countless hours into under licenses preventing re-hosting or re-branding.
WTF?
Sorry for that.

Stupids are everywhere around.

Please keep on your good work.
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

folk
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Fri Mar 03, 2017 5:00 pm
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.1.7

Post by folk »

folk wrote: [*]I never looked at your code - I looked at your github to see if there were any blueprints there in the readme.md or GH wiki
[*]I have never written any mods for Factorio
Well, that was then and this is now :-)
Since you removed the ability to read Roboport contents in the previous version (1.2.0), I unzipped the mod so that I could add it back in, and I just remade the mod.

https://hastebin.com/pasojitike.lua
All the code is in here and the URL above
There are 6 things worth noting;
1. It should be substantially faster. Note that I am not claiming I noticed anything before, because I did not. Regardless, theoretically, it should be much faster, which might be worth something on larger maps - I don't know.
2. The roboport only reads the 4 robot statistics, not the other contents because I don't care
3. I didn't implement the car/tank, because I don't use it
4. I am not going to upload this anywhere, and with this post I sign over all rights to the above to the author of the original addon
5. Line 370-380 are because I renamed the mod locally and toggled "Inventory Sensor" off, and so it migrates all the entities in my save games from your mod to this .global table
6. The tick function updates every 20 ticks, I ignore whatever is in the config file

The reason I want the roboport readout is because my perimeter outposts with 1 roboport use it to read both logistic network content and robot statistics. Anyway, it was a quick fix.

Hopefully you like it :-)

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

Re: [MOD 0.13/0.14] Inventory Sensor 1.2.0

Post by Optera »

There's quite some interesting changes you made in that complete rewrite. I sent you a pm with more details.

Reading Logistic Network statistic is a lot slower in lua than directly from a roboport and sometimes really buggy. For example when roboports run out of power and split a network. That's why I decided to remove this redundant/obsolete feature instead of properly implementing it with all checks.

Sedar
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Apr 06, 2016 7:29 am
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.2.0

Post by Sedar »

Thank you for this mod. He is sometimes extremely useful. :)

Recently, in my game, I learned the technology of electric trains and see that your sensor does not see electric locomotives from Electric Vehicles mod. Could you add compatibility with this mod, please.

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

Re: [MOD 0.13/0.14] Inventory Sensor 1.2.0

Post by Optera »

Sedar wrote:Thank you for this mod. He is sometimes extremely useful. :)

Recently, in my game, I learned the technology of electric trains and see that your sensor does not see electric locomotives from Electric Vehicles mod. Could you add compatibility with this mod, please.
It can see electric locomotives just fine in my games. Only electric tanks are detected as car, though that's a drawback with any modded vehicle as I don't include a lookup table with names of all tanks in popular mods.

Sedar
Fast Inserter
Fast Inserter
Posts: 112
Joined: Wed Apr 06, 2016 7:29 am
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.2.0

Post by Sedar »

Optera wrote: It can see electric locomotives just fine in my games. Only electric tanks are detected as car, though that's a drawback with any modded vehicle as I don't include a lookup table with names of all tanks in popular mods.
You're right, everything works fine. Maybe when I did the tests I placed the sensor by the wrong side. Excuse for troubling. Thanks again for your mod. :D

gridstop
Inserter
Inserter
Posts: 44
Joined: Sun Jul 17, 2016 1:46 am
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.2.2

Post by gridstop »

Would it be possible to read the contents of a requester chest? I have some setups where I have to use a circuit network to set requests, and read the contents of the requester chests, since they aren't normally part of the network.

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

Re: [MOD 0.13/0.14] Inventory Sensor 1.3.0

Post by Optera »

gridstop wrote:Would it be possible to read the contents of a requester chest? I have some setups where I have to use a circuit network to set requests, and read the contents of the requester chests, since they aren't normally part of the network.
Good idea.

Edit: 1.3.0 connects to requester chests, including any modded requester, and ignores all other chest types.

Mobius1
Fast Inserter
Fast Inserter
Posts: 185
Joined: Thu Feb 09, 2017 12:05 am
Contact:

Re: [MOD 0.13/0.14] Inventory Sensor 1.3.0

Post by Mobius1 »

hey Optera, how's it going?

first of all thanks for creating this mod, its so amazingly helpful I love it!

I'd like to give you an idea, why don't you make the hability to read wagon contents in your LTN mod?

Like the train arrives at the "provider station" with the signal, for example, 100 iron-ore, but my "provider station" is a mining outpost that has around 90k in stock and mines both iron and copper and its fed into the trains by logistic robots.

Sometimes the train requests "14 stacks" or something like that, that makes it requests 2 or more types of items at once on the station, so now lets say its outputting 100 iron and 100 copper, the logistic bots will start to grab iron to fill the train but the inserters are faster than the bots, so they empty out the requester chest before it tells the robots to stop bringing more iron, so they end up in a loop of grabbing iron over and over and over filling the wagon with only 1 type of ore. The solution I found for this particular issue was to use this Inventory Sensor mod attached with a combinator that turns the contents of the wagon into a negative signal and feeds the output of the LTN station, so once the wagon has, say, 100 iron ore, the requester chests clears out their filters since they're attached to the circuit network because its sending an iron signal of 0, the robots stops feeding it with iron and starts feeding it with copper and everything works automagically brilliant!

So that made me think that since the train sends the request signal to the LTN stop, why it doesn't also send its wagon contents to the Stop with an inverse signal of the work order? For example, if the train is providing items, outputting a negative signal, the contents of its wagon would output a positive signal, if the train is requesting items, outputting a positive signal, the wagon would output a negative signal.

Its just a suggestion btw, I'll still love both mods either way :D

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

Re: [MOD 0.13/0.14] Inventory Sensor 1.3.0

Post by Optera »

Mobius1 wrote:hey Optera, how's it going?

first of all thanks for creating this mod, its so amazingly helpful I love it!

I'd like to give you an idea, why don't you make the hability to read wagon contents in your LTN mod?

Like the train arrives at the "provider station" with the signal, for example, 100 iron-ore, but my "provider station" is a mining outpost that has around 90k in stock and mines both iron and copper and its fed into the trains by logistic robots.

Sometimes the train requests "14 stacks" or something like that, that makes it requests 2 or more types of items at once on the station, so now lets say its outputting 100 iron and 100 copper, the logistic bots will start to grab iron to fill the train but the inserters are faster than the bots, so they empty out the requester chest before it tells the robots to stop bringing more iron, so they end up in a loop of grabbing iron over and over and over filling the wagon with only 1 type of ore. The solution I found for this particular issue was to use this Inventory Sensor mod attached with a combinator that turns the contents of the wagon into a negative signal and feeds the output of the LTN station, so once the wagon has, say, 100 iron ore, the requester chests clears out their filters since they're attached to the circuit network because its sending an iron signal of 0, the robots stops feeding it with iron and starts feeding it with copper and everything works automagically brilliant!

So that made me think that since the train sends the request signal to the LTN stop, why it doesn't also send its wagon contents to the Stop with an inverse signal of the work order? For example, if the train is providing items, outputting a negative signal, the contents of its wagon would output a positive signal, if the train is requesting items, outputting a positive signal, the wagon would output a negative signal.

Its just a suggestion btw, I'll still love both mods either way :D
LTN doesn't show train inventories because it would be waste of script updates wasted on a (soon) tripple redundant functionality.
  • Inventory Sensor came long before LTN and has a much finer, per wagon, granularity than ltn could.
  • For less granularity a simple memory cell storing inserter pulse reads and subtracting that from the static loading amount provides the best ups performance as it doesn't need any script update.
    On my maps I exclusively use this method for (u-)loading LTN controlled trains.
  • 0.15 will add reading train inventories to all stops.

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

Re: [MOD 0.15] Inventory Sensor 1.4.0

Post by Optera »

Update to 0.15 is done.
I've added reading inventories of fluid wagons, no idea why the devs didn't add that to train stops.
Image

Now I need a break before moving LTN to 0.15.

loganb
Inserter
Inserter
Posts: 43
Joined: Mon Jul 25, 2016 3:58 am
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.2

Post by loganb »

Hello,

Your mods are great, BTW. Thanks for enriching the game for us all.

Quick question/feature request: can you/would you consider making it possible for the inventory sensor to report available space rather than contents? With the stack inserter override in 0.15 (and bug fix on 0.15.8), I think it's possible to load a train with multiple resources without locking inserters, but only if it's possible to sense the remaining space in the cargo wagon. Specifically, sensing space in locked slots would be amazing.

I made a feature request awhile ago and described how it might work: viewtopic.php?f=6&t=38897. I'd be interested in your thoughts on the subject. Thanks!

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.2

Post by Optera »

I'm not keen on doing anything related to filters with the horrible inefficient way the api exposes them.
Even just counting the number of filtered slots requires iterating over every single slot. The only exposed function is is_filtered which is mostly useless as it only returns if there is any filter set.

Should LuaInventory ever get a functions returning a list of indizes of filtered slots or a dictionary with direct references to filtered slots I'd consider working with them.

User avatar
ZlovreD
Fast Inserter
Fast Inserter
Posts: 112
Joined: Thu Apr 06, 2017 1:07 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.2

Post by ZlovreD »

Adding is_crafting() to assemblers, furnaces and reactors:

[signal.lua] @end

Code: Select all

  {
    type = "virtual-signal",
    name = "detect-in-use",
    icon = "__base__/graphics/icons/signal/signal_C.png",
    subgroup = "sensor-signals",
    order = "x[sensor-signals]-du"
  }
Maybee new icon?

[control.lua] @212 line before "if connectedEntity.type == ASSEMBLER then"

Code: Select all

  if connectedEntity.type == ASSEMBLER or connectedEntity.type == FURNACE or connectedEntity.type == REACTOR then
	if connectedEntity.is_crafting() then
		signals[signalIndex] = {index = signalIndex, signal = {type = "virtual",name = "detect-in-use"}, count = 1 }
		signalIndex = signalIndex+1
	end
  end
Reason, explanation and usage

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.2

Post by Optera »

Why settle for just is_crafting when I could instead check crafting_progress.
To be useful it will have to display the percentage it's currently working on instead of how much it has completed. 0%-1% = 1, 99%-100% = 100

PS:
I currently use a a slight variation of this linear Kovarex design.

User avatar
ZlovreD
Fast Inserter
Fast Inserter
Posts: 112
Joined: Thu Apr 06, 2017 1:07 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.2

Post by ZlovreD »

Optera wrote:Why settle for just is_crafting when I could instead check crafting_progress.
To be useful it will have to display the percentage it's currently working on instead of how much it has completed. 0%-1% = 1, 99%-100% = 100
Not yet tested, but i'm assuming 100% keeps until assembler unfinished unloading? But yeah, it's may be usefull.
Optera wrote:PS:
I currently use a a slight variation of this linear Kovarex design.
Cuz donut shape allow me to check amount of 238 and split off 235 from circulation only if i have at least double amount of it to run kovarex process.

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.3

Post by Optera »

Done adding crafting progress.
A better icon would be appreciated.

I also rewrote a good chunk of inventory detection so it will work with modded creations like nuclear fuel powered furnaces with burnt results.

Edit: The mod portal is messed up again, you can download it on Github.

User avatar
ZlovreD
Fast Inserter
Fast Inserter
Posts: 112
Joined: Thu Apr 06, 2017 1:07 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.3

Post by ZlovreD »

Optera wrote:Done adding crafting progress.
Sweet.. 8-)
Optera wrote:A better icon would be appreciated.
Pick any (clickable):
ImageImageImageImage
ImageImageImageImage
ImageImageImageImage

PS: And Dont forget to set [.icon_size = 64] like you did for LTN tech icon ;)

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.3

Post by Optera »

ZlovreD wrote:
Optera wrote:Done adding crafting progress.
Sweet.. 8-)
Optera wrote:A better icon would be appreciated.
Pick any (clickable):
ImageImageImageImage
ImageImageImageImage
ImageImageImageImage

PS: And Dont forget to set [.icon_size = 64] like you did for LTN tech icon ;)
Those gears would be fine for the crafting signal. However I'm looking for an icon for progress signal. preferably matching the temperature icon.

User avatar
ZlovreD
Fast Inserter
Fast Inserter
Posts: 112
Joined: Thu Apr 06, 2017 1:07 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.4.3

Post by ZlovreD »

Optera wrote:Those gears would be fine for the crafting signal. However I'm looking for an icon for progress signal. preferably matching the temperature icon.
Last chance: :D
Image

Btw you can go further and improve it by adding check for "entity.get_output_inventory().is_empty()" like in Bottleneck to maintain sending 100% signal.
Also can be added signal for bonus progress "entity.bonus_progress".

Post Reply

Return to “Mods”

Who is online

Users browsing this forum: Bearham, steinerrr