> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-es/tiempo-de-ejecucion-de-la-escena/modulos-de-tiempo-de-ejecucion/restricted-actions.md).

# Acciones restringidas

El `RestrictedActions` módulo permite que las escenas accedan a funcionalidad sensible (y, por lo tanto, restringida). Está vinculado al [`permiso`](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md#permissions) sistema, que las escenas usan para solicitar el uso de métodos individuales.

```ts
const RestrictedActions = require("~system/RestrictedActions");
```

{% hint style="info" %}
Como implementador de World Explorer, tu runtime podría no hacer cumplir los permisos. Nosotros **firmemente** desaconsejamos esto, ya que pone a los jugadores en peligro.
{% endhint %}

La mayor parte de la funcionalidad restringida la proporciona este módulo, pero también hay [funciones globales](https://github.com/decentraland/docs/tree/main/contributor/globals/README.md).

El módulo contiene los siguientes métodos y tipos:

* [`function movePlayerTo`](#movePlayerTo)
* [`function teleportTo`](#teleportTo)
* [`function triggerEmote`](#triggerEmote)
* [`function changeRealm`](#changeRealm)
* [`function openExternalUrl`](#openExternalUrl)
* [`function openNftDialog`](#openNftDialog)
* [`function setCommunicationsAdapter`](#setCommunicationsAdapter)
* [`interface Vector3`](#Vector3)

### Métodos

Cada uno de los métodos a continuación está asociado con un [permiso](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md#permissions) que puede solicitarse en el manifiesto de la escena.

**`movePlayerTo`**

Desplaza al jugador a una nueva posición relativa a la actual y, opcionalmente, establece el objetivo de la cámara con [vectores](#Vector3).

Requiere el [`ALLOW_TO_MOVE_PLAYER_INSIDE_SCENE`](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md#permissions) permiso.

```ts
interface Request {
  newRelativePosition: Vector3;
  cameraTarget?: Vector3;
}

interface Response {
    // Una vez que el jugador se haya movido a la nueva posición, y si el jugador no interrumpió el movimiento, esto será true.
  success: boolean;
}

function movePlayerTo(Request): Promise<Response>;
```

**`teleportTo`**

Reposiciona al jugador en una parcela, opcionalmente en otro realm.

En lugar de requerir un permiso preaprobado, cada llamada a `teleportTo` debe ser aprobada por el jugador.

```ts
interface Request {
  // La parcela en la que aterrizar. Omitido: el spawn predeterminado del realm
  // (solo tiene sentido junto con `realm`).
  worldCoordinates?: Vector2;

  // El realm al que pertenece la parcela: un nombre de world (`foo.dcl.eth`) o una URL de realm.
  // Cuando se establece, el cliente cambia de realm (una reconexión completa, incluso al realm en el que
  // ya está el jugador) y luego aterriza en la parcela allí.
  // Omitido: la parcela está en el realm actual del jugador.
  realm?: string;
}

interface Response {}

function teleportTo(Request): Promise<Response>;
```

**`triggerEmote`**

Haz que el avatar del jugador muestre una animación de emote, usando uno de los nombres predefinidos.

Requiere el [`ALLOW_TO_TRIGGER_AVATAR_EMOTE`](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md#permissions) permiso.

```ts
interface Request {
  predefinedEmote: string;
}

interface Response {}

function triggerEmote(Request): Promise<Response>;
```

**`openExternalUrl`**

Ofrece mostrarle un sitio web al jugador, usando una UI apropiada (que puede ser otra aplicación).

Requiere el [`OPEN_EXTERNAL_LINK`](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md#permissions) permiso.

```ts
interface Request {
  url: string;
}

interface Response {
  // Si el jugador autorizó abrir el enlace.
  success: boolean;
}

function openExternalUrl(Request): Promise<Response>;
```

**`openNftDialog`**

Muestra información sobre un NFT al jugador, usando una UI apropiada.

```ts
interface Request {
  // El URN del NFT.
  urn: string;
}

interface Response {
  // Si el NFT se localizó correctamente y se asoció con una imagen o video.
  success: boolean;
}

function openNftDialog(Request): Promise<Response>;
```

**`changeRealm`** (obsoleto)

Cambia World Explorer a otro servidor de contenido, usando su URL base.

Obsoleto en favor de [`teleportTo`](#teleportTo) con un `realm` (y sin `worldCoordinates` para el spawn predeterminado del realm). `changeRealm` se resuelve una vez que se acepta el cambio en lugar de cuando el nuevo realm entra en funcionamiento, así que un `teleportTo` emitido inmediatamente después se ejecuta contra el realm anterior.

```ts
interface Request {
  // La URL del nuevo realm.
  realm: string;

  // Un mensaje opcional para mostrar a los usuarios cuando tengan que aprobar el cambio.
  message?: string;
}

interface Response {
  // Si el cambio de realm fue autorizado y exitoso.
  success: boolean;
}

function changeRealm(Request): Promise<Response>;
```

### Tipos

El único tipo adicional utilizado por los métodos de este módulo es `Vector3`.

**`Vector3`**

Contiene una posición 3D relativa o absoluta.

```ts
interface Vector3 {
  x: number;
  y: number;
  z: number;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/contributor/contributor-es/tiempo-de-ejecucion-de-la-escena/modulos-de-tiempo-de-ejecucion/restricted-actions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
