mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-02 07:21:07 +00:00
Addition to 2f35e5a04ef828d: companions should still auto equip
This commit is contained in:
parent
4ad43fdf92
commit
68b87714bb
@ -79,13 +79,13 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr,
|
|||||||
{
|
{
|
||||||
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner);
|
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr, setOwner);
|
||||||
|
|
||||||
// Auto-equip items if an armor/clothing item is added, but not for the player nor werewolves
|
// Auto-equip items if an armor/clothing or weapon item is added, but not for the player nor werewolves
|
||||||
if ((actorPtr.getRefData().getHandle() != "player")
|
if ((actorPtr.getRefData().getHandle() != "player")
|
||||||
&& !(MWWorld::Class::get(actorPtr).getNpcStats(actorPtr).isWerewolf())
|
&& !(MWWorld::Class::get(actorPtr).getNpcStats(actorPtr).isWerewolf())
|
||||||
&& !actorPtr.getClass().getCreatureStats(actorPtr).isDead())
|
&& !actorPtr.getClass().getCreatureStats(actorPtr).isDead())
|
||||||
{
|
{
|
||||||
std::string type = itemPtr.getTypeName();
|
std::string type = itemPtr.getTypeName();
|
||||||
if ((type == typeid(ESM::Armor).name()) || (type == typeid(ESM::Clothing).name()))
|
if ((type == typeid(ESM::Armor).name()) || (type == typeid(ESM::Clothing).name()) || (type == typeid(ESM::Weapon).name()))
|
||||||
autoEquip(actorPtr);
|
autoEquip(actorPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,10 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
|||||||
|
|
||||||
// Only autoEquip if we are the original owner of the item.
|
// Only autoEquip if we are the original owner of the item.
|
||||||
// This stops merchants from auto equipping anything you sell to them.
|
// This stops merchants from auto equipping anything you sell to them.
|
||||||
if (!Misc::StringUtils::ciEqual(test.getCellRef().mOwner, actor.getCellRef().mRefID))
|
// ...unless this is a companion, he should always equip items given to him.
|
||||||
|
if (!Misc::StringUtils::ciEqual(test.getCellRef().mOwner, actor.getCellRef().mRefID) &&
|
||||||
|
(actor.getClass().getScript(actor).empty() ||
|
||||||
|
!actor.getRefData().getLocals().getIntVar(actor.getClass().getScript(actor), "companion")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int testSkill = MWWorld::Class::get (test).getEquipmentSkill (test);
|
int testSkill = MWWorld::Class::get (test).getEquipmentSkill (test);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user