Tp command

This commit is contained in:
2026-10-02 13:51:07 -03:00
parent 7b3cdd925e
commit d2dde8c14f
3 changed files with 23 additions and 0 deletions
+16
View File
@@ -42,6 +42,7 @@ import {
integer,
item,
literal,
number,
word,
} from "$/common/commands.ts";
import type { GameLoop } from "./game_loop.ts";
@@ -1218,6 +1219,21 @@ export class GameServer {
),
);
// TODO: only let operators do this
register(
literal<ServerCommandSource>("tp").describe("Teleports you to x y z").then(
argument<number, ServerCommandSource>("x", number()).then(
argument<number, ServerCommandSource>("y", number()).then(
argument<number, ServerCommandSource>("z", number()).executes((context) => {
const [x, y, z] = ["x", "y", "z"].map((axis) => context.get<number>(axis));
this.teleport(context.source.server_player, x, y, z);
context.source.send_message(`Teleported to ${x} ${y} ${z}`);
}),
),
),
),
);
register(
literal<ServerCommandSource>("tps").describe("Shows how the game loop keeps up").executes((context) => {
if (!this.loop) {