Player api
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user