Пример #1
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    Interpreter::Type_Integer x = runtime[0].mInteger;
                    runtime.pop();

                    Interpreter::Type_Integer y = runtime[0].mInteger;
                    runtime.pop();

                    ESM::Position pos;
                    MWBase::World *world = MWBase::Environment::get().getWorld();
                    const MWWorld::Ptr playerPtr = world->getPlayerPtr();

                    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;

                    MWWorld::ActionTeleport("", pos, false).execute(playerPtr);
                    world->adjustPosition(playerPtr, false);
                }
Пример #2
0
                virtual void execute (Interpreter::Runtime& runtime)
                {
                    std::string cell = runtime.getStringLiteral (runtime[0].mInteger);
                    runtime.pop();

                    ESM::Position pos;
                    MWBase::World *world = MWBase::Environment::get().getWorld();
                    const MWWorld::Ptr playerPtr = world->getPlayerPtr();

                    if (world->findExteriorPosition(cell, pos))
                    {
                        MWWorld::ActionTeleport("", pos, false).execute(playerPtr);
                        world->adjustPosition(playerPtr, false);
                    }
                    else
                    {
                        // Change to interior even if findInteriorPosition()
                        // yields false. In this case position will be zero-point.
                        world->findInteriorPosition(cell, pos);
                        MWWorld::ActionTeleport(cell, pos, false).execute(playerPtr);
                    }
                }