[2.0] How to script constant combinators using the new `LuaLogisticSection`
Posted: Thu Oct 24, 2024 11:29 pm
I've been trying to understand the new combinator system for the past few hours and I feel like I'm missing something simple here. In 1.1, I've used a modified constant combinator (which players couldn't open and change the signal value), and the script updated it with when I wanted to change the value.
Now constant combinators use the logistic groups and I can't seem to get them to work. When I place a new combinator, I set that signal to 0:
And with the `/editor` I can check the combinator and see that it works correctly adding my signal with value 0. But when I need to update it, I get the slot and change its min and max values:
And I get the error "Can't specify non zero request with non trivial item filter condition" on the `section.set_slot(1, slot)` line.
Is this the right way to do it, or did I miss some other way of setting constant combinator values via script?
Code: Select all
set_signal(1, { signal = { type = "item", name = "powerSat" }, count = count })
Now constant combinators use the logistic groups and I can't seem to get them to work. When I place a new combinator, I set that signal to 0:
Code: Select all
local behaviour = _entity.get_or_create_control_behavior()
if (behaviour.sections_count == 0) then behaviour.add_section() end
local section = behaviour.get_section(1)
section.set_slot(1, { value = { name = "powerSat", type="item" }, min = 0, max = 0 })
Code: Select all
local behaviour = v.get_or_create_control_behavior()
local section = behaviour.get_section(1)
local slot = section.get_slot(1)
slot.min = count
slot.max = count
section.set_slot(1, slot)
Is this the right way to do it, or did I miss some other way of setting constant combinator values via script?