Rework avatars.

Now we have a concept of an avatar at the server, realm, and scene level
and we have the groundwork for a realm store. New uesrs no longer props,
they get a default avatar. New system supports gender
{male,female,neutral} and {child,adult}.
This commit is contained in:
Evan Carroll 2026-01-22 21:04:27 -06:00
parent e4abdb183f
commit 6fb90e42c3
55 changed files with 7392 additions and 512 deletions

View file

@ -24,6 +24,11 @@ CREATE TABLE auth.users (
bio TEXT,
avatar_url public.url,
-- User preferences for default avatar selection
birthday DATE,
gender_preference auth.gender_preference NOT NULL DEFAULT 'gender_neutral',
age_category auth.age_category NOT NULL DEFAULT 'adult',
reputation_tier server.reputation_tier NOT NULL DEFAULT 'member',
reputation_promoted_at TIMESTAMPTZ,
@ -634,9 +639,13 @@ CREATE INDEX idx_auth_avatars_default ON auth.avatars (user_id, is_default) WHER
CREATE TABLE auth.active_avatars (
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
realm_id UUID NOT NULL, -- FK added in 030_realm.sql after realm.realms exists
avatar_id UUID NOT NULL REFERENCES auth.avatars(id) ON DELETE CASCADE,
avatar_id UUID REFERENCES auth.avatars(id) ON DELETE SET NULL,
current_emotion SMALLINT NOT NULL DEFAULT 0 CHECK (current_emotion >= 0 AND current_emotion <= 11),
-- User-selected avatars from avatar stores (lower priority than custom avatar)
selected_server_avatar_id UUID, -- FK added in 025_server_avatars.sql
selected_realm_avatar_id UUID, -- FK added in 035_realm_avatars.sql
current_emotion server.emotion_state NOT NULL DEFAULT 'happy',
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
@ -644,6 +653,12 @@ CREATE TABLE auth.active_avatars (
);
COMMENT ON TABLE auth.active_avatars IS 'Current avatar per user per realm';
COMMENT ON COLUMN auth.active_avatars.avatar_id IS
'User custom avatar (highest priority, nullable for users without custom avatars)';
COMMENT ON COLUMN auth.active_avatars.selected_server_avatar_id IS
'User-selected server avatar (from avatar store), lower priority than custom avatar';
COMMENT ON COLUMN auth.active_avatars.selected_realm_avatar_id IS
'User-selected realm avatar (from avatar store), higher priority than server selection';
-- =============================================================================
-- Server-Level Moderation: IP Bans