diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index 8119d0bc..62c7f78b 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -1224,7 +1224,13 @@ function Public.on_player_joined_game(event) local p = {x = player.position.x, y = player.position.y} local get_tile = surface.get_tile(p) if get_tile.valid and get_tile.name == 'out-of-map' then - player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface) + local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5) + if pos then + player.teleport(pos, surface) + else + pos = game.forces.player.get_spawn_position(surface) + player.teleport(pos, surface) + end end end diff --git a/maps/mountain_fortress_v3/ic/functions.lua b/maps/mountain_fortress_v3/ic/functions.lua index 5e97e5fb..9ab3c175 100644 --- a/maps/mountain_fortress_v3/ic/functions.lua +++ b/maps/mountain_fortress_v3/ic/functions.lua @@ -332,7 +332,13 @@ local function check_if_players_are_in_nauvis(ic) for _, player in pairs(game.connected_players) do local main_surface = game.surfaces[ic.allowed_surface] if player.surface.name == 'nauvis' then - player.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface) + local pos = main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5) + if pos then + player.teleport(pos, main_surface) + else + pos = game.forces.player.get_spawn_position(main_surface) + player.teleport(pos, main_surface) + end end end end diff --git a/maps/mountain_fortress_v3/icw/functions.lua b/maps/mountain_fortress_v3/icw/functions.lua index 3808397f..45f79198 100644 --- a/maps/mountain_fortress_v3/icw/functions.lua +++ b/maps/mountain_fortress_v3/icw/functions.lua @@ -849,6 +849,10 @@ function Public.use_cargo_wagon_door_with_entity(icw, player, door) return end + if not wagon.entity or not wagon.entity.valid then + return + end + player_data.fallback_surface = wagon.entity.surface.index player_data.fallback_position = {wagon.entity.position.x, wagon.entity.position.y} diff --git a/maps/mountain_fortress_v3/locomotive.lua b/maps/mountain_fortress_v3/locomotive.lua index 8a717deb..e93ec37d 100644 --- a/maps/mountain_fortress_v3/locomotive.lua +++ b/maps/mountain_fortress_v3/locomotive.lua @@ -1128,7 +1128,7 @@ local function gui_click(event) } ) - this.locomotive_max_health = this.locomotive_max_health + 10000 + this.locomotive_max_health = this.locomotive_max_health + 20000 --[[ this.locomotive_max_health = this.locomotive_max_health + (this.locomotive_max_health * 0.5) @@ -1836,7 +1836,13 @@ local function on_player_changed_surface(event) if not surface or not surface.valid then return end - player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface) + local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5) + if pos then + player.teleport(pos, surface) + else + pos = game.forces.player.get_spawn_position(surface) + player.teleport(pos, surface) + end end if string.sub(player.surface.name, 0, #map_name) ~= map_name then diff --git a/modules/rpg/main.lua b/modules/rpg/main.lua index ae8fd478..b19e73aa 100644 --- a/modules/rpg/main.lua +++ b/modules/rpg/main.lua @@ -1117,7 +1117,13 @@ local function on_player_used_capsule(event) end end elseif obj_name == 'warp-gate' then - player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface) + local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5) + if pos then + player.teleport(pos, surface) + else + pos = game.forces.player.get_spawn_position(surface) + player.teleport(pos, surface) + end rpg_t.mana = 0 Public.damage_player_over_time(player, math.random(8, 16)) player.play_sound {path = 'utility/armor_insert', volume_modifier = 1} diff --git a/modules/wave_defense/main.lua b/modules/wave_defense/main.lua index a117b4d8..c49d3506 100644 --- a/modules/wave_defense/main.lua +++ b/modules/wave_defense/main.lua @@ -790,6 +790,12 @@ local function command_to_main_target(group, bypass) debug_print('get_main_command - got commands') + local surface_index = WD.get('surface_index') + + if group.surface.index ~= surface_index then + return + end + group.set_command( { type = defines.command.compound,