mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +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;
|
Interpreter::Type_Float zRot = runtime[0].mFloat;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
|
MWWorld::CellStore* store = NULL;
|
||||||
|
if (player.getCell()->isExterior())
|
||||||
|
{
|
||||||
int cx,cy;
|
int cx,cy;
|
||||||
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
MWBase::Environment::get().getWorld()->positionToIndex(x,y,cx,cy);
|
||||||
MWWorld::CellStore* store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
store = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
|
||||||
if(store)
|
}
|
||||||
{
|
else
|
||||||
|
store = player.getCell();
|
||||||
|
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
pos.pos[0] = x;
|
pos.pos[0] = x;
|
||||||
pos.pos[1] = y;
|
pos.pos[1] = y;
|
||||||
|
@ -478,11 +484,6 @@ namespace MWScript
|
||||||
ref.getPtr().getCellRef().setPosition(pos);
|
ref.getPtr().getCellRef().setPosition(pos);
|
||||||
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,pos);
|
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,pos);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw std::runtime_error ("unknown cell");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R, bool pc>
|
template<class R, bool pc>
|
||||||
|
|
Loading…
Reference in a new issue