From f9ca86504b0168c24500f1347df33464c9625e6a Mon Sep 17 00:00:00 2001 From: Aleksei-bird Date: Tue, 20 Aug 2024 20:15:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=20"DeleteEmptyChunks"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeleteEmptyChunks/README.md | 4 - DeleteEmptyChunks/changelog.txt | 114 ---- DeleteEmptyChunks/control.lua | 489 ------------------ DeleteEmptyChunks/data.lua | 10 - DeleteEmptyChunks/description.md | 4 - .../graphics/DeleteEmptyChunks_button.png | Bin 1424 -> 0 bytes DeleteEmptyChunks/info.json | 8 - DeleteEmptyChunks/locale/en/locale.cfg | 29 -- DeleteEmptyChunks/settings.lua | 24 - DeleteEmptyChunks/thumbnail.png | Bin 3366 -> 0 bytes 10 files changed, 682 deletions(-) delete mode 100644 DeleteEmptyChunks/README.md delete mode 100644 DeleteEmptyChunks/changelog.txt delete mode 100644 DeleteEmptyChunks/control.lua delete mode 100644 DeleteEmptyChunks/data.lua delete mode 100644 DeleteEmptyChunks/description.md delete mode 100644 DeleteEmptyChunks/graphics/DeleteEmptyChunks_button.png delete mode 100644 DeleteEmptyChunks/info.json delete mode 100644 DeleteEmptyChunks/locale/en/locale.cfg delete mode 100644 DeleteEmptyChunks/settings.lua delete mode 100644 DeleteEmptyChunks/thumbnail.png diff --git a/DeleteEmptyChunks/README.md b/DeleteEmptyChunks/README.md deleted file mode 100644 index a0e53edd..00000000 --- a/DeleteEmptyChunks/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# DeleteEmptyChunks -Factorio mod: Delete chunks which contain no player entities. - -Useful for slimming down save files and recovering lost performance from fruitless exploration. Can configure radius of adjacent chunks to keep and toggle keeping chunks with paving diff --git a/DeleteEmptyChunks/changelog.txt b/DeleteEmptyChunks/changelog.txt deleted file mode 100644 index a9dedbac..00000000 --- a/DeleteEmptyChunks/changelog.txt +++ /dev/null @@ -1,114 +0,0 @@ ---------------------------------------------------------------------------------------------------- -Version: 0.4.3 -Date: 2020-12-27 - Changes: - - Updated for 1.1 ---------------------------------------------------------------------------------------------------- -Version: 0.4.2 -Date: 2020-07-11 - Bugfixes: - - Logical error would print warning to non-admins when any button was pressed ---------------------------------------------------------------------------------------------------- -Version: 0.4.1 -Date: 2020-04-22 - Features: - - Support for creep introduced by Krastorio2 - - Recognizes colored refined-concrete added in later versions of 0.18 ---------------------------------------------------------------------------------------------------- -Version: 0.4.0 -Date: 2020-02-15 - Features: - - Functionality limited to admins and server console ---------------------------------------------------------------------------------------------------- -Version: 0.3.10 -Date: 2020-02-02 - Features: - - Added compatibility for Mining Drones ---------------------------------------------------------------------------------------------------- -Version: 0.3.9 -Date: 2020-01-31 - Changes: - - Updated for 0.18 ---------------------------------------------------------------------------------------------------- -Version: 0.3.8 -Date: 2019-09-01 - Features: - - Added support for Alien Biome and Space Exploration - - Improved console command and remote interface - Changes: - - Removed unneeded references for Factorismo2 and Surfaces_remake ---------------------------------------------------------------------------------------------------- -Version: 0.3.6 -Date: 2019-08-25 - Features: - - Added console command and remote interface ---------------------------------------------------------------------------------------------------- -Version: 0.3.4 -Date: 2019-03-24 - Changes: - - Updated for 0.17 ---------------------------------------------------------------------------------------------------- -Version: 0.3.3 -Date: 2018-06-17 - Changes: - - New button, cleaner code, eliminate idle CPU usage ---------------------------------------------------------------------------------------------------- -Version: 0.3.2 -Date: 2018-05-02 - Optimizations: - - Surface.count_tiles_filtered now accepts a table of filters in Factorio 0.16.40 - Bugfixes: - - Prevent deleting the chunk a player is in when that chunk has not yet been charted ---------------------------------------------------------------------------------------------------- -Version: 0.3.1 -Date: 2018-03-11 - Minor Features: - - Added support for RSO. Unavoidable side effects: Because of the way RSO handles resource generation, if you've 'pinned' part of a resource, RSO will create an identical resource shifted by a bit within that region. If you delete the starting area chunks, those resources are gone. Otherwise, if RSO is allowed to regenerate them, it will spam the starting area with duplicates as many times as one clicks the button. ---------------------------------------------------------------------------------------------------- -Version: 0.3.0 -Date: 2018-03-04 - Optimizations: - - No need to search invisible chunks for player entities or paving (nearly three times faster) - Changes: - - Removed hard-coded enumeration of tile names from other mods - - Now detect all non-vanilla tiles as paving added by other mods except those specifically ignored - - Cleaned up log and print messages - - Limited to only deleting chunks from a single surface specified by an option. It is not reliably safe to delete chunks from surfaces added by mods ---------------------------------------------------------------------------------------------------- -Version: 0.2.3 -Date: 2018-03-01 - Minor Features: - - Updated for Refined Concrete in Version 0.16.27 ---------------------------------------------------------------------------------------------------- -Version: 0.2.2 -Date: 2018-01-01 - Bugfixes: - - Corrected typo causing multiplayer to fail ---------------------------------------------------------------------------------------------------- -Version: 0.2.0 -Date: 2018-01-01 - Features: - - Improved support for localization - - Ignore factories from mod Factorissimo2 - - Added support for mod AsphaltRoads - Optimizations: - - Refactored code ---------------------------------------------------------------------------------------------------- -Version: 0.1.1 -Date: 2017-12-30 - Optimizations: - - Seven times faster processing paving ---------------------------------------------------------------------------------------------------- -Version: 0.1.0 -Date: 2017-12-29 - Bugfixes: - - Backported bugfixes from DestroyEmptyChunks 0.2.1 - Features: - - Allowed for paving other than concrete. - Major Features: - - Updated for Factorio 0.16 ---------------------------------------------------------------------------------------------------- -Version: 0.0.7 -Date: 2017-10-03 - Major Features: - - Initial release diff --git a/DeleteEmptyChunks/control.lua b/DeleteEmptyChunks/control.lua deleted file mode 100644 index 464e8b1f..00000000 --- a/DeleteEmptyChunks/control.lua +++ /dev/null @@ -1,489 +0,0 @@ -local mod_gui = require("mod-gui") -function remote_doit(who, args) - --remote.call("DeleteEmptyChunks", "getSurface") - --remote.call("DeleteEmptyChunks", "getRadius") - --remote.call("DeleteEmptyChunks", "getPaving") - --remote.call("DeleteEmptyChunks", "DeleteEmptyChunks", {surface="nauvis", radius=0, paving=false}) - local target_surface = settings.global["DeleteEmptyChunks_surface"].value - local radius = settings.global["DeleteEmptyChunks_radius"].value - local keep_paving = settings.global["DeleteEmptyChunks_paving"].value - if args.surface ~= nil then - target_surface = args.surface - end - if args.radius ~= nil then - radius = args.radius - end - if args.paving ~= nil then - keep_paving = args.paving - end - doit(who, target_surface, radius, keep_paving) -end - -function doit(who, target_surface, radius, keep_paving) - -- Get list of possible paving - local paving = {} - local paving_base = {"stone-path", "concrete", "hazard-concrete-left", "hazard-concrete-right", "refined-concrete", "refined-hazard-concrete-left", "refined-hazard-concrete-right", - "acid-refined-concrete", "black-refined-concrete", "blue-refined-concrete", "brown-refined-concrete", "cyan-refined-concrete", "green-refined-concrete", - "orange-refined-concrete", "pink-refined-concrete", "purple-refined-concrete", "red-refined-concrete", "yellow-refined-concrete"} - if keep_paving then - paving = getPavingTiles() - --log(table_to_csv(paving)) - end - - -- Get list of all player positions and forces - local playerForceNames = {} - local playerPositions = {} - for _, player in pairs(game.players) do - table.insert( playerForceNames, player.force.name ) - table.insert( playerPositions, {x = math.floor(player.position.x / 32), y = math.floor(player.position.y / 32)}) - end - if #playerForceNames > 1 then printAll({'DeleteEmptyChunks_text_force', table_to_csv(playerForceNames)}) end - - -- Verify surface exists - local surface = nil - local surface_list = {} - for _, candidate in pairs (game.surfaces) do - table.insert( surface_list, candidate.name ) - if candidate.name == target_surface then - surface = candidate - end - end - --log(table_to_csv(surface_list)) - - -- Let the players know what is happening - if surface == nil and #surface_list > 0 then - printAll({'DeleteEmptyChunks_text_mod_nosurface', target_surface, table_to_csv(surface_list)}) - else - if #paving > 0 then - if radius > 0 then - printAll({'DeleteEmptyChunks_text_notifier_pr', who, radius}) - else - printAll({'DeleteEmptyChunks_text_notifier_p', who}) - end - printAll({'DeleteEmptyChunks_text_notifier_paving', #paving, #paving_base, #paving - #paving_base}) - else - if radius > 0 then - printAll({'DeleteEmptyChunks_text_notifier_r', who, radius}) - else - printAll({'DeleteEmptyChunks_text_notifier', who}) - end - end - -- Perform chunk deletion on specified surface - if surface ~= nil then - -- First Pass - local list = getKeepList(surface, playerForceNames, radius == 0 and 1 or 0, paving) - -- Save players from the void - for _, position in pairs(playerPositions) do - if list.coordinates[position.x] == nil then - list.coordinates[position.x]={} - end - list.coordinates[position.x][position.y]=1 - end - -- Second Pass - local result = deleteChunks(surface, list.coordinates, radius) - -- Report results to all players - printAll({'DeleteEmptyChunks_text_starting', list.total, surface.name, list.total - list.uncharted}) - if result.kept > 0 then - if list.occupied > 0 then - if list.paved > 0 then - if result.adjacent > 0 then - printAll({'DeleteEmptyChunks_text_keep_epa', result.kept, list.occupied, list.paved, result.adjacent}) - else - printAll({'DeleteEmptyChunks_text_keep_ep', result.kept, list.occupied, list.paved}) - end - else - if result.adjacent > 0 then - printAll({'DeleteEmptyChunks_text_keep_ea', result.kept, list.occupied, result.adjacent}) - else - printAll({'DeleteEmptyChunks_text_keep_e', result.kept, list.occupied}) - end - end - elseif list.paved > 0 then - if result.adjacent > 0 then - printAll({'DeleteEmptyChunks_text_keep_pa', result.kept, list.paved, result.adjacent}) - else - printAll({'DeleteEmptyChunks_text_keep_p', result.kept, list.paved}) - end - end - end - printAll({'DeleteEmptyChunks_text_delete', result.deleted}) - if game.active_mods["rso-mod"] then - remote.call("RSO", "disableStartingArea") - remote.call("RSO", "resetGeneration", surface) - end - end - end -end - -function printAll(text) - log(text) - game.print(text) -end - -function table_to_csv(list) - local str = "" - for _, item in pairs (list) do - if string.len(str) > 0 then - str = str .. "\", \"" .. item - else - str = "\"" .. item - end - end - if string.len(str) > 0 then - str = str .. "\"" - end - return str -end - -function getPavingTiles() - local paving = {} - local ground = {} - -- Ignored tileset for "Base mod" as of 0.17.66 - -- Paving: {"stone-path", "concrete", "hazard-concrete-left", "hazard-concrete-right", "refined-concrete", "refined-hazard-concrete-left", "refined-hazard-concrete-right", - -- "acid-refined-concrete", "black-refined-concrete", "blue-refined-concrete", "brown-refined-concrete", "cyan-refined-concrete", "green-refined-concrete", - -- "orange-refined-concrete", "pink-refined-concrete", "purple-refined-concrete", "red-refined-concrete", "yellow-refined-concrete"} - local Base_tiles = {"deepwater", "deepwater-green", "dirt-1", "dirt-2", "dirt-3", "dirt-4", "dirt-5", - "dirt-6", "dirt-7", "dry-dirt", "grass-1", "grass-2", "grass-3", "grass-4", "lab-dark-1", - "lab-dark-2", "lab-white", "out-of-map", "red-desert-0", "red-desert-1", "red-desert-2", - "red-desert-3", "sand-1", "sand-2", "sand-3", "tutorial-grid", "water", "water-green", - "landfill", "water-mud", "water-shallow"} - for _, v in ipairs(Base_tiles) do - table.insert(ground, v) - end - - -- Ignored tileset for "Alien Biome" exported from 0.4.15 - -- Paving: none - local AlienBiomes_tiles = {"frozen-snow-0", "frozen-snow-1", "frozen-snow-2", "frozen-snow-3", "frozen-snow-4", "frozen-snow-5", "frozen-snow-6", "frozen-snow-7", "frozen-snow-8", "frozen-snow-9", - "mineral-aubergine-dirt-1", "mineral-aubergine-dirt-2", "mineral-aubergine-dirt-3", "mineral-aubergine-dirt-4", "mineral-aubergine-dirt-5", "mineral-aubergine-dirt-6", - "mineral-aubergine-sand-1", "mineral-aubergine-sand-2", "mineral-aubergine-sand-3", - "mineral-beige-dirt-1", "mineral-beige-dirt-2", "mineral-beige-dirt-3", "mineral-beige-dirt-4", "mineral-beige-dirt-5", "mineral-beige-dirt-6", - "mineral-beige-sand-1", "mineral-beige-sand-2", "mineral-beige-sand-3", - "mineral-black-dirt-1", "mineral-black-dirt-2", "mineral-black-dirt-3", "mineral-black-dirt-4", "mineral-black-dirt-5", "mineral-black-dirt-6", - "mineral-black-sand-1", "mineral-black-sand-2", "mineral-black-sand-3", - "mineral-brown-dirt-1", "mineral-brown-dirt-2", "mineral-brown-dirt-3", "mineral-brown-dirt-4", "mineral-brown-dirt-5", "mineral-brown-dirt-6", - "mineral-brown-sand-1", "mineral-brown-sand-2", "mineral-brown-sand-3", - "mineral-cream-dirt-1", "mineral-cream-dirt-2", "mineral-cream-dirt-3", "mineral-cream-dirt-4", "mineral-cream-dirt-5", "mineral-cream-dirt-6", - "mineral-cream-sand-1", "mineral-cream-sand-2", "mineral-cream-sand-3", - "mineral-dustyrose-dirt-1", "mineral-dustyrose-dirt-2", "mineral-dustyrose-dirt-3", "mineral-dustyrose-dirt-4", "mineral-dustyrose-dirt-5", "mineral-dustyrose-dirt-6", - "mineral-dustyrose-sand-1", "mineral-dustyrose-sand-2", "mineral-dustyrose-sand-3", - "mineral-grey-dirt-1", "mineral-grey-dirt-2", "mineral-grey-dirt-3", "mineral-grey-dirt-4", "mineral-grey-dirt-5", "mineral-grey-dirt-6", - "mineral-grey-sand-1", "mineral-grey-sand-2", "mineral-grey-sand-3", - "mineral-purple-dirt-1", "mineral-purple-dirt-2", "mineral-purple-dirt-3", "mineral-purple-dirt-4", "mineral-purple-dirt-5", "mineral-purple-dirt-6", - "mineral-purple-sand-1", "mineral-purple-sand-2", "mineral-purple-sand-3", - "mineral-red-dirt-1", "mineral-red-dirt-2", "mineral-red-dirt-3", "mineral-red-dirt-4", "mineral-red-dirt-5", "mineral-red-dirt-6", - "mineral-red-sand-1", "mineral-red-sand-2", "mineral-red-sand-3", - "mineral-tan-dirt-1", "mineral-tan-dirt-2", "mineral-tan-dirt-3", "mineral-tan-dirt-4", "mineral-tan-dirt-5", "mineral-tan-dirt-6", - "mineral-tan-sand-1", "mineral-tan-sand-2", "mineral-tan-sand-3", - "mineral-violet-dirt-1", "mineral-violet-dirt-2", "mineral-violet-dirt-3", "mineral-violet-dirt-4", "mineral-violet-dirt-5", "mineral-violet-dirt-6", - "mineral-violet-sand-1", "mineral-violet-sand-2", "mineral-violet-sand-3", - "mineral-white-dirt-1", "mineral-white-dirt-2", "mineral-white-dirt-3", "mineral-white-dirt-4", "mineral-white-dirt-5", "mineral-white-dirt-6", - "mineral-white-sand-1", "mineral-white-sand-2", "mineral-white-sand-3", - "vegetation-blue-grass-1", "vegetation-blue-grass-2", - "vegetation-green-grass-1", "vegetation-green-grass-2", "vegetation-green-grass-3", "vegetation-green-grass-4", - "vegetation-mauve-grass-1", "vegetation-mauve-grass-2", - "vegetation-olive-grass-1", "vegetation-olive-grass-2", - "vegetation-orange-grass-1", "vegetation-orange-grass-2", - "vegetation-purple-grass-1", "vegetation-purple-grass-2", - "vegetation-red-grass-1", "vegetation-red-grass-2", - "vegetation-turquoise-grass-1", "vegetation-turquoise-grass-2", - "vegetation-violet-grass-1", "vegetation-violet-grass-2", - "vegetation-yellow-grass-1", "vegetation-yellow-grass-2", - "volcanic-blue-heat-1", "volcanic-blue-heat-2", "volcanic-blue-heat-3", "volcanic-blue-heat-4", - "volcanic-green-heat-1", "volcanic-green-heat-2", "volcanic-green-heat-3", "volcanic-green-heat-4", - "volcanic-orange-heat-1", "volcanic-orange-heat-2", "volcanic-orange-heat-3", "volcanic-orange-heat-4", - "volcanic-purple-heat-1", "volcanic-purple-heat-2", "volcanic-purple-heat-3", "volcanic-purple-heat-4"} - if game.active_mods["alien-biomes"] then - for _, v in ipairs(AlienBiomes_tiles) do - table.insert(ground, v) - end - end - - -- Ignored tileset for "Space Exploration" exported from 0.1.137 - -- Paving: {"se-space-platform-plating", "se-space-platform-scaffold", "se-spaceship-floor"} - local SpaceExploration_tiles = {"se-asteroid", "se-regolith", "se-space"} - if game.active_mods["space-exploration"] then - for _, v in ipairs(SpaceExploration_tiles) do - table.insert(ground, v) - end - end - - -- Ignored tileset for "Krastorio2" exported from 0.9.11 - -- Paving: {"kr-black-reinforced-plate", "kr-white-reinforced-plate"} - local Krastorio2_tiles = {"kr-creep"} - if game.active_mods["Krastorio2"] then - for _, v in ipairs(Krastorio2_tiles) do - table.insert(ground, v) - end - end - - for _, t in pairs(game.tile_prototypes) do - local found = false - for _, s in pairs(ground) do - if t.name == s then - found = true - break - end - end - if not found then - table.insert(paving, t.name) - end - end - return paving -end - -function getKeepList(surface, playerForceNames, overlap, pavers) - local count_entities = surface.count_entities_filtered - local count_tiles = surface.count_tiles_filtered - local count_total_chunks = 0 - local count_uncharted = 0 - local count_with_entities = 0 - local count_with_paving = 0 - local keepcords = {} - local chunks = surface.get_chunks() - for chunk in (chunks) do - local chunk_occupied = false - local chunk_charted = false - local chunk_paved = false - local chunkArea = {{chunk.x*32-overlap, chunk.y*32-overlap}, {chunk.x*32+32+overlap, chunk.y*32+32+overlap}} - for _, forceName in pairs (playerForceNames) do - if game.forces[forceName].is_chunk_charted( surface, chunk ) then - chunk_charted = true - break - end - end - if chunk_charted then - for _, forceName in pairs (playerForceNames) do - if count_entities{area=chunkArea, force=forceName, limit=1} ~= 0 then - chunk_occupied = true - break - end - end - if not chunk_occupied and #pavers > 0 then - local pavedArea = {{chunk.x*32, chunk.y*32}, {chunk.x*32+32, chunk.y*32+32}} - if count_tiles{area=pavedArea, name=pavers, limit=1} ~= 0 then - chunk_paved = true - end - end - if chunk_occupied or chunk_paved then - if keepcords[chunk.x] == nil then - keepcords[chunk.x]={} - end - keepcords[chunk.x][chunk.y]=1 - if chunk_occupied then - count_with_entities = count_with_entities + 1 - elseif chunk_paved then - count_with_paving = count_with_paving + 1 - end - end - else - count_uncharted = count_uncharted + 1 - end - count_total_chunks = count_total_chunks + 1 - end - -- Compatibility with Mining Drones, Mining_Drones_0.3.2/script/mining_drone.lua:24 - -- Of course it just has to be right on a chunk boundry. - if game.active_mods["Mining_Drones"] and surface.name == 'nauvis' then - local x = 1000000/32 - local y = 1000000/32 - if keepcords[x-1] == nil then - keepcords[x-1]={} - end - keepcords[x-1][y-1]=1 - keepcords[x-1][y]=1 - if keepcords[x] == nil then - keepcords[x]={} - end - keepcords[x][y-1]=1 - keepcords[x][y]=1 - end - return {total=count_total_chunks, occupied=count_with_entities, paved=count_with_paving, coordinates=keepcords, uncharted = count_uncharted} -end - -function deleteChunks(surface, coordinates, radius) - local count_adjacent = 0 - local count_keep = 0 - local count_deleted = 0 - local chunks = surface.get_chunks() - for chunk in (chunks) do - local mustClean = true - if coordinates[chunk.x] ~= nil and coordinates[chunk.x][chunk.y] ~= nil then - mustClean = false - elseif radius > 0 then - for i, x in pairs(coordinates) do - if chunk.x <= i + radius and chunk.x >= i - radius then - for j, y in pairs(x) do - if chunk.y <= j + radius and chunk.y >= j - radius then - mustClean = false - count_adjacent = count_adjacent + 1 - break - end - end - if not mustClean then - break - end - end - end - end - if mustClean then - surface.delete_chunk({chunk.x, chunk.y}) - count_deleted = count_deleted + 1 - else - count_keep = count_keep + 1 - end - end - return {adjacent=count_adjacent, deleted=count_deleted, kept=count_keep} -end - - - - - - -remote.add_interface('DeleteEmptyChunks', { - getSurface = function() return settings.global["DeleteEmptyChunks_surface"].value end, - getRadius = function() return settings.global["DeleteEmptyChunks_radius"].value end, - getPaving = function() return settings.global["DeleteEmptyChunks_paving"].value end, - DeleteEmptyChunks = remote_doit -}) - -do---- Init ---- -script.on_init(function() - for _, player in pairs(game.players) do - if player and player.valid then - if player.admin then - show_gui(player) - else - hide_gui(player) - end - end - end -end) - - -function show_gui(player) - if not (player and player.valid) then return end - local gui = mod_gui.get_button_flow(player) - if not (gui and gui.valid) then return end - if not gui.DeleteEmptyChunks then - gui.add{ - type = "sprite-button", - name = "DeleteEmptyChunks", - sprite = "DeleteEmptyChunks_button", - style = mod_gui.button_style, - tooltip = {'DeleteEmptyChunks_buttontext'} - } - end -end - -function hide_gui(player) - if not (player and player.valid) then return end - local gui = mod_gui.get_button_flow(player) - if not (gui and gui.valid) then return end - if gui.DeleteEmptyChunks then - gui.DeleteEmptyChunks.destroy() - end -end - -commands.add_command("DeleteEmptyChunks", {'DeleteEmptyChunks_command'}, function(param) - local args = {} - if param.player_index then - local player = game.players[param.player_index] - if player.admin then - if param.parameter then - args = load("return "..param.parameter)() - end - remote_doit(player.name, args) - else - player.print({'DeleteEmptyChunks_adminsonly'}) - end - else - if param.parameter then - args = load("return "..param.parameter)() - end - remote_doit("Server console", args) - end -end) - - - -do---- Init ---- -script.on_init(function() - for _, player in pairs(game.players) do - if player and player.valid then - if player.admin then - show_gui(player) - else - hide_gui(player) - end - end - end -end) - -script.on_configuration_changed(function(data) - for _, player in pairs(game.players) do - if player and player.valid then - if player.gui.left.DeleteEmptyChunks_button then player.gui.left.DeleteEmptyChunks_button.destroy() end - if player.admin then - show_gui(player) - else - hide_gui(player) - end - end - end -end) - -script.on_event({defines.events.on_player_created, defines.events.on_player_joined_game, defines.events.on_player_respawned}, function(event) - if event.player_index then - local player = game.players[event.player_index] - if player and player.valid then - if player.admin then - show_gui(player) - else - hide_gui(player) - end - end - end -end) - - -script.on_event(defines.events.on_player_promoted, function(event) - if event.player_index then - show_gui(game.players[event.player_index]) - end -end) - -script.on_event(defines.events.on_player_demoted, function(event) - if event.player_index then - hide_gui(game.players[event.player_index]) - end -end) -end - - - -------------------------------------------- -local function on_gui_click(event) - local player = game.players[event.player_index] - local element = event.element - - if element.name == "DeleteEmptyChunks" then - player.gui.screen.add{type = "frame", name = "delete_chunks_frame", caption = "Удалить чанки?", direction = "vertical"} - player.gui.screen.delete_chunks_frame.add{type = "button", name = "delete_chunks_yes", caption = "Да"} - player.gui.screen.delete_chunks_frame.add{type = "button", name = "delete_chunks_no", caption = "Нет"} - elseif element.name == "delete_chunks_yes" then - local target_surface = settings.global["DeleteEmptyChunks_surface"].value - local radius = settings.global["DeleteEmptyChunks_radius"].value - local keep_paving = settings.global["DeleteEmptyChunks_paving"].value - doit(player.name, target_surface, radius, keep_paving) - player.gui.screen.delete_chunks_frame.destroy() - elseif element.name == "delete_chunks_no" then - player.gui.screen.delete_chunks_frame.destroy() - end -end - -script.on_event(defines.events.on_gui_click, on_gui_click) - -------------------------------------------- - -end - diff --git a/DeleteEmptyChunks/data.lua b/DeleteEmptyChunks/data.lua deleted file mode 100644 index 3c6fd2d0..00000000 --- a/DeleteEmptyChunks/data.lua +++ /dev/null @@ -1,10 +0,0 @@ -data:extend({ - { - type = "sprite", - name = "DeleteEmptyChunks_button", - filename = "__DeleteEmptyChunks__/graphics/DeleteEmptyChunks_button.png", - priority = "extra-high-no-scale", - width = 32, - height = 32 - }, -}) diff --git a/DeleteEmptyChunks/description.md b/DeleteEmptyChunks/description.md deleted file mode 100644 index 80a70f47..00000000 --- a/DeleteEmptyChunks/description.md +++ /dev/null @@ -1,4 +0,0 @@ -##Delete Empty Chunks -Delete chunks which contain no player entities. Useful for slimming down save files and recovering lost performance from fruitless exploration. Can configure radius of adjacent chunks to keep and toggle keeping chunks with paving - -Based on [DestroyEmptyChunks](https://mods.factorio.com/mods/darkfrei/DestroyEmptyChunks) v0.0.5 by darkfrei diff --git a/DeleteEmptyChunks/graphics/DeleteEmptyChunks_button.png b/DeleteEmptyChunks/graphics/DeleteEmptyChunks_button.png deleted file mode 100644 index 05e7d6495d867b51e4fe624c2af20177af729224..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1424 zcmWmE2~d+)5CGsmA>4#BB4>y~z$Dy4Obn1fLbxSWDxzpZC`XYS5tKs^use&n3kD^FHR6IbbN?yjX(*BwG-tO$|yqSG7Z?=}RBLr<=V*o)AIxLj6 z6V5oz(bIw>OH?-wLC9B}$e3Wbgb)Y_fkbGb5L(&@lnzo`52>TCrE93AXM{2^Mj4u* zjLcAIb8Tacj)|qNnYFIDjXuU+Z-axr);e@c)CM)IxaHPAu0zKox6#X z@4zX*?JU|9Q)2ghxl?=<{y?qMfqFc*VGH*pA)($QslhGvjC)!ODVk%THAm)=CnaTxh*@GnhR`Lq&o#f# zt)Sn%@Pg-&Uww;y^C}&7FB$SI8}%(8rdD1hSKabDG45SG;Zt+hyH4qIO6hxQYFoXM z()hrm{-JyA6tnRzvvrouUtpYFq_@8aXn#fTe9P#0PZxX$5-hU>Z^A_H!X@uQrT?%c zpV%@LTLyw*Qoxb|rVOSE(f~nH5U8PIz$7rh5Cb|)0s=Ht0b&^Nhlzk6Obq-az#nc& z0bK*W2pBRD2$RFqK{7Q{4g<_y!0J^8Yk*)mOvTaw!3s570oc9j5QRGQoI30r2!|;^ zm;!|Kf)F`O6)IOno&ynmU`HR|^n)n*DpRTo(pU?U0Hy>4O5h3Abg7yy2LU4BF9d!< zKof%PLO_KH07VG4!32N|>jB$(RFobSxm)Ga1AO4F2v9{}I}Cn~aBX|nDz$Tk+_CI? zcGb7@Q;_f@t$l&kwm@rHpf%4C3kC`Cl`eaa*+u5rg=c!XnW^CqpB%;tj46DYKgHz6 zBOsmU*U7xuLH^UhjE*qz%wWbW>~-?wQ2XRr`g9cHSnnTRm!<}~t#B5(M;#eN%Iwu^ zf@a>Hub$-DP_!s*Z&60a$d;;6W98%gCk2S^X~`4(copwr7jHKHtGyJ$QE`u?f=XVC z&gNpRZzC_Ev0?oD4cbZGOtZtApR?^AW>5&1j6^6bCEEJ|m&jUbn4jKb!WH-Uxh*9X zf2B%&`n=0;7`Afeyw^EdBu6%OCNsM2nDw2wwh zir1YnN!XwlIoHZv9jnY+uDe>aV&gx=RjMjG6lMS2`&<(C9TtD|Y18g+<)w+Xk3V47 z6F`mGe{G5{hm8FWpP~HSf%$;RYf6X?+;x87rmZvQ_V8*&NUdH+QCUP6KlaOEWS*I9 z01NGwJ=@zr@~Xu)C5FtbZ$%t1=a@qzXeB4R_WG5RW2lBlaWq=;v#|-6kyx$P^GC-c ze&l5|#WwD*_{+~SJa1l(_hf9zp@qWi$xt5P*8boVoCkj5f1xaC}CHC39JbuedrqHG#b585_dw*0I#ed!i^?NafV`!$%=Jt^*?=(vuN(cRkl z$JL{ghoSQmSN7Z9s|zIcy;aVnVeh|rJx6Wqk}7Ne^k{o|L$g}Lf_Jd`gSf~42PA`q A>;M1& diff --git a/DeleteEmptyChunks/info.json b/DeleteEmptyChunks/info.json deleted file mode 100644 index 6324e423..00000000 --- a/DeleteEmptyChunks/info.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "DeleteEmptyChunks", - "description": "Delete chunks which contain no player entities, configurable chunk radius & paving detection", - "version": "0.4.3", - "title": "Delete Empty Chunks", - "author": "Strath", - "factorio_version": "1.1" -} diff --git a/DeleteEmptyChunks/locale/en/locale.cfg b/DeleteEmptyChunks/locale/en/locale.cfg deleted file mode 100644 index f2f21673..00000000 --- a/DeleteEmptyChunks/locale/en/locale.cfg +++ /dev/null @@ -1,29 +0,0 @@ -DeleteEmptyChunks_buttontext=Delete Empty Chunks - -DeleteEmptyChunks_text_notifier_pr=__1__ deleted empty chunks except those with paving and within radius __2__ -DeleteEmptyChunks_text_notifier_p=__1__ deleted empty chunks except those with paving -DeleteEmptyChunks_text_notifier_r=__1__ deleted empty chunks except those within radius __2__ -DeleteEmptyChunks_text_notifier=__1__ deleted empty chunks -DeleteEmptyChunks_text_notifier_paving=Detected __1__ paving tiles: __2__ vanilla and __3__ from mods -DeleteEmptyChunks_text_force=Forces: __1__ -DeleteEmptyChunks_text_starting=Starting with __1__ chunks on "__2__" surface, __3__ visible -DeleteEmptyChunks_text_keep_epa=Keeping __1__ chunks: __2__ with entities, __3__ with paving, and __4__ adjacent -DeleteEmptyChunks_text_keep_ep=Keeping __1__ chunks: __2__ with entities, and __3__ with paving -DeleteEmptyChunks_text_keep_ea=Keeping __1__ chunks: __2__ with entities, and __3__ adjacent -DeleteEmptyChunks_text_keep_e=Keeping __1__ chunks: __2__ with entities -DeleteEmptyChunks_text_keep_pa=Keeping __1__ chunks: __2__ with paving, and __3__ adjacent -DeleteEmptyChunks_text_keep_p=Keeping __1__ chunks: __2__ with paving -DeleteEmptyChunks_text_delete=Deleted __1__ chunks -DeleteEmptyChunks_text_mod_nosurface=DeleteEmptyChunks: Surface "__1__" not found. Valid surfaces: __2__ -DeleteEmptyChunks_command={surface="[surface name]", radius=[value], paving=[true/false]}, Deletes empty chunks. Omitted values default to mod settings, e.g., /DeleteEmptyChunks {radius=0, paving=true} -DeleteEmptyChunks_adminsonly=Only admins can delete empty chunks - -[mod-setting-name] -DeleteEmptyChunks_surface=Surface -DeleteEmptyChunks_radius=Keep Radius -DeleteEmptyChunks_paving=Detect Paving - -[mod-setting-description] -DeleteEmptyChunks_surface=Name of surface to process (Default is "nauvis") -DeleteEmptyChunks_radius=Radius of adjacent chucks to keep -DeleteEmptyChunks_paving=Also keep chunks containing concrete, stone paths, hazard concrete, etc diff --git a/DeleteEmptyChunks/settings.lua b/DeleteEmptyChunks/settings.lua deleted file mode 100644 index 37ff0a4b..00000000 --- a/DeleteEmptyChunks/settings.lua +++ /dev/null @@ -1,24 +0,0 @@ -data:extend({ - { - type = "string-setting", - name = "DeleteEmptyChunks_surface", - setting_type = "runtime-global", - default_value = "nauvis", - order = "1" - }, - { - type = "int-setting", - name = "DeleteEmptyChunks_radius", - setting_type = "runtime-global", - minimum_value = 0, - default_value = 2, - order = "2" - }, - { - type = "bool-setting", - name = "DeleteEmptyChunks_paving", - setting_type = "runtime-global", - default_value = true, - order = "3" - } -}) diff --git a/DeleteEmptyChunks/thumbnail.png b/DeleteEmptyChunks/thumbnail.png deleted file mode 100644 index 01e376a740a9e40bfd40fa493bdd8f43fbbf8f83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3366 zcmV+>4cYREP)P_y0fjnL?>Bj7{Hs z7bKqO9Z`ZKPyZdy&rc79=lA#bhm!QVUe@>52h#I#DW!azB&pT5U^{B9t)VW<(%N>? z1ID*|9)En1QuLTaZ>G}08@V&=yK^T=!WK`l^icXR&Nbly@>1ran0Y1UBC0V&dS8X~ z_s8pVDrjLGO^XHRRrz+n1FdJs%NTcEkwn9c&XWX738Pg8KwFs)#k@ zML12fOh<<0Nvfk}Mo6m_OvW;r*a<3gG!huUd=JN?$nZC4N2mv zvY`B0H|6{oi~<%CHgIulV3!5MBB*}75u_ayX5KiZJb*3;Dgi^0tLwzDRFI<8R>Pp? zV9a<5($xh(C<<;&x}BOp*5BvQ_BM%aagNG8;VB4O)B^Sy{7f>#a!g?uE$*KVSTY{y ze4$IUP2u|5c4`WV8-(M|&1X0KG9Kh@96GDYEZiZ-Bij8j4Rh!w_@HigWjwgc+;6kE zKO{FyBpODHSbh}$Er}DJg1in}WOF~dAUReP4I^mI-SDd#^q7b8W0y&cB&w(Mo=<9e zD%1L&ELUH)mCH5fV}|Bn2fOTjosI?V`~Yz&8MkK8F%Q_J9unq}9VduMI#i^FMFcY{ zV{f<$Lc+^VU05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