Skip to content

Commit

Permalink
tp icon labels
Browse files Browse the repository at this point in the history
  • Loading branch information
SiriusAshling committed Feb 10, 2022
1 parent ccf426b commit a7bf521
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function describeSysCommand(command: SysSubcommand): string {
const uberStateDescription = describeUberState(command.uberIdentifier);
return `Enable multiplayer sync for ${uberStateDescription}`;
} case SysCommandVariant.createWarpIcon:
return `Create warp icon ${command.warpId} at ${command.x}, ${command.y}`;
return `Create warp icon ${command.warpId} at ${command.x}, ${command.y}${command.label === undefined ? "" : ` with a label "${command.label}"`}`;
case SysCommandVariant.destroyWarpIcon:
return `Destroy warp icon ${command.warpId}`;
case SysCommandVariant.ifBounds: {
Expand Down
1 change: 1 addition & 0 deletions src/item/sysCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ interface CreateWarpIcon {
warpId: number,
x: number,
y: number,
label?: string,
}
interface DestroyWarpIcon {
id: SysCommandVariant.destroyWarpIcon,
Expand Down
7 changes: 7 additions & 0 deletions src/parser/parseItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,18 @@ function parseCreateWarpIcon(status: ParseStatus): ParseCommandSuccess | ParseFa
const y = parseFloat(status);
if (y === null) { return fail(Token.float, status, undefined); }

let label;
if (eat(status, "|")) {
label = parseRemainingLine(status);
if (label === null) { return fail(Token.text, status, undefined); }
}

const command: SysSubcommand = {
id: SysCommandVariant.createWarpIcon,
warpId,
x,
y,
label,
};

return succeed(command);
Expand Down
5 changes: 3 additions & 2 deletions syntaxes/ori-wotw-header.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@
}
},
"createWarp": {
"match": "\\G(4\\|22\\|)(\\d+\\|-?\\d+(?:[.,]\\d+)?\\|-?\\d+(?:[.,]\\d+)?)\\b",
"match": "\\G(4\\|22\\|)(\\d+\\|-?\\d+(?:[.,]\\d+)?\\|-?\\d+(?:[.,]\\d+)?)(\\|[^\\s]+)?\\b",
"captures": {
"1": { "name": "variable.other.enummember" },
"2": { "name": "variable" }
"2": { "name": "variable" },
"3": { "name": "string" }
}
},
"destroyWarp": {
Expand Down

0 comments on commit a7bf521

Please sign in to comment.