From cfa1b6a6abd290ce4b085c9b37d9c5f1acfe857f Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 12 Aug 2021 00:10:27 -0400 Subject: [PATCH] Fix present logic --- .../logic/furniture/FurniturePresentLogic.ts | 6 +++- .../furniture/FurnitureParticleSystem.ts | 36 +++++-------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts index 571a5472..9c7e6c89 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts @@ -1,4 +1,5 @@ import { IAssetData } from '../../../../../core/asset/interfaces'; +import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem'; import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; @@ -32,7 +33,10 @@ export class FurniturePresentLogic extends FurnitureLogic { super.initialize(asset); - // particle system etc + if(asset.particleSystems && asset.particleSystems.length) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.particleSystems); + } } public processUpdateMessage(message: RoomObjectUpdateMessage): void diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 91e47c58..03365713 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -119,9 +119,9 @@ export class FurnitureParticleSystem if(!this._emptySprite) { - this._emptySprite = new NitroSprite(Texture.WHITE); + this._emptySprite = new NitroSprite(Texture.EMPTY); - this._emptySprite.tint = this._bgColor; + this._emptySprite.alpha = 0; } this._centerX = -(this._roomSprite.offsetX); @@ -183,25 +183,10 @@ export class FurnitureParticleSystem if(!this._canvasTexture) this.updateCanvas(); - if(this._blackOverlayAlphaTransform.alpha === 1) - { - this._emptySprite.filters = null; - - Nitro.instance.renderer.render(this._emptySprite, { - renderTexture: this._canvasTexture, - clear: true - }); - } - else - { - this._emptySprite.filters = [ this._blackOverlayAlphaTransform ]; - - Nitro.instance.renderer.render(this._emptySprite, { - renderTexture: this._canvasTexture, - transform: this._identityMatrix, - clear: true - }); - } + Nitro.instance.renderer.render(this._emptySprite, { + renderTexture: this._canvasTexture, + clear: true + }); for(const particle of this._currentEmitter.particles) { @@ -209,16 +194,14 @@ export class FurnitureParticleSystem const ty = ((this._centerY - offsetY) + ((((particle.y + ((particle.x + particle.z) / 2)) * k) / 10) * this._scaleMultiplier)); const asset = particle.getAsset(); - if(asset) + if(asset && asset.texture) { - const texture = asset.texture; - if(particle.fade && (particle.alphaMultiplier < 1)) { this._translationMatrix.identity(); this._translationMatrix.translate((tx + asset.offsetX), (ty + asset.offsetY)); - const sprite = new NitroSprite(texture); + const sprite = new NitroSprite(asset.texture); this._particleColorTransform.alpha = particle.alphaMultiplier; @@ -233,8 +216,7 @@ export class FurnitureParticleSystem else { const point = new NitroPoint((tx + asset.offsetX), (ty + asset.offsetY)); - - const sprite = new NitroSprite(texture); + const sprite = new NitroSprite(asset.texture); sprite.x = point.x; sprite.y = point.y;