🆙 Fix Effects (enable)

This commit is contained in:
DuckieTM
2026-02-07 11:25:38 +01:00
parent 4225dbdd90
commit 9c43cb240e
5 changed files with 384 additions and 15 deletions
@@ -885,7 +885,7 @@ export class RoomPlane implements IRoomPlane
const visibleAvatarIds = new Set<number>();
const addReflectionSprite = (texture: Texture, location: IVector3D, alpha: number): boolean => {
if(!texture || !location || alpha < 0) return false;
if(!texture?.source || !location || alpha < 0) return false;
const relative = Vector3d.dif(location, this._location);
const planeDistance = Math.abs(Vector3d.scalarProjection(relative, this._normal));
@@ -922,7 +922,7 @@ export class RoomPlane implements IRoomPlane
for(const avatar of avatars)
{
if(!avatar?.texture || !avatar.location) continue;
if(!avatar?.texture?.source || !avatar.location) continue;
let firstSeenAt = this._windowReflectionFirstSeenAt.get(avatar.id);
@@ -955,6 +955,14 @@ export class RoomPlane implements IRoomPlane
{
if(visibleAvatarIds.has(id) || this._windowReflectionFadeOut.has(id)) continue;
if(!lastVisible.texture?.source)
{
this._windowReflectionLastVisible.delete(id);
this._windowReflectionFirstSeenAt.delete(id);
continue;
}
this._windowReflectionFadeOut.set(id, {
texture: lastVisible.texture,
location: lastVisible.location,
@@ -409,7 +409,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
const texture = sprite.texture;
const baseTexture = texture && texture.source;
if(!texture || !baseTexture) continue;
if(!texture || !baseTexture || baseTexture.destroyed) continue;
const spriteX = ((x + sprite.offsetX) + this._screenOffsetX);
const spriteY = ((y + sprite.offsetY) + this._screenOffsetY);
@@ -29,7 +29,7 @@ export class ExtendedSprite extends Sprite
public setTexture(texture: Texture): void
{
if(!texture) texture = Texture.EMPTY;
if(!texture || texture.source?.destroyed) texture = Texture.EMPTY;
if(texture === this.texture) return;