import { Networkable, PlayerData } from "@skeldjs/core"; import { GameSettings } from "@skeldjs/protocol"; import { RoomsConfig } from "../interfaces"; import { Worker } from "./Worker"; import { BaseRoom } from "./BaseRoom"; import { Perspective, PresetFilter } from "./Perspective"; export declare class Room extends BaseRoom { readonly worker: Worker; readonly config: RoomsConfig; /** * A map of player client IDs to active perspectives in the room. Used as a * short-hand, as well as being faster than searching each active perspective. */ playerPerspectives: Map; /** * A list of perspectives that are currently active in the room, see {@link Room.createPerspective} */ activePerspectives: Perspective[]; constructor(worker: Worker, config: RoomsConfig, settings: GameSettings); /** * Create a {@link Perspective} object for this room, with preset filters to * use. * * This function is relatively slow as it needs to clone the entire room. * It shouldn't really be used in loops or any events that get fired a lot. * * @param players The player, or players, to create this perspective for. * @param filters Preset filters to use for both incoming and outgoing * filters. * @returns The created perspective. */ createPerspective(players: PlayerData | PlayerData[], filters?: PresetFilter[]): Perspective; /** * Create a {@link Perspective} object for this room, with preset filters to * use. * * This function is relatively slow as it needs to clone the entire room. * It shouldn't really be used in loops or any events that get fired a lot. * * @param players The player, or players, to create this perspective for. * @param incomingFilters Preset filters to use for incoming packets making * their way into the perspective.. * @param outgoingFilters Preset filters to use for outgoing packets from the * perspective to the room. By default, same as the incoming filters. * @returns The created perspective. */ createPerspective(players: PlayerData | PlayerData[], incomingFilters: PresetFilter[], outgoingFilters: PresetFilter[]): Perspective; /** * Guard an object so that no other room (or perspective) can make changes to it. * * This is useful when perspectives create conflicts and state becomes unmanageable; * just assign its logic to one room. * * Note that this is only a nominal change; plugins can still make changes freely - the only * change is that packets won't be managed by rooms that the object does not belong to. * @param netObject The object to own */ guardObjectAsOwner(netObject: Networkable): void; /** * Unknown an object so that all rooms can make changes to it. * @param netObject The object to disown */ disownObject(netObject: Networkable): void; /** * Get the owner of an object. * @param netObject The object to disown */ getOwnerOf(netObject: Networkable): BaseRoom | undefined; canManageObject(object: Networkable): boolean; }