Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Networkable<DataT, T, RoomType>

Represents a basic networkable object in Among Us.

See NetworkableEvents for events to listen to.

Type parameters

  • DataT

  • T: NetworkableEvents

  • RoomType: Hostable

Hierarchy

Index

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

canBeManaged

  • canBeManaged(): boolean

despawn

  • despawn(): 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>

      The component class to get.

    Returns undefined | T

getListeners

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

off

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

    • EventName: string | number | symbol

    Parameters

    • event: EventName
    • listener: Listener<T[EventName]>

    Returns void

  • Type parameters

    Parameters

    • event: string
    • listener: Listener<K>

    Returns void

on

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

    • EventName: string | number | symbol

    Parameters

    • event: EventName
    • listener: Listener<T[EventName]>

    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<T[EventName]>): () => void
  • once<K>(event: string, listener: Listener<K>): () => void
  • Type parameters

    • EventName: string | number | symbol

    Parameters

    • event: EventName
    • listener: Listener<T[EventName]>

    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

wait

  • wait<EventName>(event: EventName): Promise<T[EventName]>
  • wait(event: string): Promise<BasicEvent>

waitf

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

    • EventName: string | number | symbol

    Parameters

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

          • ev: T[EventName]

          Returns boolean | Promise<boolean>

    Returns Promise<T[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>

Properties

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.

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.

spawnType

spawnType: SpawnType

The type of object that this component belongs to.

Constructors

constructor

  • new Networkable<DataT, T, RoomType>(room: RoomType, spawnType: SpawnType, netId: number, ownerId: number, flags: number, data?: HazelReader | DataT): Networkable<DataT, T, RoomType>
  • Type parameters

    • DataT

    • T: NetworkableEvents<Hostable<any>>

    • RoomType: Hostable<any, RoomType>

    Parameters

    • room: RoomType
    • spawnType: SpawnType
    • netId: number
    • ownerId: number
    • flags: number
    • Optional data: HazelReader | DataT

    Returns Networkable<DataT, T, RoomType>

Accessors

owner

  • get owner(): undefined | Hostable<any> | PlayerData<RoomType>

Generated using TypeDoc