From ed3955db17767c4d880a32f527230aefa2829f77 Mon Sep 17 00:00:00 2001
From: Dennis Postma <dennis@directonline.io>
Date: Sun, 15 Sep 2024 19:00:20 +0200
Subject: [PATCH] npm run format

---
 .../gameMaster/zoneEditor/ZoneEditor.vue      | 17 +-----
 src/components/zone/Characters.vue            |  8 +--
 src/components/zone/Objects.vue               |  6 +-
 src/services/zone.ts                          | 58 +++++++++----------
 4 files changed, 33 insertions(+), 56 deletions(-)

diff --git a/src/components/gameMaster/zoneEditor/ZoneEditor.vue b/src/components/gameMaster/zoneEditor/ZoneEditor.vue
index 297c69d..e894c71 100644
--- a/src/components/gameMaster/zoneEditor/ZoneEditor.vue
+++ b/src/components/gameMaster/zoneEditor/ZoneEditor.vue
@@ -11,12 +11,7 @@
     <Controls :layer="tiles as TilemapLayer" />
 
     <Container :depth="2">
-      <Image
-        v-for="object in zoneObjects"
-        :depth="calculateIsometricDepth(object.positionX, object.positionY, 0)"
-        :key="object.id" v-bind="getObjectImageProps(object)"
-        @pointerup="() => setSelectedZoneObject(object)"
-      />
+      <Image v-for="object in zoneObjects" :depth="calculateIsometricDepth(object.positionX, object.positionY, 0)" :key="object.id" v-bind="getObjectImageProps(object)" @pointerup="() => setSelectedZoneObject(object)" />
     </Container>
 
     <Container :depth="3">
@@ -34,15 +29,7 @@ import { storeToRefs } from 'pinia'
 import { useGameStore } from '@/stores/game'
 import { useZoneEditorStore } from '@/stores/zoneEditor'
 import { useAssetStore } from '@/stores/assets'
-import {
-  calculateIsometricDepth,
-  placeTile,
-  setAllTiles,
-  sortByDepth,
-  sortByIsometricDepth,
-  tileToWorldX,
-  tileToWorldY
-} from '@/services/zone'
+import { calculateIsometricDepth, placeTile, setAllTiles, sortByDepth, sortByIsometricDepth, tileToWorldX, tileToWorldY } from '@/services/zone'
 import { ZoneEventTileType, type ZoneObject, type ZoneEventTile, type Zone } from '@/types'
 import { uuidv4 } from '@/utilities'
 import config from '@/config'
diff --git a/src/components/zone/Characters.vue b/src/components/zone/Characters.vue
index 649bb38..c7a5651 100644
--- a/src/components/zone/Characters.vue
+++ b/src/components/zone/Characters.vue
@@ -1,11 +1,5 @@
 <template>
-  <Character
-    v-for="item in zoneStore.characters"
-    :key="item.id"
-    :layer="tilemap"
-    :character="item"
-    :depth="calculateIsometricDepth(item.positionX, item.positionY, 0)"
-  />
+  <Character v-for="item in zoneStore.characters" :key="item.id" :layer="tilemap" :character="item" :depth="calculateIsometricDepth(item.positionX, item.positionY, 0)" />
 </template>
 
 <script setup lang="ts">
diff --git a/src/components/zone/Objects.vue b/src/components/zone/Objects.vue
index 442d6a2..07b2117 100644
--- a/src/components/zone/Objects.vue
+++ b/src/components/zone/Objects.vue
@@ -1,9 +1,5 @@
 <template>
-  <Image
-    v-for="object in zoneStore.zone?.zoneObjects"
-    :depth="calculateIsometricDepth(object.positionX, object.positionY, 0)"
-    :key="object.id" v-bind="getObjectImageProps(object)"
-  />
+  <Image v-for="object in zoneStore.zone?.zoneObjects" :depth="calculateIsometricDepth(object.positionX, object.positionY, 0)" :key="object.id" v-bind="getObjectImageProps(object)" />
 </template>
 
 <script setup lang="ts">
diff --git a/src/services/zone.ts b/src/services/zone.ts
index a91d46d..edd9a96 100644
--- a/src/services/zone.ts
+++ b/src/services/zone.ts
@@ -73,43 +73,43 @@ export const initializeZoneTiles = (zoneTilemap: Tilemap, tiles: Phaser.Tilemaps
 }
 
 export const updateZoneTiles = (zoneTilemap: Tilemap, tiles: Phaser.Tilemaps.TilemapLayer, zone: Zone) => {
-  if (zone.tiles) {
-    setAllTiles(zoneTilemap, tiles, zone.tiles)
-    const zoneTiles = zone.tiles
-
-    // Ensure zoneTiles matches the current zone dimensions, filling new spaces with 'blank_tile'
-    for (let y = 0; y < zone.height; y++) {
-      zoneTiles[y] = zoneTiles[y] || [] // Ensure the row exists
-      for (let x = 0; x < zone.width; x++) {
-        zoneTiles[y][x] = zoneTiles[y][x] || 'blank_tile' // Fill missing tiles with 'blank_tile'
-      }
-    }
-
-    // Update the tilemap with any new 'blank_tile' entries
-    zoneTiles.forEach((row: any, y: any) => {
-      row.forEach((tileId: any, x: any) => {
-        placeTile(zoneTilemap, tiles, x, y, tileId)
-      })
-    })
-
-    return zoneTiles
+  if (!zone.tiles) {
+    return []
   }
-  return []
+
+  setAllTiles(zoneTilemap, tiles, zone.tiles)
+  const zoneTiles = zone.tiles
+
+  // Ensure zoneTiles matches the current zone dimensions, filling new spaces with 'blank_tile'
+  for (let y = 0; y < zone.height; y++) {
+    zoneTiles[y] = zoneTiles[y] || [] // Ensure the row exists
+    for (let x = 0; x < zone.width; x++) {
+      zoneTiles[y][x] = zoneTiles[y][x] || 'blank_tile' // Fill missing tiles with 'blank_tile'
+    }
+  }
+
+  // Update the tilemap with any new 'blank_tile' entries
+  zoneTiles.forEach((row: any, y: any) => {
+    row.forEach((tileId: any, x: any) => {
+      placeTile(zoneTilemap, tiles, x, y, tileId)
+    })
+  })
+
+  return zoneTiles
 }
 
 export const calculateIsometricDepth = (x: number, y: number, height: number = 0) => {
-  // Adjust these values as needed for your specific isometric projection
-  const isoX = x - y;
-  const isoY = (x + y) / 2;
-  return isoY - height * 0.1;  // Subtract height to make taller objects appear behind shorter ones
+  // const isoX = x - y;
+  const isoY = (x + y) / 2
+  return isoY - height * 0.1 // Subtract height to make taller objects appear behind shorter ones
 }
 
 export const sortByIsometricDepth = <T extends { positionX: number; positionY: number; object?: { height?: number } }>(items: T[]) => {
   return [...items].sort((a, b) => {
-    const aHeight = a.object?.height || 0;
-    const bHeight = b.object?.height || 0;
-    return calculateIsometricDepth(a.positionX, a.positionY, aHeight) - calculateIsometricDepth(b.positionX, b.positionY, bHeight);
-  });
+    const aHeight = a.object?.height || 0
+    const bHeight = b.object?.height || 0
+    return calculateIsometricDepth(a.positionX, a.positionY, aHeight) - calculateIsometricDepth(b.positionX, b.positionY, bHeight)
+  })
 }
 
 // Redundant, but left here for reference