mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-14 15:00:18 -04:00
respawning npc respawns in origin cell
This commit is contained in:
parent
b7a48e1d78
commit
2df7ded814
@ -1427,7 +1427,8 @@ namespace MWClass
|
|||||||
ptr.getRefData().setCustomData(nullptr);
|
ptr.getRefData().setCustomData(nullptr);
|
||||||
|
|
||||||
// Reset to original position
|
// Reset to original position
|
||||||
MWBase::Environment::get().getWorld()->moveObject(ptr, ptr.getCellRef().getPosition().asVec3());
|
MWBase::Environment::get().getWorld()->moveObject(
|
||||||
|
ptr, ptr.getCell()->getOriginCell(ptr), ptr.getCellRef().getPosition().asVec3());
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(
|
MWBase::Environment::get().getWorld()->rotateObject(
|
||||||
ptr, ptr.getCellRef().getPosition().asRotationVec3(), MWBase::RotationFlag_none);
|
ptr, ptr.getCellRef().getPosition().asRotationVec3(), MWBase::RotationFlag_none);
|
||||||
}
|
}
|
||||||
|
@ -1354,6 +1354,15 @@ namespace MWWorld
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CellStore* MWWorld::CellStore::getOriginCell(const Ptr& object) const
|
||||||
|
{
|
||||||
|
MovedRefTracker::const_iterator found = mMovedHere.find(object.getBase());
|
||||||
|
if (found != mMovedHere.end())
|
||||||
|
return found->second;
|
||||||
|
|
||||||
|
return object.getCell();
|
||||||
|
}
|
||||||
|
|
||||||
Ptr CellStore::getPtr(ESM::RefId id)
|
Ptr CellStore::getPtr(ESM::RefId id)
|
||||||
{
|
{
|
||||||
if (mState == CellStore::State_Unloaded)
|
if (mState == CellStore::State_Unloaded)
|
||||||
|
@ -338,6 +338,8 @@ namespace MWWorld
|
|||||||
|
|
||||||
Ptr getMovedActor(int actorId) const;
|
Ptr getMovedActor(int actorId) const;
|
||||||
|
|
||||||
|
CellStore* getOriginCell(const Ptr& object) const;
|
||||||
|
|
||||||
Ptr getPtr(ESM::RefId id);
|
Ptr getPtr(ESM::RefId id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user