Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MiraShipStatus<RoomType>

Represents a room object for the Mira HQ map.

See ShipStatusEvents for events to listen to.

Type parameters

  • RoomType: Hostable

Hierarchy

Index

Properties

Static roomDoors

roomDoors: Partial<Record<SystemType, number[]>>

components

components: Networkable<any, NetworkableEvents<Hostable<any>>, RoomType>[]

dirtyBit

dirtyBit: number = 0

The dirty state of this component.

flags

flags: number

Flags for this object, see SpawnFlag.

initialSpawnCenter

initialSpawnCenter: Vector2 = ...

meetingSpawnCenter

meetingSpawnCenter: Vector2 = ...

netId

netId: number

The net ID of this component.

ownerId

ownerId: number

The ID of the owner of this component.

Optional player

player: PlayerData<RoomType>

The player that this component belongs to.

room

room: RoomType

The room that this component belongs to.

spawnRadius

spawnRadius: number

spawnType

spawnType: SpawnType

The type of object that this component belongs to.

systems

systems: AllSystems

Methods

Awake

  • Awake(): void

Deserialize

  • Deserialize(reader: HazelReader, spawn?: boolean): void

Destroy

  • Destroy(): void

FixedUpdate

  • FixedUpdate(delta: number): void

HandleRpc

PreSerialize

  • PreSerialize(): void

Serialize

  • Serialize(writer: HazelWriter, spawn?: boolean): boolean

Setup

  • Setup(): void

assignRoles

  • assignRoles(): Promise<void>
  • Randomly assign players to each enabled role with a certain probability. Called just after a game is started and emits a RoomAssignRolesEvent which can be used to alter which players are assigned which roles.

    Returns Promise<void>

assignRolesFromAssignments

  • assignRolesFromAssignments(roleAssignments: Map<PlayerData<Hostable<any>>, typeof BaseRole>): Promise<void>

assignTasks

  • assignTasks(): Promise<void>

canBeManaged

  • canBeManaged(): boolean

despawn

  • despawn(): void
  • Despawns the component from the room it belongs in.

    Returns void

emit

  • emit<Event>(event: Event): Promise<Event>

emitSerial

  • emitSerial<Event>(event: Event): Promise<Event>

emitSync

  • emitSync<Event>(event: Event): Event

getComponent

  • getComponent<T>(component: NetworkableConstructor<T>): undefined | T
  • Get a certain component from the object.

    Type parameters

    • T: Networkable<any, NetworkableEvents<Hostable<any>>, Hostable<any>, T>

    Parameters

    • component: NetworkableConstructor<T>

    Returns undefined | T

getDoorsInRoom

getListeners

  • getListeners<Event>(event: string): Listener<Event>[]

getRoleAssignmentsForPlayers

  • getRoleAssignmentsForPlayers(playerPool: PlayerData<Hostable<any>>[], maxAssignable: number, roleList: typeof BaseRole[], roleAssignments?: Map<PlayerData<Hostable<any>>, typeof BaseRole>): Map<PlayerData<Hostable<any>>, typeof BaseRole>
  • Assign a list of roles to a pool of players, eliminating both players from the player list and also roles from the role list, and without regard for room settings (i.e. the chances of each role appearing or the maximum number of assignments for the role).

    Parameters

    • playerPool: PlayerData<Hostable<any>>[]

      The pool of players to assign a list of roles to.

    • maxAssignable: number

      The maximum number of players that cn be assigned a role from this list.

    • roleList: typeof BaseRole[]

      The list of roles to assign to players.

    • roleAssignments: Map<PlayerData<Hostable<any>>, typeof BaseRole> = ...

      A map of role assigments (i.e. a map of player to roles) to act as a collective output to this method.

    Returns Map<PlayerData<Hostable<any>>, typeof BaseRole>

    The role assignments (i.e. a map of player to roles) that have either collectively been assigned (if roleAssignments is passed) or been assigned just as part of this method.

getRoleAssignmentsForTeam

  • getRoleAssignmentsForTeam(playerPool: PlayerData<Hostable<any>>[], settings: Partial<Record<RoleType, RoleChanceSettings>>, roleTeam: RoleTeamType, maxAssignable: number, defaultRole?: typeof BaseRole, roleAssignments?: Map<PlayerData<Hostable<any>>, typeof BaseRole>): Map<PlayerData<Hostable<any>>, typeof BaseRole>
  • Specifically assign a pool of players to each role in a specific team.

    Parameters

    • playerPool: PlayerData<Hostable<any>>[]

      The entire list of players that can be assigned a role, whether or not they already have a role. Note that this is not a list of players to be assigned a role from this team, but it is instead every possible player who could be assigned one.

    • settings: Partial<Record<RoleType, RoleChanceSettings>>

      Role settings to use when calculating how many players should assigned a specific role.

    • roleTeam: RoleTeamType

      The team of roles to assign.

    • maxAssignable: number

      The maximum number of players that can be assigned a role from this team. For example, it could be the set number of impostors configured in the game settings.

    • Optional defaultRole: typeof BaseRole

      The default role to assign to each player

    • roleAssignments: Map<PlayerData<Hostable<any>>, typeof BaseRole> = ...

      A map of role assigments (i.e. a map of player to roles) to act as a collective output to this method.

    Returns Map<PlayerData<Hostable<any>>, typeof BaseRole>

    The role assignments (i.e. a map of player to roles) that have either collectively been assigned (if roleAssignments is passed) or been assigned just as part of this method.

getRoleAssignmentsFromRoleList

  • getRoleAssignmentsFromRoleList(playerPool: PlayerData<Hostable<any>>[], settings: Partial<Record<RoleType, RoleChanceSettings>>, teamRoles: typeof BaseRole[], maxAssignable: number, defaultRole?: typeof BaseRole, roleAssignments?: Map<PlayerData<Hostable<any>>, typeof BaseRole>): Map<PlayerData<Hostable<any>>, typeof BaseRole>
  • Specifically assign a pool of players to each role in a list, with regard to the room settings (i.e. the chance of each role appearing or the maximum number of assignments for the role).

    Parameters

    • playerPool: PlayerData<Hostable<any>>[]

      The entire list of players that can be assigned a role, whether or not they already have a role. Note that this is not a list of players to be assigned a role from this team, but it is instead every possible player who could be assigned one.

    • settings: Partial<Record<RoleType, RoleChanceSettings>>

      Role settings to use when calculating how many players should assigned a specific role.

    • teamRoles: typeof BaseRole[]
    • maxAssignable: number

      The maximum number of players that can be assigned a role from this team. For example, it could be the set number of impostors configured in the game settings.

    • Optional defaultRole: typeof BaseRole

      The default role to assign to each player

    • roleAssignments: Map<PlayerData<Hostable<any>>, typeof BaseRole> = ...

      A map of role assigments (i.e. a map of player to roles) to act as a collective output to this method.

    Returns Map<PlayerData<Hostable<any>>, typeof BaseRole>

    The role assignments (i.e. a map of player to roles) that have either collectively been assigned (if roleAssignments is passed) or been assigned just as part of this method.

getSpawnPosition

  • getSpawnPosition(player: number | PlayerData<Hostable<any>>, initialSpawn: boolean): Vector2
  • Get the spawn position of a player whether they are about to spawn after starting or whether they are about to spawn after a meeting.

    Parameters

    • player: number | PlayerData<Hostable<any>>

      The player or player ID to determine the position of.

    • initialSpawn: boolean

      Whther or not this is a spawn after starting the game.

    Returns Vector2

    The spawn position of the player.

getTasks

  • getTasks(): TaskInfo[]

matchRoles

  • matchRoles(settings: Partial<Record<RoleType, RoleChanceSettings>>, filter: (roleCtr: typeof BaseRole, roleChance: RoleChanceSettings) => any): typeof BaseRole[]
  • Get all roles registered on the room that match a given filter.

    Parameters

    • settings: Partial<Record<RoleType, RoleChanceSettings>>
    • filter: (roleCtr: typeof BaseRole, roleChance: RoleChanceSettings) => any

      The filter to match against.

        • (roleCtr: typeof BaseRole, roleChance: RoleChanceSettings): any
        • Parameters

          • roleCtr: typeof BaseRole
          • roleChance: RoleChanceSettings

          Returns any

    Returns typeof BaseRole[]

    A list of all roles that satisfy the given filter.

off

  • off<EventName>(event: EventName, listener: Listener<ShipStatusEvents<RoomType>[EventName]>): void
  • off<K>(event: string, listener: Listener<K>): void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn" | "doors.open" | "doors.close" | "system.sabotage" | "system.repair" | "decon.doors.close" | "decon.doors.open" | "decon.enter" | "decon.exit" | "hqhud.consoles.reset" | "hqhud.consoles.open" | "hqhud.consoles.close" | "hqhud.consoles.complete" | "heli.consoles.open" | "heli.consoles.reset" | "heli.consoles.close" | "heli.consoles.complete" | "o2.consoles.clear" | "o2.consoles.complete" | "medscan.joinqueue" | "medscan.leavequeue" | "movingplatform.updateplayer" | "reactor.consoles.add" | "reactor.consoles.remove" | "reactor.consoles.reset" | "security.cameras.join" | "security.cameras.leave" | "electrical.switchflip" | "room.assignroles"

    Parameters

    Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns void

on

  • on<EventName>(event: EventName, listener: Listener<ShipStatusEvents<RoomType>[EventName]>): () => void
  • on<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn" | "doors.open" | "doors.close" | "system.sabotage" | "system.repair" | "decon.doors.close" | "decon.doors.open" | "decon.enter" | "decon.exit" | "hqhud.consoles.reset" | "hqhud.consoles.open" | "hqhud.consoles.close" | "hqhud.consoles.complete" | "heli.consoles.open" | "heli.consoles.reset" | "heli.consoles.close" | "heli.consoles.complete" | "o2.consoles.clear" | "o2.consoles.complete" | "medscan.joinqueue" | "medscan.leavequeue" | "movingplatform.updateplayer" | "reactor.consoles.add" | "reactor.consoles.remove" | "reactor.consoles.reset" | "security.cameras.join" | "security.cameras.leave" | "electrical.switchflip" | "room.assignroles"

    Parameters

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

once

  • once<EventName>(event: EventName, listener: Listener<ShipStatusEvents<RoomType>[EventName]>): () => void
  • once<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: "component.spawn" | "component.despawn" | "doors.open" | "doors.close" | "system.sabotage" | "system.repair" | "decon.doors.close" | "decon.doors.open" | "decon.enter" | "decon.exit" | "hqhud.consoles.reset" | "hqhud.consoles.open" | "hqhud.consoles.close" | "hqhud.consoles.complete" | "heli.consoles.open" | "heli.consoles.reset" | "heli.consoles.close" | "heli.consoles.complete" | "o2.consoles.clear" | "o2.consoles.complete" | "medscan.joinqueue" | "medscan.leavequeue" | "movingplatform.updateplayer" | "reactor.consoles.add" | "reactor.consoles.remove" | "reactor.consoles.reset" | "security.cameras.join" | "security.cameras.leave" | "electrical.switchflip" | "room.assignroles"

    Parameters

    Returns () => void

      • (): void
      • Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns () => void

      • (): void
      • Returns void

removeAllListeners

  • removeAllListeners(): void

removeListeners

  • removeListeners(event: string): void

spawn

  • spawn(): void
  • Spawn this component if does not exist in the room it belongs in.

    Returns void

spawnPlayer

  • spawnPlayer(player: PlayerData<Hostable<any>>, initialSpawn: boolean): void
  • Teleport a player to their spawn position, calculated using InnerShipStatus.getSpawnPosition.

    Parameters

    • player: PlayerData<Hostable<any>>

      The player to determine the position of.

    • initialSpawn: boolean

      Whether or not this is a spawn after starting the game.

    Returns void

tryAssignGhostRole

  • tryAssignGhostRole(player: PlayerData<Hostable<any>>): Promise<void>
  • Try to assign a ghost role to a specific dead player.

    Parameters

    • player: PlayerData<Hostable<any>>

      The player to assign the role to.

    Returns Promise<void>

wait

  • Type parameters

    • EventName: "component.spawn" | "component.despawn" | "doors.open" | "doors.close" | "system.sabotage" | "system.repair" | "decon.doors.close" | "decon.doors.open" | "decon.enter" | "decon.exit" | "hqhud.consoles.reset" | "hqhud.consoles.open" | "hqhud.consoles.close" | "hqhud.consoles.complete" | "heli.consoles.open" | "heli.consoles.reset" | "heli.consoles.close" | "heli.consoles.complete" | "o2.consoles.clear" | "o2.consoles.complete" | "medscan.joinqueue" | "medscan.leavequeue" | "movingplatform.updateplayer" | "reactor.consoles.add" | "reactor.consoles.remove" | "reactor.consoles.reset" | "security.cameras.join" | "security.cameras.leave" | "electrical.switchflip" | "room.assignroles"

    Parameters

    • event: EventName

    Returns Promise<ShipStatusEvents<RoomType>[EventName]>

  • Parameters

    • event: string

    Returns Promise<BasicEvent>

waitf

  • waitf<EventName>(event: EventName, filter: (ev: ShipStatusEvents<RoomType>[EventName]) => boolean | Promise<boolean>): Promise<ShipStatusEvents<RoomType>[EventName]>
  • waitf<K>(event: string, filter: (ev: K) => boolean | Promise<boolean>): Promise<BasicEvent>
  • Type parameters

    • EventName: "component.spawn" | "component.despawn" | "doors.open" | "doors.close" | "system.sabotage" | "system.repair" | "decon.doors.close" | "decon.doors.open" | "decon.enter" | "decon.exit" | "hqhud.consoles.reset" | "hqhud.consoles.open" | "hqhud.consoles.close" | "hqhud.consoles.complete" | "heli.consoles.open" | "heli.consoles.reset" | "heli.consoles.close" | "heli.consoles.complete" | "o2.consoles.clear" | "o2.consoles.complete" | "medscan.joinqueue" | "medscan.leavequeue" | "movingplatform.updateplayer" | "reactor.consoles.add" | "reactor.consoles.remove" | "reactor.consoles.reset" | "security.cameras.join" | "security.cameras.leave" | "electrical.switchflip" | "room.assignroles"

    Parameters

    • event: EventName
    • filter: (ev: ShipStatusEvents<RoomType>[EventName]) => boolean | Promise<boolean>
        • Parameters

          Returns boolean | Promise<boolean>

    Returns Promise<ShipStatusEvents<RoomType>[EventName]>

  • Type parameters

    Parameters

    • event: string
    • filter: (ev: K) => boolean | Promise<boolean>
        • (ev: K): boolean | Promise<boolean>
        • Parameters

          • ev: K

          Returns boolean | Promise<boolean>

    Returns Promise<BasicEvent>

Constructors

constructor

Accessors

owner

  • get owner(): RoomType

Generated using TypeDoc