Start maybe working on a native app

This commit is contained in:
2026-11-22 17:38:28 -03:00
parent 681d3afb4d
commit a552883795
31 changed files with 1881 additions and 678 deletions
+3 -10
View File
@@ -36,7 +36,6 @@ export abstract class Player extends Entity {
// which way the body lies while swimming, radians up from flat: the way they're going, or looking when still
swim_pitch = 0;
prev_swim_pitch = 0;
#skin_version = 0;
constructor(level: ClientLevel, id: string, name: string) {
super(level, id, PLAYER_WIDTH, PLAYER_HEIGHT, PLAYER_EYE_HEIGHT);
@@ -72,15 +71,9 @@ export abstract class Player extends Entity {
};
}
// a base64 png from the server, or undefined for the default. the old skin stays until the new one is decoded
async set_skin(skin: string | undefined, slim = false) {
const version = ++this.#skin_version;
const texture = skin ? await decode_skin(skin) : undefined;
if (version !== this.#skin_version) {
// a newer skin came while this one was decoding
texture?.tex.destroy();
return;
}
// a base64 png from the server, or undefined for the default
set_skin(skin: string | undefined, slim = false) {
const texture = skin ? decode_skin(skin) : undefined;
this.skin?.tex.destroy();
this.skin = texture;
this.slim = slim;