1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00

Merge pull request #64 from ComfyFactory/mtn_v3_fixes

mtn v3 - fixes
This commit is contained in:
Gerkiz 2021-05-22 16:22:32 +02:00 committed by GitHub
commit 07165686dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -706,6 +706,10 @@ function Public.remove_offline_players()
player_inv[3] = game.players[offline_players[i].index].get_inventory(defines.inventory.character_guns)
player_inv[4] = game.players[offline_players[i].index].get_inventory(defines.inventory.character_ammo)
player_inv[5] = game.players[offline_players[i].index].get_inventory(defines.inventory.character_trash)
if not next(player_inv) then
offline_players[i] = nil
break
end
local pos = game.forces.player.get_spawn_position(surface)
local e =
surface.create_entity(

View File

@ -347,7 +347,7 @@ local function kick_players_from_surface(ic, car)
if not car.entity or not car.entity.valid then
local main_surface = game.surfaces[ic.allowed_surface]
if validate_entity(main_surface) then
for _, e in pairs(car.surface.find_entities_filtered({area = car.area})) do
for _, e in pairs(surface.find_entities_filtered({area = car.area})) do
if validate_entity(e) and e.name == 'character' and e.player then
e.player.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface)
end
@ -645,6 +645,10 @@ function Public.kill_car(ic, entity)
end
local car = ic.cars[entity.unit_number]
if not car then
return
end
local surface_index = car.surface
local surface = game.surfaces[surface_index]
kick_players_out_of_vehicles(car)