Slim skins

This commit is contained in:
2026-09-27 13:55:46 -03:00
parent d822267bd3
commit d0cbec1846
8 changed files with 89 additions and 13 deletions
+27
View File
@@ -34,6 +34,33 @@ Deno.test("/skin downloads a png, tells everyone and is saved with the player",
assertEquals(join.players.find((p: { name: string }) => p.name === "alice").skin, skin);
});
Deno.test("/skin <url> slim is for the model with thin arms, normal is the default", async () => {
const t = await test_game("mods");
t.downloads.set("https://example.com/alex.png", SKIN);
t.join(1, "alice");
t.take(1);
const skin_message = async (text: string) => {
t.send(1, { type: "chat", text });
await settle();
return t.take(1).find((m) => m.type === "player_skin");
};
assertEquals((await skin_message("/skin https://example.com/alex.png slim")).slim, true);
const loaded = await test_game("mods", t.game.save());
loaded.join(1, "alice");
assertEquals(loaded.join(2, "bob").players.find((p: { name: string }) => p.name === "alice").slim, true);
assertEquals((await skin_message("/skin https://example.com/alex.png normal")).slim, undefined);
assertEquals((await skin_message("/skin https://example.com/alex.png slim")).slim, true);
assertEquals((await skin_message("/skin https://example.com/alex.png")).slim, undefined);
assertEquals((await skin_message("/skin https://example.com/alex.png slim")).slim, true);
// back to the default skin is back to the normal model too
assertEquals((await skin_message("/skin")).slim, undefined);
t.send(1, { type: "chat", text: "/skin https://example.com/alex.png wide" });
assertEquals(t.take(1).some((m) => m.type === "player_skin"), false);
});
Deno.test("/skin says why a download can't be a skin, and /skin alone goes back to the default", async () => {
const t = await test_game("mods");
const wide = SKIN.slice();