diff --git a/exp_auto_restart/test/controller.test.js b/exp_auto_restart/test/controller.test.js index c2eb13da..0e528ac0 100644 --- a/exp_auto_restart/test/controller.test.js +++ b/exp_auto_restart/test/controller.test.js @@ -41,7 +41,7 @@ async function startPlugin(t2, { config = {}, canRestart = false } = {}) { } function addHost(controller, id, connected = true) { - controller.hosts.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), connected)); + controller.hosts.records.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), connected)); } function addInstance(controller, id, hostId, status = "running", fields = {}) { diff --git a/exp_scenario/features.ts b/exp_scenario/features.ts index 0056b691..da71dee9 100644 --- a/exp_scenario/features.ts +++ b/exp_scenario/features.ts @@ -297,6 +297,8 @@ export const features: Feature[] = [ description: "A GUI tracking research against target times, the targets live in config/research_data.lua", fields: [ str("log_file", "Log file", "Where the milestone times are written within script-output", "log/research.log"), + num("milestone_rate", "Target rate", "Targeted Milestone Science Research Rate", 45, 5, "SPM"), + num("milestone_warmup_time", "Warmup time", "Warmup time given before start counting.", 10, 0, "minutes"), ], }, { diff --git a/exp_scenario/module/config/research_data.lua b/exp_scenario/module/config/research_data.lua index ab130149..b954b47e 100644 --- a/exp_scenario/module/config/research_data.lua +++ b/exp_scenario/module/config/research_data.lua @@ -18,63 +18,184 @@ local data = { }, milestone = { ["base"] = { - ["automation"] = 600, - ["logistics"] = 300, - ["steel-processing"] = 300, - ["logistic-science-pack"] = 300, - ["electronics"] = 300, - ["fast-inserter"] = 300, - ["steel-axe"] = 300, - ["automation-2"] = 300, - ["advanced-material-processing"] = 300, - ["engine"] = 300, - ["fluid-handling"] = 300, - ["oil-processing"] = 300, - ["sulfur-processing"] = 300, - ["plastics"] = 300, - ["advanced-circuit"] = 300, - ["chemical-science-pack"] = 300, - ["modules"] = 300, - ["logistics-2"] = 300, - ["railway"] = 300, - ["research-speed-1"] = 300, - ["research-speed-2"] = 300, - ["battery"] = 300, - ["concrete"] = 300, - ["flammables"] = 300, - ["low-density-structure"] = 300, - ["advanced-material-processing-2"] = 300, - ["productivity-module"] = 300, - ["production-science-pack"] = 300, - ["processing-unit"] = 300, - ["advanced-oil-processing"] = 300, - ["electric-engine"] = 300, - ["robotics"] = 300, - ["construction-robotics"] = 300, - ["worker-robots-speed-1"] = 300, - ["worker-robots-speed-2"] = 300, - ["utility-science-pack"] = 300, - ["productivity-module-2"] = 300, - ["speed-module-2"] = 300, - ["rocket-fuel"] = 300, - ["effect-transmission"] = 300, - ["productivity-module-3"] = 300, - ["speed-module-3"] = 300, - ["rocket-silo"] = 300, - ["space-science-pack"] = 300, + "automation", + "logistics", + "steel-processing", + "logistic-science-pack", + "electronics", + "fast-inserter", + "steel-axe", + "automation-2", + "advanced-material-processing", + "engine", + "fluid-handling", + "oil-processing", + "sulfur-processing", + "plastics", + "advanced-circuit", + "chemical-science-pack", + "modules", + "logistics-2", + "railway", + "research-speed-1", + "research-speed-2", + "battery", + "concrete", + "flammables", + "low-density-structure", + "advanced-material-processing-2", + "productivity-module", + "production-science-pack", + "processing-unit", + "advanced-oil-processing", + "electric-engine", + "robotics", + "construction-robotics", + "worker-robots-speed-1", + "worker-robots-speed-2", + "utility-science-pack", + "productivity-module-2", + "speed-module-2", + "rocket-fuel", + "effect-transmission", + "productivity-module-3", + "speed-module-3", + "rocket-silo", + "space-science-pack", }, ["space-age"] = { - ["logistic-science-pack"] = 3600, - ["military-science-pack"] = 3600, - ["chemical-science-pack"] = 5400, - ["utility-science-pack"] = 7200, - ["production-science-pack"] = 7200, - ["space-science-pack"] = 7200, - ["metallurgic-science-pack"] = 10800, - ["electromagnetic-science-pack"] = 10800, - ["agricultural-science-pack"] = 10800, - ["cryogenic-science-pack"] = 10800, - ["promethium-science-pack"] = 14400, + "automation", + "electric-mining-drill", + "logistics", + "fast-inserter", + "steel-processing", + "logistic-science-pack", + "gun-turret", + "automation-2", + "advanced-material-processing", + "engine", + "logistics-2", + "automobilism", + "fluid-handling", + "oil-gathering", + "research-speed-1", + "research-speed-2", + "circuit-network", + "toolbelt", + "electric-energy-distribution-1", + "concrete", + "solar-energy", + "plastics", + "advanced-circuit", + "sulfur-processing", + "chemical-science-pack", + "battery", + "bulk-inserter", + "inserter-capacity-bonus-1", + "inserter-capacity-bonus-2", + "mining-productivity-1", + "modules", + "productivity-module", + "speed-module", + "efficiency-module", + "advanced-oil-processing", + "lubricant", + "electric-engine", + "robotics", + "construction-robotics", + "worker-robots-speed-1", + "worker-robots-speed-2", + "electric-energy-accumulators", + "explosives", + "military", + "stone-wall", + "military-2", + "military-science-pack", + "heavy-armor", + "modular-armor", + "solar-panel-equipment", + "battery-equipment", + "physical-projectile-damage-1", + "weapon-shooting-speed-1", + "repair-pack", + "radar", + "landfill", + "quality-module", + "flammables", + "processing-unit", + "low-density-structure", + "rocket-fuel", + "logistic-robotics", + "advanced-material-processing-2", + "rocket-silo", + "uranium-mining", + "research-speed-3", + "research-speed-4", + "worker-robots-storage-1", + "mining-productivity-2", + "railway", + "production-science-pack", + "utility-science-pack", + "physical-projectile-damage-2", + "weapon-shooting-speed-2", + "stronger-explosives-1", + "power-armor", + "exoskeleton-equipment", + "personal-roboport-equipment", + "nuclear-power", + "space-platform-thruster", + "planet-discovery-gleba", + "logistic-system", + "effect-transmission", + "speed-module-2", + "research-speed-5", + "worker-robots-speed-3", + "worker-robots-speed-4", + "worker-robots-storage-2", + "automation-3", + "productivity-module-2", + "efficiency-module-2", + "quality-module-2", + "planet-discovery-fulgora", + "kovarex-enrichment-process", + "military-3", + "military-4", + "power-armor-mk2", + "fission-reactor-equipment", + "battery-mk2-equipment", + "stronger-explosives-2", + "physical-projectile-damage-3", + "weapon-shooting-speed-3", + "planet-discovery-vulcanus", + "research-speed-6", + "worker-robots-speed-5", + "worker-robots-speed-6", + "worker-robots-storage-3", + "carbon-fiber", + "rocketry", + "rocket-turret", + "captivity", + "biolab", + "advanced-asteroid-processing", + "asteroid-reprocessing", + "planet-discovery-aquilo", + "physical-projectile-damage-4", + "weapon-shooting-speed-4", + "physical-projectile-damage-5", + "weapon-shooting-speed-5", + "physical-projectile-damage-6", + "weapon-shooting-speed-6", + "physical-projectile-damage-7", + "stronger-explosives-3", + "stronger-explosives-4", + "stronger-explosives-5", + "stronger-explosives-6", + "stronger-explosives-7", + "stronger-explosives-8", + "quantum-processor", + "railgun", + "fusion-reactor", + "promethium-science-pack", } }, inf_res = { diff --git a/exp_scenario/module/gui/quick_actions.lua b/exp_scenario/module/gui/quick_actions.lua index 28c9ec37..06293527 100644 --- a/exp_scenario/module/gui/quick_actions.lua +++ b/exp_scenario/module/gui/quick_actions.lua @@ -24,22 +24,16 @@ local Elements = {} local Actions = {} --- @param command ExpCommand | function (this is needed because of the overload on commands) +--- @param locale table --- @param on_click? ExpElement.EventHandler -local function new_quick_action(command, on_click) +local function new_quick_action(command, locale, on_click) local command_name = command.name local element = Gui.define("quick_actions/" .. command_name) :draw{ type = "button", - caption = { "?", - { "exp-gui_quick-actions.caption-" .. command_name }, - command_name, - }, - tooltip = { "?", - { "exp-gui_quick-actions.tooltip-" .. command_name }, - command.description, - "" - }, + caption = { locale.caption }, + tooltip = { locale.tooltip }, } :style{ width = 160, @@ -55,24 +49,77 @@ local function new_quick_action(command, on_click) } end -new_quick_action(addon_artillery.commands.artillery) -new_quick_action(addon_trains.commands.set_trains_to_automatic) +new_quick_action(addon_artillery.commands.artillery, { + caption = "exp-commands_artillery.selection-name", + tooltip = "exp-commands_artillery.description" +}) -new_quick_action(addon_teleport.commands.spawn, function(def, player, element, event) +new_quick_action(addon_trains.commands.set_trains_to_automatic, { + caption = "exp-commands_trains.caption", + tooltip = "exp-commands_trains.description" +}) + +new_quick_action(addon_teleport.commands.spawn, { + caption = "exp-commands_teleport.description-spawn", + tooltip = "exp-commands_teleport.description-spawn" +}, function(def, player, element, event) addon_teleport.commands.spawn(player, player) end) -new_quick_action(addon_waterfill.commands.waterfill) -new_quick_action(addon_lawnmower.commands.lawnmower) -new_quick_action(addon_surface.commands.clear_ground_items) -new_quick_action(addon_surface.commands.clear_blueprints_surface) -new_quick_action(addon_surface.commands.clear_blueprints) -new_quick_action(addon_home.commands.home) -new_quick_action(addon_home.commands.home_return) -new_quick_action(addon_home.commands.set_home) -new_quick_action(addon_home.commands.get_home) -new_quick_action(addon_vlayer.commands.vlayer) -new_quick_action(addon_repair.commands.repair) +new_quick_action(addon_waterfill.commands.waterfill, { + caption = "exp-commands_waterfill.selection-name", + tooltip = "exp-commands_waterfill.description" +}) + +new_quick_action(addon_lawnmower.commands.lawnmower, { + caption = "exp-commands_lawnmower.selection-name", + tooltip = "exp-commands_lawnmower.description" +}) + +new_quick_action(addon_surface.commands.clear_ground_items, { + caption = "exp-commands_surface.caption-items", + tooltip = "exp-commands_surface.description-items" +}) + +new_quick_action(addon_surface.commands.clear_blueprints_surface, { + caption = "exp-commands_surface.caption-blueprints-surface", + tooltip = "exp-commands_surface.description-blueprints-surface" +}) + +new_quick_action(addon_surface.commands.clear_blueprints, { + caption = "exp-commands_surface.caption-blueprints", + tooltip = "exp-commands_surface.description-blueprints" +}) + +new_quick_action(addon_home.commands.home, { + caption = "exp-commands_home.caption-home", + tooltip = "exp-commands_home.description-home" +}) + +new_quick_action(addon_home.commands.home_return, { + caption = "exp-commands_home.caption-return", + tooltip = "exp-commands_home.description-return" +}) + +new_quick_action(addon_home.commands.set_home, { + caption = "exp-commands_home.caption-set", + tooltip = "exp-commands_home.description-set" +}) + +new_quick_action(addon_home.commands.get_home, { + caption = "exp-commands_home.caption-get", + tooltip = "exp-commands_home.description-get" +}) + +new_quick_action(addon_vlayer.commands.vlayer, { + caption = "exp-commands_vlayer.caption", + tooltip = "exp-commands_vlayer.description" +}) + +new_quick_action(addon_repair.commands.repair, { + caption = "exp-commands_repair.selection-name", + tooltip = "exp-commands_repair.description" +}) --- Container added to the left gui flow --- @class ExpGui_QuickActions.elements.container: ExpElement diff --git a/exp_scenario/module/gui/research_milestones.lua b/exp_scenario/module/gui/research_milestones.lua index 2a84364f..71fc4662 100644 --- a/exp_scenario/module/gui/research_milestones.lua +++ b/exp_scenario/module/gui/research_milestones.lua @@ -10,6 +10,8 @@ local research_data = require("modules/exp_scenario/config/research_data") local feature, config = Feature.register("research_milestones", { log_file = "log/research.log", -- where the milestone times are written + milestone_rate = 45, -- Targeted Milestone Science Research Rate, In terms of SPM. + milestone_warmup_time = 10, -- Warmup time given before start counting. In terms of minutes. }) local table_to_json = helpers.table_to_json @@ -41,11 +43,12 @@ local research_targets = { do --- Calculate the research targets local research_index = 1 - local total_time = 0 - for name, time in pairs(research_data.milestone[research_data.mod_set]) do + local total_time = config.milestone_warmup_time * 60 + for _, name in pairs(research_data.milestone[research_data.mod_set]) do if prototypes.technology[name] and (not prototypes.technology[name].hidden) then research_targets.index_lookup[name] = research_index - total_time = total_time + time * 60 + -- The number is affected by multiplier already + total_time = total_time + math.ceil(prototypes.technology[name].research_unit_count * 60 / config.milestone_rate) research_targets.target_times[research_index] = { name = name, diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index ff366a9c..de26d1e5 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -73,6 +73,10 @@ description-remove=Remove all enemy spawners. arg-surface=Surface to remove spawners from. [exp-commands_home] +caption-home=Teleports Home. +caption-return=Teleports Previous. +caption-get=Get Home. +caption-set=Sets Home. description-home=Teleports you to your home location. description-return=Teleports you to previous location. description-get=Returns your current home location. @@ -205,6 +209,9 @@ follow-self=You can not follow yourself. [exp-commands_surface] selection-name=Surface +caption-items=Clear item +caption-blueprints=Clear Blueprints +caption-blueprints-surface=Clear Blueprints (Surface) description-items=Clear all items on the ground. description-blueprints=Clear all blueprints. description-blueprints-surface=Clear all blueprints on the current surface. @@ -214,6 +221,7 @@ blueprints=__1__ cleared all blueprints on __2__. complete=__1__ blueprint ghost were removed. [exp-commands_trains] +caption=Set Auto Train description=Set All Trains to Automatic, does not effect trains with passengers. arg-force=Force to set the trains for, default all. arg-surface=Surface to set the trains for, default all. @@ -231,8 +239,9 @@ unavailable=They was a problem teleporting you, likely no position found, please same-player=Player can not be teleported to themselves. [exp-commands_vlayer] +caption=Vlayer information. description=Print all vlayer information. -title=VLayer Information: +title=Vlayer Information: result=__1__: __2__ [exp-commands_waterfill] @@ -328,11 +337,6 @@ caption-net=Net [exp-gui_quick-actions] tooltip-main=Quick Actions -caption-artillery=Artillery -caption-research=Auto Research -caption-spawn=Teleport Spawn -caption-trains=Set Auto Train -caption-waterfill=Waterfill [exp-gui_readme] main-tooltip=Information diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 8e22261e..bf4c9f46 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -70,10 +70,14 @@ description-remove=移除蟲單位及停止生產器。 arg-surface=要移除蟲巢的位面。 [exp-commands_home] +caption-home=傳送回家。 +caption-return=傳送上次。 +caption-set=設定家。 +caption-get=取得家。 description-home=傳送回家。 +description-return=傳送回上一個位置。 description-set=設定目前位置為家。 description-get=取得家的位置。 -description-return=傳送回上一個位置。 no-home=你在 __1__ 上還沒設回程傳送點。 no-return=你還沒在 __1__ 上使用過回程。 home-set=你的回程傳送點為 __1__ 上, x: __2__ y: __3__ @@ -206,6 +210,9 @@ follow-self=你不能追蹤自己。 [exp-commands_surface] selection-name=位面 +caption-items=清除物品 +caption-blueprints=清除藍圖 +caption-blueprints-surface=清除藍圖 (位面) description-items=清除地面上的物品。 description-blueprints=清除藍圖。 description-blueprints-surface=清除本位面上的藍圖。 @@ -216,6 +223,7 @@ area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 complete=__1__ 個地上的藍圖已被清除。 [exp-commands_trains] +caption=自動火車 description=把火車設置為自動模式 arg-force=勢力 arg-surface=位面 @@ -233,7 +241,8 @@ unavailable=沒找到空間進行傳送 same-player=沒辦法傳送到自己 [exp-commands_vlayer] -description=vlayer 資訊 +caption=vlayer 資訊 +description=列印所有 vlayer 資訊 title=vlayer 資訊: result=__1__: __2__ @@ -315,16 +324,6 @@ caption-net=淨值 [exp-gui_quick-actions] tooltip-main=工具 -caption-artillery=火炮遙控 -tooltip-artillery=火炮遙控 -caption-research=研究 -tooltip-research=啟用自動研究 -caption-spawn=傳送出生 -tooltip-spawn-tooltip=傳送到出生點 -caption-trains=火車 -tooltip-trains=把火車設置為自動模式 -caption-waterfill=挖水 -tooltip-waterfill=把地換為水。 [exp-gui_readme] main-tooltip=資訊 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 8e22261e..bf4c9f46 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -70,10 +70,14 @@ description-remove=移除蟲單位及停止生產器。 arg-surface=要移除蟲巢的位面。 [exp-commands_home] +caption-home=傳送回家。 +caption-return=傳送上次。 +caption-set=設定家。 +caption-get=取得家。 description-home=傳送回家。 +description-return=傳送回上一個位置。 description-set=設定目前位置為家。 description-get=取得家的位置。 -description-return=傳送回上一個位置。 no-home=你在 __1__ 上還沒設回程傳送點。 no-return=你還沒在 __1__ 上使用過回程。 home-set=你的回程傳送點為 __1__ 上, x: __2__ y: __3__ @@ -206,6 +210,9 @@ follow-self=你不能追蹤自己。 [exp-commands_surface] selection-name=位面 +caption-items=清除物品 +caption-blueprints=清除藍圖 +caption-blueprints-surface=清除藍圖 (位面) description-items=清除地面上的物品。 description-blueprints=清除藍圖。 description-blueprints-surface=清除本位面上的藍圖。 @@ -216,6 +223,7 @@ area-too-large=區域太大了,需少過 __1__ 格,你選了 __2__ 格。 complete=__1__ 個地上的藍圖已被清除。 [exp-commands_trains] +caption=自動火車 description=把火車設置為自動模式 arg-force=勢力 arg-surface=位面 @@ -233,7 +241,8 @@ unavailable=沒找到空間進行傳送 same-player=沒辦法傳送到自己 [exp-commands_vlayer] -description=vlayer 資訊 +caption=vlayer 資訊 +description=列印所有 vlayer 資訊 title=vlayer 資訊: result=__1__: __2__ @@ -315,16 +324,6 @@ caption-net=淨值 [exp-gui_quick-actions] tooltip-main=工具 -caption-artillery=火炮遙控 -tooltip-artillery=火炮遙控 -caption-research=研究 -tooltip-research=啟用自動研究 -caption-spawn=傳送出生 -tooltip-spawn-tooltip=傳送到出生點 -caption-trains=火車 -tooltip-trains=把火車設置為自動模式 -caption-waterfill=挖水 -tooltip-waterfill=把地換為水。 [exp-gui_readme] main-tooltip=資訊 diff --git a/exp_server_list/controller.ts b/exp_server_list/controller.ts index 7a105b54..dc44d57d 100644 --- a/exp_server_list/controller.ts +++ b/exp_server_list/controller.ts @@ -114,7 +114,7 @@ export default async function (context: ControllerPluginContext) { }); // The public address of a host arrives after it connects - controller.hosts.on("update", hosts => { + controller.hosts.records.on("update", hosts => { const hostIds = new Set(hosts.map(host => host.id)); refresh([...controller.instances.values()].filter(instance => { const hostId = instance.config.get("instance.assigned_host"); diff --git a/exp_server_list/test/controller.test.js b/exp_server_list/test/controller.test.js index 11a8e853..4dafe170 100644 --- a/exp_server_list/test/controller.test.js +++ b/exp_server_list/test/controller.test.js @@ -47,7 +47,7 @@ async function startPlugin(t2, setup = () => {}) { } function addHost(controller, id, publicAddress = "") { - controller.hosts.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), true, "", publicAddress)); + controller.hosts.records.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), true, "", publicAddress)); } function addInstance(controller, id, { hostId = 1, status = "running", gamePort, factorioVersion, fields = {} } = {}) {