Add compatibility for "Any planet start" (Vulcanus)

This commit is contained in:
Simon Brodtmann 2025-03-28 00:24:51 +01:00
parent d15f877fe1
commit c5d94ec0b9
13 changed files with 89 additions and 40 deletions

View file

@ -8,5 +8,3 @@ handler.add_libraries({
require("scripts/to-nauvis"),
require("scripts/wooden-rocket-silo")
})

View file

@ -32,8 +32,8 @@
"?lane-splitters",
"?wood-industry",
"?crushing-industry",
"?any-planet-start",
"!planet-picker",
"!any-planet-start",
"!apm_power_ldinc",
"!wood-logistics",
"!early-agriculture",

View file

@ -203,8 +203,8 @@ quality-catalyst-energy-value=Quality value
quality-catalyst=Quality catalyst
[lignumis]
start-new-game=Lignumis is meant to be played in a fresh game as it extends the early game before Nauvis.
provisional-rocket-silo-button=Escape to Nauvis
start-new-game=Lignumis is meant to be played in a fresh game as it extends the early game.
provisional-rocket-silo-button=Escape to __1__
provisional-rocket-silo-button-tooltip-inventory=Your personal inventory must be empty!
provisional-rocket-silo-button-tooltip-nauvis=You don't know yet where to go!
provisional-rocket-silo-description=Fill the rocket inventory and launch the rocket to escape to Nauvis.\nBe sure to take material to jumpstart your iron, copper and wood production.
provisional-rocket-silo-button-tooltip-target=You don't know yet where to go!
provisional-rocket-silo-description=Fill the rocket inventory and launch the rocket to escape to __1__.\nBe sure to take material to jumpstart your iron, copper and wood production.

View file

@ -0,0 +1,5 @@
storage.target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
if script.active_mods["any-planet-start"] then
storage.target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or storage.target_planet
end

View file

@ -0,0 +1,33 @@
local Technology = require("__cf-lib__/data/Technology")
if not mods["any-planet-start"] then return end
if settings.startup["aps-planet"].value == "vulcanus" then
Technology:new("planet-discovery-vulcanus")
:assign({
enabled = true,
hidden = false,
unit = {
count = 100,
ingredients = {
{ "wood-science-pack", 1 },
{ "steam-science-pack", 1 }
},
time = 30
}
})
:addPrerequisite("provisional-rocketry")
Technology:new("copper-processing"):replacePrerequisite("planet-discovery-nauvis", "planet-discovery-vulcanus")
Technology:new("iron-processing"):replacePrerequisite("planet-discovery-nauvis", "planet-discovery-vulcanus")
Technology:new("automation"):addPrerequisite("iron-processing")
Technology:new("steel-processing"):addPrerequisite("iron-processing")
Technology:new("tungsten-carbide"):addPrerequisite("planet-discovery-vulcanus")
Technology:new("iron-processing")
:addPrerequisite("planet-discovery-vulcanus")
.prototype.research_trigger.entity = "big-volcanic-rock"
Technology:new("copper-processing")
:addPrerequisite("planet-discovery-vulcanus")
.prototype.research_trigger.entity = "big-volcanic-rock"
end

View file

@ -1,4 +1,5 @@
require("aai-loaders-final")
require("any-planet-start")
if not data.raw.technology["legendary-quality"] then
table.removeValue(data.raw.technology["quality-assembler"].prerequisites, "legendary-quality")

View file

@ -3,6 +3,11 @@ local effects = require("__core__/lualib/surface-render-parameter-effects")
local procession_graphic_catalogue_types = require("__base__/prototypes/planet/procession-graphic-catalogue-types")
local asteroid_util = require("__space-age__/prototypes/planet/asteroid-spawn-definitions")
local target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
if mods["any-planet-start"] then
target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or target_planet
end
local lignumis_chunks = 0.025
local lignumis_ratio = {1, 1, 1 , 0}
local nauvis_lignumis = {
@ -23,7 +28,7 @@ PlanetsLib:extend({
orbit = {
parent = {
type = "planet",
name = "nauvis"
name = target_planet
},
distance = 2,
orientation = 0.16,
@ -116,7 +121,7 @@ data:extend({
type = "space-connection",
name = "nauvis-lignumis",
subgroup = "planet-connections",
from = "nauvis",
from = target_planet,
to = "lignumis",
order = "0",
length = 2000,

View file

@ -6,6 +6,12 @@ local InitExisting = {}
InitExisting.on_init = function()
if game.tick == 0 then return end
storage.target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
if script.active_mods["any-planet-start"] then
storage.target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or storage.target_planet
end
storage.init = {}
for _, player in pairs(game.players) do
storage.init[player.index] = true

View file

@ -63,6 +63,13 @@ end
InitNew.on_init = function()
if game.tick > 0 then return end
storage.target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
if script.active_mods["any-planet-start"] then
storage.target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or storage.target_planet
remote.call("APS", "override_planet", "lignumis")
end
init_intro()
init_space_locations()
init_lignumis()

View file

@ -7,19 +7,6 @@ local Init = {
events = {}
}
local target_planet = settings.global["lignumis-second-planet"].value or "nauvis"
-- Migrate storage init as it was just a boolean before not supporting multiple players
local function migrate_0_9_6(event)
if storage.init and type(storage.init) == "boolean" then
storage.init = {
[event.player_index] = true
}
end
end
-- Initialize the player
-- Teleport to Lignumis and give some starting items
local function init_player(event)
@ -74,7 +61,6 @@ end
Init.events[defines.events.on_player_created] = function(event)
migrate_0_9_6(event)
storage.init = storage.init or {}
if storage.init[event.player_index] then return end
@ -85,8 +71,10 @@ Init.events[defines.events.on_player_created] = function(event)
game.print("While Alien Biomes is playable with Lignumis, it is not recommended as it prevents trees from being generated on Lignumis.")
end
init_player(event)
init_freeplay(event)
if not script.active_mods["any-planet-start"] then
init_player(event)
init_freeplay(event)
end
end
@ -96,7 +84,7 @@ Init.events[defines.events.on_player_changed_surface] = function(event)
if player.controller_type ~= defines.controllers.character then return end
if player and player.surface.name == target_planet then
if player and player.surface.name == storage.target_planet then
storage.nauvis_visited = true
end
@ -153,4 +141,12 @@ Init.events[defines.events.on_cutscene_cancelled] = function(event)
player.zoom = 1.5
end
Init.on_configuration_changed = function()
storage.target_planet = settings.startup["lignumis-second-planet"].value or "nauvis"
if script.active_mods["any-planet-start"] then
storage.target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or storage.target_planet
end
end
return Init

View file

@ -6,8 +6,6 @@ local ToNauvis = {
events = {}
}
local target_planet = settings.global["lignumis-second-planet"].value or "nauvis"
-- Chart the starting area for the player
local function chart_starting_area(surface, player)
local r = 200
@ -20,7 +18,7 @@ end
-- Initialize Nauvis
local function init_nauvis()
if storage.nauvis_visited then return end
local nauvis = game.planets[target_planet].create_surface()
local nauvis = game.planets[storage.target_planet].create_surface()
nauvis.request_to_generate_chunks({ 0, 0 }, 3)
nauvis.force_generate_chunk_requests()
nauvis.daytime = 0.7
@ -29,12 +27,11 @@ end
-- Teleport player to Nauvis and show welcome message
local function teleport_player(player)
local nauvis = game.planets[target_planet].surface
local nauvis = game.planets[storage.target_planet].surface
if player.surface.name == "lignumis" then
local position = nauvis.find_non_colliding_position("character", { 0, 0 }, 100, 1) or { 0, 0 }
player.teleport(position, target_planet)
player.teleport(position, storage.target_planet)
chart_starting_area(nauvis, player)
player.print("Oh no, not again. But... Welcome to Nauvis!")
end
end
@ -45,7 +42,7 @@ local function init_freeplay()
if not remote.interfaces.freeplay then return end
storage.crashed_ship_nauvis = true
local nauvis = game.planets[target_planet].surface
local nauvis = game.planets[storage.target_planet].surface
local ship_items = {
["burner-mining-drill"] = 2,
["stone-furnace"] = 2,

View file

@ -12,16 +12,17 @@ local function build_gui(player, rocket_silo)
position = defines.relative_gui_position.right
}
local launch_button = { type = "button", name = "provisional-rocket-silo-launch-button", caption = { "lignumis.provisional-rocket-silo-button" } }
local target_planet_name = { "space-location-name." .. storage.target_planet }
local launch_button = { type = "button", name = "provisional-rocket-silo-launch-button", caption = { "lignumis.provisional-rocket-silo-button", target_planet_name } }
local inventory = player.get_main_inventory()
local is_inventory_empty = inventory.is_empty()
local is_nauvis_researched = player.force.technologies["planet-discovery-nauvis"].researched
local is_nauvis_researched = player.force.technologies["planet-discovery-" .. storage.target_planet].researched
launch_button.enabled = is_inventory_empty and is_nauvis_researched
if not is_inventory_empty then
launch_button.tooltip = { "lignumis.provisional-rocket-silo-button-tooltip-inventory" }
elseif not is_nauvis_researched then
launch_button.tooltip = { "lignumis.provisional-rocket-silo-button-tooltip-nauvis" }
launch_button.tooltip = { "lignumis.provisional-rocket-silo-button-tooltip-target" }
end
@ -35,7 +36,7 @@ local function build_gui(player, rocket_silo)
direction = "vertical",
anchor = anchor,
children = {
{ type = "label", style = "frame_title", caption = { "lignumis.provisional-rocket-silo-button" }, ignored_by_interaction = true },
{ type = "label", style = "frame_title", caption = { "lignumis.provisional-rocket-silo-button", target_planet_name }, ignored_by_interaction = true },
{
type = "frame",
direction = "vertical",
@ -46,7 +47,7 @@ local function build_gui(player, rocket_silo)
direction = "vertical",
style = "inset_frame_container_vertical_flow",
children = {
{ type = "label", caption = { "lignumis.provisional-rocket-silo-description" } },
{ type = "label", caption = { "lignumis.provisional-rocket-silo-description", target_planet_name } },
launch_button
}
}

View file

@ -58,7 +58,7 @@ data:extend({
{
type = "string-setting",
name = "lignumis-second-planet",
setting_type = "runtime-global",
setting_type = "startup",
allowed_values = { "nauvis" },
default_value = "nauvis",
hidden = true