forked from cacklingfiend/lignumis
		
	Remove enemies from starting area when leaving Lignumis
This commit is contained in:
		
							parent
							
								
									429e8a3a41
								
							
						
					
					
						commit
						74eb162d9a
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		|  | @ -25,6 +25,21 @@ local function init_nauvis() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | -- Removes enemies around the crash site to not mess with the player start | ||||||
|  | local function clear_enemies() | ||||||
|  |     local nauvis = game.planets[storage.target_planet].surface | ||||||
|  |     local enemies = nauvis.find_entities_filtered({ | ||||||
|  |         position = { 0, 0 }, | ||||||
|  |         radius = 200, | ||||||
|  |         force = "enemy" | ||||||
|  |     }) | ||||||
|  |     for _, enemy in pairs(enemies) do | ||||||
|  |         enemy.destroy() | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  | 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[storage.target_planet].surface |     local nauvis = game.planets[storage.target_planet].surface | ||||||
|  | @ -67,6 +82,7 @@ local function transit_player(player_index) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     init_nauvis() |     init_nauvis() | ||||||
|  |     clear_enemies() | ||||||
|     teleport_player(player) |     teleport_player(player) | ||||||
|     init_freeplay() |     init_freeplay() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Simon Brodtmann
						Simon Brodtmann