mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-29 21:47:08 +02:00
Merge pull request #218 from ComfyFactory/mtn_v3
mtn v3 - fix weird bug
This commit is contained in:
commit
8194dccf56
@ -711,6 +711,7 @@ function Public.remove_offline_players()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local offline_players = WPT.get('offline_players')
|
local offline_players = WPT.get('offline_players')
|
||||||
|
local offline_players_surface_removal = WPT.get('offline_players_surface_removal')
|
||||||
local active_surface_index = WPT.get('active_surface_index')
|
local active_surface_index = WPT.get('active_surface_index')
|
||||||
local surface = game.surfaces[active_surface_index]
|
local surface = game.surfaces[active_surface_index]
|
||||||
local player_inv = {}
|
local player_inv = {}
|
||||||
@ -729,7 +730,9 @@ function Public.remove_offline_players()
|
|||||||
player_inv[3] = target.get_inventory(defines.inventory.character_guns)
|
player_inv[3] = target.get_inventory(defines.inventory.character_guns)
|
||||||
player_inv[4] = target.get_inventory(defines.inventory.character_ammo)
|
player_inv[4] = target.get_inventory(defines.inventory.character_ammo)
|
||||||
player_inv[5] = target.get_inventory(defines.inventory.character_trash)
|
player_inv[5] = target.get_inventory(defines.inventory.character_trash)
|
||||||
ICT_Functions.remove_surface(target) -- remove empty surface
|
if offline_players_surface_removal then
|
||||||
|
ICT_Functions.remove_surface(target) -- remove empty surface
|
||||||
|
end
|
||||||
|
|
||||||
if target.get_item_count() == 0 then -- if the player has zero items, don't do anything
|
if target.get_item_count() == 0 then -- if the player has zero items, don't do anything
|
||||||
offline_players[i] = nil
|
offline_players[i] = nil
|
||||||
|
@ -742,42 +742,43 @@ function Public.remove_surface(player)
|
|||||||
kick_players_from_surface(car)
|
kick_players_from_surface(car)
|
||||||
|
|
||||||
local trust_system = IC.get('trust_system')
|
local trust_system = IC.get('trust_system')
|
||||||
local owner = car.owner
|
if trust_system[player.index] then
|
||||||
|
trust_system[player.index] = nil
|
||||||
if owner then
|
|
||||||
owner = game.get_player(owner)
|
|
||||||
if owner and owner.valid then
|
|
||||||
if trust_system[owner.index] then
|
|
||||||
trust_system[owner.index] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local renders = IC.get('renders')
|
local renders = IC.get('renders')
|
||||||
|
|
||||||
if renders[owner.index] then
|
if renders[player.index] then
|
||||||
rendering.destroy(renders[owner.index])
|
rendering.destroy(renders[player.index])
|
||||||
renders[owner.index] = nil
|
renders[player.index] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_gui_data = IC.get('player_gui_data')
|
local player_gui_data = IC.get('player_gui_data')
|
||||||
if player_gui_data[owner.name] then
|
if player_gui_data[player.name] then
|
||||||
player_gui_data[owner.name] = nil
|
player_gui_data[player.name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local players = IC.get('players')
|
local players = IC.get('players')
|
||||||
if players[owner.index] then
|
if players[player.index] then
|
||||||
players[owner.index] = nil
|
players[player.index] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local misc_settings = IC.get('misc_settings')
|
local misc_settings = IC.get('misc_settings')
|
||||||
if misc_settings[owner.index] then
|
if misc_settings[player.index] then
|
||||||
misc_settings[owner.index] = nil
|
misc_settings[player.index] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
kill_doors(car)
|
||||||
|
|
||||||
|
surfaces[car.saved_entity] = nil
|
||||||
|
cars[car.saved_entity] = nil
|
||||||
|
|
||||||
local surface_index = car.surface
|
local surface_index = car.surface
|
||||||
local surface = game.surfaces[surface_index]
|
local surface = game.surfaces[surface_index]
|
||||||
kill_doors(car)
|
if not surface or not surface.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for _, tile in pairs(surface.find_tiles_filtered({area = car.area})) do
|
for _, tile in pairs(surface.find_tiles_filtered({area = car.area})) do
|
||||||
surface.set_tiles({{name = 'out-of-map', position = tile.position}}, true)
|
surface.set_tiles({{name = 'out-of-map', position = tile.position}}, true)
|
||||||
end
|
end
|
||||||
@ -787,8 +788,6 @@ function Public.remove_surface(player)
|
|||||||
surface.set_tiles({{name = 'out-of-map', position = {x = p.x - 1, y = p.y}}}, true)
|
surface.set_tiles({{name = 'out-of-map', position = {x = p.x - 1, y = p.y}}}, true)
|
||||||
end
|
end
|
||||||
game.delete_surface(surface)
|
game.delete_surface(surface)
|
||||||
surfaces[car.saved_entity] = nil
|
|
||||||
cars[car.saved_entity] = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.kill_car(entity)
|
function Public.kill_car(entity)
|
||||||
@ -1195,6 +1194,9 @@ function Public.remove_invalid_cars()
|
|||||||
end
|
end
|
||||||
for k, index in pairs(surfaces) do
|
for k, index in pairs(surfaces) do
|
||||||
local surface = game.surfaces[index]
|
local surface = game.surfaces[index]
|
||||||
|
if not validate_entity(surface) then
|
||||||
|
return
|
||||||
|
end
|
||||||
if not cars[tonumber(surface.name)] then
|
if not cars[tonumber(surface.name)] then
|
||||||
game.delete_surface(surface)
|
game.delete_surface(surface)
|
||||||
surfaces[k] = nil
|
surfaces[k] = nil
|
||||||
|
@ -190,6 +190,7 @@ function Public.reset_table()
|
|||||||
this.disconnect_wagon = false
|
this.disconnect_wagon = false
|
||||||
this.offline_players_enabled = true
|
this.offline_players_enabled = true
|
||||||
this.offline_players = {}
|
this.offline_players = {}
|
||||||
|
this.offline_players_surface_removal = false
|
||||||
this.collapse_amount = false
|
this.collapse_amount = false
|
||||||
this.collapse_speed = false
|
this.collapse_speed = false
|
||||||
this.y_value_position = 20
|
this.y_value_position = 20
|
||||||
|
Loading…
x
Reference in New Issue
Block a user