Tp command
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user