[MOD 0.12.x] Logistic Combinators

Changing/adding/removing one thing of the game. Doesn't break the game completely, if mod is removed.

[MOD 0.12.x] Logistic Combinators

Postby GopherAtl » Mon Aug 10, 2015 6:53 pm

Logistic Combinators

Image

Info:
Adds a variant of the constant combinator; instead of outputing constants you specify, though, it takes the types you specify and gets the values from the local logistics network, allowing you to build combinator and other circuit network systems that use data from the logistics network.


License
License
Copyright (c) 2016 GopherAtl, Choumiko, narc0tiq, matepeter90

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Long Description
Long Description
Ever wished you could feed logistic network counts into combinators? With Logistic Combinators, you can. Just open the gui and select the signals you want - up to 15 each - and wire them up, and they will automatically set their output counts to the corresponding value from logistics!

They are crafted in .5s, and cost 5 copper wire, 5 electronic circuits, and 1 advanced circuit.

The quantities input in the gui don't matter - they'll be thrown away and replaced with the current counts on the logistic network as soon as you close the gui. All that matters is the types you've selected.

unlocked when you research Logistics Robots, so once you've got bots flying around hauling things for you, you will have these as well.


Pictures
Pictures
Image
ImageImage



Version history
Version history
  • 0.1.1 2015-8-13: no longer gives silly numbers for invalid signal types (fluids & abstracts) which the logistics network doesn't support currently
  • 0.1.0 2015-8-9: Initial version released into wild for testing by people-who-aren't-me


Config Settings
Config Settings
Only the one - logistic_polling_rate. Defaults to 5, this sets the frequency (in times per second) that the combinator will poll the logistics network and update it's output value.

This is just me being cautious - the trick I use to get values from the logistics network feels dirty, and the idea of doing it every cycle in on_tick for up to 15 different items, times however many logistic combinators you might set up, seems extreme. I may change the default later, making it faster or slower, depending on how it seems to perform in real-world use. In the mean time, you're welcome to change it locally to 60 (so it updates continuously, every tick) or lower, depending on your needs; if you're just displaying the count, it shouldn't matter, but if it's being used in combinator logic faster refresh may be desired or necessary.

tl;dr: if you don't notice or mind the delay in updating, you don't need to change this.


Use in Mod Packs
Use in Mod Packs
Go ahead. You don't need to ask. You're free to include it in any mod pack either as-is, or with changed recipes/graphics, or whatever. Comments to this thread linking the mod pack are encouraged/appreciated, as it helps me keep track of who's using the mod, but that's it.

If it is allowed to become outdated, anyone who is willing is invited to maintain and release updates.


post format notes
Hopefully the format is satisfactory, if any automatic parsing systems have a problem with anything let me know.
Last edited by GopherAtl on Mon Apr 04, 2016 3:03 pm, edited 7 times in total.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby CrispyOMNOMS » Mon Aug 10, 2015 7:07 pm

This is great for my latest multi-functioning furnace setup, I had to wire every single logic chest to every single smart inserter to every single power pole just to us my own combinatory logic with robots. This will cut down on the fiddly wire placement ten fold!

EDIT: I can't seem to get the download url to work, do I need to do anything more than just click on it?

EDIT 2: Downloaded it from the web link. :)
Last edited by CrispyOMNOMS on Mon Aug 10, 2015 7:22 pm, edited 2 times in total.
CrispyOMNOMS
Burner Inserter
Burner Inserter
 
Posts: 5
Joined: Sat Aug 01, 2015 1:21 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Mon Aug 10, 2015 7:09 pm

CrispyOMNOMS wrote:This is great for my latest multi-functioning furnace setup, I had to wire every single logic chest to every single smart inserter to every single power pole just to us my own combinatory logic with robots. This will cut down on the fiddly wire placement ten fold!

that's the idea :) You're hardly alone, I see people every day, here and on reddit, surprised and sad to learn they can't use logistic network values directly in combinators, so I made a thing, and now they can (if they install the mod)
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Mon Aug 10, 2015 9:48 pm

Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Mon Aug 10, 2015 9:52 pm

DOSorDIE wrote:Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!



hmm. maybe? it'd be a completely different method under the hood, but I dunno any reason it wouldn't be doable. I will look into it, it is a good thought. I don't think logistics or construction robots are assigned to any roboport when active, only when idle and possibly when charging, so it might be expensive to be doing the checks constantly for how many robot entities are within the entire logistics area, though, particularly with many people's tendency to have thousands of them. So not sure it would be practical, could be a performance hit.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Mon Aug 10, 2015 10:55 pm

GopherAtl wrote:
DOSorDIE wrote:Great MOD!

Is it possible to make one who show in a chest the aktiv robots (flying and that in the Roboport)?
I want to know and controll how many i have.
So i can make a chest with robots and when <100 then put some in the Roboport.
That would be great!



hmm. maybe? it'd be a completely different method under the hood, but I dunno any reason it wouldn't be doable. I will look into it, it is a good thought. I don't think logistics or construction robots are assigned to any roboport when active, only when idle and possibly when charging, so it might be expensive to be doing the checks constantly for how many robot entities are within the entire logistics area, though, particularly with many people's tendency to have thousands of them. So not sure it would be practical, could be a performance hit.


That would be great when you look at it.
Maybe this helps
viewtopic.php?f=96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Mon Aug 10, 2015 11:31 pm

DOSorDIE wrote:That would be great when you look at it.
Maybe this helps
viewtopic.php?f=96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.


At a glance, it doesn't so much help as confirm my concerns about the performance! Active ones - ones that are currently flying about - are the expensive ones, it should be fairly cheap to find the count sitting idle in roboports. His is, admittedly, searching the entire world, apparently, but still, he says it takes it several seconds - completely freezing the game - to get the count. Even if I check 1/1000th the area, something that takes just milliseconds is just not something I can be doing in on_tick. An entire game cycle has to run in just 16 milliseconds, after all!
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DaCyclops » Tue Aug 11, 2015 7:07 am

DOSorDIE wrote:That would be great when you look at it.
Maybe this helps
viewtopic.php?f=96&t=13855
But i need it only for the aktiv Logistic System ... not all.
For my outposts i make the same and deliver robot when they need.


Well how about that, your asking the exact same things I was asking Gopher :D

From what Gopher confirms, the LUA just doesnt have a way of reading the current robot status from a logistics network (and from what my investigation has revealed, there is no LUA scripting access to Logistics Networks as a whole....). so to even calculate it, would require calculating the robots around each roboport and inside each roboport. which would be inaccurate the moment two roboports are placed within 50 squares of each other....

Im having some thoughts on if its possible to approximate the figure for the current Logi network, without killing the game every second.
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
 
Posts: 78
Joined: Mon Aug 25, 2014 12:37 am

Re: [Mod 0.12.x] Logistic Combinators

Postby Neotix » Tue Aug 11, 2015 7:31 am

If we put 2 or more Logistic Combinators in the same Logistic Network, and we connect them together, we will get multiplied values? Or there is some code to detect how many Logistic Combinators is in network and always show proper values?
Neotix
Filter Inserter
Filter Inserter
 
Posts: 629
Joined: Sat Nov 23, 2013 9:56 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Tue Aug 11, 2015 8:47 am

GopherAtl wrote:At a glance, it doesn't so much help as confirm my concerns about the performance! Active ones - ones that are currently flying about - are the expensive ones, it should be fairly cheap to find the count sitting idle in roboports. His is, admittedly, searching the entire world, apparently, but still, he says it takes it several seconds - completely freezing the game - to get the count. Even if I check 1/1000th the area, something that takes just milliseconds is just not something I can be doing in on_tick. An entire game cycle has to run in just 16 milliseconds, after all!


Why we do split the script that it need longer ... it dont need a update each seconds.
Make a internal database where the roboports are so we dont need to search each time.
The distance to search the next roboport is fixed but we need only all from the same logisic system.
So its easy to search from the exists roboport for new ones.

Ask all roboport (we known now its position) so its easy do a script.
And its enough to do this all x seconds todo not makeing heavy load.

EDIT:
Plan B:
Make a "Marker chest" who is need next to all Roboport i want to control (So searching for all/new Roboports is not needed)
All Marker Chest make a query of the roboport next to it (flying and in the Roboport)
and that is show in the "Output chest" like the Logistic Combinator.
For the outpost make a "Outpost chest" that only count the Roboport next to it.
Last edited by DOSorDIE on Tue Aug 11, 2015 10:36 am, edited 1 time in total.
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby vampiricdust » Tue Aug 11, 2015 9:36 am

Absolutely fantastic mod! GopherAtl you are awesome. This is a huge leap for circuit networks, finally we can use circuit logic with logistic values. I can't tell you how many times I have been playing with combinators and wished I could do this.

I'm so going to a lot of time getting to know your creation & how to abuse it.
Combinator Tutorial Part 1 - Some info & uses.
Biter Park - Building some enclosures to study & build attractions with.
Orders Up! - Place an order for goods, now taking .12 orders!
X-Perimental - and base building with combinators!
Pocket Bot Start
User avatar
vampiricdust
Filter Inserter
Filter Inserter
 
Posts: 260
Joined: Wed Jan 14, 2015 1:31 am

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Tue Aug 11, 2015 12:31 pm

DOSorDIE wrote:All Marker Chest make a query of the roboport next to it (flying and in the Roboport)
and that is show in the "Output chest" like the Logistic Combinator.
For the outpost make a "Outpost chest" that only count the Roboport next to it.



The flying ones are the problem. If the roboport even has this information, it doesn't seem to make it available in any way, so knowing where the roboports are only lets me determine the area to be searched for all entities of the type "robot." Have you seen how many roboports people use? dozens, hundreds, all overlapping, with thousands and thousands of robots? That is the problem. I could probably put something together that wouldn't be too bad if used with moderation in worlds with smaller roboport setups, but I have no control over how people use my mod, and the people with the most heavy logistics robot use would be the people who most want this kind of functionality!

I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry :(



Thanks to everyone for the interest and feedback. Please share any contraptions you make with these, as that's the best part of making mods in the first place!
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Tue Aug 11, 2015 12:44 pm

GopherAtl wrote:I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry


But is it possible to make the "Outpost Chest"?
I need to check the robots of my outposts ... so it mostly only 1 Roboport for me.
That would help a lot.
Please :roll:
When i know how i write it by myself ... but im not a Master in LUA.
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DaCyclops » Tue Aug 11, 2015 1:23 pm

DOSorDIE wrote:
GopherAtl wrote:I won't be distributing a mod that I wouldn't recommend people use, and unless some fundamentally different way to determine the active bot count is found, this falls firmly in that set. Sorry


But is it possible to make the "Outpost Chest"?
I need to check the robots of my outposts ... so it mostly only 1 Roboport for me.
That would help a lot.
Please :roll:
When i know how i write it by myself ... but im not a Master in LUA.


im gonna have a play with having it recursive read the roboports into an array when placed, and then monitor the array's inventory contents (adding new roboports when placed near an existing array). Idle count is better than no count. May also have it give an "average" over the last half a minute or so, as a "Estimated Total".

My plan was always reading all those into their own unique Signals, Idle Construction, Idle Logistics, Total Construction, Total Logistics (the count for Totals being tagged with "Estimate" unless we can get a better figure through an LUA interface). Might get laggy on ultra-big builds (heres looking at you DemonEngineer) but may be 'light' enough not to bog down the tickrate on normal builds, especially if it is working from a list as opposed to checking for roboports every time (might also make it only do its maths every 5 seconds.)
User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
 
Posts: 78
Joined: Mon Aug 25, 2014 12:37 am

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Thu Aug 13, 2015 9:25 am

Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Thu Aug 13, 2015 11:37 am

DOSorDIE wrote:Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647


Really? Thanks for reporting. I've got a meeting this morning for work, but I'll look into this and see about getting a fix out after lunch. Off the top of my head, I have no idea what might be causing this...
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby DOSorDIE » Thu Aug 13, 2015 1:34 pm

GopherAtl wrote:
DOSorDIE wrote:Found a bug
When i choose Oil, Heavy Oil, Light Oil, Petroleum, Acid, ... he always write 2147483647


Really? Thanks for reporting. I've got a meeting this morning for work, but I'll look into this and see about getting a fix out after lunch. Off the top of my head, I have no idea what might be causing this...


No need to hurry ... found a workaround.
I connected the Tank directy and then it worked.

Because the Roboport:
A friend of mine make for me the Outpost Chest.
So no need to make one ...
But you can look if the for the logistic system get to run (if you want).
DOSorDIE
Fast Inserter
Fast Inserter
 
Posts: 242
Joined: Sat Oct 11, 2014 3:43 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Thu Aug 13, 2015 3:29 pm

just did a test setup and it seems like this isn't my mod; smart inserters with a logistics condition involving crude oil don't function at all, the condition is apparently always false - tested with crude oil <, =, and > 0, and in all cases the inserter did nothing. Other fluids are likely the same. circuit network conditions work, as you found hooking directly to the tanks, but at present it seems the logistic network either doesn't track fluids, or doesn't test them properly in conditions.

:edit: passed this bug up, since it's if anything an inconsistent, or at least unexpected, behavior of the conditions on the logistics network - though not entirely inconsistent really (see my bug report post for details) Depending on the response there, I may update in the next version to just ignore, effectively outputting 0, for all signals of type "fluid."
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [Mod 0.12.x] Logistic Combinators

Postby GopherAtl » Thu Aug 13, 2015 6:51 pm

Release 0.1.1 out now (link)

Only one minor bug fix, signal types that are, for the logistics network, currently invalid (fluids and abstracts) no longer output MAX_INT, instead they output 0, and without all that time wasted trying to get their actual value (which does not exist)
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
GopherAtl
Fast Inserter
Fast Inserter
 
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm

Re: [MOD 0.12.x] Logistic Combinators

Postby vampiricdust » Sat Aug 22, 2015 12:53 pm

One thing to be mindful is negative numbers. Since the logistic bots will try to carry max load, this does cause the numbers to spike into negatives. If you're doing any arithmetic on the data, it can cause unintended behaviors. A simple decider combinator to ensure a non negative number can filter them.

Really love your mod sir. I find it more useful every night I play now.
Combinator Tutorial Part 1 - Some info & uses.
Biter Park - Building some enclosures to study & build attractions with.
Orders Up! - Place an order for goods, now taking .12 orders!
X-Perimental - and base building with combinators!
Pocket Bot Start
User avatar
vampiricdust
Filter Inserter
Filter Inserter
 
Posts: 260
Joined: Wed Jan 14, 2015 1:31 am

Next

Return to New Items, Entities, Extensions

Who is online

Users browsing this forum: No registered users and 9 guests