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:
parent
750f1fd760
commit
59c963b6cc
1 changed files with 13 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue