From 4d853ed91355dfcc4f5700149478a93d7f9f92a6 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 12 Jan 2019 18:05:58 +0000 Subject: [PATCH] Fixed Warp Point nil --- modules/WarpPoints/control.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/WarpPoints/control.lua b/modules/WarpPoints/control.lua index 42874bd4..e648b55e 100644 --- a/modules/WarpPoints/control.lua +++ b/modules/WarpPoints/control.lua @@ -129,12 +129,14 @@ local go_to_warp = Gui.inputs{ local player = Game.get_player(event) local cooldown = global.cooldowns[event.player_index] or 0 local warp = global.warps[event.element.parent.name] + if not warp then return end if cooldown > 0 then player_return({'WarpPoints.cooldown',cooldown},nil,event) return end if player.vehicle then player.vehicle.set_driver(nil) end if player.vehicle then player.vehicle.set_passenger(nil) end if player.vehicle then return end - player.teleport(game.surfaces[warp.surface].find_non_colliding_position('player',warp.position,32,1),game.surfaces[warp.surface]) - if not Role and not player.admin or Role and not Role.allowed(player,'always-warp') then + local surface = game.surfaces[warp.surface] + player.teleport(surface.find_non_colliding_position('player',warp.position,32,1),surface) + if not Role and not player.admin or Role and not Role.allowed(player,'always-warp') then event.element.parent.parent.parent.parent.style.visible = false global.cooldowns[event.player_index] = warp_limit end