boskid wrote: Mon Sep 08, 2025 9:00 am
I will throw this to Not a bug:
Thank you for your reply! As mentioned in my original post, I wasn't sure myself whether this bug should be classified as implementation or documentation bug. If you say it's working as expected, could you move this to
Documentation Improvement Requests instead, please?
1/ Related to "but slot 2 will be empty" -> you called set_slot twice with index 1, because of that slot 2 would never be modified.
Sorry, that's not true! Of course I messed up my example by writing to the same slot twice although I meant to write to slots 1 and 2. But if the SignalFilter is correct, slot 1 will be overwritten with "signal-B" the second time:
Code: Select all
/c p = game.player; pos = p.position
cc = p.surface.create_entity{name = "constant-combinator", force = p.force, position = {pos.x + 3, pos.y}}
s = cc.get_control_behavior().sections[1]
s.set_slot(1, {min = 1, value = {type = "virtual", name = "signal-A", quality = "normal"}})
s.set_slot(1, {min = 1, value = {type = "virtual", name = "signal-B", quality = "normal"}})
But this (fixed) still errors when writing to slot 2:
Code: Select all
/c p = game.player; pos = p.position
cc = p.surface.create_entity{name = "constant-combinator", force = p.force, position = {pos.x + 3, pos.y}}
s = cc.get_control_behavior().sections[1]
s.set_slot(1, {min = 1, value = {type = "virtual", name = "signal-A", quality = "normal"}})
s.set_slot(2, {min = 1, value = {type = "virtual", name = "signal-B"}})
2/ SignalFilter allows to skip quality, however that means you are providing a signal filter with an "Any" quality condition. Logistic sections specifically do not allow having one filter to specify a quality range when `min` is non-zero.
It would have been helpful to see this in the documentation.
Quality range is allowed when min is 0 because that is used for auto-trashing, however having logistic section with no quality provided and be used in a requester chest would be ambiguous how many items are requested (is it `min` of each quality or is it up to a total provided regardless of quality).
It's unfortunate that LuaConstantCombinatorControlBehavior is using LuaLogisticSection to begin with, as constant-combinators don't have logistics. I can definitely understand that it's easier to reuse LuaLogisticSection for combinators rather than making a copy of it with some tiny changes at best – but, damn, is that unintuitive!
