diff --git a/config/_file_loader.lua b/config/_file_loader.lua index 16ec66d8..aa1853cf 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -44,6 +44,7 @@ return { 'modules.commands.vlayer', 'modules.commands.enemy', 'modules.commands.waterfill', + 'modules.commands.surface-clearing', --- Addons 'modules.addons.chat-popups', diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 42d31c34..b8a27f3b 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -230,7 +230,9 @@ Roles.new_role('Member','Mem') 'command/auto-research', 'command/manual-train', 'command/lawnmower', - 'command/waterfill' + 'command/waterfill', + 'command/clear-item-on-ground', + 'command/clear-blueprint' } local hours3, hours15 = 3*216000, 15*60 diff --git a/modules/commands/surface-clearing.lua b/modules/commands/surface-clearing.lua new file mode 100644 index 00000000..d8cb19ef --- /dev/null +++ b/modules/commands/surface-clearing.lua @@ -0,0 +1,34 @@ +--[[-- Commands Module - Clear Item On Ground + - Adds a command that clear item on ground so blueprint can deploy safely + @commands Clear Item On Ground +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('clear-item-on-ground', 'Clear Item On Ground') +:add_param('range', false, 'integer-range', 1, 1000) +:register(function(player, range) + for _, e in pairs(player.surface.find_entities_filtered{position=player.position, radius=range, name='item-on-ground'}) do + if e.stack then + e.stack.clear() + end + end + + return Commands.success +end) + +--[[-- Commands Module - Clear Blueprint + - Adds a command that clear blueprint spamming or leftover + @commands Clear Blueprint +]] + +Commands.new_command('clear-blueprint', 'Clear Blueprint') +:add_param('range', false, 'integer-range', 1, 1000) +:register(function(player, range) + for _, e in pairs(player.surface.find_entities_filtered{position=player.position, radius=range, type='entity-ghost'}) do + e.destroy() + end + + return Commands.success +end) \ No newline at end of file