yolkbot
    Preparing search index...

    Class SpatulaGame

    A CTS (capture the spatula) game

    Hierarchy

    Index

    Accessors

    • get me(): Player

      Automatically pulls the current Player that represents the bot. Returns something with invalid properties (aside from id and team) if the player hasn't initialized yet. You can use Game.isReady to check if the player is ready or not.

      Returns Player

    Constructors

    • Creates a base gamemode.

      Parameters

      • bot: Bot

        The bot

      • socket: WSSocket

        The game's socket

      • map: Map

        The game's basic map information

      • mapIdx: number

        The map index

      • myId: number

        The ID of the player

      • myTeam: number

        The ID of the team the player is on

      • inputData: RawFindGameResponse

        The input game data (region, code, subdomain, etc)

      • isGameOwner: boolean

        Whether the bot is the game owner or not

      • isPrivate: boolean

        Whether the game is private or not

      • joinOptions: JoinOptions
      • OptionalrawMap: MapJSON

        The raw map data

      Returns SpatulaGame

    Methods

    • Checks whether the bot can see a specific player. Basic and not super accurate, but it should work for most cases.

      Parameters

      • target: Player

        The player to check line of sight to

      Returns boolean

      Whether the bot can see the target player or not

    • Cleans up a game after the bot leaves

      Returns void

    • Gets the best target for the bot to attack based on distance and if they're in the line of sight (among other factors)

      Parameters

      • OptionalcheckCanSee: boolean

        Whether to check if the bot can see the target using Game.canSee (defaults to false)

      • OptionalcustomPredicate: (player: Player) => boolean

        An optional function to filter potential targets; it should return true for valid targets and false for invalid ones

      Returns Player | null

      The best target for the bot to attack, or null if there are no valid targets

    • Checks whether pathfinding has "warmed up" (been used at all)

      Returns boolean

    • Checks whether bot.me is ready to use

      Returns boolean

    • Leaves a game

      Parameters

      • code: number = CloseCode.mainMenu

      Returns void

    • Processes an incoming packet from the server

      Parameters

      • bytes: Uint8Array<ArrayBuffer>

        The raw packet bytes in a Uint8Array

      Returns void

    Properties

    bot: Bot

    The bot attached to the game

    code: string = ''

    The game code

    collectibles: Record<CollectType, Collectible[]> = ...

    The collectibles spawned in on the map

    isGameOwner: boolean = false

    Whether the bot is the game owner

    isNoob: boolean = false

    Whether the game is a "noob" game

    isObserving: boolean = false

    Whether the bot is observing the game (as an eggforcer)

    isPrivate: boolean = false

    Whether the game is private

    map: GameMap

    The game's map information

    mode: Spatula = ...

    The game mode (spatula)

    myId: number = -1

    Represents the bot's current player ID; available before the botJoin hook.

    options: GameOptions = ...

    The game's options in that lil old panel

    ping: number = 0

    The bot's game "ping"

    playerHoldingSpatula: number = 0

    The ID of the Player holding the spatula

    players: (Player | undefined)[] = []

    All of the players in the game

    region: string = ''

    The game region

    simulator?: Simulator | null

    The simulator. Only exists if pathfinding has warmed up by calling the getter on Game.pathing

    socket: WSSocket

    The websocket instance associated with the game

    spatula: { x: number; y: number; z: number } = ...

    The spatula coordinates

    state: {
        buffer: {
            controlKeys?: number;
            pitch?: number;
            shotsFired?: number;
            yaw?: number;
        }[];
        chatLines: number;
        climbRY: number;
        climbX: number;
        climbZ: number;
        controlKeys: number;
        dx: number;
        dy: number;
        dz: number;
        onGround: number;
        pitch: number;
        reloading: boolean;
        serverStateIdx: number;
        shotsFired: number;
        stateIdx: number;
        swappingGun: boolean;
        usingMelee: boolean;
        yaw: number;
    } = ...

    Holds basic information about the player's current state. This is often changed during breaking changes, so keep an eye on the object form. You should NEVER need to manipulate ANYTHING in here, as it often has adverse side effects

    Type Declaration

    • buffer: { controlKeys?: number; pitch?: number; shotsFired?: number; yaw?: number }[]

      The bot's "state" buffer

    • chatLines: number

      A ticker for the bot's current chat cooldown.

    • climbRY: number

      A ticker used for climbing ladders

    • climbX: number

      A ticker used for climbing ladders

    • climbZ: number

      A ticker used for climbing ladders

    • controlKeys: number

      The bot's current raw packet control keys

    • dx: number

      The bot's X direction, used for movement. If you need the bot's current position, use the "position" prop on Bot.me

    • dy: number

      The bot's Y direction, used for movement. If you need the bot's current position, use the "position" prop on Bot.me

    • dz: number

      The bot's Z direction, used for movement. If you need the bot's current position, use the "position" prop on Bot.me

    • onGround: number

      A ticker for the bot's jumping state, from 0 (on ground) to 4 (fully off ground)

    • pitch: number

      The bot's current pitch pre-packet send. If you need the bot's current yaw as synced with the server, use the "view" prop on Bot.me

    • reloading: boolean

      Whether the bot is reloading

    • serverStateIdx: number

      The bot's current state IDX, according to the server

    • shotsFired: number

      The number of shots fired in that frame. If you need to fire shots, please use the FireDispatch

    • stateIdx: number

      The bot's current state IDX, according to the client

    • swappingGun: boolean

      Whether the bot is swapping its gun

    • usingMelee: boolean

      Whether the bot is using its melee

    • yaw: number

      The bot's current yaw pre-packet send. If you need the bot's current yaw as synced with the server, use the "view" prop on Bot.me

    subdomain: string = ''

    The game's cluster subdomain

    teamHoldingSpatula: Team = Team.None

    The team of the Player holding the spatula

    teamScore: number[] = ...

    The team "score" (the blue/red eggs at the top center of the game), with each index representing the Team enum value