TS improvements

This commit is contained in:
2025-01-04 19:17:10 +01:00
parent 700bd57e67
commit 10f6dc3802
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@
</template>
<script setup lang="ts">
import type { MapCharacter, mapLoadData } from '@/application/types'
import type { MapCharacter, mapLoadData, UUID } from '@/application/types'
import Characters from '@/components/game/map/Characters.vue'
import MapObjects from '@/components/game/map/MapObjects.vue'
import MapTiles from '@/components/game/map/MapTiles.vue'
@ -40,11 +40,11 @@ gameStore.connection?.on('map:character:join', async (data: MapCharacter) => {
mapStore.addCharacter(data)
})
gameStore.connection?.on('map:character:leave', (characterId: number) => {
gameStore.connection?.on('map:character:leave', (characterId: UUID) => {
mapStore.removeCharacter(characterId)
})
gameStore.connection?.on('map:character:move', (data: { characterId: number; positionX: number; positionY: number; rotation: number; isMoving: boolean }) => {
gameStore.connection?.on('map:character:move', (data: { characterId: UUID; positionX: number; positionY: number; rotation: number; isMoving: boolean }) => {
mapStore.updateCharacterPosition(data)
})
</script>

View File

@ -1,5 +1,5 @@
import config from '@/application/config'
import type { AssetDataT, HttpResponse, Map as MapT } from '@/application/types'
import type { AssetDataT, HttpResponse, UUID } from '@/application/types'
import { loadTexture } from '@/composables/gameComposable'
import Tilemap = Phaser.Tilemaps.Tilemap
@ -85,7 +85,7 @@ export function FlattenMapArray(tiles: string[][]) {
return normalArray
}
export async function loadMapTilesIntoScene(map_id: number, scene: Phaser.Scene) {
export async function loadMapTilesIntoScene(map_id: UUID, scene: Phaser.Scene) {
// Fetch the list of tiles from the server
const tileArray: HttpResponse<AssetDataT[]> = await fetch(config.server_endpoint + '/assets/list_tiles/' + map_id).then((response) => response.json())