Spell Check and Lua Check

This commit is contained in:
Cooldude2606
2019-01-11 22:32:30 +00:00
parent 7110b76444
commit 082d9e5439
65 changed files with 760 additions and 724 deletions

View File

@@ -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()