diff --git a/src/core/asset/AssetManager.ts b/src/core/asset/AssetManager.ts index e97f8651..57dec196 100644 --- a/src/core/asset/AssetManager.ts +++ b/src/core/asset/AssetManager.ts @@ -82,6 +82,8 @@ export class AssetManager extends Disposable implements IAssetManager { if(!data) return null; + console.log(data); + const collection = new GraphicAssetCollection(data, spritesheet); if(collection) diff --git a/src/core/asset/interfaces/IAssetData.ts b/src/core/asset/interfaces/IAssetData.ts index df67309f..ff4524c8 100644 --- a/src/core/asset/interfaces/IAssetData.ts +++ b/src/core/asset/interfaces/IAssetData.ts @@ -1,11 +1,9 @@ import { IAssetAnimation } from './animation'; import { IAsset } from './IAsset'; import { IAssetAlias } from './IAssetAlias'; -import { IAssetDimension } from './IAssetDimension'; import { IAssetPalette } from './IAssetPalette'; -import { IPlanetSystem } from './IPlanetSystem'; -import { IParticleSystem } from './particlesystem'; -import { ISpritesheet } from './spritesheet'; +import { IAssetLogicData } from './logic'; +import { ISpritesheetData } from './spritesheet'; import { IAssetVisualizationData } from './visualization'; export interface IAssetData { @@ -13,15 +11,8 @@ export interface IAssetData { name?: string; visualizationType?: string; logicType?: string; - maskType?: string; - credits?: string; - soundSample?: { id?: number, noPitch?: boolean }; - action?: { link?: string, startState?: number }; - planetSystems?: IPlanetSystem[]; - particleSystems?: IParticleSystem[]; - spritesheet?: ISpritesheet; - dimensions?: IAssetDimension; - directions?: number[]; + spritesheet?: ISpritesheetData; + logic?: IAssetLogicData; assets?: { [index: string]: IAsset }; aliases?: { [index: string]: IAssetAlias }; animations?: { [index: string]: IAssetAnimation }; diff --git a/src/core/asset/interfaces/index.ts b/src/core/asset/interfaces/index.ts index 88559df8..3d5fabbc 100644 --- a/src/core/asset/interfaces/index.ts +++ b/src/core/asset/interfaces/index.ts @@ -2,8 +2,7 @@ export * from './animation'; export * from './IAsset'; export * from './IAssetAlias'; export * from './IAssetData'; -export * from './IAssetDimension'; export * from './IAssetPalette'; -export * from './IPlanetSystem'; +export * from './logic'; export * from './spritesheet'; export * from './visualization'; diff --git a/src/core/asset/interfaces/logic/IAssetLogicCustomVars.ts b/src/core/asset/interfaces/logic/IAssetLogicCustomVars.ts new file mode 100644 index 00000000..1ebd4a86 --- /dev/null +++ b/src/core/asset/interfaces/logic/IAssetLogicCustomVars.ts @@ -0,0 +1,4 @@ +export interface ICustomVars +{ + variables?: string[]; +} diff --git a/src/core/asset/interfaces/logic/IAssetLogicData.ts b/src/core/asset/interfaces/logic/IAssetLogicData.ts new file mode 100644 index 00000000..acf484c9 --- /dev/null +++ b/src/core/asset/interfaces/logic/IAssetLogicData.ts @@ -0,0 +1,17 @@ +import { ICustomVars } from './IAssetLogicCustomVars'; +import { IAssetLogicPlanetSystem } from './IAssetLogicPlanetSystem'; +import { ISoundSample } from './ISoundSample'; +import { IAssetLogicModel } from './model/IAssetLogicModel'; +import { IParticleSystem } from './particlesystem'; + +export interface IAssetLogicData +{ + model?: IAssetLogicModel; + maskType?: string; + credits?: string; + soundSample?: ISoundSample; + action?: { link?: string, startState?: number }; + planetSystems?: IAssetLogicPlanetSystem[]; + particleSystems?: IParticleSystem[]; + customVars?: ICustomVars; +} diff --git a/src/core/asset/interfaces/IPlanetSystem.ts b/src/core/asset/interfaces/logic/IAssetLogicPlanetSystem.ts similarity index 80% rename from src/core/asset/interfaces/IPlanetSystem.ts rename to src/core/asset/interfaces/logic/IAssetLogicPlanetSystem.ts index 16acf871..47521bc6 100644 --- a/src/core/asset/interfaces/IPlanetSystem.ts +++ b/src/core/asset/interfaces/logic/IAssetLogicPlanetSystem.ts @@ -1,4 +1,4 @@ -export interface IPlanetSystem +export interface IAssetLogicPlanetSystem { id?: number; name?: string; diff --git a/src/core/asset/interfaces/logic/ISoundSample.ts b/src/core/asset/interfaces/logic/ISoundSample.ts new file mode 100644 index 00000000..003f9f62 --- /dev/null +++ b/src/core/asset/interfaces/logic/ISoundSample.ts @@ -0,0 +1,5 @@ +export interface ISoundSample +{ + id?: number; + noPitch?: boolean; +} diff --git a/src/core/asset/interfaces/logic/index.ts b/src/core/asset/interfaces/logic/index.ts new file mode 100644 index 00000000..569907b3 --- /dev/null +++ b/src/core/asset/interfaces/logic/index.ts @@ -0,0 +1,6 @@ +export * from './IAssetLogicCustomVars'; +export * from './IAssetLogicData'; +export * from './IAssetLogicPlanetSystem'; +export * from './ISoundSample'; +export * from './model'; +export * from './particlesystem'; diff --git a/src/core/asset/interfaces/IAssetDimension.ts b/src/core/asset/interfaces/logic/model/IAssetDimension.ts similarity index 100% rename from src/core/asset/interfaces/IAssetDimension.ts rename to src/core/asset/interfaces/logic/model/IAssetDimension.ts diff --git a/src/core/asset/interfaces/logic/model/IAssetLogicModel.ts b/src/core/asset/interfaces/logic/model/IAssetLogicModel.ts new file mode 100644 index 00000000..eef3245d --- /dev/null +++ b/src/core/asset/interfaces/logic/model/IAssetLogicModel.ts @@ -0,0 +1,7 @@ +import { IAssetDimension } from './IAssetDimension'; + +export interface IAssetLogicModel +{ + dimensions?: IAssetDimension; + directions?: number[]; +} diff --git a/src/core/asset/interfaces/logic/model/index.ts b/src/core/asset/interfaces/logic/model/index.ts new file mode 100644 index 00000000..4d08a724 --- /dev/null +++ b/src/core/asset/interfaces/logic/model/index.ts @@ -0,0 +1,2 @@ +export * from './IAssetDimension'; +export * from './IAssetLogicModel'; diff --git a/src/core/asset/interfaces/particlesystem/IParticleSystem.ts b/src/core/asset/interfaces/logic/particlesystem/IParticleSystem.ts similarity index 100% rename from src/core/asset/interfaces/particlesystem/IParticleSystem.ts rename to src/core/asset/interfaces/logic/particlesystem/IParticleSystem.ts diff --git a/src/core/asset/interfaces/particlesystem/IParticleSystemEmitter.ts b/src/core/asset/interfaces/logic/particlesystem/IParticleSystemEmitter.ts similarity index 100% rename from src/core/asset/interfaces/particlesystem/IParticleSystemEmitter.ts rename to src/core/asset/interfaces/logic/particlesystem/IParticleSystemEmitter.ts diff --git a/src/core/asset/interfaces/particlesystem/IParticleSystemParticle.ts b/src/core/asset/interfaces/logic/particlesystem/IParticleSystemParticle.ts similarity index 100% rename from src/core/asset/interfaces/particlesystem/IParticleSystemParticle.ts rename to src/core/asset/interfaces/logic/particlesystem/IParticleSystemParticle.ts diff --git a/src/core/asset/interfaces/particlesystem/IParticleSystemSimulation.ts b/src/core/asset/interfaces/logic/particlesystem/IParticleSystemSimulation.ts similarity index 100% rename from src/core/asset/interfaces/particlesystem/IParticleSystemSimulation.ts rename to src/core/asset/interfaces/logic/particlesystem/IParticleSystemSimulation.ts diff --git a/src/core/asset/interfaces/particlesystem/index.ts b/src/core/asset/interfaces/logic/particlesystem/index.ts similarity index 100% rename from src/core/asset/interfaces/particlesystem/index.ts rename to src/core/asset/interfaces/logic/particlesystem/index.ts diff --git a/src/core/asset/interfaces/spritesheet/ISpritesheet.ts b/src/core/asset/interfaces/spritesheet/ISpritesheet.ts deleted file mode 100644 index ff1900a8..00000000 --- a/src/core/asset/interfaces/spritesheet/ISpritesheet.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ISpritesheetData } from '@pixi/spritesheet'; -import { ISpritesheetMeta } from './ISpritesheetMeta'; - -export interface ISpritesheet extends ISpritesheetData -{ - meta: ISpritesheetMeta; -} diff --git a/src/core/asset/interfaces/spritesheet/ISpritesheetData.ts b/src/core/asset/interfaces/spritesheet/ISpritesheetData.ts new file mode 100644 index 00000000..28589583 --- /dev/null +++ b/src/core/asset/interfaces/spritesheet/ISpritesheetData.ts @@ -0,0 +1,7 @@ +import { ISpritesheetData as PixiSpritesheet } from '@pixi/spritesheet'; +import { ISpritesheetMeta } from './ISpritesheetMeta'; + +export interface ISpritesheetData extends PixiSpritesheet +{ + meta: ISpritesheetMeta; +} diff --git a/src/core/asset/interfaces/spritesheet/ISpritesheetFrame.ts b/src/core/asset/interfaces/spritesheet/ISpritesheetFrame.ts new file mode 100644 index 00000000..0833b502 --- /dev/null +++ b/src/core/asset/interfaces/spritesheet/ISpritesheetFrame.ts @@ -0,0 +1,25 @@ +export interface ISpritesheetFrame +{ + frame: { + x: number; + y: number; + w: number; + h: number; + }; + rotated: boolean; + trimmed: boolean; + spriteSourceSize: { + x: number; + y: number; + w: number; + h: number; + }; + sourceSize: { + w: number; + h: number; + }; + pivot: { + x: number; + y: number; + }; +} diff --git a/src/core/asset/interfaces/spritesheet/index.ts b/src/core/asset/interfaces/spritesheet/index.ts index e3f8d384..9c94e8ba 100644 --- a/src/core/asset/interfaces/spritesheet/index.ts +++ b/src/core/asset/interfaces/spritesheet/index.ts @@ -1,2 +1,3 @@ -export * from './ISpritesheet'; +export * from './ISpritesheetData'; +export * from './ISpritesheetFrame'; export * from './ISpritesheetMeta'; diff --git a/src/core/asset/interfaces/visualization/IAssetVisualizationData.ts b/src/core/asset/interfaces/visualization/IAssetVisualizationData.ts index e0a2d1de..e17ecdc6 100644 --- a/src/core/asset/interfaces/visualization/IAssetVisualizationData.ts +++ b/src/core/asset/interfaces/visualization/IAssetVisualizationData.ts @@ -14,6 +14,7 @@ export interface IAssetVisualizationData colors?: { [index: string]: IAssetColor }; directions?: { [index: string]: IAssetVisualizationDirection }; animations?: { [index: string]: IAssetVisualAnimation }; - postures?: { [index: string]: IAssetPosture }; - gestures?: { [index: string]: IAssetGesture }; + defaultPosture?: string; + postures?: { defaultPosture?: string, postures?: IAssetPosture[] }; + gestures?: IAssetGesture[]; } diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index 428edbc4..1c7afee8 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -342,6 +342,8 @@ export class RoomContentLoader implements IFurnitureDataListener const collection = new GraphicAssetCollection(data, spritesheet); + console.log(data); + this._collections.set(collection.name, collection); const petIndex = this._pets[collection.name]; @@ -409,7 +411,7 @@ export class RoomContentLoader implements IFurnitureDataListener if(type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT; - if(type === 'tile_cursor' || type === 'selection_arrow') return RoomObjectCategory.CURSOR; + if((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR; return RoomObjectCategory.MINIMUM; } @@ -722,17 +724,17 @@ export class RoomContentLoader implements IFurnitureDataListener switch(type) { case RoomContentLoader.PLACE_HOLDER: - return [ this.getAssetUrlWithRoomBase('place_holder') ]; + return [ this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER) ]; case RoomContentLoader.PLACE_HOLDER_WALL: - return [ this.getAssetUrlWithRoomBase('place_holder_wall') ]; + return [ this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER_WALL) ]; case RoomContentLoader.PLACE_HOLDER_PET: - return [ this.getAssetUrlWithRoomBase('place_holder_pet') ]; + return [ this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER_PET) ]; case RoomContentLoader.ROOM: - return [ this.getAssetUrlWithRoomBase('room') ]; + return [ this.getAssetUrlWithGenericBase('room') ]; case RoomContentLoader.TILE_CURSOR: - return [ this.getAssetUrlWithRoomBase('tile_cursor') ]; + return [ this.getAssetUrlWithGenericBase(RoomContentLoader.TILE_CURSOR) ]; case RoomContentLoader.SELECTION_ARROW: - return [ this.getAssetUrlWithRoomBase('selection_arrow') ]; + return [ this.getAssetUrlWithGenericBase(RoomContentLoader.SELECTION_ARROW) ]; default: { const category = this.getCategoryForType(type); @@ -788,9 +790,9 @@ export class RoomContentLoader implements IFurnitureDataListener return null; } - private getAssetUrlWithRoomBase(assetName: string): string + private getAssetUrlWithGenericBase(assetName: string): string { - return (Nitro.instance.getConfiguration('room.asset.url').replace(/%libname%/gi, assetName)); + return (Nitro.instance.getConfiguration('generic.asset.url').replace(/%libname%/gi, assetName)); } public getAssetUrlWithFurniBase(assetName: string): string diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index f56b1111..f094984a 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -523,7 +523,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato } instance.createRoomObjectAndInitalize(RoomEngine.CURSOR_OBJECT_ID, RoomEngine.CURSOR_OBJECT_TYPE, RoomObjectCategory.CURSOR); - //instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR); + instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR); return instance; } diff --git a/src/nitro/room/object/RoomObjectVariable.ts b/src/nitro/room/object/RoomObjectVariable.ts index 72c475e0..be68b29a 100644 --- a/src/nitro/room/object/RoomObjectVariable.ts +++ b/src/nitro/room/object/RoomObjectVariable.ts @@ -34,6 +34,7 @@ export class RoomObjectVariable public static FIGURE_GUIDE_STATUS: string = 'figure_guide_status'; public static FIGURE_EXPRESSION: string = 'figure_expression'; public static HEAD_DIRECTION: string = 'head_direction'; + public static FURNITURE_CUSTOM_VARIABLES: string = 'furniture_custom_variables'; public static FURNITURE_AUTOMATIC_STATE_INDEX: string = 'furniture_automatic_state_index'; public static FURNITURE_ALWAYS_STACKABLE: string = 'furniture_always_stackable'; public static FURNITURE_DISABLE_PICKING_ANIMATION: string = 'furniture_disable_picking_animation'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts index 2fc654ee..7f9613b1 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts @@ -20,7 +20,10 @@ export class FurnitureCreditLogic extends FurnitureLogic let creditValue = 0; - if(asset.credits && (asset.credits !== '') && (asset.credits.length > 0)) creditValue = parseInt(asset.credits); + if(asset.logic) + { + if(asset.logic.credits && (asset.logic.credits !== '') && (asset.logic.credits.length > 0)) creditValue = parseInt(asset.logic.credits); + } this.object.model.setValue(RoomObjectVariable.FURNITURE_CREDIT_VALUE, creditValue); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts index 0795392d..3360fef8 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts @@ -30,9 +30,12 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic { super.initialize(asset); - if(asset.action) + if(asset.logic) { - if(asset.action.startState === 1) this._showStateOnceRendered = true; + if(asset.logic.action) + { + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; + } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts index 8ac4e204..580074cf 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts @@ -18,11 +18,14 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic { super.initialize(asset); - if(asset.action) + if(asset.logic) { - if(asset.action.link && (asset.action.link !== '') && (asset.action.link.length > 0)) + if(asset.logic.action) { - (this.object && this.object.model && this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.action.link)); + if(asset.logic.action.link && (asset.logic.action.link !== '') && (asset.logic.action.link.length > 0)) + { + (this.object && this.object.model && this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link)); + } } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts index 4d06306a..91ceb15b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts @@ -15,7 +15,10 @@ export class FurnitureExternalImageLogic extends FurnitureMultiStateLogic { let maskType = ''; - if(asset.maskType && (asset.maskType !== '') && (asset.maskType.length > 0)) maskType = asset.maskType; + if(asset.logic) + { + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + } this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 0); this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE, maskType); diff --git a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts index dbb8f3a0..458624cf 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts @@ -1,5 +1,4 @@ -import { IAssetData } from '../../../../../core'; -import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem'; +import { IAssetData, IParticleSystem } from '../../../../../core'; import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; @@ -21,9 +20,12 @@ export class FurnitureFireworksLogic extends FurnitureLogic { super.initialize(asset); - if(asset.particleSystems && asset.particleSystems.length) + if(asset.logic) { - this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.particleSystems); + if(asset.logic.particleSystems && asset.logic.particleSystems.length) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); + } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts index fd0fffda..ef9529dc 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts @@ -24,11 +24,14 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic { super.initialize(asset); - if(asset.action) + if(asset.logic) { - this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.action.link); + if(asset.logic.action) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link); - if(asset.action.startState === 1) this._showStateOnceRendered = true; + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; + } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts index fad7b2b3..bdd6b79c 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts @@ -99,28 +99,42 @@ export class FurnitureLogic extends MovingObjectLogic if(!model) return; - const dimensions = asset.dimensions; - - if(!dimensions) return; - - this._sizeX = dimensions.x; - this._sizeY = dimensions.y; - this._sizeZ = dimensions.z; - - this._centerX = (this._sizeX / 2); - this._centerY = (this._sizeY / 2); - this._centerZ = (this._sizeZ / 2); - - const directions = asset.directions; - - if(directions && directions.length) + if(asset.logic) { - for(const direction of directions) this._directions.push(direction); - - this._directions.sort((a, b) => + if(asset.logic.model) { - return a - b; - }); + const dimensions = asset.logic.model.dimensions; + + if(dimensions) + { + this._sizeX = dimensions.x; + this._sizeY = dimensions.y; + this._sizeZ = dimensions.z; + + this._centerX = (this._sizeX / 2); + this._centerY = (this._sizeY / 2); + this._centerZ = (this._sizeZ / 2); + } + + const directions = asset.logic.model.directions; + + if(directions && directions.length) + { + for(const direction of directions) this._directions.push(direction); + + this._directions.sort(); + } + } + + if(asset.logic.customVars) + { + const variables = asset.logic.customVars.variables; + + if(variables && variables.length) + { + model.setValue(RoomObjectVariable.FURNITURE_CUSTOM_VARIABLES, variables); + } + } } model.setValue(RoomObjectVariable.FURNITURE_SIZE_X, this._sizeX); diff --git a/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts index bb44309d..56d97ff7 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts @@ -1,4 +1,4 @@ -import { IAssetData, IPlanetSystem } from '../../../../../core/asset/interfaces'; +import { IAssetData, IAssetLogicPlanetSystem } from '../../../../../core/asset/interfaces'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureLogic } from './FurnitureLogic'; @@ -8,9 +8,12 @@ export class FurniturePlanetSystemLogic extends FurnitureLogic { super.initialize(asset); - if(asset.planetSystems) + if(asset.logic) { - this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA, asset.planetSystems); + if(asset.logic.planetSystems) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA, asset.logic.planetSystems); + } } } } diff --git a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts index 9c7e6c89..4e0ed98f 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts @@ -1,5 +1,4 @@ -import { IAssetData } from '../../../../../core/asset/interfaces'; -import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem'; +import { IAssetData, IParticleSystem } from '../../../../../core/asset/interfaces'; import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; @@ -33,9 +32,12 @@ export class FurniturePresentLogic extends FurnitureLogic { super.initialize(asset); - if(asset.particleSystems && asset.particleSystems.length) + if(asset.logic) { - this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.particleSystems); + if(asset.logic.particleSystems && asset.logic.particleSystems.length) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); + } } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts index 0e405657..d60f4c7c 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts @@ -32,10 +32,14 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic { super.initialize(asset); - if(!asset.soundSample) return; - - this._sampleId = asset.soundSample.id; - this._noPitch = asset.soundSample.noPitch; + if(asset.logic) + { + if(asset.logic.soundSample) + { + this._sampleId = asset.logic.soundSample.id; + this._noPitch = asset.logic.soundSample.noPitch; + } + } this.object.model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, 1); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts index 093fdfbc..84d3d9d6 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts @@ -10,9 +10,12 @@ export class FurnitureWindowLogic extends FurnitureMultiStateLogic let maskType = ''; - if(asset.maskType && (asset.maskType !== '') && (asset.maskType.length > 0)) maskType = asset.maskType; + if(asset.logic) + { + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + } this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 0); this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE, maskType); } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/pet/PetLogic.ts b/src/nitro/room/object/logic/pet/PetLogic.ts index a2bb2452..dd073460 100644 --- a/src/nitro/room/object/logic/pet/PetLogic.ts +++ b/src/nitro/room/object/logic/pet/PetLogic.ts @@ -64,16 +64,19 @@ export class PetLogic extends MovingObjectLogic if(!model) return; - const directions = asset.directions; - - if(directions && directions.length) + if(asset.logic) { - for(const direction of directions) this._directions.push(direction); - - this._directions.sort((a, b) => + if(asset.logic.model) { - return a - b; - }); + const directions = asset.logic.model.directions; + + if(directions && directions.length) + { + for(const direction of directions) this._directions.push(direction); + + this._directions.sort(); + } + } } model.setValue(RoomObjectVariable.PET_ALLOWED_DIRECTIONS, this._directions); diff --git a/src/nitro/room/object/visualization/data/PetSizeData.ts b/src/nitro/room/object/visualization/data/PetSizeData.ts index 48ac9436..31e357fb 100644 --- a/src/nitro/room/object/visualization/data/PetSizeData.ts +++ b/src/nitro/room/object/visualization/data/PetSizeData.ts @@ -18,38 +18,32 @@ export class PetSizeData extends AnimationSizeData this._defaultPosture = null; } - public processPostures(postures: { [index: string]: IAssetPosture }): boolean + public processPostures(postures: { defaultPosture?: string, postures: IAssetPosture[] }): boolean { if(!postures) return false; - for(const key in postures) - { - const posture = postures[key]; + if(postures.defaultPosture && postures.defaultPosture.length) this._defaultPosture = postures.defaultPosture; - if(!posture) continue; + // for(const posture of postures.postures) + // { + // if(this._posturesToAnimations.get(posture.id)) continue; - if(this._posturesToAnimations.get(posture.id)) continue; + // if(this._defaultPosture === null) this._defaultPosture = posture.id; - if(this._defaultPosture === null) this._defaultPosture = posture.id; - - this._posturesToAnimations.set(posture.id, posture.animationId); - } + // this._posturesToAnimations.set(posture.id, posture.animationId); + // } if(this._posturesToAnimations.get(this._defaultPosture) === undefined) return false; return true; } - public processGestures(gestures: { [index: string]: IAssetGesture }): boolean + public processGestures(gestures: IAssetGesture[]): boolean { if(!gestures) return false; - for(const key in gestures) + for(const gesture of gestures) { - const gesture = gestures[key]; - - if(!gesture) continue; - if(this._gesturesToAnimations.get(gesture.id)) continue; this._gesturesToAnimations.set(gesture.id, gesture.animationId); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts index 366a352b..6cfa9257 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts @@ -1,5 +1,4 @@ -import { AdvancedMap, NitroLogger } from '../../../../../core'; -import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem'; +import { AdvancedMap, IParticleSystem, NitroLogger } from '../../../../../core'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; import { FurnitureParticleSystem } from './FurnitureParticleSystem'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 36fe3eba..302029da 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -2,8 +2,7 @@ import { RenderTexture, Texture } from '@pixi/core'; import { AlphaFilter } from '@pixi/filter-alpha'; import { Graphics } from '@pixi/graphics'; import { Matrix } from '@pixi/math'; -import { AdvancedMap, NitroPoint, NitroSprite } from '../../../../../core'; -import { IParticleSystem } from '../../../../../core/asset/interfaces/particlesystem'; +import { AdvancedMap, IParticleSystem, NitroPoint, NitroSprite } from '../../../../../core'; import { IGraphicAsset, IRoomObjectSprite } from '../../../../../room'; import { Vector3D } from '../../../../avatar'; import { Nitro } from '../../../../Nitro'; diff --git a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts index d312f3cb..3753defd 100644 --- a/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts @@ -1,4 +1,4 @@ -import { IPlanetSystem } from '../../../../../core'; +import { IAssetLogicPlanetSystem } from '../../../../../core'; import { Vector3d } from '../../../../../room'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; @@ -86,7 +86,7 @@ export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisuali { if(!this.object || !this.object.model) return; - const planetSystems = this.object.model.getValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA); + const planetSystems = this.object.model.getValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA); if(!planetSystems) return false;