status updates
This commit is contained in:
@@ -1,12 +1,42 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Server represents an ACC server instance
|
||||
type Server struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
Status string `json:"status"`
|
||||
Status ServiceStatus `json:"status"`
|
||||
IP string `gorm:"not null" json:"-"`
|
||||
Port int `gorm:"not null" json:"-"`
|
||||
ConfigPath string `gorm:"not null" json:"-"` // e.g. "/acc/servers/server1/"
|
||||
ServiceName string `gorm:"not null" json:"-"` // Windows service name
|
||||
BroadcastIP string `json:"-"`
|
||||
BroadcastPort int `json:"-"`
|
||||
BroadcastPassword string `json:"-"`
|
||||
}
|
||||
|
||||
type PlayerState struct {
|
||||
CarID int // Car ID in broadcast packets
|
||||
DriverName string // Optional: pulled from registration packet
|
||||
TeamName string
|
||||
CarModel string
|
||||
CurrentLap int
|
||||
LastLapTime int // in milliseconds
|
||||
BestLapTime int // in milliseconds
|
||||
Position int
|
||||
ConnectedAt time.Time
|
||||
DisconnectedAt *time.Time
|
||||
IsConnected bool
|
||||
}
|
||||
|
||||
type ServerState struct {
|
||||
sync.RWMutex
|
||||
Session string
|
||||
PlayerCount int
|
||||
Players map[int]*PlayerState
|
||||
// etc.
|
||||
}
|
||||
Reference in New Issue
Block a user