mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
.
This commit is contained in:
@@ -7,6 +7,14 @@ local Commands = require("modules/exp_commands")
|
||||
local Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection
|
||||
local SelectionName = "ExpCommand_Waterfill"
|
||||
|
||||
local planet = {
|
||||
["nauvis"] = "water-mud",
|
||||
["gleba"] = "water-mud",
|
||||
["vulcanus"] = "lava",
|
||||
["fulgora"] = "oil-ocean-shallow",
|
||||
["aquilo"] = "ammoniacal-ocean"
|
||||
}
|
||||
|
||||
--- Toggle player selection mode for artillery
|
||||
Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
||||
:register(function(player)
|
||||
@@ -41,6 +49,7 @@ Selection.on_selection(SelectionName, function(event)
|
||||
]]
|
||||
|
||||
local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y)
|
||||
|
||||
if area_size > 1000 then
|
||||
player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error)
|
||||
return
|
||||
@@ -61,14 +70,14 @@ Selection.on_selection(SelectionName, function(event)
|
||||
for y = area.left_top.y, area.right_bottom.y do
|
||||
tile_count = tile_count + 1
|
||||
tiles_to_make[tile_count] = {
|
||||
name = "water-mud",
|
||||
name = (surface.planet and planet[surface.planet]) or "water-mud",
|
||||
position = { x, y },
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0)
|
||||
local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" }
|
||||
local remaining_tiles = surface.count_tiles_filtered{ area = area, name = (surface.planet and planet[surface.planet]) or "water-mud" }
|
||||
local t_diff = tile_count - remaining_tiles
|
||||
|
||||
if item_count_cliff >= t_diff then
|
||||
|
||||
Reference in New Issue
Block a user