forked from cacklingfiend/lignumis
		
	Fix crash when opening the editor
This commit is contained in:
		
							parent
							
								
									02a5609c22
								
							
						
					
					
						commit
						d128ab8f6e
					
				
					 1 changed files with 24 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -41,20 +41,22 @@ script.on_init(function()
 | 
			
		|||
end)
 | 
			
		||||
 | 
			
		||||
script.on_event(e.on_player_created, function(event)
 | 
			
		||||
    local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
 | 
			
		||||
 | 
			
		||||
    local surface = storage.surface
 | 
			
		||||
    player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1) --[[@as MapPosition]], "lignumis")
 | 
			
		||||
 | 
			
		||||
    if not storage.nauvis_visited then
 | 
			
		||||
        local nauvis = game.get_surface("nauvis") --[[@as LuaSurface]]
 | 
			
		||||
        nauvis.clear()
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local player = game.get_player(event.player_index) --[[@as LuaPlayer]]
 | 
			
		||||
    local surface = storage.surface
 | 
			
		||||
 | 
			
		||||
    if not storage.init then
 | 
			
		||||
        storage.init = true
 | 
			
		||||
 | 
			
		||||
        surface.daytime = 0.7
 | 
			
		||||
 | 
			
		||||
        if player then
 | 
			
		||||
            player.teleport(surface.find_non_colliding_position("character", { 0, 0 }, 0, 1) --[[@as MapPosition]], "lignumis")
 | 
			
		||||
 | 
			
		||||
            if player.character then
 | 
			
		||||
                player.character.destructible = false
 | 
			
		||||
            end
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +79,7 @@ script.on_event(e.on_player_created, function(event)
 | 
			
		|||
                storage.crash_site_cutscene_active = true
 | 
			
		||||
                crash_site.create_cutscene(player, { -5, -4 })
 | 
			
		||||
            end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        chart_starting_area()
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue