From 02a80e87083150c1977ccde09c96d7db5baef571 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Thu, 4 Feb 2021 19:19:58 +0100 Subject: [PATCH] mtn and rpg fixes --- maps/mountain_fortress_v3/ic/functions.lua | 12 ++++++++++++ modules/rpg/main.lua | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/maps/mountain_fortress_v3/ic/functions.lua b/maps/mountain_fortress_v3/ic/functions.lua index 7e850f76..f683e155 100644 --- a/maps/mountain_fortress_v3/ic/functions.lua +++ b/maps/mountain_fortress_v3/ic/functions.lua @@ -305,8 +305,18 @@ local function kick_players_out_of_vehicles(car) end end +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) + end + end +end + local function kick_players_from_surface(ic, car) if not validate_entity(car.surface) then + check_if_players_are_in_nauvis(ic) return log_err('Car surface was not valid.') end if not car.entity or not car.entity.valid then @@ -317,6 +327,7 @@ local function kick_players_from_surface(ic, car) e.player.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface) end end + check_if_players_are_in_nauvis(ic) return log_err('Car entity was not valid.') end end @@ -331,6 +342,7 @@ local function kick_players_from_surface(ic, car) end end end + check_if_players_are_in_nauvis(ic) end local function kick_player_from_surface(ic, player, target) diff --git a/modules/rpg/main.lua b/modules/rpg/main.lua index adf61462..db133dbc 100644 --- a/modules/rpg/main.lua +++ b/modules/rpg/main.lua @@ -545,8 +545,8 @@ local function on_entity_damaged(event) local position = p.position local area = { - left_top = {x = position.x - 2, y = position.y - 2}, - right_bottom = {x = position.x + 2, y = position.y + 2} + left_top = {x = position.x - 4, y = position.y - 4}, + right_bottom = {x = position.x + 4, y = position.y + 4} } if not is_position_near(area, entity.position) then