[MOD 1.1] Inventory Sensor

Topics and discussion about specific mods
Post Reply
runamucker
Inserter
Inserter
Posts: 23
Joined: Tue Nov 07, 2017 8:35 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by runamucker »

Optera wrote:This is by design. To work with manual trains and cars IS has to constantly scan for these vehicles. Doing so every tick would utterly tank performance so it's set to only scan every 2s. Automatic mode trains and static entities are handled instantly through events.
If you feel 2s is too slow you can change it in Options - Map Settings - Entity scan interval.

However for refueling locomotives even 10s would fast enough. Wire the inserter directly to IS and set it to stack size = 1; active if locomotive detected > 0.
The inserter will only start working after is found a locomotive and will never get stuck holding items it couldn't insert.

In the first problem, I'm talking about automatic trains not being handled instantly. It's only a couple seconds after they arrive that the sensor detects them. It doesn't appear to be reading the arrival of automatic locomotives from events.

And Problem 2? After a manual train has left the station, the train is still detected as being in the station until some other vehicle passes in front of it, as in the screenshot, taken about a minute after the train left the station. The desired behaviour is that IS has no output signal two seconds after the train leaves, but the output persists as if the train is still there.

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by Optera »

Like I said vehicles are cleared and re-scanned every scan interval.
Trains are removed every update interval when their state changes to any state other than wait_station, wait_signal or manual.

The only explanation for your effects is setting very long update and scan intervals.

runamucker
Inserter
Inserter
Posts: 23
Joined: Tue Nov 07, 2017 8:35 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by runamucker »

Optera wrote:Like I said vehicles are cleared and re-scanned every scan interval.
Trains are removed every update interval when their state changes to any state other than wait_station, wait_signal or manual.

The only explanation for your effects is setting very long update and scan intervals.

So for the first problem, to be clear, you intend that both automatic and manual trains arriving at a station should expect up to a 2 second delay in identification? If so, OK.

For the second problem, I'm using the default settings for the mod -- haven't touched anything. An IS object takes up to 2 seconds to identify all types of trains (both automatic and manual), and it insists that all manual trains are identified as still in front of the IS indefinitely long after they leave the station while the scan interval is still at default. I wouldn't mention it if I'd messed with the settings at all. If that's not the intended behaviour, then there's a conflict with something.

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by Optera »

The only way to reproduce your effects is to have insane high intervals set. I don't know if you, your friends in MP or some factorio glitch set those and frankly I don't care.
Reset mod settings to default while effected saves are loaded and IS will again work again.

runamucker
Inserter
Inserter
Posts: 23
Joined: Tue Nov 07, 2017 8:35 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by runamucker »

Optera wrote:The only way to reproduce your effects is to have insane high intervals set. I don't know if you, your friends in MP or some factorio glitch set those and frankly I don't care.
Reset mod settings to default while effected saves are loaded and IS will again work again.
I reset the mod settings. It still doesn't work. I don't play MP.

When the settings are wrong, all vehicles passing in front of it would cause this problem. But this only happens with manual trains. Not automatic trains, not cars, not tanks. So it's not about the scan interval settings.

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by Optera »

Please attach the save file where this happens.
Preferably without any mod except IS.

runamucker
Inserter
Inserter
Posts: 23
Joined: Tue Nov 07, 2017 8:35 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by runamucker »

Optera wrote:Please attach the save file where this happens.
Preferably without any mod except IS.
Here. There's an IS at each platform.
Attachments
Glitch.zip
(10.84 MiB) Downloaded 122 times

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by Optera »

Fixed in 1.5.3.
Seems like I removed some code a while ago and never noticed manual trains no longer reset connection properly. :oops:

runamucker
Inserter
Inserter
Posts: 23
Joined: Tue Nov 07, 2017 8:35 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by runamucker »

Optera wrote:Fixed in 1.5.3.
Seems like I removed some code a while ago and never noticed manual trains no longer reset connection properly. :oops:
yw

Jürgen Erhard
Filter Inserter
Filter Inserter
Posts: 298
Joined: Sun Jun 12, 2016 11:29 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.2

Post by Jürgen Erhard »

And that fix broke it.

Loaded (very modded) save file. Didn't notice anything at first, I was busy building coal liquefaction. After I'm done, I… notice everything stopped in the refinery. No iron got produced. Huh? Check, check… oh, but there are iron trains in the waiting area. They are let through to the ore unloading stations when the ISes detect the ores that are currently requested. But the ISes only detected the cargo wagons, and no ore.

Trains are all auto.

Went back to 1.5.2, and everything works again. Classic regression.

Nope, never touched the settings.

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

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.4

Post by Optera »

Jürgen Erhard wrote:And that fix broke it.

Classic regression.
Classic coding while drunk/tired.

Fixed in 1.5.4

Kamuchi
Inserter
Inserter
Posts: 20
Joined: Thu Aug 10, 2017 4:32 pm
Contact:

Re: [MOD 0.14/0.15] Inventory Sensor 1.5.4

Post by Kamuchi »

Thanks Optera for this little tiny quality of life mod, was pulling my hair out for awhile untill remembering you made this :lol:
The train blueprint

abordoli
Fast Inserter
Fast Inserter
Posts: 131
Joined: Thu May 25, 2017 1:19 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.2

Post by abordoli »

Great mod!

Can this be used to sense the inventory inside labs? (including burner labs)/

Regards,
~B

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

Re: [MOD 0.16] Inventory Sensor 1.6.2

Post by Optera »

If labs are special assemblers it will work with the current version, otherwise I'd have to include their entity type to scan targets.

Edit:
Added Lab inventory and Research progress to 1.6.3.

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by Ironhair »

Does this read the contents of train fuel?

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

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by Optera »

Ironhair wrote:Does this read the contents of train fuel?
Items in burner input and output slots yes, fuel bar no.

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by Ironhair »

Optera wrote:
Ironhair wrote:Does this read the contents of train fuel?
Items in burner input and output slots yes, fuel bar no.
Thank you for the very very quick reply.

Was hoping to limit loading solid fuel only in 1 slot, coal in other 2... while using big bags.
Didn't want to have my 2 loco trains with 3k solid fuel !! :(

Ironhair
Long Handed Inserter
Long Handed Inserter
Posts: 53
Joined: Tue Apr 12, 2016 5:39 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by Ironhair »

Optera wrote:
Ironhair wrote:Does this read the contents of train fuel?
Items in burner input and output slots yes, fuel bar no.
Just to confirm, can I use this mod to limit how much solid fuel or rocket fuel I'm loading in a locomotive?

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

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by Optera »

Ironhair wrote:Was hoping to limit loading solid fuel only in 1 slot, coal in other 2... while using big bags.
Didn't want to have my 2 loco trains with 3k solid fuel !! :(
That'd require a fair bit of circuit trickery and a filter inserter to get around some game mechanics.

You want the solid fuel in the first (leftmost) slot of the loco.
Inserters will always pick up coal before solid fuel due to how item array is sorted internally.

That means you have to build a circuit with IS that acts like this:

Code: Select all

IF InventorySensor reads Locomotive Detected THEN
  IF InventorySensor reads < 50 Solid Fuel THEN 
     output = solid fuel
  ELSE IF InventorySensor reads solid fuel >= 50 AND coal < 100 THEN
     output = coal
  END
END
If you drop the coal requirement it's as simple as hooking up an inserter to IS and set the inserter to only work if Solid Fuel < 50.
Note: this will also fill cargo wagons so at least a combinator checking for Locomotive Detected & Solid Fuel < 50 is recommended.

mrvn
Smart Inserter
Smart Inserter
Posts: 5682
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [MOD 0.16] Inventory Sensor 1.6.3

Post by mrvn »

Optera wrote:
Ironhair wrote:Was hoping to limit loading solid fuel only in 1 slot, coal in other 2... while using big bags.
Didn't want to have my 2 loco trains with 3k solid fuel !! :(
That'd require a fair bit of circuit trickery and a filter inserter to get around some game mechanics.

You want the solid fuel in the first (leftmost) slot of the loco.
Inserters will always pick up coal before solid fuel due to how item array is sorted internally.

That means you have to build a circuit with IS that acts like this:

Code: Select all

IF InventorySensor reads Locomotive Detected THEN
  IF InventorySensor reads < 50 Solid Fuel THEN 
     output = solid fuel
  ELSE IF InventorySensor reads solid fuel >= 50 AND coal < 100 THEN
     output = coal
  END
END
If you drop the coal requirement it's as simple as hooking up an inserter to IS and set the inserter to only work if Solid Fuel < 50.
Note: this will also fill cargo wagons so at least a combinator checking for Locomotive Detected & Solid Fuel < 50 is recommended.
"IF InventorySensor reads solid fuel >= 50" is redundant.

Post Reply

Return to “Mods”