Files
tma-back/controllers/entities.go
Smile Rex 3c989c33f8
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
new server
2026-01-17 16:38:45 +03:00

32 lines
563 B
Go

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)
}