1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

mtn and rpg fixes

This commit is contained in:
Gerkiz 2021-02-04 19:19:58 +01:00
parent 781d82a165
commit 02a80e8708
2 changed files with 14 additions and 2 deletions

View File

@ -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)

View File

@ -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