use auto-incremented IDs instead of UUIDs

This commit is contained in:
2025-01-19 21:43:27 +09:00
parent e4f1fe19f4
commit 634dde2a3b
9 changed files with 127 additions and 110 deletions
+11 -4
View File
@@ -47,7 +47,12 @@ const entities = {}
const projectiles = {}
const positionTweens = {}
const terrains = {}
let state = { abilities: [], entities: [], terrains: [], projectiles: [] }
var state = { abilities: [], entities: [], terrains: [], projectiles: [] }
global.entities = entities
global.projectiles = projectiles
global.terrains = terrains
global.state = state
const geometry = new THREE.PlaneGeometry(0, 0)
const material = new THREE.MeshToonMaterial({ color: 0x115011 })
@@ -67,7 +72,7 @@ global.renderer = renderer
global.camera = camera
global.scene = scene
const tweenDuration = 33
var tweenDuration = 1
const keysDown = {}
const mouse = {}
@@ -179,6 +184,10 @@ function connectWebSocket() {
state.byteSize = new Blob([event.data]).size
const stateUpdates = JSON.parse(event.data)
if (stateUpdates.tickRate != null) {
tweenDuration = 1000 / stateUpdates.tickRate
}
if (stateUpdates.width != null && stateUpdates.height != null) {
state.width = stateUpdates.width
state.height = stateUpdates.height
@@ -253,8 +262,6 @@ function connectWebSocket() {
}
}
// console.log(state)
if (state.width != null && state.height != null && (ground.geometry.attributes.width != state.width || ground.geometry.attributes.height != state.height)) {
ground.geometry = new THREE.PlaneGeometry(state.width / 100, state.height / 100)
ground.position.set(state.width / 200, state.height / 200, 0)