mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Make PlaceItem place the item in the player's current worldspace
This commit is contained in:
parent
3007af44ea
commit
628600a0a5
1 changed files with 17 additions and 16 deletions
|
@ -463,11 +463,17 @@ namespace MWScript
|
|||
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::CellStore* store = NULL;
|
||||
if (player.getCell()->isExterior())
|
||||
{
|
||||
int cx,cy;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
||||
MWWorld::CellStore* store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||
if(store)
|
||||
{
|
||||
store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||
}
|
||||
else
|
||||
store = player.getCell();
|
||||
|
||||
ESM::Position pos;
|
||||
pos.pos[0] = x;
|
||||
pos.pos[1] = y;
|
||||
|
@ -478,11 +484,6 @@ namespace MWScript
|
|||
ref.getPtr().getCellRef().setPosition(pos);
|
||||
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error ("unknown cell");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class R, bool pc>
|
||||
|
|
Loading…
Reference in a new issue