Documentation
¶
Index ¶
- func WriteSubpacket(buf *bytes.Buffer, typ uint8, data []byte)
- type ArrayDiffResult
- type CarPosPacket
- type Client
- func (c Client) Active() bool
- func (c *Client) Cleanup()
- func (c *Client) GetPendingPlayersCount() int
- func (c *Client) GetPlayerSpawnDelay() int
- func (c Client) GetPos() math.Vector2D
- func (c Client) GetRotation() float64
- func (c *Client) IsRadiusSyncDisabled() bool
- func (c Client) IsReady() bool
- func (c *Client) SendRawPacket(b []byte) error
- func (c *Client) SetPlayerSpawnDelay(delayMs int)
- func (c *Client) SetRadiusSync(enabled bool)
- type ClientConfig
- type Config
- type FMSConfig
- type Server
- type UDPConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayDiffResult ¶
func ArrayDiff ¶
func ArrayDiff(old []*Client, new []*Client) ArrayDiffResult
type CarPosPacket ¶
type CarPosPacket struct {
// contains filtered or unexported fields
}
func (*CarPosPacket) Packet ¶
func (p *CarPosPacket) Packet() []byte
Packet returns the packet data with the packet time replaced by the argument.
func (*CarPosPacket) Pos ¶
func (p *CarPosPacket) Pos() math.Vector2D
Pos returns the car position as a Vector2D.
func (*CarPosPacket) Rotation ¶
func (p *CarPosPacket) Rotation() float64
Rotation returns the car rotation in degrees.
func (*CarPosPacket) Update ¶
func (p *CarPosPacket) Update(packet []byte)
Update updates CarPosPacket with the specified byte slice. The supplied slice shouldn't be modified after calling this method.
func (*CarPosPacket) Valid ¶
func (p *CarPosPacket) Valid() bool
Valid returns true if CarPosPacket contains valid packet data.
type Client ¶
type Client struct {
Addr *net.UDPAddr
LastPacket time.Time
PersonaName string
// contains filtered or unexported fields
}
func (*Client) GetPendingPlayersCount ¶
func (*Client) GetPlayerSpawnDelay ¶
func (Client) GetRotation ¶
GetRotation returns the current rotation of the client.
func (*Client) IsRadiusSyncDisabled ¶
func (Client) IsReady ¶
IsReady returns true if the client is ready to be broadcasted to other clients. This means that the server has valid channel info, player info and position data of the client.
func (*Client) SendRawPacket ¶
SendRawPacket sends a raw UDP packet to the client.
func (*Client) SetPlayerSpawnDelay ¶
func (*Client) SetRadiusSync ¶
type ClientConfig ¶
type Config ¶
func DefaultConfig ¶
func DefaultConfig() Config
type Server ¶
type Server struct {
sync.Mutex
Clients map[string]*Client
// contains filtered or unexported fields
}
func (*Server) RunPacketRead ¶
func (i *Server) RunPacketRead()
func (*Server) SetPlayerSpawnDelayForAllClients ¶
func (*Server) SetRadiusSyncForAllClients ¶
Click to show internal directories.
Click to hide internal directories.