[MOD 0.12.x] Smarter Circuitry

Topics and discussion about specific mods
Post Reply
Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

[MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

Smarter Circuitry
Pic
Info:
  • Adds a few new structures that allow for more precise manipulation and control of factory automation.
  • Name: Smarter Circuitry
  • Latest Release: v0.4.9, 25 October 2015 (facorio version at the time: 0.12.14)
  • Older Releases: Find the SHA of the specific version and replace the 'master' in the download url below with that SHA
  • Download: Github Zip package (Each new structure is its own mod, so you must extract them)
  • License: The Unlicense (Public domain http://unlicense.org)
  • Tags: Circuit network, Electric network, Logistics network
  • Author: Kikkers


This mod is the successor to Smart Circuit Systems, with some functionality removed (because of obsoletion) or merged into other structures, and of course some new bits. As before, I'm hoping eventually all objects in this mod will be replaced with equivalent vanilla ones, but that might still take a while. Note that this mod actually consists of several smaller mods for purposes of maintainability. You can pick some and omit others, because there is no cross-dependency between them, but I recommend just picking all because you're probably going to use them together (at least until vanilla replacements are here).
Long Description
Examples
Changelog
If you find any bugs, have any suggestions, or know of any other interesting uses for the mod, you can leave them in this thread.

Some specific suggestions I'm actively looking for is entity type specific behaviors (for the actuator or sensor). As I've manually added behavior for some specific types, there might be some types I forgot about.
Last edited by Kikkers on Sun Oct 25, 2015 11:30 am, edited 18 times in total.

Darloth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Darloth »

Is it possible for you to add a pressure pad, please?

Emits a (configurable) signal when an entity is on top of it, otherwise doesn't.

Entities would include players, biters and cars... maybe trains? not sure if that's possible. I wouldn't care either way about trains on pressure pads (we have other sensors for trains in here, yay) but some people might.

A mechanical switch (rightclick to toggle between emitting a signal or not) would also be useful, but probably more difficult, and I have no idea how you'd configure which signal it would emit.

Edit: Oh, oh - attaching a sensor to a mining drill should emit the amount and type of expected remaining resources!

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by GopherAtl »

ooh, this sounds nice, I will have to play with these a bit later on.

re: pressure plates, definitely possible, did a simple proof-of-concept last night in the console. Hopefully someone else will make them soon - Too many mod ideas, not enough time XD - but if nobody beats me to it, I'll make my own eventually. Smart Mining Drill is definitely also doable and a good idea, I will add that to my candidate list as well if Kikkers' (or anyone else) doesn't do it first.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

Darloth wrote:... maybe trains?
Trains in motion can already be detected using the sensor btw, just place it pointing to the tracks.
Darloth wrote:A mechanical switch
Could be worth looking at the switch mod form 0.11.x, that'll probably still work with minor changes. I personally dislike its graphics, so I never used it.
Darloth wrote:Is it possible for you to add a pressure pad, please?
GopherAtl wrote:re: pressure plates, definitely possible
What size of pressure pad would be practical? Also, I think I'd prefer a perimeter sensor instead (with the same functionality), having a non-collidable entity seems cheaty to me.
Darloth wrote:Oh, oh - attaching a sensor to a mining drill should emit the amount and type of expected remaining resources!
I'm hoping there's a simple method to get this information from a mining drill type entity, as I don't feel that a piece of code that keeps track of individual pieces of ore is fun to write.

Thanks for the ideas guys. I think that the pressure pad or perimeter sensor seems like the most necessary addition, so I might look into that in the coming days.

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by GopherAtl »

Kikkers wrote:I'm hoping there's a simple method to get this information from a mining drill type entity, as I don't feel that a piece of code that keeps track of individual pieces of ore is fun to write.
Ooh, I didn't think that far into it, just poked one with a stick and if that info is available, I couldn't find it. Code wouldn't be too bad, though, and it wouldn't have to poll them too frequently, so shouldn't be a performance concern, either.


re: pressure plate, if you don't like it being non-collidable, just make it collide in the item layer, and occupy one tile. So you can't belt over it, or build most things over it, but you can walk/drive over it (and set it off). There's something to be said for both a pressure plate - which is visually distinct, and you know you're stepping on it - versus proximity detection, where it is less obvious. Both would have their uses.
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

GopherAtl wrote:Ooh, I didn't think that far into it, just poked one with a stick and if that info is available, I couldn't find it. Code wouldn't be too bad, though, and it wouldn't have to poll them too frequently, so shouldn't be a performance concern, either.
Any idea if it's possible then to get the mining area used by the drill? Isn't that stored in the entity prototype?

GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by GopherAtl »

hmm. Probably not; easy enough to just guess with vanilla, though. If you were thinking of making a sensor object placed by the mine, you'd have to support any other mods' mines specifically. I was picturing it being a "smart mining drill" object that was directly circuit-connectable, which would also require specific support for other mods' drills, but that would kind of go without saying in that case.

:edit: I was derping there, just remembered, yes, you absolutely can access prototypes at run-time, some of my utility console functions do it. So a sensor-object version could pull the area from anything, if the area is indeed in the prototype (and if it's not, it's probably hard-coded and you can assume burner mine = 2x2, electric=5x5)
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections

therapist
Fast Inserter
Fast Inserter
Posts: 177
Joined: Tue May 27, 2014 7:22 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by therapist »

THANK YOU!!!!!!!!!!

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

There, we have a pressure plate. Hopefully it doesn't produce critical bugs, but we'll see. Keep your autosave engaged just in case.

Darloth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Darloth »

Thankyou!

That said, it doesn't seem to be in the linked zip, and I can't see it in your github repo anywhere. I'm assuming it's going to be its own micromod like the others, or in sensor, but I can't find it.

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

Derp, forgot to push.

Darloth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Sun Jun 08, 2014 3:57 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Darloth »

Actuator in the folder 4.2 has the info saying it's 4.0

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

I messed up again. It -should- work now...

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

GopherAtl wrote:hmm. Probably not; easy enough to just guess with vanilla, though. If you were thinking of making a sensor object placed by the mine, you'd have to support any other mods' mines specifically. I was picturing it being a "smart mining drill" object that was directly circuit-connectable, which would also require specific support for other mods' drills, but that would kind of go without saying in that case.

:edit: I was derping there, just remembered, yes, you absolutely can access prototypes at run-time, some of my utility console functions do it. So a sensor-object version could pull the area from anything, if the area is indeed in the prototype (and if it's not, it's probably hard-coded and you can assume burner mine = 2x2, electric=5x5)
I looked into this a bit. It seems that entity prototypes at runtime don't have all the information available that you can find in the prototype lua files. The value we would need for mining drills is the 'resource_searching_radius' field, which does not seem to be available at runtime. If that's the case, it's not currently possible to fetch remaining resources in the way that I would prefer (without hardcoding per specific mining drill object, including those added by other mods).

SirRichie
Fast Inserter
Fast Inserter
Posts: 244
Joined: Wed Feb 25, 2015 4:50 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by SirRichie »

I have not tried this and do not know of the top of my head if this is possible, but here is an idea:

in data.lua (or its variants), you can walk through all mini drills and there you have access to the mining radius. You could build a lookup table there, which you store in a global variable (not sure if you have access to global in data.lua).
You could then use this lookup table in the control.lua part.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Choumiko »

Kikkers wrote:I looked into this a bit. It seems that entity prototypes at runtime don't have all the information available that you can find in the prototype lua files. The value we would need for mining drills is the 'resource_searching_radius' field, which does not seem to be available at runtime. If that's the case, it's not currently possible to fetch remaining resources in the way that I would prefer (without hardcoding per specific mining drill object, including those added by other mods).
You could work around that by using a data-final-fixes. Loop through all entites of type mining drill, for each one create a dummy recipe/item/technology/whatever (i believe technologies can be completely hidden ingame using .enabled = false). Set the name to that of the drill and a value that's readable at runtime to the searching radius. Ugly but it could work?

Edit: nearly ninja'd
SirRichie wrote:which you store in a global variable (not sure if you have access to global in data.lua)
There's no global in data.lua

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

Thanks for the ideas, this actually seems to work. I've added them to 4.4

The final solution was to store the resource_searching_radius in a dummy technology's time cost, which is actually accessible through a force's technology list as the research_unit_unergy field (multiplied by 60 due to ticks).

aklesey1
Smart Inserter
Smart Inserter
Posts: 1862
Joined: Sun May 18, 2014 3:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by aklesey1 »

How to use pressure floor? and how to remove it?
Nickname on ModPortal - Naron79

Kikkers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sun Jun 22, 2014 8:45 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Kikkers »

aklesey1 wrote:How to use pressure floor? and how to remove it?
Did you have trouble under standing the "long description" in the top post? I might need to make that a bit clearer if you do.

billw
Long Handed Inserter
Long Handed Inserter
Posts: 67
Joined: Tue May 27, 2014 10:27 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by billw »

Hey if this can detect number of robots in a roboport then it solves the issue of resupplying a limited number of construction bots to outposts and you are my hero.
I'm going to test tonight and report back, but if it doesn't then consider this a suggestion!

Post Reply

Return to “Mods”