forked from cacklingfiend/lignumis
		
	Add transition to Nauvis
This commit is contained in:
		
							parent
							
								
									a83851341a
								
							
						
					
					
						commit
						dfea26a7cf
					
				
					 6 changed files with 75 additions and 59 deletions
				
			
		|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
| }) | ||||
|  |  | |||
|  | @ -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" }, | ||||
|  |  | |||
							
								
								
									
										40
									
								
								lignumis/script/to-nauvis.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								lignumis/script/to-nauvis.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -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) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Simon Brodtmann
						Simon Brodtmann