diff --git a/src/application/types.ts b/src/application/types.ts index cd120fb..9aba80c 100644 --- a/src/application/types.ts +++ b/src/application/types.ts @@ -115,7 +115,6 @@ export type MapEventTile = { export type MapEventTileTeleport = { id: UUID mapEventTile: MapEventTile - toMapId: UUID toMap: Map toPositionX: number toPositionY: number diff --git a/src/components/gameMaster/mapEditor/MapEditor.vue b/src/components/gameMaster/mapEditor/MapEditor.vue index 397323f..bab58f9 100644 --- a/src/components/gameMaster/mapEditor/MapEditor.vue +++ b/src/components/gameMaster/mapEditor/MapEditor.vue @@ -58,6 +58,8 @@ function save() { placedMapObjects: mapEditorStore.map.placedMapObjects?.map(({ id, mapObject, depth, isRotated, positionX, positionY }) => ({ id, mapObject, depth, isRotated, positionX, positionY })) ?? [] } + console.log(data.mapEventTiles) + if (mapEditorStore.isSettingsModalShown) { mapEditorStore.toggleSettingsModal() } diff --git a/src/components/gameMaster/mapEditor/mapPartials/MapEventTiles.vue b/src/components/gameMaster/mapEditor/mapPartials/MapEventTiles.vue index af4f596..9954932 100644 --- a/src/components/gameMaster/mapEditor/mapPartials/MapEventTiles.vue +++ b/src/components/gameMaster/mapEditor/mapPartials/MapEventTiles.vue @@ -51,7 +51,7 @@ function pencil(pointer: Phaser.Input.Pointer) { if (existingEventTile) return // If teleport, check if there is a selected map - if (mapEditorStore.drawMode === 'teleport' && !mapEditorStore.teleportSettings.toMapId) return + if (mapEditorStore.drawMode === 'teleport' && !mapEditorStore.teleportSettings.toMap) return const newEventTile = { id: uuidv4(), @@ -63,7 +63,7 @@ function pencil(pointer: Phaser.Input.Pointer) { teleport: mapEditorStore.drawMode === 'teleport' ? { - toMapId: mapEditorStore.teleportSettings.toMapId, + toMap: mapEditorStore.teleportSettings.toMap, toPositionX: mapEditorStore.teleportSettings.toPositionX, toPositionY: mapEditorStore.teleportSettings.toPositionY, toRotation: mapEditorStore.teleportSettings.toRotation diff --git a/src/components/gameMaster/mapEditor/partials/TeleportModal.vue b/src/components/gameMaster/mapEditor/partials/TeleportModal.vue index a9ab99d..a9f0dbb 100644 --- a/src/components/gameMaster/mapEditor/partials/TeleportModal.vue +++ b/src/components/gameMaster/mapEditor/partials/TeleportModal.vue @@ -25,10 +25,10 @@
- - + +
@@ -57,7 +57,7 @@ function fetchMaps() { }) } -const { toPositionX, toPositionY, toRotation, toMapId } = useRefTeleportSettings() +const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings() function useRefTeleportSettings() { const settings = mapEditorStore.teleportSettings @@ -65,18 +65,18 @@ function useRefTeleportSettings() { toPositionX: ref(settings.toPositionX), toPositionY: ref(settings.toPositionY), toRotation: ref(settings.toRotation), - toMapId: ref(settings.toMapId) + toMap: ref(settings.toMap) } } -watch([toPositionX, toPositionY, toRotation, toMapId], updateTeleportSettings) +watch([toPositionX, toPositionY, toRotation, toMap], updateTeleportSettings) function updateTeleportSettings() { mapEditorStore.setTeleportSettings({ toPositionX: toPositionX.value, toPositionY: toPositionY.value, toRotation: toRotation.value, - toMapId: toMapId.value + toMap: toMap.value }) } diff --git a/src/stores/mapEditorStore.ts b/src/stores/mapEditorStore.ts index cee87a2..f2415ff 100644 --- a/src/stores/mapEditorStore.ts +++ b/src/stores/mapEditorStore.ts @@ -3,7 +3,7 @@ import { useGameStore } from '@/stores/gameStore' import { defineStore } from 'pinia' export type TeleportSettings = { - toMapId: number + toMap: Map | null toPositionX: number toPositionY: number toRotation: number @@ -36,7 +36,7 @@ export const useMapEditorStore = defineStore('mapEditor', { mapEffects: [] as MapEffect[] }, teleportSettings: { - toMapId: 0, + toMap: null, toPositionX: 0, toPositionY: 0, toRotation: 0