Added option to set rotation on teleport tiles, new base database migration (db reset needed)

This commit is contained in:
Dennis Postma 2024-09-23 14:02:25 +02:00
parent a729371741
commit 4a9b7987dc
4 changed files with 9 additions and 2 deletions

View File

@ -174,6 +174,7 @@ CREATE TABLE `ZoneEventTileTeleport` (
`id` VARCHAR(191) NOT NULL, `id` VARCHAR(191) NOT NULL,
`zoneEventTileId` VARCHAR(191) NOT NULL, `zoneEventTileId` VARCHAR(191) NOT NULL,
`toZoneId` INTEGER NOT NULL, `toZoneId` INTEGER NOT NULL,
`toRotation` INTEGER NOT NULL,
`toPositionX` INTEGER NOT NULL, `toPositionX` INTEGER NOT NULL,
`toPositionY` INTEGER NOT NULL, `toPositionY` INTEGER NOT NULL,

View File

@ -81,6 +81,7 @@ model ZoneEventTileTeleport {
zoneEventTile ZoneEventTile @relation(fields: [zoneEventTileId], references: [id], onDelete: Cascade) zoneEventTile ZoneEventTile @relation(fields: [zoneEventTileId], references: [id], onDelete: Cascade)
toZoneId Int toZoneId Int
toZone Zone @relation(fields: [toZoneId], references: [id], onDelete: Cascade) toZone Zone @relation(fields: [toZoneId], references: [id], onDelete: Cascade)
toRotation Int
toPositionX Int toPositionX Int
toPositionY Int toPositionY Int
} }

View File

@ -23,14 +23,17 @@ export class ZoneEventTileService {
data: { data: {
zoneId: newZoneId, zoneId: newZoneId,
positionX: teleport.toPositionX, positionX: teleport.toPositionX,
positionY: teleport.toPositionY positionY: teleport.toPositionY,
rotation: teleport.toRotation
} }
}) })
// Update local character object // Update local character object
character.zoneId = newZoneId character.zoneId = newZoneId
character.rotation = teleport.toRotation
character.positionX = teleport.toPositionX character.positionX = teleport.toPositionX
character.positionY = teleport.toPositionY character.positionY = teleport.toPositionY
character.isMoving = false
// Emit events // Emit events
io.to(oldZoneId.toString()).emit('zone:character:leave', character.id) io.to(oldZoneId.toString()).emit('zone:character:leave', character.id)

View File

@ -22,6 +22,7 @@ interface IPayload {
toZoneId: number toZoneId: number
toPositionX: number toPositionX: number
toPositionY: number toPositionY: number
toRotation: number
} }
}[] }[]
zoneObjects: ZoneObject[] zoneObjects: ZoneObject[]
@ -88,7 +89,8 @@ export default class ZoneUpdateEvent {
create: { create: {
toZoneId: zoneEventTile.teleport.toZoneId, toZoneId: zoneEventTile.teleport.toZoneId,
toPositionX: zoneEventTile.teleport.toPositionX, toPositionX: zoneEventTile.teleport.toPositionX,
toPositionY: zoneEventTile.teleport.toPositionY toPositionY: zoneEventTile.teleport.toPositionY,
toRotation: zoneEventTile.teleport.toRotation
} }
} }
} }