mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +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 Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection
|
||||||
local SelectionName = "ExpCommand_Waterfill"
|
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
|
--- Toggle player selection mode for artillery
|
||||||
Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
||||||
:register(function(player)
|
: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)
|
local area_size = (area.right_bottom.x - area.left_top.x) * (area.right_bottom.y - area.left_top.y)
|
||||||
|
|
||||||
if area_size > 1000 then
|
if area_size > 1000 then
|
||||||
player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error)
|
player.print({ "exp-commands_waterfill.area-too-large", 1000, area_size }, Commands.print_settings.error)
|
||||||
return
|
return
|
||||||
@@ -61,14 +70,14 @@ Selection.on_selection(SelectionName, function(event)
|
|||||||
for y = area.left_top.y, area.right_bottom.y do
|
for y = area.left_top.y, area.right_bottom.y do
|
||||||
tile_count = tile_count + 1
|
tile_count = tile_count + 1
|
||||||
tiles_to_make[tile_count] = {
|
tiles_to_make[tile_count] = {
|
||||||
name = "water-mud",
|
name = (surface.planet and planet[surface.planet]) or "water-mud",
|
||||||
position = { x, y },
|
position = { x, y },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
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 = "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
|
local t_diff = tile_count - remaining_tiles
|
||||||
|
|
||||||
if item_count_cliff >= t_diff then
|
if item_count_cliff >= t_diff then
|
||||||
|
|||||||
Reference in New Issue
Block a user