forked from cacklingfiend/lignumis
		
	Prevent possible errors on player initialization
This commit is contained in:
		
							parent
							
								
									8e1c774e2a
								
							
						
					
					
						commit
						f91f364c8d
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -22,10 +22,10 @@ end
 | 
				
			||||||
-- 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)
 | 
				
			||||||
    local player = game.get_player(event.player_index)
 | 
					    local player = game.get_player(event.player_index)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    if not player.character then return end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    local surface = storage.surface or game.planets["lignumis"].surface
 | 
					    local surface = storage.surface or game.planets["lignumis"].surface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not player.character or not surface then return end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1), "lignumis")
 | 
					    player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1), "lignumis")
 | 
				
			||||||
    player.character.destructible = false
 | 
					    player.character.destructible = false
 | 
				
			||||||
    local main_inventory = player.character.get_main_inventory()
 | 
					    local main_inventory = player.character.get_main_inventory()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue