### Install with npm Source: https://github.com/billsonnn/nitro-renderer/blob/main/README.md Use this command to install the library via npm. ```bash npm install @nitrots/nitro-renderer ``` -------------------------------- ### Install with yarn Source: https://github.com/billsonnn/nitro-renderer/blob/main/README.md Use this command to install the library via yarn. ```bash yarn add @nitrots/nitro-renderer ``` -------------------------------- ### Initialize Nitro Engine with Default Configuration Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Bootstrap the Nitro engine using its default configuration. This is the simplest way to get started. ```typescript // Bootstrap creates a new Nitro instance with default config Nitro.bootstrap(); ``` -------------------------------- ### Play Music Track Example Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/sound-system.md Starts playing a music track by its ID. Ensure the sound manager and music controller are initialized before use. ```typescript soundManager.musicController.playTrack(5); ``` -------------------------------- ### Add Event Listener Example Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Example of how to register an event listener for a specific event type. The callback function will be executed when the event is dispatched. ```typescript nitro.events.addEventListener('NE_READY!', (event) => { console.log('Nitro is ready'); }); ``` -------------------------------- ### Example Message Configuration Mapping Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/types.md An example demonstrating how to structure the IMessageConfiguration to map specific message names to their corresponding numeric headers, including nested structures for related messages. ```typescript { "RoomUsersMessage": 101, "RoomObjectsMessage": 102, "Chat": { "UserChat": 103, "Whisper": 104 } } ``` -------------------------------- ### Dispose Manager Example Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Example of how to safely dispose of a manager object if it exists and has not already been disposed. Ensures idempotent calls. ```typescript if (manager && !manager.isDisposed) { manager.dispose(); } ``` -------------------------------- ### startSession Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Initiates the connection for a given room session. Returns true if the session starts successfully. ```APIDOC ## startSession(session: IRoomSession): boolean ### Description Starts a room session connection. ### Method N/A (SDK Method) ### Parameters #### Path Parameters - **session** (IRoomSession) - Required - Session to start ### Returns `true` if session started ``` -------------------------------- ### Set and Get Configuration Values Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Demonstrates how to set and retrieve configuration values using dot-separated keys. Supports default values and interpolation. ```typescript NitroConfiguration.setValue('system.fps.max', 30); // Get a value with default const fps = NitroConfiguration.getValue('system.fps.max', 24); ``` ```typescript // Interpolation support NitroConfiguration.setValue('asset.base', '/assets'); NitroConfiguration.parseConfiguration({ 'avatar.url': '${asset.base}/avatar.json' }); // Result: avatar.url = '/assets/avatar.json' ``` -------------------------------- ### Dispatch Event Example Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Example of dispatching a custom event. This will trigger all listeners registered for the 'CustomEvent' type. Ensure the event object conforms to the INitroEvent interface. ```typescript const event = { type: 'CustomEvent', timestamp: Date.now() }; const dispatched = dispatcher.dispatchEvent(event); ``` -------------------------------- ### playTrack Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/sound-system.md Starts playing a music track by ID. Requires the track ID as a parameter. ```APIDOC ## playTrack(trackId: number): void ### Description Starts playing a music track by ID. ### Parameters #### Path Parameters - **trackId** (number) - Required - Music track ID ### Request Example ```typescript soundManager.musicController.playTrack(5); ``` ``` -------------------------------- ### Bootstrap Nitro Instance Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Initializes the Nitro instance with default configuration, setting up PixiJS and creating a canvas. Use this to start the renderer. ```typescript static bootstrap(): void ``` ```typescript Nitro.bootstrap(); const instance = Nitro.instance; ``` -------------------------------- ### getProductData Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets product information by type. Returns the IProductData object or null if not found. ```APIDOC ## getProductData(type: string): IProductData ### Description Gets product information by type. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Parameters #### Path Parameters - **type** (string) - Required - Product type identifier ### Returns IProductData or null ``` -------------------------------- ### Example Configuration File Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/configuration.md This JSON file defines various settings for the Nitro Renderer, including system performance, logging levels, room landscape features, socket connection URL, and asset locations. It uses environment variable substitution for asset URLs. ```json { "system": { "fps": { "max": 24 }, "log": { "debug": true, "warn": false, "error": false, "events": false, "packets": false } }, "room": { "landscapes": { "enabled": true } }, "connection": { "socket": { "url": "wss://socket.example.com" } }, "asset": { "url": { "notifications": "${asset.base}/notifications/", "effects": "${asset.base}/effects/", "hof": "${asset.base}/hof/", "habitatsets": "${asset.base}/hof/", "productdata": "${asset.base}/productdata/", "figurepartsets": "${asset.base}/figurepartsets/", "furniture": "${asset.base}/furniture/", "figuredata": "${asset.base}/figuredata/" }, "base": "https://assets.example.com" } } ``` -------------------------------- ### Listen for Configuration Loaded Event Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/configuration.md Example of how to listen for the ConfigurationEvent.LOADED event to ensure configuration values are available before use. Provides a fallback default value for 'system.fps.max'. ```typescript const core = new NitroCore(); core.configuration.events.addEventListener( ConfigurationEvent.LOADED, (event) => { const maxFps = NitroConfiguration.getValue('system.fps.max', 24); // Now safe to use configuration } ); ``` -------------------------------- ### Start Room Session Connection Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Establishes the connection for a given room session. This method is used after a session has been successfully created or retrieved. ```typescript startSession(session: IRoomSession): boolean; ``` -------------------------------- ### Set Music Volume Example Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/sound-system.md Sets the music volume to a specific level. The volume should be between 0 and 100. This method is part of the music controller. ```typescript soundManager.musicController.setVolume(50); ``` -------------------------------- ### Implement and Use ILinkEventTracker Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Example of creating a link event tracker that logs commands. This tracker is added to the Nitro instance to handle specific link prefixes. ```typescript const tracker = { eventUrlPrefix: 'cmd:', linkReceived(link: string) { const command = link.replace('cmd:', ''); console.log('User triggered command:', command); } }; nitro.addLinkEventTracker(tracker); nitro.createLinkEvent('cmd:dance'); // Triggers tracker ``` -------------------------------- ### Access Nitro Subsystems Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Provides examples of how to access various subsystems of the Nitro engine, such as avatar, room engine, and communication. ```typescript // Access singleton const instance = Nitro.instance; // Access subsystems const avatar = instance.avatar; const roomEngine = instance.roomEngine; const communication = instance.communication; const sessionDataManager = instance.sessionDataManager; const soundManager = instance.soundManager; const events = instance.events; const configuration = instance.core.configuration; ``` -------------------------------- ### Get Product Data by Type Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves product information using its type identifier. Returns the product data if found, otherwise null. ```typescript sessionDataManager.getProductData("product_type_id"); ``` -------------------------------- ### Get All Furniture Data Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves all furniture items from the catalog. A listener can be provided to receive callbacks as items load. ```typescript const furniture = sessionDataManager.getAllFurnitureData({ furnitureDataReady: () => { // Furniture catalog loaded } }); ``` -------------------------------- ### Handle No Connection Error During Nitro Initialization Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/errors.md This example shows how calling `init()` on a Nitro instance without an established communication connection will throw an error. Ensure the communication manager creates and authenticates a connection before initialization. ```typescript const nitro = new Nitro(core); nitro.init(); // Throws Error if connection is not ready ``` ```typescript const core = new NitroCore(); const connection = core.communication.createConnection(); await connection.init(socketUrl); await connection.authenticated(); const nitro = new Nitro(core); nitro.init(); // Safe to call now ``` -------------------------------- ### Control Music Playback Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Provides examples for playing music tracks, adjusting volume, and managing the music playlist. Track IDs are used for selection. ```typescript // Play music itro.soundManager.musicController.playTrack(5); // Adjust volume itro.soundManager.musicController.setVolume(50); // Manage playlist const playlist = nitro.soundManager.musicController.playlist; playlist.addTrack(1); playlist.addTrack(2); playlist.addTrack(3); playlist.setRepeat(true); playlist.nextTrack(); ``` -------------------------------- ### Get and Manipulate Furniture Data Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Illustrates how to retrieve furniture information and add or update furniture within a room. Requires room and object IDs. ```typescript // Get furniture info const sofa = sessionDataManager.getFloorItemData(3); console.log(sofa.name, sofa.xDim, sofa.yDim); // Create furniture in room const success = nitro.roomEngine.addFurnitureFloor( roomId, objectId, sofa.id, location, direction, 0, {} ); // Update furniture state itro.roomEngine.updateRoomObjectFloor( roomId, objectId, newLocation, newDirection, newState, {} ); ``` -------------------------------- ### IAssetPalette Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Represents a color palette for asset recoloring, providing methods to get the palette ID and specific colors. ```APIDOC ## Interface: IAssetPalette Color palette for asset recoloring. ```typescript interface IAssetPalette { getId(): number; getColor(index: number): number; } ``` Maps color indices to RGB values for palette-based recoloring. ``` -------------------------------- ### Load Avatar Textures and Collections Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Demonstrates how to access the asset manager from the avatar render manager to get specific textures and collections. Ensure the asset manager is initialized before use. ```typescript const assetManager = avatarRenderManager.assets; const texture = assetManager.getTexture("hd-180-1"); const collection = assetManager.getCollection("avatar-collection"); ``` -------------------------------- ### getAllFurnitureData Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets all furniture items from catalog, calling listener as items load. Returns an array of currently loaded IFurnitureData objects. ```APIDOC ## getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] ### Description Gets all furniture items from catalog, calling listener as items load. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Returns Array of currently loaded IFurnitureData objects ### Example ```typescript const furniture = sessionDataManager.getAllFurnitureData({ furnitureDataReady: () => { // Furniture catalog loaded } }); ``` ``` -------------------------------- ### Get Wall Furniture by Name Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a specific wall furniture item by its name. Returns the item data if found, otherwise null. ```typescript sessionDataManager.getWallItemDataByName("Picture"); ``` -------------------------------- ### Implement IUpdateReceiver Update Method Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Provides an example implementation for the update method of IUpdateReceiver. This method is called each render frame to update object state, and should be optimized for speed. ```typescript update(time: number) { if (this.isDisposed) return; this.position.x += this.velocity.x * (time / 1000); this.position.y += this.velocity.y * (time / 1000); if (this.sprite) { this.sprite.x = this.position.x; this.sprite.y = this.position.y; } } ``` -------------------------------- ### Play Music with Nitro Renderer Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Control music playback using the soundManager. Use `playTrack` to start a specific track and `setVolume` to adjust the playback volume. ```typescript nitro.soundManager.musicController.playTrack(5); nitro.soundManager.musicController.setVolume(50); ``` -------------------------------- ### Get Floor Furniture by Name Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a specific floor furniture item by its name. Returns the item data if found, otherwise null. ```typescript const bed = sessionDataManager.getFloorItemDataByName("Bed"); ``` -------------------------------- ### Create and Manage Room Instance Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Shows how to create a room instance, set it as active, and render its display. Also includes adding users to the room. ```typescript // Create and activate room itro.roomEngine.createRoomInstance(roomId, roomMapData); itro.roomEngine.setActiveRoomId(roomId); // Get rendering canvas const canvas = nitro.roomEngine.getRoomInstanceDisplay( roomId, 0, // canvasId 800, // width 600, // height 1 // scale ); // Render to container container.appendChild(canvas.view); // Update objects for (const user of users) { nitro.roomEngine.addRoomObjectUser( roomId, user.id, user.location, user.direction, user.headDirection, 0, user.figure ); } ``` -------------------------------- ### Get Configuration Value Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Retrieves a configuration value by key. Provides a default value if the key is not found. Useful for accessing settings like maximum FPS or debug flags. ```typescript const maxFps = nitro.getConfiguration('system.fps.max', 24); const debugEnabled = nitro.getConfiguration('system.log.debug', false); ``` -------------------------------- ### Get Group Badge URL Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves the URL for a specified group badge image. This is used to get the direct link to a group badge asset. ```typescript sessionDataManager.getGroupBadgeUrl("group_badge_name"); ``` -------------------------------- ### Nitro.bootstrap() Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Creates and initializes a new Nitro instance with default configuration. It sets up the internal canvas and PixiJS application, and disposes of any existing instance before creating a new one. ```APIDOC ## Nitro.bootstrap() ### Description Creates and initializes a new Nitro instance with default configuration. Creates an internal canvas element and sets up the PixiJS application. Disposes any existing instance before creating a new one. ### Method Static Method ### Parameters None ### Request Example ```typescript Nitro.bootstrap(); const instance = Nitro.instance; ``` ### Response None ### Response Example None ``` -------------------------------- ### Initialize Nitro Engine Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Demonstrates two ways to initialize the Nitro engine: using the static bootstrap method or manual instantiation of NitroCore and Nitro. ```typescript // Bootstrap creates the engine Nitro.bootstrap(); // Or create manually const core = new NitroCore(); const nitro = new Nitro(core); nitro.init(); // Access singleton const instance = Nitro.instance; ``` -------------------------------- ### getWallItemDataByName Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets wall furniture by name. Returns the IFurnitureData object or null if not found. ```APIDOC ## getWallItemDataByName(name: string): IFurnitureData ### Description Gets wall furniture by name. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Parameters #### Path Parameters - **name** (string) - Required - Furniture name ### Returns IFurnitureData or null ``` -------------------------------- ### IConnection.init Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Initializes the connection with the server's WebSocket URL. ```APIDOC ## init(socketUrl: string): void ### Description Initializes the connection with the server's WebSocket URL. ### Parameters #### Path Parameters - **socketUrl** (string) - WebSocket server URL ### Returns - **void** ``` -------------------------------- ### getFloorItemDataByName Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets floor furniture by name. Returns the IFurnitureData object or null if not found. ```APIDOC ## getFloorItemDataByName(name: string): IFurnitureData ### Description Gets floor furniture by name. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Parameters #### Path Parameters - **name** (string) - Required - Furniture name ### Returns IFurnitureData or null ### Example ```typescript const bed = sessionDataManager.getFloorItemDataByName("Bed"); ``` ``` -------------------------------- ### getCollection Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Gets an asset collection by name. Returns IGraphicAssetCollection containing multiple assets. ```APIDOC ## getCollection(name: string): IGraphicAssetCollection ### Description Gets an asset collection by name. ### Parameters #### Path Parameters - **name** (string) - Required - Collection identifier ### Response #### Success Response - **IGraphicAssetCollection** - IGraphicAssetCollection containing multiple assets ### Example ```typescript const collection = assetManager.getCollection("avatar-collection"); const asset = collection.getAsset("hd-180-1"); ``` ``` -------------------------------- ### getTexture Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Gets a cached texture by name. Returns PixiJS Texture or null if not found. ```APIDOC ## getTexture(name: string): Texture ### Description Gets a cached texture by name. ### Parameters #### Path Parameters - **name** (string) - Required - Texture identifier ### Response #### Success Response - **Texture** - PixiJS Texture or null if not found ### Example ```typescript const texture = assetManager.getTexture("avatar-hd-180"); if (texture) { sprite.texture = texture; } ``` ``` -------------------------------- ### init() Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Initializes all subsystems of the Nitro engine. This method must be called before any other engine functionalities can be used. It sets up essential components like the avatar renderer, sound manager, and session data. ```APIDOC ## init() ### Description Initializes all subsystems including avatar renderer, sound manager, room engine, session data, and room session. Must be called before using the engine. Sets up message handlers and internal event listeners. ### Method ```typescript init(): void ``` ### Throws - Error if no connection is found after initialization ### Example ```typescript const nitro = new Nitro(core); nitro.init(); if (nitro.isReady) { // Engine is ready to use } ``` ``` -------------------------------- ### Event System Usage Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Shows how to listen for events dispatched by major subsystems and how to dispatch custom events. ```typescript // Listen for events nitro.events.addEventListener(eventType, (event) => { // Handle event }); ``` ```typescript // Custom event const event: INitroEvent = { type: 'MyEvent', timestamp: Date.now() }; nitro.events.dispatchEvent(event); ``` -------------------------------- ### Get Graphic Asset by Name Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Fetches a graphic asset by its name, which is used for rendering purposes. ```typescript const asset = avatarRenderManager.getAssetByName(name); ``` -------------------------------- ### getSession Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets a room session by its ID. Returns the IRoomSession object if found, otherwise null. ```APIDOC ## getSession(id: number): IRoomSession ### Description Gets a room session by ID. ### Method N/A (SDK Method) ### Parameters #### Path Parameters - **id** (number) - Required - Room ID ### Returns IRoomSession or null ``` -------------------------------- ### Load and Render a Room with Nitro Renderer Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Use the roomEngine to create and display a room instance. Ensure the room ID and map data are provided. The canvas element is then appended to the DOM. Objects can be added to the room using their respective details. ```typescript nitro.roomEngine.createRoomInstance(roomId, roomMapData); nitro.roomEngine.setActiveRoomId(roomId); const canvas = nitro.roomEngine.getRoomInstanceDisplay(roomId, 0, 800, 600, 1); document.body.appendChild(canvas.view); nitro.roomEngine.addRoomObjectUser( roomId, objectId, location, direction, 0, 0, figureString ); ``` -------------------------------- ### getWallItemData Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets wall furniture by type ID. Returns the IFurnitureData object or null if not found. ```APIDOC ## getWallItemData(id: number): IFurnitureData ### Description Gets wall furniture by type ID. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Parameters #### Path Parameters - **id** (number) - Required - Furniture type ID ### Returns IFurnitureData or null ``` -------------------------------- ### getFloorItemData Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Gets floor furniture by type ID. Returns the IFurnitureData object or null if not found. ```APIDOC ## getFloorItemData(id: number): IFurnitureData ### Description Gets floor furniture by type ID. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (TypeScript method) ### Endpoint None (TypeScript method) ### Parameters #### Path Parameters - **id** (number) - Required - Furniture type ID ### Returns IFurnitureData or null ### Example ```typescript const sofa = sessionDataManager.getFloorItemData(3); if (sofa) { console.log(sofa.name); // "Sofa" } ``` ``` -------------------------------- ### Manage Nitro Configuration Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Demonstrates how to parse configuration data, retrieve specific configuration values with defaults, and set configuration values at runtime. ```typescript // Parse configuration NitroConfiguration.parseConfiguration(configData); // Get values const fps = NitroConfiguration.getValue('system.fps.max', 24); // Set values NitroConfiguration.setValue('room.landscapes.enabled', true); ``` -------------------------------- ### IConnection.onReady Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Called when the connection is ready to use after initial handshake. ```APIDOC ## onReady(): void ### Description Called when the connection is ready to use after initial handshake. ### Returns - **void** ``` -------------------------------- ### getAsset Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Gets a graphic asset definition by name. Returns IGraphicAsset containing asset metadata. ```APIDOC ## getAsset(name: string): IGraphicAsset ### Description Gets a graphic asset definition by name. ### Parameters #### Path Parameters - **name** (string) - Required - Asset name ### Response #### Success Response - **IGraphicAsset** - IGraphicAsset containing asset metadata ``` -------------------------------- ### Initialize Nitro Engine and Listen for Ready Event Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Initializes the Nitro engine and sets up an event listener to log a message once the engine is ready. This is the point where all Nitro subsystems become available for use. ```typescript nitro.init(); // Wait for ready event itro.events.addEventListener(Nitro.READY, () => { console.log('Engine ready!'); // Now you can use all subsystems }); ``` -------------------------------- ### Get Localized String Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Retrieves a localized string based on a provided key. Used for internationalization of application text. ```typescript const welcomeMessage = nitro.getLocalization('welcome.message'); ``` -------------------------------- ### Get Badge URL Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves the URL for a specified badge image. Use this when you need the direct link to a badge asset. ```typescript const badgeUrl = sessionDataManager.getBadgeUrl("safe_1"); ``` -------------------------------- ### Object Management - Queries Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Methods for querying and retrieving information about objects within a room, categorized by type. ```APIDOC ## getTotalObjectsForManager ### Description Gets the total number of objects for a given category within a room. ### Method `getTotalObjectsForManager(roomId: number, category: number): number` ## getRoomObject ### Description Retrieves a specific room object controller by its ID and category within a room. ### Method `getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController` ## getRoomObjectByIndex ### Description Retrieves a room object controller by its index and category within a room. ### Method `getRoomObjectByIndex(roomId: number, index: number, category: number): IRoomObjectController` ## getRoomObjects ### Description Retrieves all room objects for a given category within a room. ### Method `getRoomObjects(roomId: number, category: number): IRoomObject[]` ## getRoomObjectCount ### Description Gets the count of room objects for a specific category ID within a room. ### Method `getRoomObjectCount(roomId: number, categoryId: number): number` ``` -------------------------------- ### Create and Render Avatar Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Demonstrates how to create a figure container and render an avatar image. Ensure assets are loaded before rendering. ```typescript // Create figure container const figureString = 'hd-180-1.ch-255-1108.lg-285-92'; const container = nitro.avatar.createFigureContainer(figureString); // Wait for assets to load if (nitro.avatar.isFigureContainerReady(container)) { // Create image const image = nitro.avatar.createAvatarImage( figureString, 'lg', // size 'm', // gender { avatarImageReady: (img) => { // Render avatar container.addChild(img); } } ); } ``` -------------------------------- ### Get Cached Texture Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Retrieves a texture from the cache using its name. Use this when you need to apply a pre-loaded texture to a sprite. ```typescript const texture = assetManager.getTexture("avatar-hd-180"); if (texture) { sprite.texture = texture; } ``` -------------------------------- ### Get Room Session by ID Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a specific room session using its unique identifier. Ensure the session ID is valid. ```typescript getSession(id: number): IRoomSession; ``` -------------------------------- ### Get Cached Badge Image Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a cached PixiJS texture for a badge image. Use this for performance when the badge has already been loaded. ```typescript const badgeTexture = sessionDataManager.getBadgeImage("safe_1"); ``` -------------------------------- ### Access Communication Demo and Connection Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Access the demo communication interface and the active connection instance through the communication manager. ```typescript demo: INitroCommunicationDemo; connection: IConnection; ``` -------------------------------- ### Initialize Nitro Engine with Custom Configuration Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Initialize the Nitro engine with a custom `NitroCore` instance and specific configuration options. This allows for fine-grained control over engine behavior. ```typescript const core = new NitroCore(); const nitro = new Nitro(core, { autoDensity: false, width: window.innerWidth, height: window.innerHeight, resolution: window.devicePixelRatio }); ``` -------------------------------- ### Get Asset Collection Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Retrieves a collection of assets by its identifier. This is useful for accessing multiple related assets, such as different variations of a character. ```typescript const collection = assetManager.getCollection("avatar-collection"); const asset = collection.getAsset("hd-180-1"); ``` -------------------------------- ### Room and Canvas Management Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Methods for managing the active room, initialization status, update cycles, and creating room instances. ```APIDOC ## setActiveRoomId ### Description Sets the active room ID for rendering and operations. ### Method `setActiveRoomId(roomId: number): void` ## onRoomEngineInitalized ### Description Callback to indicate if the Room Engine has been initialized. ### Method `onRoomEngineInitalized(flag: boolean): void` ## disableUpdate ### Description Disables or enables the update loop for the Room Engine. ### Method `disableUpdate(flag: boolean): void` ## runUpdate ### Description Manually triggers an update cycle for the Room Engine. ### Method `runUpdate(): void` ## createRoomInstance ### Description Creates a new instance of a room with provided data. ### Method `createRoomInstance(roomId: number, roomMap: IRoomMapData): void` ## getRoomInstanceDisplay ### Description Retrieves the display object for a specific room instance, canvas, and dimensions. ### Method `getRoomInstanceDisplay(roomId: number, id: number, width: number, height: number, scale: number): DisplayObject` ``` -------------------------------- ### IMessageEvent Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Handles the parsing of incoming messages from the server. It provides methods to get the message header and type, and to dispose of resources. ```typescript interface IMessageEvent { getHeader(): number; getMessageType(): string; dispose(): void; } ``` -------------------------------- ### Listen for Nitro Events Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/README.md Shows how to add event listeners for engine-wide events like Nitro.READY and room-engine-specific events such as RoomEngineEvent.ENGINE_INITIALIZED. ```typescript // Listen for engine ready nitro.events.addEventListener(Nitro.READY, (event) => { // Engine is ready }); // Listen for room events nitro.roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, () => { // Room engine ready }); ``` -------------------------------- ### Initialize Nitro Engine Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Follow this sequence to properly initialize the Nitro engine. Ensure you wait for the READY event before using subsystems. ```typescript 1. Create configuration 2. Create NitroCore 3. Create Nitro instance 4. Call nitro.init() 5. Wait for Nitro.READY event 6. Use subsystems ``` -------------------------------- ### Asset Management Operations Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Illustrates how to download assets asynchronously and retrieve cached assets like textures and collections. ```typescript // Download assets const success = await assetManager.downloadAsset('/assets/avatar.json'); ``` ```typescript // Get cached assets const texture = assetManager.getTexture('avatar-hd-180'); const collection = assetManager.getCollection('avatar-collection'); ``` -------------------------------- ### IProductData Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Defines the structure for product catalog entries, containing information like name, description, and price. Use this to display details about items available for purchase. ```typescript interface IProductData { name: string; description: string; price: number; currency: string; } ``` -------------------------------- ### Get Group Badge Identifier Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves the badge name identifier for a given group ID. Use this to find the badge associated with a group. ```typescript const groupBadgeName = sessionDataManager.getGroupBadge(101); ``` -------------------------------- ### Log Missing Configuration Key Warning Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/errors.md This snippet demonstrates how a warning is logged when accessing a non-existent configuration key. Always provide default values to `getValue()` or ensure configuration is loaded beforehand. ```typescript const unknownConfig = NitroConfiguration.getValue('nonexistent.key', 'default'); // Console: [Nitro] Missing configuration key: nonexistent.key ``` -------------------------------- ### createRoomInstance Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Creates a new room instance with the provided map data. This method initializes a room with specific configuration. ```APIDOC ## createRoomInstance(roomId: number, roomMap: IRoomMapData): void ### Description Creates a new room instance with the provided map data. ### Parameters #### Path Parameters - **roomId** (number) - Required - Room ID to create - **roomMap** (IRoomMapData) - Required - Room map configuration data ``` -------------------------------- ### Create Room Instance Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Initializes a new room instance within the engine using a given room ID and map data. This is a foundational step before adding objects or users. ```typescript roomEngine.createRoomInstance(roomId, roomMap); ``` -------------------------------- ### Get Cached Group Badge Image Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a cached PixiJS texture for a group badge image. Optimized for repeated access to group badges. ```typescript const groupBadgeTexture = sessionDataManager.getGroupBadgeImage("group_badge_name"); ``` -------------------------------- ### Handle Connection Ready Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Callback function to be executed when the connection is ready after the initial handshake. This method is part of the IConnection interface. ```typescript connection.onReady(); ``` -------------------------------- ### Get Localized String with Multiple Parameters Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Retrieves a localized string and replaces multiple specified parameters. Ideal for complex messages with dynamic values. ```typescript const eventDetails = nitro.getLocalizationWithParameters('event.info', ['eventName', 'eventDate'], ['Party', 'Tomorrow']); ``` -------------------------------- ### Create New Room Session Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Initiates the creation of a new room session. Provide the room ID and optionally a password if the room is protected. ```typescript createSession(roomId: number, password?: string): boolean; ``` -------------------------------- ### createSession Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Creates a new room session. Requires the room ID and an optional password if the room is protected. ```APIDOC ## createSession(roomId: number, password?: string): boolean ### Description Creates a new room session. ### Method N/A (SDK Method) ### Parameters #### Path Parameters - **roomId** (number) - Required - Room to join - **password** (string) - Optional - Room password if required ### Returns `true` if session created successfully ``` -------------------------------- ### Avatar Structure Data Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Contains definitions for avatar body part structures. Use this to get information about valid figure parts, colors, and constraints. ```typescript interface IStructureData { getBodyPartSets(partType: string): IBodyPartSet[]; getPartSet(partType: string, setId: number): IBodyPartSet | null; } ``` -------------------------------- ### Get Mandatory Avatar Part Set IDs Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Retrieves an array of mandatory avatar part set IDs for a given category and figure set ID. ```typescript const mandatoryParts = avatarRenderManager.getMandatoryAvatarPartSetIds(k, _arg_2); ``` -------------------------------- ### IOutfit Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Represents a saved outfit configuration, containing a figure string and display name for an outfit. ```APIDOC ## Interface: IOutfit ### Description Represents a saved outfit configuration. ### Properties - **figureString** (string) - The figure string defining the avatar's appearance. - **name** (string) - The display name of the outfit. ``` -------------------------------- ### Get Minimum Club Level for Figure Parts Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Determines the minimum club level required for the specified avatar figure parts. Can check all parts or a subset. ```typescript const level = avatarRenderManager.getFigureClubLevel(container, gender, searchParts); ``` -------------------------------- ### Geometry and Metrics Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md APIs for retrieving geometric information, variables, bounding rectangles, and screen locations of room objects. ```APIDOC ## getRoomInstanceGeometry ### Description Retrieves the geometric data for a room instance, optionally for a specific canvas. ### Method `getRoomInstanceGeometry(roomId: number, canvasId?: number): IRoomGeometry` ## getRoomInstanceVariable ### Description Retrieves a generic variable from a room instance by its key. ### Method `getRoomInstanceVariable(roomId: number, key: string): T` ## getRoomObjectBoundingRectangle ### Description Calculates the bounding rectangle for a specific room object within a room and canvas. ### Method `getRoomObjectBoundingRectangle(roomId: number, objectId: number, category: number, canvasId: number): Rectangle` ## getRoomObjectScreenLocation ### Description Gets the screen coordinates of a room object within a room and optional canvas. ### Method `getRoomObjectScreenLocation(roomId: number, objectId: number, objectType: number, canvasId?: number): Point` ``` -------------------------------- ### IAssetPalette Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Defines the interface for a color palette used in asset recoloring. It provides methods to get the palette ID and retrieve specific colors by index. ```typescript interface IAssetPalette { getId(): number; getColor(index: number): number; } ``` -------------------------------- ### Load and Parse Server Configuration Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Fetches configuration data from a server endpoint and parses it into a usable format for the Nitro engine. Ensure the server provides configuration in JSON format. ```typescript // Load configuration from server const configResponse = await fetch('/config'); const configData = await configResponse.json(); NitroConfiguration.parseConfiguration(configData); // Configuration is now available via NitroConfiguration.getValue() ``` -------------------------------- ### Get User Tags Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves an array of tag or badge names associated with a specific user in the room. Requires the user's room object ID. ```typescript const userTags = sessionDataManager.getUserTags(123); ``` -------------------------------- ### Access All Configuration Definitions Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/configuration.md Retrieves all defined configuration values as a Map. This allows iteration over all configuration settings. ```typescript const allConfig = NitroConfiguration.definitions; allConfig.forEach((value, key) => { console.log(`${key}: ${value}`); }); ``` -------------------------------- ### Get Wall Furniture by ID Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a specific wall furniture item using its type ID. Returns the item data if found, otherwise null. ```typescript sessionDataManager.getWallItemData(10); ``` -------------------------------- ### Download and Reuse Assets Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Optimize asset loading by downloading assets once and then using getCollection() for subsequent operations. This ensures assets are reused efficiently. ```typescript // Download assets once, reuse collections const success = await assetManager.downloadAsset('/assets/avatar-hd.json'); // Now use getCollection() for all avatar operations ``` -------------------------------- ### Get Floor Furniture by ID Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/session-data.md Retrieves a specific floor furniture item using its type ID. Returns the item data if found, otherwise null. ```typescript const sofa = sessionDataManager.getFloorItemData(3); if (sofa) { console.log(sofa.name); // "Sofa" } ``` -------------------------------- ### Get Room Instance Display Object Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Retrieves the PixiJS DisplayObject for a room instance, which is necessary for rendering the room in the application. Specify dimensions and scale for the display. ```typescript roomEngine.getRoomInstanceDisplay(roomId, id, width, height, scale); ``` -------------------------------- ### Initialize Engine and Create Room Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/errors.md Ensure the Nitro engine is fully initialized using `await nitro.init()` before performing operations like creating room instances. This prevents errors related to uninitialized engine states. ```typescript await nitro.init(); if (nitro.isReady) { // Engine is fully initialized nitro.roomEngine.createRoomInstance(1, roomMapData); } ``` -------------------------------- ### Download Multiple Assets Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/asset-management.md Initiates the download and caching process for multiple asset files from provided URLs. This method is asynchronous and returns a promise that resolves to a boolean indicating overall success. ```typescript const urls = [ "/assets/avatar-hd.json", "/assets/furniture.json" ]; const success = await assetManager.downloadAssets(urls); ``` -------------------------------- ### IObjectData Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/types.md A flexible container for object data, suitable for furniture states, pet properties, and custom metadata. ```APIDOC ## Interface: IObjectData ### Description Flexible object data container for furniture state, pet properties, and other object metadata. Keys and values depend on object type. ### Properties - **[key: string]** (string | number) - Required - Dynamic key-value pairs for object metadata. ``` -------------------------------- ### Simple Event Listener Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/common-interfaces.md Demonstrates how to add and remove a simple event listener using `addEventListener` and `removeEventListener`. Ensure the event type and handler function are correctly specified. ```typescript const handler = (event: INitroEvent) => { console.log('Event received:', event.type); }; dispatcher.addEventListener('EventType', handler); // Later, remove listener dispatcher.removeEventListener('EventType', handler); ``` -------------------------------- ### Get Localized String with Single Parameter Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Retrieves a localized string and replaces a single specified parameter. Useful for dynamic text like "Welcome, [username]!". ```typescript const personalizedGreeting = nitro.getLocalizationWithParameter('greeting.user', 'username', 'Alice'); ``` -------------------------------- ### IRoomManager Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md The IRoomManager interface provides methods for managing room instances, including creation, retrieval, removal, and updating room objects. It also allows for managing update categories and setting up content loaders. ```APIDOC ## Interface: IRoomManager Manages room instances and object updates. ```typescript interface IRoomManager extends INitroManager { getRoomInstance(roomId: string): IRoomInstance; createRoomInstance(roomId: string): IRoomInstance; removeRoomInstance(roomId: string): boolean; addUpdateCategory(category: number): void; removeUpdateCategory(category: number): void; createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; setContentLoader(loader: IRoomContentLoader): void; update(time: number, update?: boolean): void; rooms: Map; events: IEventDispatcher; } ``` ### Methods - **getRoomInstance(roomId: string): IRoomInstance** Retrieves an existing room instance by its ID. - **createRoomInstance(roomId: string): IRoomInstance** Creates a new room instance with the specified ID. - **removeRoomInstance(roomId: string): boolean** Removes a room instance by its ID. Returns true if successful, false otherwise. - **addUpdateCategory(category: number): void** Adds a category to be updated. - **removeUpdateCategory(category: number): void** Removes a category from being updated. - **createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject** Creates and initializes a room object within a specific room. - **setContentLoader(loader: IRoomContentLoader): void** Sets the content loader for the room manager. - **update(time: number, update?: boolean): void** Updates the room manager at a given time. An optional boolean parameter can control the update behavior. ### Properties - **rooms: Map** A map containing all active room instances, keyed by their room ID. - **events: IEventDispatcher** An event dispatcher for room-related events. ``` -------------------------------- ### Get Rendered Image of Room Object Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/room-engine.md Generates a rendered image of a specific room object. This is useful for displaying object icons or previews. A listener must be provided to receive the image result. ```typescript roomEngine.getRoomObjectImage(roomId, objectId, category, direction, scale, listener, bgColor); ``` -------------------------------- ### Initialize Connection Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Initializes the WebSocket connection with the provided server URL. This method is part of the IConnection interface. ```typescript connection.init(socketUrl); ``` -------------------------------- ### IConnection.authenticated Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/communication.md Called when authentication is complete. ```APIDOC ## authenticated(): void ### Description Called when authentication is complete. ### Returns - **void** ``` -------------------------------- ### getLocalization(key: string): string Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Fetches a localized string based on a provided key. This is used for internationalization of text displayed within the engine. ```APIDOC ## getLocalization(key: string): string ### Description Gets a localized string by key. ### Method ```typescript getLocalization(key: string): string ``` ### Parameters #### Path Parameters - **key** (string) - Required - Localization key ### Returns Localized string value ``` -------------------------------- ### Initialize Nitro Engine Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/nitro-core.md Initializes all Nitro engine subsystems. Must be called before using the engine. Sets up message handlers and internal event listeners. ```typescript const nitro = new Nitro(core); nitro.init(); if (nitro.isReady) { // Engine is ready to use } ``` -------------------------------- ### Create and Set Active Room Instance Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/API-OVERVIEW.md Creates a new room instance with specified map data and sets it as the active room. It also retrieves the canvas element for rendering the room. ```typescript // Create room instance with map data const roomMapData = { width: 32, height: 32, // ... additional room data }; itro.roomEngine.createRoomInstance(123, roomMapData); itro.roomEngine.setActiveRoomId(123); // Get canvas for rendering const canvas = nitro.roomEngine.getRoomInstanceDisplay(123, 0, 800, 600, 1); document.body.appendChild(canvas.view); ``` -------------------------------- ### Handle Avatar Image Ready Event Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/errors.md Use the `avatarImageReady` callback to ensure the avatar is fully loaded and ready before displaying it. This prevents rendering issues with incomplete assets. ```typescript const image = avatarRenderManager.createAvatarImage(figureString, 'lg', 'f', { avatarImageReady: (readyImage) => { // Avatar is now ready to display container.addChild(readyImage); } }); ``` -------------------------------- ### IPlaylistController Interface Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/sound-system.md Provides methods to manage the playlist, such as adding, removing, and controlling playback. ```APIDOC ## addTrack(trackId: number): void ### Description Adds a track to the playlist. ### Parameters #### Path Parameters - **trackId** (number) - Required - Track ID to add ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## removeTrack(trackId: number): void ### Description Removes a track from the playlist. ### Parameters #### Path Parameters - **trackId** (number) - Required - Track ID to remove ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## clearPlaylist(): void ### Description Removes all tracks from playlist. ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## nextTrack(): void ### Description Advances to the next track in playlist. ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## previousTrack(): void ### Description Goes back to the previous track in playlist. ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## setRepeat(repeat: boolean): void ### Description Enables or disables playlist repeat. ### Parameters #### Path Parameters - **repeat** (boolean) - Required - true to repeat, false for single play ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## setShuffle(shuffle: boolean): void ### Description Enables or disables shuffle playback. ### Parameters #### Path Parameters - **shuffle** (boolean) - Required - true to shuffle, false for sequential ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` ```APIDOC ## Properties ### tracks - **Type**: number[] - **Description**: Array of track IDs in playlist ### currentIndex - **Type**: number - **Description**: Index of currently playing track ### repeatMode - **Type**: boolean - **Description**: Whether repeat is enabled ### shuffleMode - **Type**: boolean - **Description**: Whether shuffle is enabled ### Source `src/api/nitro/sound/IPlaylistController.ts` ``` -------------------------------- ### createFigureContainer Source: https://github.com/billsonnn/nitro-renderer/blob/main/_autodocs/api-reference/avatar-system.md Creates a figure container from a figure string. This container is used for further operations like rendering or checking asset readiness. ```APIDOC ## createFigureContainer(figure: string): IAvatarFigureContainer ### Description Creates a figure container from a figure string. This container is used for further operations like rendering or checking asset readiness. ### Parameters #### Path Parameters - **figure** (string) - Required - Figure string (e.g., "hd-180-1.ch-255-1108") ### Returns - **IAvatarFigureContainer** - The created figure container object. ```