forked from cacklingfiend/lignumis
		
	Make the second planet after Lignumis configurable by other mods
This commit is contained in:
		
							parent
							
								
									8982b1bf82
								
							
						
					
					
						commit
						ac60c67999
					
				
					 5 changed files with 29 additions and 6 deletions
				
			
		
							
								
								
									
										12
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
					@ -105,6 +105,18 @@ Don't touch inputs for labs in this list.
 | 
				
			||||||
Lignumis adds wood and steam science packs to all labs' inputs in `data-updates.lua` so modded labs will support them.
 | 
					Lignumis adds wood and steam science packs to all labs' inputs in `data-updates.lua` so modded labs will support them.
 | 
				
			||||||
If your modded lab is special and it should not support these science packs, use this list or set the inputs in `data-final-fixes.lua`.
 | 
					If your modded lab is special and it should not support these science packs, use this list or set the inputs in `data-final-fixes.lua`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Chaning the second planet (a.k.a. transition to Nauvis)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you want to create a mod that moves Lignumis to another planet, there is a hidden setting for the scripted transition to teleport the player not to Nauvis but to any planet you like.
 | 
				
			||||||
 | 
					This doesn't change any technologies or the location of Lignumis on the map. Make sure you adjust the prototypes as well on your end.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In `settings-updates.lua` add the following to switch to Gleba as the second planet:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```lua
 | 
				
			||||||
 | 
					data.raw["string-setting"]["lignumis-second-planet"].allowed_values = { "gleba" }
 | 
				
			||||||
 | 
					data.raw["string-setting"]["lignumis-second-planet"].default_value = "gleba"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Todo
 | 
					## Todo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fix pipe graphics on desiccation furnace and quality assembler
 | 
					- Fix pipe graphics on desiccation furnace and quality assembler
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ end
 | 
				
			||||||
local function init_space_locations()
 | 
					local function init_space_locations()
 | 
				
			||||||
    local force = game.forces.player
 | 
					    local force = game.forces.player
 | 
				
			||||||
    force.technologies["planet-discovery-lignumis"].researched = true
 | 
					    force.technologies["planet-discovery-lignumis"].researched = true
 | 
				
			||||||
    if not force.technologies["planet-discovery-nauvis"].researched then
 | 
					    if game.planets["nauvis"] and force.technologies["planet-discovery-nauvis"] and not force.technologies["planet-discovery-nauvis"].researched then
 | 
				
			||||||
        force.lock_space_location("nauvis")
 | 
					        force.lock_space_location("nauvis")
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,6 +7,8 @@ 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
 | 
					-- Migrate storage init as it was just a boolean before not supporting multiple players
 | 
				
			||||||
local function migrate_0_9_6(event)
 | 
					local function migrate_0_9_6(event)
 | 
				
			||||||
| 
						 | 
					@ -94,7 +96,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 == "nauvis" then
 | 
					    if player and player.surface.name == target_planet then
 | 
				
			||||||
        storage.nauvis_visited = true
 | 
					        storage.nauvis_visited = true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@ 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)
 | 
				
			||||||
| 
						 | 
					@ -19,7 +20,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["nauvis"].create_surface()
 | 
					    local nauvis = game.planets[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
 | 
				
			||||||
| 
						 | 
					@ -28,10 +29,10 @@ 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["nauvis"].surface
 | 
					    local nauvis = game.planets[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, "nauvis")
 | 
					        player.teleport(position, target_planet)
 | 
				
			||||||
        chart_starting_area(nauvis, player)
 | 
					        chart_starting_area(nauvis, player)
 | 
				
			||||||
        player.print("Oh no, not again. But... Welcome to Nauvis!")
 | 
					        player.print("Oh no, not again. But... Welcome to Nauvis!")
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -44,7 +45,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["nauvis"].surface
 | 
					    local nauvis = game.planets[target_planet].surface
 | 
				
			||||||
    local ship_items = {
 | 
					    local ship_items = {
 | 
				
			||||||
        ["burner-mining-drill"] = 2,
 | 
					        ["burner-mining-drill"] = 2,
 | 
				
			||||||
        ["stone-furnace"] = 2,
 | 
					        ["stone-furnace"] = 2,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,14 @@ data:extend({
 | 
				
			||||||
        setting_type = "startup",
 | 
					        setting_type = "startup",
 | 
				
			||||||
        default_value = false,
 | 
					        default_value = false,
 | 
				
			||||||
        order = "h"
 | 
					        order = "h"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        type = "string-setting",
 | 
				
			||||||
 | 
					        name = "lignumis-second-planet",
 | 
				
			||||||
 | 
					        setting_type = "runtime-global",
 | 
				
			||||||
 | 
					        allowed_values = { "nauvis" },
 | 
				
			||||||
 | 
					        default_value = "nauvis",
 | 
				
			||||||
 | 
					        hidden = true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue