From 1da4b31047af1356bc3a5c4491e53714a6973005 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Mon, 24 Feb 2020 02:16:09 +0300 Subject: [PATCH] Switch torches to shields for hostile NPCs (bug #5300) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/actors.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf28d3da6..75acc0339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -202,6 +202,7 @@ Bug #5264: "Damage Fatigue" Magic Effect Can Bring Fatigue below 0 Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted Bug #5278: Console command Show doesn't fall back to global variable after local var not found + Bug #5300: NPCs don't switch from torch to shield when starting combat Feature #1415: Infinite fall failsafe Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 550caf9d1..bda78c0b5 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1234,6 +1234,11 @@ namespace MWMechanics if (heldIter != inventoryStore.end() && heldIter->getTypeName() != typeid(ESM::Light).name()) inventoryStore.unequipItem(*heldIter, ptr); } + else if (heldIter == inventoryStore.end() || heldIter->getTypeName() == typeid(ESM::Light).name()) + { + // For hostile NPCs, see if they have anything better to equip first + inventoryStore.autoEquip(ptr); + } heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);