protocol

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TIMEOUT = 5 * time.Second
)
View Source
const PROTOCOL_VERSION = 260
View Source
const RAD = math.Pi / 180.0

Variables

View Source
var CLIENT_MESSAGES = make(map[MessageCode]Message)

This does not represent the messages a client or server is permitted to send (= presence here does not imply a message of that type is valid), there are just some differences in message structures depending on whether they came from the client or the server.

View Source
var FAILED = fmt.Errorf("failed to unmarshal message")
View Source
var FAILED_EDIT = fmt.Errorf("failed to unmarshal edit message")
View Source
var SERVER_MESSAGES = make(map[MessageCode]Message)

Functions

func Encode

func Encode(messages ...Message) ([]byte, error)

func IsConnectingMessage

func IsConnectingMessage(code MessageCode) bool

func IsEditMessage

func IsEditMessage(code MessageCode) bool

func IsOwnerOnly

func IsOwnerOnly(code MessageCode) bool

If a server is not in "open edit" mode and we receive one of these messages from a user who is not the owner, we disconnect and reconnect them.

func IsServerOnly

func IsServerOnly(code MessageCode) bool

func IsSpammyMessage

func IsSpammyMessage(code MessageCode) bool

Types

type AddBot

type AddBot struct {
	NumBots int32
}

N_ADDBOT

func (AddBot) Type

func (m AddBot) Type() MessageCode

type AmmoState

type AmmoState struct {
	Amount int32
}

N_SPAWNSTATE

type Announce

type Announce struct {
	Announcement int32
}

N_ANNOUNCE

func (Announce) Type

func (m Announce) Type() MessageCode

type AuthAns

type AuthAns struct {
	Description string
	Id          int32
	Answer      string
}

N_AUTHANS

func (AuthAns) Type

func (m AuthAns) Type() MessageCode

type AuthChallenge

type AuthChallenge struct {
	Desc      string
	Id        int32
	Challenge string
}

N_AUTHCHAL

func (AuthChallenge) Type

func (m AuthChallenge) Type() MessageCode

type AuthKick

type AuthKick struct {
	Description string
	Answer      string
	Victim      int32
}

N_AUTHKICK

func (AuthKick) Type

func (m AuthKick) Type() MessageCode

type AuthTry

type AuthTry struct {
	Description string
	Answer      string
}

N_AUTHTRY

func (AuthTry) Type

func (m AuthTry) Type() MessageCode

type BaseInfo

type BaseInfo struct {
	Base      int32
	Owner     string
	Enemy     string
	Converted int32
	AmmoCount int32
}

N_BASEINFO

func (BaseInfo) Type

func (m BaseInfo) Type() MessageCode

type BaseRegen

type BaseRegen struct {
	Client   int32
	Health   int32
	Armour   int32
	Ammotype int32
	Ammo     int32
}

N_BASEREGEN

func (BaseRegen) Type

func (m BaseRegen) Type() MessageCode

type BaseScore

type BaseScore struct {
	Base  int32
	Team  string
	Total int32
}

N_BASESCORE

func (BaseScore) Type

func (m BaseScore) Type() MessageCode

type BaseState

type BaseState struct {
	AmmoType  int32
	Owner     string
	Enemy     string
	Converted int32
	AmmoCount int32
}

N_BASES

type Bases

type Bases struct {
	Bases []BaseState
}

func (Bases) Type

func (m Bases) Type() MessageCode

type BotBalance

type BotBalance struct {
	Balance int32
}

N_BOTBALANCE

func (BotBalance) Type

func (m BotBalance) Type() MessageCode

type BotLimit

type BotLimit struct {
	Limit int32
}

N_BOTLIMIT

func (BotLimit) Type

func (m BotLimit) Type() MessageCode

type CheckMaps

type CheckMaps struct {
}

N_CHECKMAPS

func (CheckMaps) Type

func (m CheckMaps) Type() MessageCode

type ClearBans

type ClearBans struct {
}

N_CLEARBANS

func (ClearBans) Type

func (m ClearBans) Type() MessageCode

type ClearDemos

type ClearDemos struct {
	Demo int32
}

N_CLEARDEMOS

func (ClearDemos) Type

func (m ClearDemos) Type() MessageCode

type ClientDisconnected

type ClientDisconnected struct {
	Client int32
}

N_CDIS

func (ClientDisconnected) Type

type ClientFlagState

type ClientFlagState struct {
	Team     int32
	Position Vec
}

type ClientInitFlags

type ClientInitFlags struct {
	Flags []ClientFlagState
}

func (ClientInitFlags) Type

func (m ClientInitFlags) Type() MessageCode

type ClientPacket

type ClientPacket struct {
	Client int32
	Length int32
}

N_CLIENT

func (ClientPacket) Type

func (m ClientPacket) Type() MessageCode

type ClientPing

type ClientPing struct {
	Ping int32
}

N_CLIENTPING

func (ClientPing) Type

func (m ClientPing) Type() MessageCode

type ClientPrivilege

type ClientPrivilege struct {
	Client    int32
	Privilege int32
}

N_CURRENTMASTER

type ClientState

type ClientState struct {
	Id         int32
	State      int32
	Frags      int32
	Flags      int32
	Deaths     int32
	Quadmillis int32
	EntityState
}

type ClientTakeFlag

type ClientTakeFlag struct {
	Flag    int32
	Version int32
}

func (ClientTakeFlag) Type

func (m ClientTakeFlag) Type() MessageCode

type ClientTokenState

type ClientTokenState struct {
	Client int32
	Count  int32
}

type Clipboard

type Clipboard PackData

func (Clipboard) Type

func (m Clipboard) Type() MessageCode

type Connect

type Connect struct {
	Name            string
	Model           int32
	Password        string
	AuthDescription string
	AuthName        string
}

N_CONNECT

func (Connect) Type

func (m Connect) Type() MessageCode

type Copy

type Copy struct {
	Sel Selection
}

N_COPY

func (Copy) Type

func (m Copy) Type() MessageCode

type CurrentMaster

type CurrentMaster struct {
	MasterMode int32
	Clients    []ClientPrivilege `type:"term"`
}

func (CurrentMaster) Type

func (m CurrentMaster) Type() MessageCode

type Damage

type Damage struct {
	Client    int32
	Aggressor int32
	Damage    int32
	Armour    int32
	Health    int32
}

N_DAMAGE

func (Damage) Type

func (m Damage) Type() MessageCode

type DelBot

type DelBot struct {
}

N_DELBOT

func (DelBot) Type

func (m DelBot) Type() MessageCode

type DeleteCube

type DeleteCube struct {
	Sel Selection
}

N_DELCUBE

func (DeleteCube) Type

func (m DeleteCube) Type() MessageCode

type DemoPacket

type DemoPacket struct {
}

N_DEMOPACKET

func (DemoPacket) Type

func (m DemoPacket) Type() MessageCode

type DemoPlayback

type DemoPlayback struct {
	On     int32
	Client int32
}

N_DEMOPLAYBACK

func (DemoPlayback) Type

func (m DemoPlayback) Type() MessageCode

type DepositTokens

type DepositTokens struct {
	Client    int32
	Base      int32
	Deposited int32
	Team      int32
	Score     int32
	Flags     int32
}

N_DEPOSITTOKENS

func (DepositTokens) Type

func (m DepositTokens) Type() MessageCode

type Died

type Died struct {
	Client      int32
	Killer      int32
	KillerFrags int32
	VictimFrags int32
}

N_DIED

func (Died) Type

func (m Died) Type() MessageCode

type DropFlag

type DropFlag struct {
	Client   int32
	Flag     int32
	Version  int32
	Position Vec
}

N_DROPFLAG

func (DropFlag) Type

func (m DropFlag) Type() MessageCode

type DropTokens

type DropTokens struct {
	Client int32
	Dropx  int32
	Dropy  int32
	Dropz  int32
	Tokens []struct {
		Token int32
		Team  int32
		Yaw   int32
	} `type:"term"`
}

N_DROPTOKENS

func (DropTokens) Type

func (m DropTokens) Type() MessageCode

type EditEntity

type EditEntity struct {
	Index      int32
	Position   Vec
	EntityType int32
	Attr1      int32
	Attr2      int32
	Attr3      int32
	Attr4      int32
	Attr5      int32
}

N_EDITENT

func (EditEntity) Type

func (m EditEntity) Type() MessageCode

type EditFace

type EditFace struct {
	Sel  Selection
	Dir  int32
	Mode int32
}

N_EDITF

func (EditFace) Type

func (m EditFace) Type() MessageCode

type EditMaterial

type EditMaterial struct {
	Sel    Selection
	Mat    int32
	Filter int32
}

N_EDITM

func (EditMaterial) Type

func (m EditMaterial) Type() MessageCode

type EditMode

type EditMode struct {
	Enabled bool
}

N_EDITMODE

func (EditMode) Type

func (m EditMode) Type() MessageCode

type EditTexture

type EditTexture struct {
	Sel      Selection
	Tex      int32
	AllFaces int32
	Extra    []byte
}

N_EDITT

func (EditTexture) Marshal

func (e EditTexture) Marshal(p *io.Packet) error

func (EditTexture) Type

func (m EditTexture) Type() MessageCode

func (*EditTexture) Unmarshal

func (e *EditTexture) Unmarshal(p *io.Packet) error

type EditVSlot

type EditVSlot struct {
	Sel      Selection
	Delta    int32
	AllFaces int32
	Extra    []byte
}

N_EDITVSLOT

func (EditVSlot) Marshal

func (e EditVSlot) Marshal(p *io.Packet) error

func (EditVSlot) Type

func (m EditVSlot) Type() MessageCode

func (*EditVSlot) Unmarshal

func (e *EditVSlot) Unmarshal(p *io.Packet) error

type EditVar

type EditVar struct {
	Key   string
	Value variables.Variable
}

N_EDITVAR

func (EditVar) Marshal

func (e EditVar) Marshal(p *io.Packet) error

func (EditVar) Type

func (m EditVar) Type() MessageCode

func (*EditVar) Unmarshal

func (e *EditVar) Unmarshal(p *io.Packet) error

type EntityState

type EntityState struct {
	LifeSequence int32
	Health       int32
	MaxHealth    int32
	Armour       int32
	Armourtype   int32
	Gunselect    int32
	Ammo         [6]AmmoState
}

type ExpireTokens

type ExpireTokens struct {
	Tokens []struct {
		Token int32
	} `type:"term"`
}

N_EXPIRETOKENS

func (ExpireTokens) Type

func (m ExpireTokens) Type() MessageCode

type Explode

type Explode struct {
	Cmillis int32
	Gun     int32
	Id      int32
	Hits    []Hit
}

N_EXPLODE

func (Explode) Type

func (m Explode) Type() MessageCode

type ExplodeFX

type ExplodeFX struct {
	Client int32
	Gun    int32
	Id     int32
}

N_EXPLODEFX

func (ExplodeFX) Type

func (m ExplodeFX) Type() MessageCode

type FlagState

type FlagState struct {
	Version   int32
	Spawn     int32
	Owner     int32
	Invisible bool
	Dropped   bool
	Position  Vec
}

func (FlagState) Marshal

func (f FlagState) Marshal(p *io.Packet) error

func (*FlagState) Unmarshal

func (f *FlagState) Unmarshal(p *io.Packet) error

type Flip

type Flip struct {
	Sel Selection
}

N_FLIP

func (Flip) Type

func (m Flip) Type() MessageCode

type ForceDeath

type ForceDeath struct {
	Client int32
}

N_FORCEDEATH

func (ForceDeath) Type

func (m ForceDeath) Type() MessageCode

type ForceIntermission

type ForceIntermission struct {
}

N_FORCEINTERMISSION

func (ForceIntermission) Type

func (m ForceIntermission) Type() MessageCode

type FromAI

type FromAI struct {
	Qcn int32
}

N_FROMAI

func (FromAI) Type

func (m FromAI) Type() MessageCode

type GameSpeed

type GameSpeed struct {
	Speed  int32
	Client int32
}

N_GAMESPEED

func (GameSpeed) Type

func (m GameSpeed) Type() MessageCode

type GetDemo

type GetDemo struct {
	Demo int32
	Tag  int32
}

N_GETDEMO

func (GetDemo) Type

func (m GetDemo) Type() MessageCode

type GetMap

type GetMap struct {
}

N_GETMAP

func (GetMap) Type

func (m GetMap) Type() MessageCode

type GunSelect

type GunSelect struct {
	GunSelect int32
}

N_GUNSELECT

func (GunSelect) Type

func (m GunSelect) Type() MessageCode

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) Handles

func (h *Handler) Handles(code MessageCode) bool

func (*Handler) Receive

func (h *Handler) Receive() <-chan ProxiedMessage

func (*Handler) Remove

func (h *Handler) Remove()

type Hit

type Hit struct {
	Target       int32
	LifeSequence int32
	Distance     float64
	Rays         int32
	Direction    Vec
}

type HitPush

type HitPush struct {
	Client int32
	Gun    int32
	Damage int32
	From   Vec
}

N_HITPUSH

func (HitPush) Type

func (m HitPush) Type() MessageCode

type IVec

type IVec struct {
	X int32
	Y int32
	Z int32
}

func IVecFromVec

func IVecFromVec(v Vec) *IVec

type InitAI

type InitAI struct {
	Aiclientnum    int32
	Ownerclientnum int32
	Aitype         int32
	Aiskill        int32
	Playermodel    int32
	Name           string
	Team           string
}

N_INITAI

func (InitAI) Type

func (m InitAI) Type() MessageCode

type InitClient

type InitClient struct {
	Client      int32
	Name        string
	Team        string
	Playermodel int32
}

N_INITCLIENT

func (InitClient) Type

func (m InitClient) Type() MessageCode

type InitTokens

type InitTokens struct {
	TeamScores   [2]TeamScore
	Tokens       []TokenState
	ClientTokens []ClientTokenState `type:"term"`
}

func (InitTokens) Type

func (m InitTokens) Type() MessageCode

type InvisFlag

type InvisFlag struct {
	Flag      int32
	Invisible int32
}

N_INVISFLAG

func (InvisFlag) Type

func (m InvisFlag) Type() MessageCode

type Item

type Item struct {
	Index int32
	Type  int32
}

N_ITEMLIST

type ItemAck

type ItemAck struct {
	Index  int32
	Client int32
}

N_ITEMACC

func (ItemAck) Type

func (m ItemAck) Type() MessageCode

type ItemList

type ItemList struct {
	Items []Item `type:"term"`
}

func (ItemList) Type

func (m ItemList) Type() MessageCode

type ItemPickup

type ItemPickup struct {
	Item int32
}

N_ITEMPICKUP

func (ItemPickup) Type

func (m ItemPickup) Type() MessageCode

type ItemSpawn

type ItemSpawn struct {
	Index int32
}

N_ITEMSPAWN

func (ItemSpawn) Type

func (m ItemSpawn) Type() MessageCode

type JumpPad

type JumpPad struct {
	Client  int32
	JumpPad int32
}

N_JUMPPAD

func (JumpPad) Type

func (m JumpPad) Type() MessageCode

type Kick

type Kick struct {
	Victim int32
	Reason string
}

N_KICK

func (Kick) Type

func (m Kick) Type() MessageCode

type ListDemos

type ListDemos struct {
}

N_LISTDEMOS

func (ListDemos) Type

func (m ListDemos) Type() MessageCode

type MapCRC

type MapCRC struct {
	Map string
	Crc int32
}

N_MAPCRC

func (MapCRC) Type

func (m MapCRC) Type() MessageCode

type MapChange

type MapChange struct {
	Name     string
	Mode     int32
	HasItems bool
}

N_MAPCHANGE

func (MapChange) Type

func (m MapChange) Type() MessageCode

type MapVote

type MapVote struct {
	Map  string
	Mode int32
}

N_MAPVOTE

func (MapVote) Type

func (m MapVote) Type() MessageCode

type MasterMode

type MasterMode struct {
	MasterMode int32
}

N_MASTERMODE

func (MasterMode) Type

func (m MasterMode) Type() MessageCode

type Message

type Message interface {
	Type() MessageCode
}

func Decode

func Decode(b []byte, fromClient bool) ([]Message, error)

type MessageCode

type MessageCode int32 // network message code
const (
	N_CONNECT MessageCode = iota
	N_SERVINFO
	N_WELCOME
	N_INITCLIENT
	N_POS
	N_TEXT
	N_SOUND
	N_CDIS
	N_SHOOT
	N_EXPLODE
	N_SUICIDE
	N_DIED
	N_DAMAGE
	N_HITPUSH
	N_SHOTFX
	N_EXPLODEFX
	N_TRYSPAWN
	N_SPAWNSTATE
	N_SPAWN
	N_FORCEDEATH
	N_GUNSELECT
	N_TAUNT
	N_MAPCHANGE
	N_MAPVOTE
	N_TEAMINFO
	N_ITEMSPAWN
	N_ITEMPICKUP
	N_ITEMACC
	N_TELEPORT
	N_JUMPPAD
	N_PING
	N_PONG
	N_CLIENTPING
	N_TIMEUP
	N_FORCEINTERMISSION
	N_SERVMSG
	N_ITEMLIST
	N_RESUME
	N_EDITMODE
	N_EDITENT
	N_EDITF
	N_EDITT
	N_EDITM
	N_FLIP
	N_COPY
	N_PASTE
	N_ROTATE
	N_REPLACE
	N_DELCUBE
	N_REMIP
	N_EDITVSLOT
	N_UNDO
	N_REDO
	N_NEWMAP
	N_GETMAP
	N_SENDMAP
	N_CLIPBOARD
	N_EDITVAR
	N_MASTERMODE
	N_KICK
	N_CLEARBANS
	N_CURRENTMASTER
	N_SPECTATOR
	N_SETMASTER
	N_SETTEAM
	N_BASES
	N_BASEINFO
	N_BASESCORE
	N_REPAMMO
	N_BASEREGEN
	N_ANNOUNCE
	N_LISTDEMOS
	N_SENDDEMOLIST
	N_GETDEMO
	N_SENDDEMO
	N_DEMOPLAYBACK
	N_RECORDDEMO
	N_STOPDEMO
	N_CLEARDEMOS
	N_TAKEFLAG
	N_RETURNFLAG
	N_RESETFLAG
	N_INVISFLAG
	N_TRYDROPFLAG
	N_DROPFLAG
	N_SCOREFLAG
	N_INITFLAGS
	N_SAYTEAM
	N_CLIENT
	N_AUTHTRY
	N_AUTHKICK
	N_AUTHCHAL
	N_AUTHANS
	N_REQAUTH
	N_PAUSEGAME
	N_GAMESPEED
	N_ADDBOT
	N_DELBOT
	N_INITAI
	N_FROMAI
	N_BOTLIMIT
	N_BOTBALANCE
	N_MAPCRC
	N_CHECKMAPS
	N_SWITCHNAME
	N_SWITCHMODEL
	N_SWITCHTEAM
	N_INITTOKENS
	N_TAKETOKEN
	N_EXPIRETOKENS
	N_DROPTOKENS
	N_DEPOSITTOKENS
	N_STEALTOKENS
	N_SERVCMD
	N_DEMOPACKET
	NUMMSG
)
const N_EMPTY MessageCode = -1

func (MessageCode) String

func (e MessageCode) String() string

type MessageProxy

type MessageProxy struct {
	// contains filtered or unexported fields
}

func NewMessageProxy

func NewMessageProxy(fromClient bool) *MessageProxy

func (*MessageProxy) Intercept

func (m *MessageProxy) Intercept(codes ...MessageCode) *Handler

func (*MessageProxy) InterceptWith

func (m *MessageProxy) InterceptWith(check func(MessageCode) bool) *Handler

func (*MessageProxy) Next

func (m *MessageProxy) Next(ctx context.Context, codes ...MessageCode) (Message, error)

Wait for a message and drop it.

func (*MessageProxy) NextTimeout

func (m *MessageProxy) NextTimeout(
	ctx context.Context,
	timeout time.Duration,
	codes ...MessageCode,
) (Message, error)

func (*MessageProxy) Process

func (m *MessageProxy) Process(ctx context.Context, channel uint8, message Message) (Message, error)

func (*MessageProxy) Remove

func (m *MessageProxy) Remove(handler *Handler)

func (*MessageProxy) Take

func (m *MessageProxy) Take(
	ctx context.Context,
	codes ...MessageCode,
) (Message, error)

func (*MessageProxy) Wait

func (m *MessageProxy) Wait(ctx context.Context, codes ...MessageCode) (Message, error)

Wait for a message, but don't prevent it from being transmitted.

func (*MessageProxy) WaitTimeout

func (m *MessageProxy) WaitTimeout(
	ctx context.Context,
	timeout time.Duration,
	codes ...MessageCode,
) (Message, error)

type NewMap

type NewMap struct {
	Size int32
}

N_NEWMAP

func (NewMap) Type

func (m NewMap) Type() MessageCode

type PackData

type PackData struct {
	Client       int32
	UnpackLength int32
	PackLength   int32
	Data         []byte
}

These are the same N_REDO N_UNDO N_CLIPBOARD

func (PackData) Marshal

func (e PackData) Marshal(p *io.Packet) error

func (*PackData) Unmarshal

func (e *PackData) Unmarshal(p *io.Packet) error

type Packet

type Packet struct {
	Channel  uint8
	Messages []Message
}

type Paste

type Paste struct {
	Sel Selection
}

N_PASTE

func (Paste) Type

func (m Paste) Type() MessageCode

type PauseGame

type PauseGame struct {
	Paused bool
	Client int32
}

N_PAUSEGAME

func (PauseGame) Type

func (m PauseGame) Type() MessageCode

type PhysicsState

type PhysicsState struct {
	State        byte
	LifeSequence int32
	Yaw          float64
	Roll         float64
	Pitch        float64
	Move         int8
	Strafe       int8
	O            Vec
	Falling      Vec
	Velocity     Vec
}

func (PhysicsState) Marshal

func (state PhysicsState) Marshal(p *io.Packet) error

func (*PhysicsState) Unmarshal

func (d *PhysicsState) Unmarshal(p *io.Packet) error

type Ping

type Ping struct {
	Cmillis int32
}

N_PING

func (Ping) Type

func (m Ping) Type() MessageCode

type Pong

type Pong struct {
	Cmillis int32
}

N_PONG

func (Pong) Type

func (m Pong) Type() MessageCode

type Pos

type Pos struct {
	Client int32
	State  PhysicsState
}

N_POS

func (Pos) Type

func (m Pos) Type() MessageCode

type ProxiedMessage

type ProxiedMessage struct {
	Message Message
	Channel uint8
	// contains filtered or unexported fields
}

func (*ProxiedMessage) Drop

func (p *ProxiedMessage) Drop()

func (*ProxiedMessage) Pass

func (p *ProxiedMessage) Pass()

func (*ProxiedMessage) Replace

func (p *ProxiedMessage) Replace(message Message)

type RecordDemo

type RecordDemo struct {
	Enabled int32
}

N_RECORDDEMO

func (RecordDemo) Type

func (m RecordDemo) Type() MessageCode

type Redo

type Redo PackData

func (Redo) Type

func (m Redo) Type() MessageCode

type Remip

type Remip struct {
}

N_REMIP

func (Remip) Type

func (m Remip) Type() MessageCode

type Replace

type Replace struct {
	Sel    Selection
	Tex    int32
	NewTex int32
	Insel  int32
	Extra  []byte
}

N_REPLACE

func (Replace) Marshal

func (e Replace) Marshal(p *io.Packet) error

func (Replace) Type

func (m Replace) Type() MessageCode

func (*Replace) Unmarshal

func (e *Replace) Unmarshal(p *io.Packet) error

type ReplenishAmmo

type ReplenishAmmo struct {
	Client   int32
	Ammotype int32
}

N_REPAMMO

func (ReplenishAmmo) Type

func (m ReplenishAmmo) Type() MessageCode

type ReqAuth

type ReqAuth struct {
	Domain string
}

N_REQAUTH

func (ReqAuth) Type

func (m ReqAuth) Type() MessageCode

type ResetFlag

type ResetFlag struct {
	Flag    int32
	Version int32
	Spawn   int32
	Team    int32
	Score   int32
}

N_RESETFLAG

func (ResetFlag) Type

func (m ResetFlag) Type() MessageCode

type Resume

type Resume struct {
	Clients []ClientState `type:"term"`
}

N_RESUME

func (Resume) Type

func (m Resume) Type() MessageCode

type ReturnFlag

type ReturnFlag struct {
	Client  int32
	Flag    int32
	Version int32
}

N_RETURNFLAG

func (ReturnFlag) Type

func (m ReturnFlag) Type() MessageCode

type Rotate

type Rotate struct {
	Sel Selection
	Dir int32
}

N_ROTATE

func (Rotate) Type

func (m Rotate) Type() MessageCode

type SayTeam

type SayTeam struct {
	Text string
}

N_SAYTEAM

func (SayTeam) Type

func (m SayTeam) Type() MessageCode

type ScoreFlag

type ScoreFlag struct {
	Client       int32
	Relayflag    int32
	Relayversion int32
	Goalflag     int32
	Goalversion  int32
	Goalspawn    int32
	Team         int32
	Score        int32
	Oflags       int32
}

N_SCOREFLAG

func (ScoreFlag) Type

func (m ScoreFlag) Type() MessageCode

type Selection

type Selection struct {
	O      IVec
	S      IVec
	Grid   int32
	Orient int32
	Cx     int32
	Cxs    int32
	Cy     int32
	Cys    int32
	Corner int32
}

type SendDemo

type SendDemo struct {
	Tag  int32
	Data []byte
}

N_SENDDEMO

func (SendDemo) Marshal

func (s SendDemo) Marshal(p *io.Packet) error

func (SendDemo) Type

func (m SendDemo) Type() MessageCode

func (*SendDemo) Unmarshal

func (s *SendDemo) Unmarshal(p *io.Packet) error

type SendDemoList

type SendDemoList struct {
	Demos []struct {
		Info string
	}
}

N_SENDDEMOLIST

func (SendDemoList) Type

func (m SendDemoList) Type() MessageCode

type SendMap

type SendMap struct {
	Map []byte
}

N_SENDMAP

func (SendMap) Marshal

func (s SendMap) Marshal(p *io.Packet) error

func (SendMap) Type

func (m SendMap) Type() MessageCode

func (*SendMap) Unmarshal

func (s *SendMap) Unmarshal(p *io.Packet) error

type ServCMD

type ServCMD struct {
	Command string
}

N_SERVCMD

func (ServCMD) Type

func (m ServCMD) Type() MessageCode

type ServerInfo

type ServerInfo struct {
	Client      int32
	Protocol    int32
	SessionId   int32
	HasPassword bool
	Description string
	Domain      string
}

N_SERVINFO

func (ServerInfo) Type

func (m ServerInfo) Type() MessageCode

type ServerInitFlags

type ServerInitFlags struct {
	Scores [2]TeamScore
	Flags  []FlagState
}

func (ServerInitFlags) Type

func (m ServerInitFlags) Type() MessageCode

type ServerMessage

type ServerMessage struct {
	Text string
}

N_SERVMSG

func (ServerMessage) Type

func (m ServerMessage) Type() MessageCode

type ServerTakeFlag

type ServerTakeFlag struct {
	Client  int32
	Flag    int32
	Version int32
}

N_TAKEFLAG

func (ServerTakeFlag) Type

func (m ServerTakeFlag) Type() MessageCode

type SetMaster

type SetMaster struct {
	Client   int32
	Master   int32
	Password string
}

N_SETMASTER

func (SetMaster) Type

func (m SetMaster) Type() MessageCode

type SetTeam

type SetTeam struct {
	Client int32
	Team   string
	Reason int32
}

N_SETTEAM

func (SetTeam) Type

func (m SetTeam) Type() MessageCode

type Shoot

type Shoot struct {
	Id   int32
	Gun  int32
	From Vec
	To   Vec
	Hits []Hit
}

N_SHOOT

func (Shoot) Type

func (m Shoot) Type() MessageCode

type ShotFX

type ShotFX struct {
	Client int32
	Gun    int32
	Id     int32
	From   Vec
	To     Vec
}

N_SHOTFX

func (ShotFX) Type

func (m ShotFX) Type() MessageCode

type Sound

type Sound struct {
	Sound int32
}

N_SOUND

func (Sound) Type

func (m Sound) Type() MessageCode

type SpawnRequest

type SpawnRequest struct {
	LifeSequence int32
	GunSelect    int32
}

N_SPAWN <- from client

func (SpawnRequest) Type

func (m SpawnRequest) Type() MessageCode

type SpawnResponse

type SpawnResponse struct {
	EntityState
}

N_SPAWN <- from server

func (SpawnResponse) Type

func (m SpawnResponse) Type() MessageCode

type SpawnState

type SpawnState struct {
	Client int32
	EntityState
}

func (SpawnState) Type

func (m SpawnState) Type() MessageCode

type Spectator

type Spectator struct {
	Client     int32
	Spectating bool
}

N_SPECTATOR

func (Spectator) Type

func (m Spectator) Type() MessageCode

type StealTokens

type StealTokens struct {
	Client    int32
	Team      int32
	Basenum   int32
	Enemyteam int32
	Score     int32
	Dropx     int32
	Dropy     int32
	Dropz     int32
	Tokens    []struct {
		Token int32
		Team  int32
		Yaw   int32
	} `type:"term"`
}

N_STEALTOKENS

func (StealTokens) Type

func (m StealTokens) Type() MessageCode

type StopDemo

type StopDemo struct {
}

N_STOPDEMO

func (StopDemo) Type

func (m StopDemo) Type() MessageCode

type Suicide

type Suicide struct {
}

N_SUICIDE

func (Suicide) Type

func (m Suicide) Type() MessageCode

type SwitchModel

type SwitchModel struct {
	Model int32
}

N_SWITCHMODEL

func (SwitchModel) Type

func (m SwitchModel) Type() MessageCode

type SwitchName

type SwitchName struct {
	Name string
}

N_SWITCHNAME

func (SwitchName) Type

func (m SwitchName) Type() MessageCode

type SwitchTeam

type SwitchTeam struct {
	Team string
}

N_SWITCHTEAM

func (SwitchTeam) Type

func (m SwitchTeam) Type() MessageCode

type TakeToken

type TakeToken struct {
	Client int32
	Token  int32
	Total  int32
}

N_TAKETOKEN

func (TakeToken) Type

func (m TakeToken) Type() MessageCode

type Taunt

type Taunt struct{}

N_TAUNT

func (Taunt) Type

func (m Taunt) Type() MessageCode

type Team

type Team struct {
	Team  string
	Frags int32
}

N_TEAMINFO

type TeamInfo

type TeamInfo struct {
	Teams []Team `type:"term"`
}

func (TeamInfo) Type

func (m TeamInfo) Type() MessageCode

type TeamScore

type TeamScore struct {
	Score int32
}

N_INITFLAGS

type Teleport

type Teleport struct {
	Client      int32
	Source      int32
	Destination int32
}

N_TELEPORT

func (Teleport) Type

func (m Teleport) Type() MessageCode

type Text

type Text struct {
	Text string
}

N_TEXT

func (Text) Type

func (m Text) Type() MessageCode

type TimeUp

type TimeUp struct {
	Remaining int32
}

N_TIMEUP

func (TimeUp) Type

func (m TimeUp) Type() MessageCode

type TokenState

type TokenState struct {
	Token int32
	Team  int32
	Yaw   int32
	X     int32
	Y     int32
	Z     int32
}

N_INITTOKENS

type TryDropFlag

type TryDropFlag struct {
}

N_TRYDROPFLAG

func (TryDropFlag) Type

func (m TryDropFlag) Type() MessageCode

type TrySpawn

type TrySpawn struct {
}

N_TRYSPAWN

func (TrySpawn) Type

func (m TrySpawn) Type() MessageCode

type Undo

type Undo PackData

func (Undo) Type

func (m Undo) Type() MessageCode

type Vec

type Vec struct {
	X float64
	Y float64
	Z float64
}

func (Vec) IsZero

func (v Vec) IsZero() bool

func (*Vec) Magnitude

func (v *Vec) Magnitude() float64

func (Vec) Scale

func (v Vec) Scale(factor float64) Vec

func (*Vec) SquaredLen

func (v *Vec) SquaredLen() float64

type Welcome

type Welcome struct {
}

N_WELCOME

func (Welcome) Type

func (m Welcome) Type() MessageCode

Jump to

Keyboard shortcuts

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