npm run format, moved some files for improved file structure, removed redundant logic

This commit is contained in:
2025-02-05 00:19:55 +01:00
parent aee18956f3
commit 2b40741ca7
26 changed files with 218 additions and 238 deletions

View File

@ -39,24 +39,21 @@ import MapSettings from '@/components/gameMaster/mapEditor/partials/MapSettings.
import TeleportModal from '@/components/gameMaster/mapEditor/partials/TeleportModal.vue'
import TileList from '@/components/gameMaster/mapEditor/partials/TileList.vue'
import Toolbar from '@/components/gameMaster/mapEditor/partials/Toolbar.vue'
import { loadAllTilesIntoScene } from '@/composables/mapComposable'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { MapObjectStorage, MapStorage } from '@/storage/storages'
import { loadAllTileTextures } from '@/services/mapService'
import { MapStorage } from '@/storage/storages'
import { useGameStore } from '@/stores/gameStore'
import { Game, Scene } from 'phavuer'
import { ref, useTemplateRef, watch } from 'vue'
import { ref, useTemplateRef } from 'vue'
const mapStorage = new MapStorage()
const mapObjectStorage = new MapObjectStorage()
const mapEditor = useMapEditorComposable()
const gameStore = useGameStore()
const toolbar = useTemplateRef('toolbar')
const mapModal = useTemplateRef('mapModal')
const tileList = useTemplateRef('tileList')
const objectList = useTemplateRef('objectList')
const mapSettingsModal = useTemplateRef('mapSettingsModal')
const teleportModal = useTemplateRef('teleportModal')
const isLoaded = ref(false)
@ -83,7 +80,7 @@ const preloadScene = async (scene: Phaser.Scene) => {
scene.load.image('waypoint', '/assets/waypoint.png')
// Get all tiles from IndexedDB and load them into the scene
await loadAllTilesIntoScene(scene)
await loadAllTileTextures(scene)
// Wait for all assets to be loaded before continuing
await new Promise<void>((resolve) => {
@ -98,7 +95,6 @@ function save() {
const currentMap = mapEditor.currentMap.value
if (!currentMap) return
console.log(currentMap.tiles)
const data = {
mapId: currentMap.id,
name: currentMap.name,
@ -108,7 +104,7 @@ function save() {
pvp: currentMap.pvp,
mapEffects: currentMap.mapEffects,
mapEventTiles: currentMap.mapEventTiles,
placedMapObjects: currentMap.placedMapObjects.map(({ id, mapObject, depth, isRotated, positionX, positionY }) => ({ id, mapObject: {...mapObject}, depth, isRotated, positionX, positionY })) ?? []
placedMapObjects: currentMap.placedMapObjects.map(({ id, mapObject, depth, isRotated, positionX, positionY }) => ({ id, mapObject: { ...mapObject }, depth, isRotated, positionX, positionY })) ?? []
}
gameStore.connection?.emit('gm:map:update', data, (response: MapT) => {
@ -116,13 +112,6 @@ function save() {
})
}
function closeLists() {
tileList.value?.getModal()?.setPosition(window.innerWidth-650,6)
tileList.value?.close()
objectList.value?.getModal()?.setPosition(window.innerWidth-650,6)
objectList.value?.close()
}
function clear() {
if (!mapEditor.currentMap.value) return