entity.clj

Bowmap · bowmap.git · Tickets

Branches > main > 72082f2 > files / src / net / bowmap / server / packet / entity.clj

(ns net.bowmap.server.packet.entity
  (:require
   [clojure.spec.alpha :as s]))

(s/def ::id pos-int?)

(defonce highest-entity-id (atom 0))

(defn next-entity-id
  "Returns a new entity ID, unique for the lifetime of the server.
   Most packets refer to entities by their ID rather than their UUID."
  []
  (swap! highest-entity-id inc))