From f91f364c8d539b2de8e3db064b246c579f944b1d Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Tue, 4 Mar 2025 09:56:59 +0100 Subject: [PATCH] Prevent possible errors on player initialization --- lignumis/scripts/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lignumis/scripts/init.lua b/lignumis/scripts/init.lua index 0a5715f..dd37c07 100644 --- a/lignumis/scripts/init.lua +++ b/lignumis/scripts/init.lua @@ -22,10 +22,10 @@ end -- Teleport to Lignumis and give some starting items local function init_player(event) local player = game.get_player(event.player_index) - - if not player.character then return end - 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.character.destructible = false local main_inventory = player.character.get_main_inventory()