feat: auto save worlds in singleplayer every 2 seconds since crashes might happen. still possible to cancel this behavior via new setting or ?noSave=true

feat: add setting for debugging to disable signs text rendering
This commit is contained in:
Vitaly Turovsky 2024-11-11 17:49:33 +03:00
commit c8c4e3267d
5 changed files with 20 additions and 2 deletions

View file

@ -484,7 +484,7 @@ export function getSectionGeometry (sx, sy, sz, world: World) {
}
}
if (invisibleBlocks.has(block.name)) continue
if (block.name.includes('_sign') || block.name === 'sign') {
if ((block.name.includes('_sign') || block.name === 'sign') && !world.config.disableSignsMapsSupport) {
const key = `${cursor.x},${cursor.y},${cursor.z}`
const props: any = block.getProperties()
const facingRotationMap = {

View file

@ -8,7 +8,8 @@ export const defaultMesherConfig = {
outputFormat: 'threeJs' as 'threeJs' | 'webgpu',
textureSize: 1024, // for testing
debugModelVariant: undefined as undefined | number[],
clipWorldBelowY: undefined as undefined | number
clipWorldBelowY: undefined as undefined | number,
disableSignsMapsSupport: false
}
export type MesherConfig = typeof defaultMesherConfig

View file

@ -1,4 +1,7 @@
import { saveServer } from './flyingSquidUtils'
import { watchUnloadForCleanup } from './gameUnload'
import { showModal } from './globalState'
import { options } from './optionsStorage'
import { chatInputValueGlobal } from './react/Chat'
import { showNotification } from './react/NotificationProvider'
@ -10,4 +13,15 @@ export default () => {
showModal({ reactType: 'chat' })
})
})
if (options.singleplayerAutoSave) {
const autoSaveInterval = setInterval(() => {
if (options.singleplayerAutoSave) {
void saveServer(true)
}
}, 2000)
watchUnloadForCleanup(() => {
clearInterval(autoSaveInterval)
})
}
}

View file

@ -53,6 +53,8 @@ const defaultOptions = {
// antiAliasing: false,
clipWorldBelowY: undefined as undefined | number, // will be removed
disableSignsMapsSupport: false,
singleplayerAutoSave: false,
showChunkBorders: false, // todo rename option
frameLimit: false as number | false,
alwaysBackupWorldBeforeLoading: undefined as boolean | undefined | null,

View file

@ -60,6 +60,7 @@ export const watchOptionsAfterViewerInit = () => {
})
watchValue(options, (o, isChanged) => {
viewer.world.mesherConfig.clipWorldBelowY = o.clipWorldBelowY
viewer.world.mesherConfig.disableSignsMapsSupport = o.disableSignsMapsSupport
if (isChanged) {
(viewer.world as WorldRendererThree).rerenderAllChunks()
}