mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-17 14:25:27 +09:00
fix: LuaItemStack could be invalid
Fixed an issue with clearing inventories of players where the command failed due to it attempting to access LuaItemStacks that were invalid for read
This commit is contained in:
1 parent
8caf3c0a82
commit
15a5d8d48a
3 files changed
+17
-15
No files matched your search
+6
-4
@@ -645,10 +645,12 @@ function Common.move_items_stack(items, surface, position, radius, chest_type)
|
||||
local last_chest
|
||||
for i=1,#items do
|
||||
local item = items[i]
|
||||
local chest = next_chest(item)
|
||||
if not chest or not chest.valid then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius', item_name, surface.name, p.x, p.y)) end
|
||||
chest.insert(item)
|
||||
last_chest = chest
|
||||
if item.valid_for_read then
|
||||
local chest = next_chest(item)
|
||||
if not chest or not chest.valid then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius', item_name, surface.name, p.x, p.y)) end
|
||||
chest.insert(item)
|
||||
last_chest = chest
|
||||
end
|
||||
end
|
||||
return last_chest
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user