Merge Game, FlyingText, Common and table

This commit is contained in:
Cooldude2606
2024-09-30 22:32:35 +01:00
parent 3145f7e904
commit f8c74c9dd3
66 changed files with 817 additions and 2035 deletions

View File

@@ -1,26 +1,36 @@
--- Disable new players from having certain items in their inventory, most commonly nukes
-- @addon Nukeprotect
local ExpUtil = require("modules/exp_util")
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
local Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
local config = require("modules.exp_legacy.config.nukeprotect") --- @dep config.nukeprotect
local move_items_stack = _C.move_items_stack --- @dep expcore.common
--- Check all items in the given inventory
---@param player LuaPlayer
---@param type defines.inventory
local function check_items(player, type)
-- if the player has perms to be ignored, then they should be
if config.ignore_permisison and Roles.player_allowed(player, config.ignore_permisison) then return end
-- if the players
if config.ignore_admins and player.admin then return end
local inventory = player.get_inventory(type)
local items = {} --- @type LuaItemStack[]
local inventory = assert(player.get_inventory(type))
for i = 1, #inventory do
local item = inventory[i]
if item.valid and item.valid_for_read and config[tostring(type)][item.name] then
player.print{ "nukeprotect.found", { "item-name." .. item.name } }
-- insert the items into the table so all items are transferred at once
move_items_stack{ item }
items[#items + 1] = item
end
end
ExpUtil.move_items_to_surface{
items = items,
surface = player.surface,
allow_creation = true,
name = "iron-chest",
}
end
for _, inventory in ipairs(config.inventories) do