mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Use safePlaceObject in spawnRandomCreature
This commit is contained in:
parent
7485abe5c3
commit
36bb255bc0
1 changed files with 1 additions and 15 deletions
|
@ -3064,23 +3064,9 @@ namespace MWWorld
|
|||
if (selectedCreature.empty())
|
||||
return;
|
||||
|
||||
ESM::Position ipos = mPlayer->getPlayer().getRefData().getPosition();
|
||||
osg::Vec3f pos(ipos.asVec3());
|
||||
osg::Quat rot(-ipos.rot[2], osg::Vec3f(0,0,1));
|
||||
const float distance = 50;
|
||||
pos = pos + (rot * osg::Vec3f(0,1,0)) * distance;
|
||||
ipos.pos[0] = pos.x();
|
||||
ipos.pos[1] = pos.y();
|
||||
ipos.pos[2] = pos.z();
|
||||
ipos.rot[0] = 0;
|
||||
ipos.rot[1] = 0;
|
||||
ipos.rot[2] = 0;
|
||||
|
||||
MWWorld::CellStore* cell = mPlayer->getPlayer().getCell();
|
||||
MWWorld::ManualRef ref(getStore(), selectedCreature, 1);
|
||||
ref.getPtr().getCellRef().setPosition(ipos);
|
||||
|
||||
placeObject(ref.getPtr(), cell, ipos);
|
||||
safePlaceObject(ref.getPtr(), getPlayerPtr(), getPlayerPtr().getCell(), 0, 220.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue