emulate retail semaphore logic

This commit is contained in:
wish
2024-10-03 21:56:06 +10:00
parent 8f68e10f1d
commit b20969ddc6
4 changed files with 33 additions and 21 deletions

View File

@@ -22,15 +22,18 @@ type Semaphore struct {
// Max Players for Semaphore
maxPlayers uint16
host *Session
}
// NewSemaphore creates a new Semaphore with intialized values
func NewSemaphore(s *Server, ID string, MaxPlayers uint16) *Semaphore {
func NewSemaphore(s *Session, ID string, MaxPlayers uint16) *Semaphore {
sema := &Semaphore{
name: ID,
id: s.NextSemaphoreID(),
id: s.GetSemaphoreID(),
clients: make(map[*Session]uint32),
maxPlayers: MaxPlayers,
host: s,
}
return sema
}