Player api

This commit is contained in:
2026-10-13 22:59:48 -03:00
parent b34e97e487
commit a10b15a3fd
22 changed files with 581 additions and 89 deletions
+11
View File
@@ -1340,6 +1340,17 @@ function player_api(game: GameServer, player: ServerPlayer): Player {
},
remove_effect: (id) => player.remove_effect(known_effect(id).id),
is_swimming: () => player.swimming,
is_sneaking: () => player.sneaking,
start_using(ticks) {
if (!Number.isInteger(ticks) || (ticks < 1 && ticks !== -1)) {
throw new Error("start_using takes a whole number of ticks, or -1 until they let go");
}
game.start_using(player, ticks);
},
stop_using() {
player.using = undefined;
},
is_using: () => player.using !== undefined,
};
}