mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Update all code styles
This commit is contained in:
@@ -4,33 +4,33 @@
|
||||
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
local Selection = require("modules.exp_legacy.modules.control.selection") --- @dep modules.control.selection
|
||||
local SelectionConvertArea = 'ConvertArea'
|
||||
local SelectionConvertArea = "ConvertArea"
|
||||
|
||||
--- Align an aabb to the grid by expanding it
|
||||
local function aabb_align_expand(aabb)
|
||||
return {
|
||||
left_top = {x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y)},
|
||||
right_bottom = {x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y)}
|
||||
left_top = { x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y) },
|
||||
right_bottom = { x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y) },
|
||||
}
|
||||
end
|
||||
|
||||
Commands.new_command('waterfill', {'expcom-waterfill.description'}, 'Change tile to water')
|
||||
:register(function(player)
|
||||
local inv = player.get_main_inventory()
|
||||
Commands.new_command("waterfill", { "expcom-waterfill.description" }, "Change tile to water")
|
||||
:register(function(player)
|
||||
local inv = player.get_main_inventory()
|
||||
|
||||
if (inv.get_item_count('cliff-explosives')) == 0 then
|
||||
return player.print{'expcom-waterfill.waterfill-cliff'}
|
||||
end
|
||||
if (inv.get_item_count("cliff-explosives")) == 0 then
|
||||
return player.print{ "expcom-waterfill.waterfill-cliff" }
|
||||
end
|
||||
|
||||
if Selection.is_selecting(player, SelectionConvertArea) then
|
||||
Selection.stop(player)
|
||||
else
|
||||
Selection.start(player, SelectionConvertArea)
|
||||
return Commands.success{'expcom-waterfill.entered-area-selection'}
|
||||
end
|
||||
if Selection.is_selecting(player, SelectionConvertArea) then
|
||||
Selection.stop(player)
|
||||
else
|
||||
Selection.start(player, SelectionConvertArea)
|
||||
return Commands.success{ "expcom-waterfill.entered-area-selection" }
|
||||
end
|
||||
|
||||
return Commands.success
|
||||
end)
|
||||
return Commands.success
|
||||
end)
|
||||
|
||||
--- When an area is selected to add protection to the area
|
||||
Selection.on_selection(SelectionConvertArea, function(event)
|
||||
@@ -41,10 +41,10 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
local entities = player.surface.find_entities_filtered{area=area, name='steel-chest'}
|
||||
local entities = player.surface.find_entities_filtered{ area = area, name = "steel-chest" }
|
||||
|
||||
if #entities == 0 then
|
||||
player.print('No steel chest found')
|
||||
player.print("No steel chest found")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -55,21 +55,21 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
local clf_exp = inv.get_item_count('cliff-explosives')
|
||||
local clf_exp = inv.get_item_count("cliff-explosives")
|
||||
|
||||
for _, entity in pairs(entities) do
|
||||
if clf_exp >= 1 then
|
||||
if entity.get_inventory(defines.inventory.chest).is_empty() then
|
||||
if (math.floor(player.position.x) ~= math.floor(entity.position.x)) or (math.floor(player.position.y) ~= math.floor(entity.position.y)) then
|
||||
table.insert(tiles_to_make, {name='water-mud', position=entity.position})
|
||||
table.insert(tiles_to_make, { name = "water-mud", position = entity.position })
|
||||
entity.destroy()
|
||||
else
|
||||
player.print{'expcom-waterfill.waterfill-distance'}
|
||||
player.print{ "expcom-waterfill.waterfill-distance" }
|
||||
end
|
||||
end
|
||||
|
||||
clf_exp = clf_exp - 1
|
||||
inv.remove({name='cliff-explosives', count=1})
|
||||
inv.remove{ name = "cliff-explosives", count = 1 }
|
||||
else
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user