1
0
forked from noxious/server

Merge remote-tracking branch 'origin/feature/map-refactor'

This commit is contained in:
2025-01-27 01:56:51 +01:00
10 changed files with 151 additions and 147 deletions

View File

@ -24,6 +24,12 @@ export class BaseCharacterHair extends BaseEntity {
@ManyToOne()
sprite?: Sprite
@Property()
createdAt = new Date()
@Property()
updatedAt = new Date()
setId(id: UUID) {
this.id = id
return this
@ -68,4 +74,22 @@ export class BaseCharacterHair extends BaseEntity {
getSprite() {
return this.sprite
}
setCreatedAt(createdAt: Date) {
this.createdAt = createdAt
return this
}
getCreatedAt() {
return this.createdAt
}
setUpdatedAt(updatedAt: Date) {
this.updatedAt = updatedAt
return this
}
getUpdatedAt() {
return this.updatedAt
}
}

View File

@ -19,9 +19,6 @@ export class BasePlacedMapObject extends BaseEntity {
@ManyToOne({ deleteRule: 'cascade', eager: true })
mapObject!: MapObject
@Property()
depth = 0
@Property()
isRotated = false
@ -58,15 +55,6 @@ export class BasePlacedMapObject extends BaseEntity {
return this.mapObject
}
setDepth(depth: number) {
this.depth = depth
return this
}
getDepth() {
return this.depth
}
setIsRotated(isRotated: boolean) {
this.isRotated = isRotated
return this

View File

@ -2,6 +2,8 @@ import { Entity } from '@mikro-orm/core'
import { BaseMap } from '#entities/base/map'
export type MapCacheT = ReturnType<Map['cache']> | {}
@Entity()
export class Map extends BaseMap {
public async cache() {
@ -20,7 +22,6 @@ export class Map extends BaseMap {
placedMapObjects: this.getPlacedMapObjects().map((placedMapObject) => ({
id: placedMapObject.getId(),
mapObject: placedMapObject.getMapObject().getId(),
depth: placedMapObject.getDepth(),
isRotated: placedMapObject.getIsRotated(),
positionX: placedMapObject.getPositionX(),
positionY: placedMapObject.getPositionY()