# Interface: ReactTextGameDebug

Defined in: [packages/core/src/global.ts:5](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L5)

## Properties

### currentPassage

> `readonly` **currentPassage**: [`Passage`](../classes/Passage.md) \| `null`

Defined in: [packages/core/src/global.ts:8](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L8)

***

### Game

> **Game**: *typeof* [`Game`](../classes/Game.md)

Defined in: [packages/core/src/global.ts:6](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L6)

***

### getPassage()

> **getPassage**: (`passageId`) => [`Passage`](../classes/Passage.md) \| `null`

Defined in: [packages/core/src/global.ts:12](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L12)

Retrieves a passage by its unique identifier.

#### Parameters

##### passageId

`string`

The unique ID of the passage to retrieve.

#### Returns

[`Passage`](../classes/Passage.md) \| `null`

The passage object if found, or null if no passage exists with the given ID.

#### Throws

Error if Game.init() has not been called

***

### getState()

> **getState**: (`_fromI`) => [`GameSaveState`](../type-aliases/GameSaveState.md)

Defined in: [packages/core/src/global.ts:13](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L13)

Captures the complete game state including all entities and passages.

This method:
1. Saves the Game's internal state (current passage)
2. Saves all registered entity states
3. Returns the complete state object

#### Parameters

##### \_fromI

`boolean` = `false`

#### Returns

[`GameSaveState`](../type-aliases/GameSaveState.md)

The complete serializable game state

#### Throws

Error if Game.init() has not been called

#### Example

```typescript
const savedState = Game.getState();
localStorage.setItem('save1', JSON.stringify(savedState));
```

***

### jumpTo()

> **jumpTo**: (`passage`) => `void`

Defined in: [packages/core/src/global.ts:11](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L11)

Navigates the game to a specified passage.

On each call, generates a new unique renderId to enable React components
to force remounts when revisiting the same passage. This is useful for
resetting component state, restarting animations, or clearing forms.

#### Parameters

##### passage

[`PassageTarget`](../type-aliases/PassageTarget.md)

A passage instance (`Story`, `InteractiveMap`,
`Widget`, or any other `Passage`) or the id of a registered passage.

#### Returns

`void`

Does not return any value.

#### Throws

Throws an error if a passage id is not found in the registry or if Game.init() has not been called

#### Remarks

A passage instance that is not in the registry is registered on the spot,
so navigating to an instance never fails with "Passage not found". Only a
string id can refer to a passage that does not exist.

#### Example

```typescript
// Jump to a passage by ID
Game.jumpTo('intro');

// Jump to a passage instance - Story, InteractiveMap and Widget all work
const chapter1 = defineStory('chapter1', (h) => [...]);
const worldMap = defineInteractiveMap('world', (h) => [...], { image: '/world.png' });
const inventory = defineWidget('inventory', <InventoryUI />);

Game.jumpTo(chapter1);
Game.jumpTo(worldMap);
Game.jumpTo(inventory);

// Jumping to the same passage multiple times will generate different renderIds
Game.jumpTo('combat'); // renderId: "1234567890-0.123"
Game.jumpTo('combat'); // renderId: "1234567891-0.456" (different!)
```

***

### passages

> `readonly` **passages**: [`Passage`](../classes/Passage.md)[]

Defined in: [packages/core/src/global.ts:10](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L10)

***

### setState()

> **setState**: (`state`) => `void`

Defined in: [packages/core/src/global.ts:14](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L14)

Restores the complete game state including all entities and passages.

This method:
1. Sets the Storage state
2. Loads the Game's internal state (current passage)
3. Loads all registered entity states

#### Parameters

##### state

[`GameSaveState`](../type-aliases/GameSaveState.md)

The game state to restore

#### Returns

`void`

#### Throws

Error if Game.init() has not been called

#### Example

```typescript
const savedState = JSON.parse(localStorage.getItem('save1'));
Game.setState(savedState);
```

***

### state

> `readonly` **state**: `Record`\<`string`, `unknown`\>

Defined in: [packages/core/src/global.ts:9](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L9)

***

### Storage

> **Storage**: *typeof* `Storage`

Defined in: [packages/core/src/global.ts:7](https://github.com/laruss/react-text-game/blob/37ebb1fd49045bfbb1d2a2fa96b8f14a2f8c2644/packages/core/src/global.ts#L7)
