Cleanup
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import type { UUID } from '@/application/types'
|
||||
|
||||
import { SocketEvent } from '@/application/enums'
|
||||
import Logger, { LoggerType } from '@/application/logger'
|
||||
import type { UUID } from '@/application/types'
|
||||
import { Character } from '@/entities/character'
|
||||
import MapManager from '@/managers/mapManager'
|
||||
import SocketManager from '@/managers/socketManager'
|
||||
@ -37,7 +36,7 @@ class CharacterTeleportService {
|
||||
|
||||
const existingCharacter = !options.isInitialJoin && MapManager.getCharacterById(characterId)
|
||||
const mapCharacter = options.isInitialJoin
|
||||
? new MapCharacter(options.character!)
|
||||
? new MapCharacter(options.character)
|
||||
: existingCharacter ||
|
||||
(() => {
|
||||
this.logger.error(`Teleport failed - Character ${characterId} not found in MapManager`)
|
||||
@ -84,7 +83,7 @@ class CharacterTeleportService {
|
||||
targetMap.addCharacter(mapCharacter.getCharacter())
|
||||
|
||||
const map = await mapRepository.getById(options.targetMapId)
|
||||
await mapRepository.getEntityManager().populate(map!, mapRepository.POPULATE_TELEPORT as any)
|
||||
await mapRepository.getEntityManager().populate(map, mapRepository.POPULATE_TELEPORT as any)
|
||||
|
||||
// Notify clients
|
||||
io.in(options.targetMapId).emit(SocketEvent.MAP_CHARACTER_JOIN, mapCharacter)
|
||||
|
Reference in New Issue
Block a user