forked from noxious/client
Map event tile improvements
This commit is contained in:
parent
0142850983
commit
b54b825422
@ -115,7 +115,6 @@ export type MapEventTile = {
|
||||
export type MapEventTileTeleport = {
|
||||
id: UUID
|
||||
mapEventTile: MapEventTile
|
||||
toMapId: UUID
|
||||
toMap: Map
|
||||
toPositionX: number
|
||||
toPositionY: number
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -25,10 +25,10 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-field-full">
|
||||
<label for="toMapId">Map to teleport to</label>
|
||||
<select v-model="toMapId" class="input-field" name="toMapId" id="toMapId">
|
||||
<option :value="0">Select map</option>
|
||||
<option v-for="map in mapEditorStore.mapList" :key="map.id" :value="map.id">{{ map.name }}</option>
|
||||
<label for="toMap">Map to teleport to</label>
|
||||
<select v-model="toMap" class="input-field" name="toMap" id="toMap">
|
||||
<option :value="null">Select map</option>
|
||||
<option v-for="map in mapEditorStore.mapList" :key="map.id" :value="map">{{ map.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user