Page 2 of 8

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Mon Aug 17, 2015 5:22 pm
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!
;)

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Mon Aug 17, 2015 9:53 pm
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]

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Mon Aug 17, 2015 10:51 pm
by billw
I added this to an in progress MP game and can't see the sensor anywhere! What am I missing?

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 18, 2015 7:00 am
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 25, 2015 2:04 am
by Ranakastrasz
What is the filter for the directional sensor?

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 25, 2015 5:56 am
by Kikkers
Ranakastrasz wrote:What is the filter for the directional sensor?
I'm unsure what you mean by filter?

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 25, 2015 10:32 am
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 25, 2015 10:39 am
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Tue Aug 25, 2015 2:02 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Wed Aug 26, 2015 8:46 am
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 11:54 am
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

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 12:00 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 1:20 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 4:01 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 5:24 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 6:44 pm
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

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Thu Aug 27, 2015 6:58 pm
by Kikkers
Well, there we go. Expect a patch sometime later this week. Hopefully I can prevent any migration problems this time.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Fri Aug 28, 2015 3:41 pm
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.

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Fri Aug 28, 2015 4:30 pm
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)

Re: [MOD 0.12.x] Smarter Circuitry

Posted: Fri Aug 28, 2015 4:42 pm
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.