feat: add private profile media and realtime contracts
This commit is contained in:
@@ -23,6 +23,8 @@ export interface ActorProfile {
|
||||
skinTone?: string;
|
||||
primaryColor?: string;
|
||||
accentColor?: string;
|
||||
hairColor?: string;
|
||||
bodyShape?: "slim" | "average" | "broad";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -202,6 +204,8 @@ function copyProfile(profile: ActorProfile): ActorProfile {
|
||||
...(profile.appearance.skinTone === undefined ? {} : { skinTone: profile.appearance.skinTone }),
|
||||
...(profile.appearance.primaryColor === undefined ? {} : { primaryColor: profile.appearance.primaryColor }),
|
||||
...(profile.appearance.accentColor === undefined ? {} : { accentColor: profile.appearance.accentColor }),
|
||||
...(profile.appearance.hairColor === undefined ? {} : { hairColor: profile.appearance.hairColor }),
|
||||
...(profile.appearance.bodyShape === undefined ? {} : { bodyShape: profile.appearance.bodyShape }),
|
||||
}
|
||||
: undefined;
|
||||
return {
|
||||
@@ -227,10 +231,17 @@ function checkedIdentity(identity: ActorIdentity): Readonly<ActorIdentity> {
|
||||
profile.appearance?.skinTone,
|
||||
profile.appearance?.primaryColor,
|
||||
profile.appearance?.accentColor,
|
||||
profile.appearance?.hairColor,
|
||||
];
|
||||
if (strings.some((item) => item !== undefined && typeof item !== "string")) {
|
||||
throw new RangeError("actor profile fields must be strings");
|
||||
}
|
||||
if (
|
||||
profile.appearance?.bodyShape !== undefined &&
|
||||
profile.appearance.bodyShape !== "slim" &&
|
||||
profile.appearance.bodyShape !== "average" &&
|
||||
profile.appearance.bodyShape !== "broad"
|
||||
) throw new RangeError("actor body shape is invalid");
|
||||
const copy: ActorIdentity = {
|
||||
id: identity.id,
|
||||
displayName: identity.displayName,
|
||||
|
||||
@@ -124,6 +124,8 @@ function buildActor(kind: ActorKind, identity: Readonly<ActorIdentity>): RiggedA
|
||||
...(color(appearance?.skinTone) === undefined ? {} : { skinTone: color(appearance?.skinTone) }),
|
||||
...(color(appearance?.primaryColor) === undefined ? {} : { outfitColor: color(appearance?.primaryColor) }),
|
||||
...(color(appearance?.accentColor) === undefined ? {} : { accentColor: color(appearance?.accentColor) }),
|
||||
...(color(appearance?.hairColor) === undefined ? {} : { hairColor: color(appearance?.hairColor) }),
|
||||
...(appearance?.bodyShape === undefined ? {} : { bodyShape: appearance.bodyShape }),
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user