Improved Research Queue


A better GUI for managing the research queue. Unlimited size, move technologies up and down, automatically add prerequisites, filter & search technologies, pause/unpause, estimated time to completion, and more!

Utilities
3 years ago
0.18 - 1.1
49.0K

i Calling your mod

2 years ago

I develop a mod that - among other things - can initiate research. I would love to call your mod to accomplish that. Which function do you recommend?

2 years ago
(updated 2 years ago)

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"

New response