Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Avatar finishes: Matte and Metallic beside Flat and Fluffy

aivsomkar3eca0c2167e7
diff --git a/packages/phone-protocol/src/bot-avatar.ts b/packages/phone-protocol/src/bot-avatar.ts
index 72ad56f520..e976633368 100644
--- a/packages/phone-protocol/src/bot-avatar.ts
+++ b/packages/phone-protocol/src/bot-avatar.ts
@@ -4,8 +4,8 @@ export const MASCOT_FACE_COLORS = ["white", "black"] as const;
export const mascotFaceColorSchema = z.enum(MASCOT_FACE_COLORS);
export type MascotFaceColor = z.infer<typeof mascotFaceColorSchema>;
-/** The finish of an engine-drawn avatar body (the shapes and Open Bot Avatar objects): Open Bot Avatar's fluffy fur; absent or null is flat. */
-export const MASCOT_MATERIALS = ["fluffy"] as const;
+/** The finish of an engine-drawn avatar body (the shapes and Open Bot Avatar objects): Open Bot Avatar's fluffy fur, or the same surface lit as matte clay or polished metal; absent or null is flat. */
+export const MASCOT_MATERIALS = ["fluffy", "matte", "metallic"] as const;
export const mascotMaterialSchema = z.enum(MASCOT_MATERIALS);
export type MascotMaterial = z.infer<typeof mascotMaterialSchema>;
diff --git a/packages/phone-protocol/src/open-bot-avatar/README.md b/packages/phone-protocol/src/open-bot-avatar/README.md
index a78d053754..27ae938351 100644
--- a/packages/phone-protocol/src/open-bot-avatar/README.md
+++ b/packages/phone-protocol/src/open-bot-avatar/README.md
@@ -12,13 +12,17 @@ Vendored sources of [Open Bot Avatar](https://github.com/DominikScholz/open-bot-
## Our changes
-`render.ts` and `dom/paint.ts` carry our only code changes, each marked `MausBot:`:
+`render.ts`, `dom/paint.ts` and the finishes below carry our only code changes, each marked `MausBot:`:
- A smile under the eyes (`mouthMark`), drawn with the eyes in the canvas and SVG renderers. The CSS-3D
`renderAvatarScene` path has no mouth; `mountAvatar` only falls back to it where canvas is missing
(never in the desktop app).
- With the fluffy material the coat seats only the two eyes, so `dom/paint.ts` paints the mouth flat on top
of it.
+- Two more materials, `matte` and `metallic`, beside `flat` and `fluffy` (`types.ts`, `dom/mount.ts`,
+ `dom/paint.ts`, `dom/fluffy/renderer.ts`, `dom/fluffy/shaders.ts`, `dom/fluffy/marks.ts`). They take the
+ fluffy path (same mesh, sockets, eye beads and state marks) but draw only the body pass, lit by
+ `bareSurface` in the fragment shader under the `finish` uniform; fluffy itself is unchanged.
- The ribbons of `working` and `done` take our six rainbow comet palettes (`COMET_COLORS`) instead of
shades of the body colour.
diff --git a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/marks.ts b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/marks.ts
index 77a6ee443a..c9e78057b8 100644
--- a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/marks.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/marks.ts
@@ -5,7 +5,7 @@
*/
import { viewBasis, type FramePath } from '../../render.ts';
import type { Capsule } from './mesh.ts';
-import { renderFluffy } from './renderer.ts';
+import { renderFluffy, type FluffyFinish } from './renderer.ts';
/** Radius of a mark's model, viewBox units: enough for the short pile to read on a small dot. */
const RADIUS = 12;
@@ -21,7 +21,7 @@ const sprites = new Map<string, { canvas: HTMLCanvasElement; radius: number }>()
* (which animates it). `scale` is device pixels per viewBox unit. False where fluffy can't be
* drawn: the caller fills the mark's path instead.
*/
-export function paintFluffyMark(ctx: CanvasRenderingContext2D, box: FramePath['box'], scale: number, color: string): boolean {
+export function paintFluffyMark(ctx: CanvasRenderingContext2D, box: FramePath['box'], scale: number, color: string, finish: FluffyFinish = 'fluffy'): boolean {
const aspect = Math.round((1000 * box.h) / box.w) / 1000;
let model = models.get(aspect);
if (!model) {
@@ -33,10 +33,10 @@ export function paintFluffyMark(ctx: CanvasRenderingContext2D, box: FramePath['b
const unit = box.w / (2 * RADIUS);
// Whole powers of two, so a mark that grows or shrinks keeps the same fibers.
const density = Math.min(8, Math.max(0.5, 2 ** Math.ceil(Math.log2(HEADROOM * scale * unit))));
- const key = `${aspect}|${color}|${density}`;
+ const key = `${aspect}|${color}|${density}|${finish}`;
let sprite = sprites.get(key);
if (!sprite) {
- const image = renderFluffy(model, FRONT, { color, ink: color, eyes: [] }, density);
+ const image = renderFluffy(model, FRONT, { color, ink: color, eyes: [], finish }, density);
if (!image) return false;
// The renderer's canvas is shared with the body: keep a copy.
const canvas = document.createElement('canvas');
diff --git a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/renderer.ts b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/renderer.ts
index f3fc9b5f07..df9cc56b3b 100644
--- a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/renderer.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/renderer.ts
@@ -12,9 +12,12 @@
import type { EyeMark, SurfaceEye, ViewBasis } from '../../render.ts';
import { DYE_RAMP_SIZE, dyeRamp } from './dye.ts';
import { ROOT_PASSES, buildMesh, halfDepth, rootsIn, type IndexRange, type FluffyShape } from './mesh.ts';
-import { PASS, fragmentShader, vertexShader } from './shaders.ts';
+import { FINISH, PASS, fragmentShader, vertexShader } from './shaders.ts';
import { SOCKET_TILE, exposedHeight, socketKey, socketRegion, socketTile } from './socket.ts';
+/** MausBot: how the surface is finished. Matte and metallic light the bare body and draw no pile. */
+export type FluffyFinish = keyof typeof FINISH;
+
/** The colors of a coat and the eyes set into it (none for a state mark). */
export interface FluffyLook {
/** Body color, any CSS color. */
@@ -23,6 +26,8 @@ export interface FluffyLook {
ink: string;
/** Up to two eyes, left first. */
eyes: SurfaceEye[];
+ /** Fluffy when left out. */
+ finish?: FluffyFinish;
}
/** A rendered coat. It lasts until the next render: draw or copy it at once. */
@@ -193,7 +198,7 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
const uniform = (name: string) => gl.getUniformLocation(program, name);
const u = {
view: uniform('view'), pivot: uniform('pivot'), extent: uniform('extent'), radius: uniform('radius'),
- shell: uniform('shell'), strandWidth: uniform('strandWidth'), pass: uniform('pass'), color: uniform('color'), ink: uniform('ink'),
+ shell: uniform('shell'), strandWidth: uniform('strandWidth'), pass: uniform('pass'), finish: uniform('finish'), color: uniform('color'), ink: uniform('ink'),
eyeRegion: uniform('eyeRegion[0]'), eyeSize: uniform('eyeSize[0]'),
};
gl.enable(gl.DEPTH_TEST);
@@ -325,7 +330,7 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
const readColor = colorReader();
const shown = {
- geometry: null as Geometry | null, view: null as ViewBasis | null, pixels: 0, color: '', ink: '',
+ geometry: null as Geometry | null, view: null as ViewBasis | null, pixels: 0, color: '', ink: '', finish: '',
regions: new Float32Array(8), contours: ['', ''],
};
let dye = '';
@@ -339,6 +344,7 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
// allocates its buffers anew. Each image sits in the corner WebGL counts from, the lower left.
if (canvas.width < pixels) canvas.width = canvas.height = pixels;
const image = { canvas, x: 0, y: canvas.height - pixels, size: pixels, cx, cy, radius };
+ const finish = look.finish ?? 'fluffy';
// The sockets: where each eye is, and its contour's distance tile.
const eyeZ = 'eyeZ' in shape ? shape.eyeZ : [];
@@ -357,7 +363,7 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
? Math.abs(view.cY - shown.view.cY) + Math.abs(view.sY - shown.view.sY) + Math.abs(view.sP - shown.view.sP) + Math.abs(view.cP - shown.view.cP)
: Infinity;
if (
- shown.geometry === geometry && shown.pixels === pixels && shown.color === look.color && shown.ink === look.ink &&
+ shown.geometry === geometry && shown.pixels === pixels && shown.color === look.color && shown.ink === look.ink && shown.finish === finish &&
contours.every((key, slot) => key === shown.contours[slot]) && regions.every((value, i) => value === shown.regions[i]) &&
turn < SAME_VIEW / (radius * scale)
) {
@@ -368,6 +374,8 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
shown.pixels = pixels;
shown.color = look.color;
shown.ink = look.ink;
+ shown.finish = finish;
+ gl.uniform1i(u.finish, FINISH[finish]);
shown.regions.set(regions);
look.eyes.forEach(({ mark }, slot) => {
@@ -403,6 +411,7 @@ function createRenderer(onContextRestored: () => void): Renderer | null {
gl.bindVertexArray(geometry.surface);
gl.uniform1i(u.pass, PASS.body);
gl.drawElements(gl.TRIANGLES, triangles.count, gl.UNSIGNED_INT, 4 * triangles.start);
+ if (finish !== 'fluffy') return image;
gl.uniform1i(u.pass, PASS.shell);
for (let layer = 1; layer <= shells; layer++) {
gl.uniform1f(u.shell, layer / shells);
diff --git a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/shaders.ts b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/shaders.ts
index 56eb0d94d1..3deed829fb 100644
--- a/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/shaders.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/dom/fluffy/shaders.ts
@@ -10,6 +10,9 @@ import { SOCKET_PAD } from './socket.ts';
/** The values of the `pass` uniform. */
export const PASS = { body: 0, shell: 1, strand: 2 } as const;
+/** MausBot: the values of the `finish` uniform. Matte and metallic draw the body pass alone. */
+export const FINISH = { fluffy: 0, matte: 1, metallic: 2 } as const;
+
/** A number as a GLSL float literal. */
const float = (n: number) => (Number.isInteger(n) ? `${n}.` : `${n}`);
@@ -45,6 +48,36 @@ float socketDistance(vec3 p, vec3 normal, out vec2 uv, out vec3 local) {
return FAR;
}`;
+// MausBot: the body with no pile. `d` is the distance to the nearer eye's contour.
+const bareSurface = `
+vec3 bareSurface(vec3 n, vec3 light, float d) {
+ float lambert = dot(n, light);
+ float socket = 1. - smoothstep(-.1, 1.7, d);
+ if (finish == ${FINISH.matte}) {
+ // Clay: light wraps far round the body, and nothing shines.
+ float wrap = clamp((lambert + .8) / 1.8, 0., 1.);
+ float sky = .5 - .5 * n.y;
+ vec3 lit = color * (.66 + .40 * wrap * wrap + .05 * sky);
+ // Shadows keep their hue: darker, not greyer.
+ lit = mix(lit * lit, lit, .55 + .45 * wrap);
+ return lit * (1. - .22 * socket);
+ }
+ // Polished metal: the body color tints everything it reflects. The surroundings are looked up
+ // by the normal, not the mirrored view: a flat front face would otherwise swing from sky to
+ // ground with every small turn.
+ float up = -n.y;
+ float sky = mix(1., .58, smoothstep(.08, .95, up));
+ float ground = mix(.46, .68, smoothstep(.12, .95, -up));
+ float surroundings = mix(ground, sky, smoothstep(-.24, .08, up));
+ float fresnel = pow(1. - clamp(n.z, 0., 1.), 3.);
+ vec3 tint = mix(color, vec3(1.), .10 + .45 * fresnel);
+ vec3 metal = tint * (.14 + .20 * clamp(lambert, 0., 1.) + .90 * surroundings);
+ vec3 halfway = normalize(light + vec3(0., 0., 1.));
+ float highlight = pow(clamp(dot(n, halfway), 0., 1.), 48.);
+ metal += mix(color, vec3(1.), .75) * (.85 * highlight + .22 * fresnel);
+ return metal * (1. - .30 * socket);
+}`;
+
export const vertexShader = `#version 300 es
precision highp float;
precision highp int;
@@ -145,7 +178,7 @@ uniform sampler2D dyeRamp;
uniform highp sampler3D brushedPile;
uniform vec3 color, ink;
uniform mat3 view;
-uniform int pass;
+uniform int pass, finish;
uniform float shell;
in vec3 P, N, V, pilePosition, lean;
in float tip, variation, across, pocketDepth;
@@ -173,6 +206,8 @@ float brushedHeight() {
return clamp(.5 + 1.65 * (locks / 16. - .5) + .16 * (tuft - .5), 0., 1.);
}
+${bareSurface}
+
void main() {
vec3 n = normalize(N);
vec3 light = normalize(vec3(-.52, -.83, .62));
@@ -259,6 +294,8 @@ void main() {
base = mix(base, (dye + scatter) * brightness * pileFill, ramp.a);
}
+ if (finish != ${FINISH.fluffy}) base = bareSurface(n, light, d);
+
if (pass == BODY && d < 3.7) {
// The eye: a glossy bead in the socket.
vec2 curve = local.xy * .94;
diff --git a/packages/phone-protocol/src/open-bot-avatar/dom/mount.ts b/packages/phone-protocol/src/open-bot-avatar/dom/mount.ts
index e1700b78e0..34e6f6fb06 100644
--- a/packages/phone-protocol/src/open-bot-avatar/dom/mount.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/dom/mount.ts
@@ -30,8 +30,9 @@ export interface AvatarOptions {
/** Eye color: #rgb or #rrggbb, or any CSS color. Defaults to a near-black ink. */
eyeColor?: string;
/**
- * The body's finish: 'flat' (default), or 'fluffy' for a coat of fur with the eyes set into it.
- * Fluffy needs the canvas renderer and WebGL2; without them the avatar draws flat.
+ * The body's finish: 'flat' (default), 'fluffy' for a coat of fur with the eyes set into it, or
+ * 'matte' or 'metallic' for the same surface lit bare. All but flat need the canvas renderer and
+ * WebGL2; without them the avatar draws flat.
*/
material?: AvatarMaterial;
/** Volume amount 0..14 (6 = natural depth, 0 = flat). */
@@ -244,8 +245,8 @@ export function mountAvatar(host: HTMLElement, initial: AvatarOptions): MountedA
lastStill = '';
};
- /** Whether the avatar is painted in fluffy: on a canvas, live or still. */
- const fluffy = () => opts.material === 'fluffy' && opts.renderer !== 'scene' && canvasSupported();
+ /** Whether the avatar is painted with a lit finish (MausBot: fluffy, matte or metallic): on a canvas, live or still. */
+ const fluffy = () => opts.material !== undefined && opts.material !== 'flat' && opts.renderer !== 'scene' && canvasSupported();
const paint = (p: AvatarOptions, options: RenderOptions) => {
if (scene || lastStill) clear();
diff --git a/packages/phone-protocol/src/open-bot-avatar/dom/paint.ts b/packages/phone-protocol/src/open-bot-avatar/dom/paint.ts
index 2c6c78f1bf..3b6d85f014 100644
--- a/packages/phone-protocol/src/open-bot-avatar/dom/paint.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/dom/paint.ts
@@ -171,9 +171,11 @@ export function paintCanvas(surface: CanvasSurface, frame: AvatarFrame, size: nu
if (!sections.has(id)) sections.set(id, { box, path: new Path2D(d), rule: evenOdd ? 'evenodd' : 'nonzero' });
}
const { matrices, bounds } = framePlacement(frame);
- const volume = material === 'fluffy' ? surface.volume : null;
+ // MausBot: matte and metallic take the fluffy path with their own lighting and no pile.
+ const finish = material === 'flat' ? null : material;
+ const volume = finish ? surface.volume : null;
const fluffy = volume !== null;
- if (fluffy) {
+ if (fluffy && finish === 'fluffy') {
bounds.x0 -= PILE_MARGIN;
bounds.y0 -= PILE_MARGIN;
bounds.x1 += PILE_MARGIN;
@@ -198,7 +200,7 @@ export function paintCanvas(surface: CanvasSurface, frame: AvatarFrame, size: nu
// The whole body and its eyes as one image, unless it has shrunk away into a mark.
const { view, scale: bodyScale, eyes } = frame.surface;
- const coat = volume && bodyScale > 0.001 ? renderFluffy(volume(), view, { color: fill, ink, eyes }, scale) : null;
+ const coat = volume && bodyScale > 0.001 ? renderFluffy(volume(), view, { color: fill, ink, eyes, finish: finish ?? undefined }, scale) : null;
let coatPainted = false;
ctx.lineCap = 'round';
ctx.strokeStyle = ink;
@@ -210,7 +212,7 @@ export function paintCanvas(surface: CanvasSurface, frame: AvatarFrame, size: nu
if (shape.kind === 'slice') {
const section = sections.get(shape.path) as Section;
if (isMark(shape)) {
- if (!fluffy || !paintFluffyMark(ctx, section.box, scale, fill)) ctx.fill(section.path, section.rule);
+ if (!finish || !fluffy || !paintFluffyMark(ctx, section.box, scale, fill, finish)) ctx.fill(section.path, section.rule);
} else if (!coat) {
ctx.fill(section.path, section.rule);
} else if (!coatPainted) {
diff --git a/packages/phone-protocol/src/open-bot-avatar/types.ts b/packages/phone-protocol/src/open-bot-avatar/types.ts
index 1047ee9316..31dd765e6a 100644
--- a/packages/phone-protocol/src/open-bot-avatar/types.ts
+++ b/packages/phone-protocol/src/open-bot-avatar/types.ts
@@ -64,8 +64,11 @@ export interface AvatarMotionBlend {
t: number;
}
-/** A body's finish: a flat fill, or a coat of fluffy fur (live avatars on a canvas, see AvatarOptions). */
-export type AvatarMaterial = 'flat' | 'fluffy';
+/**
+ * A body's finish: a flat fill, a coat of fluffy fur, or (MausBot) the bare surface lit as matte
+ * clay or polished metal (all but flat on a canvas, see AvatarOptions).
+ */
+export type AvatarMaterial = 'flat' | 'fluffy' | 'matte' | 'metallic';
export interface RenderOptions {
/** Body color as #rgb or #rrggbb. Invalid values fall back to the default. */
diff --git a/server/bot-profile.test.ts b/server/bot-profile.test.ts
index f82009c80a..1165c90bbe 100644
--- a/server/bot-profile.test.ts
+++ b/server/bot-profile.test.ts
@@ -155,15 +155,15 @@ describe("mascotBodyColor", () => {
});
describe("mascotMaterial", () => {
- it.each(["fluffy", null] as const)("accepts %s at both profile boundaries", (mascotMaterial) => {
+ it.each(["fluffy", "matte", "metallic", null] as const)("accepts %s at both profile boundaries", (mascotMaterial) => {
for (const strict of [true, false]) {
expect(parseBotProfilePatch({ mascotMaterial }, strict)).toEqual({ ok: true, patch: { mascotMaterial } });
}
});
- it.each(["Fluffy", "fuzzy", "velvet", "", 1, {}])("rejects %j", (mascotMaterial) => {
+ it.each(["Fluffy", "fuzzy", "velvet", "flat", "", 1, {}])("rejects %j", (mascotMaterial) => {
expect(parseBotProfilePatch({ mascotMaterial } as never, true)).toEqual({
- ok: false, error: "mascotMaterial must be fluffy, or null",
+ ok: false, error: "mascotMaterial must be fluffy, matte, metallic, or null",
});
});
});
diff --git a/server/mascot-face-color.e2e.test.ts b/server/mascot-face-color.e2e.test.ts
index 7194031447..8ffa210b10 100644
--- a/server/mascot-face-color.e2e.test.ts
+++ b/server/mascot-face-color.e2e.test.ts
@@ -65,7 +65,7 @@ it("saves, reads and clears a custom body color through the isolated HTTP routes
}
}, 60_000);
-it("saves, reads and clears the fluffy finish through the isolated HTTP routes", async () => {
+it("saves, reads and clears each finish through the isolated HTTP routes", async () => {
const fixture = await launchVerificationServer();
const api = async (method: string, path: string, body?: unknown, status = 200) => {
const response = await fetch(`${fixture.info.url}${path}`, {
@@ -82,12 +82,12 @@ it("saves, reads and clears the fluffy finish through the isolated HTTP routes",
}, 201);
expect(bot.mascotMaterial).toBe("fluffy");
const path = `/api/bots/${bot.id}`;
- for (const mascotMaterial of ["fluffy", null]) {
+ for (const mascotMaterial of ["matte", "metallic", "fluffy", null]) {
expect((await api("PATCH", path, { mascotMaterial })).bot.mascotMaterial).toBe(mascotMaterial);
const saved = JSON.parse(readFileSync(join(fixture.info.dataDir, "bots.json"), "utf8"));
expect(saved.find((value: { id: string }) => value.id === bot.id).mascotMaterial).toBe(mascotMaterial);
}
- expect((await api("PATCH", path, { mascotMaterial: "shaggy" }, 400)).error).toBe("mascotMaterial must be fluffy, or null");
+ expect((await api("PATCH", path, { mascotMaterial: "shaggy" }, 400)).error).toBe("mascotMaterial must be fluffy, matte, metallic, or null");
const after = (await api("GET", "/api/bots")).bots.find((value: { id: string }) => value.id === bot.id);
expect(after).toMatchObject({ color: "yellow", mascotBody: "blob", mascotMaterial: null });
} finally {
diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx
index 9c5aa31dbf..d2fc0c0a4f 100644
--- a/src/components/Avatar.tsx
+++ b/src/components/Avatar.tsx
@@ -108,7 +108,7 @@ export type MausAvatarProps = {
faceColor?: MascotFaceColor | null;
/** A custom `#rrggbb` body colour; it wins over `color` for the body only. */
bodyColor?: string | null;
- /** Fluffy fur on a body the engine draws (the shapes and objects); the cursor and festival bodies stay flat. */
+ /** The finish (matte, metallic or fluffy fur) of a body the engine draws (the shapes and objects); the cursor and festival bodies stay flat. */
material?: MascotMaterial | null;
/** Whose face this is; a decorative mascot has none. */
kind?: AvatarKind;
diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.ts
index e7a82467d5..c0852a20c4 100644
--- a/src/components/BotSettingsDialog.simple.test.ts
+++ b/src/components/BotSettingsDialog.simple.test.ts
@@ -604,7 +604,7 @@ describe("the avatar editor", () => {
expect(patch).toHaveBeenLastCalledWith({ mascotFaceColor: "white" });
});
- it("offers Fluffy only on an engine-drawn body, and Flat clears it", () => {
+ it("offers the finishes only on an engine-drawn body, and Flat clears one", () => {
const fur = (bot: Bot) => {
const props = ofType(editor(bot), MascotMaterialPicker)!.props as Parameters<typeof MascotMaterialPicker>[0];
return capture(() => MascotMaterialPicker(props));
@@ -618,10 +618,12 @@ describe("the avatar editor", () => {
const choices = segment(bare, "data-avatar-material");
expect(choices.value).toBe("off");
expect(choices.options.map((option) => [option.value, option.label])).toEqual([
- ["off", "Flat"], ["fluffy", "Fluffy"],
+ ["off", "Flat"], ["matte", "Matte"], ["metallic", "Metallic"], ["fluffy", "Fluffy"],
]);
- choices.onChange("fluffy");
- expect(patch).toHaveBeenLastCalledWith({ mascotMaterial: "fluffy" });
+ for (const finish of ["matte", "metallic", "fluffy"]) {
+ choices.onChange(finish);
+ expect(patch).toHaveBeenLastCalledWith({ mascotMaterial: finish });
+ }
fresh();
const furred = segment(fur(makeBot({ mascotBody: "obj-mug", mascotMaterial: "fluffy" })), "data-avatar-material");
expect(furred.value).toBe("fluffy");
diff --git a/src/components/MascotMaterialPicker.tsx b/src/components/MascotMaterialPicker.tsx
index 89dbfd9802..e839cc0ea9 100644
--- a/src/components/MascotMaterialPicker.tsx
+++ b/src/components/MascotMaterialPicker.tsx
@@ -1,11 +1,13 @@
import { t } from "@/lib/i18n";
import type { Bot } from "@/state/store";
-import { MASCOT_MATERIALS } from "../../shared/bot-avatar";
+import type { MascotMaterial } from "../../shared/bot-avatar";
import { engineBody } from "../../shared/object-bodies";
import type { AvatarPatch } from "./avatar-editing";
import { Segmented } from "./bot-panel/rows";
-/** Flat or fluffy for the engine-drawn bodies; the cursor and festival bodies are always flat, so the row hides for them. */
+const FINISHES: readonly ("off" | MascotMaterial)[] = ["off", "matte", "metallic", "fluffy"];
+
+/** The finish of the engine-drawn bodies; the cursor and festival bodies are always flat, so the row hides for them. */
export function MascotMaterialPicker({ bot, disabled, onPatch }: {
bot: Bot;
disabled: boolean;
@@ -20,7 +22,7 @@ export function MascotMaterialPicker({ bot, disabled, onPatch }: {
label={t("botIdentity.material")}
value={bot.mascotMaterial ?? "off"}
onChange={(value) => onPatch({ mascotMaterial: value === "off" ? null : value })}
- options={(["off", ...MASCOT_MATERIALS] as const).map((value) => ({ value, label: t(`botIdentity.material.${value}`), disabled }))}
+ options={FINISHES.map((value) => ({ value, label: t(`botIdentity.material.${value}`), disabled }))}
/>
</div>
);
diff --git a/src/locales/en.json b/src/locales/en.json
index 83749429f1..ca90ed24f5 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7631,6 +7631,8 @@
"botIdentity.faceColor.default": "Body default",
"botIdentity.material": "Finish",
"botIdentity.material.off": "Flat",
+ "botIdentity.material.matte": "Matte",
+ "botIdentity.material.metallic": "Metallic",
"botIdentity.material.fluffy": "Fluffy",
"botIdentity.avatar": "Avatar",
"botIdentity.resetMascot": "Reset mascot",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 9211f00498..31382274a2 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -7248,6 +7248,8 @@
"botIdentity.faceColor.default": "Padrão do corpo",
"botIdentity.material": "Acabamento",
"botIdentity.material.off": "Liso",
+ "botIdentity.material.matte": "Fosco",
+ "botIdentity.material.metallic": "Metálico",
"botIdentity.material.fluffy": "Fofo",
"botIdentity.avatar": "Avatar",
"botIdentity.resetMascot": "Redefinir mascote",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index c33b862fe6..857bbbf366 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -38826,6 +38826,8 @@
"engines.antigravity.switchCliNote": "c3620dd7b9fa6e9ad0f8d387837001b723af2fa83720a1a0e8ce6e9e52695b04",
"botIdentity.material": "a6c7a84baa6750fce33f7512acd6793e53def1d228b5f2efb8074b42648424fc",
"botIdentity.material.off": "9285cedcf26a7cbb5277c70b4651a54679ee9d2c89767bc9dbe532b14f4bb697",
+ "botIdentity.material.matte": "07d8eb6678c99a1d6cf84e00fe48e236992ca330aef0d7352ffa75c3d8dcebb8",
+ "botIdentity.material.metallic": "5d08f304a03e1fedc20358f8f233e38a0dd68652286fa116c44d598ec56593cd",
"botIdentity.material.fluffy": "66443efe6ecf5853e9fc80b2250986d9606b07f1d15b1a0a1d5bd1eeeed7a153",
"brief.card.openOutlook": "cf6cc1b38c3aee050f5b0345fc9346723a6f0f81c39afb370af6403ca8902fa0",
"palette.commands": "b269dc4e81a528a4d42e9e74101923514a626f55f8dd76b1461e0690e72d041a",