common

package
v0.0.0-...-c6ab6a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InfoLogger    *log.Logger
	WarningLogger *log.Logger
	ErrorLogger   *log.Logger
)

Functions

func RegisterPackets

func RegisterPackets()

func SetupLoggerFiles

func SetupLoggerFiles() (*os.File, *os.File, func(), error)

func SetupServerLogger

func SetupServerLogger() func()

Types

type ClientBoundWorldStateUpdate

type ClientBoundWorldStateUpdate struct {
	State WorldState
}

type Connection

type Connection struct {
	Connection net.Conn
	ClientAddr net.Addr
	Encoder    *gob.Encoder
	Decoder    *gob.Decoder
}

func NewConnection

func NewConnection(conn net.Conn) Connection

func (Connection) MustRecieve

func (c Connection) MustRecieve() Packet

Same as Recieve() but panics if it encounters an error

func (Connection) MustSend

func (c Connection) MustSend(packet Packet)

Same as Send() but panics if it encounters an error

func (Connection) Recieve

func (c Connection) Recieve() (Packet, error)

Waits for incoming data on the Connection before it decodes the data into a packet with the gob.Decoder

func (Connection) Send

func (c Connection) Send(packet Packet) error

Encodes a packet with the gob.Encoder and sends it along the Connection

type Packet

type Packet interface {
}

type RecievedPacket

type RecievedPacket struct {
	Packet Packet
	Sender net.Addr
}

type ServerBoundAddVolume

type ServerBoundAddVolume struct {
	Volume Volume
}

type ServerBoundLightingUpdate

type ServerBoundLightingUpdate struct {
	Color mgl32.Vec3
}

type ServerBoundWorldStateRequest

type ServerBoundWorldStateRequest struct {
}

type Volume

type Volume struct {
	Min, Max mgl32.Vec3
}

func NewVolume

func NewVolume(min, max mgl32.Vec3) Volume

func (Volume) Dx

func (v Volume) Dx() float32

func (Volume) Dy

func (v Volume) Dy() float32

func (Volume) Dz

func (v Volume) Dz() float32

func (Volume) Size

func (v Volume) Size() mgl32.Vec3

type WorldState

type WorldState struct {
	Volumes []Volume

	LightCol mgl32.Vec3
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL