skeldjs
    Preparing search index...

    Class StatefulRoom<T>

    Represents an object capable of hosting games.

    See StatefulRoomEvents for events to listen to.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    authorityId: number

    The ID of the host of the room.

    code: number

    The code of the room.

    config: StatefulRoomConfig = {}
    counter: number

    The current start counter for the room.

    destroyed: boolean

    Whether or not this room has been destroyed.

    endGameIntents: EndGameIntent<any>[]

    Every end game intent that should happen in a queue to be or not to be canceled.

    The first item of each element being the name of the end game intent and the second being metadata passed with it.

    See RoomEndGameIntentEvent to cancel an end game intent, or see StatefulRoom.registerEndGameIntent to register your own.

    See RoomGameEndEvent to listen for a game actually ending.

    fixedUpdateInterval?: Timeout
    gameManager: undefined | InnerGameManager<StatefulRoom<T>>
    gameState: GameState

    The state that the game is currently in.

    lastFixedUpdateTimestamp: number
    lastNetId: number
    lobbyBehaviour: undefined | LobbyBehaviour<StatefulRoom<T>>

    An instance of the lobby behaviour in the room. Spawned when the room is currently in the lobby waiting for a game to start.

    It is possible for more than one lobby behaviour to be spawned, however this property is set and cleared for simplicity.

    See StatefulRoom.objectList if you're looking to find all lobby behaviour objects that have been spawned.

    meetingHud: undefined | MeetingHud<StatefulRoom<T>>

    An instance of the meeting hud in the room. Spawned when a meeting is started.

    It is possible for more than one meeting hud to be spawned, however this property is set and cleared for simplicity.

    See StatefulRoom.objectList if you're looking to find all meeting hud objects that have been spawned.

    messageStream: BaseGameDataMessage[]

    The current message stream to be sent to the server on fixed update.

    networkedObjects: Map<
        number,
        NetworkedObject<StatefulRoom<T>, NetworkedObjectEvents<StatefulRoom<T>>>,
    >

    The networked components in the room.

    A list of all objects in the room.

    playerInfo: Map<number, NetworkedPlayerInfo<StatefulRoom<T>>>
    players: Map<number, Player<StatefulRoom<T>>>

    The players in the room.

    privacy: PrivacyType

    The privacy state of the room.

    registeredPrefabs: Map<number, NetworkedObjectConstructor<any>[]>

    A map of spawn type -> objects used in the protocol. Useful to register custom INO (inner net objects) such as replicating behaviour from a client mod, see StatefulRoom.registerPrefab.

    registeredRoles: Map<number, typeof BaseRole>

    All roles that can be assigned to players. See StatefulRoom.registerRole.

    settings: GameSettings

    The settings of the room.

    shipPrefabIds: Map<number, number>
    shipStatus: undefined | InnerShipStatus<StatefulRoom<T>>

    An instance of the ship status in the room. Spawned when a game is started and represents the current map.

    It is possible for more than one ship status to be spawned, however this property is set and cleared for simplicity.

    See StatefulRoom.objectList if you're looking to find all ship status objects that have been spawned.

    voteBanSystem: undefined | VoteBanSystem<StatefulRoom<T>>

    An instance of the voting ban system in the room. Used as a utility object for handling kick and ban votes.

    It is possible for more than one vote ban system to be spawned, however this property is set and cleared for simplicity.

    See StatefulRoom.objectList if you're looking to find all vote ban system objects that have been spawned.

    processFixedUpdateInterval: number = ...

    How often a processFixedUpdate should be called.

    Accessors

    Methods

    • Get an available player ID.

      Returns number

      The player ID that was found.

      // Get an available player ID and add it to the gamedata.
      const playerId = room.getAvailablePlayerID();
      room.gamedata.add(playerId);
    • Get a player by one of their components' netIds.

      Parameters

      • netId: number

        The net ID of the component of the player to search.

      Returns undefined | Player<StatefulRoom<T>>

      The player that was found, or null if they do not exist.

      const player = room.getPlayerByNetId(34);
      
    • Set the host of the room. If the current client is the new host, it will conduct required host changes. e.g. Spawning objects if they are not already spawned.

      Parameters

      Returns Promise<void>

    • Change the settings of the room. If the host, it will broadcast these changes.

      Parameters

      • settings: Partial<AllGameSettings>

        The settings to set to (Can be partial).

      Returns void

      room.syncSettings({
      crewmateVision: 0.5,
      votingTime: 120
      });