Skip to content

Commit

Permalink
Change undefined returns to null.
Browse files Browse the repository at this point in the history
  • Loading branch information
CriticalFloof committed Dec 3, 2023
1 parent 704b06e commit 45f6210
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/omegga/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class Player implements OmeggaPlayer {
);
}

async getPawn(): Promise<string | undefined> {
async getPawn(): Promise<string | null> {
// given a player controller, match the player's pawn
const pawnRegExp = new RegExp(
`^(?<index>\\d+)\\) BP_PlayerController_C .+?PersistentLevel\\.${this.controller}\\.Pawn = (?:BP_FigureV2_C'.+:PersistentLevel\\.)?(?<pawn>BP_FigureV2_C_\\d+|None)'?`
Expand All @@ -361,12 +361,12 @@ class Player implements OmeggaPlayer {
{ first: 'index', timeoutDelay: 500 }
);

if (pawn === 'None') return;
if (pawn === 'None') return null;

return pawn;
}

async getPosition(): Promise<[number, number, number] | undefined> {
async getPosition(): Promise<[number, number, number] | null> {
// this is here because my text editor had weird syntax highlighting glitches when the other omeggas were replaced with this.#omegga...
// guess the code is "too new" :egg:
const omegga = this.#omegga;
Expand All @@ -387,7 +387,7 @@ class Player implements OmeggaPlayer {
{ first: 'index', timeoutDelay: 100 }
);

if (pawn === 'None') return;
if (pawn === 'None') return null;

// given a player's pawn, match the player's position
const posRegExp = new RegExp(
Expand Down

0 comments on commit 45f6210

Please sign in to comment.