new server
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s

This commit is contained in:
Smile Rex
2026-01-17 16:38:45 +03:00
parent 1c60264d1d
commit 3c989c33f8
10 changed files with 156 additions and 85 deletions

31
controllers/entities.go Normal file
View File

@@ -0,0 +1,31 @@
package controllers
import "server/models"
func (h *Hub) addEntity(id uint32, entity models.Entity) {
h.Mu.Lock()
defer h.Mu.Unlock()
h.Entities[id] = entity
}
func (h *Hub) updateEntityPosition(x, y, z float32, entity_id uint32) {
h.Mu.Lock()
defer h.Mu.Unlock()
h.Entities[entity_id].SetPosition(x, y, z)
}
func (h *Hub) updateEntityRotation(yaw float32, entity_id uint32) {
h.Mu.Lock()
defer h.Mu.Unlock()
h.Entities[entity_id].SetYaw(yaw)
}
func (h *Hub) removeEntity(id uint32) {
h.Mu.Lock()
defer h.Mu.Unlock()
delete(h.Entities, id)
}