From dfea26a7cf7f3391e59c0011a6b2fba814797cbb Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Mon, 6 Jan 2025 01:38:29 +0100 Subject: [PATCH] Add transition to Nauvis --- README.md | 5 +- lignumis/control.lua | 11 ++-- lignumis/locale/en/strings.cfg | 2 + .../prototypes/content/wooden-rocket-silo.lua | 51 +++++-------------- lignumis/prototypes/technology.lua | 25 +++++---- lignumis/script/to-nauvis.lua | 40 +++++++++++++++ 6 files changed, 75 insertions(+), 59 deletions(-) create mode 100644 lignumis/script/to-nauvis.lua diff --git a/README.md b/README.md index 47eab14..918fcf8 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,7 @@ Dive into the world of Lignumis, a moon of Nauvis offering only the most basic t - Move wood and lumber to its own fuel category - Make seeds burnable again - - Make rocket silo work (incl. transition to Nauvis) - - ~~Add ammo turret~~ - Add recipe for moist stromatolite remnants for regular furnace - - ~~Make enemies work~~ - Make mod "Wooden logistics" optional - Balance pollution (noise) - Tweak enemies + warfare (add damage research) @@ -19,13 +16,13 @@ Dive into the world of Lignumis, a moon of Nauvis offering only the most basic t - Add burner radar - Balance resources - Force start with wooden ammo - - Add robots (simple robots inspired by https://mods.factorio.com/mod/copper-construction-robots; gold and copper variant) - Remove stromatolite (non-plant)? - Guarantee spawn of gold in starting area - Fix pipe graphics on desiccation furnace - Change color of gold soil - Ban huge rocks with coal from Nauvis - Increase default moisture bias + - Create proper experience for the transition to Nauvis with a custom UI with launch button ## Credits diff --git a/lignumis/control.lua b/lignumis/control.lua index d1993c6..a89b78c 100644 --- a/lignumis/control.lua +++ b/lignumis/control.lua @@ -1,3 +1,5 @@ +require("script/to-nauvis") + local crash_site = require("crash-site") local util = require("util") local e = defines.events @@ -56,10 +58,6 @@ script.on_event(e.on_player_created, function(event) storage.crashed_ship_parts = remote.call("freeplay", "get_ship_parts") storage.starting_message = remote.call("freeplay", "get_custom_intro_message") - log(serpent.block(storage.crashed_ship_items)) - log(serpent.block(storage.crashed_debris_items)) - log(serpent.block(storage.crashed_ship_parts)) - local ship_items = { ["wood-darts-magazine"] = 8 } local debris_items = { ["lumber"] = 8 } @@ -89,10 +87,7 @@ local get_starting_message = function() if storage.custom_intro_message then return storage.custom_intro_message end - if script.active_mods["space-age"] then - return { "msg-intro-space-age" } - end - return { "msg-intro" } + return { "msg-intro-space-age" } end local function show_intro_message(player) diff --git a/lignumis/locale/en/strings.cfg b/lignumis/locale/en/strings.cfg index f6251dc..00de6ce 100644 --- a/lignumis/locale/en/strings.cfg +++ b/lignumis/locale/en/strings.cfg @@ -46,9 +46,11 @@ gold-plate=Gold plate gold-cable=Gold cable moist-stromatolite-remnant=Moist stromatolite remnant steam-science-pack=Steam science pack +destination-nauvis=Travel to Nauvis [item-description] wooden-wall=Use wooden walls to protect your base from the locals and to reduce noise levels. +destination-nauvis=Insert this item into a rocket to travel to Nauvis. Notice that you won't come back for a while. [fluid-name] wood-pulp=Wood pulp diff --git a/lignumis/prototypes/content/wooden-rocket-silo.lua b/lignumis/prototypes/content/wooden-rocket-silo.lua index 608585f..206c117 100644 --- a/lignumis/prototypes/content/wooden-rocket-silo.lua +++ b/lignumis/prototypes/content/wooden-rocket-silo.lua @@ -89,40 +89,6 @@ local rocket_part_recipe = { allow_productivity = true } -local satellite_item = { - type = "item", - name = "satellite", - icon = "__base__/graphics/icons/satellite.png", - subgroup = "space-related", - order = "d[rocket-parts]-e[satellite]", - inventory_move_sound = item_sounds.mechanical_inventory_move, - pick_sound = item_sounds.mechanical_inventory_pickup, - drop_sound = item_sounds.mechanical_inventory_move, - stack_size = 1, - weight = 1 * tons, - rocket_launch_products = {{type = "item", name = "destination-nauvis", amount = 1}}, - send_to_orbit_mode = "automated" -} - -local satellite_recipe = { - type = "recipe", - name = "satellite", - energy_required = 5, - enabled = false, - category = "crafting", - ingredients = - { - { type = "item", name = "low-density-structure", amount = 100 }, - { type = "item", name = "solar-panel", amount = 100 }, - { type = "item", name = "accumulator", amount = 100 }, - { type = "item", name = "radar", amount = 5 }, - { type = "item", name = "processing-unit", amount = 100 }, - { type = "item", name = "rocket-fuel", amount = 50 } - }, - results = { { type = "item", name = "satellite", amount = 1 } }, - requester_paste_multiplier = 1 -} - local nauvis_item = { type = "item", name = "destination-nauvis", @@ -133,7 +99,17 @@ local nauvis_item = { pick_sound = item_sounds.mechanical_inventory_pickup, drop_sound = item_sounds.mechanical_inventory_move, stack_size = 1, - weight = 1 * tons + weight = 1 * tons, + send_to_orbit_mode = "automated", + spoil_ticks = 60 * 60 * 10 +} + +local nauvis_recipe = { + type = "recipe", + name = "destination-nauvis", + enabled = false, + ingredients = {}, + results = { { type = "item", name = "destination-nauvis", amount = 1 } } } data:extend({ @@ -142,7 +118,6 @@ data:extend({ silo_recipe, rocket, rocket_part_recipe, - satellite_item, - satellite_recipe, - nauvis_item + nauvis_item, + nauvis_recipe }) diff --git a/lignumis/prototypes/technology.lua b/lignumis/prototypes/technology.lua index a955bb7..4c71b83 100644 --- a/lignumis/prototypes/technology.lua +++ b/lignumis/prototypes/technology.lua @@ -5,11 +5,22 @@ data:extend({ icons = util.technology_icon_constant_planet("__lignumis__/graphics/technology/nauvis.png"), icon_size = 256, essential = true, - effects = { { - type = "unlock-space-location", - space_location = "nauvis", - use_icon_overlay_constant = true - } }, + effects = { + { + type = "unlock-space-location", + space_location = "nauvis", + use_icon_overlay_constant = true + }, + { + type = "unlock-recipe", + recipe = "destination-nauvis" + }, + { + type = "unlock-space-platforms", + modifier = true, + hidden = true + } + }, prerequisites = { "provisional-rocketry" }, unit = { count = 100, @@ -121,10 +132,6 @@ data:extend({ { type = "unlock-recipe", recipe = "provisional-rocket-silo" - }, - { - type = "unlock-recipe", - recipe = "satellite" } }, prerequisites = { "wood-liquefaction" }, diff --git a/lignumis/script/to-nauvis.lua b/lignumis/script/to-nauvis.lua new file mode 100644 index 0000000..e177ef7 --- /dev/null +++ b/lignumis/script/to-nauvis.lua @@ -0,0 +1,40 @@ +local crash_site = require("crash-site") +local util = require("util") +local e = defines.events + +local function chart_starting_area(surface, player) + local r = 200 + local force = player.force + local origin = force.get_spawn_position(surface) + force.chart(surface, { { origin.x - r, origin.y - r }, { origin.x + r, origin.y + r } }) +end + +local function travel_to_nauvis() + local nauvis = game.planets["nauvis"].create_surface() + nauvis.request_to_generate_chunks({ 0, 0 }, 3) + nauvis.force_generate_chunk_requests() + + for _, player in pairs(game.players) do + if player.surface.name == "lignumis" then + player.teleport(nauvis.find_non_colliding_position("character", { 0, 0 }, 0, 1) --[[@as MapPosition]], + "nauvis") + chart_starting_area(nauvis, player) + player.print("Oh no, not again. But... Welcome to Nauvis!") + end + end + + local ship_items = remote.call("freeplay", "get_ship_items") + local debris_items = remote.call("freeplay", "get_debris_items") + local crashed_ship_parts = remote.call("freeplay", "get_ship_parts") + + nauvis.daytime = 0.7 + crash_site.create_crash_site(nauvis, { -5, -6 }, ship_items, debris_items, util.copy(crashed_ship_parts)) +end + +script.on_event(e.on_rocket_launch_ordered, function(event) + local rocket_silo = event.rocket_silo + if rocket_silo.name == "provisional-rocket-silo" then + --rocket_silo.destroy() + travel_to_nauvis() + end +end)