mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Fix order of operations when undoing werewolf transformation of an NPC
This commit is contained in:
parent
505250f6ec
commit
b6d02d9b14
@ -1531,27 +1531,23 @@ namespace MWMechanics
|
|||||||
player->restoreSkillsAttributes();
|
player->restoreSkillsAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equipped items other than WerewolfRobe may reference bones that do not even
|
|
||||||
// exist with the werewolf object root, so make sure to unequip all items
|
|
||||||
// *before* we become a werewolf.
|
|
||||||
MWWorld::InventoryStore& invStore = actor.getClass().getInventoryStore(actor);
|
|
||||||
invStore.unequipAll(actor);
|
|
||||||
|
|
||||||
// Werewolfs can not cast spells, so we need to unset the prepared spell if there is one.
|
// Werewolfs can not cast spells, so we need to unset the prepared spell if there is one.
|
||||||
if (npcStats.getDrawState() == MWMechanics::DrawState_Spell)
|
if (npcStats.getDrawState() == MWMechanics::DrawState_Spell)
|
||||||
npcStats.setDrawState(MWMechanics::DrawState_Nothing);
|
npcStats.setDrawState(MWMechanics::DrawState_Nothing);
|
||||||
|
|
||||||
npcStats.setWerewolf(werewolf);
|
npcStats.setWerewolf(werewolf);
|
||||||
|
|
||||||
|
MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor);
|
||||||
|
|
||||||
if(werewolf)
|
if(werewolf)
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor);
|
inv.unequipAll(actor);
|
||||||
|
|
||||||
inv.equip(MWWorld::InventoryStore::Slot_Robe, inv.ContainerStore::add("werewolfrobe", 1, actor), actor);
|
inv.equip(MWWorld::InventoryStore::Slot_Robe, inv.ContainerStore::add("werewolfrobe", 1, actor), actor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actor.getClass().getContainerStore(actor).remove("werewolfrobe", 1, actor);
|
inv.unequipSlot(MWWorld::InventoryStore::Slot_Robe, actor);
|
||||||
|
inv.ContainerStore::remove("werewolfrobe", 1, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(actor == player->getPlayer())
|
if(actor == player->getPlayer())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user