1
0
forked from noxious/client

npm run format

This commit is contained in:
Dennis Postma 2024-11-05 23:16:47 +01:00
parent d71f4e7b59
commit 1384f50406
3 changed files with 8 additions and 19 deletions

View File

@ -102,13 +102,13 @@ const calculateLightStrength = (time: Date): number => {
}
// Sunrise transition (6 AM - 7 AM)
else if (hour === SUNRISE_HOUR) {
strength = NIGHT_STRENGTH + ((DAY_STRENGTH - NIGHT_STRENGTH) * minute / 60)
strength = NIGHT_STRENGTH + ((DAY_STRENGTH - NIGHT_STRENGTH) * minute) / 60
}
// Sunset transition (8 PM - 10 PM)
else if (hour >= SUNSET_HOUR - 2 && hour < SUNSET_HOUR) {
const totalMinutes = ((hour - (SUNSET_HOUR - 2)) * 60) + minute
const totalMinutes = (hour - (SUNSET_HOUR - 2)) * 60 + minute
const transitionProgress = totalMinutes / 120 // 2 hours = 120 minutes
strength = DAY_STRENGTH - ((DAY_STRENGTH - NIGHT_STRENGTH) * transitionProgress)
strength = DAY_STRENGTH - (DAY_STRENGTH - NIGHT_STRENGTH) * transitionProgress
}
return strength
@ -202,4 +202,4 @@ onBeforeUnmount(() => {
if (sceneRef.value) sceneRef.value.scene.remove('effects')
gameStore.connection?.off('weather')
})
</script>
</script>

View File

@ -1,13 +1,6 @@
<template>
<div style="display: none">
<img
v-for="(url, index) in imageUrls"
:key="index"
:src="url"
alt=""
@load="handleImageLoad(index)"
@error="handleImageError(index)"
/>
<img v-for="(url, index) in imageUrls" :key="index" :src="url" alt="" @load="handleImageLoad(index)" @error="handleImageError(index)" />
</div>
</template>
@ -15,11 +8,7 @@
import { ref } from 'vue'
// Internal array of images to preload
const imageUrls = ref<string[]>([
'/assets/ui-elements/ui-border-4-corners.svg',
'/assets/ui-elements/ui-border-4-corners-light.svg',
'/assets/ui-elements/ui-border-4-corners-small.svg'
])
const imageUrls = ref<string[]>(['/assets/ui-elements/ui-border-4-corners.svg', '/assets/ui-elements/ui-border-4-corners-light.svg', '/assets/ui-elements/ui-border-4-corners-small.svg'])
const loadedImages = ref<Set<number>>(new Set())
@ -31,4 +20,4 @@ const handleImageLoad = (index: number) => {
const handleImageError = (index: number) => {
console.log(`Image ${index} failed to load:`, imageUrls.value[index])
}
</script>
</script>

View File

@ -230,4 +230,4 @@ export type WeatherState = {
rainPercentage: number
isFogEnabled: boolean
fogDensity: number
}
}