Skip to content

Commit

Permalink
Mtn: more validations
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Jan 4, 2025
1 parent b269b47 commit 1fac93d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
15 changes: 5 additions & 10 deletions maps/mountain_fortress_v3/ic/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ function Public.remove_invalid_cars()
end
end
kick_players_from_surface(car)
log('IC::remove_invalid_cars -> car.entity was not valid - removing unit number: ' .. car_index)
log('IC::remove_invalid_cars -> car.entity was not valid for car_index: ' .. car_index)
else
local owner = game.get_player(car.owner)
if owner and owner.valid then
Expand All @@ -1357,8 +1357,7 @@ function Public.remove_invalid_cars()
Task.set_timeout_in_ticks(30, enable_car_to_be_mined, { entity = car.entity, owner_name = owner.name })
cars[car_index] = nil
if cars[car_index] then
log('IC::remove_invalid_cars -> car will be deleted since no valid owner was found.')
log(serpent.block(cars[car_index]))
log('IC::remove_invalid_cars -> car will be deleted since no valid owner was found for car index: ' .. car_index)
cars[car_index] = nil
end
end
Expand All @@ -1372,21 +1371,17 @@ function Public.remove_invalid_cars()
if surface and surface.valid then
local valid_surface = get_car_by_surface(surface.index)
if not valid_surface then
log(serpent.block(car_to_surface_index))
log(serpent.block(cars[car_to_surface_index]))
log(serpent.block(cars))
game.delete_surface(surface)
surfaces[car_to_surface_index] = nil
log('IC::remove_invalid_cars -> surface was valid and will be deleted since no car entry.')
log('IC::remove_invalid_cars -> surface was valid and will be deleted since no car entry for car_to_surface_index: ' .. car_to_surface_index)
end
else
if cars[car_to_surface_index] then
log('IC::remove_invalid_cars -> car will be deleted since no valid surface was found.')
log(serpent.block(cars[car_to_surface_index]))
log('IC::remove_invalid_cars -> car will be deleted since no valid surface was found for car_to_surface_index: ' .. car_to_surface_index)
cars[car_to_surface_index] = nil
end

log('IC::remove_invalid_cars -> surface was not valid upon trying to delete for: ' .. car_to_surface_index)
log('IC::remove_invalid_cars -> surface was not valid upon trying to delete for car_to_surface_index: ' .. car_to_surface_index)
surfaces[car_to_surface_index] = nil
end
end
Expand Down
1 change: 1 addition & 0 deletions utils/gui/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ end

local function build_config_gui(data)
local player = data.player
if not player then return end
local frame = data.frame

local AG = Antigrief.get()
Expand Down

0 comments on commit 1fac93d

Please sign in to comment.