Updating Smart Circuit Systems for 0.12

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

Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Notice: I've made an official release of this mod, calling it Smarter Circuitry. You can find it here: https://forums.factorio.com/forum/vie ... 91&t=14824



Hi guys,

Seeing as there was some enthusiasm for the mod that added toggleable switches, actuators and sensors, I thought I should make an attempt to make an update for it. Though I mentioned that mod was abandoned, the status quo has changed (I graduated, woohoo).

Contains the following:
  • Adds a sensor that can detect the contents of a bunch of items, like chests, vehicles(trains, cars), assemblers, furnaces, etc.
  • Adds an actuator, a device that can toggle the activity of numerous objects like trains, assemblers, belts (which are flipped rather than disabled), etc.
  • Adds an electric switch which can connect and disconnect parts of the factory
I'm going to keep it at three separate mods, as it's easier to maintain.

I again tried to produce suitable graphics (reusing where I can).

Still will be testing a bit on this, if anyone is willing to help test, that'd be grrreat. Most likely the actuator has the most bug potential

Here's a temporary link -removed-. I'll host it on github once we consider it stable


List of specific uses for this mod (let me know of any others, this will help creating a detailed description):
  • Remotely or automatically switch off parts of the factory (electric switch), depending on current accumulator charge (sensor on an accumulator)
  • Start backup power by connecting steam engines back on the network (electric switch), depending on accumulator charge (sensor on an accumulator)
  • Set a train schedule to wait at stations for 0 seconds, and instead only allow it to leave once it's full or empty (sensor on cargo wagons, actuator somewhere on the train, normal combinators to determine the correct condition for the actuator)
  • Don't fill up a locomotive completely by checking how much fuel it has already (sensor on the locomotive)
  • Lock your doors (actuator on a gate)
  • Disable or enable groups of turrets depending on if an attack is happening (sensor on a single laser turret, energy fluctuates when it's shooting)
Last edited by Kikkers on Thu Aug 13, 2015 4:39 pm, edited 3 times in total.

User avatar
HeilTec
Filter Inserter
Filter Inserter
Posts: 258
Joined: Tue Jul 08, 2014 1:14 pm
Contact:

Re: Updating Smart Circuit Systems for 0.12

Post by HeilTec »

Giving it a spin ... we all expect much of the 013 but can't wait.
Google is my friend. Searching the forum and the wiki is always a first.

User avatar
HeilTec
Filter Inserter
Filter Inserter
Posts: 258
Joined: Tue Jul 08, 2014 1:14 pm
Contact:

Re: Updating Smart Circuit Systems for 0.12

Post by HeilTec »

Thank you Kikkers for keeping this alive.

I seem to have trouble locating the Electric switch in both science and crafting.

Unknown key:
IMG
Hope this helps.
Google is my friend. Searching the forum and the wiki is always a first.

User avatar
HeilTec
Filter Inserter
Filter Inserter
Posts: 258
Joined: Tue Jul 08, 2014 1:14 pm
Contact:

Re: Updating Smart Circuit Systems for 0.12

Post by HeilTec »

Testing some more reveals that
1) If research was done before mod is installed item does not show up.
2) Research done after mod installation allows crafting and placing.

Electric switch tests ok when above is done.
Google is my friend. Searching the forum and the wiki is always a first.

User avatar
HeilTec
Filter Inserter
Filter Inserter
Posts: 258
Joined: Tue Jul 08, 2014 1:14 pm
Contact:

Re: Updating Smart Circuit Systems for 0.12

Post by HeilTec »

I looked a bit into migration script and - voila - there it was.

I managed to create the needed scripts - Enabling new recipes.
https://www.dropbox.com/s/ubc7ma6iwt5uc ... 0.zip?dl=0
Google is my friend. Searching the forum and the wiki is always a first.

User avatar
HeilTec
Filter Inserter
Filter Inserter
Posts: 258
Joined: Tue Jul 08, 2014 1:14 pm
Contact:

Re: Updating Smart Circuit Systems for 0.12

Post by HeilTec »

Missing event handler.

1) Place car in front of sensor.
2) Fuel car
3) Mine car with fuel.

Sensor still shows fuel.
Google is my friend. Searching the forum and the wiki is always a first.

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

Re: Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Thanks for looking at it. That sensor showing fuel was an oversight, the sensor should always clear its output regardless of whether there is a target, and it didn't do that yet.

Also thanks for the migration code. Never really used those before, now I know what they're for.

Things I changed:
  • attempt to fix that sensor issue
  • added orange lamp for the actuator for when there isn't a target, but the wire condition is fulfilled.
  • actuators don't work on cars now (and probably tanks too), as that didn't make a lot of sense to me anymore.
Changes are in the same download link.

Right now, I'm trying to think of any entity types that the actuator should handle differently, or any entities types that the sensor could scan. If anyone has ideas, shoot.

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

Re: Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Another update, I thought it would be nice to make lockable gates. It would've been nice if we could actually open and close gates through code, but that's not an option. Instead, it locks on the state the gate is currently in.

Also made the sensor able to show that a moving train is spotted, so together with gates, you could perhaps make safer railway crossings.

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

Re: Updating Smart Circuit Systems for 0.12

Post by GopherAtl »

Kikkers wrote:Another update, I thought it would be nice to make lockable gates. It would've been nice if we could actually open and close gates through code, but that's not an option. Instead, it locks on the state the gate is currently in.

Also made the sensor able to show that a moving train is spotted, so together with gates, you could perhaps make safer railway crossings.
You can create a new force and assign the gate to that; then it'll be up to your own code to call request_to_open to keep it open, and otherwise it will close. It won't open for any entities not assigned to that force, which none will be unless you assign them. I'm not sure how frequently you have to call it, but you have to call request_to_open repeatedly, calling it once will just make it start to open, then close again, all I've tested was calling it every tick, which worked, but less frequently should as well.
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: Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Oh, interesting, I'll have to look into that.

My estimate on the main cost for the mod is calls to find_entities(_filtered), especially while they don't have a target yet and are looking for one. But I do buffer targeted entities, so that one function shouldn't have that big of an impact.

By the way, I'm not sure if there is a better way for finding a target entity. Or once you have an entity, determining if it's a supported one. Currently I'm using the entity types as table keys to type specific tickfunction table values, but as we don't seem to have integer id's, I don't think that can be improved.

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

Re: Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Gates now work far better, thanks for the tip GopherAtl !

They now open or close exclusively on a signal, and the alternative force is reset once the actuator loses the gate as a target.

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

Re: Updating Smart Circuit Systems for 0.12

Post by Kikkers »

Also just added the new version of the pulse sensor. Since we have other kinds of sensors, I just added a smaller accumulator that behaves normally, and you can attach a normal sensor to that to detect network pulses.

For all items in this mod, I think I have isolated the most critical ones. We'll see which ones get absoleted in the next major version.

Post Reply

Return to “Mods”