mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +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:
@@ -5,77 +5,154 @@ return {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
pollution_ageing_by_research = false,
|
pollution_ageing_by_research = false,
|
||||||
queue_amount = 3,
|
queue_amount = 3,
|
||||||
|
mod_set = "base",
|
||||||
|
mod_set_lookup = {
|
||||||
|
"space-age"
|
||||||
|
},
|
||||||
-- this enable 20 more inventory for each mining productivity level up to 4
|
-- this enable 20 more inventory for each mining productivity level up to 4
|
||||||
bonus_inventory = {
|
bonus_inventory = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
res = {
|
||||||
|
-- Mining Productivity
|
||||||
|
["base"] = {
|
||||||
|
["name"] = "mining-productivity-4",
|
||||||
|
["level"] = 4,
|
||||||
|
},
|
||||||
|
["space-age"] = {
|
||||||
|
["name"] = "mining-productivity-3",
|
||||||
|
["level"] = 3,
|
||||||
|
}
|
||||||
|
},
|
||||||
name = "character_inventory_slots_bonus",
|
name = "character_inventory_slots_bonus",
|
||||||
rate = 5,
|
rate = 5,
|
||||||
limit = 20,
|
limit = 20,
|
||||||
},
|
},
|
||||||
file_name = "log/research.log",
|
file_name = "log/research.log",
|
||||||
milestone = {
|
milestone = {
|
||||||
["automation"] = 600,
|
["base"] = {
|
||||||
["logistics"] = 300,
|
["automation"] = 600,
|
||||||
["steel-processing"] = 300,
|
["logistics"] = 300,
|
||||||
["logistic-science-pack"] = 300,
|
["steel-processing"] = 300,
|
||||||
["electronics"] = 300,
|
["logistic-science-pack"] = 300,
|
||||||
["fast-inserter"] = 300,
|
["electronics"] = 300,
|
||||||
["steel-axe"] = 300,
|
["fast-inserter"] = 300,
|
||||||
["automation-2"] = 300,
|
["steel-axe"] = 300,
|
||||||
["advanced-material-processing"] = 300,
|
["automation-2"] = 300,
|
||||||
["engine"] = 300,
|
["advanced-material-processing"] = 300,
|
||||||
["fluid-handling"] = 300,
|
["engine"] = 300,
|
||||||
["oil-processing"] = 300,
|
["fluid-handling"] = 300,
|
||||||
["sulfur-processing"] = 300,
|
["oil-processing"] = 300,
|
||||||
["plastics"] = 300,
|
["sulfur-processing"] = 300,
|
||||||
["advanced-electronics"] = 300,
|
["plastics"] = 300,
|
||||||
["chemical-science-pack"] = 300,
|
["advanced-electronics"] = 300,
|
||||||
["modules"] = 300,
|
["chemical-science-pack"] = 300,
|
||||||
["logistics-2"] = 300,
|
["modules"] = 300,
|
||||||
["railway"] = 300,
|
["logistics-2"] = 300,
|
||||||
["research-speed-1"] = 300,
|
["railway"] = 300,
|
||||||
["research-speed-2"] = 300,
|
["research-speed-1"] = 300,
|
||||||
["battery"] = 300,
|
["research-speed-2"] = 300,
|
||||||
["concrete"] = 300,
|
["battery"] = 300,
|
||||||
["flammables"] = 300,
|
["concrete"] = 300,
|
||||||
["low-density-structure"] = 300,
|
["flammables"] = 300,
|
||||||
["advanced-material-processing-2"] = 300,
|
["low-density-structure"] = 300,
|
||||||
["productivity-module"] = 300,
|
["advanced-material-processing-2"] = 300,
|
||||||
["production-science-pack"] = 300,
|
["productivity-module"] = 300,
|
||||||
["advanced-electronics-2"] = 300,
|
["production-science-pack"] = 300,
|
||||||
["advanced-oil-processing"] = 300,
|
["advanced-electronics-2"] = 300,
|
||||||
["electric-engine"] = 300,
|
["advanced-oil-processing"] = 300,
|
||||||
["robotics"] = 300,
|
["electric-engine"] = 300,
|
||||||
["construction-robotics"] = 300,
|
["robotics"] = 300,
|
||||||
["worker-robots-speed-1"] = 300,
|
["construction-robotics"] = 300,
|
||||||
["worker-robots-speed-2"] = 300,
|
["worker-robots-speed-1"] = 300,
|
||||||
["utility-science-pack"] = 300,
|
["worker-robots-speed-2"] = 300,
|
||||||
["productivity-module-2"] = 300,
|
["utility-science-pack"] = 300,
|
||||||
["speed-module-2"] = 300,
|
["productivity-module-2"] = 300,
|
||||||
["rocket-fuel"] = 300,
|
["speed-module-2"] = 300,
|
||||||
["effect-transmission"] = 300,
|
["rocket-fuel"] = 300,
|
||||||
["productivity-module-3"] = 300,
|
["effect-transmission"] = 300,
|
||||||
["rocket-control-unit"] = 300,
|
["productivity-module-3"] = 300,
|
||||||
["speed-module-3"] = 300,
|
["speed-module-3"] = 300,
|
||||||
["rocket-silo"] = 300,
|
["rocket-silo"] = 300,
|
||||||
["space-science-pack"] = 300,
|
["space-science-pack"] = 300
|
||||||
|
},
|
||||||
|
["space-age"] = {
|
||||||
|
["logistic-science-pack"] = 2400,
|
||||||
|
["military-science-pack"] = 2400,
|
||||||
|
["chemical-science-pack"] = 3000,
|
||||||
|
["utility-science-pack"] = 3600,
|
||||||
|
["production-science-pack"] = 3600,
|
||||||
|
["space-science-pack"] = 3600,
|
||||||
|
["metallurgic-science-pack"] = 4200,
|
||||||
|
["electromagnetic-science-pack"] = 4200,
|
||||||
|
["agricultural-science-pack"] = 4200,
|
||||||
|
["cryogenic-science-pack"] = 4200,
|
||||||
|
["promethium-science-pack"] = 4800
|
||||||
|
}
|
||||||
},
|
},
|
||||||
inf_res = {
|
inf_res = {
|
||||||
-- Mining Productivity
|
["base"] = {
|
||||||
["mining-productivity-4"] = 4,
|
-- Mining Productivity
|
||||||
-- Robot Speed
|
["mining-productivity-4"] = 4,
|
||||||
["worker-robots-speed-6"] = 6,
|
-- Robot Speed
|
||||||
-- Laser Damage
|
["worker-robots-speed-6"] = 6,
|
||||||
["energy-weapons-damage-7"] = 7,
|
-- Laser Damage
|
||||||
-- Explosive Damage
|
["energy-weapons-damage-7"] = 7,
|
||||||
["stronger-explosives-7"] = 7,
|
-- Explosive Damage
|
||||||
-- Bullet Damage
|
["stronger-explosives-7"] = 7,
|
||||||
["physical-projectile-damage-7"] = 7,
|
-- Bullet Damage
|
||||||
-- Flame Damage
|
["physical-projectile-damage-7"] = 7,
|
||||||
["refined-flammables-7"] = 7,
|
-- Flame Damage
|
||||||
-- Artillery Range
|
["refined-flammables-7"] = 7,
|
||||||
["artillery-shell-range-1"] = 1,
|
-- Artillery Range
|
||||||
-- Artillery Speed
|
["artillery-shell-range-1"] = 1,
|
||||||
["artillery-shell-speed-1"] = 1,
|
-- Artillery Speed
|
||||||
|
["artillery-shell-speed-1"] = 1
|
||||||
|
},
|
||||||
|
["space-age"] = {
|
||||||
|
-- Mining Productivity
|
||||||
|
["mining-productivity-3"] = 3,
|
||||||
|
-- Robot Speed
|
||||||
|
["worker-robots-speed-7"] = 7,
|
||||||
|
-- Laser Damage
|
||||||
|
["energy-weapons-damage-7"] = 7,
|
||||||
|
-- Electric Damage
|
||||||
|
["electric-weapons-damage-3"] = 3,
|
||||||
|
-- Explosive Damage
|
||||||
|
["stronger-explosives-7"] = 7,
|
||||||
|
-- Bullet Damage
|
||||||
|
["physical-projectile-damage-7"] = 7,
|
||||||
|
-- Flame Damage
|
||||||
|
["refined-flammables-7"] = 7,
|
||||||
|
-- Artillery Range
|
||||||
|
["artillery-shell-range-1"] = 1,
|
||||||
|
-- Artillery Speed
|
||||||
|
["artillery-shell-speed-1"] = 1,
|
||||||
|
-- Artillery Damage
|
||||||
|
["artillery-shell-damage-1"] = 1,
|
||||||
|
-- Railgun Speed
|
||||||
|
["railgun-shooting-speed-1"] = 1,
|
||||||
|
-- Railgun Damage
|
||||||
|
["railgun-damage-1"] = 1,
|
||||||
|
-- Health
|
||||||
|
["health"] = 1,
|
||||||
|
-- Research Productivity
|
||||||
|
["research-productivity"] = 1,
|
||||||
|
-- Scrap Recycling Productivity
|
||||||
|
["scrap-recycling-productivity"] = 1,
|
||||||
|
-- Asteroid Productivity
|
||||||
|
["asteroid-productivity"] = 1,
|
||||||
|
-- Processing Unit Productivity
|
||||||
|
["processing-unit-productivity"] = 1,
|
||||||
|
-- Steel Plate Productivity
|
||||||
|
["steel-plate-productivity"] = 1,
|
||||||
|
-- Low Density Structure Productivity
|
||||||
|
["low-density-structure-productivity"] = 1,
|
||||||
|
-- Plastic Bar Productivity
|
||||||
|
["plastic-bar-productivity"] = 1,
|
||||||
|
-- Rocket Fuel Productivity
|
||||||
|
["rocket-fuel-productivity"] = 1,
|
||||||
|
-- Rocket Part Productivity
|
||||||
|
["rocket-part-productivity"] = 1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,21 @@ local config = require("modules.exp_legacy.config.research") --- @dep config.res
|
|||||||
local table_to_json = helpers.table_to_json
|
local table_to_json = helpers.table_to_json
|
||||||
local write_file = helpers.write_file
|
local write_file = helpers.write_file
|
||||||
|
|
||||||
local research = {}
|
local research = {
|
||||||
|
time = {},
|
||||||
|
res_queue_enable = false
|
||||||
|
}
|
||||||
|
|
||||||
Storage.register(research, function(tbl)
|
Storage.register(research, function(tbl)
|
||||||
research = tbl
|
research = tbl
|
||||||
end)
|
end)
|
||||||
|
|
||||||
research.time = {}
|
for i = 1, #config.mod_set_lookup do
|
||||||
research.res_queue_enable = false
|
if script.active_mods[config.mod_set_lookup[i]] then
|
||||||
|
config.mod_set = config.mod_set_lookup[i]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local research_time_format = ExpUtil.format_time_factory{ format = "clock", hours = true, minutes = true, seconds = true }
|
local research_time_format = ExpUtil.format_time_factory{ format = "clock", hours = true, minutes = true, seconds = true }
|
||||||
local empty_time = research_time_format(nil)
|
local empty_time = research_time_format(nil)
|
||||||
@@ -38,7 +46,7 @@ do
|
|||||||
local res_total = 0
|
local res_total = 0
|
||||||
local i = 1
|
local i = 1
|
||||||
|
|
||||||
for k, v in pairs(config.milestone) do
|
for k, v in pairs(config.milestone[config.mod_set]) do
|
||||||
research.time[i] = 0
|
research.time[i] = 0
|
||||||
res["lookup_name"][k] = i
|
res["lookup_name"][k] = i
|
||||||
res_total = res_total + v * 60
|
res_total = res_total + v * 60
|
||||||
@@ -89,9 +97,9 @@ local function research_res_n(res_)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function research_notification(event)
|
local function research_notification(event)
|
||||||
if config.inf_res[event.research.name] then
|
if config.inf_res[config.mod_set][event.research.name] then
|
||||||
if event.research.name == "mining-productivity-4" then
|
if event.research.name == config.bonus_inventory.res[config.mod_set].name then
|
||||||
if event.research.level == 5 then
|
if event.research.level == config.bonus_inventory.res[config.mod_set].level + 1 then
|
||||||
-- Add run result to log
|
-- Add run result to log
|
||||||
research_add_log()
|
research_add_log()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ local format_player_name = Commands.format_player_name_locale
|
|||||||
|
|
||||||
local config = require("modules.exp_legacy.config.research") --- @dep config.research
|
local config = require("modules.exp_legacy.config.research") --- @dep config.research
|
||||||
|
|
||||||
|
--- @class Command.Research
|
||||||
|
local module = {}
|
||||||
|
|
||||||
local research = {
|
local research = {
|
||||||
res_queue_enable = false
|
res_queue_enable = false
|
||||||
}
|
}
|
||||||
@@ -18,16 +21,9 @@ end)
|
|||||||
|
|
||||||
--- @param force LuaForce
|
--- @param force LuaForce
|
||||||
--- @param silent boolean True when no message should be printed
|
--- @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_q = force.research_queue
|
||||||
local res
|
local res = force.technologies[config.bonus_inventory.res[config.mod_set].name]
|
||||||
|
|
||||||
if script.active_mods["space-age"] then
|
|
||||||
res = force.technologies["mining-productivity-3"]
|
|
||||||
|
|
||||||
else
|
|
||||||
res = force.technologies["mining-productivity-4"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if #res_q < config.queue_amount then
|
if #res_q < config.queue_amount then
|
||||||
for i = 1, config.queue_amount - #res_q do
|
for i = 1, config.queue_amount - #res_q do
|
||||||
@@ -53,7 +49,7 @@ Commands.new("set-auto-research", { "exp-commands_research.description" })
|
|||||||
end
|
end
|
||||||
|
|
||||||
if research.res_queue_enable then
|
if research.res_queue_enable then
|
||||||
res_queue(player.force --[[@as LuaForce]], true)
|
module.res_queue(player.force --[[@as LuaForce]], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_name = format_player_name(player)
|
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
|
if not research.res_queue_enable then return end
|
||||||
|
|
||||||
local force = event.research.force
|
local force = event.research.force
|
||||||
if force.rockets_launched > 0 and force.technologies["mining-productivity-4"].level > 4 then
|
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
|
||||||
res_queue(force, event.by_script)
|
module.res_queue(force, event.by_script)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local e = defines.events
|
local e = defines.events
|
||||||
return {
|
--- @package
|
||||||
events = {
|
module.events = {
|
||||||
[e.on_research_finished] = on_research_finished,
|
[e.on_research_finished] = on_research_finished,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return module
|
||||||
|
|||||||
Reference in New Issue
Block a user