mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Allow script-based teleportation from interior to exterior cell 0,0
This commit is contained in:
parent
b4c7914a25
commit
b0bd10f219
2 changed files with 20 additions and 25 deletions
|
@ -104,10 +104,7 @@ void ScriptFunctions::SetExterior(unsigned short pid, int x, int y) noexcept
|
|||
cout << "exterior: " << player->GetCell()->mCellId.mIndex.mX << ", " << player->GetCell()->mCellId.mIndex.mY;
|
||||
cout << " in to exterior cell \"" << x << ", " << y << "\"" << endl;
|
||||
|
||||
/*cout << "TEST1 : " << player->GetCell()->mData.mFlags << endl;
|
||||
player->GetCell()->mData.mFlags &= ~1;
|
||||
cout << "TEST2 : " << player->GetCell()->mData.mFlags << endl;*/
|
||||
|
||||
player->GetCell()->mName = "";
|
||||
player->GetCell()->mCellId.mIndex.mX = x;
|
||||
player->GetCell()->mCellId.mIndex.mY = y;
|
||||
|
||||
|
|
|
@ -139,29 +139,27 @@ void LocalPlayer::setCell()
|
|||
int x = GetCell()->mCellId.mIndex.mX;
|
||||
int y = GetCell()->mCellId.mIndex.mY;
|
||||
ESM::CellId curCell = player.mCell->getCell()->mCellId;
|
||||
if(x != curCell.mIndex.mX || y != curCell.mIndex.mY)
|
||||
{
|
||||
cout << "Exterior location: " << x << ", " << y << endl;
|
||||
world->indexToPosition (x, y, pos.pos[0], pos.pos[1], true);
|
||||
pos.pos[2] = 0;
|
||||
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
if (GetCell()->mName.empty())
|
||||
{
|
||||
world->indexToPosition(x, y, pos.pos[0], pos.pos[1], true);
|
||||
pos.pos[2] = 0;
|
||||
|
||||
world->changeToExteriorCell (pos, true);
|
||||
world->fixPosition(player);
|
||||
}
|
||||
else if (world->findExteriorPosition(GetCell()->mName, pos))
|
||||
{
|
||||
cout << "Exterior location: " << GetCell()->mName << endl;
|
||||
world->changeToExteriorCell(pos, true);
|
||||
world->fixPosition(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Interior location: " << GetCell()->mName << endl;
|
||||
world->findInteriorPosition(GetCell()->mName, pos);
|
||||
world->changeToInteriorCell(GetCell()->mName, pos, true);
|
||||
}
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
|
||||
world->changeToExteriorCell(pos, true);
|
||||
world->fixPosition(player);
|
||||
}
|
||||
else if (world->findExteriorPosition(GetCell()->mName, pos))
|
||||
{
|
||||
world->changeToExteriorCell(pos, true);
|
||||
world->fixPosition(player);
|
||||
}
|
||||
else {
|
||||
|
||||
world->findInteriorPosition(GetCell()->mName, pos);
|
||||
world->changeToInteriorCell(GetCell()->mName, pos, true);
|
||||
}
|
||||
|
||||
updateCell(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue