mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Items are moved to spawn chests on clear
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
@commands Clear Item On Ground
|
@commands Clear Item On Ground
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
local copy_items_stack = _C.copy_items_stack --- @dep expcore.common
|
||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
require 'config.expcore.command_general_parse'
|
require 'config.expcore.command_general_parse'
|
||||||
|
|
||||||
@@ -11,6 +12,9 @@ Commands.new_command('clear-item-on-ground', 'Clear Item On Ground')
|
|||||||
:register(function(player, range)
|
:register(function(player, range)
|
||||||
for _, e in pairs(player.surface.find_entities_filtered{position=player.position, radius=range, name='item-on-ground'}) do
|
for _, e in pairs(player.surface.find_entities_filtered{position=player.position, radius=range, name='item-on-ground'}) do
|
||||||
if e.stack then
|
if e.stack then
|
||||||
|
-- calling move_items_stack(e.stack) will crash to desktop
|
||||||
|
-- https://forums.factorio.com/viewtopic.php?f=7&t=110322
|
||||||
|
copy_items_stack{e.stack}
|
||||||
e.stack.clear()
|
e.stack.clear()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user