bot

package
v1.0.303 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MoveMask       = 1 << 4
	MaxMessageSize = 1390
	LightLevel     = 150
)

Variables

This section is empty.

Functions

func ClientStringCommand added in v1.0.298

func ClientStringCommand(s string) message.Buffer

func ClientUserMessage added in v1.0.298

func ClientUserMessage(ui string) message.Buffer

Marshal a c2s userinfo update message

Types

type Bot

type Bot struct {
	Net        Connection
	User       pl.Userinfo
	Version    string
	Netchan    NetChan
	Spawned    bool
	AckPending bool
	Debug      bool

	FrameNum int

	Aliases map[string]string
	CVars   map[string]string
	Cmds    map[string]func(*Bot, Cmd)
	// contains filtered or unexported fields
}

func (*Bot) AddClientString added in v1.0.298

func (b *Bot) AddClientString(format string, args ...any)

Add a client string to the bot's outgoing message buffer. This is how strings are sent from the bot to the server.

func (*Bot) BuildUserCommand added in v1.0.298

func (b *Bot) BuildUserCommand() message.Buffer

func (*Bot) ClientCommand

func (bot *Bot) ClientCommand(str string, reliable bool) error

func (*Bot) OutPending

func (bot *Bot) OutPending() bool

is there anything that needs to be sent?

func (*Bot) Receive

func (bot *Bot) Receive() (int, error)

func (*Bot) RegisterCallback added in v1.0.233

func (b *Bot) RegisterCallback(index int, dofunc func(any, *message.Buffer))

func (*Bot) ReliablePending

func (bot *Bot) ReliablePending() bool

was a recently received msg reliable and needs an ack?

func (*Bot) ResolveString added in v1.0.298

func (b *Bot) ResolveString(s string) string

Replace any variables and aliases with their substitutions. Aliases are not recursive.

func (*Bot) Run

func (bot *Bot) Run() error

func (*Bot) Send

func (bot *Bot) Send() error

func (*Bot) SendAck

func (bot *Bot) SendAck() error

Any sequence sent with reliable bit set (0x800000)

func (*Bot) UnregisterCallback added in v1.0.233

func (b *Bot) UnregisterCallback(index int)

type Connection

type Connection struct {
	Address   string
	Port      int
	Conn      net.Conn
	Challenge *pb.Challenge
}

type NetChan

type NetChan struct {
	QPort        int
	Sequence1    int
	Sequence2    int
	ReliableS1   bool
	ReliableS2   bool
	LastReliable int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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