To enable other mods to use your amazing research queue you may define a remote-interface.
I tried this for my mod and it works perfectly.
Here is what I did. It would be nice if you put this in your mod:
file 'scripts/remote-interface.lua' with the following content:
local queue = require 'scripts.queue'
local rqtech = require 'scripts.rqtech'
local actions = require 'scripts.gui.actions'
remote.add_interface(
"sonaxaton-research-queue", {
get_queued_names = function(force)
local result = {}
for technology in queue.iter(force) do --
table.insert(result, technology.tech.name)
end
return result
end,
enqueue = function(force, name)
local technology = rqtech.new(force.technologies[name])
queue.enqueue(force, technology)
queue.update(force)
for _, player in pairs(force.players) do
local player_data = global.players[player.index]
if player_data ~= nil then
local gui_data = player_data.gui
if gui_data.window.valid and gui_data.window.visible then
actions.update_queue(player, technology)
end
end
end
end,
}
)
And call this inside of control.lua:
local remote_interface = require "scripts.remote-interface"