Add compatibility for "Any planet start" (Vulcanus)
This commit is contained in:
parent
d15f877fe1
commit
c5d94ec0b9
13 changed files with 89 additions and 40 deletions
|
@ -8,5 +8,3 @@ handler.add_libraries({
|
||||||
require("scripts/to-nauvis"),
|
require("scripts/to-nauvis"),
|
||||||
require("scripts/wooden-rocket-silo")
|
require("scripts/wooden-rocket-silo")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
"?lane-splitters",
|
"?lane-splitters",
|
||||||
"?wood-industry",
|
"?wood-industry",
|
||||||
"?crushing-industry",
|
"?crushing-industry",
|
||||||
|
"?any-planet-start",
|
||||||
"!planet-picker",
|
"!planet-picker",
|
||||||
"!any-planet-start",
|
|
||||||
"!apm_power_ldinc",
|
"!apm_power_ldinc",
|
||||||
"!wood-logistics",
|
"!wood-logistics",
|
||||||
"!early-agriculture",
|
"!early-agriculture",
|
||||||
|
|
|
@ -203,8 +203,8 @@ quality-catalyst-energy-value=Quality value
|
||||||
quality-catalyst=Quality catalyst
|
quality-catalyst=Quality catalyst
|
||||||
|
|
||||||
[lignumis]
|
[lignumis]
|
||||||
start-new-game=Lignumis is meant to be played in a fresh game as it extends the early game before 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 Nauvis
|
provisional-rocket-silo-button=Escape to __1__
|
||||||
provisional-rocket-silo-button-tooltip-inventory=Your personal inventory must be empty!
|
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-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 Nauvis.\nBe sure to take material to jumpstart your iron, copper and wood production.
|
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.
|
||||||
|
|
5
lignumis/migrations/lignumis-1.0.37.lua
Normal file
5
lignumis/migrations/lignumis-1.0.37.lua
Normal 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
|
33
lignumis/prototypes/compatibility/any-planet-start.lua
Normal file
33
lignumis/prototypes/compatibility/any-planet-start.lua
Normal 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
|
|
@ -1,4 +1,5 @@
|
||||||
require("aai-loaders-final")
|
require("aai-loaders-final")
|
||||||
|
require("any-planet-start")
|
||||||
|
|
||||||
if not data.raw.technology["legendary-quality"] then
|
if not data.raw.technology["legendary-quality"] then
|
||||||
table.removeValue(data.raw.technology["quality-assembler"].prerequisites, "legendary-quality")
|
table.removeValue(data.raw.technology["quality-assembler"].prerequisites, "legendary-quality")
|
||||||
|
|
|
@ -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 procession_graphic_catalogue_types = require("__base__/prototypes/planet/procession-graphic-catalogue-types")
|
||||||
local asteroid_util = require("__space-age__/prototypes/planet/asteroid-spawn-definitions")
|
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_chunks = 0.025
|
||||||
local lignumis_ratio = {1, 1, 1 , 0}
|
local lignumis_ratio = {1, 1, 1 , 0}
|
||||||
local nauvis_lignumis = {
|
local nauvis_lignumis = {
|
||||||
|
@ -23,7 +28,7 @@ PlanetsLib:extend({
|
||||||
orbit = {
|
orbit = {
|
||||||
parent = {
|
parent = {
|
||||||
type = "planet",
|
type = "planet",
|
||||||
name = "nauvis"
|
name = target_planet
|
||||||
},
|
},
|
||||||
distance = 2,
|
distance = 2,
|
||||||
orientation = 0.16,
|
orientation = 0.16,
|
||||||
|
@ -116,7 +121,7 @@ data:extend({
|
||||||
type = "space-connection",
|
type = "space-connection",
|
||||||
name = "nauvis-lignumis",
|
name = "nauvis-lignumis",
|
||||||
subgroup = "planet-connections",
|
subgroup = "planet-connections",
|
||||||
from = "nauvis",
|
from = target_planet,
|
||||||
to = "lignumis",
|
to = "lignumis",
|
||||||
order = "0",
|
order = "0",
|
||||||
length = 2000,
|
length = 2000,
|
||||||
|
|
|
@ -6,6 +6,12 @@ local InitExisting = {}
|
||||||
InitExisting.on_init = function()
|
InitExisting.on_init = function()
|
||||||
if game.tick == 0 then return end
|
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 = {}
|
storage.init = {}
|
||||||
for _, player in pairs(game.players) do
|
for _, player in pairs(game.players) do
|
||||||
storage.init[player.index] = true
|
storage.init[player.index] = true
|
||||||
|
|
|
@ -63,6 +63,13 @@ end
|
||||||
InitNew.on_init = function()
|
InitNew.on_init = function()
|
||||||
if game.tick > 0 then return end
|
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_intro()
|
||||||
init_space_locations()
|
init_space_locations()
|
||||||
init_lignumis()
|
init_lignumis()
|
||||||
|
|
|
@ -7,19 +7,6 @@ local Init = {
|
||||||
events = {}
|
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
|
-- Initialize the player
|
||||||
-- Teleport to Lignumis and give some starting items
|
-- Teleport to Lignumis and give some starting items
|
||||||
local function init_player(event)
|
local function init_player(event)
|
||||||
|
@ -74,7 +61,6 @@ end
|
||||||
|
|
||||||
|
|
||||||
Init.events[defines.events.on_player_created] = function(event)
|
Init.events[defines.events.on_player_created] = function(event)
|
||||||
migrate_0_9_6(event)
|
|
||||||
storage.init = storage.init or {}
|
storage.init = storage.init or {}
|
||||||
|
|
||||||
if storage.init[event.player_index] then return end
|
if storage.init[event.player_index] then return end
|
||||||
|
@ -85,9 +71,11 @@ 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.")
|
game.print("While Alien Biomes is playable with Lignumis, it is not recommended as it prevents trees from being generated on Lignumis.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not script.active_mods["any-planet-start"] then
|
||||||
init_player(event)
|
init_player(event)
|
||||||
init_freeplay(event)
|
init_freeplay(event)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Watch Nauvis being visited for the first time
|
-- Watch Nauvis being visited for the first time
|
||||||
|
@ -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.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
|
storage.nauvis_visited = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,4 +141,12 @@ Init.events[defines.events.on_cutscene_cancelled] = function(event)
|
||||||
player.zoom = 1.5
|
player.zoom = 1.5
|
||||||
end
|
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
|
return Init
|
||||||
|
|
|
@ -6,8 +6,6 @@ local ToNauvis = {
|
||||||
events = {}
|
events = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local target_planet = settings.global["lignumis-second-planet"].value or "nauvis"
|
|
||||||
|
|
||||||
-- Chart the starting area for the player
|
-- Chart the starting area for the player
|
||||||
local function chart_starting_area(surface, player)
|
local function chart_starting_area(surface, player)
|
||||||
local r = 200
|
local r = 200
|
||||||
|
@ -20,7 +18,7 @@ end
|
||||||
-- Initialize Nauvis
|
-- Initialize Nauvis
|
||||||
local function init_nauvis()
|
local function init_nauvis()
|
||||||
if storage.nauvis_visited then return end
|
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.request_to_generate_chunks({ 0, 0 }, 3)
|
||||||
nauvis.force_generate_chunk_requests()
|
nauvis.force_generate_chunk_requests()
|
||||||
nauvis.daytime = 0.7
|
nauvis.daytime = 0.7
|
||||||
|
@ -29,12 +27,11 @@ end
|
||||||
|
|
||||||
-- Teleport player to Nauvis and show welcome message
|
-- Teleport player to Nauvis and show welcome message
|
||||||
local function teleport_player(player)
|
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
|
if player.surface.name == "lignumis" then
|
||||||
local position = nauvis.find_non_colliding_position("character", { 0, 0 }, 100, 1) or { 0, 0 }
|
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)
|
chart_starting_area(nauvis, player)
|
||||||
player.print("Oh no, not again. But... Welcome to Nauvis!")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +42,7 @@ local function init_freeplay()
|
||||||
if not remote.interfaces.freeplay then return end
|
if not remote.interfaces.freeplay then return end
|
||||||
|
|
||||||
storage.crashed_ship_nauvis = true
|
storage.crashed_ship_nauvis = true
|
||||||
local nauvis = game.planets[target_planet].surface
|
local nauvis = game.planets[storage.target_planet].surface
|
||||||
local ship_items = {
|
local ship_items = {
|
||||||
["burner-mining-drill"] = 2,
|
["burner-mining-drill"] = 2,
|
||||||
["stone-furnace"] = 2,
|
["stone-furnace"] = 2,
|
||||||
|
|
|
@ -12,16 +12,17 @@ local function build_gui(player, rocket_silo)
|
||||||
position = defines.relative_gui_position.right
|
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 inventory = player.get_main_inventory()
|
||||||
local is_inventory_empty = inventory.is_empty()
|
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
|
launch_button.enabled = is_inventory_empty and is_nauvis_researched
|
||||||
if not is_inventory_empty then
|
if not is_inventory_empty then
|
||||||
launch_button.tooltip = { "lignumis.provisional-rocket-silo-button-tooltip-inventory" }
|
launch_button.tooltip = { "lignumis.provisional-rocket-silo-button-tooltip-inventory" }
|
||||||
elseif not is_nauvis_researched then
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ local function build_gui(player, rocket_silo)
|
||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
anchor = anchor,
|
anchor = anchor,
|
||||||
children = {
|
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",
|
type = "frame",
|
||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
|
@ -46,7 +47,7 @@ local function build_gui(player, rocket_silo)
|
||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
style = "inset_frame_container_vertical_flow",
|
style = "inset_frame_container_vertical_flow",
|
||||||
children = {
|
children = {
|
||||||
{ type = "label", caption = { "lignumis.provisional-rocket-silo-description" } },
|
{ type = "label", caption = { "lignumis.provisional-rocket-silo-description", target_planet_name } },
|
||||||
launch_button
|
launch_button
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ data:extend({
|
||||||
{
|
{
|
||||||
type = "string-setting",
|
type = "string-setting",
|
||||||
name = "lignumis-second-planet",
|
name = "lignumis-second-planet",
|
||||||
setting_type = "runtime-global",
|
setting_type = "startup",
|
||||||
allowed_values = { "nauvis" },
|
allowed_values = { "nauvis" },
|
||||||
default_value = "nauvis",
|
default_value = "nauvis",
|
||||||
hidden = true
|
hidden = true
|
||||||
|
|
Loading…
Add table
Reference in a new issue