1
0
forked from noxious/server

Almost finalised refactoring

This commit is contained in:
2025-01-03 14:35:02 +01:00
parent fecdf222d7
commit a40b71140a
35 changed files with 257 additions and 410 deletions

View File

@ -26,10 +26,7 @@ export class CharacterType extends BaseEntity {
@Property()
isSelectable = false
@OneToMany(() => Character, (character) => character.characterType)
characters = new Collection<Character>(this)
@ManyToOne(() => Sprite, { nullable: true })
@ManyToOne({ nullable: true })
sprite?: Sprite
@Property()
@ -109,13 +106,4 @@ export class CharacterType extends BaseEntity {
getUpdatedAt() {
return this.updatedAt
}
setCharacters(characters: Collection<Character>) {
this.characters = characters
return this
}
getCharacters() {
return this.characters
}
}

View File

@ -10,7 +10,7 @@ import { MapEventTileTeleport } from './mapEventTileTeleport'
import { BaseEntity } from '#application/base/baseEntity'
import { UUID } from '#application/types'
import { placedMapObject } from '#entities/placedMapObject'
import { PlacedMapObject } from '#entities/placedMapObject'
@Entity()
export class Map extends BaseEntity {
@ -47,8 +47,8 @@ export class Map extends BaseEntity {
@OneToMany(() => MapEventTileTeleport, (teleport) => teleport.toMap)
mapEventTileTeleports = new Collection<MapEventTileTeleport>(this)
@OneToMany(() => placedMapObject, (object) => object.map)
placedMapObjects = new Collection<placedMapObject>(this)
@OneToMany(() => PlacedMapObject, (object) => object.map)
placedMapObjects = new Collection<PlacedMapObject>(this)
@OneToMany(() => Character, (character) => character.map)
characters = new Collection<Character>(this)
@ -155,7 +155,7 @@ export class Map extends BaseEntity {
return this.mapEventTileTeleports
}
setPlacedMapObjects(placedMapObjects: Collection<placedMapObject>) {
setPlacedMapObjects(placedMapObjects: Collection<PlacedMapObject>) {
this.placedMapObjects = placedMapObjects
return this
}

View File

@ -16,10 +16,10 @@ export class MapObject extends BaseEntity {
@Property({ type: 'json', nullable: true })
tags?: any
@Property()
@Property({ type: 'decimal', precision: 10, scale: 2 })
originX = 0
@Property()
@Property({ type: 'decimal', precision: 10, scale: 2 })
originY = 0
@Property()

View File

@ -10,7 +10,7 @@ import { MapObject } from '#entities/mapObject'
//@TODO : Rename mapObject
@Entity()
export class placedMapObject extends BaseEntity {
export class PlacedMapObject extends BaseEntity {
@PrimaryKey()
id = randomUUID()