1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 21:49:55 +00:00

Allow script-based teleportation from interior to exterior cell 0,0

This commit is contained in:
David Cernat 2016-08-03 22:07:49 +03:00
parent b4c7914a25
commit b0bd10f219
2 changed files with 20 additions and 25 deletions

View file

@ -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 << "exterior: " << player->GetCell()->mCellId.mIndex.mX << ", " << player->GetCell()->mCellId.mIndex.mY;
cout << " in to exterior cell \"" << x << ", " << y << "\"" << endl; cout << " in to exterior cell \"" << x << ", " << y << "\"" << endl;
/*cout << "TEST1 : " << player->GetCell()->mData.mFlags << endl; player->GetCell()->mName = "";
player->GetCell()->mData.mFlags &= ~1;
cout << "TEST2 : " << player->GetCell()->mData.mFlags << endl;*/
player->GetCell()->mCellId.mIndex.mX = x; player->GetCell()->mCellId.mIndex.mX = x;
player->GetCell()->mCellId.mIndex.mY = y; player->GetCell()->mCellId.mIndex.mY = y;

View file

@ -139,29 +139,27 @@ void LocalPlayer::setCell()
int x = GetCell()->mCellId.mIndex.mX; int x = GetCell()->mCellId.mIndex.mX;
int y = GetCell()->mCellId.mIndex.mY; int y = GetCell()->mCellId.mIndex.mY;
ESM::CellId curCell = player.mCell->getCell()->mCellId; 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); pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
world->fixPosition(player);
} world->changeToExteriorCell(pos, true);
else if (world->findExteriorPosition(GetCell()->mName, pos)) world->fixPosition(player);
{ }
cout << "Exterior location: " << GetCell()->mName << endl; else if (world->findExteriorPosition(GetCell()->mName, pos))
world->changeToExteriorCell(pos, true); {
world->fixPosition(player); world->changeToExteriorCell(pos, true);
} world->fixPosition(player);
else }
{ else {
cout << "Interior location: " << GetCell()->mName << endl;
world->findInteriorPosition(GetCell()->mName, pos); world->findInteriorPosition(GetCell()->mName, pos);
world->changeToInteriorCell(GetCell()->mName, pos, true); world->changeToInteriorCell(GetCell()->mName, pos, true);
} }
updateCell(true); updateCell(true);
} }