Skip to content

Commit

Permalink
feat: add button to move player to selected teleport destination
Browse files Browse the repository at this point in the history
  • Loading branch information
PeenScreeker committed Sep 16, 2024
1 parent a3b99f3 commit 7733f6f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions layout/pages/zoning/zoning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@
<TextEntry id="TeleYaw" class="textentry zoning__textentry" maxchars="6" textmode="numeric" ontextentrysubmit="ZoneMenuHandler.setRegionTeleDestOrientation()" />
</Panel>
</Panel>
<Panel class="zoning__property">
<Panel class="zoning__region-property-container">
<Button id="CheckTPDest" class="button button--green" onactivate="ZoneMenuHandler.moveToTeleDest()">
<Label text="Teleport" class ="button__text" />
</Button>
</Panel>
</Panel>
</Panel>
</Panel>
</Panel>
Expand Down
9 changes: 9 additions & 0 deletions scripts/pages/zoning/zoning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,15 @@ class ZoneMenuHandler {
}
}

moveToTeleDest() {
if (!this.selectedZone || !this.selectedZone.zone) return;

const region = this.selectedZone.zone.regions[0];
if (region.teleDestTargetname === '' && !region.teleDestPos && !region.teleDestYaw) return;

this.panels.zoningMenu.moveToTPDest(region);
}

onPointPicked(point: { x: number; y: number; z: number }) {
if (!this.selectedZone || !this.selectedZone.zone) return;

Expand Down
2 changes: 2 additions & 0 deletions scripts/types-mom/panels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@ interface ZoneMenu extends AbstractPanel<'ZoneMenu'> {
setCornersFromRegion(region: import('common/web').Region): void;

moveToRegion(region: import('common/web').Region): void;

moveToTPDest(region: import('common/web').Region): void;
}

0 comments on commit 7733f6f

Please sign in to comment.