mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Update Research Milestones (#17)
* Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Update research.lua * Fix use of created_entity in events * Fix to use correct module pattern --------- Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,9 @@ local format_player_name = Commands.format_player_name_locale
|
||||
|
||||
local config = require("modules.exp_legacy.config.research") --- @dep config.research
|
||||
|
||||
--- @class Command.Research
|
||||
local module = {}
|
||||
|
||||
local research = {
|
||||
res_queue_enable = false
|
||||
}
|
||||
@@ -18,16 +21,9 @@ end)
|
||||
|
||||
--- @param force LuaForce
|
||||
--- @param silent boolean True when no message should be printed
|
||||
local function res_queue(force, silent)
|
||||
function module.res_queue(force, silent)
|
||||
local res_q = force.research_queue
|
||||
local res
|
||||
|
||||
if script.active_mods["space-age"] then
|
||||
res = force.technologies["mining-productivity-3"]
|
||||
|
||||
else
|
||||
res = force.technologies["mining-productivity-4"]
|
||||
end
|
||||
local res = force.technologies[config.bonus_inventory.res[config.mod_set].name]
|
||||
|
||||
if #res_q < config.queue_amount then
|
||||
for i = 1, config.queue_amount - #res_q do
|
||||
@@ -53,7 +49,7 @@ Commands.new("set-auto-research", { "exp-commands_research.description" })
|
||||
end
|
||||
|
||||
if research.res_queue_enable then
|
||||
res_queue(player.force --[[@as LuaForce]], true)
|
||||
module.res_queue(player.force --[[@as LuaForce]], true)
|
||||
end
|
||||
|
||||
local player_name = format_player_name(player)
|
||||
@@ -65,14 +61,15 @@ local function on_research_finished(event)
|
||||
if not research.res_queue_enable then return end
|
||||
|
||||
local force = event.research.force
|
||||
if force.rockets_launched > 0 and force.technologies["mining-productivity-4"].level > 4 then
|
||||
res_queue(force, event.by_script)
|
||||
if force.rockets_launched > 0 and force.technologies[config.bonus_inventory.res[config.mod_set].name].level > config.bonus_inventory.res[config.mod_set].level then
|
||||
module.res_queue(force, event.by_script)
|
||||
end
|
||||
end
|
||||
|
||||
local e = defines.events
|
||||
return {
|
||||
events = {
|
||||
[e.on_research_finished] = on_research_finished,
|
||||
}
|
||||
--- @package
|
||||
module.events = {
|
||||
[e.on_research_finished] = on_research_finished,
|
||||
}
|
||||
|
||||
return module
|
||||
|
||||
Reference in New Issue
Block a user