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:
@@ -5,77 +5,154 @@ return {
|
||||
enabled = true,
|
||||
pollution_ageing_by_research = false,
|
||||
queue_amount = 3,
|
||||
mod_set = "base",
|
||||
mod_set_lookup = {
|
||||
"space-age"
|
||||
},
|
||||
-- this enable 20 more inventory for each mining productivity level up to 4
|
||||
bonus_inventory = {
|
||||
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",
|
||||
rate = 5,
|
||||
limit = 20,
|
||||
},
|
||||
file_name = "log/research.log",
|
||||
milestone = {
|
||||
["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-electronics"] = 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,
|
||||
["advanced-electronics-2"] = 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,
|
||||
["rocket-control-unit"] = 300,
|
||||
["speed-module-3"] = 300,
|
||||
["rocket-silo"] = 300,
|
||||
["space-science-pack"] = 300,
|
||||
["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-electronics"] = 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,
|
||||
["advanced-electronics-2"] = 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
|
||||
},
|
||||
["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 = {
|
||||
-- Mining Productivity
|
||||
["mining-productivity-4"] = 4,
|
||||
-- Robot Speed
|
||||
["worker-robots-speed-6"] = 6,
|
||||
-- Laser Damage
|
||||
["energy-weapons-damage-7"] = 7,
|
||||
-- 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,
|
||||
["base"] = {
|
||||
-- Mining Productivity
|
||||
["mining-productivity-4"] = 4,
|
||||
-- Robot Speed
|
||||
["worker-robots-speed-6"] = 6,
|
||||
-- Laser Damage
|
||||
["energy-weapons-damage-7"] = 7,
|
||||
-- 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
|
||||
},
|
||||
["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 write_file = helpers.write_file
|
||||
|
||||
local research = {}
|
||||
local research = {
|
||||
time = {},
|
||||
res_queue_enable = false
|
||||
}
|
||||
|
||||
Storage.register(research, function(tbl)
|
||||
research = tbl
|
||||
end)
|
||||
|
||||
research.time = {}
|
||||
research.res_queue_enable = false
|
||||
for i = 1, #config.mod_set_lookup do
|
||||
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 empty_time = research_time_format(nil)
|
||||
@@ -38,7 +46,7 @@ do
|
||||
local res_total = 0
|
||||
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
|
||||
res["lookup_name"][k] = i
|
||||
res_total = res_total + v * 60
|
||||
@@ -89,9 +97,9 @@ local function research_res_n(res_)
|
||||
end
|
||||
|
||||
local function research_notification(event)
|
||||
if config.inf_res[event.research.name] then
|
||||
if event.research.name == "mining-productivity-4" then
|
||||
if event.research.level == 5 then
|
||||
if config.inf_res[config.mod_set][event.research.name] then
|
||||
if event.research.name == config.bonus_inventory.res[config.mod_set].name then
|
||||
if event.research.level == config.bonus_inventory.res[config.mod_set].level + 1 then
|
||||
-- Add run result to log
|
||||
research_add_log()
|
||||
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
|
||||
|
||||
--- @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