1
0
forked from noxious/server
noxious_server/src/entities/zoneObject.ts

95 lines
1.5 KiB
TypeScript

import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Zone } from './zone'
import { MapObject } from '#entities/mapObject'
import { UUID } from '#application/types'
import { randomUUID } from 'node:crypto'
//@TODO : Rename mapObject
@Entity()
export class ZoneObject extends BaseEntity {
@PrimaryKey()
id = randomUUID()
@ManyToOne(() => Zone)
zone!: Zone
@ManyToOne(() => MapObject)
mapObject!: MapObject
@Property()
depth = 0
@Property()
isRotated = false
@Property()
positionX = 0
@Property()
positionY = 0
setId(id: UUID) {
this.id = id
return this
}
getId() {
return this.id
}
setZone(zone: Zone) {
this.zone = zone
return this
}
getZone() {
return this.zone
}
setMapObject(mapObject: MapObject) {
this.mapObject = mapObject
return this
}
getMapObject() {
return this.mapObject
}
setDepth(depth: number) {
this.depth = depth
return this
}
getDepth() {
return this.depth
}
setIsRotated(isRotated: boolean) {
this.isRotated = isRotated
return this
}
getIsRotated() {
return this.isRotated
}
setPositionX(positionX: number) {
this.positionX = positionX
return this
}
getPositionX() {
return this.positionX
}
setPositionY(positionY: number) {
this.positionY = positionY
return this
}
getPositionY() {
return this.positionY
}
}