Skip to content

Commit 378e237

Browse files
author
notnotmelon
committed
fix: Resolved crash with maraxsis. Resolves #267
1 parent c27bf86 commit 378e237

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

script/travel.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ local function purgatory_surface()
2626
return surface
2727
end
2828

29-
local function teleport_safely(e, surface, position, player, leaving)
29+
local function teleport_safely(e, surface, position, player)
30+
if not e.valid then return end
31+
if not player.valid then return end
32+
3033
position = {x = position.x or position[1], y = position.y or position[2]}
3134

3235
if e.is_player() and not e.character then -- god controller
@@ -46,11 +49,11 @@ local function teleport_safely(e, surface, position, player, leaving)
4649
end
4750

4851
local function enter_factory(e, factory, player)
49-
teleport_safely(e, factory.inside_surface, {factory.inside_door_x, factory.inside_door_y}, player, false)
52+
teleport_safely(e, factory.inside_surface, {factory.inside_door_x, factory.inside_door_y}, player)
5053
end
5154

5255
local function leave_factory(e, factory, player)
53-
teleport_safely(e, factory.outside_surface, {factory.outside_door_x, factory.outside_door_y}, player, true)
56+
teleport_safely(e, factory.outside_surface, {factory.outside_door_x, factory.outside_door_y}, player)
5457
end
5558

5659
-- https://mods.factorio.com/mod/jetpack

0 commit comments

Comments
 (0)