Fly command
This commit is contained in:
@@ -1283,6 +1283,16 @@ export class GameServer {
|
||||
),
|
||||
);
|
||||
|
||||
// TODO: only let operators do this
|
||||
register(
|
||||
literal<ServerCommandSource>("fly").describe("Toggles flying").executes((context) => {
|
||||
const player = context.source.server_player;
|
||||
player.flying = !player.flying;
|
||||
player.fall_distance = 0;
|
||||
context.source.send_message(player.flying ? "You can fly" : "You can't fly anymore");
|
||||
}),
|
||||
);
|
||||
|
||||
register(
|
||||
literal<ServerCommandSource>("tps").describe("Shows how the game loop keeps up").executes((context) => {
|
||||
if (!this.loop) {
|
||||
@@ -1497,6 +1507,10 @@ export class GameServer {
|
||||
player.fall_distance = 0;
|
||||
return;
|
||||
}
|
||||
if (player.flying) {
|
||||
player.fall_distance = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const vitals = player.vitals;
|
||||
const in_liquid = this.#in_liquid(x, y, z);
|
||||
@@ -1649,6 +1663,8 @@ export class GameServer {
|
||||
);
|
||||
const attack_speed = player.attribute(ATTRIBUTES.attack_speed);
|
||||
sync("attack_speed", attack_speed, () => ({ type: "attack_speed", value: attack_speed }));
|
||||
const flying = player.flying;
|
||||
sync("flying", flying, () => ({ type: "flying", flying }));
|
||||
const effects = [...player.effects.values()]
|
||||
.filter((effect) => effect.show_icon)
|
||||
.map(({ type, amplifier, duration }) => ({ id: type.id, amplifier, duration }));
|
||||
|
||||
Reference in New Issue
Block a user