Display a default skin on remote player entity

This commit is contained in:
Alexis Faizeau 2021-11-24 15:43:01 +01:00
parent 24640d13bb
commit 5c3036e18b
2 changed files with 9 additions and 7 deletions

View file

@ -128,6 +128,10 @@ export abstract class Character extends Container {
} }
public addTextures(textures: string[], frame?: string | number): void { public addTextures(textures: string[], frame?: string | number): void {
if (textures.length < 1) {
throw new TextureError("no texture given");
}
for (const texture of textures) { for (const texture of textures) {
if (this.scene && !this.scene.textures.exists(texture)) { if (this.scene && !this.scene.textures.exists(texture)) {
throw new TextureError("texture not found"); throw new TextureError("texture not found");

View file

@ -69,13 +69,11 @@ export const lazyLoadPlayerCharacterTextures = (
} }
//If the loading fail, we render the default model instead. //If the loading fail, we render the default model instead.
return returnPromise return returnPromise.then((keys) =>
.then((keys) => keys.map((key) => {
keys.map((key) => { return typeof key !== "string" ? key.name : key;
return typeof key !== "string" ? key.name : key; })
}) );
)
.catch(() => lazyLoadPlayerCharacterTextures(loadPlugin, ["color_22", "eyes_23"]));
}; };
export const getRessourceDescriptor = ( export const getRessourceDescriptor = (