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 teleport, check if there is a selected map
if (mapEditor.drawMode.value === 'teleport' && !mapEditor.teleportSettings.value.toMapId) return if (mapEditor.drawMode.value === 'teleport' && !mapEditor.teleportSettings.value.toMapId) return
console.log(mapEditor.teleportSettings.value.toMapId)
const newEventTile = { const newEventTile = {
id: uuidv4() as UUID, id: uuidv4() as UUID,
mapId: map.id, mapId: map.id,

View File

@ -18,7 +18,7 @@ import SelectedPlacedMapObjectComponent from '@/components/gameMaster/mapEditor/
import { useMapEditorComposable } from '@/composables/useMapEditorComposable' import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { getTile } from '@/services/mapService' import { getTile } from '@/services/mapService'
import { useScene } from 'phavuer' 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 Tilemap = Phaser.Tilemaps.Tilemap
import TilemapLayer = Phaser.Tilemaps.TilemapLayer 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" /> <input @mousedown.stop class="!pl-7 input-field w-full" type="text" name="search" placeholder="Search" v-model="searchQuery" />
</div> </div>
</div> </div>
<img <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')" />
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>
<div class="flex"> <div class="flex">
<select class="input-field w-full" name="lists" v-model="mapEditor.drawMode.value" @change="(event: any) => mapEditor.setDrawMode(event.target.value)"> <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> <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> <template #modalHeader>
<h3 class="m-0 font-medium shrink-0 text-white">Teleport settings</h3> <h3 class="m-0 font-medium shrink-0 text-white">Teleport settings</h3>
</template> </template>
@ -26,9 +26,9 @@
</div> </div>
<div class="form-field-full"> <div class="form-field-full">
<label for="toMap">Map to teleport to</label> <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 :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> </select>
</div> </div>
</div> </div>
@ -41,9 +41,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Map } from '@/application/types' import type { Map } from '@/application/types'
import Modal from '@/components/utilities/Modal.vue' 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 { 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 showTeleportModal = computed(() => mapEditor.tool.value === 'pencil' && mapEditor.drawMode.value === 'teleport')
const mapStorage = new MapStorage() const mapStorage = new MapStorage()
@ -55,7 +55,7 @@ defineExpose({
open: () => modalRef.value?.open() open: () => modalRef.value?.open()
}) })
const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings() const { toPositionX, toPositionY, toRotation, toMapId } = useRefTeleportSettings()
function useRefTeleportSettings() { function useRefTeleportSettings() {
const settings = mapEditor.teleportSettings.value const settings = mapEditor.teleportSettings.value
@ -63,18 +63,18 @@ function useRefTeleportSettings() {
toPositionX: ref(settings.toPositionX), toPositionX: ref(settings.toPositionX),
toPositionY: ref(settings.toPositionY), toPositionY: ref(settings.toPositionY),
toRotation: ref(settings.toRotation), 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() { function updateTeleportSettings() {
mapEditor.setTeleportSettings({ mapEditor.setTeleportSettings({
toPositionX: toPositionX.value, toPositionX: toPositionX.value,
toPositionY: toPositionY.value, toPositionY: toPositionY.value,
toRotation: toRotation.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" /> <input @mousedown.stop class="!pl-7 input-field w-full" type="text" name="search" placeholder="Search" v-model="searchQuery" />
</div> </div>
</div> </div>
<img <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')" />
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>
<div class="flex"> <div class="flex">
<select class="input-field w-full" name="lists" v-model="mapEditor.drawMode.value" @change="(event: any) => mapEditor.setDrawMode(event.target.value)"> <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, ...currentMap,
mapId: currentMap.id mapId: currentMap.id
} }
console.log(data)
gameStore.connection?.emit(SocketEvent.GM_MAP_UPDATE, data, (response: MapT) => { gameStore.connection?.emit(SocketEvent.GM_MAP_UPDATE, data, (response: MapT) => {
mapStorage.update(response.id, response) mapStorage.update(response.id, response)

View File

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

View File

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