1
0
forked from noxious/server

Created base entities, extended normal entities with these

This commit is contained in:
2025-01-06 18:03:12 +01:00
parent be9ee97385
commit 24586855cb
42 changed files with 2006 additions and 1858 deletions

View File

@ -1,84 +1,6 @@
import { randomUUID } from 'node:crypto'
import { Entity } from '@mikro-orm/core'
import { Entity, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { Map } from './map'
import { MapEventTile } from './mapEventTile'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
import { BaseMapEventTileTeleport } from '#entities/base/mapEventTileTeleport'
@Entity()
export class MapEventTileTeleport 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
}
}
export class MapEventTileTeleport extends BaseMapEventTileTeleport {}