server/src/entities/base/mapEventTileTeleport.ts

84 lines
1.5 KiB
TypeScript

import { randomUUID } from 'node:crypto'
import { ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
import type { UUID } from'@/application/types'
import type { Map } from'@/entities/map'
import type { MapEventTile } from'@/entities/mapEventTile'
import { BaseEntity } from'@/application/base/baseEntity'
export class BaseMapEventTileTeleport extends BaseEntity {
@PrimaryKey()
id = randomUUID()
@OneToOne({ deleteRule: 'cascade' })
mapEventTile!: MapEventTile
@ManyToOne({ deleteRule: 'cascade', eager: true })
toMap!: Map
@Property()
toRotation!: number
@Property()
toPositionX!: number
@Property()
toPositionY!: number
setId(id: UUID) {
this.id = id
return this
}
getId() {
return this.id
}
setMapEventTile(mapEventTile: MapEventTile) {
this.mapEventTile = mapEventTile
return this
}
getMapEventTile() {
return this.mapEventTile
}
setToMap(toMap: Map) {
this.toMap = toMap
return this
}
getToMap() {
return this.toMap
}
setToRotation(toRotation: number) {
this.toRotation = toRotation
return this
}
getToRotation() {
return this.toRotation
}
setToPositionX(toPositionX: number) {
this.toPositionX = toPositionX
return this
}
getToPositionX() {
return this.toPositionX
}
setToPositionY(toPositionY: number) {
this.toPositionY = toPositionY
return this
}
getToPositionY() {
return this.toPositionY
}
}