mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
.
This commit is contained in:
@@ -65,16 +65,19 @@ Selection.on_selection(SelectionName, function(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local tile_count = 0
|
local tile_count = 0
|
||||||
|
local remaining_tiles = 0
|
||||||
local tiles_to_make = {}
|
local tiles_to_make = {}
|
||||||
local chest = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force }
|
local chest = surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force }
|
||||||
local tile_to_apply = (surface.planet and planet[surface.planet]) or "water-mud"
|
local tile_to_apply = (surface.planet and planet[surface.planet]) or "water-mud"
|
||||||
|
|
||||||
if #chest > 0 then
|
if #chest > 0 then
|
||||||
for _, v in pairs(chest) do
|
for _, v in pairs(chest) do
|
||||||
if v.get_inventory(defines.inventory.chest).is_empty() then
|
if v.get_inventory(defines.inventory.chest).is_empty() and tile_count < item_count_total then
|
||||||
tile_count = tile_count + 1
|
tile_count = tile_count + 1
|
||||||
tiles_to_make[tile_count] = { name = tile_to_apply, position = { v.position.x, v.position.y } }
|
tiles_to_make[tile_count] = { name = tile_to_apply, position = { v.position.x, v.position.y } }
|
||||||
v.destroy()
|
v.destroy()
|
||||||
|
elseif v.get_inventory(defines.inventory.chest).is_empty() then
|
||||||
|
remaining_tiles = remaining_tiles + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -85,10 +88,11 @@ Selection.on_selection(SelectionName, function(event)
|
|||||||
tiles_to_make[tile_count] = { name = tile_to_apply, position = { x, y } }
|
tiles_to_make[tile_count] = { name = tile_to_apply, position = { x, y } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply }
|
||||||
end
|
end
|
||||||
|
|
||||||
surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0)
|
surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0)
|
||||||
local remaining_tiles = surface.count_tiles_filtered{ area = area, name = tile_to_apply }
|
|
||||||
local t_diff = tile_count - remaining_tiles
|
local t_diff = tile_count - remaining_tiles
|
||||||
|
|
||||||
if item_count_cliff >= t_diff and t_diff > 0 then
|
if item_count_cliff >= t_diff and t_diff > 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user