-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Since core supports Npc with inventory and equipment, it should also support removing those items when the Npc is removed. Currently we have MobManager.removeMob(mob) that handles most of clean up. Right now, all the Items that are in possession of the Npc, still remain in the ItemManager. This will just build up over time as the uptime of the server increases.
For the time being, I've added some code (in my repository) to the removeMob() method in the MobManager class. I can see this functionality being added here or in the Npc class.
if (mob.equipment && mob.equipment.size) {
mob.equipment.forEach((item, slot) => mob.unequip(slot));
}
if (mob.inventory && mob.inventory.size) {
mob.inventory.forEach(item => this.state.ItemManager.remove(item));
}
I unequip the items first as the current stack will eventually call Character.removeItem() on Items being worn in equipment and that removeItem method points toward inventory.
Would like to see this be officially supported.