-payload victory requirement, +space science tech, -some bugs

This commit is contained in:
Peter 2019-01-15 20:48:17 +08:00
parent ec6495dbd8
commit 2bc071887e
7 changed files with 215 additions and 76 deletions

View File

@ -1,15 +1,21 @@
if settings.startup["017-axe"].value then local function disable_silo_script()
local function generate_axes() if remote.interfaces["silo_script"] then
-- game.print("gen_ax") remote.call("silo_script","set_finish_on_launch", false)
global.axe_techs = {} remote.call("silo_script","set_show_launched_without_satellite", false)
for _, axe in pairs(game.item_prototypes) do end
if axe.attack_range then end
global.axe_techs[#global.axe_techs+1] = {axe.name,axe.speed} local function generate_axes()
end -- game.print("gen_ax")
global.axe_techs = {}
for _, axe in pairs(game.item_prototypes) do
if axe.attack_range then
global.axe_techs[#global.axe_techs+1] = {axe.name,axe.speed}
end end
end end
end
if settings.startup["017-axe"].value then
local function ax_gen() local function ax_gen()
if global.axe_techs == nil then if global.axe_techs == nil then
generate_axes() generate_axes()
@ -76,11 +82,6 @@ if settings.startup["017-axe"].value then
end end
end end
script.on_init(function()
global.axe_techs = {}
generate_axes()
end)
-- init_game -- init_game
-- script.on_configuration_changed(function() configuration_changed = 1 game.print("changed") end) -- script.on_configuration_changed(function() configuration_changed = 1 game.print("changed") end)
@ -154,3 +155,106 @@ if settings.startup["017-axe"].value then
-- end) -- end)
end end
if settings.startup["017-rocket-victory"].value then
script.on_event(defines.events.on_rocket_launched, function(event)
if game.active_mods["SpaceMod"] then
-- game.print("SpaceMod installed: not enabling victory")
else
game.set_game_state{game_finished = true, player_won = true, can_continue = true}
end
end)
end
local function initialize()
if settings.startup["017-axe"].value then
global.axe_techs = {}
generate_axes()
end
if settings.startup["017-rocket-victory"].value then
disable_silo_script()
end
end
script.on_configuration_changed(function()
initialize()
if settings.startup["017-rocket-victory"].value and not settings.startup["017-techtree"].value then
for i, force in pairs(game.forces) do
if force.technologies["rocket-silo"].researched == true then
force.recipes["satellite"].enabled = true
end
end
end
if settings.startup["017-rocket-victory"].value and settings.startup["017-techtree"].value then
for i, force in pairs(game.forces) do
local get_input_count = force.item_production_statistics.get_input_count
if get_input_count("space-science-pack") > 0 then
force.recipes["satellite"].enabled = true
force.technologies["space-science-pack"].researched = true
force.print("force: " .. force.name .. " | space-science-pack tech unlocked | total produced for force: " .. get_input_count("space-science-pack"))
else
force.recipes["satellite"].enabled = false
force.technologies["space-science-pack"].researched = false
force.print("No space science produced by this force: keeping technology locked.")
end
end
end
if settings.startup["017-techtree"].value then
for i, force in pairs(game.forces) do
local get_input_count = force.item_production_statistics.get_input_count
if get_input_count("science-pack-2") > 0 then
force.recipes["science-pack-2"].enabled = true
force.technologies["logistics-science-pack"].researched = true
force.print("force: " .. force.name .. " | logistics-science-pack tech unlocked | total produced for force: " .. get_input_count("science-pack-2"))
else
force.recipes["science-pack-2"].enabled = false
force.technologies["logistics-science-pack"].researched = false
force.print("No logistics science produced by this force: keeping technology locked.")
end
if get_input_count("science-pack-3") > 0 then
force.recipes["science-pack-3"].enabled = true
force.recipes["17-chemical-science-pack"].enabled = true
force.technologies["chemical-science-pack"].researched = true
force.print("force: " .. force.name .. " | chemical-science-pack tech unlocked | total produced for force: " .. get_input_count("science-pack-3"))
else
force.recipes["science-pack-3"].enabled = false
force.recipes["17-chemical-science-pack"].enabled = false
force.technologies["chemical-science-pack"].researched = false
force.print("No chemical science produced by this force: keeping technology locked.")
end
if get_input_count("production-science-pack") > 0 then
force.recipes["production-science-pack"].enabled = true
force.recipes["17-production-science-pack"].enabled = true
force.technologies["production-science-pack"].researched = true
force.print("force: " .. force.name .. " | production-science-pack tech unlocked | total produced for force: " .. get_input_count("production-science-pack"))
else
force.recipes["production-science-pack"].enabled = false
force.recipes["17-production-science-pack"].enabled = false
force.technologies["production-science-pack"].researched = false
force.print("No production science produced by this force: keeping technology locked.")
end
if get_input_count("high-tech-science-pack") > 0 then
force.recipes["high-tech-science-pack"].enabled = true
force.recipes["17-utility-science-pack"].enabled = true
force.technologies["utility-science-pack"].researched = true
force.print("force: " .. force.name .. " | high-tech-science-pack tech unlocked | total produced for force: " .. get_input_count("high-tech-science-pack"))
else
force.recipes["high-tech-science-pack"].enabled = false
force.recipes["17-utility-science-pack"].enabled = false
force.technologies["utility-science-pack"].researched = false
force.print("No utility science produced by this force: keeping technology locked.")
end
end
end
for i, force in pairs(game.forces) do
force.reset_recipes()
end
for i, force in pairs(game.forces) do
force.reset_technologies()
end
end)
script.on_init(initialize)

View File

@ -60,6 +60,10 @@ local r_effects = data.raw["technology"]["rocket-silo"].effects --remove the dup
for _=1, #r_effects do for _=1, #r_effects do
if r_effects[_].type == "unlock-recipe" and (r_effects[_].recipe == "low-density-structure" or r_effects[_].recipe == "rocket-fuel" or r_effects[_].recipe == "rocket-control-unit") then if r_effects[_].type == "unlock-recipe" and (r_effects[_].recipe == "low-density-structure" or r_effects[_].recipe == "rocket-fuel" or r_effects[_].recipe == "rocket-control-unit") then
r_effects[_] = nil r_effects[_] = nil
elseif settings.startup["017-techtree"].value and settings.startup["017-rocket-victory"].value then
if r_effects[_].type == "unlock-recipe" and r_effects[_].recipe == "satellite" then
r_effects[_] = nil
end
end end
end end
@ -159,13 +163,13 @@ if settings.startup["017-techtree"].value then
end end
for _, tech in pairs(data.raw["technology"]) do for _, tech in pairs(data.raw["technology"]) do
if tech.name ~= ("logistics-science-pack" or "chemical-science-pack" or "production-science-pack" or "utility-science-pack") then if tech.name ~= ("logistics-science-pack" or "chemical-science-pack" or "production-science-pack" or "utility-science-pack" or "space-science-pack") then
if tech.effects then if tech.effects then
if #tech.effects ~= 0 then if #tech.effects ~= 0 then
for i=1, #tech.effects do for i, effect in pairs(tech.effects) do
if tech.effects[i] then if effect then
if tech.effects[i].type then if effect.type then
if tech.effects[i].type == "unlock-recipe" then if effect.type == "unlock-recipe" then
whitelisted = true whitelisted = true
break break
else else
@ -175,14 +179,31 @@ if settings.startup["017-techtree"].value then
end end
end end
end end
if settings.startup["017-rocket-victory"].value then
if whitelisted == false then
if tech.unit then
if tech.unit.ingredients then
for j, nasa in pairs(tech.unit.ingredients) do
if nasa[1] == "space-science-pack" then
compare(tech, "space-science-pack", "space-science-pack")
break
else
whitelisted = false
end
end
end
end
end
end
if whitelisted == true then if whitelisted == true then
local valid = compare(tech, "logistics-science-pack", "science-pack-2") local valid = compare(tech, "logistics-science-pack", "science-pack-2")
if valid == false then if valid == false then
local valid = compare(tech, "chemical-science-pack", "science-pack-3") end local valid = compare(tech, "chemical-science-pack", "science-pack-3") end
if valid == false then if valid == false then
local valid = compare(tech, "production-science-pack", "production-science-pack") end local valid = compare(tech, "production-science-pack", "production-science-pack") end
if valid == false then if valid == false then
local valid = compare(tech, "utility-science-pack", "high-tech-science-pack") end compare(tech, "utility-science-pack", "high-tech-science-pack")
end
end end
end end
end end

View File

@ -1,6 +1,6 @@
{ {
"name": "017_science", "name": "017_science",
"version": "0.0.16", "version": "0.0.17",
"factorio_version": "0.16", "factorio_version": "0.16",
"title": "0.17 science conversion", "title": "0.17 science conversion",
"author": "npc_strider(morley376)", "author": "npc_strider(morley376)",

View File

@ -4,6 +4,7 @@ logistics-science-pack=Logistics science pack
chemical-science-pack=Chemical science pack chemical-science-pack=Chemical science pack
production-science-pack=Production science pack production-science-pack=Production science pack
utility-science-pack=Utility science pack utility-science-pack=Utility science pack
space-science-pack=Space science pack
[item-name] [item-name]
science-pack-1=Automation science pack science-pack-1=Automation science pack
@ -26,14 +27,17 @@ high-tech-science-pack=Utility science pack
017-pack-type-rebalancing=Science pack type rebalancing 017-pack-type-rebalancing=Science pack type rebalancing
017-techtree=Science-pack technologies and techtree 017-techtree=Science-pack technologies and techtree
017-nuclear-reprocessing-discount=nuclear-fuel-reprocessing technology discount 017-nuclear-reprocessing-discount=nuclear-fuel-reprocessing technology discount
017-rocket-victory=No-rocket victory
017-green-cost=Logistics science pack technology cost 017-green-cost=Logistics science pack technology cost
017-chem-cost=Chemical science pack technology cost 017-chem-cost=Chemical science pack technology cost
017-purple-cost=Production science pack technology cost 017-purple-cost=Production science pack technology cost
017-gold-cost=Utility science pack technology cost 017-gold-cost=Utility science pack technology cost
017-nasa-cost=Space science pack technology cost
017-green-energy=Logistics science pack technology time-per-unit 017-green-energy=Logistics science pack technology time-per-unit
017-chem-energy=Chemical science pack technology time-per-unit 017-chem-energy=Chemical science pack technology time-per-unit
017-purple-energy=Production science pack technology time-per-unit 017-purple-energy=Production science pack technology time-per-unit
017-gold-energy=Utility science pack technology time-per-unit 017-gold-energy=Utility science pack technology time-per-unit
017-nasa-energy=Space science pack technology time-per-unit
[mod-setting-description] [mod-setting-description]
017-drill=(Default enabled) Toggle FFF-266 mining changes (removed hardness). This mod makes all vanilla ore hardness = 1 and makes the burner-mining-drill mining_power = 3, which may break modded ore gating. 017-drill=(Default enabled) Toggle FFF-266 mining changes (removed hardness). This mod makes all vanilla ore hardness = 1 and makes the burner-mining-drill mining_power = 3, which may break modded ore gating.
@ -48,12 +52,15 @@ high-tech-science-pack=Utility science pack
017-lds-num=(Default 5, Min 1, Max 32) When steel-plate is not present in vanilla 'high tech' equipment recipes, the cost is determined by the number of "processing-unit"s. math.ceil(n("processing-unit")/thissetting) 017-lds-num=(Default 5, Min 1, Max 32) When steel-plate is not present in vanilla 'high tech' equipment recipes, the cost is determined by the number of "processing-unit"s. math.ceil(n("processing-unit")/thissetting)
017-pack-type-rebalancing=(Default enabled) Enable the rebalancing of high-end technologies into production/utility 'categories' (FFF-275). For example, level-3 modules no longer use utility science and will use production science instead as they increase production. 017-pack-type-rebalancing=(Default enabled) Enable the rebalancing of high-end technologies into production/utility 'categories' (FFF-275). For example, level-3 modules no longer use utility science and will use production science instead as they increase production.
017-techtree=(Default enabled) Enable the 0.17 techtree. Science packs are now unlocked by dedicated technologies and the rocket-silo no longer requires rocket-speed-5 as a prerequisite (FFF-275 & FFF-245). NOTE: Technologies are dynamically assigned a 'science pack technology' as a prerequisite through script (to work with mods). This may not reflect release tech paths. 017-techtree=(Default enabled) Enable the 0.17 techtree. Science packs are now unlocked by dedicated technologies and the rocket-silo no longer requires rocket-speed-5 as a prerequisite (FFF-275 & FFF-245). NOTE: Technologies are dynamically assigned a 'science pack technology' as a prerequisite through script (to work with mods). This may not reflect release tech paths.
017-rocket-victory=(Default enabled) The victory condition for the game no longer requires a payload (satellite) (FFF-275).
017-nuclear-reprocessing-discount=(Default 1000, Min 0, Max 1400) This number is subtracted from the current cost of nuclear-fuel-reprocessing technology (1500). FFF-275 hints at a major discount to this technology ("The Nuclear fuel cell reprocessing is also drastically cheaper") but does not specify an amount. 017-nuclear-reprocessing-discount=(Default 1000, Min 0, Max 1400) This number is subtracted from the current cost of nuclear-fuel-reprocessing technology (1500). FFF-275 hints at a major discount to this technology ("The Nuclear fuel cell reprocessing is also drastically cheaper") but does not specify an amount.
017-green-cost=(Default 50, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. 017-green-cost=(Default 50, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off steel-processing difficulty
017-chem-cost=(Default 200, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. 017-chem-cost=(Default 200, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off advanced-electronics difficulty
017-purple-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. 017-purple-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off advanced-material-processing-2 difficulty.
017-gold-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. 017-gold-cost=(Default 250, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off advanced-electronics-2 difficulty.
017-nasa-cost=(Default 5000, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Default based off atomic-bomb technology difficulty.
017-green-energy=(Default 5, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology. 017-green-energy=(Default 5, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-chem-energy=(Default 15, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology. 017-chem-energy=(Default 15, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-purple-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology. 017-purple-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-gold-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology. 017-gold-energy=(Default 30, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.
017-nasa-energy=(Default 60, Min 0, Max INF.) This value is NOT official and is an estimate based on the difficulty of similar technologies. Amount of time to research one unit of this technology.

View File

@ -1,26 +0,0 @@
for i, force in pairs(game.forces) do
local get_input_count = force.item_production_statistics.get_input_count
if get_input_count("science-pack-2") > 0 then
force.recipes["science-pack-2"].enabled = true
force.technologies["logistics-science-pack"].researched = true
-- game.print(force.name .. " | " .. "science-pack-2" .. " | " .. get_input_count("science-pack-2"))
end
if get_input_count("science-pack-3") > 0 then
force.recipes["science-pack-3"].enabled = true
force.recipes["17-chemical-science-pack"].enabled = true
force.technologies["chemical-science-pack"].researched = true
-- game.print(force.name .. " | " .. "science-pack-3" .. " | " .. get_input_count("science-pack-3"))
end
if get_input_count("production-science-pack") > 0 then
force.recipes["production-science-pack"].enabled = true
force.recipes["17-production-science-pack"].enabled = true
force.technologies["production-science-pack"].researched = true
-- game.print(force.name .. " | " .. "production-science-pack" .. " | " .. get_input_count("production-science-pack"))
end
if get_input_count("high-tech-science-pack") > 0 then
force.recipes["high-tech-science-pack"].enabled = true
force.recipes["17-utility-science-pack"].enabled = true
force.technologies["utility-science-pack"].researched = true
-- game.print(force.name .. " | " .. "high-tech-science-pack" .. " | " .. get_input_count("high-tech-science-pack"))
end
end

View File

@ -94,6 +94,13 @@ data:extend(
setting_type = "startup", setting_type = "startup",
default_value = true, default_value = true,
order = "npc-m" order = "npc-m"
},
{
type = "bool-setting",
name = "017-rocket-victory",
setting_type = "startup",
default_value = true,
order = "npc-me"
}, },
{ {
type = "int-setting", type = "int-setting",
@ -126,6 +133,14 @@ data:extend(
minimum_value = 0, minimum_value = 0,
default_value = 250, default_value = 250,
order = "npc-nd" order = "npc-nd"
},
{
type = "int-setting",
name = "017-nasa-cost",
setting_type = "startup",
minimum_value = 0,
default_value = 5000,
order = "npc-ne"
}, },
{ {
type = "int-setting", type = "int-setting",
@ -157,6 +172,14 @@ data:extend(
setting_type = "startup", setting_type = "startup",
minimum_value = 0, minimum_value = 0,
default_value = 30, default_value = 30,
order = "npc-od"
},
{
type = "int-setting",
name = "017-nasa-energy",
setting_type = "startup",
minimum_value = 0,
default_value = 60,
order = "npc-oe" order = "npc-oe"
} }
}) })

View File

@ -91,28 +91,38 @@ data:extend(
time = settings.startup["017-gold-energy"].value time = settings.startup["017-gold-energy"].value
}, },
order = "e-e-e" order = "e-e-e"
}--, (NEXT UPDATE! SPACE SCIENCE + SATELLITE REBALANCING) }
-- { })
-- type = "technology", end
-- name = "space-science-pack",
-- icon_size = 128, if settings.startup["017-techtree"].value and settings.startup["017-rocket-victory"].value then
-- icon = "__017_science__/graphics/technology/white.png", data:extend(
-- effects = {
-- { {
-- {type = "unlock-recipe", recipe = "17-utility-science-pack"} type = "technology",
-- }, name = "space-science-pack",
-- unit = icon_size = 128,
-- { icon = "__017_science__/graphics/technology/white.png",
-- count = 250, effects =
-- ingredients = {
-- { {type = "unlock-recipe", recipe = "satellite"}
-- {"science-pack-1", 1}, },
-- {"science-pack-2", 1}, prerequisites = {"rocket-silo"},
-- {"science-pack-3", 1}, unit =
-- }, {
-- time = 15 count = settings.startup["017-nasa-cost"].value,
-- }, ingredients =
-- order = "a-d-b-a" {
-- } {"science-pack-1", 1},
{"science-pack-2", 1},
{"science-pack-3", 1},
{"military-science-pack", 1},
{"production-science-pack", 1},
{"high-tech-science-pack", 1}
},
time = settings.startup["017-nasa-energy"].value,
},
order = "k-b"
}
}) })
end end