fix inventory clear (#416)

* Update clear_items function to accept player name

* Update inventory_clear.lua

* Update exp_scenario/module/control/inventory_clear.lua

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>

---------

Co-authored-by: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com>
This commit is contained in:
2026-03-27 22:48:53 +09:00
committed by GitHub
parent 91b6d25597
commit 6cbc4e5cfb

View File

@@ -1,5 +1,8 @@
--[[-- Control - Inventory Clear
Will move players items to spawn when they are banned or kicked, option to clear on leave
on_player_banned - player_name
on_player_kicked - player_index
]]
local ExpUtil = require("modules/exp_util")
@@ -7,6 +10,7 @@ local events = require("modules.exp_legacy.config.inventory_clear")
--- @param event { player_index: number }
local function clear_items(event)
if not event.player_index then return end
local player = assert(game.get_player(event.player_index))
local inventory = assert(player.get_main_inventory())
ExpUtil.transfer_inventory_to_surface{