Research Control Tower


Sets your infinite research based on a circuit signal. Supports all infinite technologies including modded ones.

Content
2 months ago
2.0
410
Circuit network

i Signal limit & handler fix

2 months ago
(updated 2 months ago)

Hello,I came across a couple of areas in your code that I think could benefit from small adjustments.

  1. Research-signal value greater than 1000

If a research signal is set higher than 1000, research control no longer works correctly.
In control.lua, line 35 currently reads:

local min_value = 1000

Changing it to

local min_value = math.huge

lets the tower handle research signals above 1000 without issues.

  1. Duplicate on_research_finished handlers

Lines 215–216 and 238–239 both register the same event:

script.on_event(defines.events.on_research_finished, process_tower)
script.on_event(defines.events.on_research_finished, update_combinators)

When script.on_event is called twice for the same event, Factorio keeps only the last handler, so process_tower never runs. Although research restarts when the combinators refresh every 60 ticks, this probably isn’t what you intended. A simple fix is to wrap both calls in a single handler:

local function on_research_finished()
process_tower()
update_combinators()
end
script.on_event(defines.events.on_research_finished, on_research_finished)

Thank you for the mod. I've been using it and it’s been very helpful.

2 months ago

I implemented both changes and thanks for the code. The value change was an oversight by me and your change worked flawlessly. Unfortunately the event handler change doesn't work as hoped as the circuit network hasn't been updated yet so the tower can't know that things have changed until the next update so things are still the same researching 1 second of the same tech.

New response