Replaced old teleport func. with new one
This commit is contained in:
@ -2,14 +2,12 @@ import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { MapEventTileWithTeleport } from '#application/types'
|
||||
import MapManager from '#managers/mapManager'
|
||||
import MapCharacter from '#models/mapCharacter'
|
||||
import mapEventTileRepository from '#repositories/mapEventTileRepository'
|
||||
import MapEventTileRepository from '#repositories/mapEventTileRepository'
|
||||
import CharacterService from '#services/characterService'
|
||||
import MapEventTileService from '#services/mapEventTileService'
|
||||
import TeleportService from '#services/teleportService'
|
||||
|
||||
export default class CharacterMove extends BaseEvent {
|
||||
private readonly characterService = CharacterService
|
||||
private readonly mapEventTileService = MapEventTileService
|
||||
|
||||
public listen(): void {
|
||||
this.socket.on('map:character:move', this.handleEvent.bind(this))
|
||||
@ -88,9 +86,13 @@ export default class CharacterMove extends BaseEvent {
|
||||
return
|
||||
}
|
||||
|
||||
// @TODO: Replace with TeleportService
|
||||
if (mapEventTile.teleport) {
|
||||
await this.mapEventTileService.handleTeleport(this.io, this.socket, mapCharacter.character, mapEventTile.teleport)
|
||||
await TeleportService.teleportCharacter(mapCharacter.character.id, {
|
||||
targetMapId: mapEventTile.teleport.toMap.id,
|
||||
targetX: mapEventTile.teleport.toPositionX,
|
||||
targetY: mapEventTile.teleport.toPositionY,
|
||||
rotation: mapCharacter.character.rotation
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user