1
0
forked from noxious/client

Teleport fix WIP

This commit is contained in:
Dennis Postma 2025-02-14 03:04:42 +01:00
parent 8f26a40a0e
commit 56f30093f6
9 changed files with 19 additions and 26 deletions

View File

@ -90,6 +90,8 @@ function pencil(pointer: Phaser.Input.Pointer, map: MapT) {
// If teleport, check if there is a selected map
if (mapEditor.drawMode.value === 'teleport' && !mapEditor.teleportSettings.value.toMapId) return
console.log(mapEditor.teleportSettings.value.toMapId)
const newEventTile = {
id: uuidv4() as UUID,
mapId: map.id,

View File

@ -18,7 +18,7 @@ import SelectedPlacedMapObjectComponent from '@/components/gameMaster/mapEditor/
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { getTile } from '@/services/mapService'
import { useScene } from 'phavuer'
import {computed, onMounted, onUnmounted, ref, watch} from 'vue'
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import Tilemap = Phaser.Tilemaps.Tilemap
import TilemapLayer = Phaser.Tilemaps.TilemapLayer

View File

@ -9,12 +9,7 @@
<input @mousedown.stop class="!pl-7 input-field w-full" type="text" name="search" placeholder="Search" v-model="searchQuery" />
</div>
</div>
<img
src="/assets/icons/mapEditor/dropdown-chevron.svg"
class="w-12 h-12 ml-2 cursor-pointer hover:opacity-80 -rotate-90"
alt="Close"
@click="mapEditor.setTool('move')"
/>
<img src="/assets/icons/mapEditor/dropdown-chevron.svg" class="w-12 h-12 ml-2 cursor-pointer hover:opacity-80 -rotate-90" alt="Close" @click="mapEditor.setTool('move')" />
</div>
<div class="flex">
<select class="input-field w-full" name="lists" v-model="mapEditor.drawMode.value" @change="(event: any) => mapEditor.setDrawMode(event.target.value)">

View File

@ -1,5 +1,5 @@
<template>
<Modal v-if="showTeleportModal" ref="modalRef" @modal:close="() => mapEditorStore.setTool('move')" :modal-width="300" :modal-height="350" :is-resizable="false" bg-style="none">
<Modal v-if="showTeleportModal" ref="modalRef" @modal:close="() => mapEditor.setTool('move')" :modal-width="300" :modal-height="350" :is-resizable="false" bg-style="none">
<template #modalHeader>
<h3 class="m-0 font-medium shrink-0 text-white">Teleport settings</h3>
</template>
@ -26,9 +26,9 @@
</div>
<div class="form-field-full">
<label for="toMap">Map to teleport to</label>
<select v-model="toMap" class="input-field" name="toMap" id="toMap">
<select v-model="toMapId" class="input-field" name="toMap" id="toMap">
<option :value="null">Select map</option>
<option v-for="map in mapList" :key="map.id" :value="map">{{ map.name }}</option>
<option v-for="map in mapList" :key="map.id" :value="map.id">{{ map.name }}</option>
</select>
</div>
</div>
@ -41,9 +41,9 @@
<script setup lang="ts">
import type { Map } from '@/application/types'
import Modal from '@/components/utilities/Modal.vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { MapStorage } from '@/storage/storages'
import { computed, onMounted, ref, useTemplateRef, watch } from 'vue'
import {MapStorage} from "@/storage/storages";
import {useMapEditorComposable} from "@/composables/useMapEditorComposable";
const showTeleportModal = computed(() => mapEditor.tool.value === 'pencil' && mapEditor.drawMode.value === 'teleport')
const mapStorage = new MapStorage()
@ -55,7 +55,7 @@ defineExpose({
open: () => modalRef.value?.open()
})
const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings()
const { toPositionX, toPositionY, toRotation, toMapId } = useRefTeleportSettings()
function useRefTeleportSettings() {
const settings = mapEditor.teleportSettings.value
@ -63,18 +63,18 @@ function useRefTeleportSettings() {
toPositionX: ref(settings.toPositionX),
toPositionY: ref(settings.toPositionY),
toRotation: ref(settings.toRotation),
toMap: ref(settings.toMapId)
toMapId: ref(settings.toMapId)
}
}
watch([toPositionX, toPositionY, toRotation, toMap], updateTeleportSettings)
watch([toPositionX, toPositionY, toRotation, toMapId], updateTeleportSettings)
function updateTeleportSettings() {
mapEditor.setTeleportSettings({
toPositionX: toPositionX.value,
toPositionY: toPositionY.value,
toRotation: toRotation.value,
toMapId: toMap.value
toMapId: toMapId.value
})
}

View File

@ -9,12 +9,7 @@
<input @mousedown.stop class="!pl-7 input-field w-full" type="text" name="search" placeholder="Search" v-model="searchQuery" />
</div>
</div>
<img
src="/assets/icons/mapEditor/dropdown-chevron.svg"
class="w-12 h-12 ml-2 cursor-pointer hover:opacity-80 -rotate-90"
alt="Close"
@click="mapEditor.setTool('move')"
/>
<img src="/assets/icons/mapEditor/dropdown-chevron.svg" class="w-12 h-12 ml-2 cursor-pointer hover:opacity-80 -rotate-90" alt="Close" @click="mapEditor.setTool('move')" />
</div>
<div class="flex">
<select class="input-field w-full" name="lists" v-model="mapEditor.drawMode.value" @change="(event: any) => mapEditor.setDrawMode(event.target.value)">

View File

@ -91,6 +91,7 @@ function save() {
...currentMap,
mapId: currentMap.id
}
console.log(data)
gameStore.connection?.emit(SocketEvent.GM_MAP_UPDATE, data, (response: MapT) => {
mapStorage.update(response.id, response)

View File

@ -1,11 +1,11 @@
<template></template>
<script setup lang="ts">
import { login } from '@/services/authenticationService'
import { CharacterHairStorage, CharacterTypeStorage, MapObjectStorage, MapStorage, SoundStorage, SpriteStorage, TileStorage } from '@/storage/storages'
import { TextureStorage } from '@/storage/textureStorage'
import { useGameStore } from '@/stores/gameStore'
import { onMounted, onUnmounted } from 'vue'
import {login} from "@/services/authenticationService";
import {useGameStore} from "@/stores/gameStore";
const gameStore = useGameStore()
const mapStorage = new MapStorage()

View File

@ -1,6 +1,6 @@
import type { Map, MapObject, PlacedMapObject, UUID } from '@/application/types'
import { useGameStore } from '@/stores/gameStore'
import { ref } from 'vue'
import {useGameStore} from "@/stores/gameStore";
export type TeleportSettings = {
toMapId: string