mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
Spell Check and Lua Check
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
--- Adds a function to clear a players inventoy and move the items to spawn.
|
||||
--- Adds a function to clear a players inventory and move the items to spawn.
|
||||
-- @module ExpGamingAdmin.ClearInventory@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Admin = require('ExpGamingAdmin')
|
||||
@@ -13,7 +13,7 @@ local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Function Define
|
||||
local inventorys = {
|
||||
local inventories = {
|
||||
defines.inventory.player_main,
|
||||
defines.inventory.player_quickbar,
|
||||
defines.inventory.player_trash,
|
||||
@@ -23,7 +23,7 @@ local inventorys = {
|
||||
}
|
||||
|
||||
function Admin.move_item_to_spawn(item,surface,chests)
|
||||
local chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
||||
chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
||||
local chest = nil
|
||||
while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do
|
||||
chest = table.remove(chests,1)
|
||||
@@ -38,14 +38,14 @@ function Admin.move_item_to_spawn(item,surface,chests)
|
||||
end
|
||||
|
||||
function Admin.move_inventory(player)
|
||||
local player = Game.get_player(player)
|
||||
player = Game.get_player(player)
|
||||
if not player then return end
|
||||
local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {}
|
||||
for _,_inventory in pairs(inventorys) do
|
||||
for _,_inventory in pairs(inventories) do
|
||||
local inventory = player.get_inventory(_inventory)
|
||||
if inventory then
|
||||
for item,count in pairs(inventory.get_contents()) do
|
||||
local item = {name=item,count=count}
|
||||
item = {name=item,count=count}
|
||||
chests = Admin.move_item_to_spawn(item,player.surface,chests)
|
||||
end
|
||||
inventory.clear()
|
||||
|
||||
Reference in New Issue
Block a user