From c6a7482bcc62d8f2c3bef916facbcc589193d088 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 18 Mar 2022 00:59:22 -0400 Subject: [PATCH] Update logic --- src/nitro/room/RoomObjectLogicFactory.ts | 4 ++++ .../room/object/logic/MovingObjectLogic.ts | 19 ++++++++++++++----- .../room/object/logic/furniture/index.ts | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/nitro/room/RoomObjectLogicFactory.ts b/src/nitro/room/RoomObjectLogicFactory.ts index 933a417a..6f79b8cf 100644 --- a/src/nitro/room/RoomObjectLogicFactory.ts +++ b/src/nitro/room/RoomObjectLogicFactory.ts @@ -6,6 +6,7 @@ import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogi import { RoomObjectLogicBase } from '../../room/object/logic/RoomObjectLogicBase'; import { FurnitureEcotronBoxLogic, FurnitureEffectBoxLogic, FurnitureGroupForumTerminalLogic, FurnitureHweenLovelockLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureSongDiskLogic, FurnitureSoundMachineLogic, FurnitureWelcomeGiftLogic } from './object'; import { AvatarLogic } from './object/logic/avatar/AvatarLogic'; +import { FurnitureAchievementResolutionLogic } from './object/logic/furniture/FurnitureAchievementResolutionLogic'; import { FurnitureBadgeDisplayLogic } from './object/logic/furniture/FurnitureBadgeDisplayLogic'; import { FurnitureChangeStateWhenStepOnLogic } from './object/logic/furniture/FurnitureChangeStateWhenStepOnLogic'; import { FurnitureClothingChangeLogic } from './object/logic/furniture/FurnitureClothingChangeLogic'; @@ -345,6 +346,9 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory case RoomObjectLogicType.FURNITURE_WELCOME_GIFT: logic = FurnitureWelcomeGiftLogic; break; + case RoomObjectLogicType.FURNITURE_ACHIEVEMENT_RESOLUTION: + logic = FurnitureAchievementResolutionLogic; + break; default: logic = FurnitureLogic; break; diff --git a/src/nitro/room/object/logic/MovingObjectLogic.ts b/src/nitro/room/object/logic/MovingObjectLogic.ts index c25840e3..101cc160 100644 --- a/src/nitro/room/object/logic/MovingObjectLogic.ts +++ b/src/nitro/room/object/logic/MovingObjectLogic.ts @@ -8,7 +8,7 @@ import { RoomObjectVariable } from '../RoomObjectVariable'; export class MovingObjectLogic extends RoomObjectLogicBase { - public static UPDATE_MOVING_INTERVAL: number = 500; + public static DEFAULT_UPDATE_INTERVAL: number = 500; private static TEMP_VECTOR: Vector3d = new Vector3d(); private _liftAmount: number; @@ -17,6 +17,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase private _locationDelta: Vector3d; private _lastUpdateTime: number; private _changeTime: number; + private _updateInterval: number; constructor() { @@ -28,6 +29,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase this._locationDelta = new Vector3d(); this._lastUpdateTime = 0; this._changeTime = 0; + this._updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; } protected onDispose(): void @@ -72,14 +74,14 @@ export class MovingObjectLogic extends RoomObjectLogicBase let difference = (this.time - this._changeTime); - if(difference === (MovingObjectLogic.UPDATE_MOVING_INTERVAL >> 1)) difference++; + if(difference === (this._updateInterval >> 1)) difference++; - if(difference > MovingObjectLogic.UPDATE_MOVING_INTERVAL) difference = MovingObjectLogic.UPDATE_MOVING_INTERVAL; + if(difference > this._updateInterval) difference = this._updateInterval; if(this._locationDelta.length > 0) { vector.assign(this._locationDelta); - vector.multiply((difference / MovingObjectLogic.UPDATE_MOVING_INTERVAL)); + vector.multiply((difference / this._updateInterval)); vector.add(this._location); } else @@ -91,7 +93,7 @@ export class MovingObjectLogic extends RoomObjectLogicBase this.object.setLocation(vector); - if(difference === MovingObjectLogic.UPDATE_MOVING_INTERVAL) + if(difference === this._updateInterval) { this._locationDelta.x = 0; this._locationDelta.y = 0; @@ -139,4 +141,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase { return this._lastUpdateTime; } + + protected set updateInterval(interval: number) + { + if(interval <= 0) interval = 1; + + this._updateInterval = interval; + } } diff --git a/src/nitro/room/object/logic/furniture/index.ts b/src/nitro/room/object/logic/furniture/index.ts index e5b5c8d7..2a8f87d1 100644 --- a/src/nitro/room/object/logic/furniture/index.ts +++ b/src/nitro/room/object/logic/furniture/index.ts @@ -1,3 +1,4 @@ +export * from './FurnitureAchievementResolutionLogic'; export * from './FurnitureBadgeDisplayLogic'; export * from './FurnitureChangeStateWhenStepOnLogic'; export * from './FurnitureCounterClockLogic';