SkeldJS
    Preparing search index...

    Class StatefulRoom<RoomType, T>Abstract

    Represents an object capable of hosting games.

    See StatefulRoomEvents for events to listen to.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    objectUpdateCooldownDuration: number = 0.1
    processFixedUpdateInterval: number = ...

    How often a processFixedUpdate should be called.

    authorityId: number = -1

    The ID of the host of the room.

    config: StatefulRoomConfig = {}
    destroyed: boolean = false

    Whether or not this room has been destroyed.

    endGameIntents: EndGameIntent[] = []

    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 RoomGameEndedEvent to listen for a game actually ending.

    fixedUpdateInterval: undefined | Timeout = undefined
    gameManager: undefined | GameManager<StatefulRoom<RoomType, T>> = undefined
    gameState: GameState = GameState.NotStarted

    The state that the game is currently in.

    lastFixedUpdateTimestamp: number
    lastNetId: number = 0
    lobbyBehaviour: undefined | LobbyBehaviour<StatefulRoom<RoomType, T>> = undefined

    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<RoomType, T>> = undefined

    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<RoomType, T>, {}>> = ...

    The networked components in the room.

    objectList: NetworkedObject<StatefulRoom<RoomType, T>, {}>[] = []

    A list of all objects in the room.

    objectUpdateCooldown: number = StatefulRoom.objectUpdateCooldownDuration
    playerInfo: Map<number, NetworkedPlayerInfo<StatefulRoom<RoomType, T>>> = ...
    players: Map<number, Player<StatefulRoom<RoomType, T>>> = ...

    The players in 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 | ShipStatus<StatefulRoom<RoomType, T>> = undefined

    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.

    startGameCounter: number = -1

    The current start counter for the room.

    voteBanSystem: undefined | VoteBanSystem<StatefulRoom<RoomType, T>> = undefined

    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.

    Accessors

    Methods

    • Returns
          | undefined
          | {
              aliveCrewmates: number;
              aliveImpostors: number;
              totalImpostors: number;
          }

    • 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);
    • Start the game. If the client's player is not the host, the server may ban the client.

      Returns Promise<void>

    • Parameters

      • deltaSeconds: number
      • sendUpdates: boolean

      Returns Promise<void>

    • 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
      });