All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m19s
32 lines
563 B
Go
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)
|
|
}
|