1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Auto-equip items when a clothe or an armor is removed from inventory

This fix auto-equip on corpses.
This commit is contained in:
Emanuel Guevel 2013-10-24 02:14:05 +02:00
parent 750f1fd760
commit 59c963b6cc

View file

@ -321,7 +321,19 @@ int MWWorld::InventoryStore::remove(const Ptr& item, int count, const Ptr& actor
}
}
return ContainerStore::remove(item, count, actor);
int retCount = ContainerStore::remove(item, count, actor);
// If an armor/clothing item is removed, try to find a replacement,
// but not for the player nor werewolves.
if ((actor.getRefData().getHandle() != "player")
&& !(MWWorld::Class::get(actor).getNpcStats(actor).isWerewolf()))
{
std::string type = item.getTypeName();
if ((type == typeid(ESM::Armor).name()) || (type == typeid(ESM::Clothing).name()))
autoEquip(actor);
}
return retCount;
}
void MWWorld::InventoryStore::unequipSlot(int slot, const MWWorld::Ptr& actor)