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

@@ -3,21 +3,26 @@
@commands Clear-Inventory
]]
local ExpUtil = require("modules/exp_util")
local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore.commands
local move_items_stack = _C.move_items_stack --- @dep expcore.common
require("modules.exp_legacy.config.expcore.command_role_parse")
--- Clears a players inventory
-- @command clear-inventory
-- @tparam LuaPlayer player the player to clear the inventory of
Commands.new_command("clear-inventory", { "expcom-clr-inv.description" }, "Clears a players inventory")
:add_param("player", false, "player-role")
:add_alias("clear-inv", "move-inventory", "move-inv")
:register(function(_, player)
local inv = player.get_main_inventory()
if not inv then
return Commands.error{ "expcore-commands.reject-player-alive" }
end
move_items_stack(inv)
inv.clear()
end)
:add_param("player", false, "player-role")
:add_alias("clear-inv", "move-inventory", "move-inv")
:register(function(_, player)
local inventory = player.get_main_inventory()
if not inventory then
return Commands.error{ "expcore-commands.reject-player-alive" }
end
ExpUtil.transfer_inventory_to_surface{
inventory = inventory,
surface = player.surface,
name = "iron-chest",
allow_creation = true,
}
end)