[MOD 0.12.x] Smarter Circuitry

Topics and discussion about specific mods
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 »

billw wrote: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!
;)
theit8514
Inserter
Inserter
Posts: 47
Joined: Sun Apr 20, 2014 2:11 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by theit8514 »

Encountered an error with the Sensor and the Rail Tanker mod. When the tanker wagon emptys out completely, the sensor crashes with: control.lua:252: Item stack count has to be a positive number.

After attempting to fix it, I also encountered a separate error in which the fluidbox existed in the array but was nil.
Code Fix
[edit]Looks like it's more than that, the Rail Tanker seems to place a hidden decorative object which doesn't get detected properly.[/edit]
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 »

I added this to an in progress MP game and can't see the sensor anywhere! What am I missing?
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 modified that fluidbox fix slightly more, but it should be stable regardless now. Also had some confusion about migration scripts, fixed that too. The sensor and actuator should appear in in-progress games again.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2174
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Ranakastrasz »

What is the filter for the directional sensor?
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
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 »

Ranakastrasz wrote:What is the filter for the directional sensor?
I'm unsure what you mean by filter?
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2174
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Ranakastrasz »

Kikkers wrote:
Ranakastrasz wrote:What is the filter for the directional sensor?
I'm unsure what you mean by filter?
Alterable setting labled filter.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
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 »

Ranakastrasz wrote:Alterable setting labled filter.
Oh, I'm guessing you mean the filter on the actuator or electric switch. Those don't do anything, but need to be there to be able to operate the underlying smart inserter when no wires are connected, or when there isn't a logistics network nearby.

I though it was more important that the player can always operate the object, so they can always see what is, or isn't connected.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2174
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Ranakastrasz »

Kikkers wrote:
Ranakastrasz wrote:Alterable setting labled filter.
Oh, I'm guessing you mean the filter on the actuator or electric switch. Those don't do anything, but need to be there to be able to operate the underlying smart inserter when no wires are connected, or when there isn't a logistics network nearby.

I though it was more important that the player can always operate the object, so they can always see what is, or isn't connected.
Ah, So that is just a side effect of the workaround.

Code: Select all

Error while running the event handler: __actuator__/control.lua.138: attempt to compare number with table
Game couldn't load with this error.
I just added an actuator and sensor net to make trains launch as soon as they load and unload.
Next time I loaded the game, it gave this error.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
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 »

Ranakastrasz wrote:

Code: Select all

Error while running the event handler: __actuator__/control.lua.138: attempt to compare number with table
Game couldn't load with this error.
I just added an actuator and sensor net to make trains launch as soon as they load and unload.
Next time I loaded the game, it gave this error.
I'm not sure what causes that, seeing that the code line mentioned doesn't point to a line that can cause that error. I know of one way that this can happen: the actuator (and sensor) maintain a copy of the function they use each tick, which could be from an old version. I thought I had some code functional that refreshes this function on game load, but apparently something's still going wrong and I'm not sure what.

Also, I tried loading your save and it did seem to work for me, though I didn't have some of the mods you're using. It could be related to that.

You could always disable the the actuator mod and load the game again if that's the cause, but they'll get removed. I'm sorry for not adequately testing for robustness, I suppose that's the cost of making it crammed with features.
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by waduk »

I accidentally put fast inserter on directional sensor, then this happen.
They pulling a virtual item.
So, i'm not sure if this a bug or how this mod work internally.

Image
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 »

waduk wrote:I accidentally put fast inserter on directional sensor, then this happen.
They pulling a virtual item.
So, i'm not sure if this a bug or how this mod work internally.
I'm aware that this is possible. The reason is that it's impossible in script to prevent an inserter from getting stuff out of a chest. The sensor is basically a hidden smart chest, so that's the problem.

The only way to prevent inserters doing this is to set the hidden chest to a different force, but this would prevent you from picking up your sensor.

I've attempted multiple times to request this in the modding api, but it seems to not be there yet.
waduk
Filter Inserter
Filter Inserter
Posts: 372
Joined: Tue Feb 10, 2015 5:44 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by waduk »

Yeah, this is not problem at all, and i don't think any player will came across this unless they make the same accidental placement as i do.
And i don't even notice if i don't see a strange icon rolling in my belt, and it gives hilarious surprise actually.
i really didn't expect to see a locomotive icon, at first i thought it was electrical engine running wild, that somehow being dropped by logistic bot.

Thank you for this wonderful mod btw.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2174
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Ranakastrasz »

Can you make it use virtual items like combinators do? Can you manipulate a constant combinator via script?
Can you have it manipulate a liquid instead, and have it act as a smart tank?


Also, It turns out I had version 4.0 instead of the latest version, so I am updating, Might have been the problem.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
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 »

Ranakastrasz wrote:Can you make it use virtual items like combinators do? Can you manipulate a constant combinator via script?
Can you have it manipulate a liquid instead, and have it act as a smart tank?
If I could manipulate a combinator signal, this problem would be solved. But we can't (yet), and virtual items (signals) can't be added to regular inventories.

If anyone knows of a roundabout way to manipulate a constant combinator, please tell.
Ranakastrasz wrote:Also, It turns out I had version 4.0 instead of the latest version, so I am updating, Might have been the problem.
Whew, got scared there as I was sure that was a bug I fixed previously.
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:If anyone knows of a roundabout way to manipulate a constant combinator, please tell.
here's what I use:

Code: Select all

        local cargoProxy = self.waitingStation.cargoProxy
        local output = cargoProxy.get_circuit_condition(1)
        local cargoCount = self:cargoCount()
        for c=1,50 do
          output.parameters[c]={signal={type = "item", name = nil}, count = 1, index = c}
        end
        output.parameters[1]={signal={type = "virtual", name = "signal-train-at-station"}, count = 1, index = 1}
        output.parameters[2]={signal={type = "virtual", name = "signal-locomotives"}, count = #self.train.locomotives.front_movers+#self.train.locomotives.back_movers, index = 2}
        output.parameters[3]={signal={type = "virtual", name = "signal-cargowagons"}, count = #self.train.cargo_wagons, index = 3}
        local i=4
        for name, count in pairs(cargoCount) do
          local type = "item"
          if fluids[name] then
            type = "fluid"
            count = math.floor(count)
          end
          output.parameters[i]={signal={type = type, name = name}, count=count, index = i}
          i=i+1
          if i>50 then break end
        end
        for c=i,50 do
          output.parameters[i]={signal={type = "item", name = nil}, count = 1, index = c}
        end
        cargoProxy.set_circuit_condition(1,output)
cargoProxy is a constant combinator, cargoCount is a table indexed by item name. The combinator has item_slot_count set to 50 instead the default 15
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 »

Well, there we go. Expect a patch sometime later this week. Hopefully I can prevent any migration problems this time.
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 »

Choumiko wrote:
Kikkers wrote:If anyone knows of a roundabout way to manipulate a constant combinator, please tell.
here's what I use:

Code: Select all

        local cargoProxy = self.waitingStation.cargoProxy
        local output = cargoProxy.get_circuit_condition(1)
        local cargoCount = self:cargoCount()
        for c=1,50 do
          output.parameters[c]={signal={type = "item", name = nil}, count = 1, index = c}
        end
        output.parameters[1]={signal={type = "virtual", name = "signal-train-at-station"}, count = 1, index = 1}
        output.parameters[2]={signal={type = "virtual", name = "signal-locomotives"}, count = #self.train.locomotives.front_movers+#self.train.locomotives.back_movers, index = 2}
        output.parameters[3]={signal={type = "virtual", name = "signal-cargowagons"}, count = #self.train.cargo_wagons, index = 3}
        local i=4
        for name, count in pairs(cargoCount) do
          local type = "item"
          if fluids[name] then
            type = "fluid"
            count = math.floor(count)
          end
          output.parameters[i]={signal={type = type, name = name}, count=count, index = i}
          i=i+1
          if i>50 then break end
        end
        for c=i,50 do
          output.parameters[i]={signal={type = "item", name = nil}, count = 1, index = c}
        end
        cargoProxy.set_circuit_condition(1,output)
cargoProxy is a constant combinator, cargoCount is a table indexed by item name. The combinator has item_slot_count set to 50 instead the default 15
Trying this out a bit, I noticed you could just insert any table that has the parameters field into set_circuit_condition. A lot cleaner than resetting each individual signal field in the constant combinator.
Syriusz
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Thu May 07, 2015 12:34 pm
Contact:

Re: [MOD 0.12.x] Smarter Circuitry

Post by Syriusz »

Hello! Great mod!
But i got such error after 12.5 update:
"Error while loading entity prototype "directional-sensor" (decider-combinator): No such node (activity_led_light_offsets)
Modifications: sensor"

I copied activity_led_light_offsets = {...} from vanilla entity configs and game run (but don't know what happen in game)
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 »

Syriusz wrote:Hello! Great mod!
But i got such error after 12.5 update:
"Error while loading entity prototype "directional-sensor" (decider-combinator): No such node (activity_led_light_offsets)
Modifications: sensor"

I copied activity_led_light_offsets = {...} from vanilla entity configs and game run (but don't know what happen in game)
Yes, that would work. I've already added that bit in the new version, but I'm still working on some other bits until I release it. Expect it in the next 24h. In the meantime, that fix would work just fine.
Post Reply

Return to “Mods”