diff --git a/src/api/IAdvancedMap.ts b/src/api/IAdvancedMap.ts new file mode 100644 index 00000000..6d310969 --- /dev/null +++ b/src/api/IAdvancedMap.ts @@ -0,0 +1,22 @@ +import { IDisposable } from './common'; + +export interface IAdvancedMap extends IDisposable +{ + dispose(): void; + reset(): void; + unshift(key: T, value: U): boolean; + add(key: T, value: U): boolean; + remove(key: T): U; + getWithIndex(index: number): U; + getKey(index: number): T; + getKeys(): T[]; + hasKey(key: T): boolean; + getValue(key: T): U; + getValues(): U[]; + hasValue(value: U): boolean; + indexOf(value: U): number; + concatenate(newValues: IAdvancedMap): void; + clone(): IAdvancedMap; + readonly length: number; + readonly disposed: boolean +} diff --git a/src/api/index.ts b/src/api/index.ts index 34916288..8e7a78c9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -13,4 +13,12 @@ export * from './common'; export * from './communication'; export * from './communication/enums'; export * from './configuration'; +export * from './IAdvancedMap'; export * from './INitroCore'; +export * from './nitro'; +export * from './room'; +export * from './room/object'; +export * from './room/object/enum'; +export * from './room/object/logic'; +export * from './room/object/visualization'; +export * from './room/renderer'; diff --git a/src/api/nitro/IRoomContentLoader.ts b/src/api/nitro/IRoomContentLoader.ts new file mode 100644 index 00000000..31cc7ff3 --- /dev/null +++ b/src/api/nitro/IRoomContentLoader.ts @@ -0,0 +1,13 @@ +import { IGraphicAssetCollection } from '../asset'; +import { IEventDispatcher } from '../common'; +import { IRoomObject } from '../room'; + +export interface IRoomContentLoader +{ + dispose: () => void; + downloadAsset(type: string, events: IEventDispatcher): void; + isLoaderType(type: string): boolean; + getCollection(name: string): IGraphicAssetCollection; + getPlaceholderName(type: string): string; + setRoomObjectRoomId(object: IRoomObject, roomId: string): void; +} diff --git a/src/api/nitro/index.ts b/src/api/nitro/index.ts new file mode 100644 index 00000000..14699223 --- /dev/null +++ b/src/api/nitro/index.ts @@ -0,0 +1 @@ +export * from './IRoomContentLoader'; diff --git a/src/room/utils/IRoomGeometry.ts b/src/api/room/IRoomGeometry.ts similarity index 100% rename from src/room/utils/IRoomGeometry.ts rename to src/api/room/IRoomGeometry.ts diff --git a/src/room/IRoomInstance.ts b/src/api/room/IRoomInstance.ts similarity index 83% rename from src/room/IRoomInstance.ts rename to src/api/room/IRoomInstance.ts index 4a77e8d7..838096b5 100644 --- a/src/room/IRoomInstance.ts +++ b/src/api/room/IRoomInstance.ts @@ -1,9 +1,8 @@ -import { IDisposable } from '../api'; +import { IDisposable } from '../../api'; import { IRoomInstanceContainer } from './IRoomInstanceContainer'; import { IRoomObjectManager } from './IRoomObjectManager'; -import { IRoomObject } from './object/IRoomObject'; -import { IRoomObjectModel } from './object/IRoomObjectModel'; -import { IRoomRendererBase } from './renderer/IRoomRendererBase'; +import { IRoomObject, IRoomObjectModel } from './object'; +import { IRoomRendererBase } from './renderer'; export interface IRoomInstance extends IDisposable { diff --git a/src/room/IRoomInstanceContainer.ts b/src/api/room/IRoomInstanceContainer.ts similarity index 84% rename from src/room/IRoomInstanceContainer.ts rename to src/api/room/IRoomInstanceContainer.ts index 02233653..efe51846 100644 --- a/src/room/IRoomInstanceContainer.ts +++ b/src/api/room/IRoomInstanceContainer.ts @@ -1,8 +1,8 @@ import { IRoomObjectManager } from './IRoomObjectManager'; -import { IRoomObject } from './object/IRoomObject'; +import { IRoomObject } from './object'; export interface IRoomInstanceContainer { createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; createRoomObjectManager(category: number): IRoomObjectManager; -} \ No newline at end of file +} diff --git a/src/room/IRoomManager.ts b/src/api/room/IRoomManager.ts similarity index 71% rename from src/room/IRoomManager.ts rename to src/api/room/IRoomManager.ts index 5e9f6e47..44c6b4a5 100644 --- a/src/room/IRoomManager.ts +++ b/src/api/room/IRoomManager.ts @@ -1,7 +1,7 @@ -import { IEventDispatcher, INitroManager } from '../api'; -import { RoomContentLoader } from '../nitro/room/RoomContentLoader'; +import { IEventDispatcher, INitroManager } from '../common'; +import { IRoomContentLoader } from '../nitro'; import { IRoomInstance } from './IRoomInstance'; -import { IRoomObject } from './object/IRoomObject'; +import { IRoomObject } from './object'; export interface IRoomManager extends INitroManager { @@ -11,7 +11,7 @@ export interface IRoomManager extends INitroManager addUpdateCategory(category: number): void; removeUpdateCategory(category: number): void; createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; - setContentLoader(loader: RoomContentLoader): void; + setContentLoader(loader: IRoomContentLoader): void; update(time: number, update?: boolean): void; rooms: Map; events: IEventDispatcher; diff --git a/src/room/IRoomManagerListener.ts b/src/api/room/IRoomManagerListener.ts similarity index 100% rename from src/room/IRoomManagerListener.ts rename to src/api/room/IRoomManagerListener.ts diff --git a/src/room/IRoomObjectManager.ts b/src/api/room/IRoomObjectManager.ts similarity index 67% rename from src/room/IRoomObjectManager.ts rename to src/api/room/IRoomObjectManager.ts index 7df3cf19..c47cd173 100644 --- a/src/room/IRoomObjectManager.ts +++ b/src/api/room/IRoomObjectManager.ts @@ -1,5 +1,5 @@ -import { AdvancedMap } from '../core'; -import { IRoomObjectController } from './object/IRoomObjectController'; +import { IAdvancedMap } from '../IAdvancedMap'; +import { IRoomObjectController } from './object'; export interface IRoomObjectManager { @@ -9,6 +9,6 @@ export interface IRoomObjectManager createObject(id: number, stateCount: number, type: string): IRoomObjectController; removeObject(id: number): void; removeAllObjects(): void; - objects: AdvancedMap; + objects: IAdvancedMap; totalObjects: number; } diff --git a/src/api/room/IRoomObjectUpdateMessage.ts b/src/api/room/IRoomObjectUpdateMessage.ts new file mode 100644 index 00000000..5b04a528 --- /dev/null +++ b/src/api/room/IRoomObjectUpdateMessage.ts @@ -0,0 +1,7 @@ +import { IVector3D } from './IVector3D'; + +export interface IRoomObjectUpdateMessage +{ + readonly location: IVector3D; + readonly direction: IVector3D; +} diff --git a/src/api/room/IRoomSpriteMouseEvent.ts b/src/api/room/IRoomSpriteMouseEvent.ts new file mode 100644 index 00000000..c942d6c6 --- /dev/null +++ b/src/api/room/IRoomSpriteMouseEvent.ts @@ -0,0 +1,17 @@ +export interface IRoomSpriteMouseEvent +{ + readonly type: string; + readonly eventId: string; + readonly canvasId: string; + readonly spriteTag: string; + readonly screenX: number; + readonly screenY: number; + readonly localX: number; + readonly localY: number; + readonly ctrlKey: boolean; + readonly altKey: boolean; + readonly shiftKey: boolean; + readonly buttonDown: boolean; + spriteOffsetX: number; + spriteOffsetY: number; +} diff --git a/src/api/room/IVector3D.ts b/src/api/room/IVector3D.ts new file mode 100644 index 00000000..9214be46 --- /dev/null +++ b/src/api/room/IVector3D.ts @@ -0,0 +1,10 @@ +export interface IVector3D +{ + assign(vector: IVector3D): void; + add(vector: IVector3D): void; + subtract(vector: IVector3D): void; + x: number; + y: number; + z: number; + length: number; +} diff --git a/src/room/data/RoomObjectSpriteData.ts b/src/api/room/RoomObjectSpriteData.ts similarity index 100% rename from src/room/data/RoomObjectSpriteData.ts rename to src/api/room/RoomObjectSpriteData.ts diff --git a/src/api/room/index.ts b/src/api/room/index.ts new file mode 100644 index 00000000..2193aba8 --- /dev/null +++ b/src/api/room/index.ts @@ -0,0 +1,15 @@ +export * from './IRoomGeometry'; +export * from './IRoomInstance'; +export * from './IRoomInstanceContainer'; +export * from './IRoomManager'; +export * from './IRoomManagerListener'; +export * from './IRoomObjectManager'; +export * from './IRoomObjectUpdateMessage'; +export * from './IRoomSpriteMouseEvent'; +export * from './IVector3D'; +export * from './object'; +export * from './object/enum'; +export * from './object/logic'; +export * from './object/visualization'; +export * from './renderer'; +export * from './RoomObjectSpriteData'; diff --git a/src/room/object/IRoomObject.ts b/src/api/room/object/IRoomObject.ts similarity index 65% rename from src/room/object/IRoomObject.ts rename to src/api/room/object/IRoomObject.ts index 42e088f4..0dca2521 100644 --- a/src/room/object/IRoomObject.ts +++ b/src/api/room/object/IRoomObject.ts @@ -1,8 +1,8 @@ -import { IDisposable } from '../../api'; -import { IVector3D } from '../utils/IVector3D'; +import { IDisposable } from '../../common'; +import { IVector3D } from '../IVector3D'; import { IRoomObjectModel } from './IRoomObjectModel'; -import { IRoomObjectMouseHandler } from './logic/IRoomObjectMouseHandler'; -import { IRoomObjectVisualization } from './visualization/IRoomObjectVisualization'; +import { IRoomObjectMouseHandler } from './logic'; +import { IRoomObjectVisualization } from './visualization'; export interface IRoomObject extends IDisposable { diff --git a/src/room/object/IRoomObjectController.ts b/src/api/room/object/IRoomObjectController.ts similarity index 63% rename from src/room/object/IRoomObjectController.ts rename to src/api/room/object/IRoomObjectController.ts index 6e4a7e94..9a66d4fe 100644 --- a/src/room/object/IRoomObjectController.ts +++ b/src/api/room/object/IRoomObjectController.ts @@ -1,8 +1,8 @@ -import { RoomObjectUpdateMessage } from '../messages/RoomObjectUpdateMessage'; -import { IVector3D } from '../utils/IVector3D'; +import { IRoomObjectUpdateMessage } from '../IRoomObjectUpdateMessage'; +import { IVector3D } from '../IVector3D'; import { IRoomObject } from './IRoomObject'; -import { IRoomObjectEventHandler } from './logic/IRoomObjectEventHandler'; -import { IRoomObjectGraphicVisualization } from './visualization/IRoomObjectGraphicVisualization'; +import { IRoomObjectEventHandler } from './logic'; +import { IRoomObjectGraphicVisualization } from './visualization'; export interface IRoomObjectController extends IRoomObject { @@ -11,8 +11,8 @@ export interface IRoomObjectController extends IRoomObject setState(state: number, index?: number): boolean; setVisualization(visualization: IRoomObjectGraphicVisualization): void; setLogic(logic: IRoomObjectEventHandler): void; - processUpdateMessage(message: RoomObjectUpdateMessage): void; + processUpdateMessage(message: IRoomObjectUpdateMessage): void; tearDown(): void; isReady: boolean; logic: IRoomObjectEventHandler; -} \ No newline at end of file +} diff --git a/src/room/object/IRoomObjectModel.ts b/src/api/room/object/IRoomObjectModel.ts similarity index 100% rename from src/room/object/IRoomObjectModel.ts rename to src/api/room/object/IRoomObjectModel.ts diff --git a/src/room/object/IRoomObjectModelController.ts b/src/api/room/object/IRoomObjectModelController.ts similarity index 73% rename from src/room/object/IRoomObjectModelController.ts rename to src/api/room/object/IRoomObjectModelController.ts index b4823b1e..7a27d498 100644 --- a/src/room/object/IRoomObjectModelController.ts +++ b/src/api/room/object/IRoomObjectModelController.ts @@ -1,4 +1,4 @@ -import { AdvancedMap } from '../../core'; +import { IAdvancedMap } from '../../IAdvancedMap'; import { IRoomObjectModel } from './IRoomObjectModel'; export interface IRoomObjectModelController extends IRoomObjectModel @@ -7,5 +7,5 @@ export interface IRoomObjectModelController extends IRoomObjectModel setString(_arg_1: string, _arg_2: string, _arg_3: boolean): void; setNumberArray(_arg_1: string, _arg_2: [], _arg_3: boolean): void; setStringArray(_arg_1: string, _arg_2: [], _arg_3: boolean): void; - setStringToStringMap(_arg_1: string, _arg_2: AdvancedMap, _arg_3: boolean): void; + setStringToStringMap(_arg_1: string, _arg_2: IAdvancedMap, _arg_3: boolean): void; } diff --git a/src/room/object/enum/AlphaTolerance.ts b/src/api/room/object/enum/AlphaTolerance.ts similarity index 100% rename from src/room/object/enum/AlphaTolerance.ts rename to src/api/room/object/enum/AlphaTolerance.ts diff --git a/src/room/object/enum/RoomObjectSpriteType.ts b/src/api/room/object/enum/RoomObjectSpriteType.ts similarity index 100% rename from src/room/object/enum/RoomObjectSpriteType.ts rename to src/api/room/object/enum/RoomObjectSpriteType.ts diff --git a/src/room/object/enum/index.ts b/src/api/room/object/enum/index.ts similarity index 100% rename from src/room/object/enum/index.ts rename to src/api/room/object/enum/index.ts diff --git a/src/api/room/object/index.ts b/src/api/room/object/index.ts new file mode 100644 index 00000000..7d028ebc --- /dev/null +++ b/src/api/room/object/index.ts @@ -0,0 +1,7 @@ +export * from './enum'; +export * from './IRoomObject'; +export * from './IRoomObjectController'; +export * from './IRoomObjectModel'; +export * from './IRoomObjectModelController'; +export * from './logic'; +export * from './visualization'; diff --git a/src/room/object/logic/IRoomObjectEventHandler.ts b/src/api/room/object/logic/IRoomObjectEventHandler.ts similarity index 72% rename from src/room/object/logic/IRoomObjectEventHandler.ts rename to src/api/room/object/logic/IRoomObjectEventHandler.ts index 7feee3cc..26e17edb 100644 --- a/src/room/object/logic/IRoomObjectEventHandler.ts +++ b/src/api/room/object/logic/IRoomObjectEventHandler.ts @@ -1,5 +1,5 @@ -import { IDisposable, IEventDispatcher } from '../../../api'; -import { RoomObjectUpdateMessage } from '../../messages/RoomObjectUpdateMessage'; +import { IDisposable, IEventDispatcher } from '../../../common'; +import { IRoomObjectUpdateMessage } from '../../IRoomObjectUpdateMessage'; import { IRoomObjectController } from '../IRoomObjectController'; import { IRoomObjectMouseHandler } from './IRoomObjectMouseHandler'; @@ -7,7 +7,7 @@ export interface IRoomObjectEventHandler extends IRoomObjectMouseHandler, IDispo { initialize(data: unknown): void; update(totalTimeRunning: number): void; - processUpdateMessage(message: RoomObjectUpdateMessage): void; + processUpdateMessage(message: IRoomObjectUpdateMessage): void; getEventTypes(): string[]; useObject(): void; setObject(object: IRoomObjectController): void; diff --git a/src/room/object/logic/IRoomObjectLogicFactory.ts b/src/api/room/object/logic/IRoomObjectLogicFactory.ts similarity index 84% rename from src/room/object/logic/IRoomObjectLogicFactory.ts rename to src/api/room/object/logic/IRoomObjectLogicFactory.ts index f3314a9d..142b5198 100644 --- a/src/room/object/logic/IRoomObjectLogicFactory.ts +++ b/src/api/room/object/logic/IRoomObjectLogicFactory.ts @@ -1,4 +1,4 @@ -import { IEventDispatcher } from '../../../api'; +import { IEventDispatcher } from '../../../common'; import { IRoomObjectEventHandler } from './IRoomObjectEventHandler'; export interface IRoomObjectLogicFactory diff --git a/src/api/room/object/logic/IRoomObjectMouseHandler.ts b/src/api/room/object/logic/IRoomObjectMouseHandler.ts new file mode 100644 index 00000000..4240c568 --- /dev/null +++ b/src/api/room/object/logic/IRoomObjectMouseHandler.ts @@ -0,0 +1,7 @@ +import { IRoomGeometry } from '../../IRoomGeometry'; +import { IRoomSpriteMouseEvent } from '../../IRoomSpriteMouseEvent'; + +export interface IRoomObjectMouseHandler +{ + mouseEvent(event: IRoomSpriteMouseEvent, geometry: IRoomGeometry): void; +} diff --git a/src/api/room/object/logic/index.ts b/src/api/room/object/logic/index.ts new file mode 100644 index 00000000..5892efe2 --- /dev/null +++ b/src/api/room/object/logic/index.ts @@ -0,0 +1,3 @@ +export * from './IRoomObjectEventHandler'; +export * from './IRoomObjectLogicFactory'; +export * from './IRoomObjectMouseHandler'; diff --git a/src/room/object/visualization/IPlaneDrawingData.ts b/src/api/room/object/visualization/IPlaneDrawingData.ts similarity index 100% rename from src/room/object/visualization/IPlaneDrawingData.ts rename to src/api/room/object/visualization/IPlaneDrawingData.ts diff --git a/src/room/object/visualization/IPlaneVisualization.ts b/src/api/room/object/visualization/IPlaneVisualization.ts similarity index 100% rename from src/room/object/visualization/IPlaneVisualization.ts rename to src/api/room/object/visualization/IPlaneVisualization.ts diff --git a/src/room/object/visualization/IRoomObjectGraphicVisualization.ts b/src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts similarity index 76% rename from src/room/object/visualization/IRoomObjectGraphicVisualization.ts rename to src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts index 58a37fc0..8fb20d26 100644 --- a/src/room/object/visualization/IRoomObjectGraphicVisualization.ts +++ b/src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts @@ -1,4 +1,4 @@ -import { IGraphicAssetCollection } from '../../../api'; +import { IGraphicAssetCollection } from '../../../asset'; import { IRoomObjectVisualization } from './IRoomObjectVisualization'; export interface IRoomObjectGraphicVisualization extends IRoomObjectVisualization diff --git a/src/room/object/visualization/IRoomObjectSprite.ts b/src/api/room/object/visualization/IRoomObjectSprite.ts similarity index 100% rename from src/room/object/visualization/IRoomObjectSprite.ts rename to src/api/room/object/visualization/IRoomObjectSprite.ts diff --git a/src/room/object/visualization/IRoomObjectSpriteVisualization.ts b/src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts similarity index 85% rename from src/room/object/visualization/IRoomObjectSpriteVisualization.ts rename to src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts index b30acde9..e3dd4cdf 100644 --- a/src/room/object/visualization/IRoomObjectSpriteVisualization.ts +++ b/src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts @@ -1,4 +1,4 @@ -import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData'; +import { RoomObjectSpriteData } from '../../RoomObjectSpriteData'; import { IRoomObjectGraphicVisualization } from './IRoomObjectGraphicVisualization'; import { IRoomObjectSprite } from './IRoomObjectSprite'; @@ -9,4 +9,4 @@ export interface IRoomObjectSpriteVisualization extends IRoomObjectGraphicVisual sprites: IRoomObjectSprite[]; updateObjectCounter: number; updateModelCounter: number; -} \ No newline at end of file +} diff --git a/src/room/object/visualization/IRoomObjectVisualization.ts b/src/api/room/object/visualization/IRoomObjectVisualization.ts similarity index 91% rename from src/room/object/visualization/IRoomObjectVisualization.ts rename to src/api/room/object/visualization/IRoomObjectVisualization.ts index e32eb675..445fb904 100644 --- a/src/room/object/visualization/IRoomObjectVisualization.ts +++ b/src/api/room/object/visualization/IRoomObjectVisualization.ts @@ -1,6 +1,6 @@ import { RenderTexture } from '@pixi/core'; import { Rectangle } from '@pixi/math'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; +import { IRoomGeometry } from '../../IRoomGeometry'; import { IRoomObject } from '../IRoomObject'; import { IObjectVisualizationData } from './IRoomObjectVisualizationData'; diff --git a/src/room/object/visualization/IRoomObjectVisualizationData.ts b/src/api/room/object/visualization/IRoomObjectVisualizationData.ts similarity index 71% rename from src/room/object/visualization/IRoomObjectVisualizationData.ts rename to src/api/room/object/visualization/IRoomObjectVisualizationData.ts index d442843b..43370299 100644 --- a/src/room/object/visualization/IRoomObjectVisualizationData.ts +++ b/src/api/room/object/visualization/IRoomObjectVisualizationData.ts @@ -1,4 +1,4 @@ -import { IAssetData } from '../../../api'; +import { IAssetData } from '../../../asset'; export interface IObjectVisualizationData { diff --git a/src/room/object/visualization/IRoomObjectVisualizationFactory.ts b/src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts similarity index 89% rename from src/room/object/visualization/IRoomObjectVisualizationFactory.ts rename to src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts index a088e65a..a28adae1 100644 --- a/src/room/object/visualization/IRoomObjectVisualizationFactory.ts +++ b/src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts @@ -1,4 +1,4 @@ -import { IAssetData } from '../../../api'; +import { IAssetData } from '../../../asset'; import { IRoomObjectGraphicVisualization } from './IRoomObjectGraphicVisualization'; import { IObjectVisualizationData } from './IRoomObjectVisualizationData'; diff --git a/src/api/room/object/visualization/IRoomPlane.ts b/src/api/room/object/visualization/IRoomPlane.ts new file mode 100644 index 00000000..8c008399 --- /dev/null +++ b/src/api/room/object/visualization/IRoomPlane.ts @@ -0,0 +1,13 @@ +import { IRoomGeometry } from '../../IRoomGeometry'; +import { IVector3D } from '../../IVector3D'; +import { IPlaneDrawingData } from './IPlaneDrawingData'; + +export interface IRoomPlane +{ + uniqueId: number; + location: IVector3D; + leftSide: IVector3D; + rightSide: IVector3D; + color: number; + getDrawingDatas(_arg_1: IRoomGeometry): IPlaneDrawingData[]; +} diff --git a/src/room/object/visualization/ISortableSprite.ts b/src/api/room/object/visualization/ISortableSprite.ts similarity index 100% rename from src/room/object/visualization/ISortableSprite.ts rename to src/api/room/object/visualization/ISortableSprite.ts diff --git a/src/api/room/object/visualization/index.ts b/src/api/room/object/visualization/index.ts new file mode 100644 index 00000000..681f37e5 --- /dev/null +++ b/src/api/room/object/visualization/index.ts @@ -0,0 +1,10 @@ +export * from './IPlaneDrawingData'; +export * from './IPlaneVisualization'; +export * from './IRoomObjectGraphicVisualization'; +export * from './IRoomObjectSprite'; +export * from './IRoomObjectSpriteVisualization'; +export * from './IRoomObjectVisualization'; +export * from './IRoomObjectVisualizationData'; +export * from './IRoomObjectVisualizationFactory'; +export * from './IRoomPlane'; +export * from './ISortableSprite'; diff --git a/src/api/room/renderer/IRoomCanvasMouseListener.ts b/src/api/room/renderer/IRoomCanvasMouseListener.ts new file mode 100644 index 00000000..bcd97ffd --- /dev/null +++ b/src/api/room/renderer/IRoomCanvasMouseListener.ts @@ -0,0 +1,8 @@ +import { IRoomGeometry } from '../IRoomGeometry'; +import { IRoomSpriteMouseEvent } from '../IRoomSpriteMouseEvent'; +import { IRoomObject } from '../object'; + +export interface IRoomCanvasMouseListener +{ + processRoomCanvasMouseEvent(event: IRoomSpriteMouseEvent, object: IRoomObject, geometry: IRoomGeometry): void +} diff --git a/src/room/renderer/IRoomRenderer.ts b/src/api/room/renderer/IRoomRenderer.ts similarity index 100% rename from src/room/renderer/IRoomRenderer.ts rename to src/api/room/renderer/IRoomRenderer.ts diff --git a/src/room/renderer/IRoomRendererBase.ts b/src/api/room/renderer/IRoomRendererBase.ts similarity index 79% rename from src/room/renderer/IRoomRendererBase.ts rename to src/api/room/renderer/IRoomRendererBase.ts index ca6d3685..2c007066 100644 --- a/src/room/renderer/IRoomRendererBase.ts +++ b/src/api/room/renderer/IRoomRendererBase.ts @@ -1,4 +1,4 @@ -import { IRoomObject } from '../object/IRoomObject'; +import { IRoomObject } from '../object'; export interface IRoomRendererBase { @@ -7,4 +7,4 @@ export interface IRoomRendererBase dispose(): void; reset(): void; update(time: number, update?: boolean): void; -} \ No newline at end of file +} diff --git a/src/room/renderer/IRoomRendererFactory.ts b/src/api/room/renderer/IRoomRendererFactory.ts similarity index 100% rename from src/room/renderer/IRoomRendererFactory.ts rename to src/api/room/renderer/IRoomRendererFactory.ts diff --git a/src/room/renderer/IRoomRenderingCanvas.ts b/src/api/room/renderer/IRoomRenderingCanvas.ts similarity index 84% rename from src/room/renderer/IRoomRenderingCanvas.ts rename to src/api/room/renderer/IRoomRenderingCanvas.ts index 3ac178f7..98888ce4 100644 --- a/src/room/renderer/IRoomRenderingCanvas.ts +++ b/src/api/room/renderer/IRoomRenderingCanvas.ts @@ -1,10 +1,10 @@ import { RenderTexture } from '@pixi/core'; import { DisplayObject } from '@pixi/display'; import { Point } from '@pixi/math'; -import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData'; -import { IRoomGeometry } from '../utils/IRoomGeometry'; +import { IRoomGeometry } from '../IRoomGeometry'; +import { ISortableSprite } from '../object'; +import { RoomObjectSpriteData } from '../RoomObjectSpriteData'; import { IRoomCanvasMouseListener } from './IRoomCanvasMouseListener'; -import { SortableSprite } from './utils/SortableSprite'; export interface IRoomRenderingCanvas { @@ -17,7 +17,7 @@ export interface IRoomRenderingCanvas setMouseListener(listener: IRoomCanvasMouseListener): void; skipSpriteVisibilityChecking(): void; resumeSpriteVisibilityChecking(): void; - getPlaneSortableSprites(): SortableSprite[]; + getPlaneSortableSprites(): ISortableSprite[]; handleMouseEvent(x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): boolean; getSortableSpriteList(): RoomObjectSpriteData[]; getDisplayAsTexture(): RenderTexture; diff --git a/src/room/renderer/IRoomSpriteCanvasContainer.ts b/src/api/room/renderer/IRoomSpriteCanvasContainer.ts similarity index 76% rename from src/room/renderer/IRoomSpriteCanvasContainer.ts rename to src/api/room/renderer/IRoomSpriteCanvasContainer.ts index f144b68c..be65859d 100644 --- a/src/room/renderer/IRoomSpriteCanvasContainer.ts +++ b/src/api/room/renderer/IRoomSpriteCanvasContainer.ts @@ -1,8 +1,8 @@ -import { IRoomObject } from '../object/IRoomObject'; +import { IRoomObject } from '../object'; export interface IRoomSpriteCanvasContainer { getRoomObject(instanceId: number): IRoomObject; objects: Map; roomObjectVariableAccurateZ: string; -} \ No newline at end of file +} diff --git a/src/api/room/renderer/index.ts b/src/api/room/renderer/index.ts new file mode 100644 index 00000000..8a236c0b --- /dev/null +++ b/src/api/room/renderer/index.ts @@ -0,0 +1,6 @@ +export * from './IRoomCanvasMouseListener'; +export * from './IRoomRenderer'; +export * from './IRoomRendererBase'; +export * from './IRoomRendererFactory'; +export * from './IRoomRenderingCanvas'; +export * from './IRoomSpriteCanvasContainer'; diff --git a/src/core/common/NitroEvent.ts b/src/core/common/NitroEvent.ts index a85eb43c..204f113a 100644 --- a/src/core/common/NitroEvent.ts +++ b/src/core/common/NitroEvent.ts @@ -1,4 +1,6 @@ -export class NitroEvent +import { INitroEvent } from '../../api'; + +export class NitroEvent implements INitroEvent { private _type: string; diff --git a/src/core/utils/AdvancedMap.ts b/src/core/utils/AdvancedMap.ts index 68a27e69..a5fee252 100644 --- a/src/core/utils/AdvancedMap.ts +++ b/src/core/utils/AdvancedMap.ts @@ -1,6 +1,6 @@ -import { IDisposable } from '../../api'; +import { IAdvancedMap } from '../../api'; -export class AdvancedMap implements IDisposable +export class AdvancedMap implements IAdvancedMap { private _length: number; private _dictionary: Map; @@ -148,7 +148,7 @@ export class AdvancedMap implements IDisposable for (const k of newValues._keys) this.add(k, newValues.getValue(k)); } - public clone(): AdvancedMap + public clone(): IAdvancedMap { const map = new AdvancedMap(); diff --git a/src/nitro/INitro.ts b/src/nitro/INitro.ts index 6a603af2..bed100ce 100644 --- a/src/nitro/INitro.ts +++ b/src/nitro/INitro.ts @@ -1,7 +1,6 @@ import { Application } from '@pixi/app'; import { Ticker } from '@pixi/ticker'; -import { IEventDispatcher, ILinkEventTracker, INitroCore, IWorkerEventTracker } from '../api'; -import { IRoomManager } from '../room/IRoomManager'; +import { IEventDispatcher, ILinkEventTracker, INitroCore, IRoomManager, IWorkerEventTracker } from '../api'; import { IAvatarRenderManager } from './avatar/IAvatarRenderManager'; import { IRoomCameraWidgetManager } from './camera/IRoomCameraWidgetManager'; import { INitroCommunicationManager } from './communication/INitroCommunicationManager'; diff --git a/src/nitro/Nitro.ts b/src/nitro/Nitro.ts index 4f0c7ec6..458a53ae 100644 --- a/src/nitro/Nitro.ts +++ b/src/nitro/Nitro.ts @@ -2,10 +2,9 @@ import { Application, IApplicationOptions } from '@pixi/app'; import { SCALE_MODES } from '@pixi/constants'; import { settings } from '@pixi/settings'; import { Ticker } from '@pixi/ticker'; -import { IEventDispatcher, ILinkEventTracker, INitroCore, IWorkerEventTracker } from '../api'; +import { IEventDispatcher, ILinkEventTracker, INitroCore, IRoomManager, IWorkerEventTracker } from '../api'; import { ConfigurationEvent, EventDispatcher, NitroCore, NitroEvent } from '../core'; import { PixiApplicationProxy } from '../pixi-proxy'; -import { IRoomManager } from '../room/IRoomManager'; import { RoomManager } from '../room/RoomManager'; import { AvatarRenderManager } from './avatar/AvatarRenderManager'; import { IAvatarRenderManager } from './avatar/IAvatarRenderManager'; diff --git a/src/nitro/avatar/cache/AvatarImageCache.ts b/src/nitro/avatar/cache/AvatarImageCache.ts index 5729badd..e4413f35 100644 --- a/src/nitro/avatar/cache/AvatarImageCache.ts +++ b/src/nitro/avatar/cache/AvatarImageCache.ts @@ -1,8 +1,7 @@ import { Texture } from '@pixi/core'; import { Matrix, Point, Rectangle } from '@pixi/math'; -import { NitroContainer, NitroSprite } from '../../../pixi-proxy'; -import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData'; -import { Nitro } from '../../Nitro'; +import { RoomObjectSpriteData } from '../../../api/room/RoomObjectSpriteData'; +import { NitroContainer, NitroSprite, PixiApplicationProxy } from '../../../pixi-proxy'; import { IActiveActionData } from '../actions/IActiveActionData'; import { AssetAliasCollection } from '../alias/AssetAliasCollection'; import { AvatarAnimationLayerData } from '../animation/AvatarAnimationLayerData'; @@ -87,7 +86,7 @@ export class AvatarImageCache public disposeInactiveActions(k: number = 60000): void { - const time = Nitro.instance.time; + const time = PixiApplicationProxy.instance.ticker.lastTime; if (this._cache) { diff --git a/src/nitro/room/IRoomCreator.ts b/src/nitro/room/IRoomCreator.ts index 490d664f..94f2cadc 100644 --- a/src/nitro/room/IRoomCreator.ts +++ b/src/nitro/room/IRoomCreator.ts @@ -1,6 +1,4 @@ -import { IRoomInstance } from '../../room/IRoomInstance'; -import { IRoomObjectController } from '../../room/object/IRoomObjectController'; -import { IVector3D } from '../../room/utils/IVector3D'; +import { IRoomInstance, IRoomObjectController, IVector3D } from '../../api'; import { IRoomSessionManager } from '../session/IRoomSessionManager'; import { ISessionDataManager } from '../session/ISessionDataManager'; import { IObjectData } from './object/data/IObjectData'; diff --git a/src/nitro/room/IRoomEngine.ts b/src/nitro/room/IRoomEngine.ts index dd604055..855de543 100644 --- a/src/nitro/room/IRoomEngine.ts +++ b/src/nitro/room/IRoomEngine.ts @@ -1,16 +1,8 @@ import { RenderTexture } from '@pixi/core'; import { DisplayObject } from '@pixi/display'; import { Point, Rectangle } from '@pixi/math'; -import { INitroManager } from '../../api'; -import { IRoomObject } from '../../room'; -import { IRoomManager } from '../../room/IRoomManager'; -import { IRoomObjectController } from '../../room/object/IRoomObjectController'; -import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory'; -import { IRoomObjectVisualizationFactory } from '../../room/object/visualization/IRoomObjectVisualizationFactory'; -import { IRoomRendererFactory } from '../../room/renderer/IRoomRendererFactory'; -import { IRoomRenderingCanvas } from '../../room/renderer/IRoomRenderingCanvas'; -import { IRoomGeometry } from '../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../room/utils/IVector3D'; +import { INitroManager, IRoomGeometry, IRoomManager, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRendererFactory, IRoomRenderingCanvas } from '../../api'; +import { IVector3D } from '../../api/room/IVector3D'; import { PetCustomPart } from '../avatar/pets/PetCustomPart'; import { IRoomSessionManager } from '../session/IRoomSessionManager'; import { ISessionDataManager } from '../session/ISessionDataManager'; diff --git a/src/nitro/room/IRoomEngineServices.ts b/src/nitro/room/IRoomEngineServices.ts index 598be025..d4c5290c 100644 --- a/src/nitro/room/IRoomEngineServices.ts +++ b/src/nitro/room/IRoomEngineServices.ts @@ -1,8 +1,4 @@ -import { IConnection, IEventDispatcher } from '../../api'; -import { IRoomInstance } from '../../room/IRoomInstance'; -import { IRoomObjectController } from '../../room/object/IRoomObjectController'; -import { IRoomRenderingCanvas } from '../../room/renderer/IRoomRenderingCanvas'; -import { IVector3D } from '../../room/utils/IVector3D'; +import { IConnection, IEventDispatcher, IRoomInstance, IRoomObjectController, IRoomRenderingCanvas, IVector3D } from '../../api'; import { IRoomSessionManager } from '../session/IRoomSessionManager'; import { ISessionDataManager } from '../session/ISessionDataManager'; import { IObjectData } from './object/data/IObjectData'; diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index f67f97a9..d187cb1f 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -1,10 +1,10 @@ import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Loader, LoaderResource } from '@pixi/loaders'; import { Spritesheet } from '@pixi/spritesheet'; -import { IAssetData, IEventDispatcher, IGraphicAssetCollection, INitroLogger } from '../../api'; +import { IAssetData, IEventDispatcher, IGraphicAssetCollection, INitroLogger, IRoomContentLoader } from '../../api'; +import { IRoomObject } from '../../api/room/object/IRoomObject'; import { GraphicAssetCollection, GraphicAssetGifCollection, NitroBundle, NitroEvent, NitroLogger } from '../../core'; import { RoomContentLoadedEvent } from '../../room/events/RoomContentLoadedEvent'; -import { IRoomObject } from '../../room/object/IRoomObject'; import { Nitro } from '../Nitro'; import { FurnitureType } from '../session/furniture/FurnitureType'; import { IFurnitureData } from '../session/furniture/IFurnitureData'; @@ -17,7 +17,7 @@ import { RoomObjectVariable } from './object/RoomObjectVariable'; import { RoomObjectVisualizationType } from './object/RoomObjectVisualizationType'; import { PetColorResult } from './PetColorResult'; -export class RoomContentLoader implements IFurnitureDataListener +export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLoader { private static PLACE_HOLDER: string = 'place_holder'; private static PLACE_HOLDER_WALL: string = 'place_holder_wall'; diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index 375c7e6b..0abcb7b5 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -1,30 +1,10 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Container, DisplayObject } from '@pixi/display'; import { Matrix, Point, Rectangle } from '@pixi/math'; -import { IConnection, IDisposable, IMessageComposer, IUpdateReceiver } from '../../api'; +import { IConnection, IDisposable, IMessageComposer, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IUpdateReceiver, IVector3D } from '../../api'; import { NitroEvent, NitroManager } from '../../core'; import { NitroSprite, TextureUtils } from '../../pixi-proxy'; -import { RoomObjectEvent } from '../../room/events/RoomObjectEvent'; -import { RoomObjectMouseEvent } from '../../room/events/RoomObjectMouseEvent'; -import { IRoomInstance } from '../../room/IRoomInstance'; -import { IRoomManager } from '../../room/IRoomManager'; -import { IRoomManagerListener } from '../../room/IRoomManagerListener'; -import { RoomObjectUpdateMessage } from '../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObject } from '../../room/object/IRoomObject'; -import { IRoomObjectController } from '../../room/object/IRoomObjectController'; -import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory'; -import { IRoomObjectVisualizationFactory } from '../../room/object/visualization/IRoomObjectVisualizationFactory'; -import { IRoomRenderer } from '../../room/renderer/IRoomRenderer'; -import { IRoomRendererFactory } from '../../room/renderer/IRoomRendererFactory'; -import { IRoomRenderingCanvas } from '../../room/renderer/IRoomRenderingCanvas'; -import { RoomRendererFactory } from '../../room/renderer/RoomRendererFactory'; -import { RoomInstance } from '../../room/RoomInstance'; -import { IRoomGeometry } from '../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../room/utils/IVector3D'; -import { NumberBank } from '../../room/utils/NumberBank'; -import { RoomEnterEffect } from '../../room/utils/RoomEnterEffect'; -import { RoomGeometry } from '../../room/utils/RoomGeometry'; -import { Vector3d } from '../../room/utils/Vector3d'; +import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomObjectEvent, RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomRendererFactory, Vector3d } from '../../room'; import { PetCustomPart } from '../avatar/pets/PetCustomPart'; import { PetFigureData } from '../avatar/pets/PetFigureData'; import { RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '../communication'; diff --git a/src/nitro/room/RoomMessageHandler.ts b/src/nitro/room/RoomMessageHandler.ts index cf42c529..2818760b 100644 --- a/src/nitro/room/RoomMessageHandler.ts +++ b/src/nitro/room/RoomMessageHandler.ts @@ -1,7 +1,6 @@ -import { IConnection } from '../../api'; +import { IConnection, IVector3D } from '../../api'; import { Disposable } from '../../core'; -import { IVector3D } from '../../room/utils/IVector3D'; -import { Vector3d } from '../../room/utils/Vector3d'; +import { Vector3d } from '../../room'; import { AvatarGuideStatus } from '../avatar/enum/AvatarGuideStatus'; import { PetType } from '../avatar/pets/PetType'; import { ObjectsDataUpdateEvent, PetExperienceEvent } from '../communication'; diff --git a/src/nitro/room/RoomObjectEventHandler.ts b/src/nitro/room/RoomObjectEventHandler.ts index db691077..2477544b 100644 --- a/src/nitro/room/RoomObjectEventHandler.ts +++ b/src/nitro/room/RoomObjectEventHandler.ts @@ -1,16 +1,10 @@ +import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectController, IVector3D } from '../../api'; import { Disposable, NitroLogger } from '../../core'; -import { RoomId } from '../../room'; +import { RoomEnterEffect, RoomId, Vector3d } from '../../room'; import { RoomObjectEvent } from '../../room/events/RoomObjectEvent'; import { RoomObjectMouseEvent } from '../../room/events/RoomObjectMouseEvent'; import { RoomSpriteMouseEvent } from '../../room/events/RoomSpriteMouseEvent'; import { RoomObjectUpdateMessage } from '../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObject } from '../../room/object/IRoomObject'; -import { IRoomObjectController } from '../../room/object/IRoomObjectController'; -import { IRoomCanvasMouseListener } from '../../room/renderer/IRoomCanvasMouseListener'; -import { IRoomGeometry } from '../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../room/utils/IVector3D'; -import { RoomEnterEffect } from '../../room/utils/RoomEnterEffect'; -import { Vector3d } from '../../room/utils/Vector3d'; import { FurnitureGroupInfoComposer, SetObjectDataMessageComposer } from '../communication'; import { GetResolutionAchievementsMessageComposer } from '../communication/messages/outgoing/game/GetResolutionAchievementsMessageComposer'; import { BotPlaceComposer } from '../communication/messages/outgoing/room/engine/BotPlaceComposer'; diff --git a/src/nitro/room/RoomObjectLogicFactory.ts b/src/nitro/room/RoomObjectLogicFactory.ts index 7651f746..07f2cdb8 100644 --- a/src/nitro/room/RoomObjectLogicFactory.ts +++ b/src/nitro/room/RoomObjectLogicFactory.ts @@ -1,7 +1,5 @@ -import { IEventDispatcher } from '../../api'; +import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory } from '../../api'; import { EventDispatcher, NitroLogger } from '../../core'; -import { IRoomObjectEventHandler } from '../../room/object/logic/IRoomObjectEventHandler'; -import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory'; import { RoomObjectLogicBase } from '../../room/object/logic/RoomObjectLogicBase'; import { FurnitureEcotronBoxLogic, FurnitureEffectBoxLogic, FurnitureGroupForumTerminalLogic, FurnitureHabboWheelLogic, FurnitureHweenLovelockLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureSongDiskLogic, FurnitureSoundMachineLogic, FurnitureWelcomeGiftLogic } from './object'; import { AvatarLogic } from './object/logic/avatar/AvatarLogic'; diff --git a/src/nitro/room/events/RoomObjectBadgeAssetEvent.ts b/src/nitro/room/events/RoomObjectBadgeAssetEvent.ts index 3025c765..cf840d70 100644 --- a/src/nitro/room/events/RoomObjectBadgeAssetEvent.ts +++ b/src/nitro/room/events/RoomObjectBadgeAssetEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectBadgeAssetEvent extends RoomObjectEvent { @@ -25,4 +25,4 @@ export class RoomObjectBadgeAssetEvent extends RoomObjectEvent { return this._groupBadge; } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectDataRequestEvent.ts b/src/nitro/room/events/RoomObjectDataRequestEvent.ts index f0b93b33..4d1e477a 100644 --- a/src/nitro/room/events/RoomObjectDataRequestEvent.ts +++ b/src/nitro/room/events/RoomObjectDataRequestEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectDataRequestEvent extends RoomObjectEvent { diff --git a/src/nitro/room/events/RoomObjectDimmerStateUpdateEvent.ts b/src/nitro/room/events/RoomObjectDimmerStateUpdateEvent.ts index c5bd72e1..b63579b4 100644 --- a/src/nitro/room/events/RoomObjectDimmerStateUpdateEvent.ts +++ b/src/nitro/room/events/RoomObjectDimmerStateUpdateEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; export class RoomObjectDimmerStateUpdateEvent extends RoomObjectEvent { diff --git a/src/nitro/room/events/RoomObjectFloorHoleEvent.ts b/src/nitro/room/events/RoomObjectFloorHoleEvent.ts index 43d25f7e..3fe5e087 100644 --- a/src/nitro/room/events/RoomObjectFloorHoleEvent.ts +++ b/src/nitro/room/events/RoomObjectFloorHoleEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectFloorHoleEvent extends RoomObjectEvent { @@ -10,4 +10,4 @@ export class RoomObjectFloorHoleEvent extends RoomObjectEvent { super(k, _arg_2); } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectHSLColorEnableEvent.ts b/src/nitro/room/events/RoomObjectHSLColorEnableEvent.ts index c2f42762..213ffed0 100644 --- a/src/nitro/room/events/RoomObjectHSLColorEnableEvent.ts +++ b/src/nitro/room/events/RoomObjectHSLColorEnableEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectHSLColorEnableEvent extends RoomObjectEvent { @@ -39,4 +39,4 @@ export class RoomObjectHSLColorEnableEvent extends RoomObjectEvent { return this._lightness; } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectMoveEvent.ts b/src/nitro/room/events/RoomObjectMoveEvent.ts index 4ed801db..86baf23b 100644 --- a/src/nitro/room/events/RoomObjectMoveEvent.ts +++ b/src/nitro/room/events/RoomObjectMoveEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectMoveEvent extends RoomObjectEvent { @@ -10,4 +10,4 @@ export class RoomObjectMoveEvent extends RoomObjectEvent { super(k, _arg_2); } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts b/src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts index b4d56a37..63953ffa 100644 --- a/src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts +++ b/src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts @@ -1,4 +1,4 @@ -import { IRoomObject } from '../../../room'; +import { IRoomObject } from '../../../api'; import { RoomObjectFurnitureActionEvent } from './RoomObjectFurnitureActionEvent'; export class RoomObjectPlaySoundIdEvent extends RoomObjectFurnitureActionEvent diff --git a/src/nitro/room/events/RoomObjectRoomAdEvent.ts b/src/nitro/room/events/RoomObjectRoomAdEvent.ts index 9f948933..5f26cdce 100644 --- a/src/nitro/room/events/RoomObjectRoomAdEvent.ts +++ b/src/nitro/room/events/RoomObjectRoomAdEvent.ts @@ -1,4 +1,5 @@ -import { IRoomObject, RoomObjectEvent } from '../../../room'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectRoomAdEvent extends RoomObjectEvent { diff --git a/src/nitro/room/events/RoomObjectSamplePlaybackEvent.ts b/src/nitro/room/events/RoomObjectSamplePlaybackEvent.ts index 13d9bb6a..1edbf6c6 100644 --- a/src/nitro/room/events/RoomObjectSamplePlaybackEvent.ts +++ b/src/nitro/room/events/RoomObjectSamplePlaybackEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectSamplePlaybackEvent extends RoomObjectEvent { diff --git a/src/nitro/room/events/RoomObjectStateChangedEvent.ts b/src/nitro/room/events/RoomObjectStateChangedEvent.ts index e6946ecc..7634d271 100644 --- a/src/nitro/room/events/RoomObjectStateChangedEvent.ts +++ b/src/nitro/room/events/RoomObjectStateChangedEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectStateChangedEvent extends RoomObjectEvent { @@ -19,4 +19,4 @@ export class RoomObjectStateChangedEvent extends RoomObjectEvent { return this._state; } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectTileMouseEvent.ts b/src/nitro/room/events/RoomObjectTileMouseEvent.ts index bdabf0a6..8b90aae1 100644 --- a/src/nitro/room/events/RoomObjectTileMouseEvent.ts +++ b/src/nitro/room/events/RoomObjectTileMouseEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectMouseEvent } from '../../../room/events/RoomObjectMouseEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectMouseEvent } from '../../../room/events/RoomObjectMouseEvent'; export class RoomObjectTileMouseEvent extends RoomObjectMouseEvent { diff --git a/src/nitro/room/events/RoomObjectWallMouseEvent.ts b/src/nitro/room/events/RoomObjectWallMouseEvent.ts index bcfe8438..6eccf8a8 100644 --- a/src/nitro/room/events/RoomObjectWallMouseEvent.ts +++ b/src/nitro/room/events/RoomObjectWallMouseEvent.ts @@ -1,7 +1,5 @@ -import { RoomObjectMouseEvent } from '../../../room/events/RoomObjectMouseEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IRoomObject, IVector3D } from '../../../api'; +import { RoomObjectMouseEvent, Vector3d } from '../../../room'; export class RoomObjectWallMouseEvent extends RoomObjectMouseEvent { @@ -58,4 +56,4 @@ export class RoomObjectWallMouseEvent extends RoomObjectMouseEvent { return this._direction; } -} \ No newline at end of file +} diff --git a/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts b/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts index e1e13db9..92dacf9a 100644 --- a/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts +++ b/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts @@ -1,5 +1,5 @@ -import { RoomObjectEvent } from '../../../room/events/RoomObjectEvent'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { RoomObjectEvent } from '../../../room'; export class RoomObjectWidgetRequestEvent extends RoomObjectEvent { diff --git a/src/nitro/room/events/RoomToObjectOwnAvatarMoveEvent.ts b/src/nitro/room/events/RoomToObjectOwnAvatarMoveEvent.ts index 5f5da18f..330104bf 100644 --- a/src/nitro/room/events/RoomToObjectOwnAvatarMoveEvent.ts +++ b/src/nitro/room/events/RoomToObjectOwnAvatarMoveEvent.ts @@ -1,5 +1,5 @@ -import { RoomToObjectEvent } from '../../../room/events/RoomToObjectEvent'; -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; +import { RoomToObjectEvent } from '../../../room'; export class RoomToObjectOwnAvatarMoveEvent extends RoomToObjectEvent { @@ -18,4 +18,4 @@ export class RoomToObjectOwnAvatarMoveEvent extends RoomToObjectEvent { return this._targetLocation; } -} \ No newline at end of file +} diff --git a/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts b/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts index 8144d91a..4a3b528a 100644 --- a/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts +++ b/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts @@ -1,4 +1,4 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; import { ObjectMoveUpdateMessage } from './ObjectMoveUpdateMessage'; export class ObjectAvatarUpdateMessage extends ObjectMoveUpdateMessage @@ -30,4 +30,4 @@ export class ObjectAvatarUpdateMessage extends ObjectMoveUpdateMessage { return this._baseY; } -} \ No newline at end of file +} diff --git a/src/nitro/room/messages/ObjectHeightUpdateMessage.ts b/src/nitro/room/messages/ObjectHeightUpdateMessage.ts index 46c8a1b8..756babbc 100644 --- a/src/nitro/room/messages/ObjectHeightUpdateMessage.ts +++ b/src/nitro/room/messages/ObjectHeightUpdateMessage.ts @@ -1,5 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../room/messages/RoomObjectUpdateMessage'; -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; export class ObjectHeightUpdateMessage extends RoomObjectUpdateMessage { @@ -16,4 +16,4 @@ export class ObjectHeightUpdateMessage extends RoomObjectUpdateMessage { return this._height; } -} \ No newline at end of file +} diff --git a/src/nitro/room/messages/ObjectMoveUpdateMessage.ts b/src/nitro/room/messages/ObjectMoveUpdateMessage.ts index 0315a685..0a614c31 100644 --- a/src/nitro/room/messages/ObjectMoveUpdateMessage.ts +++ b/src/nitro/room/messages/ObjectMoveUpdateMessage.ts @@ -1,5 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../room/messages/RoomObjectUpdateMessage'; -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; export class ObjectMoveUpdateMessage extends RoomObjectUpdateMessage { @@ -16,7 +16,7 @@ export class ObjectMoveUpdateMessage extends RoomObjectUpdateMessage public get targetLocation(): IVector3D { - if(!this._targetLocation) return this.location; + if (!this._targetLocation) return this.location; return this._targetLocation; } @@ -25,4 +25,4 @@ export class ObjectMoveUpdateMessage extends RoomObjectUpdateMessage { return this._isSlide; } -} \ No newline at end of file +} diff --git a/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts b/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts index a450ecdb..e513d42c 100644 --- a/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts +++ b/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts @@ -1,6 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../room/messages/RoomObjectUpdateMessage'; -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { RoomObjectUpdateMessage, Vector3d } from '../../../room'; export class ObjectRoomMaskUpdateMessage extends RoomObjectUpdateMessage { diff --git a/src/nitro/room/object/RoomMapMaskData.ts b/src/nitro/room/object/RoomMapMaskData.ts index e823be67..c95c980d 100644 --- a/src/nitro/room/object/RoomMapMaskData.ts +++ b/src/nitro/room/object/RoomMapMaskData.ts @@ -1,4 +1,4 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; export class RoomMapMaskData { @@ -13,4 +13,4 @@ export class RoomMapMaskData { return this._masks; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/RoomObjectVisualizationFactory.ts b/src/nitro/room/object/RoomObjectVisualizationFactory.ts index f2383f17..0ce4f580 100644 --- a/src/nitro/room/object/RoomObjectVisualizationFactory.ts +++ b/src/nitro/room/object/RoomObjectVisualizationFactory.ts @@ -1,9 +1,6 @@ -import { IAssetData } from '../../../api'; +import { IAssetData, IObjectVisualizationData, IRoomObjectGraphicVisualization, IRoomObjectVisualizationFactory } from '../../../api'; import { NitroLogger } from '../../../core'; -import { IRoomObjectGraphicVisualization } from '../../../room/object/visualization/IRoomObjectGraphicVisualization'; -import { IObjectVisualizationData } from '../../../room/object/visualization/IRoomObjectVisualizationData'; -import { IRoomObjectVisualizationFactory } from '../../../room/object/visualization/IRoomObjectVisualizationFactory'; -import { RoomObjectSpriteVisualization } from '../../../room/object/visualization/RoomObjectSpriteVisualization'; +import { RoomObjectSpriteVisualization } from '../../../room'; import { Nitro } from '../../Nitro'; import { RoomObjectVisualizationType } from './RoomObjectVisualizationType'; import { AvatarVisualization } from './visualization/avatar/AvatarVisualization'; diff --git a/src/nitro/room/object/RoomPlaneBitmapMaskData.ts b/src/nitro/room/object/RoomPlaneBitmapMaskData.ts index a697aa70..8300848e 100644 --- a/src/nitro/room/object/RoomPlaneBitmapMaskData.ts +++ b/src/nitro/room/object/RoomPlaneBitmapMaskData.ts @@ -1,5 +1,5 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; export class RoomPlaneBitmapMaskData { @@ -22,9 +22,9 @@ export class RoomPlaneBitmapMaskData return this._loc; } - public set loc(k:IVector3D) + public set loc(k: IVector3D) { - if(!this._loc) this._loc = new Vector3d(); + if (!this._loc) this._loc = new Vector3d(); this._loc.assign(k); } diff --git a/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts b/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts index 659ab970..76b0ceff 100644 --- a/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts +++ b/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts @@ -1,4 +1,4 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; import { RoomMapMaskData } from './RoomMapMaskData'; import { RoomPlaneBitmapMaskData } from './RoomPlaneBitmapMaskData'; @@ -18,7 +18,7 @@ export class RoomPlaneBitmapMaskParser public dispose(): void { - if(this._masks) + if (this._masks) { this.reset(); @@ -28,19 +28,19 @@ export class RoomPlaneBitmapMaskParser public initialize(k: RoomMapMaskData): boolean { - if(!k) return false; + if (!k) return false; this._masks.clear(); - if(k.masks.length) + if (k.masks.length) { - for(const mask of k.masks) + for (const mask of k.masks) { - if(!mask) continue; + if (!mask) continue; const location = mask.locations.length ? mask.locations[0] : null; - if(!location) continue; + if (!location) continue; this._masks.set(mask.id, new RoomPlaneBitmapMaskData(mask.type, location, mask.category)); } @@ -51,9 +51,9 @@ export class RoomPlaneBitmapMaskParser public reset(): void { - for(const mask of this._masks.values()) + for (const mask of this._masks.values()) { - if(!mask) continue; + if (!mask) continue; mask.dispose(); } @@ -73,7 +73,7 @@ export class RoomPlaneBitmapMaskParser { const existing = this._masks.get(k); - if(existing) + if (existing) { this._masks.delete(k); @@ -89,15 +89,15 @@ export class RoomPlaneBitmapMaskParser { const data = new RoomMapMaskData(); - for(const [ key, mask ] of this._masks.entries()) + for (const [key, mask] of this._masks.entries()) { - if(!mask) continue; + if (!mask) continue; const type = this.getMaskType(mask); const category = this.getMaskCategory(mask); const location = this.getMaskLocation(mask); - if(type && category && location) + if (type && category && location) { const newMask: any = { id: key, @@ -121,21 +121,21 @@ export class RoomPlaneBitmapMaskParser public getMaskLocation(mask: RoomPlaneBitmapMaskData): IVector3D { - if(!mask) return null; + if (!mask) return null; return mask.loc; } public getMaskType(mask: RoomPlaneBitmapMaskData): string { - if(!mask) return null; + if (!mask) return null; return mask.type; } public getMaskCategory(mask: RoomPlaneBitmapMaskData): string { - if(!mask) return null; + if (!mask) return null; return mask.category; } diff --git a/src/nitro/room/object/RoomPlaneData.ts b/src/nitro/room/object/RoomPlaneData.ts index 87804678..88e41a05 100644 --- a/src/nitro/room/object/RoomPlaneData.ts +++ b/src/nitro/room/object/RoomPlaneData.ts @@ -1,5 +1,5 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; import { RoomPlaneMaskData } from './RoomPlaneMaskData'; export class RoomPlaneData @@ -38,7 +38,7 @@ export class RoomPlaneData this._rightSide = new Vector3d(); this._rightSide.assign(_arg_4); this._type = k; - if(((!(_arg_3 == null)) && (!(_arg_4 == null)))) + if (((!(_arg_3 == null)) && (!(_arg_4 == null)))) { this._normal = Vector3d.crossProduct(_arg_3, _arg_4); _local_6 = 0; @@ -46,26 +46,26 @@ export class RoomPlaneData _local_8 = 0; _local_9 = 0; _local_10 = 0; - if(((!(this.normal.x == 0)) || (!(this.normal.y == 0)))) + if (((!(this.normal.x == 0)) || (!(this.normal.y == 0)))) { _local_9 = this.normal.x; _local_10 = this.normal.y; _local_6 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); - if(_local_6 >= 360) + if (_local_6 >= 360) { _local_6 = (_local_6 - 360); } _local_9 = Math.sqrt(((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y))); _local_10 = this.normal.z; _local_7 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); - if(_local_7 >= 360) + if (_local_7 >= 360) { _local_7 = (_local_7 - 360); } } else { - if(this.normal.z < 0) + if (this.normal.z < 0) { _local_7 = 90; } @@ -76,13 +76,13 @@ export class RoomPlaneData } this._normalDirection = new Vector3d(_local_6, _local_7, _local_8); } - if(((!(_arg_5 == null)) && (_arg_5.length > 0))) + if (((!(_arg_5 == null)) && (_arg_5.length > 0))) { _local_11 = 0; - while(_local_11 < _arg_5.length) + while (_local_11 < _arg_5.length) { _local_12 = _arg_5[_local_11]; - if(((!(_local_12 == null)) && (_local_12.length > 0))) + if (((!(_local_12 == null)) && (_local_12.length > 0))) { _local_13 = new Vector3d(); _local_13.assign(_local_12); @@ -136,24 +136,24 @@ export class RoomPlaneData public getSecondaryNormal(k: number): IVector3D { - if(((k < 0) || (k >= this.secondaryNormalCount))) + if (((k < 0) || (k >= this.secondaryNormalCount))) { return null; } - const _local_2:Vector3d = new Vector3d(); + const _local_2: Vector3d = new Vector3d(); _local_2.assign((this._secondaryNormals[k] as IVector3D)); return _local_2; } public addMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): void { - const _local_5:RoomPlaneMaskData = new RoomPlaneMaskData(k, _arg_2, _arg_3, _arg_4); + const _local_5: RoomPlaneMaskData = new RoomPlaneMaskData(k, _arg_2, _arg_3, _arg_4); this._masks.push(_local_5); } - private getMask(k: number):RoomPlaneMaskData + private getMask(k: number): RoomPlaneMaskData { - if(((k < 0) || (k >= this.maskCount))) + if (((k < 0) || (k >= this.maskCount))) { return null; } @@ -162,8 +162,8 @@ export class RoomPlaneData public getMaskLeftSideLoc(k: number): number { - const _local_2:RoomPlaneMaskData = this.getMask(k); - if(_local_2 != null) + const _local_2: RoomPlaneMaskData = this.getMask(k); + if (_local_2 != null) { return _local_2.leftSideLoc; } @@ -172,8 +172,8 @@ export class RoomPlaneData public getMaskRightSideLoc(k: number): number { - const _local_2:RoomPlaneMaskData = this.getMask(k); - if(_local_2 != null) + const _local_2: RoomPlaneMaskData = this.getMask(k); + if (_local_2 != null) { return _local_2.rightSideLoc; } @@ -182,8 +182,8 @@ export class RoomPlaneData public getMaskLeftSideLength(k: number): number { - const _local_2:RoomPlaneMaskData = this.getMask(k); - if(_local_2 != null) + const _local_2: RoomPlaneMaskData = this.getMask(k); + if (_local_2 != null) { return _local_2.leftSideLength; } @@ -192,8 +192,8 @@ export class RoomPlaneData public getMaskRightSideLength(k: number): number { - const _local_2:RoomPlaneMaskData = this.getMask(k); - if(_local_2 != null) + const _local_2: RoomPlaneMaskData = this.getMask(k); + if (_local_2 != null) { return _local_2.rightSideLength; } diff --git a/src/nitro/room/object/RoomPlaneParser.ts b/src/nitro/room/object/RoomPlaneParser.ts index 1ef9e3f6..5b76cc76 100644 --- a/src/nitro/room/object/RoomPlaneParser.ts +++ b/src/nitro/room/object/RoomPlaneParser.ts @@ -1,6 +1,6 @@ import { Point } from '@pixi/math'; -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; import { RoomFloorHole } from './RoomFloorHole'; import { RoomMapData } from './RoomMapData'; import { RoomPlaneData } from './RoomPlaneData'; @@ -51,23 +51,23 @@ export class RoomPlaneParser { const length = matricies.length; - if(!length) return 0; + if (!length) return 0; let tileHeight = 0; let i = 0; - while(i < length) + while (i < length) { const matrix = matricies[i]; let j = 0; - while(j < matrix.length) + while (j < matrix.length) { const height = matrix[j]; - if(height > tileHeight) tileHeight = height; + if (height > tileHeight) tileHeight = height; j++; } @@ -80,27 +80,27 @@ export class RoomPlaneParser private static findEntranceTile(matricies: number[][]): Point { - if(!matricies) return null; + if (!matricies) return null; const length = matricies.length; - if(!length) return null; + if (!length) return null; const _local_6: number[] = []; let i = 0; - while(i < length) + while (i < length) { const matrix = matricies[i]; - if(!matrix || !matrix.length) return null; + if (!matrix || !matrix.length) return null; let j = 0; - while(j < matrix.length) + while (j < matrix.length) { - if(matrix[j] >= 0) + if (matrix[j] >= 0) { _local_6.push(j); @@ -110,16 +110,16 @@ export class RoomPlaneParser j++; } - if(_local_6.length < (i + 1)) _local_6.push((matrix.length + 1)); + if (_local_6.length < (i + 1)) _local_6.push((matrix.length + 1)); i++; } i = 1; - while(i < (_local_6.length - 1)) + while (i < (_local_6.length - 1)) { - if(((Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i - 1)]) - 1)) && (Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i + 1)]) - 1)))) return new Point(Math.trunc((_local_6[i]) | 0), i); + if (((Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i - 1)]) - 1)) && (Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i + 1)]) - 1)))) return new Point(Math.trunc((_local_6[i]) | 0), i); i++; } @@ -145,29 +145,29 @@ export class RoomPlaneParser const _local_3: number = k[0].length; const _local_4: number[][] = []; _local_6 = 0; - while(_local_6 < (_local_2 * 4)) + while (_local_6 < (_local_2 * 4)) { _local_4[_local_6] = []; _local_6++; } let _local_9 = 0; _local_6 = 0; - while(_local_6 < _local_2) + while (_local_6 < _local_2) { _local_10 = 0; _local_5 = 0; - while(_local_5 < _local_3) + while (_local_5 < _local_3) { _local_11 = k[_local_6][_local_5]; - if(((_local_11 < 0) || (_local_11 <= 0xFF))) + if (((_local_11 < 0) || (_local_11 <= 0xFF))) { _local_8 = 0; - while(_local_8 < 4) + while (_local_8 < 4) { _local_7 = 0; - while(_local_7 < 4) + while (_local_7 < 4) { - if(_local_4[(_local_9 + _local_8)] === undefined) _local_4[(_local_9 + _local_8)] = []; + if (_local_4[(_local_9 + _local_8)] === undefined) _local_4[(_local_9 + _local_8)] = []; _local_4[(_local_9 + _local_8)][(_local_10 + _local_7)] = ((_local_11 < 0) ? _local_11 : (_local_11 * 4)); _local_7++; @@ -183,7 +183,7 @@ export class RoomPlaneParser _local_15 = (_local_12 + (((_local_11 >> 9) & 0x01) * 3)); _local_16 = (_local_12 + (((_local_11 >> 8) & 0x01) * 3)); _local_7 = 0; - while(_local_7 < 3) + while (_local_7 < 3) { _local_17 = (_local_7 + 1); _local_4[_local_9][(_local_10 + _local_7)] = (((_local_13 * (3 - _local_7)) + (_local_14 * _local_7)) / 3); @@ -225,13 +225,13 @@ export class RoomPlaneParser const _local_2: number = (k.length - 1); const _local_3: number = (k[0].length - 1); _local_5 = 1; - while(_local_5 < _local_2) + while (_local_5 < _local_2) { _local_4 = 1; - while(_local_4 < _local_3) + while (_local_4 < _local_3) { _local_6 = k[_local_5][_local_4]; - if(_local_6 < 0) + if (_local_6 < 0) { // } @@ -248,7 +248,7 @@ export class RoomPlaneParser _local_15 = (_local_6 + 1); _local_16 = (_local_6 - 1); _local_17 = (((((((_local_7 == _local_15) || (_local_8 == _local_15)) || (_local_10 == _local_15)) ? 8 : 0) | ((((_local_9 == _local_15) || (_local_8 == _local_15)) || (_local_11 == _local_15)) ? 4 : 0)) | ((((_local_12 == _local_15) || (_local_13 == _local_15)) || (_local_10 == _local_15)) ? 2 : 0)) | ((((_local_14 == _local_15) || (_local_13 == _local_15)) || (_local_11 == _local_15)) ? 1 : 0)); - if(_local_17 == 15) + if (_local_17 == 15) { _local_17 = 0; } @@ -265,7 +265,7 @@ export class RoomPlaneParser k.shift(); k.pop(); - for(const _local_2 of k) + for (const _local_2 of k) { _local_2.shift(); _local_2.pop(); @@ -276,12 +276,12 @@ export class RoomPlaneParser { const _local_2: number[] = []; const _local_3: number[] = []; - for(const _local_4 of k) + for (const _local_4 of k) { _local_4.push(RoomPlaneParser.TILE_BLOCKED); _local_4.unshift(RoomPlaneParser.TILE_BLOCKED); } - for(const _local_5 of k[0]) + for (const _local_5 of k[0]) { _local_2.push(RoomPlaneParser.TILE_BLOCKED); _local_3.push(RoomPlaneParser.TILE_BLOCKED); @@ -328,7 +328,7 @@ export class RoomPlaneParser public get floorHeight(): number { - if(this._fixedWallHeight != -1) + if (this._fixedWallHeight != -1) { return this._fixedWallHeight; } @@ -337,7 +337,7 @@ export class RoomPlaneParser public get wallHeight(): number { - if(this._fixedWallHeight != -1) + if (this._fixedWallHeight != -1) { return this._fixedWallHeight + 3.6; } @@ -346,7 +346,7 @@ export class RoomPlaneParser public set wallHeight(k: number) { - if(k < 0) + if (k < 0) { k = 0; } @@ -360,7 +360,7 @@ export class RoomPlaneParser public set wallThicknessMultiplier(k: number) { - if(k < 0) + if (k < 0) { k = 0; } @@ -374,7 +374,7 @@ export class RoomPlaneParser public set floorThicknessMultiplier(k: number) { - if(k < 0) + if (k < 0) { k = 0; } @@ -387,7 +387,7 @@ export class RoomPlaneParser this._tileMatrix = null; this._tileMatrixOriginal = null; this._floorHoleMatrix = null; - if(this._floorHoles != null) + if (this._floorHoles != null) { this._floorHoles.clear(); this._floorHoles = null; @@ -411,9 +411,9 @@ export class RoomPlaneParser public initializeTileMap(width: number, height: number): boolean { - if(width < 0) width = 0; + if (width < 0) width = 0; - if(height < 0) height = 0; + if (height < 0) height = 0; this._tileMatrix = []; this._tileMatrixOriginal = []; @@ -421,7 +421,7 @@ export class RoomPlaneParser let y = 0; - while(y < height) + while (y < height) { const tileMatrix = []; const tileMatrixOriginal = []; @@ -429,7 +429,7 @@ export class RoomPlaneParser let x = 0; - while(x < width) + while (x < width) { tileMatrix[x] = RoomPlaneParser.TILE_BLOCKED; tileMatrixOriginal[x] = RoomPlaneParser.TILE_BLOCKED; @@ -462,77 +462,77 @@ export class RoomPlaneParser let _local_6: number; let _local_7: boolean; let _local_8: number; - if(((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))) + if (((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))) { _local_4 = this._tileMatrix[_arg_2]; _local_4[k] = _arg_3; - if(_arg_3 >= 0) + if (_arg_3 >= 0) { - if(k < this._minX) + if (k < this._minX) { this._minX = k; } - if(k > this._maxX) + if (k > this._maxX) { this._maxX = k; } - if(_arg_2 < this._minY) + if (_arg_2 < this._minY) { this._minY = _arg_2; } - if(_arg_2 > this._maxY) + if (_arg_2 > this._maxY) { this._maxY = _arg_2; } } else { - if(((k == this._minX) || (k == this._maxX))) + if (((k == this._minX) || (k == this._maxX))) { _local_5 = false; _local_6 = this._minY; - while(_local_6 < this._maxY) + while (_local_6 < this._maxY) { - if(this.getTileHeightInternal(k, _local_6) >= 0) + if (this.getTileHeightInternal(k, _local_6) >= 0) { _local_5 = true; break; } _local_6++; } - if(!_local_5) + if (!_local_5) { - if(k == this._minX) + if (k == this._minX) { this._minX++; } - if(k == this._maxX) + if (k == this._maxX) { this._maxX--; } } } - if(((_arg_2 == this._minY) || (_arg_2 == this._maxY))) + if (((_arg_2 == this._minY) || (_arg_2 == this._maxY))) { _local_7 = false; _local_8 = this._minX; - while(_local_8 < this._maxX) + while (_local_8 < this._maxX) { - if(this.getTileHeight(_local_8, _arg_2) >= 0) + if (this.getTileHeight(_local_8, _arg_2) >= 0) { _local_7 = true; break; } _local_8++; } - if(!_local_7) + if (!_local_7) { - if(_arg_2 == this._minY) + if (_arg_2 == this._minY) { this._minY++; } - if(_arg_2 == this._maxY) + if (_arg_2 == this._maxY) { this._maxY--; } @@ -546,25 +546,25 @@ export class RoomPlaneParser public getTileHeight(k: number, _arg_2: number): number { - if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } const _local_3 = this._tileMatrix[_arg_2]; - if(_local_3[k] === undefined) return 0; + if (_local_3[k] === undefined) return 0; return Math.abs(_local_3[k]); } private getTileHeightOriginal(k: number, _arg_2: number): number { - if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } - if(this._floorHoleMatrix[_arg_2][k]) + if (this._floorHoleMatrix[_arg_2][k]) { return RoomPlaneParser.TILE_HOLE; } @@ -574,7 +574,7 @@ export class RoomPlaneParser private getTileHeightInternal(k: number, _arg_2: number): number { - if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + if (((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) { return RoomPlaneParser.TILE_BLOCKED; } @@ -582,18 +582,18 @@ export class RoomPlaneParser return _local_3[k]; } - public initializeFromTileData(k: number=-1): boolean + public initializeFromTileData(k: number = -1): boolean { let _local_2: number; let _local_3: number; this._fixedWallHeight = k; _local_3 = 0; - while(_local_3 < this._height) + while (_local_3 < this._height) { _local_2 = 0; - while(_local_2 < this._width) + while (_local_2 < this._width) { - if(this._tileMatrixOriginal[_local_3] === undefined) this._tileMatrixOriginal[_local_3] = []; + if (this._tileMatrixOriginal[_local_3] === undefined) this._tileMatrixOriginal[_local_3] = []; this._tileMatrixOriginal[_local_3][_local_2] = this._tileMatrix[_local_3][_local_2]; _local_2++; } @@ -602,13 +602,13 @@ export class RoomPlaneParser const _local_4: Point = RoomPlaneParser.findEntranceTile(this._tileMatrix); _local_3 = 0; - while(_local_3 < this._height) + while (_local_3 < this._height) { _local_2 = 0; - while(_local_2 < this._width) + while (_local_2 < this._width) { - if(this._floorHoleMatrix[_local_3] === undefined) this._floorHoleMatrix[_local_3] = []; - if(this._floorHoleMatrix[_local_3][_local_2]) + if (this._floorHoleMatrix[_local_3] === undefined) this._floorHoleMatrix[_local_3] = []; + if (this._floorHoleMatrix[_local_3][_local_2]) { this.setTileHeight(_local_2, _local_3, RoomPlaneParser.TILE_HOLE); } @@ -623,7 +623,7 @@ export class RoomPlaneParser private initialize(k: Point): boolean { let _local_2 = 0; - if(k != null) + if (k != null) { _local_2 = this.getTileHeight(k.x, k.y); this.setTileHeight(k.x, k.y, RoomPlaneParser.TILE_BLOCKED); @@ -632,14 +632,14 @@ export class RoomPlaneParser this.createWallPlanes(); const _local_3: number[][] = []; - for(const _local_4 of this._tileMatrix) _local_3.push(_local_4.concat()); + for (const _local_4 of this._tileMatrix) _local_3.push(_local_4.concat()); RoomPlaneParser.padHeightMap(_local_3); RoomPlaneParser.addTileTypes(_local_3); RoomPlaneParser.unpadHeightMap(_local_3); const _local_5 = RoomPlaneParser.expandFloorTiles(_local_3); this.extractPlanes(_local_5); - if(k != null) + if (k != null) { this.setTileHeight(k.x, k.y, _local_2); this.addFloor(new Vector3d((k.x + 0.5), (k.y + 0.5), _local_2), new Vector3d(-1, 0, 0), new Vector3d(0, -1, 0), false, false, false, false); @@ -660,22 +660,22 @@ export class RoomPlaneParser let _local_5 = 0; let _local_6: Point = new Point(k.x, k.y); let _local_7 = 0; - while(_local_7++ < 1000) + while (_local_7++ < 1000) { _local_8 = false; _local_9 = false; _local_10 = _local_5; - if(((((_local_6.x < this.minX) || (_local_6.x > this.maxX)) || (_local_6.y < this.minY)) || (_local_6.y > this.maxY))) + if (((((_local_6.x < this.minX) || (_local_6.x > this.maxX)) || (_local_6.y < this.minY)) || (_local_6.y > this.maxY))) { _local_8 = true; } _local_11 = _local_4[_local_5](_local_6, _arg_2); - if(_local_11 == null) + if (_local_11 == null) { return null; } _local_12 = (Math.abs((_local_11.x - _local_6.x)) + Math.abs((_local_11.y - _local_6.y))); - if(((_local_6.x == _local_11.x) || (_local_6.y == _local_11.y))) + if (((_local_6.x == _local_11.x) || (_local_6.y == _local_11.y))) { _local_5 = (((_local_5 - 1) + _local_4.length) % _local_4.length); _local_12 = (_local_12 + 1); @@ -687,13 +687,13 @@ export class RoomPlaneParser _local_12--; } _local_3.addWall(_local_6, _local_10, _local_12, _local_8, _local_9); - if((((_local_11.x == k.x) && (_local_11.y == k.y)) && ((!(_local_11.x == _local_6.x)) || (!(_local_11.y == _local_6.y))))) + if ((((_local_11.x == k.x) && (_local_11.y == k.y)) && ((!(_local_11.x == _local_6.x)) || (!(_local_11.y == _local_6.y))))) { break; } _local_6 = _local_11; } - if(_local_3.count == 0) + if (_local_3.count == 0) { return null; } @@ -708,37 +708,37 @@ export class RoomPlaneParser let _local_8: number; let _local_2 = 0; const _local_3: number = k.count; - while(_local_2 < _local_3) + while (_local_2 < _local_3) { const _local_4 = _local_2; _local_5 = _local_2; _local_6 = 0; _local_7 = false; - while(((!(k.getBorder(_local_2))) && (_local_2 < _local_3))) + while (((!(k.getBorder(_local_2))) && (_local_2 < _local_3))) { - if(k.getLeftTurn(_local_2)) + if (k.getLeftTurn(_local_2)) { _local_6++; } else { - if(_local_6 > 0) + if (_local_6 > 0) { _local_6--; } } - if(_local_6 > 1) + if (_local_6 > 1) { _local_7 = true; } _local_5 = _local_2; _local_2++; } - if(_local_7) + if (_local_7) { _local_8 = _local_4; - while(_local_8 <= _local_5) + while (_local_8 <= _local_5) { k.setHideWall(_local_8, true); _local_8++; @@ -759,9 +759,9 @@ export class RoomPlaneParser let _local_10: number; const _local_2: number = k.count; let _local_3 = 0; - while(_local_3 < _local_2) + while (_local_3 < _local_2) { - if(!k.getHideWall(_local_3)) + if (!k.getHideWall(_local_3)) { _local_4 = k.getCorner(_local_3); _local_5 = k.getDirection(_local_3); @@ -770,11 +770,11 @@ export class RoomPlaneParser _local_8 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; _local_9 = 0; _local_10 = 0; - while(_local_10 < _local_6) + while (_local_10 < _local_6) { - if(this.getTileHeightInternal(((_local_4.x + (_local_10 * _local_7.x)) - _local_8.x), ((_local_4.y + (_local_10 * _local_7.y)) - _local_8.y)) == RoomPlaneParser.TILE_HOLE) + if (this.getTileHeightInternal(((_local_4.x + (_local_10 * _local_7.x)) - _local_8.x), ((_local_4.y + (_local_10 * _local_7.y)) - _local_8.y)) == RoomPlaneParser.TILE_HOLE) { - if(((_local_10 > 0) && (_local_9 == 0))) + if (((_local_10 > 0) && (_local_9 == 0))) { k.setLength(_local_3, _local_10); break; @@ -783,7 +783,7 @@ export class RoomPlaneParser } else { - if(_local_9 > 0) + if (_local_9 > 0) { k.moveCorner(_local_3, _local_9); break; @@ -791,7 +791,7 @@ export class RoomPlaneParser } _local_10++; } - if(_local_9 == _local_6) + if (_local_9 == _local_6) { k.setHideWall(_local_3, true); } @@ -814,17 +814,17 @@ export class RoomPlaneParser const _local_7: number = Math.max(k.x, _arg_2.x); const _local_8: number = _arg_3.count; let _local_9 = 0; - while(_local_9 < _local_8) + while (_local_9 < _local_8) { _local_10 = _arg_3.getCorner(_local_9); _local_11 = _arg_3.getEndPoint(_local_9); - if(k.x == _arg_2.x) + if (k.x == _arg_2.x) { - if(((_local_10.x == k.x) && (_local_11.x == k.x))) + if (((_local_10.x == k.x) && (_local_11.x == k.x))) { _local_12 = Math.min(_local_10.y, _local_11.y); _local_13 = Math.max(_local_10.y, _local_11.y); - if(((_local_12 <= _local_4) && (_local_5 <= _local_13))) + if (((_local_12 <= _local_4) && (_local_5 <= _local_13))) { return _local_9; } @@ -832,13 +832,13 @@ export class RoomPlaneParser } else { - if(k.y == _arg_2.y) + if (k.y == _arg_2.y) { - if(((_local_10.y == k.y) && (_local_11.y == k.y))) + if (((_local_10.y == k.y) && (_local_11.y == k.y))) { _local_14 = Math.min(_local_10.x, _local_11.x); _local_15 = Math.max(_local_10.x, _local_11.x); - if(((_local_14 <= _local_6) && (_local_7 <= _local_15))) + if (((_local_14 <= _local_6) && (_local_7 <= _local_15))) { return _local_9; } @@ -859,9 +859,9 @@ export class RoomPlaneParser let _local_9: number; const _local_3: number = k.count; let _local_4 = 0; - while(_local_4 < _local_3) + while (_local_4 < _local_3) { - if(!k.getHideWall(_local_4)) + if (!k.getHideWall(_local_4)) { _local_5 = k.getCorner(_local_4); _local_6 = new Point(_local_5.x, _local_5.y); @@ -870,9 +870,9 @@ export class RoomPlaneParser _local_6.x = (_local_6.x + (_local_7.x * _local_8)); _local_6.y = (_local_6.y + (_local_7.y * _local_8)); _local_9 = this.resolveOriginalWallIndex(_local_5, _local_6, _arg_2); - if(_local_9 >= 0) + if (_local_9 >= 0) { - if(_arg_2.getHideWall(_local_9)) + if (_arg_2.getHideWall(_local_9)) { k.setHideWall(_local_4, true); } @@ -899,9 +899,9 @@ export class RoomPlaneParser const _local_4 = _arg_2.count; let _local_7 = 0; - while(_local_7 < _local_3) + while (_local_7 < _local_3) { - if(!k.getHideWall(_local_7)) + if (!k.getHideWall(_local_7)) { const _local_8 = k.getCorner(_local_7); const _local_9 = k.getDirection(_local_7); @@ -911,11 +911,11 @@ export class RoomPlaneParser let _local_13 = -1; let _local_14 = 0; - while(_local_14 < _local_10) + while (_local_14 < _local_10) { const _local_27 = this.getTileHeightInternal(((_local_8.x + (_local_14 * _local_11.x)) + _local_12.x), ((_local_8.y + (_local_14 * _local_11.y)) + _local_12.y)); - if(((_local_27 >= 0) && ((_local_27 < _local_13) || (_local_13 < 0)))) + if (((_local_27 >= 0) && ((_local_27 < _local_13) || (_local_13 < 0)))) { _local_13 = _local_27; } @@ -940,7 +940,7 @@ export class RoomPlaneParser let _local_5 = 0; let _local_6 = 0; - if(_local_20 >= 0) + if (_local_20 >= 0) { _local_5 = _arg_2.getDirection(((_local_20 + 1) % _local_4)); _local_6 = _arg_2.getDirection((((_local_20 - 1) + _local_4) % _local_4)); @@ -953,13 +953,13 @@ export class RoomPlaneParser let _local_21 = null; - if((((_local_5 - _local_9) + 4) % 4) == 3) + if ((((_local_5 - _local_9) + 4) % 4) == 3) { _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; } else { - if((((_local_9 - _local_6) + 4) % 4) == 3) + if ((((_local_9 - _local_6) + 4) % 4) == 3) { _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_6]; } @@ -983,7 +983,7 @@ export class RoomPlaneParser let _local_13: number; let _local_14: number; const k = this._tileMatrix; - if(k == null) + if (k == null) { return false; } @@ -992,19 +992,19 @@ export class RoomPlaneParser let _local_4: number[]; const _local_5: number = k.length; let _local_6 = 0; - if(_local_5 == 0) + if (_local_5 == 0) { return false; } _local_2 = 0; - while(_local_2 < _local_5) + while (_local_2 < _local_5) { _local_4 = k[_local_2]; - if(((_local_4 == null) || (_local_4.length == 0))) + if (((_local_4 == null) || (_local_4.length == 0))) { return false; } - if(_local_6 > 0) + if (_local_6 > 0) { _local_6 = Math.min(_local_6, _local_4.length); } @@ -1018,23 +1018,23 @@ export class RoomPlaneParser const _local_8: number = this.minX; let _local_9: number = this.minY; _local_9 = this.minY; - while(_local_9 <= this.maxY) + while (_local_9 <= this.maxY) { - if(this.getTileHeightInternal(_local_8, _local_9) > RoomPlaneParser.TILE_HOLE) + if (this.getTileHeightInternal(_local_8, _local_9) > RoomPlaneParser.TILE_HOLE) { _local_9--; break; } _local_9++; } - if(_local_9 > this.maxY) + if (_local_9 > this.maxY) { return false; } const _local_10: Point = new Point(_local_8, _local_9); const _local_11: RoomWallData = this.generateWallData(_local_10, true); const _local_12: RoomWallData = this.generateWallData(_local_10, false); - if(_local_11 != null) + if (_local_11 != null) { _local_13 = _local_11.count; _local_14 = _local_12.count; @@ -1042,12 +1042,12 @@ export class RoomPlaneParser this.addWalls(_local_11, _local_12); } _local_3 = 0; - while(_local_3 < this.tileMapHeight) + while (_local_3 < this.tileMapHeight) { _local_2 = 0; - while(_local_2 < this.tileMapWidth) + while (_local_2 < this.tileMapWidth) { - if(this.getTileHeightInternal(_local_2, _local_3) < 0) + if (this.getTileHeightInternal(_local_2, _local_3) < 0) { this.setTileHeight(_local_2, _local_3, -(_local_7 + this.wallHeight)); } @@ -1060,23 +1060,23 @@ export class RoomPlaneParser private extractTopWall(k: Point, _arg_2: boolean): Point { - if(k == null) + if (k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if(!_arg_2) + if (!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while(_local_3 < 1000) + while (_local_3 < 1000) { - if(this.getTileHeightInternal((k.x + _local_3), k.y) > _local_4) + if (this.getTileHeightInternal((k.x + _local_3), k.y) > _local_4) { return new Point(((k.x + _local_3) - 1), k.y); } - if(this.getTileHeightInternal((k.x + _local_3), (k.y + 1)) <= _local_4) + if (this.getTileHeightInternal((k.x + _local_3), (k.y + 1)) <= _local_4) { return new Point((k.x + _local_3), (k.y + 1)); } @@ -1087,23 +1087,23 @@ export class RoomPlaneParser private extractRightWall(k: Point, _arg_2: boolean): Point { - if(k == null) + if (k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if(!_arg_2) + if (!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while(_local_3 < 1000) + while (_local_3 < 1000) { - if(this.getTileHeightInternal(k.x, (k.y + _local_3)) > _local_4) + if (this.getTileHeightInternal(k.x, (k.y + _local_3)) > _local_4) { return new Point(k.x, (k.y + (_local_3 - 1))); } - if(this.getTileHeightInternal((k.x - 1), (k.y + _local_3)) <= _local_4) + if (this.getTileHeightInternal((k.x - 1), (k.y + _local_3)) <= _local_4) { return new Point((k.x - 1), (k.y + _local_3)); } @@ -1114,23 +1114,23 @@ export class RoomPlaneParser private extractBottomWall(k: Point, _arg_2: boolean): Point { - if(k == null) + if (k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if(!_arg_2) + if (!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while(_local_3 < 1000) + while (_local_3 < 1000) { - if(this.getTileHeightInternal((k.x - _local_3), k.y) > _local_4) + if (this.getTileHeightInternal((k.x - _local_3), k.y) > _local_4) { return new Point((k.x - (_local_3 - 1)), k.y); } - if(this.getTileHeightInternal((k.x - _local_3), (k.y - 1)) <= _local_4) + if (this.getTileHeightInternal((k.x - _local_3), (k.y - 1)) <= _local_4) { return new Point((k.x - _local_3), (k.y - 1)); } @@ -1141,23 +1141,23 @@ export class RoomPlaneParser private extractLeftWall(k: Point, _arg_2: boolean): Point { - if(k == null) + if (k == null) { return null; } let _local_3 = 1; let _local_4: number = RoomPlaneParser.TILE_HOLE; - if(!_arg_2) + if (!_arg_2) { _local_4 = RoomPlaneParser.TILE_BLOCKED; } - while(_local_3 < 1000) + while (_local_3 < 1000) { - if(this.getTileHeightInternal(k.x, (k.y - _local_3)) > _local_4) + if (this.getTileHeightInternal(k.x, (k.y - _local_3)) > _local_4) { return new Point(k.x, (k.y - (_local_3 - 1))); } - if(this.getTileHeightInternal((k.x + 1), (k.y - _local_3)) <= _local_4) + if (this.getTileHeightInternal((k.x + 1), (k.y - _local_3)) <= _local_4) { return new Point((k.x + 1), (k.y - _local_3)); } @@ -1172,17 +1172,17 @@ export class RoomPlaneParser //this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [_arg_4]); const _local_8: number = (RoomPlaneParser.WALL_THICKNESS * this._wallThicknessMultiplier); const _local_9: number = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); - const _local_10:Vector3d = Vector3d.crossProduct(_arg_2, _arg_3); - const _local_11:Vector3d = Vector3d.product(_local_10, ((1 / _local_10.length) * -(_local_8))); + const _local_10: Vector3d = Vector3d.crossProduct(_arg_2, _arg_3); + const _local_11: Vector3d = Vector3d.product(_local_10, ((1 / _local_10.length) * -(_local_8))); this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, _arg_3), _arg_2, _local_11, [_local_10, _arg_4]); - if(_arg_5) + if (_arg_5) { this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_2), _arg_3), Vector3d.product(_arg_3, (-(_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); } - if(_arg_6) + if (_arg_6) { this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, Vector3d.product(_arg_3, (-(_local_9) / _arg_3.length))), Vector3d.product(_arg_3, ((_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); - if(_arg_7) + if (_arg_7) { const _local_12 = Vector3d.product(_arg_2, (_local_8 / _arg_2.length)); this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_3), Vector3d.product(_local_12, -1)), _local_12, _local_11, [_local_10, _arg_2, _arg_4]); @@ -1193,27 +1193,27 @@ export class RoomPlaneParser private addFloor(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: boolean, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void { let _local_9: number; - let _local_10:Vector3d; - let _local_11:Vector3d; + let _local_10: Vector3d; + let _local_11: Vector3d; const _local_8: RoomPlaneData = this.addPlane(RoomPlaneData.PLANE_FLOOR, k, _arg_2, _arg_3); - if(_local_8 != null) + if (_local_8 != null) { _local_9 = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); _local_10 = new Vector3d(0, 0, _local_9); _local_11 = Vector3d.dif(k, _local_10); - if(_arg_6) + if (_arg_6) { this.addPlane(RoomPlaneData.PLANE_FLOOR, _local_11, _arg_2, _local_10); } - if(_arg_7) + if (_arg_7) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, Vector3d.sum(_arg_2, _arg_3)), Vector3d.product(_arg_2, -1), _local_10); } - if(_arg_4) + if (_arg_4) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_3), Vector3d.product(_arg_3, -1), _local_10); } - if(_arg_5) + if (_arg_5) { this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_2), _arg_3, _local_10); } @@ -1222,7 +1222,7 @@ export class RoomPlaneParser public initializeFromMapData(data: RoomMapData): boolean { - if(!data) return false; + if (!data) return false; this.reset(); @@ -1235,23 +1235,23 @@ export class RoomPlaneParser this.initializeTileMap(width, height); - if(data.tileMap) + if (data.tileMap) { let y = 0; - while(y < data.tileMap.length) + while (y < data.tileMap.length) { const row = data.tileMap[y]; - if(row) + if (row) { let x = 0; - while(x < row.length) + while (x < row.length) { const column = row[x]; - if(column) this.setTileHeight(x, y, column.height); + if (column) this.setTileHeight(x, y, column.height); x++; } @@ -1261,15 +1261,15 @@ export class RoomPlaneParser } } - if(data.holeMap && data.holeMap.length) + if (data.holeMap && data.holeMap.length) { let index = 0; - while(index < data.holeMap.length) + while (index < data.holeMap.length) { const hole = data.holeMap[index]; - if(!hole) continue; + if (!hole) continue; this.addFloorHole(hole.id, hole.x, hole.y, hole.width, hole.height); @@ -1291,7 +1291,7 @@ export class RoomPlaneParser private addPlane(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[] = null): RoomPlaneData { - if(((_arg_3.length == 0) || (_arg_4.length == 0))) + if (((_arg_3.length == 0) || (_arg_4.length == 0))) { return null; } @@ -1318,14 +1318,14 @@ export class RoomPlaneParser let y = 0; - while(y < this._height) + while (y < this._height) { const tileRow: { height: number }[] = []; const tileMatrix = this._tileMatrixOriginal[y]; let x = 0; - while(x < this._width) + while (x < this._width) { const tileHeight = tileMatrix[x]; @@ -1339,9 +1339,9 @@ export class RoomPlaneParser y++; } - for(const [ holeId, holeData ] of this._floorHoles.entries()) + for (const [holeId, holeData] of this._floorHoles.entries()) { - if(!holeData) continue; + if (!holeData) continue; data.holeMap.push({ id: holeId, @@ -1357,55 +1357,55 @@ export class RoomPlaneParser public getPlaneLocation(k: number): IVector3D { - if(((k < 0) || (k >= this.planeCount))) return null; + if (((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if(!planeData) return null; + if (!planeData) return null; return planeData.loc; } public getPlaneNormal(k: number): IVector3D { - if(((k < 0) || (k >= this.planeCount))) return null; + if (((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if(!planeData) return null; + if (!planeData) return null; return planeData.normal; } public getPlaneLeftSide(k: number): IVector3D { - if(((k < 0) || (k >= this.planeCount))) return null; + if (((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if(!planeData) return null; + if (!planeData) return null; return planeData.leftSide; } public getPlaneRightSide(k: number): IVector3D { - if(((k < 0) || (k >= this.planeCount))) return null; + if (((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if(!planeData) return null; + if (!planeData) return null; return planeData.rightSide; } public getPlaneNormalDirection(k: number): IVector3D { - if(((k < 0) || (k >= this.planeCount))) return null; + if (((k < 0) || (k >= this.planeCount))) return null; const planeData = this._planes[k]; - if(!planeData) return null; + if (!planeData) return null; return planeData.normalDirection; } @@ -1414,16 +1414,16 @@ export class RoomPlaneParser { let _local_3: IVector3D[]; let _local_4: number; - if(((k < 0) || (k >= this.planeCount))) + if (((k < 0) || (k >= this.planeCount))) { return null; } const _local_2: RoomPlaneData = (this._planes[k] as RoomPlaneData); - if(_local_2 != null) + if (_local_2 != null) { _local_3 = []; _local_4 = 0; - while(_local_4 < _local_2.secondaryNormalCount) + while (_local_4 < _local_2.secondaryNormalCount) { _local_3.push(_local_2.getSecondaryNormal(_local_4)); _local_4++; @@ -1435,66 +1435,66 @@ export class RoomPlaneParser public getPlaneType(k: number): number { - if(((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; + if (((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; const planeData = this._planes[k]; - if(!planeData) return RoomPlaneData.PLANE_UNDEFINED; + if (!planeData) return RoomPlaneData.PLANE_UNDEFINED; return planeData.type; } public getPlaneMaskCount(k: number): number { - if(((k < 0) || (k >= this.planeCount))) return 0; + if (((k < 0) || (k >= this.planeCount))) return 0; const planeData = this._planes[k]; - if(!planeData) return 0; + if (!planeData) return 0; return planeData.maskCount; } public getPlaneMaskLeftSideLoc(k: number, _arg_2: number): number { - if(((k < 0) || (k >= this.planeCount))) return -1; + if (((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if(!planeData) return -1; + if (!planeData) return -1; return planeData.getMaskLeftSideLoc(_arg_2); } public getPlaneMaskRightSideLoc(k: number, _arg_2: number): number { - if(((k < 0) || (k >= this.planeCount))) return -1; + if (((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if(!planeData) return -1; + if (!planeData) return -1; return planeData.getMaskRightSideLoc(_arg_2); } public getPlaneMaskLeftSideLength(k: number, _arg_2: number): number { - if(((k < 0) || (k >= this.planeCount))) return -1; + if (((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if(!planeData) return -1; + if (!planeData) return -1; return planeData.getMaskLeftSideLength(_arg_2); } public getPlaneMaskRightSideLength(k: number, _arg_2: number): number { - if(((k < 0) || (k >= this.planeCount))) return -1; + if (((k < 0) || (k >= this.planeCount))) return -1; const planeData = this._planes[k]; - if(!planeData) return -1; + if (!planeData) return -1; return planeData.getMaskRightSideLength(_arg_2); } @@ -1521,27 +1521,27 @@ export class RoomPlaneParser let k: number; let _local_2: number; let _local_3: boolean[]; - let _local_5:RoomFloorHole; + let _local_5: RoomFloorHole; let _local_6: number; let _local_7: number; let _local_8: number; let _local_9: number; _local_2 = 0; - while(_local_2 < this._height) + while (_local_2 < this._height) { _local_3 = this._floorHoleMatrix[_local_2]; k = 0; - while(k < this._width) + while (k < this._width) { _local_3[k] = false; k++; } _local_2++; } - for(const _local_4 of this._floorHoles.values()) + for (const _local_4 of this._floorHoles.values()) { _local_5 = _local_4; - if(_local_5 != null) + if (_local_5 != null) { _local_6 = _local_5.x; _local_7 = ((_local_5.x + _local_5.width) - 1); @@ -1552,11 +1552,11 @@ export class RoomPlaneParser _local_8 = ((_local_8 < 0) ? 0 : _local_8); _local_9 = ((_local_9 >= this._height) ? (this._height - 1) : _local_9); _local_2 = _local_8; - while(_local_2 <= _local_9) + while (_local_2 <= _local_9) { _local_3 = this._floorHoleMatrix[_local_2]; k = _local_6; - while(k <= _local_7) + while (k <= _local_7) { _local_3[k] = true; k++; @@ -1590,19 +1590,19 @@ export class RoomPlaneParser const _local_3: number = k[0].length; const _local_4: boolean[][] = []; let _local_5 = 0; - while(_local_5 < _local_2) + while (_local_5 < _local_2) { _local_4[_local_5] = []; _local_5++; } let _local_6 = 0; - while(_local_6 < _local_2) + while (_local_6 < _local_2) { _local_7 = 0; - while(_local_7 < _local_3) + while (_local_7 < _local_3) { _local_8 = k[_local_6][_local_7]; - if(((_local_8 < 0) || (_local_4[_local_6][_local_7]))) + if (((_local_8 < 0) || (_local_4[_local_6][_local_7]))) { // } @@ -1611,9 +1611,9 @@ export class RoomPlaneParser _local_11 = ((_local_7 == 0) || (!(k[_local_6][(_local_7 - 1)] == _local_8))); _local_12 = ((_local_6 == 0) || (!(k[(_local_6 - 1)][_local_7] == _local_8))); _local_9 = (_local_7 + 1); - while(_local_9 < _local_3) + while (_local_9 < _local_3) { - if((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) + if ((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) { break; } @@ -1622,14 +1622,14 @@ export class RoomPlaneParser _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); _local_17 = false; _local_10 = (_local_6 + 1); - while(((_local_10 < _local_2) && (!(_local_17)))) + while (((_local_10 < _local_2) && (!(_local_17)))) { _local_14 = (!(k[_local_10][_local_7] == _local_8)); _local_17 = (((_local_14) || ((_local_7 > 0) && ((k[_local_10][(_local_7 - 1)] == _local_8) == _local_11))) || ((_local_9 < _local_3) && ((k[_local_10][_local_9] == _local_8) == _local_13))); _local_15 = _local_7; - while(_local_15 < _local_9) + while (_local_15 < _local_9) { - if((k[_local_10][_local_15] == _local_8) == _local_14) + if ((k[_local_10][_local_15] == _local_8) == _local_14) { _local_17 = true; _local_9 = _local_15; @@ -1637,7 +1637,7 @@ export class RoomPlaneParser } _local_15++; } - if(_local_17) + if (_local_17) { break; } @@ -1646,10 +1646,10 @@ export class RoomPlaneParser _local_14 = ((_local_14) || (_local_10 == _local_2)); _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); _local_16 = _local_6; - while(_local_16 < _local_10) + while (_local_16 < _local_10) { _local_15 = _local_7; - while(_local_15 < _local_9) + while (_local_15 < _local_9) { _local_4[_local_16][_local_15] = true; _local_15++; diff --git a/src/nitro/room/object/RoomWallData.ts b/src/nitro/room/object/RoomWallData.ts index 3b0cdba3..f5058a81 100644 --- a/src/nitro/room/object/RoomWallData.ts +++ b/src/nitro/room/object/RoomWallData.ts @@ -1,6 +1,6 @@ import { Point } from '@pixi/math'; -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; export class RoomWallData { @@ -47,7 +47,7 @@ export class RoomWallData public addWall(k: Point, _arg_2: number, _arg_3: number, _arg_4: boolean, _arg_5: boolean): void { - if(((this._addDuplicates) || (this.checkIsNotDuplicate(k, _arg_2, _arg_3, _arg_4, _arg_5)))) + if (((this._addDuplicates) || (this.checkIsNotDuplicate(k, _arg_2, _arg_3, _arg_4, _arg_5)))) { this._corners.push(k); this._directions.push(_arg_2); @@ -65,9 +65,9 @@ export class RoomWallData { let _local_6 = 0; - while(_local_6 < this._count) + while (_local_6 < this._count) { - if(((((((this._corners[_local_6].x == k.x) && (this._corners[_local_6].y == k.y)) && (this._directions[_local_6] == _arg_2)) && (this._lengths[_local_6] == _arg_3)) && (this._borders[_local_6] == _arg_4)) && (this._leftTurns[_local_6] == _arg_5))) + if (((((((this._corners[_local_6].x == k.x) && (this._corners[_local_6].y == k.y)) && (this._directions[_local_6] == _arg_2)) && (this._lengths[_local_6] == _arg_3)) && (this._borders[_local_6] == _arg_4)) && (this._leftTurns[_local_6] == _arg_5))) { return false; } @@ -134,7 +134,7 @@ export class RoomWallData public setLength(k: number, _arg_2: number): void { - if(_arg_2 < this._lengths[k]) + if (_arg_2 < this._lengths[k]) { this._lengths[k] = _arg_2; this._manuallyRightCut[k] = true; @@ -144,7 +144,7 @@ export class RoomWallData public moveCorner(k: number, _arg_2: number): void { let _local_3: IVector3D; - if(((_arg_2 > 0) && (_arg_2 < this._lengths[k]))) + if (((_arg_2 > 0) && (_arg_2 < this._lengths[k]))) { const corner = this._corners[k]; @@ -160,13 +160,13 @@ export class RoomWallData let k: number; let _local_2: Point; let _local_3: Point; - let _local_4:IVector3D; + let _local_4: IVector3D; let _local_5: number; - if(this._endPoints.length != this.count) + if (this._endPoints.length != this.count) { this._endPoints = []; k = 0; - while(k < this.count) + while (k < this.count) { _local_2 = this.getCorner(k); _local_3 = new Point(_local_2.x, _local_2.y); diff --git a/src/nitro/room/object/data/IObjectData.ts b/src/nitro/room/object/data/IObjectData.ts index 879e137d..d8b350ae 100644 --- a/src/nitro/room/object/data/IObjectData.ts +++ b/src/nitro/room/object/data/IObjectData.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../api'; -import { IRoomObjectModel } from '../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../api'; export interface IObjectData { diff --git a/src/nitro/room/object/data/ObjectDataBase.ts b/src/nitro/room/object/data/ObjectDataBase.ts index 076fef18..67787294 100644 --- a/src/nitro/room/object/data/ObjectDataBase.ts +++ b/src/nitro/room/object/data/ObjectDataBase.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../api'; -import { IRoomObjectModel } from '../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../api'; import { RoomObjectVariable } from '../RoomObjectVariable'; import { IObjectData } from './IObjectData'; import { ObjectDataFlags } from './ObjectDataFlags'; diff --git a/src/nitro/room/object/data/type/CrackableDataType.ts b/src/nitro/room/object/data/type/CrackableDataType.ts index c120fc52..7a80d82c 100644 --- a/src/nitro/room/object/data/type/CrackableDataType.ts +++ b/src/nitro/room/object/data/type/CrackableDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/EmptyDataType.ts b/src/nitro/room/object/data/type/EmptyDataType.ts index 0ba8ab5e..2f8b99bf 100644 --- a/src/nitro/room/object/data/type/EmptyDataType.ts +++ b/src/nitro/room/object/data/type/EmptyDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/HighScoreDataType.ts b/src/nitro/room/object/data/type/HighScoreDataType.ts index 18da147c..634112bf 100644 --- a/src/nitro/room/object/data/type/HighScoreDataType.ts +++ b/src/nitro/room/object/data/type/HighScoreDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/LegacyDataType.ts b/src/nitro/room/object/data/type/LegacyDataType.ts index f143f4c2..655dc518 100644 --- a/src/nitro/room/object/data/type/LegacyDataType.ts +++ b/src/nitro/room/object/data/type/LegacyDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/MapDataType.ts b/src/nitro/room/object/data/type/MapDataType.ts index e72ca7c7..5024e01d 100644 --- a/src/nitro/room/object/data/type/MapDataType.ts +++ b/src/nitro/room/object/data/type/MapDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/NumberDataType.ts b/src/nitro/room/object/data/type/NumberDataType.ts index 69db36a6..00a24bd0 100644 --- a/src/nitro/room/object/data/type/NumberDataType.ts +++ b/src/nitro/room/object/data/type/NumberDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/StringDataType.ts b/src/nitro/room/object/data/type/StringDataType.ts index 431de63d..1de6d89d 100644 --- a/src/nitro/room/object/data/type/StringDataType.ts +++ b/src/nitro/room/object/data/type/StringDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/data/type/VoteDataType.ts b/src/nitro/room/object/data/type/VoteDataType.ts index 52c4139f..df31ffa7 100644 --- a/src/nitro/room/object/data/type/VoteDataType.ts +++ b/src/nitro/room/object/data/type/VoteDataType.ts @@ -1,5 +1,4 @@ -import { IMessageDataWrapper } from '../../../../../api'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IMessageDataWrapper, IRoomObjectModel } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IObjectData } from '../IObjectData'; import { ObjectDataBase } from '../ObjectDataBase'; diff --git a/src/nitro/room/object/logic/MovingObjectLogic.ts b/src/nitro/room/object/logic/MovingObjectLogic.ts index 101cc160..0cbfa2df 100644 --- a/src/nitro/room/object/logic/MovingObjectLogic.ts +++ b/src/nitro/room/object/logic/MovingObjectLogic.ts @@ -1,8 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObjectController } from '../../../../room/object/IRoomObjectController'; -import { RoomObjectLogicBase } from '../../../../room/object/logic/RoomObjectLogicBase'; -import { IVector3D } from '../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../room/utils/Vector3d'; +import { IRoomObjectController, IRoomObjectUpdateMessage, IVector3D } from '../../../../api'; +import { RoomObjectLogicBase, Vector3d } from '../../../../room'; import { ObjectMoveUpdateMessage } from '../../messages/ObjectMoveUpdateMessage'; import { RoomObjectVariable } from '../RoomObjectVariable'; @@ -46,11 +43,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase const locationOffset = this.getLocationOffset(); const model = this.object && this.object.model; - if(model) + if (model) { - if(locationOffset) + if (locationOffset) { - if(this._liftAmount !== locationOffset.z) + if (this._liftAmount !== locationOffset.z) { this._liftAmount = locationOffset.z; @@ -59,7 +56,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase } else { - if(this._liftAmount !== 0) + if (this._liftAmount !== 0) { this._liftAmount = 0; @@ -68,17 +65,17 @@ export class MovingObjectLogic extends RoomObjectLogicBase } } - if((this._locationDelta.length > 0) || locationOffset) + if ((this._locationDelta.length > 0) || locationOffset) { const vector = MovingObjectLogic.TEMP_VECTOR; let difference = (this.time - this._changeTime); - if(difference === (this._updateInterval >> 1)) difference++; + if (difference === (this._updateInterval >> 1)) difference++; - if(difference > this._updateInterval) difference = this._updateInterval; + if (difference > this._updateInterval) difference = this._updateInterval; - if(this._locationDelta.length > 0) + if (this._locationDelta.length > 0) { vector.assign(this._locationDelta); vector.multiply((difference / this._updateInterval)); @@ -89,11 +86,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase vector.assign(this._location); } - if(locationOffset) vector.add(locationOffset); + if (locationOffset) vector.add(locationOffset); this.object.setLocation(vector); - if(difference === this._updateInterval) + if (difference === this._updateInterval) { this._locationDelta.x = 0; this._locationDelta.y = 0; @@ -108,23 +105,23 @@ export class MovingObjectLogic extends RoomObjectLogicBase { super.setObject(object); - if(object) this._location.assign(object.getLocation()); + if (object) this._location.assign(object.getLocation()); } - public processUpdateMessage(message: RoomObjectUpdateMessage): void + public processUpdateMessage(message: IRoomObjectUpdateMessage): void { - if(!message) return; + if (!message) return; super.processUpdateMessage(message); - if(message.location) this._location.assign(message.location); + if (message.location) this._location.assign(message.location); - if(message instanceof ObjectMoveUpdateMessage) return this.processMoveMessage(message); + if (message instanceof ObjectMoveUpdateMessage) return this.processMoveMessage(message); } private processMoveMessage(message: ObjectMoveUpdateMessage): void { - if(!message || !this.object || !message.location) return; + if (!message || !this.object || !message.location) return; this._changeTime = this._lastUpdateTime; @@ -144,7 +141,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase protected set updateInterval(interval: number) { - if(interval <= 0) interval = 1; + if (interval <= 0) interval = 1; this._updateInterval = interval; } diff --git a/src/nitro/room/object/logic/avatar/AvatarLogic.ts b/src/nitro/room/object/logic/avatar/AvatarLogic.ts index 80d2af34..8c494661 100644 --- a/src/nitro/room/object/logic/avatar/AvatarLogic.ts +++ b/src/nitro/room/object/logic/avatar/AvatarLogic.ts @@ -1,10 +1,6 @@ -import { RoomObjectMouseEvent } from '../../../../../room/events/RoomObjectMouseEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { IRoomGeometry, IRoomObjectModel } from '../../../../../api'; +import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent, Vector3d } from '../../../../../room'; import { AvatarAction } from '../../../../avatar/enum/AvatarAction'; import { Nitro } from '../../../../Nitro'; import { MouseEventType } from '../../../../ui/MouseEventType'; @@ -83,16 +79,16 @@ export class AvatarLogic extends MovingObjectLogic public getEventTypes(): string[] { - const types = [ RoomObjectMouseEvent.CLICK, RoomObjectMoveEvent.POSITION_CHANGED, RoomObjectMouseEvent.MOUSE_ENTER, RoomObjectMouseEvent.MOUSE_LEAVE, RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW ]; + const types = [RoomObjectMouseEvent.CLICK, RoomObjectMoveEvent.POSITION_CHANGED, RoomObjectMouseEvent.MOUSE_ENTER, RoomObjectMouseEvent.MOUSE_LEAVE, RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW]; return this.mergeTypes(super.getEventTypes(), types); } public dispose(): void { - if(this._selected && this.object) + if (this._selected && this.object) { - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); } super.dispose(); @@ -104,15 +100,15 @@ export class AvatarLogic extends MovingObjectLogic { super.update(time); - if(this._selected && this.object) + if (this._selected && this.object) { - if(this.eventDispatcher) + if (this.eventDispatcher) { const location = this.object.getLocation(); - if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) + if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) { - if(!this._reportedLocation) this._reportedLocation = new Vector3d(); + if (!this._reportedLocation) this._reportedLocation = new Vector3d(); this._reportedLocation.assign(location); @@ -123,14 +119,14 @@ export class AvatarLogic extends MovingObjectLogic const model = this.object && this.object.model; - if(model) this.updateModel(this.time, model); + if (model) this.updateModel(this.time, model); } private updateModel(time: number, model: IRoomObjectModel): void { - if(this._talkingEndTimestamp > 0) + if (this._talkingEndTimestamp > 0) { - if(time > this._talkingEndTimestamp) + if (time > this._talkingEndTimestamp) { model.setValue(RoomObjectVariable.FIGURE_TALK, 0); @@ -140,14 +136,14 @@ export class AvatarLogic extends MovingObjectLogic } else { - if(!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) + if (!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) { this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp(); this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp(); } else { - if((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) + if ((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_TALK, 0); @@ -155,7 +151,7 @@ export class AvatarLogic extends MovingObjectLogic } else { - if((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) + if ((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_TALK, 1); @@ -166,30 +162,30 @@ export class AvatarLogic extends MovingObjectLogic } } - if((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) + if ((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); this._animationEndTimestamp = 0; } - if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) + if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0); this._gestureEndTimestamp = 0; } - if((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) + if ((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_SIGN, -1); this._signEndTimestamp = 0; } - if(this._carryObjectEndTimestamp > 0) + if (this._carryObjectEndTimestamp > 0) { - if(time > this._carryObjectEndTimestamp) + if (time > this._carryObjectEndTimestamp) { model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); @@ -200,11 +196,11 @@ export class AvatarLogic extends MovingObjectLogic } } - if(this._allowUseCarryObject) + if (this._allowUseCarryObject) { - if((time - this._carryObjectStartTimestamp) > 5000) + if ((time - this._carryObjectStartTimestamp) > 5000) { - if(((time - this._carryObjectStartTimestamp) % 10000) < 1000) + if (((time - this._carryObjectStartTimestamp) % 10000) < 1000) { model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1); } @@ -215,7 +211,7 @@ export class AvatarLogic extends MovingObjectLogic } } - if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) + if ((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_BLINK, 1); @@ -223,21 +219,21 @@ export class AvatarLogic extends MovingObjectLogic this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp(); } - if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) + if ((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_BLINK, 0); this._blinkingEndTimestamp = 0; } - if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) + if ((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) { model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect); this._effectChangeTimeStamp = 0; } - if((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) + if ((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) { model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0); @@ -247,15 +243,15 @@ export class AvatarLogic extends MovingObjectLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(!message || !this.object) return; + if (!message || !this.object) return; super.processUpdateMessage(message); const model = this.object && this.object.model; - if(!model) return; + if (!model) return; - if(message instanceof ObjectAvatarPostureUpdateMessage) + if (message instanceof ObjectAvatarPostureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter); @@ -263,7 +259,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarChatUpdateMessage) + if (message instanceof ObjectAvatarChatUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_TALK, 1); @@ -272,28 +268,28 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarTypingUpdateMessage) + if (message instanceof ObjectAvatarTypingUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0); return; } - if(message instanceof ObjectAvatarMutedUpdateMessage) + if (message instanceof ObjectAvatarMutedUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0)); return; } - if(message instanceof ObjectAvatarPlayingGameUpdateMessage) + if (message instanceof ObjectAvatarPlayingGameUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0)); return; } - if(message instanceof ObjectAvatarUpdateMessage) + if (message instanceof ObjectAvatarUpdateMessage) { model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp); @@ -302,7 +298,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarGestureUpdateMessage) + if (message instanceof ObjectAvatarGestureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); @@ -311,35 +307,35 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarExpressionUpdateMessage) + if (message instanceof ObjectAvatarExpressionUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType); this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue(RoomObjectVariable.FIGURE_EXPRESSION)); - if(this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; + if (this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; return; } - if(message instanceof ObjectAvatarDanceUpdateMessage) + if (message instanceof ObjectAvatarDanceUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle); return; } - if(message instanceof ObjectAvatarSleepUpdateMessage) + if (message instanceof ObjectAvatarSleepUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); - if(message.isSleeping) this._blinkingStartTimestamp = -1; + if (message.isSleeping) this._blinkingStartTimestamp = -1; else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp()); return; } - if(message instanceof ObjectAvatarPlayerValueUpdateMessage) + if (message instanceof ObjectAvatarPlayerValueUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value); @@ -348,19 +344,19 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarEffectUpdateMessage) + if (message instanceof ObjectAvatarEffectUpdateMessage) { this.updateAvatarEffect(message.effect, message.delayMilliseconds, model); return; } - if(message instanceof ObjectAvatarCarryObjectUpdateMessage) + if (message instanceof ObjectAvatarCarryObjectUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); - if(message.itemType === 0) + if (message.itemType === 0) { this._carryObjectStartTimestamp = 0; this._carryObjectEndTimestamp = 0; @@ -370,7 +366,7 @@ export class AvatarLogic extends MovingObjectLogic { this._carryObjectStartTimestamp = this.time; - if(message.itemType < AvatarLogic.MAX_HAND_ID) + if (message.itemType < AvatarLogic.MAX_HAND_ID) { this._carryObjectEndTimestamp = 0; this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID; @@ -385,14 +381,14 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarUseObjectUpdateMessage) + if (message instanceof ObjectAvatarUseObjectUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType); return; } - if(message instanceof ObjectAvatarSignUpdateMessage) + if (message instanceof ObjectAvatarSignUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType); @@ -401,14 +397,14 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarFlatControlUpdateMessage) + if (message instanceof ObjectAvatarFlatControlUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level); return; } - if(message instanceof ObjectAvatarFigureUpdateMessage) + if (message instanceof ObjectAvatarFigureUpdateMessage) { model.setValue(RoomObjectVariable.FIGURE, message.figure); model.setValue(RoomObjectVariable.GENDER, message.gender); @@ -416,7 +412,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarSelectedMessage) + if (message instanceof ObjectAvatarSelectedMessage) { this._selected = message.selected; this._reportedLocation = null; @@ -424,7 +420,7 @@ export class AvatarLogic extends MovingObjectLogic return; } - if(message instanceof ObjectAvatarOwnMessage) + if (message instanceof ObjectAvatarOwnMessage) { model.setValue(RoomObjectVariable.OWN_USER, 1); @@ -434,19 +430,19 @@ export class AvatarLogic extends MovingObjectLogic private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void { - if(effect === AvatarLogic.EFFECT_TYPE_SPLASH) + if (effect === AvatarLogic.EFFECT_TYPE_SPLASH) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM; } - else if(effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) + else if (effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK; } - else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) + else if (model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = effect; @@ -454,7 +450,7 @@ export class AvatarLogic extends MovingObjectLogic effect = AvatarLogic.EFFECT_TYPE_SPLASH; } - else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) + else if (model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) { this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._newEffect = effect; @@ -462,7 +458,7 @@ export class AvatarLogic extends MovingObjectLogic effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK; } - else if(delay === 0) + else if (delay === 0) { this._effectChangeTimeStamp = 0; } @@ -482,7 +478,7 @@ export class AvatarLogic extends MovingObjectLogic { let eventType: string = null; - switch(event.type) + switch (event.type) { case MouseEventType.MOUSE_CLICK: eventType = RoomObjectMouseEvent.CLICK; @@ -490,20 +486,20 @@ export class AvatarLogic extends MovingObjectLogic case MouseEventType.ROLL_OVER: eventType = RoomObjectMouseEvent.MOUSE_ENTER; - if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); + if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); break; case MouseEventType.ROLL_OUT: eventType = RoomObjectMouseEvent.MOUSE_LEAVE; - if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); + if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); break; } - if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); } private randomTalkingPauseStartTimestamp(): number diff --git a/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts index 17512e83..853734b0 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts @@ -1,5 +1,4 @@ -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectEvent, RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectBadgeAssetEvent } from '../../../events/RoomObjectBadgeAssetEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectGroupBadgeUpdateMessage } from '../../../messages/ObjectGroupBadgeUpdateMessage'; @@ -18,7 +17,7 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo public getEventTypes(): string[] { - const types = [ RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED, RoomObjectBadgeAssetEvent.LOAD_BADGE ]; + const types = [RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED, RoomObjectBadgeAssetEvent.LOAD_BADGE]; return this.mergeTypes(super.getEventTypes(), types); } @@ -27,17 +26,17 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo { super.processUpdateMessage(message); - if(message instanceof ObjectGroupBadgeUpdateMessage) + if (message instanceof ObjectGroupBadgeUpdateMessage) { - if(message.assetName !== 'loading_icon') + if (message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE, FurnitureAchievementResolutionLogic.BADGE_VISIBLE_IN_STATE); } } - if(message instanceof ObjectSelectedMessage) + if (message instanceof ObjectSelectedMessage) { - if(!this.eventDispatcher || !this.object) return; + if (!this.eventDispatcher || !this.object) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); } @@ -45,11 +44,11 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; let event: RoomObjectEvent = null; - switch(this.object.getState(0)) + switch (this.object.getState(0)) { case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_NOT_STARTED: case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_IN_PROGRESS: @@ -63,12 +62,12 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo break; } - if(event) this.eventDispatcher.dispatchEvent(event); + if (event) this.eventDispatcher.dispatchEvent(event); } protected updateBadge(badgeId: string): void { - if(badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return; + if (badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return; super.updateBadge(badgeId); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts index b0f7be66..56d02f27 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts @@ -1,5 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { Nitro } from '../../../../Nitro'; +import { PixiApplicationProxy } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectBadgeAssetEvent } from '../../../events/RoomObjectBadgeAssetEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; @@ -12,7 +12,7 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic { public getEventTypes(): string[] { - const types = [ RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, RoomObjectBadgeAssetEvent.LOAD_BADGE ]; + const types = [RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, RoomObjectBadgeAssetEvent.LOAD_BADGE]; return this.mergeTypes(super.getEventTypes(), types); } @@ -21,25 +21,25 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic { super.processUpdateMessage(message); - if(!this.object) return; + if (!this.object) return; - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const data = message.data; - if(data instanceof StringDataType) this.updateBadge(data.getValue(1)); + if (data instanceof StringDataType) this.updateBadge(data.getValue(1)); return; } - if(message instanceof ObjectGroupBadgeUpdateMessage) + if (message instanceof ObjectGroupBadgeUpdateMessage) { - if(message.assetName !== 'loading_icon') + if (message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME, message.assetName); this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, 1); - this.update(Nitro.instance.time); + this.update(PixiApplicationProxy.instance.ticker.lastTime); } return; @@ -48,16 +48,16 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object)); } protected updateBadge(badgeId: string): void { - if(badgeId === '') return; + if (badgeId === '') return; - if(this.eventDispatcher) + if (this.eventDispatcher) { this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1); diff --git a/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts index b027816f..7179bdfb 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts @@ -1,6 +1,5 @@ -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectStateChangedEvent } from '../../../events/RoomObjectStateChangedEvent'; import { FurnitureLogic } from './FurnitureLogic'; @@ -9,21 +8,21 @@ export class FurnitureCounterClockLogic extends FurnitureLogic { public getEventTypes(): string[] { - const types = [ RoomObjectStateChangedEvent.STATE_CHANGE ]; + const types = [RoomObjectStateChangedEvent.STATE_CHANGE]; return this.mergeTypes(super.getEventTypes(), types); } public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event|| !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch(event.type) + switch (event.type) { case MouseEventType.DOUBLE_CLICK: - switch(event.spriteTag) + switch (event.spriteTag) { case 'start_stop': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); @@ -33,7 +32,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic break; } - if(this.eventDispatcher && objectEvent) + if (this.eventDispatcher && objectEvent) { this.eventDispatcher.dispatchEvent(objectEvent); @@ -47,7 +46,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts index f0add598..0fa5073e 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui/widget/enums/RoomWidgetEnumItemExtradataParameter'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureLogic } from './FurnitureLogic'; @@ -9,9 +9,9 @@ export class FurnitureCrackableLogic extends FurnitureLogic { super.processUpdateMessage(message); - if(!this.object) return; + if (!this.object) return; - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.CRACKABLE_FURNI); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts index 15c3a38b..0ea2d3ab 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts @@ -1,6 +1,5 @@ -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { FurnitureLogic } from './FurnitureLogic'; @@ -20,23 +19,23 @@ export class FurnitureDiceLogic extends FurnitureLogic public getEventTypes(): string[] { - const types = [ RoomObjectFurnitureActionEvent.DICE_ACTIVATE, RoomObjectFurnitureActionEvent.DICE_OFF ]; + const types = [RoomObjectFurnitureActionEvent.DICE_ACTIVATE, RoomObjectFurnitureActionEvent.DICE_OFF]; return this.mergeTypes(super.getEventTypes(), types); } public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch(event.type) + switch (event.type) { case MouseEventType.DOUBLE_CLICK: - if(this._noTags) + if (this._noTags) { - if(((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + if (((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); @@ -51,22 +50,22 @@ export class FurnitureDiceLogic extends FurnitureLogic } else { - if(((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + if (((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); } - else if(event.spriteTag === 'deactivate') + else if (event.spriteTag === 'deactivate') { objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_OFF, this.object); } } - if(objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent); + if (objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent); return; } super.mouseEvent(event, geometry); } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts index e2d1a7b6..a276450a 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts @@ -1,6 +1,5 @@ -import { IAssetData } from '../../../../../api'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IAssetData, IRoomGeometry } from '../../../../../api'; +import { RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts index 6c468547..a12e1333 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts @@ -1,7 +1,5 @@ -import { IAssetData, IParticleSystem } from '../../../../../api'; -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IAssetData, IParticleSystem, IRoomGeometry } from '../../../../../api'; +import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectStateChangedEvent } from '../../../events/RoomObjectStateChangedEvent'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts index 9566082f..5657bf39 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts @@ -1,5 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { RoomObjectUpdateMessage, Vector3d } from '../../../../../room'; import { RoomObjectFloorHoleEvent } from '../../../events/RoomObjectFloorHoleEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { RoomObjectVariable } from '../../RoomObjectVariable'; @@ -22,14 +21,14 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic public getEventTypes(): string[] { - const types = [ RoomObjectFloorHoleEvent.ADD_HOLE, RoomObjectFloorHoleEvent.REMOVE_HOLE ]; + const types = [RoomObjectFloorHoleEvent.ADD_HOLE, RoomObjectFloorHoleEvent.REMOVE_HOLE]; return this.mergeTypes(super.getEventTypes(), types); } protected onDispose(): void { - if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); } @@ -48,26 +47,26 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(!this.object) return; + if (!this.object) return; - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { this.handleStateUpdate(this.object.getState(0)); } const location = this.object.getLocation(); - if(!this._currentLocation) + if (!this._currentLocation) { this._currentLocation = new Vector3d(); } else { - if((location.x !== this._currentLocation.x) || (location.y !== this._currentLocation.y)) + if ((location.x !== this._currentLocation.x) || (location.y !== this._currentLocation.y)) { - if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); } } } @@ -77,16 +76,16 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic private handleStateUpdate(state: number): void { - if(state === this._currentState) return; + if (state === this._currentState) return; - if(this.eventDispatcher) + if (this.eventDispatcher) { - if(state === FurnitureFloorHoleLogic.STATE_HOLE) + if (state === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); } - else if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + else if (this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) { this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); } @@ -97,14 +96,14 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic private handleAutomaticStateUpdate(): void { - if(!this.object) return; + if (!this.object) return; const model = this.object.model; - if(!model) return; + if (!model) return; const stateIndex = model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); - if(!isNaN(stateIndex)) this.handleStateUpdate((stateIndex % 2)); + if (!isNaN(stateIndex)) this.handleStateUpdate((stateIndex % 2)); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts index b321403b..f0cefb8b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts @@ -1,5 +1,5 @@ import { IAssetData } from '../../../../../api'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { ContextMenuEnum } from '../../../../ui'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts index 104544ff..4bf84158 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts @@ -1,6 +1,6 @@ -import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { Nitro } from '../../../../Nitro'; +import { IRoomGeometry } from '../../../../../api'; +import { PixiApplicationProxy } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui'; import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events'; import { ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages'; @@ -31,11 +31,11 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const data = message.data; - if(data instanceof StringDataType) + if (data instanceof StringDataType) { this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY)); this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY)); @@ -43,19 +43,19 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic } } - else if(message instanceof ObjectGroupBadgeUpdateMessage) + else if (message instanceof ObjectGroupBadgeUpdateMessage) { - if(message.assetName !== 'loading_icon') + if (message.assetName !== 'loading_icon') { this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName); - this.update(Nitro.instance.time); + this.update(PixiApplicationProxy.instance.ticker.lastTime); } } - else if(message instanceof ObjectSelectedMessage) + else if (message instanceof ObjectSelectedMessage) { - if(!message.selected) + if (!message.selected) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); } @@ -80,9 +80,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; - switch(event.type) + switch (event.type) { case MouseEventType.MOUSE_CLICK: this.openContextMenu(); diff --git a/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts index 5c946ea4..0f95cc24 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { RoomObjectVariable } from '../../RoomObjectVariable'; @@ -12,12 +12,12 @@ export class FurnitureHighScoreLogic extends FurnitureLogic public getEventTypes(): string[] { - return [ RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY ]; + return [RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY]; } public tearDown(): void { - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY, this.object)); } @@ -29,11 +29,11 @@ export class FurnitureHighScoreLogic extends FurnitureLogic { super.processUpdateMessage(message); - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { - if(message.state === FurnitureHighScoreLogic.SHOW_WIDGET_IN_STATE) + if (message.state === FurnitureHighScoreLogic.SHOW_WIDGET_IN_STATE) { this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts index d75ff426..0aa49e1b 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts @@ -1,6 +1,5 @@ -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectStateChangedEvent } from '../../../events/RoomObjectStateChangedEvent'; import { FurnitureLogic } from './FurnitureLogic'; @@ -9,21 +8,21 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic { public getEventTypes(): string[] { - const types = [ RoomObjectStateChangedEvent.STATE_CHANGE ]; + const types = [RoomObjectStateChangedEvent.STATE_CHANGE]; return this.mergeTypes(super.getEventTypes(), types); } public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; let objectEvent: RoomObjectEvent = null; - switch(event.type) + switch (event.type) { case MouseEventType.DOUBLE_CLICK: - switch(event.spriteTag) + switch (event.spriteTag) { case 'off': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3); @@ -31,7 +30,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic } break; case MouseEventType.MOUSE_CLICK: - switch(event.spriteTag) + switch (event.spriteTag) { case 'inc': objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2); @@ -43,7 +42,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic break; } - if(this.eventDispatcher && objectEvent) + if (this.eventDispatcher && objectEvent) { this.eventDispatcher.dispatchEvent(objectEvent); @@ -55,8 +54,8 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3)); } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts index 3d41f51f..21e48eec 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { LegacyDataType } from '../../data/type/LegacyDataType'; import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; @@ -19,7 +19,7 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic public update(totalTimeRunning: number): void { - if((this._nextStateTimestamp > 0) && (totalTimeRunning >= this._nextStateTimestamp)) + if ((this._nextStateTimestamp > 0) && (totalTimeRunning >= this._nextStateTimestamp)) { this._nextStateTimestamp = 0; @@ -35,7 +35,7 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { this.processUpdate(message); @@ -47,12 +47,12 @@ export class FurnitureIceStormLogic extends FurnitureMultiStateLogic private processUpdate(message: ObjectDataUpdateMessage): void { - if(!message) return; + if (!message) return; const state = ~~(message.state / 1000); const time = ~~(message.state % 1000); - if(!time) + if (!time) { this._nextStateTimestamp = 0; diff --git a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts index 1a35fd26..3690aba5 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts @@ -1,6 +1,5 @@ -import { IAssetData } from '../../../../../api'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IAssetData, IRoomGeometry } from '../../../../../api'; +import { RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts index 8b7a70dc..736c5815 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui'; import { RoomObjectStateChangedEvent } from '../../../events'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; @@ -37,29 +37,29 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if(!this._isInitialized) this.requestInit(); + if (!this._isInitialized) this.requestInit(); this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const state = this.object.getState(0); - if(state !== this._currentState) + if (state !== this._currentState) { this._currentState = state; - if(state === 1) this.requestPlayList(); - else if(state === 0) this.requestStopPlaying(); + if (state === 1) this.requestPlayList(); + else if (state === 0) this.requestStopPlaying(); } } } private requestInit(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -70,7 +70,7 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic private requestPlayList(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -79,21 +79,21 @@ export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic private requestStopPlaying(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP, this.object)); } private requestDispose(): void { - if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + if (!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE, this.object)); } public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, -1)); diff --git a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts index 1ddc3062..49fb4e16 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureLogic.ts @@ -1,12 +1,5 @@ -import { IAssetData } from '../../../../../api'; -import { RoomObjectMouseEvent } from '../../../../../room/events/RoomObjectMouseEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObjectController } from '../../../../../room/object/IRoomObjectController'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { IAssetData, IRoomGeometry, IRoomObjectController, IRoomObjectModel, IVector3D } from '../../../../../api'; +import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent, Vector3d } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectRoomAdEvent } from '../../../events'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts index 827cde7c..a1312aad 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { MapDataType } from '../../data/type/MapDataType'; @@ -13,7 +13,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic public getEventTypes(): string[] { - const types = [ RoomObjectWidgetRequestEvent.MANNEQUIN ]; + const types = [RoomObjectWidgetRequestEvent.MANNEQUIN]; return this.mergeTypes(super.getEventTypes(), types); } @@ -22,7 +22,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic { super.processUpdateMessage(message); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { message.data.writeRoomObjectModel(this.object.model); @@ -32,7 +32,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic private processObjectData(): void { - if(!this.object || !this.object.model) return; + if (!this.object || !this.object.model) return; const data = new MapDataType(); @@ -45,7 +45,7 @@ export class FurnitureMannequinLogic extends FurnitureLogic public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MANNEQUIN, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts index 39b8d59d..f32f1afa 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts @@ -1,5 +1,5 @@ -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { FurnitureLogic } from './FurnitureLogic'; @@ -8,16 +8,16 @@ export class FurnitureMultiStateLogic extends FurnitureLogic { public getEventTypes(): string[] { - const types = [ RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW ]; + const types = [RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW]; return this.mergeTypes(super.getEventTypes(), types); } public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; - switch(event.type) + switch (event.type) { case MouseEventType.ROLL_OVER: this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); @@ -29,4 +29,4 @@ export class FurnitureMultiStateLogic extends FurnitureLogic super.mouseEvent(event, geometry); } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts index beb1ea73..194bd567 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts @@ -1,7 +1,5 @@ -import { IAssetData, IParticleSystem } from '../../../../../api'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IAssetData, IParticleSystem, IRoomGeometry } from '../../../../../api'; +import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; diff --git a/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts b/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts index e866772b..3eaecdc0 100644 --- a/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts @@ -1,5 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { RoomObjectUpdateMessage, Vector3d } from '../../../../../room'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { ObjectMoveUpdateMessage } from '../../../messages/ObjectMoveUpdateMessage'; import { LegacyDataType } from '../../data/type/LegacyDataType'; @@ -24,22 +23,22 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(!message) return; + if (!message) return; const isMoveMessage = (message instanceof ObjectMoveUpdateMessage); - if(this.object && !isMoveMessage && message.location) + if (this.object && !isMoveMessage && message.location) { const location = this.object.getLocation(); const difference = Vector3d.dif(message.location, location); - if(difference) + if (difference) { - if((Math.abs(difference.x) < 2) && (Math.abs(difference.y) < 2)) + if ((Math.abs(difference.x) < 2) && (Math.abs(difference.y) < 2)) { let prevLocation = location; - if((Math.abs(difference.x) > 1) || (Math.abs(difference.y) > 1)) + if ((Math.abs(difference.x) > 1) || (Math.abs(difference.y) > 1)) { prevLocation = Vector3d.sum(location, Vector3d.product(difference, 0.5)); } @@ -51,11 +50,11 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic } } - if(message.location && !isMoveMessage) super.processUpdateMessage(new ObjectMoveUpdateMessage(message.location, message.location, message.direction)); + if (message.location && !isMoveMessage) super.processUpdateMessage(new ObjectMoveUpdateMessage(message.location, message.location, message.direction)); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { - if(message.state > 0) + if (message.state > 0) { this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL / this.getUpdateIntervalValue(message.state); } @@ -69,7 +68,7 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic return; } - if(isMoveMessage && message.isSlide) this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; + if (isMoveMessage && message.isSlide) this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; super.processUpdateMessage(message); } @@ -88,7 +87,7 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic { const animation = this.getAnimationValue(message.state); - if(animation !== message.state) + if (animation !== message.state) { const legacyStuff = new LegacyDataType(); @@ -102,14 +101,14 @@ export class FurniturePushableLogic extends FurnitureMultiStateLogic public update(time: number): void { - if(!this.object) return; + if (!this.object) return; this._oldLocation.assign(this.object.getLocation()); super.update(time); - if(Vector3d.dif(this.object.getLocation(), this._oldLocation).length !== 0) return; + if (Vector3d.dif(this.object.getLocation(), this._oldLocation).length !== 0) return; - if(this.object.getState(0) !== FurniturePushableLogic.ANIMATION_NOT_MOVING) this.object.setState(FurniturePushableLogic.ANIMATION_NOT_MOVING, 0); + if (this.object.getState(0) !== FurniturePushableLogic.ANIMATION_NOT_MOVING) this.object.setState(FurniturePushableLogic.ANIMATION_NOT_MOVING, 0); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts index 42a0f6d9..31195915 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts @@ -1,6 +1,5 @@ -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectHSLColorEnableEvent } from '../../../events/RoomObjectHSLColorEnableEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; @@ -33,13 +32,13 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic protected onDispose(): void { - if(this._roomColorUpdated) + if (this._roomColorUpdated) { - if(this.eventDispatcher && this.object) + if (this.eventDispatcher && this.object) { const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if(realRoomObject === 1) + if (realRoomObject === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, false, 0, 0, 0)); } @@ -55,19 +54,19 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { message.data.writeRoomObjectModel(this.object.model); const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if(realRoomObject === 1) this.processColorUpdate(); + if (realRoomObject === 1) this.processColorUpdate(); } } private processColorUpdate(): void { - if(!this.object || !this.object.model) return; + if (!this.object || !this.object.model) return; const numberData = new NumberDataType(); @@ -78,7 +77,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic const saturation = numberData.getValue(2); const lightness = numberData.getValue(3); - if((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1)) + if ((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1)) { this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE, hue); this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION, saturation); @@ -86,7 +85,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic this.object.setState(state, 0); - if(this.eventDispatcher) + if (this.eventDispatcher) { this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, (state === 1), hue, saturation, lightness)); } @@ -97,9 +96,9 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object) return; + if (!event || !geometry || !this.object) return; - switch(event.type) + switch (event.type) { case MouseEventType.DOUBLE_CLICK: (this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object))); diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts index da18c927..d40a8c3e 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts @@ -1,4 +1,4 @@ -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IRoomObjectModel } from '../../../../../api'; import { FurnitureRoomBrandingLogic } from './FurnitureRoomBrandingLogic'; export class FurnitureRoomBackgroundLogic extends FurnitureRoomBrandingLogic @@ -7,4 +7,4 @@ export class FurnitureRoomBackgroundLogic extends FurnitureRoomBrandingLogic { return null; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts index 34dd6624..62970458 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts @@ -1,4 +1,4 @@ -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; +import { IRoomObjectModel } from '../../../../../api'; import { HabboWebTools } from '../../../../utils'; import { RoomObjectRoomAdEvent } from '../../../events'; import { RoomObjectVariable } from '../../RoomObjectVariable'; @@ -18,15 +18,15 @@ export class FurnitureRoomBillboardLogic extends FurnitureRoomBrandingLogic return model.getValue(RoomObjectVariable.FURNITURE_BRANDING_URL); } - protected handleAdClick(objectId: number, objectType: string, clickUrl: string):void + protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void { - if(clickUrl.indexOf('http') === 0) + if (clickUrl.indexOf('http') === 0) { HabboWebTools.openWebPage(clickUrl); return; } - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl)); } } diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts index 961c0cc6..33a677ee 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts @@ -1,8 +1,7 @@ import { BaseTexture, Texture } from '@pixi/core'; import { decompressFrames, parseGIF } from 'gifuct-js'; -import { IAssetData } from '../../../../../api'; -import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { IAssetData, IRoomGeometry } from '../../../../../api'; +import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; import { MouseEventType } from '../../../../ui'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui/widget/enums/RoomWidgetEnumItemExtradataParameter'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts index 15093042..6d09d99e 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectDimmerStateUpdateEvent } from '../../../events/RoomObjectDimmerStateUpdateEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; @@ -29,13 +29,13 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic protected onDispose(): void { - if(this._roomColorUpdated) + if (this._roomColorUpdated) { - if(this.eventDispatcher && this.object) + if (this.eventDispatcher && this.object) { const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if(realRoomObject === 1) + if (realRoomObject === 1) { this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, 0, 1, 1, 0xFFFFFF, 0xFF)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER, this.object)); @@ -50,15 +50,15 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { - if(message.data) + if (message.data) { const extra = message.data.getLegacyString(); const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); - if(realRoomObject === 1) this.processDimmerData(extra); + if (realRoomObject === 1) this.processDimmerData(extra); super.processUpdateMessage(new ObjectDataUpdateMessage(this.getStateFromDimmerData(extra), message.data)); } @@ -71,22 +71,22 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic private getStateFromDimmerData(data: string): number { - if(!data) return 0; + if (!data) return 0; const parts = data.split(','); - if(parts.length >= 5) return (parseInt(parts[0]) - 1); + if (parts.length >= 5) return (parseInt(parts[0]) - 1); return 0; } private processDimmerData(data: string): void { - if(!data) return; + if (!data) return; const parts = data.split(','); - if(parts.length >= 5) + if (parts.length >= 5) { const state = this.getStateFromDimmerData(data); const presetId = parseInt(parts[1]); @@ -96,13 +96,13 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic let colorCode = parseInt(color.substr(1), 16); let brightness = parseInt(parts[4]); - if(!state) + if (!state) { colorCode = 0xFFFFFF; brightness = 0xFF; } - if(this.eventDispatcher && this.object) + if (this.eventDispatcher && this.object) { this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, state, presetId, effectId, colorCode, brightness)); @@ -113,7 +113,7 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic public useObject(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.DIMMER, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts index 42b06b3b..bfd72c5a 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { FurnitureLogic } from './FurnitureLogic'; @@ -23,7 +23,7 @@ export class FurnitureScoreLogic extends FurnitureLogic public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); + if (message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); super.processUpdateMessage(message); } @@ -34,13 +34,13 @@ export class FurnitureScoreLogic extends FurnitureLogic const currentScore = this.object.getState(0); - if(this._score !== currentScore) + if (this._score !== currentScore) { let difference = (this._score - currentScore); - if(difference < 0) difference = -(difference); + if (difference < 0) difference = -(difference); - if((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); + if ((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); else this._scoreIncreaser = FurnitureScoreLogic.UPDATE_INTERVAL; this._scoreTimer = Nitro.instance.time; @@ -53,15 +53,15 @@ export class FurnitureScoreLogic extends FurnitureLogic const currentScore = this.object.getState(0); - if((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) + if ((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) { const _local_3 = (time - this._scoreTimer); let _local_4 = (_local_3 / this._scoreIncreaser); let _local_5 = 1; - if(this._score < currentScore) _local_5 = -1; + if (this._score < currentScore) _local_5 = -1; - if(_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); + if (_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); this.object.setState((currentScore + (_local_5 * _local_4)), 0); diff --git a/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts index 75f655f5..98ae5ebf 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureLogic } from './FurnitureLogic'; @@ -9,7 +9,7 @@ export class FurnitureSongDiskLogic extends FurnitureLogic { super.processUpdateMessage(message); - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) { const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); const diskId = parseInt(extras); diff --git a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts index 6834f925..db09bd29 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts @@ -1,5 +1,5 @@ import { IAssetData } from '../../../../../api'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectSamplePlaybackEvent } from '../../../events/RoomObjectSamplePlaybackEvent'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts index cc290398..c66beadb 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { ObjectDataUpdateMessage } from '../../../messages'; @@ -34,29 +34,29 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; - if(!this._isInitialized) this.requestInit(); + if (!this._isInitialized) this.requestInit(); this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const state = this.object.getState(0); - if(state !== this._currentState) + if (state !== this._currentState) { this._currentState = state; - if(state === 1) this.requestPlayList(); - else if(state === 0) this.requestStopPlaying(); + if (state === 1) this.requestPlayList(); + else if (state === 0) this.requestStopPlaying(); } } } private requestInit(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -67,7 +67,7 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic private requestPlayList(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this._disposeEventsAllowed = true; @@ -76,14 +76,14 @@ export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic private requestStopPlaying(): void { - if(!this.object || !this.eventDispatcher) return; + if (!this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP, this.object)); } private requestDispose(): void { - if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + if (!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE, this.object)); } diff --git a/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts index 847a6351..bfb01276 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts @@ -1,5 +1,5 @@ import { IAssetData } from '../../../../../api'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { ObjectItemDataUpdateMessage } from '../../../messages/ObjectItemDataUpdateMessage'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts index 78e98508..dbef3a67 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts @@ -1,4 +1,5 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { PixiApplicationProxy } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { VoteDataType } from '../../data/type/VoteDataType'; @@ -27,11 +28,11 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const stuffData = (message.data as VoteDataType); - if(!stuffData) return; + if (!stuffData) return; this.updateTotal(stuffData.result); } @@ -41,20 +42,20 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { this._total = k; - if(!this._lastUpdate) + if (!this._lastUpdate) { this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, k); - this._lastUpdate = Nitro.instance.time; + this._lastUpdate = PixiApplicationProxy.instance.ticker.lastTime; return; } - if(this._total !== this.currentTotal) + if (this._total !== this.currentTotal) { const difference = Math.abs((this._total - this.currentTotal)); - if((difference * FurnitureVoteCounterLogic.UPDATE_INTERVAL) > FurnitureVoteCounterLogic.MAX_UPDATE_TIME) + if ((difference * FurnitureVoteCounterLogic.UPDATE_INTERVAL) > FurnitureVoteCounterLogic.MAX_UPDATE_TIME) { this._interval = (FurnitureVoteCounterLogic.MAX_UPDATE_TIME / difference); } @@ -71,17 +72,17 @@ export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic { super.update(time); - if(this.object) + if (this.object) { - if((this.currentTotal !== this._total) && (time >= (this._lastUpdate + this._interval))) + if ((this.currentTotal !== this._total) && (time >= (this._lastUpdate + this._interval))) { const _local_2 = (time - this._lastUpdate); let _local_3 = (_local_2 / this._interval); let _local_4 = 1; - if(this._total < this.currentTotal) _local_4 = -1; + if (this._total < this.currentTotal) _local_4 = -1; - if(_local_3 > (_local_4 * (this._total - this.currentTotal))) _local_3 = (_local_4 * (this._total - this.currentTotal)); + if (_local_3 > (_local_4 * (this._total - this.currentTotal))) _local_3 = (_local_4 * (this._total - this.currentTotal)); this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, (this.currentTotal + (_local_4 * _local_3))); diff --git a/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts index 65cc217c..11519ca0 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts @@ -1,4 +1,4 @@ -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; +import { RoomObjectUpdateMessage } from '../../../../../room'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { VoteDataType } from '../../data/type/VoteDataType'; import { RoomObjectVariable } from '../../RoomObjectVariable'; @@ -10,13 +10,13 @@ export class FurnitureVoteMajorityLogic extends FurnitureMultiStateLogic { super.processUpdateMessage(message); - if(!this.object) return; + if (!this.object) return; - if(message instanceof ObjectDataUpdateMessage) + if (message instanceof ObjectDataUpdateMessage) { const data = message.data; - if(data instanceof VoteDataType) this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT, data.result); + if (data instanceof VoteDataType) this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT, data.result); } } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts index d20c26cd..931d02a9 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts @@ -1,4 +1,5 @@ -import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room'; +import { IRoomGeometry } from '../../../../../api'; +import { RoomSpriteMouseEvent } from '../../../../../room'; import { MouseEventType } from '../../../../ui'; import { RoomObjectStateChangedEvent } from '../../../events'; import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; @@ -7,11 +8,11 @@ export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic { public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry) return; + if (!event || !geometry) return; - if(event.type === MouseEventType.DOUBLE_CLICK) + if (event.type === MouseEventType.DOUBLE_CLICK) { - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); } super.mouseEvent(event, geometry); diff --git a/src/nitro/room/object/logic/pet/PetLogic.ts b/src/nitro/room/object/logic/pet/PetLogic.ts index 754eb544..4460f52a 100644 --- a/src/nitro/room/object/logic/pet/PetLogic.ts +++ b/src/nitro/room/object/logic/pet/PetLogic.ts @@ -1,10 +1,5 @@ -import { IAssetData } from '../../../../../api'; -import { RoomObjectMouseEvent } from '../../../../../room/events/RoomObjectMouseEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { IAssetData, IRoomGeometry, IRoomObjectModel } from '../../../../../api'; +import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent, Vector3d } from '../../../../../room'; import { PetFigureData } from '../../../../avatar/pets/PetFigureData'; import { PetType } from '../../../../avatar/pets/PetType'; import { MouseEventType } from '../../../../ui/MouseEventType'; diff --git a/src/nitro/room/object/logic/room/RoomLogic.ts b/src/nitro/room/object/logic/room/RoomLogic.ts index d6bb4ab5..68a0c9ff 100644 --- a/src/nitro/room/object/logic/room/RoomLogic.ts +++ b/src/nitro/room/object/logic/room/RoomLogic.ts @@ -1,13 +1,6 @@ import { Point } from '@pixi/math'; -import { RoomObjectEvent } from '../../../../../room/events/RoomObjectEvent'; -import { RoomObjectMouseEvent } from '../../../../../room/events/RoomObjectMouseEvent'; -import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { RoomObjectLogicBase } from '../../../../../room/object/logic/RoomObjectLogicBase'; -import { ColorConverter } from '../../../../../room/utils/ColorConverter'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { IRoomGeometry, IRoomObjectModel } from '../../../../../api'; +import { ColorConverter, RoomObjectEvent, RoomObjectLogicBase, RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent, Vector3d } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; import { MouseEventType } from '../../../../ui/MouseEventType'; import { RoomObjectTileMouseEvent } from '../../../events/RoomObjectTileMouseEvent'; @@ -63,7 +56,7 @@ export class RoomLogic extends RoomObjectLogicBase public getEventTypes(): string[] { - const types = [ RoomObjectMouseEvent.MOUSE_MOVE, RoomObjectMouseEvent.CLICK ]; + const types = [RoomObjectMouseEvent.MOUSE_MOVE, RoomObjectMouseEvent.CLICK]; return this.mergeTypes(super.getEventTypes(), types); } @@ -72,14 +65,14 @@ export class RoomLogic extends RoomObjectLogicBase { super.dispose(); - if(this._planeParser) + if (this._planeParser) { this._planeParser.dispose(); this._planeParser = null; } - if(this._planeBitmapMaskParser) + if (this._planeBitmapMaskParser) { this._planeBitmapMaskParser.dispose(); @@ -89,11 +82,11 @@ export class RoomLogic extends RoomObjectLogicBase public initialize(roomMap: RoomMapData): void { - if(!roomMap || !this.object) return; + if (!roomMap || !this.object) return; - if(!(roomMap instanceof RoomMapData)) return; + if (!(roomMap instanceof RoomMapData)) return; - if(!this._planeParser.initializeFromMapData(roomMap)) return; + if (!this._planeParser.initializeFromMapData(roomMap)) return; this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, roomMap); this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, 0xFFFFFF); @@ -110,13 +103,13 @@ export class RoomLogic extends RoomObjectLogicBase this.updateBackgroundColor(time); - if(this._needsMapUpdate) + if (this._needsMapUpdate) { - if(this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return; + if (this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return; const model = this.object && this.object.model; - if(model) + if (model) { const mapData = this._planeParser.getMapData(); @@ -134,12 +127,12 @@ export class RoomLogic extends RoomObjectLogicBase private updateBackgroundColor(k: number): void { - if(!this.object || !this._colorChangedTime) return; + if (!this.object || !this._colorChangedTime) return; let color = this._color; let newColor = this._light; - if((k - this._colorChangedTime) >= this._colorTransitionLength) + if ((k - this._colorChangedTime) >= this._colorTransitionLength) { color = this._targetColor; newColor = this._targetLight; @@ -173,60 +166,60 @@ export class RoomLogic extends RoomObjectLogicBase _local_5 = ((_local_5 & 0xFFFF00) + newColor); color = ColorConverter.hslToRGB(_local_5); - if(this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color); + if (this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color); } public processUpdateMessage(message: RoomObjectUpdateMessage): void { - if(!message || !this.object) return; + if (!message || !this.object) return; const model = this.object.model; - if(!model) return; + if (!model) return; - if(message instanceof ObjectRoomUpdateMessage) + if (message instanceof ObjectRoomUpdateMessage) { this.onObjectRoomUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomMaskUpdateMessage) + if (message instanceof ObjectRoomMaskUpdateMessage) { this.onObjectRoomMaskUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomPlaneVisibilityUpdateMessage) + if (message instanceof ObjectRoomPlaneVisibilityUpdateMessage) { this.onObjectRoomPlaneVisibilityUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomPlanePropertyUpdateMessage) + if (message instanceof ObjectRoomPlanePropertyUpdateMessage) { this.onObjectRoomPlanePropertyUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomFloorHoleUpdateMessage) + if (message instanceof ObjectRoomFloorHoleUpdateMessage) { this.onObjectRoomFloorHoleUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomColorUpdateMessage) + if (message instanceof ObjectRoomColorUpdateMessage) { this.onObjectRoomColorUpdateMessage(message, model); return; } - if(message instanceof ObjectRoomMapUpdateMessage) + if (message instanceof ObjectRoomMapUpdateMessage) { this.onObjectRoomMapUpdateMessage(message); } @@ -234,7 +227,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomUpdateMessage(message: ObjectRoomUpdateMessage, model: IRoomObjectModel): void { - switch(message.type) + switch (message.type) { case ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE: model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, message.value); @@ -253,12 +246,12 @@ export class RoomLogic extends RoomObjectLogicBase let maskType: string = null; let update = false; - switch(message.type) + switch (message.type) { case ObjectRoomMaskUpdateMessage.ADD_MASK: maskType = RoomPlaneBitmapMaskData.WINDOW; - if(message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE; + if (message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE; this._planeBitmapMaskParser.addMask(message.maskId, message.maskType, message.maskLocation, maskType); @@ -270,16 +263,16 @@ export class RoomLogic extends RoomObjectLogicBase } - if(update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML()); + if (update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML()); } private onObjectRoomPlaneVisibilityUpdateMessage(message: ObjectRoomPlaneVisibilityUpdateMessage, model: IRoomObjectModel): void { let visible = 0; - if(message.visible) visible = 1; + if (message.visible) visible = 1; - switch(message.type) + switch (message.type) { case ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY: model.setValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY, visible); @@ -293,7 +286,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomPlanePropertyUpdateMessage(message: ObjectRoomPlanePropertyUpdateMessage, model: IRoomObjectModel): void { - switch(message.type) + switch (message.type) { case ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS: model.setValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS, message.value); @@ -306,7 +299,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomFloorHoleUpdateMessage(message: ObjectRoomFloorHoleUpdateMessage, model: IRoomObjectModel): void { - switch(message.type) + switch (message.type) { case ObjectRoomFloorHoleUpdateMessage.ADD: this._planeParser.addFloorHole(message.id, message.x, message.y, message.width, message.height); @@ -323,7 +316,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomColorUpdateMessage(message: ObjectRoomColorUpdateMessage, model: IRoomObjectModel): void { - if(!message || !model) return; + if (!message || !model) return; this._originalColor = this._color; this._originalLight = this._light; @@ -331,7 +324,7 @@ export class RoomLogic extends RoomObjectLogicBase this._targetLight = message.light; this._colorChangedTime = this.time; - if(this._skipColorTransition) + if (this._skipColorTransition) this._colorTransitionLength = 0; else this._colorTransitionLength = 1500; @@ -341,7 +334,7 @@ export class RoomLogic extends RoomObjectLogicBase private onObjectRoomMapUpdateMessage(message: ObjectRoomMapUpdateMessage): void { - if(!message || !message.mapData) return; + if (!message || !message.mapData) return; this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, message.mapData); this.object.model.setValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME, this.time); @@ -351,20 +344,20 @@ export class RoomLogic extends RoomObjectLogicBase public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void { - if(!event || !geometry || !this.object || !this.object.model) return; + if (!event || !geometry || !this.object || !this.object.model) return; const tag = event.spriteTag; let planeId = 0; - if(tag && (tag.indexOf('@') >= 0)) + if (tag && (tag.indexOf('@') >= 0)) { planeId = parseInt(tag.substr(tag.indexOf('@') + 1)); } - if((planeId < 1) || (planeId > this._planeParser.planeCount)) + if ((planeId < 1) || (planeId > this._planeParser.planeCount)) { - if(event.type === MouseEventType.ROLL_OUT) + if (event.type === MouseEventType.ROLL_OUT) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); } @@ -382,12 +375,12 @@ export class RoomLogic extends RoomObjectLogicBase const planeNormalDirection = this._planeParser.getPlaneNormalDirection(planeId); const planeType = this._planeParser.getPlaneType(planeId); - if(((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return; + if (((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return; const leftSideLength = planeLeftSide.length; const rightSideLength = planeRightSide.length; - if(((leftSideLength == 0) || (rightSideLength == 0))) return; + if (((leftSideLength == 0) || (rightSideLength == 0))) return; const screenX = event.screenX; const screenY = event.screenY; @@ -395,7 +388,7 @@ export class RoomLogic extends RoomObjectLogicBase planePosition = geometry.getPlanePosition(screenPoint, planeLocation, planeLeftSide, planeRightSide); - if(!planePosition) + if (!planePosition) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); @@ -411,7 +404,7 @@ export class RoomLogic extends RoomObjectLogicBase const tileY = _local_18.y; const tileZ = _local_18.z; - if(((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength))) + if (((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength))) { this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY); @@ -427,30 +420,30 @@ export class RoomLogic extends RoomObjectLogicBase let eventType: string = null; - if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; - else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; + if ((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + else if ((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; - switch(event.type) + switch (event.type) { case MouseEventType.MOUSE_MOVE: case MouseEventType.ROLL_OVER: case MouseEventType.MOUSE_CLICK: { let newEvent: RoomObjectEvent = null; - if(planeType === RoomPlaneData.PLANE_FLOOR) + if (planeType === RoomPlaneData.PLANE_FLOOR) { newEvent = new RoomObjectTileMouseEvent(eventType, this.object, event.eventId, tileX, tileY, tileZ, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); } - else if((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE)) + else if ((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE)) { let direction = 90; - if(planeNormalDirection) + if (planeNormalDirection) { direction = (planeNormalDirection.x + 90); - if(direction > 360) direction -= 360; + if (direction > 360) direction -= 360; } const _local_27 = ((planeLeftSide.length * planePosition.x) / leftSideLength); @@ -459,7 +452,7 @@ export class RoomLogic extends RoomObjectLogicBase newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, planeLocation, planeLeftSide, planeRightSide, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); } - if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); + if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); return; } diff --git a/src/nitro/room/object/logic/room/SelectionArrowLogic.ts b/src/nitro/room/object/logic/room/SelectionArrowLogic.ts index 9457491b..2622a585 100644 --- a/src/nitro/room/object/logic/room/SelectionArrowLogic.ts +++ b/src/nitro/room/object/logic/room/SelectionArrowLogic.ts @@ -1,6 +1,5 @@ import { IAssetData } from '../../../../../api'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { RoomObjectLogicBase } from '../../../../../room/object/logic/RoomObjectLogicBase'; +import { RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room'; import { ObjectVisibilityUpdateMessage } from '../../../messages/ObjectVisibilityUpdateMessage'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/logic/room/TileCursorLogic.ts b/src/nitro/room/object/logic/room/TileCursorLogic.ts index 8894486e..0953c0c7 100644 --- a/src/nitro/room/object/logic/room/TileCursorLogic.ts +++ b/src/nitro/room/object/logic/room/TileCursorLogic.ts @@ -1,6 +1,5 @@ import { IAssetData } from '../../../../../api'; -import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; -import { RoomObjectLogicBase } from '../../../../../room/object/logic/RoomObjectLogicBase'; +import { RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room'; import { ObjectTileCursorUpdateMessage } from '../../../messages/ObjectTileCursorUpdateMessage'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts index a0841d16..4c98790d 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts @@ -1,14 +1,8 @@ import { BLEND_MODES } from '@pixi/constants'; import { Resource, Texture } from '@pixi/core'; -import { IGraphicAsset } from '../../../../../api'; +import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; -import { AlphaTolerance } from '../../../../../room/object/enum/AlphaTolerance'; -import { RoomObjectSpriteType } from '../../../../../room/object/enum/RoomObjectSpriteType'; -import { IRoomObject } from '../../../../../room/object/IRoomObject'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; -import { RoomObjectSpriteVisualization } from '../../../../../room/object/visualization/RoomObjectSpriteVisualization'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { RoomObjectSpriteVisualization } from '../../../../../room'; import { AvatarAction } from '../../../../avatar/enum/AvatarAction'; import { AvatarGuideStatus } from '../../../../avatar/enum/AvatarGuideStatus'; import { AvatarSetType } from '../../../../avatar/enum/AvatarSetType'; diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts index b88a88a1..16092095 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts @@ -1,7 +1,6 @@ import { Resource, Texture } from '@pixi/core'; -import { IAssetData } from '../../../../../api'; +import { IAssetData, IObjectVisualizationData } from '../../../../../api'; import { Disposable } from '../../../../../core'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; import { AvatarScaleType } from '../../../../avatar/enum/AvatarScaleType'; import { IAvatarEffectListener } from '../../../../avatar/IAvatarEffectListener'; import { IAvatarImage } from '../../../../avatar/IAvatarImage'; diff --git a/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts b/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts index 3ffdd446..bee5db78 100644 --- a/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts @@ -1,4 +1,4 @@ -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarVisualization } from '../AvatarVisualization'; import { IExpressionAddition } from './IExpressionAddition'; @@ -44,4 +44,4 @@ export class ExpressionAddition implements IExpressionAddition { return this._visualization; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts b/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts index 3ba4dd58..3bccbfa7 100644 --- a/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { Nitro } from '../../../../../Nitro'; import { AvatarVisualization } from '../AvatarVisualization'; @@ -34,23 +34,23 @@ export class FloatingHeartAddition extends ExpressionAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; this._scale = scale; let additionScale = 64; let offsetX = 0; - if(scale < 48) + if (scale < 48) { this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss_small'); - if((this.visualization.angle === 90) || (this.visualization.angle === 270)) + if ((this.visualization.angle === 90) || (this.visualization.angle === 270)) { offsetX = 0; } - else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + else if ((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) { offsetX = 6; } @@ -65,12 +65,12 @@ export class FloatingHeartAddition extends ExpressionAddition { this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss'); - if((this.visualization.angle === 90) || (this.visualization.angle === 270)) + if ((this.visualization.angle === 90) || (this.visualization.angle === 270)) { offsetX = -3; } - else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + else if ((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) { offsetX = 22; } @@ -80,17 +80,17 @@ export class FloatingHeartAddition extends ExpressionAddition this._offsetY = -70; } - if(this.visualization.posture === AvatarAction.POSTURE_SIT) + if (this.visualization.posture === AvatarAction.POSTURE_SIT) { this._offsetY += (additionScale / 2); } - else if(this.visualization.posture === AvatarAction.POSTURE_LAY) + else if (this.visualization.posture === AvatarAction.POSTURE_LAY) { this._offsetY += additionScale; } - if(this._asset) + if (this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -108,13 +108,13 @@ export class FloatingHeartAddition extends ExpressionAddition public animate(sprite: IRoomObjectSprite): boolean { - if(!sprite) return false; + if (!sprite) return false; - if(this._asset) sprite.texture = this._asset; + if (this._asset) sprite.texture = this._asset; - if(this._state === FloatingHeartAddition.STATE_DELAY) + if (this._state === FloatingHeartAddition.STATE_DELAY) { - if((Nitro.instance.time - this._startTime) < FloatingHeartAddition.DELAY_BEFORE_ANIMATION) return false; + if ((Nitro.instance.time - this._startTime) < FloatingHeartAddition.DELAY_BEFORE_ANIMATION) return false; this._state = FloatingHeartAddition.STATE_FADE_IN; @@ -126,14 +126,14 @@ export class FloatingHeartAddition extends ExpressionAddition return true; } - if(this._state === FloatingHeartAddition.STATE_FADE_IN) + if (this._state === FloatingHeartAddition.STATE_FADE_IN) { this._delta += 0.1; sprite.offsetY = this._offsetY; sprite.alpha = (Math.pow(this._delta, 0.9) * 255); - if(this._delta >= 1) + if (this._delta >= 1) { sprite.alpha = 255; @@ -144,7 +144,7 @@ export class FloatingHeartAddition extends ExpressionAddition return true; } - if(this._state === FloatingHeartAddition.STATE_FLOAT) + if (this._state === FloatingHeartAddition.STATE_FLOAT) { const alpha = Math.pow(this._delta, 0.9); @@ -155,7 +155,7 @@ export class FloatingHeartAddition extends ExpressionAddition sprite.offsetY = (this._offsetY + (((this._delta < 1) ? alpha : 1) * offset)); sprite.alpha = ((1 - alpha) * 255); - if(sprite.alpha <= 0) + if (sprite.alpha <= 0) { sprite.visible = false; diff --git a/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts b/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts index 691a6776..d8dfaf89 100644 --- a/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { Nitro } from '../../../../../Nitro'; import { AvatarVisualization } from '../AvatarVisualization'; @@ -42,14 +42,14 @@ export class FloatingIdleZAddition implements IAvatarAddition { let side = 'left'; - if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; + if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; return ('avatar_addition_user_idle_' + side + '_' + state + ((this._scale < 48) ? '_small' : '')); } public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; this._scale = scale; this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName((this._state === FloatingIdleZAddition.STATE_FRAME_A) ? 1 : 2)); @@ -57,9 +57,9 @@ export class FloatingIdleZAddition implements IAvatarAddition let additionScale = 64; let offsetX = 0; - if(scale < 48) + if (scale < 48) { - if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) { offsetX = 10; } @@ -74,7 +74,7 @@ export class FloatingIdleZAddition implements IAvatarAddition } else { - if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + if ((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) { offsetX = 22; } @@ -86,17 +86,17 @@ export class FloatingIdleZAddition implements IAvatarAddition this._offsetY = -70; } - if(this._visualization.posture === AvatarAction.POSTURE_SIT) + if (this._visualization.posture === AvatarAction.POSTURE_SIT) { this._offsetY += (additionScale / 2); } - else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + else if (this._visualization.posture === AvatarAction.POSTURE_LAY) { this._offsetY += (additionScale - (0.3 * additionScale)); } - if(this._asset) + if (this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -108,13 +108,13 @@ export class FloatingIdleZAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if(!sprite) return false; + if (!sprite) return false; const totalTimeRunning = Nitro.instance.time; - if(this._state === FloatingIdleZAddition.STATE_DELAY) + if (this._state === FloatingIdleZAddition.STATE_DELAY) { - if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_BEFORE_ANIMATION) + if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_BEFORE_ANIMATION) { this._state = FloatingIdleZAddition.STATE_FRAME_A; this._startTime = totalTimeRunning; @@ -122,9 +122,9 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if(this._state === FloatingIdleZAddition.STATE_FRAME_A) + if (this._state === FloatingIdleZAddition.STATE_FRAME_A) { - if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) { this._state = FloatingIdleZAddition.STATE_FRAME_B; this._startTime = totalTimeRunning; @@ -132,9 +132,9 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if(this._state === FloatingIdleZAddition.STATE_FRAME_B) + if (this._state === FloatingIdleZAddition.STATE_FRAME_B) { - if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + if ((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) { this._state = FloatingIdleZAddition.STATE_FRAME_A; this._startTime = totalTimeRunning; @@ -142,7 +142,7 @@ export class FloatingIdleZAddition implements IAvatarAddition } } - if(this._asset) + if (this._asset) { sprite.texture = this._asset; sprite.alpha = 255; diff --git a/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts b/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts index 83a727e6..ab84e24e 100644 --- a/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts @@ -1,7 +1,7 @@ import { Resource, Texture } from '@pixi/core'; import { Sprite } from '@pixi/sprite'; -import { AlphaTolerance, TextureUtils } from '../../../../../..'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { AlphaTolerance, IRoomObjectSprite } from '../../../../../../api'; +import { TextureUtils } from '../../../../../../pixi-proxy'; import { IAvatarAddition } from './IAvatarAddition'; export class GameClickTargetAddition implements IAvatarAddition @@ -29,9 +29,9 @@ export class GameClickTargetAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; - if(!this._asset) + if (!this._asset) { const newSprite = new Sprite(Texture.WHITE); diff --git a/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts index 282673be..70d8d5a9 100644 --- a/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { AvatarGuideStatus } from '../../../../../avatar/enum/AvatarGuideStatus'; import { AvatarVisualization } from '../AvatarVisualization'; @@ -30,7 +30,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; sprite.visible = true; sprite.relativeDepth = this._relativeDepth; @@ -42,7 +42,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition this._asset = this._visualization.getAvatarRenderAsset((this._status === AvatarGuideStatus.GUIDE) ? 'avatar_addition_user_guide_bubble' : 'avatar_addition_user_guide_requester_bubble'); - if(scale < 48) + if (scale < 48) { offsetX = -19; offsetY = -80; @@ -54,17 +54,17 @@ export class GuideStatusBubbleAddition implements IAvatarAddition offsetY = -120; } - if(this._visualization.posture === AvatarAction.POSTURE_SIT) + if (this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + else if (this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if(this._asset) + if (this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -75,7 +75,7 @@ export class GuideStatusBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if(this._asset && sprite) + if (this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts b/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts index 1ff6d84a..11743f16 100644 --- a/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts @@ -1,4 +1,4 @@ -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; export interface IAvatarAddition { @@ -6,4 +6,4 @@ export interface IAvatarAddition update(sprite: IRoomObjectSprite, scale: number): void; animate(sprite: IRoomObjectSprite): boolean; id: number; -} \ No newline at end of file +} diff --git a/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts index 0f856cc2..20160624 100644 --- a/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { AvatarVisualization } from '../AvatarVisualization'; import { IAvatarAddition } from './IAvatarAddition'; @@ -25,13 +25,13 @@ export class MutedBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; let additionScale = 64; let offsetX = 0; let offsetY = 0; - if(scale < 48) + if (scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted_small'); @@ -47,10 +47,10 @@ export class MutedBubbleAddition implements IAvatarAddition offsetY = -110; } - if(this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2); - else if(this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale; + if (this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2); + else if (this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale; - if(this._asset) + if (this._asset) { sprite.visible = true; sprite.texture = this._asset; @@ -66,7 +66,7 @@ export class MutedBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if(this._asset && sprite) + if (this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts index 4c01db1a..0d04ef2e 100644 --- a/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { AvatarVisualization } from '../AvatarVisualization'; import { IAvatarAddition } from './IAvatarAddition'; @@ -35,7 +35,7 @@ export class NumberBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; this._scale = scale; @@ -43,9 +43,9 @@ export class NumberBubbleAddition implements IAvatarAddition let offsetX = 0; let offsetY = 0; - if(this._number > 0) + if (this._number > 0) { - if(scale < 48) + if (scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number + '_small'); @@ -61,17 +61,17 @@ export class NumberBubbleAddition implements IAvatarAddition offsetY = -105; } - if(this._visualization.posture === AvatarAction.POSTURE_SIT) + if (this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + else if (this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if(this._asset) + if (this._asset) { sprite.visible = true; sprite.texture = this._asset; @@ -91,15 +91,15 @@ export class NumberBubbleAddition implements IAvatarAddition } else { - if(sprite.visible) this._numberValueFadeDirection = -1; + if (sprite.visible) this._numberValueFadeDirection = -1; } } public animate(sprite: IRoomObjectSprite): boolean { - if(!sprite) return false; + if (!sprite) return false; - if(this._asset) + if (this._asset) { sprite.texture = this._asset; } @@ -107,15 +107,15 @@ export class NumberBubbleAddition implements IAvatarAddition let alpha = sprite.alpha; let didAnimate = false; - if(this._numberValueMoving) + if (this._numberValueMoving) { this._numberValueMoveCounter++; - if(this._numberValueMoveCounter < 10) return false; + if (this._numberValueMoveCounter < 10) return false; - if(this._numberValueFadeDirection < 0) + if (this._numberValueFadeDirection < 0) { - if(this._scale < 48) + if (this._scale < 48) { sprite.offsetY -= 2; } @@ -128,9 +128,9 @@ export class NumberBubbleAddition implements IAvatarAddition { let count = 4; - if(this._scale < 48) count = 8; + if (this._scale < 48) count = 8; - if(!(this._numberValueMoveCounter % count)) + if (!(this._numberValueMoveCounter % count)) { sprite.offsetY--; @@ -139,11 +139,11 @@ export class NumberBubbleAddition implements IAvatarAddition } } - if(this._numberValueFadeDirection > 0) + if (this._numberValueFadeDirection > 0) { - if(alpha < 255) alpha += 32; + if (alpha < 255) alpha += 32; - if(alpha >= 255) + if (alpha >= 255) { alpha = 255; @@ -155,11 +155,11 @@ export class NumberBubbleAddition implements IAvatarAddition return true; } - if(this._numberValueFadeDirection < 0) + if (this._numberValueFadeDirection < 0) { - if(alpha >= 0) alpha -= 32; + if (alpha >= 0) alpha -= 32; - if(alpha <= 0) + if (alpha <= 0) { this._numberValueFadeDirection = 0; this._numberValueMoving = false; diff --git a/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts b/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts index 9830571c..b8ae4390 100644 --- a/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts +++ b/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; +import { IRoomObjectSprite } from '../../../../../../api'; import { AvatarAction } from '../../../../../avatar/enum/AvatarAction'; import { AvatarVisualization } from '../AvatarVisualization'; import { IAvatarAddition } from './IAvatarAddition'; @@ -27,7 +27,7 @@ export class TypingBubbleAddition implements IAvatarAddition public update(sprite: IRoomObjectSprite, scale: number): void { - if(!sprite) return; + if (!sprite) return; sprite.visible = true; sprite.relativeDepth = this._relativeDepth; @@ -37,7 +37,7 @@ export class TypingBubbleAddition implements IAvatarAddition let offsetX = 0; let offsetY = 0; - if(scale < 48) + if (scale < 48) { this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing_small'); @@ -54,17 +54,17 @@ export class TypingBubbleAddition implements IAvatarAddition offsetY = -83; } - if(this._visualization.posture === AvatarAction.POSTURE_SIT) + if (this._visualization.posture === AvatarAction.POSTURE_SIT) { offsetY += (additionScale / 2); } - else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + else if (this._visualization.posture === AvatarAction.POSTURE_LAY) { offsetY += scale; } - if(this._asset) + if (this._asset) { sprite.texture = this._asset; sprite.offsetX = offsetX; @@ -75,7 +75,7 @@ export class TypingBubbleAddition implements IAvatarAddition public animate(sprite: IRoomObjectSprite): boolean { - if(this._asset && sprite) + if (this._asset && sprite) { sprite.texture = this._asset; } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts index c4b6dbf9..9dfafe4f 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts @@ -1,4 +1,4 @@ -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; +import { IObjectVisualizationData } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVisualizationType } from '../../RoomObjectVisualizationType'; import { AnimationData } from '../data/AnimationData'; @@ -37,7 +37,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization public initialize(data: IObjectVisualizationData): boolean { - if(!(data instanceof FurnitureAnimatedVisualizationData)) return false; + if (!(data instanceof FurnitureAnimatedVisualizationData)) return false; return super.initialize(data); } @@ -46,7 +46,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { super.dispose(); - if(this._animationData) + if (this._animationData) { this._animationData.dispose(); @@ -66,18 +66,18 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected getAnimationId(animationData: AnimationStateData): number { - if((this.animationId !== FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID) && this._data.hasAnimation(this._animationScale, this.animationId)) return this.animationId; + if ((this.animationId !== FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID) && this._data.hasAnimation(this._animationScale, this.animationId)) return this.animationId; return FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID; } protected updateObject(scale: number, direction: number): boolean { - if(super.updateObject(scale, direction)) + if (super.updateObject(scale, direction)) { const state = this.object.getState(0); - if(state !== this._state) + if (state !== this._state) { this.setAnimation(state); @@ -94,13 +94,13 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateModel(scale: number): boolean { - if(super.updateModel(scale)) + if (super.updateModel(scale)) { - if(this.usesAnimationResetting()) + if (this.usesAnimationResetting()) { const updateTime = this.object.model.getValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME); - if(updateTime > this._animationChangeTime) + if (updateTime > this._animationChangeTime) { this._animationChangeTime = updateTime; @@ -110,7 +110,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const state = this.object.model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); - if(!isNaN(state)) + if (!isNaN(state)) { const animationId = this._data.getAnimationId(this._animationScale, state); @@ -125,11 +125,11 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization private isPlayingTransition(animationData: AnimationStateData, animationId: number): boolean { - if(!AnimationData.isTransitionFromAnimation(animationData.animationId) && !AnimationData.isTransitionToAnimation(animationData.animationId)) return false; + if (!AnimationData.isTransitionFromAnimation(animationData.animationId) && !AnimationData.isTransitionToAnimation(animationData.animationId)) return false; - if(animationId !== animationData.animationAfterTransitionId) return false; + if (animationId !== animationData.animationAfterTransitionId) return false; - if(animationData.animationOver) return false; + if (animationData.animationOver) return false; return true; } @@ -138,14 +138,14 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const animationId = animationData.animationId; - if(!AnimationData.isTransitionFromAnimation(animationId) && !AnimationData.isTransitionToAnimation(animationId)) return animationId; + if (!AnimationData.isTransitionFromAnimation(animationId) && !AnimationData.isTransitionToAnimation(animationId)) return animationId; return animationData.animationAfterTransitionId; } protected setAnimation(animationId: number): void { - if(!this._data) return; + if (!this._data) return; this.setSubAnimation(this._animationData, animationId, (this._state >= 0)); } @@ -154,19 +154,19 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const currentAnimation = animationData.animationId; - if(_arg_3) + if (_arg_3) { - if(this.isPlayingTransition(animationData, animationId)) return false; + if (this.isPlayingTransition(animationData, animationId)) return false; const state = this.getCurrentState(animationData); - if(animationId !== state) + if (animationId !== state) { - if(!this._data.isImmediateChange(this._animationScale, animationId, state)) + if (!this._data.isImmediateChange(this._animationScale, animationId, state)) { let transition = AnimationData.getTransitionFromAnimationId(state); - if(this._data.hasAnimation(this._animationScale, transition)) + if (this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -175,7 +175,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { transition = AnimationData.getTransitionToAnimationId(animationId); - if(this._data.hasAnimation(this._animationScale, transition)) + if (this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -185,24 +185,24 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization } else { - if(AnimationData.isTransitionFromAnimation(animationData.animationId)) + if (AnimationData.isTransitionFromAnimation(animationData.animationId)) { const transition = AnimationData.getTransitionToAnimationId(animationId); - if(this._data.hasAnimation(this._animationScale, transition)) + if (this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; } } - else if(!AnimationData.isTransitionToAnimation(animationData.animationId)) + else if (!AnimationData.isTransitionToAnimation(animationData.animationId)) { - if(this.usesAnimationResetting()) + if (this.usesAnimationResetting()) { const transition = AnimationData.getTransitionFromAnimationId(state); - if(this._data.hasAnimation(this._animationScale, transition)) + if (this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -211,7 +211,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const transition = AnimationData.getTransitionToAnimationId(animationId); - if(this._data.hasAnimation(this._animationScale, transition)) + if (this._data.hasAnimation(this._animationScale, transition)) { animationData.animationAfterTransitionId = animationId; animationId = transition; @@ -222,7 +222,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization } } - if(currentAnimation !== animationId) + if (currentAnimation !== animationId) { animationData.animationId = animationId; @@ -239,16 +239,16 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected resetAllAnimationFrames(): void { - if(!this._animationData) return; + if (!this._animationData) return; this._animationData.setLayerCount(this._animatedLayerCount); } protected updateAnimation(scale: number): number { - if(!this._data) return 0; + if (!this._data) return 0; - if(scale !== this._animationScale) + if (scale !== this._animationScale) { this._animationScale = scale; this._animatedLayerCount = this._data.getLayerCount(scale); @@ -265,13 +265,13 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateAnimations(scale: number): number { - if(this._animationData.animationOver && !this._directionChanged) return 0; + if (this._animationData.animationOver && !this._directionChanged) return 0; const update = this.updateFramesForAnimation(this._animationData, scale); - if(this._animationData.animationOver) + if (this._animationData.animationOver) { - if((AnimationData.isTransitionFromAnimation(this._animationData.animationId)) || (AnimationData.isTransitionToAnimation(this._animationData.animationId))) + if ((AnimationData.isTransitionFromAnimation(this._animationData.animationId)) || (AnimationData.isTransitionToAnimation(this._animationData.animationId))) { this.setAnimation(this._animationData.animationAfterTransitionId); this._animationData.animationOver = false; @@ -283,12 +283,12 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected updateFramesForAnimation(animationData: AnimationStateData, scale: number): number { - if(animationData.animationOver && !this._directionChanged) return 0; + if (animationData.animationOver && !this._directionChanged) return 0; const animationId = this.getAnimationId(animationData); let frameCount = animationData.frameCounter; - if(!frameCount) frameCount = this._data.getStartFrame(scale, animationId, this._direction); + if (!frameCount) frameCount = this._data.getStartFrame(scale, animationId, this._direction); frameCount += this.frameIncrease; animationData.frameCounter = frameCount; @@ -299,32 +299,32 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization let update = 0; let layerUpdate = (1 << (this._animatedLayerCount - 1)); - while(layerId >= 0) + while (layerId >= 0) { let sequenceId = 0; animationPlayed = animationData.getAnimationPlayed(layerId); - if(!animationPlayed || this._directionChanged) + if (!animationPlayed || this._directionChanged) { let lastFramePlayed = animationData.getLastFramePlayed(layerId); let frame = animationData.getFrame(layerId); - if(frame) + if (frame) { - if(frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) + if (frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) { lastFramePlayed = true; } } - if((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) + if ((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) { sequenceId = AnimationFrame.SEQUENCE_NOT_DEFINED; - if(frame) sequenceId = frame.activeSequence; + if (frame) sequenceId = frame.activeSequence; - if(sequenceId === AnimationFrame.SEQUENCE_NOT_DEFINED) + if (sequenceId === AnimationFrame.SEQUENCE_NOT_DEFINED) { frame = this._data.getFrame(scale, animationId, this._direction, layerId, frameCount); } @@ -338,7 +338,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization update = (update | layerUpdate); } - if(!frame || (frame.remainingFrameRepeats == AnimationFrame.FRAME_REPEAT_FOREVER)) + if (!frame || (frame.remainingFrameRepeats == AnimationFrame.FRAME_REPEAT_FOREVER)) { lastFramePlayed = true; animationPlayed = true; @@ -364,7 +364,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization { const currentFrame = this._animationData.getFrame(layerId); - if(!currentFrame) return super.getFrameNumber(scale, layerId); + if (!currentFrame) return super.getFrameNumber(scale, layerId); return currentFrame.id; } @@ -375,7 +375,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const currentFrame = this._animationData.getFrame(layerId); - if(!currentFrame) return offset; + if (!currentFrame) return offset; return (offset + currentFrame.x); } @@ -386,7 +386,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization const currentFrame = this._animationData.getFrame(layerId); - if(!currentFrame) return offset; + if (!currentFrame) return offset; return (offset + currentFrame.y); } @@ -398,7 +398,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization protected setDirection(direction: number): void { - if(this._direction === direction) return; + if (this._direction === direction) return; super.setDirection(direction); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts index 07e86160..eafdeae9 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts @@ -1,4 +1,4 @@ -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureFireworksVisualization } from './FurnitureFireworksVisualization'; @@ -21,7 +21,7 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor private updatePresentWrap(): void { - if(!this.object) return; + if (!this.object) return; const local3 = 1000; const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); @@ -36,11 +36,11 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor public getFrameNumber(scale: number, layerId: number): number { - if(this._lastAnimationId === FurnitureGiftWrappedFireworksVisualization.PRESENT_DEFAULT_STATE) + if (this._lastAnimationId === FurnitureGiftWrappedFireworksVisualization.PRESENT_DEFAULT_STATE) { - if(layerId <= 1) return this._packetType; + if (layerId <= 1) return this._packetType; - if(layerId === 2) return this._ribbonType; + if (layerId === 2) return this._ribbonType; } return super.getFrameNumber(scale, layerId); @@ -53,7 +53,7 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor let assetName = this._type; let layerCode = ''; - if(layerId < (this.spriteCount - 1)) + if (layerId < (this.spriteCount - 1)) { layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); } @@ -70,7 +70,7 @@ export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFirewor return assetName; } - protected setAnimation(animationId: number):void + protected setAnimation(animationId: number): void { this._lastAnimationId = animationId; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts index 885156f3..8d44b3cc 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts @@ -1,4 +1,4 @@ -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureVisualization } from './FurnitureVisualization'; @@ -16,7 +16,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization private updatePresentWrap(): void { - if(!this.object) return; + if (!this.object) return; const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); @@ -29,7 +29,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization public getFrameNumber(scale: number, layerId: number): number { - if(layerId <= 1) return this._packetType; + if (layerId <= 1) return this._packetType; return this._ribbonType; } @@ -41,7 +41,7 @@ export class FurnitureGiftWrappedVisualization extends FurnitureVisualization let assetName = this._type; let layerCode = ''; - if(layerId < (this.spriteCount - 1)) + if (layerId < (this.spriteCount - 1)) { layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts index cd646295..c564ca15 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts @@ -1,5 +1,4 @@ -import { IGraphicAsset } from '../../../../../api'; -import { IRoomObjectSprite } from '../../../../../room'; +import { IGraphicAsset, IRoomObjectSprite } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts index b5f89b34..57840d80 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts @@ -1,5 +1,4 @@ -import { IGraphicAsset } from '../../../../../api'; -import { IRoomObjectSprite } from '../../../../../room'; +import { IGraphicAsset, IRoomObjectSprite } from '../../../../../api'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts index 453c54e7..40c88418 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts @@ -1,4 +1,4 @@ -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; +import { IObjectVisualizationData } from '../../../../../api'; import { AvatarSetType } from '../../../../avatar/enum/AvatarSetType'; import { IAvatarImageListener } from '../../../../avatar/IAvatarImageListener'; import { RoomObjectVariable } from '../../RoomObjectVariable'; @@ -38,18 +38,18 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl public initialize(data: IObjectVisualizationData): boolean { - if(!(data instanceof FurnitureMannequinVisualizationData)) return false; + if (!(data instanceof FurnitureMannequinVisualizationData)) return false; return super.initialize(data); } public dispose(): void { - if(this._disposed) return; + if (this._disposed) return; this._disposed = true; - if(this._dynamicAssetName && this.asset) + if (this._dynamicAssetName && this.asset) { this.asset.disposeAsset(this._dynamicAssetName); @@ -63,9 +63,9 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const updateObject = super.updateObject(scale, direction); - if(updateObject) + if (updateObject) { - if(this._mannequinScale !== scale) + if (this._mannequinScale !== scale) { this._mannequinScale = scale; @@ -80,11 +80,11 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { let updateModel = super.updateModel(scale); - if(updateModel) + if (updateModel) { const figure = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_FIGURE) || null); - if(figure) + if (figure) { this._figure = (figure + '.' + this._placeHolderFigure); this._gender = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_GENDER) || null); @@ -102,15 +102,15 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl private updateAvatar(forceUpdate: boolean = false): void { - if(!this.avatarExists() || forceUpdate) + if (!this.avatarExists() || forceUpdate) { const avatarImage = this._data.createAvatarImage(this._figure, this._mannequinScale, this._gender, this); - if(avatarImage) + if (avatarImage) { avatarImage.setDirection(AvatarSetType.FULL, this.direction); - if(this._dynamicAssetName) this.asset.disposeAsset(this._dynamicAssetName); + if (this._dynamicAssetName) this.asset.disposeAsset(this._dynamicAssetName); this.asset.addAsset(this.getAvatarAssetName(), avatarImage.getImage(AvatarSetType.FULL, false, 1, false), true); @@ -134,14 +134,14 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl public resetFigure(figure: string): void { - if(figure === this._figure) this.updateAvatar(true); + if (figure === this._figure) this.updateAvatar(true); } protected getSpriteAssetName(scale: number, layerId: number): string { const tag = this.getLayerTag(scale, this.direction, layerId); - if(this._figure && (tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) + if (this._figure && (tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) { return this.getAvatarAssetName(); } @@ -153,7 +153,7 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const tag = this.getLayerTag(scale, direction, layerId); - if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return (-(this.getSprite(layerId).width) / 2); + if ((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return (-(this.getSprite(layerId).width) / 2); return super.getLayerXOffset(scale, direction, layerId); } @@ -162,7 +162,7 @@ export class FurnitureMannequinVisualization extends FurnitureVisualization impl { const tag = this.getLayerTag(scale, direction, layerId); - if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return -(this.getSprite(layerId).height); + if ((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return -(this.getSprite(layerId).height); return super.getLayerYOffset(scale, direction, layerId); } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 42410375..1d0acc84 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -2,10 +2,9 @@ import { RenderTexture, Texture } from '@pixi/core'; import { AlphaFilter } from '@pixi/filter-alpha'; import { Graphics } from '@pixi/graphics'; import { Matrix } from '@pixi/math'; -import { IGraphicAsset, IParticleSystem } from '../../../../../api'; +import { IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; import { NitroPoint, NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; -import { IRoomObjectSprite } from '../../../../../room'; import { Vector3D } from '../../../../avatar'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; import { FurnitureParticleSystemEmitter } from './FurnitureParticleSystemEmitter'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts index e1f79e72..8dc9c6e1 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts @@ -1,9 +1,5 @@ -import { IGraphicAsset } from '../../../../../api'; -import { AlphaTolerance } from '../../../../../room/object/enum/AlphaTolerance'; -import { IRoomObjectSprite } from '../../../../../room/object/visualization/IRoomObjectSprite'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; -import { RoomObjectSpriteVisualization } from '../../../../../room/object/visualization/RoomObjectSpriteVisualization'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObjectSprite } from '../../../../../api'; +import { RoomObjectSpriteVisualization } from '../../../../../room'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVisualizationType } from '../../RoomObjectVisualizationType'; import { ColorData } from '../data/ColorData'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts b/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts index f5b6863e..37a1e811 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts @@ -1,5 +1,4 @@ -import { IAssetData, IAssetVisualizationData } from '../../../../../api'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; +import { IAssetData, IAssetVisualizationData, IObjectVisualizationData } from '../../../../../api'; import { ColorData } from '../data/ColorData'; import { LayerData } from '../data/LayerData'; import { SizeData } from '../data/SizeData'; diff --git a/src/nitro/room/object/visualization/pet/PetVisualization.ts b/src/nitro/room/object/visualization/pet/PetVisualization.ts index fe77f7ef..b3196510 100644 --- a/src/nitro/room/object/visualization/pet/PetVisualization.ts +++ b/src/nitro/room/object/visualization/pet/PetVisualization.ts @@ -1,7 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IGraphicAsset } from '../../../../../api'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; +import { IGraphicAsset, IObjectVisualizationData, IRoomGeometry } from '../../../../../api'; import { Nitro } from '../../../../Nitro'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVisualizationType } from '../../RoomObjectVisualizationType'; diff --git a/src/nitro/room/object/visualization/room/PlaneDrawingData.ts b/src/nitro/room/object/visualization/room/PlaneDrawingData.ts index af4c446f..96465df1 100644 --- a/src/nitro/room/object/visualization/room/PlaneDrawingData.ts +++ b/src/nitro/room/object/visualization/room/PlaneDrawingData.ts @@ -1,5 +1,5 @@ import { Point } from '@pixi/math'; -import { IPlaneDrawingData } from '../../../../../room/object/visualization/IPlaneDrawingData'; +import { IPlaneDrawingData } from '../../../../../api'; export class PlaneDrawingData implements IPlaneDrawingData { @@ -21,7 +21,7 @@ export class PlaneDrawingData implements IPlaneDrawingData this._maskAssetFlipHs = []; this._maskAssetFlipVs = []; - if(k != null) + if (k != null) { this._maskAssetNames = k._maskAssetNames; this._maskAssetLocations = k._maskAssetLocations; diff --git a/src/nitro/room/object/visualization/room/RoomPlane.ts b/src/nitro/room/object/visualization/room/RoomPlane.ts index e5a47556..83a5cb53 100644 --- a/src/nitro/room/object/visualization/room/RoomPlane.ts +++ b/src/nitro/room/object/visualization/room/RoomPlane.ts @@ -1,11 +1,9 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Graphics } from '@pixi/graphics'; import { Matrix, Point, Rectangle } from '@pixi/math'; +import { IRoomGeometry, IRoomPlane, IVector3D } from '../../../../../api'; import { NitroRenderTexture, TextureUtils } from '../../../../../pixi-proxy'; -import { IRoomPlane } from '../../../../../room/object/visualization/IRoomPlane'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { Vector3d } from '../../../../../room'; import { PlaneMaskManager } from './mask/PlaneMaskManager'; import { PlaneDrawingData } from './PlaneDrawingData'; import { PlaneVisualizationLayer } from './rasterizer/basic/PlaneVisualizationLayer'; diff --git a/src/nitro/room/object/visualization/room/RoomVisualization.ts b/src/nitro/room/object/visualization/room/RoomVisualization.ts index 34bcacfa..a400cd48 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualization.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualization.ts @@ -1,16 +1,8 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Rectangle } from '@pixi/math'; +import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType } from '../../../../../api'; import { AdvancedMap } from '../../../../../core'; -import { AlphaTolerance } from '../../../../../room/object/enum/AlphaTolerance'; -import { RoomObjectSpriteType } from '../../../../../room/object/enum/RoomObjectSpriteType'; -import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel'; -import { IPlaneVisualization } from '../../../../../room/object/visualization/IPlaneVisualization'; -import { IRoomObjectSprite } from '../../../../../room/object/visualization/IRoomObjectSprite'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; -import { IRoomPlane } from '../../../../../room/object/visualization/IRoomPlane'; -import { RoomObjectSpriteVisualization } from '../../../../../room/object/visualization/RoomObjectSpriteVisualization'; -import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; -import { Vector3d } from '../../../../../room/utils/Vector3d'; +import { RoomObjectSpriteVisualization, Vector3d } from '../../../../../room'; import { RoomMapData } from '../../RoomMapData'; import { RoomMapMaskData } from '../../RoomMapMaskData'; import { RoomObjectVariable } from '../../RoomObjectVariable'; diff --git a/src/nitro/room/object/visualization/room/RoomVisualizationData.ts b/src/nitro/room/object/visualization/room/RoomVisualizationData.ts index 618aea18..f9bdec54 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualizationData.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualizationData.ts @@ -1,6 +1,5 @@ -import { IAssetData, IGraphicAssetCollection } from '../../../../../api'; +import { IAssetData, IGraphicAssetCollection, IObjectVisualizationData } from '../../../../../api'; import { Disposable } from '../../../../../core'; -import { IObjectVisualizationData } from '../../../../../room/object/visualization/IRoomObjectVisualizationData'; import { PlaneMaskManager } from './mask/PlaneMaskManager'; import { LandscapeRasterizer } from './rasterizer/animated/LandscapeRasterizer'; import { FloorRasterizer } from './rasterizer/basic/FloorRasterizer'; diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMask.ts b/src/nitro/room/object/visualization/room/mask/PlaneMask.ts index 76d0215f..fa441f2c 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMask.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMask.ts @@ -1,5 +1,4 @@ -import { IGraphicAsset } from '../../../../../../api'; -import { IVector3D } from '../../../../../../room/utils/IVector3D'; +import { IGraphicAsset, IVector3D } from '../../../../../../api'; import { PlaneMaskVisualization } from './PlaneMaskVisualization'; export class PlaneMask diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts index d8484f62..776718b1 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts @@ -1,7 +1,6 @@ import { Graphics } from '@pixi/graphics'; import { Matrix, Point } from '@pixi/math'; -import { IGraphicAssetCollection } from '../../../../../../api'; -import { IVector3D } from '../../../../../../room/utils/IVector3D'; +import { IGraphicAssetCollection, IVector3D } from '../../../../../../api'; import { PlaneMask } from './PlaneMask'; import { PlaneMaskVisualization } from './PlaneMaskVisualization'; diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts b/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts index 04feb627..0afdc244 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts @@ -1,5 +1,4 @@ -import { IGraphicAsset } from '../../../../../../api'; -import { IVector3D } from '../../../../../../room/utils/IVector3D'; +import { IGraphicAsset, IVector3D } from '../../../../../../api'; import { PlaneMaskBitmap } from './PlaneMaskBitmap'; export class PlaneMaskVisualization diff --git a/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts index 227fbe97..8e25951f 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts @@ -1,5 +1,5 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../api'; import { PlaneBitmapData } from '../utils/PlaneBitmapData'; import { PlaneVisualizationLayer } from './basic/PlaneVisualizationLayer'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts index 7d9981b5..9f784d6d 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts @@ -1,6 +1,6 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { IVector3D } from '../../../../../../../api'; +import { Vector3d } from '../../../../../../../room'; import { Plane } from '../basic/Plane'; export class LandscapePlane extends Plane @@ -16,18 +16,18 @@ export class LandscapePlane extends Plane { const _local_2 = this.getPlaneVisualization(k); - if(_local_2) return !(_local_2.hasAnimationLayers); + if (_local_2) return !(_local_2.hasAnimationLayers); return super.isStatic(k); } public initializeDimensions(k: number, _arg_2: number): void { - if(k < 0) k = 0; + if (k < 0) k = 0; - if(_arg_2 < 0) _arg_2 = 0; + if (_arg_2 < 0) _arg_2 = 0; - if((k !== this._width) || (_arg_2 !== this._height)) + if ((k !== this._width) || (_arg_2 !== this._height)) { this._width = k; this._height = _arg_2; @@ -38,13 +38,13 @@ export class LandscapePlane extends Plane { const visualization = this.getPlaneVisualization(_arg_4); - if(!visualization || !visualization.geometry) return null; + if (!visualization || !visualization.geometry) return null; const _local_13 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_14 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 1)); const _local_15 = visualization.geometry.getScreenPoint(new Vector3d(0, 1, 0)); - if(_local_13 && _local_14 && _local_15) + if (_local_13 && _local_14 && _local_15) { _arg_2 = Math.round(Math.abs((((_local_13.x - _local_15.x) * _arg_2) / visualization.geometry.scale))); _arg_3 = Math.round(Math.abs((((_local_13.y - _local_14.y) * _arg_3) / visualization.geometry.scale))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts index e6ee6409..533c72af 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts @@ -1,5 +1,5 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../../api'; import { Nitro } from '../../../../../../Nitro'; import { PlaneBitmapData } from '../../utils/PlaneBitmapData'; import { Randomizer } from '../../utils/Randomizer'; @@ -17,9 +17,9 @@ export class LandscapeRasterizer extends PlaneRasterizer public initializeDimensions(k: number, _arg_2: number): boolean { - if(k < 0) k = 0; + if (k < 0) k = 0; - if(_arg_2 < 0) _arg_2 = 0; + if (_arg_2 < 0) _arg_2 = 0; this._landscapeWidth = k; this._landscapeHeight = _arg_2; @@ -29,41 +29,41 @@ export class LandscapeRasterizer extends PlaneRasterizer protected initializePlanes(): void { - if(!this.data) return; + if (!this.data) return; const landscapes = this.data.landscapes; - if(landscapes && landscapes.length) this.parseLandscapes(landscapes); + if (landscapes && landscapes.length) this.parseLandscapes(landscapes); } private parseLandscapes(k: any): void { - if(!k) return; + if (!k) return; const randomNumber = Math.trunc((Math.random() * 654321)); - for(const landscapeIndex in k) + for (const landscapeIndex in k) { const landscape = k[landscapeIndex]; - if(!landscape) continue; + if (!landscape) continue; const id = landscape.id; const visualizations = landscape.animatedVisualizations; const plane = new LandscapePlane(); - for(const visualization of visualizations) + for (const visualization of visualizations) { - if(!visualization) continue; + if (!visualization) continue; const size = visualization.size; let horizontalAngle = LandscapePlane.HORIZONTAL_ANGLE_DEFAULT; let verticalAngle = LandscapePlane.VERTICAL_ANGLE_DEFAULT; - if(visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; - if(visualization.verticalAngle) verticalAngle = visualization.verticalAngle; + if (visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle; + if (visualization.verticalAngle) verticalAngle = visualization.verticalAngle; const basicLayers = visualization.layers; const animatedLayers = visualization.animationLayers; @@ -73,39 +73,39 @@ export class LandscapeRasterizer extends PlaneRasterizer const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this.getGeometry(size, horizontalAngle, verticalAngle)); - if(planeVisualization) + if (planeVisualization) { Randomizer.setSeed(randomNumber); let layerId = 0; - if(totalBasicLayers) + if (totalBasicLayers) { - while(layerId < basicLayers.length) + while (layerId < basicLayers.length) { const layer = basicLayers[layerId]; - if(layer) + if (layer) { let material: PlaneMaterial = null; let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT; let color: number = LandscapePlane.DEFAULT_COLOR; let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET; - if(layer.materialId) material = this.getMaterial(layer.materialId); + if (layer.materialId) material = this.getMaterial(layer.materialId); - if(layer.color) color = layer.color; + if (layer.color) color = layer.color; - if(layer.offset) offset = layer.offset; + if (layer.offset) offset = layer.offset; - if(layer.align) + if (layer.align) { - if(layer.align === 'bottom') + if (layer.align === 'bottom') { align = PlaneVisualizationLayer.ALIGN_BOTTOM; } - else if(layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP; + else if (layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP; } planeVisualization.setLayer(layerId, material, color, align, offset); @@ -117,23 +117,23 @@ export class LandscapeRasterizer extends PlaneRasterizer layerId = 0; - if(totalAnimatedLayers) + if (totalAnimatedLayers) { const animationItems: {}[] = []; - while(layerId < animatedLayers.length) + while (layerId < animatedLayers.length) { const layer = animatedLayers[layerId]; - if(layer) + if (layer) { const items = layer.animationItems; - if(items && items.length) + if (items && items.length) { - for(const item of items) + for (const item of items) { - if(item) + if (item) { const id = item.id; const assetId = item.assetId; @@ -162,7 +162,7 @@ export class LandscapeRasterizer extends PlaneRasterizer } } - if(!this.addPlane(id, plane)) plane.dispose(); + if (!this.addPlane(id, plane)) plane.dispose(); } } @@ -170,9 +170,9 @@ export class LandscapeRasterizer extends PlaneRasterizer { let _local_3 = 0; - if((k.length > 0)) + if ((k.length > 0)) { - if(k.charAt((k.length - 1)) === '%') + if (k.charAt((k.length - 1)) === '%') { k = k.substr(0, (k.length - 1)); @@ -180,13 +180,13 @@ export class LandscapeRasterizer extends PlaneRasterizer } } - if((_arg_2.length > 0)) + if ((_arg_2.length > 0)) { const _local_4 = 10000; const _local_5 = Randomizer.getValues(1, 0, _local_4); const _local_6 = (_local_5[0] / _local_4); - if(_arg_2.charAt((_arg_2.length - 1)) === '%') + if (_arg_2.charAt((_arg_2.length - 1)) === '%') { _arg_2 = _arg_2.substr(0, (_arg_2.length - 1)); @@ -201,27 +201,27 @@ export class LandscapeRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as LandscapePlane; - if(!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane; + if (!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane; - if(!plane) return null; + if (!plane) return null; - if(canvas) + if (canvas) { canvas.clear(); } let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY, maxX, maxY, timeSinceStartMs); - if(graphic && (graphic !== canvas)) + if (graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if(!graphic) return null; + if (!graphic) return null; } let planeBitmapData: PlaneBitmapData = null; - if(!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0)) + if (!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0)) { planeBitmapData = new PlaneBitmapData(graphic, ((Math.round((timeSinceStartMs / LandscapeRasterizer.UPDATE_INTERVAL)) * LandscapeRasterizer.UPDATE_INTERVAL) + LandscapeRasterizer.UPDATE_INTERVAL)); } @@ -235,9 +235,9 @@ export class LandscapeRasterizer extends PlaneRasterizer public getTextureIdentifier(k: number, _arg_2: IVector3D): string { - if(_arg_2) + if (_arg_2) { - if(_arg_2.x < 0) return (k + '_0'); + if (_arg_2.x < 0) return (k + '_0'); return (k + '_1'); } diff --git a/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts b/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts index cbb18dc0..b79e3ac4 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts @@ -1,7 +1,6 @@ import { Graphics } from '@pixi/graphics'; import { Matrix } from '@pixi/math'; -import { IDisposable, IGraphicAssetCollection } from '../../../../../../../api'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IDisposable, IGraphicAssetCollection, IVector3D } from '../../../../../../../api'; import { AnimationItem } from './AnimationItem'; export class PlaneVisualizationAnimationLayer implements IDisposable diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts index e26c25e8..b2b4f1ef 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts @@ -1,6 +1,6 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { IVector3D } from '../../../../../../../api'; +import { Vector3d } from '../../../../../../../room'; import { Plane } from './Plane'; export class FloorPlane extends Plane @@ -13,7 +13,7 @@ export class FloorPlane extends Plane { const visualization = this.getPlaneVisualization(scale); - if(!visualization || !visualization.geometry) return null; + if (!visualization || !visualization.geometry) return null; const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (height / visualization.geometry.scale), 0)); @@ -22,7 +22,7 @@ export class FloorPlane extends Plane let x = 0; let y = 0; - if(_local_10 && _local_11 && _local_12) + if (_local_10 && _local_11 && _local_12) { width = Math.round(Math.abs((_local_10.x - _local_12.x))); height = Math.round(Math.abs((_local_10.x - _local_11.x))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts index 76fcbf33..0635610e 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts @@ -1,5 +1,5 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../../api'; import { PlaneBitmapData } from '../../utils/PlaneBitmapData'; import { FloorPlane } from './FloorPlane'; import { PlaneRasterizer } from './PlaneRasterizer'; @@ -8,22 +8,22 @@ export class FloorRasterizer extends PlaneRasterizer { protected initializePlanes(): void { - if(!this.data) return; + if (!this.data) return; const floors = this.data.floors; - if(floors && floors.length) this.parseFloors(floors); + if (floors && floors.length) this.parseFloors(floors); } private parseFloors(k: any): void { - if(!k) return; + if (!k) return; - for(const floorIndex in k) + for (const floorIndex in k) { const floor = k[floorIndex]; - if(!floor) continue; + if (!floor) continue; const id = floor.id; const visualization = floor.visualizations; @@ -31,7 +31,7 @@ export class FloorRasterizer extends PlaneRasterizer this.parseVisualizations(plane, visualization); - if(!this.addPlane(id, plane)) plane.dispose(); + if (!this.addPlane(id, plane)) plane.dispose(); } } @@ -39,19 +39,19 @@ export class FloorRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as FloorPlane; - if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane; + if (!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane; - if(!plane) return null; + if (!plane) return null; - if(canvas) canvas.clear(); + if (canvas) canvas.clear(); let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY); - if(graphic && (graphic !== canvas)) + if (graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if(!graphic) return null; + if (!graphic) return null; } return new PlaneBitmapData(graphic, -1); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts index 05912511..f366af3a 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts @@ -1,4 +1,4 @@ -import { IRoomGeometry } from '../../../../../../../room/utils/IRoomGeometry'; +import { IRoomGeometry } from '../../../../../../../api'; import { PlaneVisualization } from './PlaneVisualization'; import { PlaneVisualizationLayer } from './PlaneVisualizationLayer'; @@ -24,9 +24,9 @@ export class Plane public dispose(): void { - for(const visualization of this._planeVisualizations.values()) + for (const visualization of this._planeVisualizations.values()) { - if(!visualization) continue; + if (!visualization) continue; visualization.dispose(); } @@ -39,9 +39,9 @@ export class Plane public clearCache(): void { - for(const visualization of this._planeVisualizations.values()) + for (const visualization of this._planeVisualizations.values()) { - if(!visualization) continue; + if (!visualization) continue; visualization.clearCache(); } @@ -51,7 +51,7 @@ export class Plane { const existing = this._planeVisualizations.get(size.toString()); - if(existing) return null; + if (existing) return null; const plane = new PlaneVisualization(size, totalLayers, geometry); @@ -68,11 +68,11 @@ export class Plane let sizeIndex = 0; let i = 1; - while(i < this._sizes.length) + while (i < this._sizes.length) { - if(this._sizes[i] > size) + if (this._sizes[i] > size) { - if((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i; + if ((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i; break; } @@ -87,11 +87,11 @@ export class Plane protected getPlaneVisualization(size: number): PlaneVisualization { - if(size === this._lastSize) return this._lastPlaneVisualization; + if (size === this._lastSize) return this._lastPlaneVisualization; const sizeIndex = this.getSizeIndex(size); - if(sizeIndex < this._sizes.length) + if (sizeIndex < this._sizes.length) { this._lastPlaneVisualization = this._planeVisualizations.get(this._sizes[sizeIndex].toString()); } diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts index e263e1df..f0b22396 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts @@ -1,5 +1,5 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../../api'; import { PlaneMaterialCellMatrix } from './PlaneMaterialCellMatrix'; export class PlaneMaterial @@ -18,11 +18,11 @@ export class PlaneMaterial public dispose(): void { - if(this._planeMaterialItems && this._planeMaterialItems.length) + if (this._planeMaterialItems && this._planeMaterialItems.length) { - for(const item of this._planeMaterialItems) + for (const item of this._planeMaterialItems) { - if(!item) continue; + if (!item) continue; item.dispose(); } @@ -35,13 +35,13 @@ export class PlaneMaterial public clearCache(): void { - if(!this._isCached) return; + if (!this._isCached) return; - if(this._planeMaterialItems && this._planeMaterialItems.length) + if (this._planeMaterialItems && this._planeMaterialItems.length) { - for(const item of this._planeMaterialItems) + for (const item of this._planeMaterialItems) { - if(!item) continue; + if (!item) continue; item.clearCache(); } @@ -61,15 +61,15 @@ export class PlaneMaterial public getMaterialCellMatrix(normal: IVector3D): PlaneMaterialCellMatrix { - if(!normal) return null; + if (!normal) return null; - if(this._planeMaterialItems && this._planeMaterialItems.length) + if (this._planeMaterialItems && this._planeMaterialItems.length) { - for(const item of this._planeMaterialItems) + for (const item of this._planeMaterialItems) { - if(!item) continue; + if (!item) continue; - if((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item; + if ((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item; } } @@ -78,13 +78,13 @@ export class PlaneMaterial public render(canvas: Graphics, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): Graphics { - if(width < 1) width = 1; + if (width < 1) width = 1; - if(height < 1) height = 1; + if (height < 1) height = 1; const cellMatrix = this.getMaterialCellMatrix(normal); - if(!cellMatrix) return null; + if (!cellMatrix) return null; this._isCached = true; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts index f6914f5c..6be502d3 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts @@ -1,7 +1,6 @@ import { Matrix, Point } from '@pixi/math'; -import { IGraphicAsset } from '../../../../../../../api'; +import { IGraphicAsset, IVector3D } from '../../../../../../../api'; import { NitroSprite } from '../../../../../../../pixi-proxy'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; import { Randomizer } from '../../utils'; import { PlaneTexture } from './PlaneTexture'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts index 18db882f..4066b131 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts @@ -1,7 +1,7 @@ import { Graphics } from '@pixi/graphics'; +import { IVector3D } from '../../../../../../../api'; import { NitroRenderTexture } from '../../../../../../../pixi-proxy'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { Vector3d } from '../../../../../../../room'; import { PlaneMaterialCell } from './PlaneMaterialCell'; export class PlaneMaterialCellColumn diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts index 5c46f2fe..b861fd8c 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts @@ -1,8 +1,8 @@ import { Graphics } from '@pixi/graphics'; import { Point, Rectangle } from '@pixi/math'; +import { IVector3D } from '../../../../../../../api'; import { TextureUtils } from '../../../../../../../pixi-proxy'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { Vector3d } from '../../../../../../../room'; import { RoomVisualization } from '../../RoomVisualization'; import { Randomizer } from '../../utils/Randomizer'; import { PlaneMaterialCell } from './PlaneMaterialCell'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts index 98023d15..fd93fd38 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts @@ -1,12 +1,8 @@ import { Resource, Texture } from '@pixi/core'; import { Graphics } from '@pixi/graphics'; import { Point } from '@pixi/math'; -import { IGraphicAsset, IGraphicAssetCollection } from '../../../../../../../api'; -import { IRoomGeometry } from '../../../../../../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Rasterizer } from '../../../../../../../room/utils/Rasterizer'; -import { RoomGeometry } from '../../../../../../../room/utils/RoomGeometry'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { IGraphicAsset, IGraphicAssetCollection, IRoomGeometry, IVector3D } from '../../../../../../../api'; +import { Rasterizer, RoomGeometry, Vector3d } from '../../../../../../../room'; import { PlaneBitmapData } from '../../utils/PlaneBitmapData'; import { IPlaneRasterizer } from '../IPlaneRasterizer'; import { FloorPlane } from './FloorPlane'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts index e0d07273..2f06f190 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../../api'; import { PlaneTextureBitmap } from './PlaneTextureBitmap'; export class PlaneTexture @@ -16,11 +16,11 @@ export class PlaneTexture public dispose(): void { - if(this._bitmaps) + if (this._bitmaps) { - for(const bitmap of this._bitmaps) + for (const bitmap of this._bitmaps) { - if(!bitmap) continue; + if (!bitmap) continue; bitmap.dispose(); } @@ -38,20 +38,20 @@ export class PlaneTexture { const _local_2 = this.getPlaneTextureBitmap(k); - if(!_local_2) return null; + if (!_local_2) return null; return _local_2.bitmap; } public getPlaneTextureBitmap(k: IVector3D): PlaneTextureBitmap { - if(!k) return null; + if (!k) return null; - for(const bitmap of this._bitmaps) + for (const bitmap of this._bitmaps) { - if(!bitmap) continue; + if (!bitmap) continue; - if((((k.x >= bitmap.normalMinX) && (k.x <= bitmap.normalMaxX)) && (k.y >= bitmap.normalMinY)) && (k.y <= bitmap.normalMaxY)) return bitmap; + if ((((k.x >= bitmap.normalMinX) && (k.x <= bitmap.normalMaxX)) && (k.y >= bitmap.normalMinY)) && (k.y <= bitmap.normalMaxY)) return bitmap; } return null; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts index 5ef6f18a..bb14f3d6 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts @@ -1,8 +1,6 @@ import { Graphics } from '@pixi/graphics'; -import { IDisposable, IGraphicAssetCollection } from '../../../../../../../api'; -import { IRoomGeometry } from '../../../../../../../room/utils/IRoomGeometry'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { IDisposable, IGraphicAssetCollection, IRoomGeometry, IVector3D } from '../../../../../../../api'; +import { Vector3d } from '../../../../../../../room'; import { PlaneVisualizationAnimationLayer } from '../animated/PlaneVisualizationAnimationLayer'; import { PlaneMaterial } from './PlaneMaterial'; import { PlaneVisualizationLayer } from './PlaneVisualizationLayer'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts index 151372be..46c8eab3 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts @@ -1,7 +1,7 @@ import { Graphics } from '@pixi/graphics'; import { Rectangle } from '@pixi/math'; +import { IVector3D } from '../../../../../../../api'; import { TextureUtils } from '../../../../../../../pixi-proxy'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; import { RoomVisualization } from '../../RoomVisualization'; import { PlaneMaterial } from './PlaneMaterial'; diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts index bf8b77a8..6ab6c31e 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts @@ -1,6 +1,6 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; -import { Vector3d } from '../../../../../../../room/utils/Vector3d'; +import { IVector3D } from '../../../../../../../api'; +import { Vector3d } from '../../../../../../../room'; import { Plane } from './Plane'; export class WallPlane extends Plane @@ -13,13 +13,13 @@ export class WallPlane extends Plane { const visualization = this.getPlaneVisualization(size); - if(!visualization || !visualization.geometry) return null; + if (!visualization || !visualization.geometry) return null; const _local_8 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); const _local_9 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, (height / visualization.geometry.scale))); const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, (width / visualization.geometry.scale), 0)); - if(_local_8 && _local_9 && _local_10) + if (_local_8 && _local_9 && _local_10) { width = Math.round(Math.abs((_local_8.x - _local_10.x))); height = Math.round(Math.abs((_local_8.y - _local_9.y))); diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts index 33ab6f18..c28045dc 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts @@ -1,5 +1,5 @@ import { Graphics } from '@pixi/graphics'; -import { IVector3D } from '../../../../../../../room/utils/IVector3D'; +import { IVector3D } from '../../../../../../../api'; import { PlaneBitmapData } from '../../utils/PlaneBitmapData'; import { PlaneRasterizer } from './PlaneRasterizer'; import { WallPlane } from './WallPlane'; @@ -8,22 +8,22 @@ export class WallRasterizer extends PlaneRasterizer { protected initializePlanes(): void { - if(!this.data) return; + if (!this.data) return; const walls = this.data.walls; - if(walls && walls.length) this.parseWalls(walls); + if (walls && walls.length) this.parseWalls(walls); } private parseWalls(k: any): void { - if(!k) return; + if (!k) return; - for(const wallIndex in k) + for (const wallIndex in k) { const wall = k[wallIndex]; - if(!wall) continue; + if (!wall) continue; const id = wall.id; const visualization = wall.visualizations; @@ -31,7 +31,7 @@ export class WallRasterizer extends PlaneRasterizer this.parseVisualizations(plane, visualization); - if(!this.addPlane(id, plane)) plane.dispose(); + if (!this.addPlane(id, plane)) plane.dispose(); } } @@ -39,11 +39,11 @@ export class WallRasterizer extends PlaneRasterizer { let plane = this.getPlane(id) as WallPlane; - if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane; + if (!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane; - if(!plane) return null; + if (!plane) return null; - if(canvas) + if (canvas) { const rectangle = canvas.getBounds(); @@ -54,11 +54,11 @@ export class WallRasterizer extends PlaneRasterizer let graphic = plane.render(canvas, width, height, scale, normal, useTexture); - if(graphic && (graphic !== canvas)) + if (graphic && (graphic !== canvas)) { graphic = graphic.clone(); - if(!graphic) return null; + if (!graphic) return null; } return new PlaneBitmapData(graphic, -1); @@ -66,9 +66,9 @@ export class WallRasterizer extends PlaneRasterizer public getTextureIdentifier(k: number, normal: IVector3D): string { - if(normal) + if (normal) { - return `${ k }_${ normal.x }_${ normal.y }_${ normal.z }`; + return `${k}_${normal.x}_${normal.y}_${normal.z}`; } return super.getTextureIdentifier(k, normal); diff --git a/src/nitro/room/preview/RoomPreviewer.ts b/src/nitro/room/preview/RoomPreviewer.ts index 543a5d63..fb49c19a 100644 --- a/src/nitro/room/preview/RoomPreviewer.ts +++ b/src/nitro/room/preview/RoomPreviewer.ts @@ -2,12 +2,9 @@ import { RenderTexture, Texture } from '@pixi/core'; import { Container, DisplayObject } from '@pixi/display'; import { Point, Rectangle } from '@pixi/math'; import { Sprite } from '@pixi/sprite'; +import { IRoomObjectController, IRoomRenderingCanvas, IVector3D } from '../../../api'; import { NitroSprite } from '../../../pixi-proxy'; -import { IRoomObjectController } from '../../../room/object/IRoomObjectController'; -import { IRoomRenderingCanvas } from '../../../room/renderer/IRoomRenderingCanvas'; -import { IVector3D } from '../../../room/utils/IVector3D'; -import { RoomId } from '../../../room/utils/RoomId'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { RoomId, Vector3d } from '../../../room'; import { FloorHeightMapMessageParser } from '../../communication/messages/parser/room/mapping/FloorHeightMapMessageParser'; import { RoomEntryTileMessageParser } from '../../communication/messages/parser/room/mapping/RoomEntryTileMessageParser'; import { Nitro } from '../../Nitro'; diff --git a/src/nitro/room/utils/LegacyWallGeometry.ts b/src/nitro/room/utils/LegacyWallGeometry.ts index 38d5de3d..81d06a83 100644 --- a/src/nitro/room/utils/LegacyWallGeometry.ts +++ b/src/nitro/room/utils/LegacyWallGeometry.ts @@ -1,5 +1,5 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; export class LegacyWallGeometry { @@ -48,7 +48,7 @@ export class LegacyWallGeometry public initialize(width: number, height: number, floorHeight: number): void { - if((width <= this._width) && (height <= this._height)) + if ((width <= this._width) && (height <= this._height)) { this._width = width; this._height = height; @@ -61,7 +61,7 @@ export class LegacyWallGeometry let y = 0; - while(y < height) + while (y < height) { const heights: number[] = []; @@ -69,7 +69,7 @@ export class LegacyWallGeometry let x = 0; - while(x < width) + while (x < width) { heights.push(0); @@ -91,11 +91,11 @@ export class LegacyWallGeometry public setHeight(x: number, y: number, height: number): boolean { - if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return false; + if ((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return false; const heightMap = this._heightMap[y]; - if(!heightMap) return false; + if (!heightMap) return false; heightMap[x] = height; @@ -104,11 +104,11 @@ export class LegacyWallGeometry public getHeight(x: number, y: number): number { - if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return 0; + if ((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return 0; const heightMap = this._heightMap[y]; - if(!heightMap) return 0; + if (!heightMap) return 0; return heightMap[x]; } @@ -118,22 +118,22 @@ export class LegacyWallGeometry let _local_12: number; let _local_6: number; let _local_7: number; - if(((k == 0) && (_arg_2 == 0))) + if (((k == 0) && (_arg_2 == 0))) { k = this._width; _arg_2 = this._height; _local_12 = Math.round((this.scale / 10)); - if(_arg_5 == LegacyWallGeometry.R) + if (_arg_5 == LegacyWallGeometry.R) { _local_7 = (this._width - 1); - while(_local_7 >= 0) + while (_local_7 >= 0) { _local_6 = 1; - while(_local_6 < this._height) + while (_local_6 < this._height) { - if(this.getHeight(_local_7, _local_6) <= this._floorHeight) + if (this.getHeight(_local_7, _local_6) <= this._floorHeight) { - if((_local_6 - 1) < _arg_2) + if ((_local_6 - 1) < _arg_2) { k = _local_7; _arg_2 = (_local_6 - 1); @@ -150,14 +150,14 @@ export class LegacyWallGeometry else { _local_6 = (this._height - 1); - while(_local_6 >= 0) + while (_local_6 >= 0) { _local_7 = 1; - while(_local_7 < this._width) + while (_local_7 < this._width) { - if(this.getHeight(_local_7, _local_6) <= this._floorHeight) + if (this.getHeight(_local_7, _local_6) <= this._floorHeight) { - if((_local_7 - 1) < k) + if ((_local_7 - 1) < k) { k = (_local_7 - 1); _arg_2 = _local_6; @@ -175,7 +175,7 @@ export class LegacyWallGeometry let _local_8: number = k; let _local_9: number = _arg_2; let _local_10: number = this.getHeight(k, _arg_2); - if(_arg_5 == LegacyWallGeometry.R) + if (_arg_5 == LegacyWallGeometry.R) { _local_8 = (_local_8 + ((_arg_3 / (this._scale / 2)) - 0.5)); _local_9 = (_local_9 + 0.5); @@ -187,11 +187,11 @@ export class LegacyWallGeometry _local_8 = (_local_8 + 0.5); _local_10 = (_local_10 - ((_arg_4 - (((this._scale / 2) - _arg_3) / 2)) / (this._scale / 2))); } - const _local_11:Vector3d = new Vector3d(_local_8, _local_9, _local_10); + const _local_11: Vector3d = new Vector3d(_local_8, _local_9, _local_10); return _local_11; } - public getLocationOldFormat(k: number, _arg_2: number, _arg_3: string):IVector3D + public getLocationOldFormat(k: number, _arg_2: number, _arg_3: string): IVector3D { let _local_4: number; let _local_5: number; @@ -204,11 +204,11 @@ export class LegacyWallGeometry let _local_11: number; let _local_12 = 0; _local_4 = 0; - while(_local_4 < this._width) + while (_local_4 < this._width) { - if(((_local_5 >= 0) && (_local_5 < this._height))) + if (((_local_5 >= 0) && (_local_5 < this._height))) { - if(this.getHeight(_local_4, _local_5) <= this._floorHeight) + if (this.getHeight(_local_4, _local_5) <= this._floorHeight) { _local_8 = (_local_4 - 1); _local_9 = _local_5; @@ -216,7 +216,7 @@ export class LegacyWallGeometry _arg_3 = LegacyWallGeometry.L; break; } - if(this.getHeight(_local_4, (_local_5 + 1)) <= this._floorHeight) + if (this.getHeight(_local_4, (_local_5 + 1)) <= this._floorHeight) { _local_8 = _local_4; _local_9 = _local_5; @@ -233,7 +233,7 @@ export class LegacyWallGeometry _local_13 = (_local_13 + ((((-(_arg_2) * 18) / 32) * this.scale) / 2)); _local_12 = this.getHeight(_local_8, _local_9); _local_11 = (((_local_12 * this.scale) / 2) + _local_13); - if(_arg_3 == LegacyWallGeometry.R) + if (_arg_3 == LegacyWallGeometry.R) { _local_11 = (_local_11 + ((_local_6 * this.scale) / 4)); } @@ -244,9 +244,9 @@ export class LegacyWallGeometry return this.getLocation(_local_8, _local_9, _local_10, _local_11, _arg_3); } - public getOldLocation(k:IVector3D, _arg_2: number): [ number, number, number, number, string ] + public getOldLocation(k: IVector3D, _arg_2: number): [number, number, number, number, string] { - if(k == null) + if (k == null) { return null; } @@ -256,7 +256,7 @@ export class LegacyWallGeometry let _local_6 = 0; let _local_7 = ''; let _local_8 = 0; - if(_arg_2 == 90) + if (_arg_2 == 90) { _local_3 = Math.floor((k.x - 0.5)); _local_4 = Math.floor((k.y + 0.5)); @@ -267,7 +267,7 @@ export class LegacyWallGeometry } else { - if(_arg_2 == 180) + if (_arg_2 == 180) { _local_3 = Math.floor((k.x + 0.5)); _local_4 = Math.floor((k.y - 0.5)); @@ -284,10 +284,10 @@ export class LegacyWallGeometry return [_local_3, _local_4, _local_5, _local_6, _local_7]; } - public getOldLocationString(k:IVector3D, _arg_2: number): string + public getOldLocationString(k: IVector3D, _arg_2: number): string { const _local_3 = this.getOldLocation(k, _arg_2); - if(_local_3 == null) + if (_local_3 == null) { return null; } @@ -302,7 +302,7 @@ export class LegacyWallGeometry public getDirection(k: string): number { - if(k == LegacyWallGeometry.R) + if (k == LegacyWallGeometry.R) { return 180; } diff --git a/src/nitro/room/utils/ObjectRolling.ts b/src/nitro/room/utils/ObjectRolling.ts index a49592e2..3b45d442 100644 --- a/src/nitro/room/utils/ObjectRolling.ts +++ b/src/nitro/room/utils/ObjectRolling.ts @@ -1,4 +1,4 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; +import { IVector3D } from '../../../api'; export class ObjectRolling { @@ -37,4 +37,4 @@ export class ObjectRolling { return this._movementType; } -} \ No newline at end of file +} diff --git a/src/nitro/room/utils/RoomCamera.ts b/src/nitro/room/utils/RoomCamera.ts index 9cd9ec7c..e5be4b34 100644 --- a/src/nitro/room/utils/RoomCamera.ts +++ b/src/nitro/room/utils/RoomCamera.ts @@ -1,5 +1,5 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; export class RoomCamera { @@ -7,12 +7,12 @@ export class RoomCamera private _targetId: number = -1; private _targetCategory: number = -2; - private _targetLoc:Vector3d = null; + private _targetLoc: Vector3d = null; private _moveDistance: number = 0; private _previousMoveSpeed: number = 0; private _maintainPreviousMoveSpeed: boolean = false; - private _currentLoc:Vector3d = null; - private _targetObjectLoc:Vector3d; + private _currentLoc: Vector3d = null; + private _targetObjectLoc: Vector3d; private _limitedLocX: boolean = false; private _limitedLocY: boolean = false; private _centeredLocX: boolean = false; @@ -31,7 +31,7 @@ export class RoomCamera this._targetObjectLoc = new Vector3d(); } - public get location():IVector3D + public get location(): IVector3D { return this._currentLoc; } @@ -56,12 +56,12 @@ export class RoomCamera this._targetCategory = k; } - public get targetObjectLoc():IVector3D + public get targetObjectLoc(): IVector3D { return this._targetObjectLoc; } - public set targetObjectLoc(k:IVector3D) + public set targetObjectLoc(k: IVector3D) { this._targetObjectLoc.assign(k); } @@ -133,7 +133,7 @@ export class RoomCamera public set scale(k: number) { - if(this._scale != k) + if (this._scale != k) { this._scale = k; this._scaleChanged = true; @@ -172,21 +172,21 @@ export class RoomCamera public get isMoving(): boolean { - if(((!(this._targetLoc == null)) && (!(this._currentLoc == null)))) + if (((!(this._targetLoc == null)) && (!(this._currentLoc == null)))) { return true; } return false; } - public set target(k:IVector3D) + public set target(k: IVector3D) { - let _local_2:Vector3d; - if(this._targetLoc == null) + let _local_2: Vector3d; + if (this._targetLoc == null) { this._targetLoc = new Vector3d(); } - if((((!(this._targetLoc.x == k.x)) || (!(this._targetLoc.y == k.y))) || (!(this._targetLoc.z == k.z)))) + if ((((!(this._targetLoc.x == k.x)) || (!(this._targetLoc.y == k.y))) || (!(this._targetLoc.z == k.z)))) { this._targetLoc.assign(k); _local_2 = Vector3d.dif(this._targetLoc, this._currentLoc); @@ -201,9 +201,9 @@ export class RoomCamera this._currentLoc = null; } - public initializeLocation(k:IVector3D): void + public initializeLocation(k: IVector3D): void { - if(this._currentLoc != null) + if (this._currentLoc != null) { return; } @@ -211,9 +211,9 @@ export class RoomCamera this._currentLoc.assign(k); } - public resetLocation(k:IVector3D): void + public resetLocation(k: IVector3D): void { - if(this._currentLoc == null) + if (this._currentLoc == null) { this._currentLoc = new Vector3d(); } @@ -222,14 +222,14 @@ export class RoomCamera public update(k: number, _arg_2: number): void { - let _local_3:Vector3d; + let _local_3: Vector3d; let _local_4: number; let _local_5: number; let _local_6: number; let _local_7: number; - if((((this._followDuration > 0) && (!(this._targetLoc == null))) && (!(this._currentLoc == null)))) + if ((((this._followDuration > 0) && (!(this._targetLoc == null))) && (!(this._currentLoc == null)))) { - if(this._scaleChanged) + if (this._scaleChanged) { this._scaleChanged = false; this._currentLoc = this._targetLoc; @@ -237,11 +237,11 @@ export class RoomCamera return; } _local_3 = Vector3d.dif(this._targetLoc, this._currentLoc); - if(_local_3.length > this._moveDistance) + if (_local_3.length > this._moveDistance) { this._moveDistance = _local_3.length; } - if(_local_3.length <= _arg_2) + if (_local_3.length <= _arg_2) { this._currentLoc = this._targetLoc; this._targetLoc = null; @@ -253,12 +253,12 @@ export class RoomCamera _local_5 = (_arg_2 * 0.5); _local_6 = (this._moveDistance / RoomCamera.MOVE_SPEED_DENOMINATOR); _local_7 = (_local_5 + ((_local_6 - _local_5) * _local_4)); - if(this._maintainPreviousMoveSpeed) + if (this._maintainPreviousMoveSpeed) { - if(_local_7 < this._previousMoveSpeed) + if (_local_7 < this._previousMoveSpeed) { _local_7 = this._previousMoveSpeed; - if(_local_7 > _local_3.length) + if (_local_7 > _local_3.length) { _local_7 = _local_3.length; } diff --git a/src/nitro/room/utils/RoomData.ts b/src/nitro/room/utils/RoomData.ts index 47042d62..c3a2629d 100644 --- a/src/nitro/room/utils/RoomData.ts +++ b/src/nitro/room/utils/RoomData.ts @@ -1,4 +1,4 @@ -import { RoomMapData } from '../object/RoomMapData'; +import { RoomMapData } from '../object'; export class RoomData { @@ -56,4 +56,4 @@ export class RoomData { this._landscapeType = k; } -} \ No newline at end of file +} diff --git a/src/nitro/room/utils/RoomFurnitureData.ts b/src/nitro/room/utils/RoomFurnitureData.ts index 6e023488..da1729ec 100644 --- a/src/nitro/room/utils/RoomFurnitureData.ts +++ b/src/nitro/room/utils/RoomFurnitureData.ts @@ -1,6 +1,6 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; -import { IObjectData } from '../object/data/IObjectData'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; +import { IObjectData } from '../object'; export class RoomFurnitureData { diff --git a/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts b/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts index 91346e1c..06618d3e 100644 --- a/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts +++ b/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts @@ -1,4 +1,4 @@ -import { IRoomObjectController } from '../../../room/object/IRoomObjectController'; +import { IRoomObjectController } from '../../../api'; export class RoomObjectBadgeImageAssetListener { @@ -20,4 +20,4 @@ export class RoomObjectBadgeImageAssetListener { return this._groupBadge; } -} \ No newline at end of file +} diff --git a/src/nitro/room/utils/SelectedRoomObjectData.ts b/src/nitro/room/utils/SelectedRoomObjectData.ts index e56b57a6..940212ab 100644 --- a/src/nitro/room/utils/SelectedRoomObjectData.ts +++ b/src/nitro/room/utils/SelectedRoomObjectData.ts @@ -1,7 +1,7 @@ -import { IVector3D } from '../../../room/utils/IVector3D'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { IVector3D } from '../../../api'; +import { Vector3d } from '../../../room'; import { ISelectedRoomObjectData } from '../ISelectedRoomObjectData'; -import { IObjectData } from '../object/data/IObjectData'; +import { IObjectData } from '../object'; export class SelectedRoomObjectData implements ISelectedRoomObjectData { @@ -49,12 +49,12 @@ export class SelectedRoomObjectData implements ISelectedRoomObjectData return this._operation; } - public get loc():Vector3d + public get loc(): Vector3d { return this._loc; } - public get dir():Vector3d + public get dir(): Vector3d { return this._dir; } diff --git a/src/nitro/room/utils/SpriteDataCollector.ts b/src/nitro/room/utils/SpriteDataCollector.ts index 53850be6..4514d4e7 100644 --- a/src/nitro/room/utils/SpriteDataCollector.ts +++ b/src/nitro/room/utils/SpriteDataCollector.ts @@ -1,12 +1,7 @@ import { Point, Rectangle } from '@pixi/math'; +import { IPlaneDrawingData, IPlaneVisualization, IRoomObjectSpriteVisualization, IRoomPlane, IRoomRenderingCanvas, RoomObjectSpriteData } from '../../../api'; import { PixiApplicationProxy } from '../../../pixi-proxy'; -import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData'; -import { IPlaneDrawingData } from '../../../room/object/visualization/IPlaneDrawingData'; -import { IPlaneVisualization } from '../../../room/object/visualization/IPlaneVisualization'; -import { IRoomObjectSpriteVisualization } from '../../../room/object/visualization/IRoomObjectSpriteVisualization'; -import { IRoomPlane } from '../../../room/object/visualization/IRoomPlane'; -import { IRoomRenderingCanvas } from '../../../room/renderer/IRoomRenderingCanvas'; -import { Vector3d } from '../../../room/utils/Vector3d'; +import { Vector3d } from '../../../room/utils'; import { RoomObjectCategory } from '../object/RoomObjectCategory'; import { PlaneDrawingData } from '../object/visualization/room/PlaneDrawingData'; import { RoomEngine } from '../RoomEngine'; @@ -385,9 +380,9 @@ export class SpriteDataCollector return _local_8; } - public getRoomPlanes(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): PlaneDrawingData[] + public getRoomPlanes(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): IPlaneDrawingData[] { - const _local_5: PlaneDrawingData[] = []; + const _local_5: IPlaneDrawingData[] = []; const roomObject = _arg_3.getRoomObject(_arg_3.activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); const visualization = (roomObject.visualization as unknown as IPlaneVisualization); diff --git a/src/nitro/room/utils/TileObjectMap.ts b/src/nitro/room/utils/TileObjectMap.ts index 65ef5f67..a23c73f4 100644 --- a/src/nitro/room/utils/TileObjectMap.ts +++ b/src/nitro/room/utils/TileObjectMap.ts @@ -1,5 +1,5 @@ -import { NitroLogger } from '../../../core'; -import { IRoomObject } from '../../../room/object/IRoomObject'; +import { IRoomObject } from '../../../api'; +import { NitroLogger } from '../../../core'; import { RoomObjectVariable } from '../object/RoomObjectVariable'; export class TileObjectMap diff --git a/src/room/RoomInstance.ts b/src/room/RoomInstance.ts index 724b9061..3508150f 100644 --- a/src/room/RoomInstance.ts +++ b/src/room/RoomInstance.ts @@ -1,12 +1,6 @@ +import { IRoomInstance, IRoomInstanceContainer, IRoomObject, IRoomObjectController, IRoomObjectManager, IRoomObjectModel, IRoomRendererBase } from '../api'; import { Disposable } from '../core'; -import { IRoomInstance } from './IRoomInstance'; -import { IRoomInstanceContainer } from './IRoomInstanceContainer'; -import { IRoomObjectManager } from './IRoomObjectManager'; -import { IRoomObject } from './object/IRoomObject'; -import { IRoomObjectController } from './object/IRoomObjectController'; -import { IRoomObjectModel } from './object/IRoomObjectModel'; -import { RoomObjectModel } from './object/RoomObjectModel'; -import { IRoomRendererBase } from './renderer/IRoomRendererBase'; +import { RoomObjectModel } from './object'; export class RoomInstance extends Disposable implements IRoomInstance { diff --git a/src/room/RoomManager.ts b/src/room/RoomManager.ts index f3adfd06..35687514 100644 --- a/src/room/RoomManager.ts +++ b/src/room/RoomManager.ts @@ -1,16 +1,7 @@ -import { IGraphicAssetCollection } from '../api'; +import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory } from '../api'; import { NitroManager } from '../core'; import { RoomContentLoader } from '../nitro/room/RoomContentLoader'; import { RoomContentLoadedEvent } from './events/RoomContentLoadedEvent'; -import { IRoomInstance } from './IRoomInstance'; -import { IRoomInstanceContainer } from './IRoomInstanceContainer'; -import { IRoomManager } from './IRoomManager'; -import { IRoomManagerListener } from './IRoomManagerListener'; -import { IRoomObjectManager } from './IRoomObjectManager'; -import { IRoomObject } from './object/IRoomObject'; -import { IRoomObjectController } from './object/IRoomObjectController'; -import { IRoomObjectLogicFactory } from './object/logic/IRoomObjectLogicFactory'; -import { IRoomObjectVisualizationFactory } from './object/visualization/IRoomObjectVisualizationFactory'; import { RoomInstance } from './RoomInstance'; import { RoomObjectManager } from './RoomObjectManager'; @@ -25,7 +16,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst private _state: number; private _rooms: Map; - private _contentLoader: RoomContentLoader; + private _contentLoader: IRoomContentLoader; private _updateCategories: number[]; private _listener: IRoomManagerListener; @@ -303,7 +294,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst } } - public setContentLoader(loader: RoomContentLoader): void + public setContentLoader(loader: IRoomContentLoader): void { if (this._contentLoader) this._contentLoader.dispose(); diff --git a/src/room/RoomObjectManager.ts b/src/room/RoomObjectManager.ts index 778bbfc8..3771d902 100644 --- a/src/room/RoomObjectManager.ts +++ b/src/room/RoomObjectManager.ts @@ -1,7 +1,6 @@ +import { IRoomObjectController, IRoomObjectManager } from '../api'; import { AdvancedMap } from '../core'; -import { IRoomObjectManager } from './IRoomObjectManager'; -import { IRoomObjectController } from './object/IRoomObjectController'; -import { RoomObject } from './object/RoomObject'; +import { RoomObject } from './object'; export class RoomObjectManager implements IRoomObjectManager { diff --git a/src/room/data/index.ts b/src/room/data/index.ts deleted file mode 100644 index d67698c4..00000000 --- a/src/room/data/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './RoomObjectSpriteData'; diff --git a/src/room/events/RoomObjectEvent.ts b/src/room/events/RoomObjectEvent.ts index f389bb02..34d84998 100644 --- a/src/room/events/RoomObjectEvent.ts +++ b/src/room/events/RoomObjectEvent.ts @@ -1,5 +1,5 @@ +import { IRoomObject } from '../../api'; import { NitroEvent } from '../../core'; -import { IRoomObject } from '../object/IRoomObject'; export class RoomObjectEvent extends NitroEvent { diff --git a/src/room/events/RoomObjectMouseEvent.ts b/src/room/events/RoomObjectMouseEvent.ts index df10b8be..21ceef82 100644 --- a/src/room/events/RoomObjectMouseEvent.ts +++ b/src/room/events/RoomObjectMouseEvent.ts @@ -1,4 +1,4 @@ -import { IRoomObject } from '../object/IRoomObject'; +import { IRoomObject } from '../../api'; import { RoomObjectEvent } from './RoomObjectEvent'; export class RoomObjectMouseEvent extends RoomObjectEvent diff --git a/src/room/events/RoomSpriteMouseEvent.ts b/src/room/events/RoomSpriteMouseEvent.ts index bb6bab0d..2edd5221 100644 --- a/src/room/events/RoomSpriteMouseEvent.ts +++ b/src/room/events/RoomSpriteMouseEvent.ts @@ -1,4 +1,6 @@ -export class RoomSpriteMouseEvent +import { IRoomSpriteMouseEvent } from '../../api'; + +export class RoomSpriteMouseEvent implements IRoomSpriteMouseEvent { private _type: string; private _eventId: string; diff --git a/src/room/index.ts b/src/room/index.ts index b5b45eac..b70a77d8 100644 --- a/src/room/index.ts +++ b/src/room/index.ts @@ -1,13 +1,11 @@ -export * from './data'; export * from './events'; -export * from './IRoomInstance'; -export * from './IRoomInstanceContainer'; -export * from './IRoomManager'; -export * from './IRoomManagerListener'; -export * from './IRoomObjectManager'; export * from './messages'; export * from './object'; +export * from './object/logic'; +export * from './object/visualization'; export * from './renderer'; +export * from './renderer/cache'; +export * from './renderer/utils'; export * from './RoomInstance'; export * from './RoomManager'; export * from './RoomObjectManager'; diff --git a/src/room/messages/RoomObjectUpdateMessage.ts b/src/room/messages/RoomObjectUpdateMessage.ts index 93d61986..af48569a 100644 --- a/src/room/messages/RoomObjectUpdateMessage.ts +++ b/src/room/messages/RoomObjectUpdateMessage.ts @@ -1,4 +1,4 @@ -import { IVector3D } from '../utils/IVector3D'; +import { IVector3D } from '../../api'; export class RoomObjectUpdateMessage { @@ -20,4 +20,4 @@ export class RoomObjectUpdateMessage { return this._direction; } -} \ No newline at end of file +} diff --git a/src/room/object/RoomObject.ts b/src/room/object/RoomObject.ts index f908ed20..2bb72446 100644 --- a/src/room/object/RoomObject.ts +++ b/src/room/object/RoomObject.ts @@ -1,13 +1,7 @@ +import { IRoomObjectController, IRoomObjectEventHandler, IRoomObjectModel, IRoomObjectMouseHandler, IRoomObjectUpdateMessage, IRoomObjectVisualization, IVector3D } from '../../api'; import { Disposable } from '../../core'; -import { RoomObjectUpdateMessage } from '../messages/RoomObjectUpdateMessage'; -import { IVector3D } from '../utils/IVector3D'; import { Vector3d } from '../utils/Vector3d'; -import { IRoomObjectController } from './IRoomObjectController'; -import { IRoomObjectModel } from './IRoomObjectModel'; -import { IRoomObjectEventHandler } from './logic/IRoomObjectEventHandler'; -import { IRoomObjectMouseHandler } from './logic/IRoomObjectMouseHandler'; import { RoomObjectModel } from './RoomObjectModel'; -import { IRoomObjectVisualization } from './visualization/IRoomObjectVisualization'; export class RoomObject extends Disposable implements IRoomObjectController { @@ -24,7 +18,7 @@ export class RoomObject extends Disposable implements IRoomObjectController private _visualization: IRoomObjectVisualization; private _logic: IRoomObjectEventHandler; - private _pendingLogicMessages: RoomObjectUpdateMessage[]; + private _pendingLogicMessages: IRoomObjectUpdateMessage[]; private _updateCounter: number; private _isReady: boolean; @@ -173,7 +167,7 @@ export class RoomObject extends Disposable implements IRoomObjectController } } - public processUpdateMessage(message: RoomObjectUpdateMessage): void + public processUpdateMessage(message: IRoomObjectUpdateMessage): void { if (this._logic) return this._logic.processUpdateMessage(message); diff --git a/src/room/object/RoomObjectModel.ts b/src/room/object/RoomObjectModel.ts index d610ce24..9696bbff 100644 --- a/src/room/object/RoomObjectModel.ts +++ b/src/room/object/RoomObjectModel.ts @@ -1,4 +1,4 @@ -import { IRoomObjectModel } from './IRoomObjectModel'; +import { IRoomObjectModel } from '../../api'; export class RoomObjectModel implements IRoomObjectModel { @@ -27,9 +27,9 @@ export class RoomObjectModel implements IRoomObjectModel public setValue(key: string, value: T): void { - if(this._map.has(key)) + if (this._map.has(key)) { - if(this._map.get(key) === value) return; + if (this._map.get(key) === value) return; } this._map.set(key, (value as T)); @@ -39,7 +39,7 @@ export class RoomObjectModel implements IRoomObjectModel public removeKey(key: string): void { - if(!key) return; + if (!key) return; this._map.delete(key); diff --git a/src/room/object/index.ts b/src/room/object/index.ts index 559eb05e..0ef08671 100644 --- a/src/room/object/index.ts +++ b/src/room/object/index.ts @@ -1,8 +1,3 @@ -export * from './enum'; -export * from './IRoomObject'; -export * from './IRoomObjectController'; -export * from './IRoomObjectModel'; -export * from './IRoomObjectModelController'; export * from './logic'; export * from './RoomObject'; export * from './RoomObjectModel'; diff --git a/src/room/object/logic/IRoomObjectMouseHandler.ts b/src/room/object/logic/IRoomObjectMouseHandler.ts deleted file mode 100644 index 676faba8..00000000 --- a/src/room/object/logic/IRoomObjectMouseHandler.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { RoomSpriteMouseEvent } from '../../events/RoomSpriteMouseEvent'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; - -export interface IRoomObjectMouseHandler -{ - mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void; -} \ No newline at end of file diff --git a/src/room/object/logic/RoomObjectLogicBase.ts b/src/room/object/logic/RoomObjectLogicBase.ts index 512f677d..34610cc9 100644 --- a/src/room/object/logic/RoomObjectLogicBase.ts +++ b/src/room/object/logic/RoomObjectLogicBase.ts @@ -1,10 +1,6 @@ -import { IEventDispatcher } from '../../../api'; +import { IEventDispatcher, IRoomGeometry, IRoomObjectController, IRoomObjectEventHandler, IRoomObjectUpdateMessage } from '../../../api'; import { Disposable } from '../../../core'; -import { RoomSpriteMouseEvent } from '../../events/RoomSpriteMouseEvent'; -import { RoomObjectUpdateMessage } from '../../messages/RoomObjectUpdateMessage'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; -import { IRoomObjectController } from '../IRoomObjectController'; -import { IRoomObjectEventHandler } from './IRoomObjectEventHandler'; +import { RoomSpriteMouseEvent } from '../../events'; export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventHandler { @@ -40,7 +36,7 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH return; } - public processUpdateMessage(message: RoomObjectUpdateMessage): void + public processUpdateMessage(message: IRoomObjectUpdateMessage): void { if (!message || !this._object) return; diff --git a/src/room/object/logic/index.ts b/src/room/object/logic/index.ts index fe319e39..17132cbf 100644 --- a/src/room/object/logic/index.ts +++ b/src/room/object/logic/index.ts @@ -1,4 +1 @@ -export * from './IRoomObjectEventHandler'; -export * from './IRoomObjectLogicFactory'; -export * from './IRoomObjectMouseHandler'; export * from './RoomObjectLogicBase'; diff --git a/src/room/object/visualization/IRoomPlane.ts b/src/room/object/visualization/IRoomPlane.ts deleted file mode 100644 index 476fef77..00000000 --- a/src/room/object/visualization/IRoomPlane.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { PlaneDrawingData } from '../../../nitro/room/object/visualization/room/PlaneDrawingData'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; -import { IVector3D } from '../../utils/IVector3D'; - -export interface IRoomPlane -{ - uniqueId: number; - location: IVector3D; - leftSide: IVector3D; - rightSide: IVector3D; - color: number; - getDrawingDatas(_arg_1: IRoomGeometry): PlaneDrawingData[]; -} diff --git a/src/room/object/visualization/RoomObjectSprite.ts b/src/room/object/visualization/RoomObjectSprite.ts index 6a295cf0..609b322e 100644 --- a/src/room/object/visualization/RoomObjectSprite.ts +++ b/src/room/object/visualization/RoomObjectSprite.ts @@ -1,9 +1,7 @@ import { BLEND_MODES } from '@pixi/constants'; import { Filter, Resource, Texture } from '@pixi/core'; import { Container } from '@pixi/display'; -import { AlphaTolerance } from '../enum/AlphaTolerance'; -import { RoomObjectSpriteType } from '../enum/RoomObjectSpriteType'; -import { IRoomObjectSprite } from './IRoomObjectSprite'; +import { AlphaTolerance, IRoomObjectSprite, RoomObjectSpriteType } from '../../../api'; export class RoomObjectSprite implements IRoomObjectSprite { @@ -98,7 +96,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set name(name: string) { - if(this._name === name) return; + if (this._name === name) return; this._name = name; @@ -132,9 +130,9 @@ export class RoomObjectSprite implements IRoomObjectSprite public set texture(texture: Texture) { - if(this._texture === texture) return; + if (this._texture === texture) return; - if(texture) + if (texture) { this._width = texture.width; this._height = texture.height; @@ -152,11 +150,11 @@ export class RoomObjectSprite implements IRoomObjectSprite public set container(container: Container) { - if(this._container === container) return; + if (this._container === container) return; this.texture = Texture.EMPTY; - if(container) + if (container) { this._width = container.width; this._height = container.height; @@ -186,7 +184,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set offsetX(x: number) { - if(this._offsetX === x) return; + if (this._offsetX === x) return; this._offsetX = x; @@ -200,7 +198,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set offsetY(y: number) { - if(this._offsetY === y) return; + if (this._offsetY === y) return; this._offsetY = y; @@ -214,7 +212,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set flipH(flip: boolean) { - if(this._flipH === flip) return; + if (this._flipH === flip) return; this._flipH = flip; @@ -228,7 +226,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set flipV(flip: boolean) { - if(this._flipV === flip) return; + if (this._flipV === flip) return; this._flipV = flip; @@ -254,7 +252,7 @@ export class RoomObjectSprite implements IRoomObjectSprite { alpha = (alpha & 0xFF); - if(this._alpha === alpha) return; + if (this._alpha === alpha) return; this._alpha = alpha; @@ -268,7 +266,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set blendMode(blend: number) { - if(this._blendMode === blend) return; + if (this._blendMode === blend) return; this._blendMode = blend; @@ -284,7 +282,7 @@ export class RoomObjectSprite implements IRoomObjectSprite { color = (color & 0xFFFFFF); - if(this._color === color) return; + if (this._color === color) return; this._color = color; @@ -298,7 +296,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set relativeDepth(depth: number) { - if(this._relativeDepth === depth) return; + if (this._relativeDepth === depth) return; this._relativeDepth = depth; @@ -312,7 +310,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set varyingDepth(flag: boolean) { - if(flag === this._varyingDepth) return; + if (flag === this._varyingDepth) return; this._varyingDepth = flag; @@ -346,7 +344,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set visible(visible: boolean) { - if(this._visible === visible) return; + if (this._visible === visible) return; this._visible = visible; @@ -360,7 +358,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set tag(tag: string) { - if(this._tag === tag) return; + if (this._tag === tag) return; this._tag = tag; @@ -374,7 +372,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set posture(posture: string) { - if(this._posture === posture) return; + if (this._posture === posture) return; this._posture = posture; @@ -388,7 +386,7 @@ export class RoomObjectSprite implements IRoomObjectSprite public set alphaTolerance(tolerance: number) { - if(this._alphaTolerance === tolerance) return; + if (this._alphaTolerance === tolerance) return; this._alphaTolerance = tolerance; diff --git a/src/room/object/visualization/RoomObjectSpriteVisualization.ts b/src/room/object/visualization/RoomObjectSpriteVisualization.ts index a0c178bb..0bed86f9 100644 --- a/src/room/object/visualization/RoomObjectSpriteVisualization.ts +++ b/src/room/object/visualization/RoomObjectSpriteVisualization.ts @@ -1,13 +1,7 @@ import { RenderTexture } from '@pixi/core'; import { Point, Rectangle } from '@pixi/math'; -import { IGraphicAssetCollection } from '../../../api'; +import { IGraphicAssetCollection, IObjectVisualizationData, IRoomGeometry, IRoomObjectController, IRoomObjectSprite, IRoomObjectSpriteVisualization, RoomObjectSpriteData } from '../../../api'; import { NitroContainer, NitroSprite, TextureUtils } from '../../../pixi-proxy'; -import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; -import { IRoomObjectController } from '../IRoomObjectController'; -import { IRoomObjectSprite } from './IRoomObjectSprite'; -import { IRoomObjectSpriteVisualization } from './IRoomObjectSpriteVisualization'; -import { IObjectVisualizationData } from './IRoomObjectVisualizationData'; import { RoomObjectSprite } from './RoomObjectSprite'; export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualization diff --git a/src/room/object/visualization/index.ts b/src/room/object/visualization/index.ts index 6deb2049..f87ef163 100644 --- a/src/room/object/visualization/index.ts +++ b/src/room/object/visualization/index.ts @@ -1,12 +1,2 @@ -export * from './IPlaneDrawingData'; -export * from './IPlaneVisualization'; -export * from './IRoomObjectGraphicVisualization'; -export * from './IRoomObjectSprite'; -export * from './IRoomObjectSpriteVisualization'; -export * from './IRoomObjectVisualization'; -export * from './IRoomObjectVisualizationData'; -export * from './IRoomObjectVisualizationFactory'; -export * from './IRoomPlane'; -export * from './ISortableSprite'; export * from './RoomObjectSprite'; export * from './RoomObjectSpriteVisualization'; diff --git a/src/room/renderer/IRoomCanvasMouseListener.ts b/src/room/renderer/IRoomCanvasMouseListener.ts deleted file mode 100644 index ad32882a..00000000 --- a/src/room/renderer/IRoomCanvasMouseListener.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { RoomSpriteMouseEvent } from '../events/RoomSpriteMouseEvent'; -import { IRoomObject } from '../object/IRoomObject'; -import { IRoomGeometry } from '../utils/IRoomGeometry'; - -export interface IRoomCanvasMouseListener -{ - processRoomCanvasMouseEvent(event: RoomSpriteMouseEvent, object: IRoomObject, geometry: IRoomGeometry): void -} diff --git a/src/room/renderer/RoomRenderer.ts b/src/room/renderer/RoomRenderer.ts index e551b8f9..ed86a212 100644 --- a/src/room/renderer/RoomRenderer.ts +++ b/src/room/renderer/RoomRenderer.ts @@ -1,7 +1,4 @@ -import { IRoomObject } from '../object/IRoomObject'; -import { IRoomRenderer } from './IRoomRenderer'; -import { IRoomRenderingCanvas } from './IRoomRenderingCanvas'; -import { IRoomSpriteCanvasContainer } from './IRoomSpriteCanvasContainer'; +import { IRoomObject, IRoomRenderer, IRoomRenderingCanvas, IRoomSpriteCanvasContainer } from '../../api'; import { RoomSpriteCanvas } from './RoomSpriteCanvas'; export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer @@ -23,15 +20,15 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public dispose(): void { - if(this._disposed) return; + if (this._disposed) return; - if(this._canvases) + if (this._canvases) { - for(const [ key, canvas ] of this._canvases.entries()) + for (const [key, canvas] of this._canvases.entries()) { this._canvases.delete(key); - if(!canvas) continue; + if (!canvas) continue; canvas.dispose(); } @@ -39,7 +36,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer this._canvases = null; } - if(this._objects) + if (this._objects) { this._objects = null; } @@ -54,7 +51,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public getInstanceId(object: IRoomObject): number { - if(!object) return -1; + if (!object) return -1; return object.instanceId; } @@ -66,7 +63,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public addObject(object: IRoomObject): void { - if(!object) return; + if (!object) return; this._objects.set(this.getInstanceId(object), object); } @@ -77,9 +74,9 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer this._objects.delete(instanceId); - for(const canvas of this._canvases.values()) + for (const canvas of this._canvases.values()) { - if(!canvas) continue; + if (!canvas) continue; const spriteCanvas = canvas as RoomSpriteCanvas; @@ -89,25 +86,25 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer public render(time: number, update: boolean = false): void { - if(!this._canvases || !this._canvases.size) return; + if (!this._canvases || !this._canvases.size) return; - for(const canvas of this._canvases.values()) canvas && canvas.render(time, update); + for (const canvas of this._canvases.values()) canvas && canvas.render(time, update); } public update(time: number, update: boolean = false): void { - if(!this._canvases || !this._canvases.size) return; + if (!this._canvases || !this._canvases.size) return; this.render(time, update); - for(const canvas of this._canvases.values()) canvas && canvas.update(); + for (const canvas of this._canvases.values()) canvas && canvas.update(); } public getCanvas(id: number): IRoomRenderingCanvas { const existing = this._canvases.get(id); - if(!existing) return null; + if (!existing) return null; return existing; } @@ -116,18 +113,18 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer { const existing = this._canvases.get(id) as IRoomRenderingCanvas; - if(existing) + if (existing) { existing.initialize(width, height); - if(existing.geometry) existing.geometry.scale = scale; + if (existing.geometry) existing.geometry.scale = scale; return existing; } const canvas = this.createSpriteCanvas(id, width, height, scale); - if(!canvas) return; + if (!canvas) return; this._canvases.set(id, canvas); @@ -143,7 +140,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer { const existing = this._canvases.get(id); - if(!existing) return; + if (!existing) return; this._canvases.delete(id); diff --git a/src/room/renderer/RoomRendererFactory.ts b/src/room/renderer/RoomRendererFactory.ts index 34eb2a67..9de8de8d 100644 --- a/src/room/renderer/RoomRendererFactory.ts +++ b/src/room/renderer/RoomRendererFactory.ts @@ -1,5 +1,4 @@ -import { IRoomRenderer } from './IRoomRenderer'; -import { IRoomRendererFactory } from './IRoomRendererFactory'; +import { IRoomRenderer, IRoomRendererFactory } from '../../api'; import { RoomRenderer } from './RoomRenderer'; export class RoomRendererFactory implements IRoomRendererFactory @@ -8,4 +7,4 @@ export class RoomRendererFactory implements IRoomRendererFactory { return new RoomRenderer(); } -} \ No newline at end of file +} diff --git a/src/room/renderer/RoomSpriteCanvas.ts b/src/room/renderer/RoomSpriteCanvas.ts index a2d8d562..ed522c92 100644 --- a/src/room/renderer/RoomSpriteCanvas.ts +++ b/src/room/renderer/RoomSpriteCanvas.ts @@ -3,28 +3,14 @@ import { Container, DisplayObject } from '@pixi/display'; import { Graphics } from '@pixi/graphics'; import { Matrix, Point, Rectangle } from '@pixi/math'; import { Sprite } from '@pixi/sprite'; +import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite, IRoomObjectSpriteVisualization, IRoomRenderingCanvas, IRoomSpriteCanvasContainer, IRoomSpriteMouseEvent, RoomObjectSpriteData, RoomObjectSpriteType } from '../../api'; import { Nitro } from '../../nitro/Nitro'; import { MouseEventType } from '../../nitro/ui/MouseEventType'; import { NitroContainer, NitroSprite, PixiApplicationProxy } from '../../pixi-proxy'; -import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData'; -import { RoomSpriteMouseEvent } from '../events/RoomSpriteMouseEvent'; -import { RoomObjectSpriteType } from '../object/enum/RoomObjectSpriteType'; -import { IRoomObject } from '../object/IRoomObject'; -import { IRoomObjectSprite } from '../object/visualization/IRoomObjectSprite'; -import { IRoomObjectSpriteVisualization } from '../object/visualization/IRoomObjectSpriteVisualization'; -import { RoomRotatingEffect, RoomShakingEffect } from '../utils'; -import { IRoomGeometry } from '../utils/IRoomGeometry'; -import { RoomEnterEffect } from '../utils/RoomEnterEffect'; -import { RoomGeometry } from '../utils/RoomGeometry'; -import { Vector3d } from '../utils/Vector3d'; -import { RoomObjectCache } from './cache/RoomObjectCache'; -import { RoomObjectCacheItem } from './cache/RoomObjectCacheItem'; -import { IRoomCanvasMouseListener } from './IRoomCanvasMouseListener'; -import { IRoomRenderingCanvas } from './IRoomRenderingCanvas'; -import { IRoomSpriteCanvasContainer } from './IRoomSpriteCanvasContainer'; -import { ExtendedSprite } from './utils/ExtendedSprite'; -import { ObjectMouseData } from './utils/ObjectMouseData'; -import { SortableSprite } from './utils/SortableSprite'; +import { RoomSpriteMouseEvent } from '../events'; +import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect, Vector3d } from '../utils'; +import { RoomObjectCache, RoomObjectCacheItem } from './cache'; +import { ExtendedSprite, ObjectMouseData, SortableSprite } from './utils'; export class RoomSpriteCanvas implements IRoomRenderingCanvas { @@ -60,7 +46,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas private _mouseCheckCount: number; private _mouseSpriteWasHit: boolean; private _mouseActiveObjects: Map; - private _eventCache: Map; + private _eventCache: Map; private _eventId: number; private _scale: number; @@ -337,7 +323,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas { this._canvasUpdated = false; - this._totalTimeRunning += Nitro.instance.ticker.deltaTime; + this._totalTimeRunning += PixiApplicationProxy.instance.ticker.deltaTime; if (this._totalTimeRunning === this._renderTimestamp) return; @@ -847,7 +833,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas const checkedSprites: string[] = []; let didHitSprite = false; - let mouseEvent: RoomSpriteMouseEvent = null; + let mouseEvent: IRoomSpriteMouseEvent = null; let spriteId = (this._activeSpriteCount - 1); while (spriteId >= 0) @@ -959,7 +945,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas return didHitSprite; } - protected createMouseEvent(x: number, y: number, localX: number, localY: number, type: string, tag: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): RoomSpriteMouseEvent + protected createMouseEvent(x: number, y: number, localX: number, localY: number, type: string, tag: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): IRoomSpriteMouseEvent { const screenX: number = (x - (this._width / 2)); const screenY: number = (y - (this._height / 2)); @@ -968,7 +954,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas return new RoomSpriteMouseEvent(type, ((canvasName + '_') + this._eventId), canvasName, tag, screenX, screenY, localX, localY, ctrlKey, altKey, shiftKey, buttonDown); } - protected bufferMouseEvent(k: RoomSpriteMouseEvent, _arg_2: string): void + protected bufferMouseEvent(k: IRoomSpriteMouseEvent, _arg_2: string): void { if (!k || !this._eventCache) return; diff --git a/src/room/renderer/cache/RoomObjectCache.ts b/src/room/renderer/cache/RoomObjectCache.ts index 5c79084a..f65aeca2 100644 --- a/src/room/renderer/cache/RoomObjectCache.ts +++ b/src/room/renderer/cache/RoomObjectCache.ts @@ -1,7 +1,5 @@ -import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData'; -import { RoomObjectSpriteType } from '../../object/enum/RoomObjectSpriteType'; -import { IRoomObjectSprite } from '../../object/visualization/IRoomObjectSprite'; -import { SortableSprite } from '../utils/SortableSprite'; +import { IRoomObjectSprite, RoomObjectSpriteData, RoomObjectSpriteType } from '../../../api'; +import { SortableSprite } from '../utils'; import { RoomObjectCacheItem } from './RoomObjectCacheItem'; export class RoomObjectCache @@ -19,11 +17,11 @@ export class RoomObjectCache public dispose(): void { - if(this._data) + if (this._data) { - for(const [ key, item ] of this._data.entries()) + for (const [key, item] of this._data.entries()) { - if(!item) continue; + if (!item) continue; this._data.delete(key); @@ -38,7 +36,7 @@ export class RoomObjectCache { let existing = this._data.get(k); - if(!existing) + if (!existing) { existing = new RoomObjectCacheItem(this._roomObjectVariableAccurateZ); @@ -52,7 +50,7 @@ export class RoomObjectCache { const existing = this._data.get(k); - if(!existing) return; + if (!existing) return; this._data.delete(k); @@ -63,19 +61,19 @@ export class RoomObjectCache { const spriteData: RoomObjectSpriteData[] = []; - for(const item of this._data.values()) + for (const item of this._data.values()) { - if(!item) continue; + if (!item) continue; const sprites = item.sprites && item.sprites.sprites; - if(!sprites || !sprites.length) continue; + if (!sprites || !sprites.length) continue; - for(const sprite of sprites) + for (const sprite of sprites) { - if(!sprite) continue; + if (!sprite) continue; - if((sprite.sprite.spriteType !== RoomObjectSpriteType.ROOM_PLANE) && (sprite.sprite.name !== '')) + if ((sprite.sprite.spriteType !== RoomObjectSpriteType.ROOM_PLANE) && (sprite.sprite.name !== '')) { const data = new RoomObjectSpriteData(); @@ -95,16 +93,16 @@ export class RoomObjectCache const isSkewed = this.isSkewedSprite(sprite.sprite); - if(isSkewed) + if (isSkewed) { data.skew = (((sprite.sprite.direction % 4) === 0) ? -0.5 : 0.5); } - if(((((isSkewed || (sprite.name.indexOf('%image.library.url%') >= 0)) || (sprite.name.indexOf('%group.badge.url%') >= 0)) && (data.width <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR)) && (data.height <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR))) + if (((((isSkewed || (sprite.name.indexOf('%image.library.url%') >= 0)) || (sprite.name.indexOf('%group.badge.url%') >= 0)) && (data.width <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR)) && (data.height <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR))) { //data.color = Canvas._Str_23439(sprite.sprite.texture).toString(); - if(sprite.sprite.name.indexOf('external_image_wallitem') === 0) + if (sprite.sprite.name.indexOf('external_image_wallitem') === 0) { data.frame = true; } @@ -115,18 +113,18 @@ export class RoomObjectCache } } - if(!spriteData || !spriteData.length) return null; + if (!spriteData || !spriteData.length) return null; return spriteData; } private isSkewedSprite(k: IRoomObjectSprite): boolean { - if(!k.type) return false; + if (!k.type) return false; - if((k.type.indexOf('external_image_wallitem') === 0) && (k.tag === 'THUMBNAIL')) return true; + if ((k.type.indexOf('external_image_wallitem') === 0) && (k.tag === 'THUMBNAIL')) return true; - if((k.type.indexOf('guild_forum') === 0) && (k.tag === 'THUMBNAIL')) return true; + if ((k.type.indexOf('guild_forum') === 0) && (k.tag === 'THUMBNAIL')) return true; return false; } @@ -135,11 +133,11 @@ export class RoomObjectCache { const sprites: SortableSprite[] = []; - for(const item of this._data.values()) + for (const item of this._data.values()) { - for(const sprite of item.sprites.sprites) + for (const sprite of item.sprites.sprites) { - if(sprite.sprite.spriteType === RoomObjectSpriteType.ROOM_PLANE) sprites.push(sprite); + if (sprite.sprite.spriteType === RoomObjectSpriteType.ROOM_PLANE) sprites.push(sprite); } } diff --git a/src/room/renderer/cache/RoomObjectLocationCacheItem.ts b/src/room/renderer/cache/RoomObjectLocationCacheItem.ts index 6a4444bc..ed91ae25 100644 --- a/src/room/renderer/cache/RoomObjectLocationCacheItem.ts +++ b/src/room/renderer/cache/RoomObjectLocationCacheItem.ts @@ -1,7 +1,5 @@ -import { IRoomObject } from '../../object/IRoomObject'; -import { IRoomGeometry } from '../../utils/IRoomGeometry'; -import { IVector3D } from '../../utils/IVector3D'; -import { Vector3d } from '../../utils/Vector3d'; +import { IRoomGeometry, IRoomObject, IVector3D } from '../../../api'; +import { Vector3d } from '../../utils'; export class RoomObjectLocationCacheItem { @@ -33,17 +31,17 @@ export class RoomObjectLocationCacheItem public updateLocation(object: IRoomObject, geometry: IRoomGeometry): IVector3D { - if(!object || !geometry) return null; + if (!object || !geometry) return null; let locationChanged = false; const location = object.getLocation(); - if((geometry.updateId !== this._geometryUpdateId) || (object.updateCounter !== this._objectUpdateId)) + if ((geometry.updateId !== this._geometryUpdateId) || (object.updateCounter !== this._objectUpdateId)) { this._objectUpdateId = object.updateCounter; - if((geometry.updateId !== this._geometryUpdateId) || (location.x !== this._location.x) || (location.y !== this._location.y) || (location.z !== this._location.z)) + if ((geometry.updateId !== this._geometryUpdateId) || (location.x !== this._location.x) || (location.y !== this._location.y) || (location.z !== this._location.z)) { this._geometryUpdateId = geometry.updateId; this._location.assign(location); @@ -54,25 +52,25 @@ export class RoomObjectLocationCacheItem this._locationChanged = locationChanged; - if(this._locationChanged) + if (this._locationChanged) { const screenLocation = geometry.getScreenPosition(location); - if(!screenLocation) return null; + if (!screenLocation) return null; const accurateZ = object.model.getValue(this._roomObjectVariableAccurateZ); - if(isNaN(accurateZ) || (accurateZ === 0)) + if (isNaN(accurateZ) || (accurateZ === 0)) { const rounded = new Vector3d(Math.round(location.x), Math.round(location.y), location.z); - if((rounded.x !== location.x) || (rounded.y !== location.y)) + if ((rounded.x !== location.x) || (rounded.y !== location.y)) { const roundedScreen = geometry.getScreenPosition(rounded); this._screenLocation.assign(screenLocation); - if(roundedScreen) this._screenLocation.z = roundedScreen.z; + if (roundedScreen) this._screenLocation.z = roundedScreen.z; } else { diff --git a/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts b/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts index 70ecc4e3..64edf21d 100644 --- a/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts +++ b/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts @@ -1,4 +1,4 @@ -import { SortableSprite } from '../utils/SortableSprite'; +import { SortableSprite } from '../utils'; export class RoomObjectSortableSpriteCacheItem { @@ -47,7 +47,7 @@ export class RoomObjectSortableSpriteCacheItem public needsUpdate(k: number, _arg_2: number): boolean { - if((k === this._updateId1) && (_arg_2 === this._updateId2)) return false; + if ((k === this._updateId1) && (_arg_2 === this._updateId2)) return false; this._updateId1 = k; this._updateId2 = _arg_2; @@ -57,15 +57,15 @@ export class RoomObjectSortableSpriteCacheItem public setSpriteCount(k: number): void { - if(k < this._sprites.length) + if (k < this._sprites.length) { let iterator = k; - while(iterator < this._sprites.length) + while (iterator < this._sprites.length) { const sprite = this._sprites[iterator]; - if(sprite) sprite.dispose(); + if (sprite) sprite.dispose(); iterator++; } diff --git a/src/room/renderer/index.ts b/src/room/renderer/index.ts index 0c25a605..2978ecdc 100644 --- a/src/room/renderer/index.ts +++ b/src/room/renderer/index.ts @@ -1,10 +1,4 @@ export * from './cache'; -export * from './IRoomCanvasMouseListener'; -export * from './IRoomRenderer'; -export * from './IRoomRendererBase'; -export * from './IRoomRendererFactory'; -export * from './IRoomRenderingCanvas'; -export * from './IRoomSpriteCanvasContainer'; export * from './RoomRenderer'; export * from './RoomRendererFactory'; export * from './RoomSpriteCanvas'; diff --git a/src/room/renderer/utils/SortableSprite.ts b/src/room/renderer/utils/SortableSprite.ts index 24912b16..2475988c 100644 --- a/src/room/renderer/utils/SortableSprite.ts +++ b/src/room/renderer/utils/SortableSprite.ts @@ -1,5 +1,4 @@ -import { IRoomObjectSprite } from '../../object/visualization/IRoomObjectSprite'; -import { ISortableSprite } from '../../object/visualization/ISortableSprite'; +import { IRoomObjectSprite, ISortableSprite } from '../../../api'; export class SortableSprite implements ISortableSprite { diff --git a/src/room/utils/ColorConverter.ts b/src/room/utils/ColorConverter.ts index 88c80b68..dbeabe8f 100644 --- a/src/room/utils/ColorConverter.ts +++ b/src/room/utils/ColorConverter.ts @@ -1,9 +1,9 @@ -import { IVector3D } from './IVector3D'; +import { IVector3D } from '../../api'; import { Vector3d } from './Vector3d'; export class ColorConverter { - private static HEX_DIGITS = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' ]; + private static HEX_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; public static hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array { @@ -52,7 +52,7 @@ export class ColorConverter const b = color & 0xFF; const g = (color & 0xFF00) >>> 8; const r = (color & 0xFF0000) >>> 16; - const a = ( (color & 0xFF000000) >>> 24 ) / 255; + const a = ((color & 0xFF000000) >>> 24) / 255; return 'rgba(' + [r, g, b, 1].join(',') + ')'; } @@ -68,15 +68,15 @@ export class ColorConverter let _local_8 = 0; let _local_9 = 0; let _local_10 = 0; - if(_local_7 == 0) + if (_local_7 == 0) { _local_8 = 0; } else { - if(_local_5 == _local_2) + if (_local_5 == _local_2) { - if(_local_3 > _local_4) + if (_local_3 > _local_4) { _local_8 = ((60 * (_local_3 - _local_4)) / _local_7); } @@ -87,13 +87,13 @@ export class ColorConverter } else { - if(_local_5 == _local_3) + if (_local_5 == _local_3) { _local_8 = (((60 * (_local_4 - _local_2)) / _local_7) + 120); } else { - if(_local_5 == _local_4) + if (_local_5 == _local_4) { _local_8 = (((60 * (_local_2 - _local_3)) / _local_7) + 240); } @@ -101,13 +101,13 @@ export class ColorConverter } } _local_9 = (0.5 * (_local_5 + _local_6)); - if(_local_7 == 0) + if (_local_7 == 0) { _local_10 = 0; } else { - if(_local_9 <= 0.5) + if (_local_9 <= 0.5) { _local_10 = ((_local_7 / _local_9) * 0.5); } @@ -136,11 +136,11 @@ export class ColorConverter let _local_5 = 0; let _local_6 = 0; let _local_7 = 0; - if(_local_3 > 0) + if (_local_3 > 0) { _local_12 = 0; _local_13 = 0; - if(_local_4 < 0.5) + if (_local_4 < 0.5) { _local_12 = (_local_4 * (1 + _local_3)); } @@ -152,52 +152,52 @@ export class ColorConverter _local_14 = (_local_2 + (1 / 3)); _local_15 = _local_2; _local_16 = (_local_2 - (1 / 3)); - if(_local_14 < 0) + if (_local_14 < 0) { _local_14 = (_local_14 + 1); } else { - if(_local_14 > 1) + if (_local_14 > 1) { _local_14--; } } - if(_local_15 < 0) + if (_local_15 < 0) { _local_15 = (_local_15 + 1); } else { - if(_local_15 > 1) + if (_local_15 > 1) { _local_15--; } } - if(_local_16 < 0) + if (_local_16 < 0) { _local_16 = (_local_16 + 1); } else { - if(_local_16 > 1) + if (_local_16 > 1) { _local_16--; } } - if((_local_14 * 6) < 1) + if ((_local_14 * 6) < 1) { _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_14)); } else { - if((_local_14 * 2) < 1) + if ((_local_14 * 2) < 1) { _local_5 = _local_12; } else { - if((_local_14 * 3) < 2) + if ((_local_14 * 3) < 2) { _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_14))); } @@ -207,19 +207,19 @@ export class ColorConverter } } } - if((_local_15 * 6) < 1) + if ((_local_15 * 6) < 1) { _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_15)); } else { - if((_local_15 * 2) < 1) + if ((_local_15 * 2) < 1) { _local_6 = _local_12; } else { - if((_local_15 * 3) < 2) + if ((_local_15 * 3) < 2) { _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_15))); } @@ -229,19 +229,19 @@ export class ColorConverter } } } - if((_local_16 * 6) < 1) + if ((_local_16 * 6) < 1) { _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_16)); } else { - if((_local_16 * 2) < 1) + if ((_local_16 * 2) < 1) { _local_7 = _local_12; } else { - if((_local_16 * 3) < 2) + if ((_local_16 * 3) < 2) { _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_16))); } @@ -270,7 +270,7 @@ export class ColorConverter let _local_2: number = (((k >> 16) & 0xFF) / 0xFF); let _local_3: number = (((k >> 8) & 0xFF) / 0xFF); let _local_4: number = (((k >> 0) & 0xFF) / 0xFF); - if(_local_2 > 0.04045) + if (_local_2 > 0.04045) { _local_2 = Math.pow(((_local_2 + 0.055) / 1.055), 2.4); } @@ -278,7 +278,7 @@ export class ColorConverter { _local_2 = (_local_2 / 12.92); } - if(_local_3 > 0.04045) + if (_local_3 > 0.04045) { _local_3 = Math.pow(((_local_3 + 0.055) / 1.055), 2.4); } @@ -286,7 +286,7 @@ export class ColorConverter { _local_3 = (_local_3 / 12.92); } - if(_local_4 > 0.04045) + if (_local_4 > 0.04045) { _local_4 = Math.pow(((_local_4 + 0.055) / 1.055), 2.4); } @@ -300,12 +300,12 @@ export class ColorConverter return new Vector3d((((_local_2 * 0.4124) + (_local_3 * 0.3576)) + (_local_4 * 0.1805)), (((_local_2 * 0.2126) + (_local_3 * 0.7152)) + (_local_4 * 0.0722)), (((_local_2 * 0.0193) + (_local_3 * 0.1192)) + (_local_4 * 0.9505))); } - public static xyz2CieLab(k:IVector3D):IVector3D + public static xyz2CieLab(k: IVector3D): IVector3D { let _local_2: number = (k.x / 95.047); let _local_3: number = (k.y / 100); let _local_4: number = (k.z / 108.883); - if(_local_2 > 0.008856) + if (_local_2 > 0.008856) { _local_2 = Math.pow(_local_2, (1 / 3)); } @@ -313,7 +313,7 @@ export class ColorConverter { _local_2 = ((7.787 * _local_2) + (16 / 116)); } - if(_local_3 > 0.008856) + if (_local_3 > 0.008856) { _local_3 = Math.pow(_local_3, (1 / 3)); } @@ -321,7 +321,7 @@ export class ColorConverter { _local_3 = ((7.787 * _local_3) + (16 / 116)); } - if(_local_4 > 0.008856) + if (_local_4 > 0.008856) { _local_4 = Math.pow(_local_4, (1 / 3)); } @@ -332,7 +332,7 @@ export class ColorConverter return new Vector3d(((116 * _local_3) - 16), (500 * (_local_2 - _local_3)), (200 * (_local_3 - _local_4))); } - public static rgb2CieLab(k: number):IVector3D + public static rgb2CieLab(k: number): IVector3D { return ColorConverter.xyz2CieLab(ColorConverter.rgb2xyz(k)); } diff --git a/src/room/utils/IVector3D.ts b/src/room/utils/IVector3D.ts deleted file mode 100644 index 703a41f8..00000000 --- a/src/room/utils/IVector3D.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface IVector3D -{ - x: number; - y: number; - z: number; - length: number; -} diff --git a/src/room/utils/RoomEnterEffect.ts b/src/room/utils/RoomEnterEffect.ts index b172407b..49d0d505 100644 --- a/src/room/utils/RoomEnterEffect.ts +++ b/src/room/utils/RoomEnterEffect.ts @@ -1,4 +1,4 @@ -import { Nitro } from '../../nitro/Nitro'; +import { PixiApplicationProxy } from '../../pixi-proxy'; export class RoomEnterEffect { @@ -19,17 +19,17 @@ export class RoomEnterEffect RoomEnterEffect._currentDelta = 0; RoomEnterEffect._startDelayMs = delay; RoomEnterEffect._effectDurationMs = duration; - RoomEnterEffect._initializationTimeMs = Nitro.instance.time; + RoomEnterEffect._initializationTimeMs = PixiApplicationProxy.instance.ticker.lastTime; RoomEnterEffect._state = RoomEnterEffect.STATE_START_DELAY; } public static turnVisualizationOn(): void { - if((RoomEnterEffect._state === RoomEnterEffect.STATE_NOT_INITIALIZED) || (RoomEnterEffect._state === RoomEnterEffect.STATE_OVER)) return; + if ((RoomEnterEffect._state === RoomEnterEffect.STATE_NOT_INITIALIZED) || (RoomEnterEffect._state === RoomEnterEffect.STATE_OVER)) return; - const k = (Nitro.instance.time - RoomEnterEffect._initializationTimeMs); + const k = (PixiApplicationProxy.instance.ticker.lastTime - RoomEnterEffect._initializationTimeMs); - if(k > (RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs)) + if (k > (RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs)) { RoomEnterEffect._state = RoomEnterEffect.STATE_OVER; @@ -38,7 +38,7 @@ export class RoomEnterEffect RoomEnterEffect._visualizationOn = true; - if(k < RoomEnterEffect._startDelayMs) + if (k < RoomEnterEffect._startDelayMs) { RoomEnterEffect._state = RoomEnterEffect.STATE_START_DELAY; @@ -61,7 +61,7 @@ export class RoomEnterEffect public static isRunning(): boolean { - if((RoomEnterEffect._state === RoomEnterEffect.STATE_START_DELAY) || (RoomEnterEffect._state === RoomEnterEffect.STATE_RUNNING)) return true; + if ((RoomEnterEffect._state === RoomEnterEffect.STATE_START_DELAY) || (RoomEnterEffect._state === RoomEnterEffect.STATE_RUNNING)) return true; return false; } diff --git a/src/room/utils/RoomGeometry.ts b/src/room/utils/RoomGeometry.ts index 5c76d9cb..e243b077 100644 --- a/src/room/utils/RoomGeometry.ts +++ b/src/room/utils/RoomGeometry.ts @@ -1,6 +1,5 @@ import { Point } from '@pixi/math'; -import { IRoomGeometry } from './IRoomGeometry'; -import { IVector3D } from './IVector3D'; +import { IRoomGeometry, IVector3D } from '../../api'; import { Vector3d } from './Vector3d'; export class RoomGeometry implements IRoomGeometry @@ -9,13 +8,13 @@ export class RoomGeometry implements IRoomGeometry public static SCALE_ZOOMED_OUT: number = 32; private _updateId: number = 0; - private _x: Vector3d; - private _y: Vector3d; - private _z: Vector3d; - private _directionAxis: Vector3d; - private _location: Vector3d; - private _direction: Vector3d; - private _depth: Vector3d; + private _x: IVector3D; + private _y: IVector3D; + private _z: IVector3D; + private _directionAxis: IVector3D; + private _location: IVector3D; + private _direction: IVector3D; + private _depth: IVector3D; private _scale: number = 1; private _x_scale: number = 1; private _y_scale: number = 1; @@ -23,8 +22,8 @@ export class RoomGeometry implements IRoomGeometry private _x_scale_internal: number = 1; private _y_scale_internal: number = 1; private _z_scale_internal: number = 1; - private _loc: Vector3d; - private _dir: Vector3d; + private _loc: IVector3D; + private _dir: IVector3D; private _clipNear: number = -500; private _clipFar: number = 500; private _displacements: Map = null; @@ -47,7 +46,7 @@ export class RoomGeometry implements IRoomGeometry this.z_scale = 1; this.location = new Vector3d(location.x, location.y, location.z); this.direction = new Vector3d(direction.x, direction.y, direction.z); - if(_arg_4 != null) + if (_arg_4 != null) { this.setDepthVector(_arg_4); } @@ -61,13 +60,13 @@ export class RoomGeometry implements IRoomGeometry public static getIntersectionVector(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D): IVector3D { const _local_5: number = Vector3d.dotProduct(_arg_2, _arg_4); - if(Math.abs(_local_5) < 1E-5) + if (Math.abs(_local_5) < 1E-5) { return null; } - const _local_6: Vector3d = Vector3d.dif(k, _arg_3); + const _local_6: IVector3D = Vector3d.dif(k, _arg_3); const _local_7: number = (-(Vector3d.dotProduct(_arg_4, _local_6)) / _local_5); - const _local_8: Vector3d = Vector3d.sum(k, Vector3d.product(_arg_2, _local_7)); + const _local_8: IVector3D = Vector3d.sum(k, Vector3d.product(_arg_2, _local_7)); return _local_8; } @@ -84,12 +83,12 @@ export class RoomGeometry implements IRoomGeometry public set scale(k: number) { - if(k <= 1) + if (k <= 1) { k = 1; } k = (k * Math.sqrt(0.5)); - if(k != this._scale) + if (k != this._scale) { this._scale = k; this._updateId++; @@ -112,11 +111,11 @@ export class RoomGeometry implements IRoomGeometry public set location(k: IVector3D) { - if(k == null) + if (k == null) { return; } - if(this._loc == null) + if (this._loc == null) { this._loc = new Vector3d(); } @@ -127,7 +126,7 @@ export class RoomGeometry implements IRoomGeometry this._loc.x = (this._loc.x / this._x_scale); this._loc.y = (this._loc.y / this._y_scale); this._loc.z = (this._loc.z / this._z_scale); - if((((!(this._loc.x == _local_2)) || (!(this._loc.y == _local_3))) || (!(this._loc.z == _local_4)))) + if ((((!(this._loc.x == _local_2)) || (!(this._loc.y == _local_3))) || (!(this._loc.z == _local_4)))) { this._updateId++; } @@ -142,14 +141,14 @@ export class RoomGeometry implements IRoomGeometry { let _local_21: number; let _local_22: number; - let _local_23: Vector3d; - let _local_24: Vector3d; - let _local_25: Vector3d; - if(k == null) + let _local_23: IVector3D; + let _local_24: IVector3D; + let _local_25: IVector3D; + if (k == null) { return; } - if(this._dir == null) + if (this._dir == null) { this._dir = new Vector3d(); } @@ -158,27 +157,27 @@ export class RoomGeometry implements IRoomGeometry const _local_4: number = this._dir.z; this._dir.assign(k); this._direction.assign(k); - if((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) + if ((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) { this._updateId++; } - const _local_5: Vector3d = new Vector3d(0, 1, 0); - const _local_6: Vector3d = new Vector3d(0, 0, 1); - const _local_7: Vector3d = new Vector3d(1, 0, 0); + const _local_5: IVector3D = new Vector3d(0, 1, 0); + const _local_6: IVector3D = new Vector3d(0, 0, 1); + const _local_7: IVector3D = new Vector3d(1, 0, 0); const _local_8: number = ((k.x / 180) * Math.PI); const _local_9: number = ((k.y / 180) * Math.PI); const _local_10: number = ((k.z / 180) * Math.PI); const _local_11: number = Math.cos(_local_8); const _local_12: number = Math.sin(_local_8); - const _local_13: Vector3d = Vector3d.sum(Vector3d.product(_local_5, _local_11), Vector3d.product(_local_7, -(_local_12))); - const _local_14: Vector3d = new Vector3d(_local_6.x, _local_6.y, _local_6.z); - const _local_15: Vector3d = Vector3d.sum(Vector3d.product(_local_5, _local_12), Vector3d.product(_local_7, _local_11)); + const _local_13: IVector3D = Vector3d.sum(Vector3d.product(_local_5, _local_11), Vector3d.product(_local_7, -(_local_12))); + const _local_14: IVector3D = new Vector3d(_local_6.x, _local_6.y, _local_6.z); + const _local_15: IVector3D = Vector3d.sum(Vector3d.product(_local_5, _local_12), Vector3d.product(_local_7, _local_11)); const _local_16: number = Math.cos(_local_9); const _local_17: number = Math.sin(_local_9); - const _local_18: Vector3d = new Vector3d(_local_13.x, _local_13.y, _local_13.z); - const _local_19: Vector3d = Vector3d.sum(Vector3d.product(_local_14, _local_16), Vector3d.product(_local_15, _local_17)); - const _local_20: Vector3d = Vector3d.sum(Vector3d.product(_local_14, -(_local_17)), Vector3d.product(_local_15, _local_16)); - if(_local_10 != 0) + const _local_18: IVector3D = new Vector3d(_local_13.x, _local_13.y, _local_13.z); + const _local_19: IVector3D = Vector3d.sum(Vector3d.product(_local_14, _local_16), Vector3d.product(_local_15, _local_17)); + const _local_20: IVector3D = Vector3d.sum(Vector3d.product(_local_14, -(_local_17)), Vector3d.product(_local_15, _local_16)); + if (_local_10 != 0) { _local_21 = Math.cos(_local_10); _local_22 = Math.sin(_local_10); @@ -201,7 +200,7 @@ export class RoomGeometry implements IRoomGeometry public set x_scale(k: number) { - if(this._x_scale != (k * this._x_scale_internal)) + if (this._x_scale != (k * this._x_scale_internal)) { this._x_scale = (k * this._x_scale_internal); this._updateId++; @@ -210,7 +209,7 @@ export class RoomGeometry implements IRoomGeometry public set y_scale(k: number) { - if(this._y_scale != (k * this._y_scale_internal)) + if (this._y_scale != (k * this._y_scale_internal)) { this._y_scale = (k * this._y_scale_internal); this._updateId++; @@ -219,7 +218,7 @@ export class RoomGeometry implements IRoomGeometry public set z_scale(k: number) { - if(this._z_scale != (k * this._z_scale_internal)) + if (this._z_scale != (k * this._z_scale_internal)) { this._z_scale = (k * this._z_scale_internal); this._updateId++; @@ -235,7 +234,7 @@ export class RoomGeometry implements IRoomGeometry this._dir = null; this._directionAxis = null; this._location = null; - if(this._displacements != null) + if (this._displacements != null) { this._displacements.clear(); this._displacements = null; @@ -245,12 +244,12 @@ export class RoomGeometry implements IRoomGeometry public setDisplacement(k: IVector3D, _arg_2: IVector3D): void { let _local_3: string; - let _local_4: Vector3d; - if(((k == null) || (_arg_2 == null))) + let _local_4: IVector3D; + if (((k == null) || (_arg_2 == null))) { return; } - if(this._displacements != null) + if (this._displacements != null) { _local_3 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); this._displacements.delete(_local_3); @@ -264,7 +263,7 @@ export class RoomGeometry implements IRoomGeometry private getDisplacenent(k: IVector3D): IVector3D { let _local_2: string; - if(this._displacements != null) + if (this._displacements != null) { _local_2 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); return this._displacements.get(_local_2); @@ -276,26 +275,26 @@ export class RoomGeometry implements IRoomGeometry { let _local_18: number; let _local_19: number; - let _local_20: Vector3d; - let _local_21: Vector3d; - let _local_22: Vector3d; - const _local_2: Vector3d = new Vector3d(0, 1, 0); - const _local_3: Vector3d = new Vector3d(0, 0, 1); - const _local_4: Vector3d = new Vector3d(1, 0, 0); + let _local_20: IVector3D; + let _local_21: IVector3D; + let _local_22: IVector3D; + const _local_2: IVector3D = new Vector3d(0, 1, 0); + const _local_3: IVector3D = new Vector3d(0, 0, 1); + const _local_4: IVector3D = new Vector3d(1, 0, 0); const _local_5: number = ((k.x / 180) * Math.PI); const _local_6: number = ((k.y / 180) * Math.PI); const _local_7: number = ((k.z / 180) * Math.PI); const _local_8: number = Math.cos(_local_5); const _local_9: number = Math.sin(_local_5); - const _local_10: Vector3d = Vector3d.sum(Vector3d.product(_local_2, _local_8), Vector3d.product(_local_4, -(_local_9))); - const _local_11: Vector3d = new Vector3d(_local_3.x, _local_3.y, _local_3.z); - const _local_12: Vector3d = Vector3d.sum(Vector3d.product(_local_2, _local_9), Vector3d.product(_local_4, _local_8)); + const _local_10: IVector3D = Vector3d.sum(Vector3d.product(_local_2, _local_8), Vector3d.product(_local_4, -(_local_9))); + const _local_11: IVector3D = new Vector3d(_local_3.x, _local_3.y, _local_3.z); + const _local_12: IVector3D = Vector3d.sum(Vector3d.product(_local_2, _local_9), Vector3d.product(_local_4, _local_8)); const _local_13: number = Math.cos(_local_6); const _local_14: number = Math.sin(_local_6); - const _local_15: Vector3d = new Vector3d(_local_10.x, _local_10.y, _local_10.z); - const _local_16: Vector3d = Vector3d.sum(Vector3d.product(_local_11, _local_13), Vector3d.product(_local_12, _local_14)); - const _local_17: Vector3d = Vector3d.sum(Vector3d.product(_local_11, -(_local_14)), Vector3d.product(_local_12, _local_13)); - if(_local_7 != 0) + const _local_15: IVector3D = new Vector3d(_local_10.x, _local_10.y, _local_10.z); + const _local_16: IVector3D = Vector3d.sum(Vector3d.product(_local_11, _local_13), Vector3d.product(_local_12, _local_14)); + const _local_17: IVector3D = Vector3d.sum(Vector3d.product(_local_11, -(_local_14)), Vector3d.product(_local_12, _local_13)); + if (_local_7 != 0) { _local_18 = Math.cos(_local_7); _local_19 = Math.sin(_local_7); @@ -313,36 +312,36 @@ export class RoomGeometry implements IRoomGeometry public adjustLocation(k: IVector3D, _arg_2: number): void { - if(((k == null) || (this._z == null))) + if (((k == null) || (this._z == null))) { return; } - const _local_3: Vector3d = Vector3d.product(this._z, -(_arg_2)); - const _local_4: Vector3d = new Vector3d((k.x + _local_3.x), (k.y + _local_3.y), (k.z + _local_3.z)); + const _local_3: IVector3D = Vector3d.product(this._z, -(_arg_2)); + const _local_4: IVector3D = new Vector3d((k.x + _local_3.x), (k.y + _local_3.y), (k.z + _local_3.z)); this.location = _local_4; } public getCoordinatePosition(k: IVector3D): IVector3D { - if(k == null) + if (k == null) { return null; } const _local_2: number = Vector3d.scalarProjection(k, this._x); const _local_3: number = Vector3d.scalarProjection(k, this._y); const _local_4: number = Vector3d.scalarProjection(k, this._z); - const _local_5: Vector3d = new Vector3d(_local_2, _local_3, _local_4); + const _local_5: IVector3D = new Vector3d(_local_2, _local_3, _local_4); return _local_5; } public getScreenPosition(k: IVector3D): IVector3D { - let _local_2: Vector3d = Vector3d.dif(k, this._loc); + let _local_2: IVector3D = Vector3d.dif(k, this._loc); _local_2.x = (_local_2.x * this._x_scale); _local_2.y = (_local_2.y * this._y_scale); _local_2.z = (_local_2.z * this._z_scale); let _local_3: number = Vector3d.scalarProjection(_local_2, this._depth); - if(((_local_3 < this._clipNear) || (_local_3 > this._clipFar))) + if (((_local_3 < this._clipNear) || (_local_3 > this._clipFar))) { return null; } @@ -351,7 +350,7 @@ export class RoomGeometry implements IRoomGeometry _local_4 = (_local_4 * this._scale); _local_5 = (_local_5 * this._scale); const _local_6: IVector3D = this.getDisplacenent(k); - if(_local_6 != null) + if (_local_6 != null) { _local_2 = Vector3d.dif(k, this._loc); _local_2.add(_local_6); @@ -369,7 +368,7 @@ export class RoomGeometry implements IRoomGeometry public getScreenPoint(k: IVector3D): Point { const _local_2: IVector3D = this.getScreenPosition(k); - if(_local_2 == null) + if (_local_2 == null) { return null; } @@ -383,18 +382,18 @@ export class RoomGeometry implements IRoomGeometry let _local_16: number; const _local_5: number = (k.x / this._scale); const _local_6: number = (-(k.y) / this._scale); - const _local_7: Vector3d = Vector3d.product(this._x, _local_5); + const _local_7: IVector3D = Vector3d.product(this._x, _local_5); _local_7.add(Vector3d.product(this._y, _local_6)); - const _local_8: Vector3d = new Vector3d((this._loc.x * this._x_scale), (this._loc.y * this._y_scale), (this._loc.z * this._z_scale)); + const _local_8: IVector3D = new Vector3d((this._loc.x * this._x_scale), (this._loc.y * this._y_scale), (this._loc.z * this._z_scale)); _local_8.add(_local_7); const _local_9: IVector3D = this._z; - const _local_10: Vector3d = new Vector3d((_arg_2.x * this._x_scale), (_arg_2.y * this._y_scale), (_arg_2.z * this._z_scale)); - const _local_11: Vector3d = new Vector3d((_arg_3.x * this._x_scale), (_arg_3.y * this._y_scale), (_arg_3.z * this._z_scale)); - const _local_12: Vector3d = new Vector3d((_arg_4.x * this._x_scale), (_arg_4.y * this._y_scale), (_arg_4.z * this._z_scale)); + const _local_10: IVector3D = new Vector3d((_arg_2.x * this._x_scale), (_arg_2.y * this._y_scale), (_arg_2.z * this._z_scale)); + const _local_11: IVector3D = new Vector3d((_arg_3.x * this._x_scale), (_arg_3.y * this._y_scale), (_arg_3.z * this._z_scale)); + const _local_12: IVector3D = new Vector3d((_arg_4.x * this._x_scale), (_arg_4.y * this._y_scale), (_arg_4.z * this._z_scale)); const _local_13: IVector3D = Vector3d.crossProduct(_local_11, _local_12); - const _local_14: Vector3d = new Vector3d(); + const _local_14: IVector3D = new Vector3d(); _local_14.assign(RoomGeometry.getIntersectionVector(_local_8, _local_9, _local_10, _local_13)); - if(_local_14 != null) + if (_local_14 != null) { _local_14.subtract(_local_10); _local_15 = ((Vector3d.scalarProjection(_local_14, _arg_3) / _local_11.length) * _arg_3.length); @@ -406,7 +405,7 @@ export class RoomGeometry implements IRoomGeometry public performZoom(): void { - if(this.isZoomedIn()) + if (this.isZoomedIn()) { this.scale = RoomGeometry.SCALE_ZOOMED_OUT; } diff --git a/src/room/utils/RoomRotatingEffect.ts b/src/room/utils/RoomRotatingEffect.ts index 7aa3e5a3..ba844119 100644 --- a/src/room/utils/RoomRotatingEffect.ts +++ b/src/room/utils/RoomRotatingEffect.ts @@ -1,4 +1,4 @@ -import { Nitro } from '../../nitro/Nitro'; +import { PixiApplicationProxy } from '../../pixi-proxy'; export class RoomRotatingEffect { @@ -20,19 +20,19 @@ export class RoomRotatingEffect this._SafeStr_4513 = 0; this._SafeStr_4515 = _arg_1; this._SafeStr_4516 = _arg_2; - this._SafeStr_4514 = Nitro.instance.time; + this._SafeStr_4514 = PixiApplicationProxy.instance.ticker.lastTime; this._SafeStr_448 = 1; } public static turnVisualizationOn(): void { - if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + if ((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; - if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + if (!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); - const _local_1 = (Nitro.instance.time - this._SafeStr_4514); + const _local_1 = (PixiApplicationProxy.instance.ticker.lastTime - this._SafeStr_4514); - if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + if (_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) { this._SafeStr_448 = 3; @@ -41,7 +41,7 @@ export class RoomRotatingEffect this._SafeStr_4512 = true; - if(_local_1 < this._SafeStr_4515) + if (_local_1 < this._SafeStr_4515) { this._SafeStr_448 = 1; @@ -52,7 +52,7 @@ export class RoomRotatingEffect this._SafeStr_4513 = ((_local_1 - this._SafeStr_4515) / this._SafeStr_4516); } - public static turnVisualizationOff():void + public static turnVisualizationOff(): void { this._SafeStr_4512 = false; @@ -68,7 +68,7 @@ export class RoomRotatingEffect private static isRunning(): boolean { - if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + if ((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; return false; } diff --git a/src/room/utils/RoomShakingEffect.ts b/src/room/utils/RoomShakingEffect.ts index 6927f798..e8b68f83 100644 --- a/src/room/utils/RoomShakingEffect.ts +++ b/src/room/utils/RoomShakingEffect.ts @@ -1,4 +1,4 @@ -import { Nitro } from '../../nitro/Nitro'; +import { PixiApplicationProxy } from '../../pixi-proxy'; export class RoomShakingEffect { @@ -20,19 +20,19 @@ export class RoomShakingEffect this._SafeStr_4513 = 0; this._SafeStr_4515 = _arg_1; this._SafeStr_4516 = _arg_2; - this._SafeStr_4514 = Nitro.instance.time; + this._SafeStr_4514 = PixiApplicationProxy.instance.ticker.lastTime; this._SafeStr_448 = 1; } public static turnVisualizationOn(): void { - if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + if ((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; - if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + if (!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); - const _local_1 = (Nitro.instance.time - this._SafeStr_4514); + const _local_1 = (PixiApplicationProxy.instance.ticker.lastTime - this._SafeStr_4514); - if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + if (_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) { this._SafeStr_448 = 3; @@ -41,7 +41,7 @@ export class RoomShakingEffect this._SafeStr_4512 = true; - if(_local_1 < this._SafeStr_4515) + if (_local_1 < this._SafeStr_4515) { this._SafeStr_448 = 1; @@ -52,7 +52,7 @@ export class RoomShakingEffect this._SafeStr_4513 = ((_local_1 - this._SafeStr_4515) / this._SafeStr_4516); } - public static turnVisualizationOff():void + public static turnVisualizationOff(): void { this._SafeStr_4512 = false; @@ -68,7 +68,7 @@ export class RoomShakingEffect private static isRunning(): boolean { - if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + if ((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; return false; } diff --git a/src/room/utils/Vector3d.ts b/src/room/utils/Vector3d.ts index 0f185c1c..3a025edf 100644 --- a/src/room/utils/Vector3d.ts +++ b/src/room/utils/Vector3d.ts @@ -1,4 +1,4 @@ -import { IVector3D } from './IVector3D'; +import { IVector3D } from '../../api'; export class Vector3d implements IVector3D { @@ -17,46 +17,46 @@ export class Vector3d implements IVector3D public static sum(vector1: IVector3D, vector2: IVector3D): Vector3d { - if(!vector1 || !vector2) return null; + if (!vector1 || !vector2) return null; return new Vector3d((vector1.x + vector2.x), (vector1.y + vector2.y), (vector1.z + vector2.z)); } public static dif(vector1: IVector3D, vector2: IVector3D): Vector3d { - if(!vector1 || !vector2) return null; + if (!vector1 || !vector2) return null; return new Vector3d((vector1.x - vector2.x), (vector1.y - vector2.y), (vector1.z - vector2.z)); } public static product(vector: IVector3D, value: number): Vector3d { - if(!vector) return null; + if (!vector) return null; return new Vector3d((vector.x * value), (vector.y * value), (vector.z * value)); } public static dotProduct(vector1: IVector3D, vector2: IVector3D): number { - if(!vector1 || !vector2) return 0; + if (!vector1 || !vector2) return 0; return (vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z); } public static crossProduct(vector1: IVector3D, vector2: IVector3D): Vector3d { - if(!vector1 || !vector2) return null; + if (!vector1 || !vector2) return null; return new Vector3d(((vector1.y * vector2.z) - (vector1.z * vector2.y)), ((vector1.z * vector2.x) - (vector1.x * vector2.z)), ((vector1.x * vector2.y) - (vector1.y * vector2.x))); } public static scalarProjection(vector1: IVector3D, vector2: IVector3D): number { - if(!vector1 || !vector2) return -1; + if (!vector1 || !vector2) return -1; const length = vector2.length; - if(length > 0) + if (length > 0) { return ((vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z)) / length; } @@ -64,22 +64,22 @@ export class Vector3d implements IVector3D return -1; } - public static cosAngle(vector1: IVector3D, vector2:IVector3D): number + public static cosAngle(vector1: IVector3D, vector2: IVector3D): number { - if(!vector1 || !vector2) return 0; + if (!vector1 || !vector2) return 0; const totalLength = (vector1.length * vector2.length); - if(!totalLength) return 0; + if (!totalLength) return 0; return (Vector3d.dotProduct(vector1, vector2) / totalLength); } public static isEqual(vector1: IVector3D, vector2: IVector3D): boolean { - if(!vector1 || !vector2) return false; + if (!vector1 || !vector2) return false; - if((vector1.x !== vector2.x) || (vector1.y !== vector2.y) || (vector1.z !== vector2.z)) return false; + if ((vector1.x !== vector2.x) || (vector1.y !== vector2.y) || (vector1.z !== vector2.z)) return false; return true; } @@ -93,7 +93,7 @@ export class Vector3d implements IVector3D public add(vector: IVector3D): void { - if(!vector) return; + if (!vector) return; this._x += vector.x; this._y += vector.y; @@ -103,7 +103,7 @@ export class Vector3d implements IVector3D public subtract(vector: IVector3D): void { - if(!vector) return; + if (!vector) return; this._x -= vector.x; this._y -= vector.y; @@ -121,7 +121,7 @@ export class Vector3d implements IVector3D public divide(amount: number): void { - if(!amount) return; + if (!amount) return; this._x /= amount; this._y /= amount; @@ -131,7 +131,7 @@ export class Vector3d implements IVector3D public assign(vector: IVector3D): void { - if(!vector) return; + if (!vector) return; this._x = vector.x; this._y = vector.y; @@ -174,7 +174,7 @@ export class Vector3d implements IVector3D public get length(): number { - if(isNaN(this._length)) + if (isNaN(this._length)) { this._length = Math.sqrt(((this._x * this._x) + (this._y * this._y)) + (this._z * this._z)); } @@ -184,6 +184,6 @@ export class Vector3d implements IVector3D public toString(): string { - return `[Vector3d: ${ this._x }, ${ this._y }, ${ this._z }]`; + return `[Vector3d: ${this._x}, ${this._y}, ${this._z}]`; } } diff --git a/src/room/utils/index.ts b/src/room/utils/index.ts index c5262f23..b1a9c9e1 100644 --- a/src/room/utils/index.ts +++ b/src/room/utils/index.ts @@ -1,6 +1,4 @@ export * from './ColorConverter'; -export * from './IRoomGeometry'; -export * from './IVector3D'; export * from './NumberBank'; export * from './PointMath'; export * from './Rasterizer';