mt

package module
Version: v0.0.0-...-bcc58cb Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 19 Imported by: 3

Documentation

Overview

Package mt implements the high-level Minetest protocol. This version is compatible with Minetest 5.4.1.

Index

Constants

View Source
const (
	MaxLight = 14 // Maximum artificial light.
	SunLight = 15
)

Variables

View Source
var DefaultMinimap = []MinimapMode{
	{Type: NoMinimap},
	{Type: SurfaceMinimap, Size: 256},
	{Type: SurfaceMinimap, Size: 128},
	{Type: SurfaceMinimap, Size: 64},
	{Type: RadarMinimap, Size: 512},
	{Type: RadarMinimap, Size: 256},
	{Type: RadarMinimap, Size: 128},
}

DefaultMinimap is the initial set of MinimapModes used by the client.

View Source
var ErrTooLong = errors.New("len too long")

ErrTooLong reports a length that is too long to serialize.

Functions

func Blkpos2Pos

func Blkpos2Pos(blkpos [3]int16, i uint16) (pos [3]int16)

BlkPos2Pos converts a MapBlk position and index to a node position.

func BuiltinNodeDefs

func BuiltinNodeDefs(n int) map[Content]NodeDef

func Pos2Blkpos

func Pos2Blkpos(pos [3]int16) (blkpos [3]int16, i uint16)

Pos2BlkPos converts a node position to a MapBlk position and index.

Types

type AOAdd

type AOAdd struct {
	ID AOID
	//mt:const genericCAO
	//mt:lenhdr 32
	InitData AOInitData
}

type AOAnim

type AOAnim struct {
	Frames [2]int32
	Speed  float32
	Blend  float32
	NoLoop bool
}

type AOAttach

type AOAttach struct {
	ParentID     AOID
	Bone         string
	Pos          Vec
	Rot          [3]float32
	ForceVisible bool
}

type AOBonePos

type AOBonePos struct {
	Pos Vec
	Rot [3]float32
}

type AOCmdAnim

type AOCmdAnim struct {
	Anim AOAnim
}

type AOCmdAnimSpeed

type AOCmdAnimSpeed struct {
	Speed float32
}

type AOCmdArmorGroups

type AOCmdArmorGroups struct {
	Armor []Group
}

type AOCmdAttach

type AOCmdAttach struct {
	Attach AOAttach
}

type AOCmdBonePos

type AOCmdBonePos struct {
	Bone string
	Pos  AOBonePos
}

type AOCmdHP

type AOCmdHP struct {
	HP uint16
}

type AOCmdPhysOverride

type AOCmdPhysOverride struct {
	Phys AOPhysOverride
}

type AOCmdPos

type AOCmdPos struct {
	Pos AOPos
}

type AOCmdProps

type AOCmdProps struct {
	Props AOProps
}

type AOCmdSpawnInfant

type AOCmdSpawnInfant struct {
	ID AOID
}

type AOCmdSprite

type AOCmdSprite struct {
	Sprite AOSprite
}

type AOCmdTextureMod

type AOCmdTextureMod struct {
	Mod Texture // suffix
}

type AOID

type AOID uint16

type AOInitData

type AOInitData struct {

	// For players.
	Name     string
	IsPlayer bool

	ID AOID

	Pos
	Rot [3]float32

	HP uint16

	// See (de)serialize.fmt.
	Msgs []AOMsg
}

type AOMsg

type AOMsg interface {
	// contains filtered or unexported methods
}

type AOPhysOverride

type AOPhysOverride struct {
	Walk, Jump, Gravity float32

	// Player only.
	NoSneak, NoSneakGlitch, OldSneak bool
}

type AOPos

type AOPos struct {
	Pos
	Vel, Acc Vec
	Rot      [3]float32

	Interpolate    bool
	End            bool
	UpdateInterval float32
}

type AOProps

type AOProps struct {
	MaxHP            uint16 // Player only.
	CollideWithNodes bool
	Weight           float32 // deprecated
	ColBox, SelBox   Box
	Pointable        bool
	Visual           string
	VisualSize       [3]float32
	Textures         []Texture
	SpriteSheetSize  [2]int16 // in sprites.
	SpritePos        [2]int16 // in sprite sheet.
	Visible          bool
	MakeFootstepSnds bool
	RotateSpeed      float32 // in radians per second.
	Mesh             string
	Colors           []color.NRGBA
	CollideWithAOs   bool
	StepHeight       float32
	FaceRotateDir    bool
	FaceRotateDirOff float32 // in degrees.
	BackfaceCull     bool
	Nametag          string
	NametagColor     color.NRGBA
	FaceRotateSpeed  float32 // in degrees per second.
	Infotext         string
	Itemstring       string
	Glow             int8
	MaxBreath        uint16  // Player only.
	EyeHeight        float32 // Player only.
	ZoomFOV          float32 // in degrees. Player only.
	UseTextureAlpha  bool
	DmgTextureMod    Texture // suffix
	Shaded           bool
	ShowOnMinimap    bool
	NametagBG        color.NRGBA
}

type AOSprite

type AOSprite struct {
	Frame0          [2]int16
	Frames          uint16
	FrameDuration   float32
	ViewAngleFrames bool
}

type AlignType

type AlignType uint8
const (
	NoAlign AlignType = iota
	WorldAlign
	UserAlign
)

func (AlignType) String

func (i AlignType) String() string

type AlphaUse

type AlphaUse uint8

AlphaUse specifies how the alpha channel of a texture is used.

const (
	Blend AlphaUse = iota
	Mask           // "Rounded" to either fully opaque or transparent.
	Opaque
	Legacy
)

func (AlphaUse) String

func (i AlphaUse) String() string

type AnimType

type AnimType uint8
const (
	NoAnim            AnimType = iota // none
	VerticalFrameAnim                 // vertical frame
	SpriteSheetAnim                   // sprite sheet

)

func (AnimType) String

func (i AnimType) String() string

type AuthMethods

type AuthMethods uint32
const (
	LegacyPasswd AuthMethods = 1 << iota
	SRP
	FirstSRP
)

func (AuthMethods) String

func (i AuthMethods) String() string

type Box

type Box [2]Vec

type CSMRestrictionFlags

type CSMRestrictionFlags uint64
const (
	NoCSMs CSMRestrictionFlags = 1 << iota
	NoChatMsgs
	NoItemDefs
	NoNodeDefs
	LimitMapRange
	NoPlayerList
)

type ChatMsgType

type ChatMsgType uint8
const (
	RawMsg      ChatMsgType = iota // raw
	NormalMsg                      // normal
	AnnounceMsg                    // announce
	SysMsg                         // sys

)

func (ChatMsgType) String

func (i ChatMsgType) String() string

type Cmd

type Cmd interface {
	DefaultPktInfo() rudp.PktInfo
	// contains filtered or unexported methods
}

type CompressionModes

type CompressionModes uint16

type Content

type Content uint16
const (
	Unknown Content = 125
	Air     Content = 126
	Ignore  Content = 127
)

type DigTime

type DigTime struct {
	Rating int16
	Time   float32
}

type Dir

type Dir uint8

A Dir represents a direction parallel to an axis.

const (
	East  Dir = iota // +X
	Above            // +Y
	North            // +Z
	South            // -Z
	Below            // -Y
	West             // -X
	NoDir
)

func (Dir) Opposite

func (d Dir) Opposite() Dir

Opposite returns the Dir's opposite. NoDir is its own opposite.

func (Dir) String

func (i Dir) String() string

type DirBoxes

type DirBoxes struct {
	Top, Bot                 []Box
	Front, Left, Back, Right []Box
}

type DrawType

type DrawType uint8

A DrawType specifies how a node is drawn.

const (
	DrawCube DrawType = iota
	DrawNothing
	DrawLiquid
	DrawFlowing
	DrawLikeGlass
	DrawAllFaces
	DrawAllFacesOpt
	DrawTorch
	DrawSign
	DrawPlant
	DrawFence
	DrawRail
	DrawNodeBox
	DrawGlassFrame
	DrawFire
	DrawGlassFrameOpt
	DrawMesh
	DrawRootedPlant
)

func (DrawType) String

func (i DrawType) String() string

type Field

type Field struct {
	Name string

	//mt:len32
	Value string
}

type Group

type Group struct {
	Name   string
	Rating int16
}

type HUD

type HUD struct {
	Type HUDType

	Pos      [2]float32
	Name     string
	Scale    [2]float32
	Text     string
	Number   uint32
	Item     uint32
	Dir      uint32
	Align    [2]float32
	Offset   [2]float32
	WorldPos Pos
	Size     [2]int32
	ZIndex   int16
	Text2    string
}

type HUDField

type HUDField uint8
const (
	HUDPos HUDField = iota
	HUDName
	HUDScale
	HUDText
	HUDNumber
	HUDItem
	HUDDir
	HUDAlign
	HUDOffset
	HUDWorldPos
	HUDSize
	HUDZIndex
	HUDText2
)

func (HUDField) String

func (i HUDField) String() string

type HUDFlags

type HUDFlags uint32
const (
	ShowHotbar HUDFlags = 1 << iota
	ShowHealthBar
	ShowCrosshair
	ShowWieldedItem
	ShowBreathBar
	ShowMinimap
	ShowRadarMinimap
)

type HUDID

type HUDID uint32

type HUDType

type HUDType uint8
const (
	ImgHUD HUDType = iota
	TextHUD
	StatbarHUD
	InvHUD
	WaypointHUD
	ImgWaypointHUD
)

func (HUDType) String

func (i HUDType) String() string

type HotbarParam

type HotbarParam uint16
const (
	HotbarSize HotbarParam = 1 + iota
	HotbarImg
	HotbarSelImg
)

func (HotbarParam) String

func (i HotbarParam) String() string

type IDAOMsg

type IDAOMsg struct {
	ID AOID
	//mt:lenhdr 16
	Msg AOMsg
}

type Interaction

type Interaction uint8
const (
	Dig Interaction = iota
	StopDigging
	Dug
	Place
	Use      // Left click snowball-like.
	Activate // Right click air.
)

func (Interaction) String

func (i Interaction) String() string

type Inv

type Inv []NamedInvList

func (*Inv) Deserialize

func (i *Inv) Deserialize(r io.Reader) (err error)

func (Inv) List

func (inv Inv) List(name string) *NamedInvList

func (Inv) Serialize

func (i Inv) Serialize(w io.Writer) error

func (Inv) SerializeKeep

func (i Inv) SerializeKeep(w io.Writer, old Inv) error

type InvList

type InvList struct {
	Width  int
	Stacks []Stack
}

func (*InvList) Deserialize

func (l *InvList) Deserialize(r io.Reader) (err error)

func (InvList) Serialize

func (l InvList) Serialize(w io.Writer) error

func (InvList) SerializeKeep

func (l InvList) SerializeKeep(w io.Writer, old InvList) error

type Item

type Item struct {
	Name string
	Wear uint16
	ItemMeta
}

type ItemDef

type ItemDef struct {
	Type ItemType

	Name, Desc string

	InvImg, WieldImg Texture
	WieldScale       [3]float32

	StackMax uint16

	Usable          bool
	CanPointLiquids bool

	ToolCaps ToolCaps

	Groups []Group

	PlacePredict string

	PlaceSnd, PlaceFailSnd SoundDef

	PointRange float32

	// Set index in Palette with "palette_index" item meta field,
	// this overrides Color.
	Palette Texture
	Color   color.NRGBA

	// Texture overlays.
	InvOverlay, WieldOverlay Texture

	ShortDesc string
}

An ItemDef defines the properties of an item.

type ItemMeta

type ItemMeta string

func NewItemMeta

func NewItemMeta(fields []Field) ItemMeta

func (ItemMeta) Field

func (m ItemMeta) Field(name string) (s string, ok bool)

func (ItemMeta) Fields

func (m ItemMeta) Fields() []Field

func (*ItemMeta) SetField

func (m *ItemMeta) SetField(name, value string)

func (*ItemMeta) SetToolCaps

func (m *ItemMeta) SetToolCaps(tc ToolCaps)

func (ItemMeta) ToolCaps

func (m ItemMeta) ToolCaps() (ToolCaps, bool)

type ItemType

type ItemType uint8
const (
	NodeItem ItemType
	CraftItem
	ToolItem
)

func (ItemType) String

func (i ItemType) String() string

type Keys

type Keys uint32
const (
	ForwardKey Keys = 1 << iota
	BackwardKey
	LeftKey
	RightKey
	JumpKey
	SpecialKey
	SneakKey
	DigKey
	PlaceKey
	ZoomKey
)

type KickReason

type KickReason uint8

A KickReason is the reason a ToCltKick has been sent.

const (
	WrongPasswd KickReason = iota
	UnexpectedData
	SrvIsSingleplayer
	UnsupportedVer
	BadNameChars
	BadName
	TooManyClts
	EmptyPasswd
	AlreadyConnected
	SrvErr
	Custom
	Shutdown
	Crash
)

type LightBank

type LightBank uint8
const (
	Day LightBank = iota
	Night
)

func (LightBank) String

func (i LightBank) String() string

type LiquidType

type LiquidType uint8
const (
	NotALiquid LiquidType = iota
	FlowingLiquid
	LiquidSrc
)

func (LiquidType) String

func (i LiquidType) String() string

type Listener

type Listener struct {
	*rudp.Listener
}

func Listen

func Listen(conn net.PacketConn) Listener

func (Listener) Accept

func (l Listener) Accept() (Peer, error)

type LitFromBlks

type LitFromBlks uint16
const AlwaysLitFrom LitFromBlks = 0xf000

func LitFrom

func LitFrom(d Dir, b LightBank) LitFromBlks

type MapBlk

type MapBlk struct {
	Flags   MapBlkFlags
	LitFrom LitFromBlks

	//mt:zlib
	Param0 [4096]Content
	Param1 [4096]uint8
	Param2 [4096]uint8

	NodeMetas map[uint16]*NodeMeta
}

type MapBlkFlags

type MapBlkFlags uint8
const (
	BlkIsUnderground MapBlkFlags = 1 << iota
	BlkDayNightDiff
	BlkLightExpired
	BlkNotGenerated
)

type MinimapMode

type MinimapMode struct {
	Type  MinimapType
	Label string
	Size  uint16
	Texture
	Scale uint16
}

type MinimapType

type MinimapType uint16
const (
	NoMinimap      MinimapType = iota // none
	SurfaceMinimap                    // surface
	RadarMinimap                      // radar
	TextureMinimap                    // texture
)

func (MinimapType) String

func (i MinimapType) String() string

type ModChanSig

type ModChanSig uint8
const (
	JoinOK ModChanSig = iota
	JoinFail
	LeaveOK
	LeaveFail
	NotRegistered
	SetState
)

func (ModChanSig) String

func (i ModChanSig) String() string

type NamedInvList

type NamedInvList struct {
	Name string
	InvList
}

type Node

type Node struct {
	Param0         Content
	Param1, Param2 uint8
}

type NodeBox

type NodeBox struct {
	Type NodeBoxType

	//mt:if %s.Type == MountedBox
	WallTop, WallBot, WallSides Box

	//mt:if t := %s.Type; t == FixedBox || t == LeveledBox || t == ConnectedBox
	Fixed []Box

	//mt:if %s.Type == ConnectedBox
	ConnDirs, DiscoDirs  DirBoxes
	DiscoAll, DiscoSides []Box
}

type NodeBoxType

type NodeBoxType uint8
const (
	CubeBox      NodeBoxType = iota // Cube
	FixedBox                        // Fixed
	MountedBox                      // Mounted
	LeveledBox                      // Leveled
	ConnectedBox                    // Connected

)

func (NodeBoxType) String

func (i NodeBoxType) String() string

type NodeDef

type NodeDef struct {
	Param0 Content

	Name   string
	Groups []Group

	P1Type   Param1Type
	P2Type   Param2Type
	DrawType DrawType

	Mesh  string
	Scale float32
	//mt:const uint8(6)
	Tiles        [6]TileDef
	OverlayTiles [6]TileDef
	//mt:const uint8(6)
	SpecialTiles [6]TileDef

	Color   color.NRGBA
	Palette Texture

	Waving       WaveType
	ConnectSides uint8
	ConnectTo    []Content
	InsideTint   color.NRGBA
	Level        uint8 // Must be < 128.

	Translucent bool // Sunlight is scattered and becomes normal light.
	Transparent bool // Sunlight isn't scattered.
	LightSrc    uint8

	GndContent   bool
	Collides     bool
	Pointable    bool
	Diggable     bool
	Climbable    bool
	Replaceable  bool
	OnRightClick bool

	DmgPerSec int32

	LiquidType   LiquidType
	FlowingAlt   string
	SrcAlt       string
	Viscosity    uint8 // 0-7
	LiqRenewable bool
	FlowRange    uint8
	DrownDmg     uint8
	Floodable    bool

	DrawBox, ColBox, SelBox NodeBox

	FootstepSnd, DiggingSnd, DugSnd SoundDef

	LegacyFaceDir bool
	LegacyMounted bool

	DigPredict string

	MaxLvl uint8

	AlphaUse
}

type NodeMeta

type NodeMeta struct {
	//mt:len32
	Fields []NodeMetaField

	Inv Inv
}

func (*NodeMeta) Field

func (nm *NodeMeta) Field(name string) *NodeMetaField

type NodeMetaField

type NodeMetaField struct {
	Field
	Private bool
}

type Param1Type

type Param1Type uint8
const (
	P1Nothing Param1Type = iota
	P1Light
)

func (Param1Type) String

func (i Param1Type) String() string

type Param2Type

type Param2Type uint8
const (
	P2Nibble Param2Type = iota
	P2Byte
	P2Flowing
	P2FaceDir
	P2Mounted
	P2Leveled
	P2Rotation
	P2Mesh
	P2Color
	P2ColorFaceDir
	P2ColorMounted
	P2GlassLikeLevel
)

func (Param2Type) String

func (i Param2Type) String() string

type ParticleSpawnerID

type ParticleSpawnerID uint32

type Peer

type Peer struct {
	*rudp.Conn
}

Peer wraps rudp.Conn, adding (de)serialization.

func Connect

func Connect(conn net.Conn) Peer

func (Peer) Recv

func (p Peer) Recv() (_ Pkt, rerr error)

func (Peer) Send

func (p Peer) Send(pkt Pkt) (ack <-chan struct{}, err error)

func (Peer) SendCmd

func (p Peer) SendCmd(cmd Cmd) (ack <-chan struct{}, err error)

SendCmd is equivalent to Send(Pkt{cmd, cmd.DefaultPktInfo()}).

type Pkt

type Pkt struct {
	Cmd
	rudp.PktInfo
}

A Pkt is a deserialized rudp.Pkt.

type PlayerListUpdateType

type PlayerListUpdateType uint8
const (
	InitPlayers   PlayerListUpdateType = iota // init
	AddPlayers                                // add
	RemovePlayers                             // remove
)

func (PlayerListUpdateType) String

func (i PlayerListUpdateType) String() string

type PlayerPos

type PlayerPos struct {
	Pos100, Vel100   [3]int32
	Pitch100, Yaw100 int32
	Keys             Keys
	FOV80            uint8
	WantedRange      uint8 // in MapBlks.
}

func (PlayerPos) FOV

func (p PlayerPos) FOV() float32

func (PlayerPos) Pitch

func (p PlayerPos) Pitch() float32

func (PlayerPos) Pos

func (p PlayerPos) Pos() (pos Pos)

func (*PlayerPos) SetFOV

func (p *PlayerPos) SetFOV(fov float32)

func (*PlayerPos) SetPitch

func (p *PlayerPos) SetPitch(pitch float32)

func (*PlayerPos) SetPos

func (p *PlayerPos) SetPos(pos Pos)

func (*PlayerPos) SetVel

func (p *PlayerPos) SetVel(vel Vec)

func (*PlayerPos) SetYaw

func (p *PlayerPos) SetYaw(yaw float32)

func (PlayerPos) StoodOn

func (p PlayerPos) StoodOn() [3]int16

func (PlayerPos) Vel

func (p PlayerPos) Vel() (vel Vec)

func (PlayerPos) Yaw

func (p PlayerPos) Yaw() float32

type PointedAO

type PointedAO struct {
	ID AOID
}

type PointedNode

type PointedNode struct {
	Under, Above [3]int16
}

type PointedThing

type PointedThing interface {
	// contains filtered or unexported methods
}

func PointedSameNode

func PointedSameNode(pos [3]int16) PointedThing

type Pos

type Pos Vec

A Pos is a world space position, represented as a Vec from the origin.

func IntPos

func IntPos(ip [3]int16) (p Pos)

IntPos returns the Pos of the node at ip.

func (Pos) Add

func (p Pos) Add(v Vec) Pos

Add returns p+v.

func (Pos) From

func (p Pos) From(q Pos) Vec

From returns the Vec which moves to p from q.

func (Pos) Int

func (p Pos) Int() (ip [3]int16)

Int returns the position of the node which the Pos is inside.

func (Pos) Sub

func (p Pos) Sub(v Vec) Pos

Sub returns p-v.

type SoundDef

type SoundDef struct {
	Name              string
	Gain, Pitch, Fade float32
}

type SoundID

type SoundID int32

type SoundSrcType

type SoundSrcType uint8
const (
	NoSrc  SoundSrcType = iota // nowhere
	PosSrc                     // pos
	AOSrc                      // ao
)

func (SoundSrcType) String

func (i SoundSrcType) String() string

type Stack

type Stack struct {
	Item
	Count uint16
}

func (*Stack) Scan

func (stk *Stack) Scan(state fmt.ScanState, verb rune) (err error)

Scan scans a stackstring, implementing the fmt.Scanner interface.

func (Stack) String

func (s Stack) String() string

String returns the Stack's stackstring.

type Texture

type Texture string

type TileAnim

type TileAnim struct {
	Type AnimType

	//mt:if %s.Type == SpriteSheetAnim
	AspectRatio [2]uint8

	//mt:if %s.Type == VerticalFrameAnim
	NFrames [2]uint16

	//mt:if %s.Type != NoAnim
	Duration float32 // in seconds

}

type TileDef

type TileDef struct {
	Texture
	Anim  TileAnim
	Flags TileFlags

	//mt:if %s.Flags&TileColor != 0
	R, G, B uint8

	//mt:if %s.Flags&TileScale != 0
	Scale uint8

	//mt:if %s.Flags&TileAlign != 0
	Align AlignType
}

type TileFlags

type TileFlags uint16
const (
	TileBackfaceCull TileFlags = 1 << iota
	TileAbleH
	TileAbleV
	TileColor
	TileScale
	TileAlign
)

func (TileFlags) String

func (i TileFlags) String() string

type ToCltAOMsgs

type ToCltAOMsgs struct {
	//mt:raw
	Msgs []IDAOMsg
}

ToCltAOMsgs updates the client about nearby AOs.

func (*ToCltAOMsgs) DefaultPktInfo

func (*ToCltAOMsgs) DefaultPktInfo() rudp.PktInfo

type ToCltAORmAdd

type ToCltAORmAdd struct {
	Remove []AOID
	Add    []AOAdd
}

ToCltAORmAdd tells the client that AOs have been removed from and/or added to the AOs that it can see.

func (*ToCltAORmAdd) DefaultPktInfo

func (*ToCltAORmAdd) DefaultPktInfo() rudp.PktInfo

type ToCltAcceptAuth

type ToCltAcceptAuth struct {
	// The client does the equivalent of
	//	PlayerPos[1] -= 5
	// before using PlayerPos.
	PlayerPos Pos

	MapSeed         uint64
	SendInterval    float32
	SudoAuthMethods AuthMethods
}

ToCltAcceptAuth is sent after the client successfully authenticates. The client responds to ToCltAcceptAuth with ToSrvInit2.

func (*ToCltAcceptAuth) DefaultPktInfo

func (*ToCltAcceptAuth) DefaultPktInfo() rudp.PktInfo

type ToCltAcceptSudoMode

type ToCltAcceptSudoMode struct {
	SudoAuthMethods AuthMethods
}

func (*ToCltAcceptSudoMode) DefaultPktInfo

func (*ToCltAcceptSudoMode) DefaultPktInfo() rudp.PktInfo

type ToCltAddHUD

type ToCltAddHUD struct {
	ID HUDID
	HUD
}

ToCltHUDAdd tells the client to add a HUD.

func (*ToCltAddHUD) DefaultPktInfo

func (*ToCltAddHUD) DefaultPktInfo() rudp.PktInfo

type ToCltAddNode

type ToCltAddNode struct {
	Pos [3]int16
	Node
	KeepMeta bool
}

ToCltAddNode tells the client that a nearby node changed to something other than air.

func (*ToCltAddNode) DefaultPktInfo

func (*ToCltAddNode) DefaultPktInfo() rudp.PktInfo

type ToCltAddParticleSpawner

type ToCltAddParticleSpawner struct {
	Amount         uint16
	Duration       float32
	Pos, Vel, Acc  [2][3]float32
	ExpirationTime [2]float32 // in seconds.
	Size           [2]float32
	Collide        bool

	//mt:len32
	Texture

	ID           ParticleSpawnerID
	Vertical     bool
	CollisionRm  bool
	AttachedAOID AOID
	AnimParams   TileAnim
	Glow         uint8
	AOCollision  bool
	NodeParam0   Content
	NodeParam2   uint8
	NodeTile     uint8
}

ToCltAddParticleSpawner tells the client to add a particle spawner.

func (*ToCltAddParticleSpawner) DefaultPktInfo

func (*ToCltAddParticleSpawner) DefaultPktInfo() rudp.PktInfo

type ToCltAddPlayerVel

type ToCltAddPlayerVel struct {
	Vel Vec
}

ToCltAddPlayerVel tells the client to add Vel to the player's velocity.

func (*ToCltAddPlayerVel) DefaultPktInfo

func (*ToCltAddPlayerVel) DefaultPktInfo() rudp.PktInfo

type ToCltAnnounceMedia

type ToCltAnnounceMedia struct {
	Files []struct {
		Name       string
		Base64SHA1 string
	}
	URL string
}

ToCltAnnounceMedia tells the client what media is available on request. See ToSrvReqMedia.

func (*ToCltAnnounceMedia) DefaultPktInfo

func (*ToCltAnnounceMedia) DefaultPktInfo() rudp.PktInfo

type ToCltBlkData

type ToCltBlkData struct {
	Blkpos [3]int16
	Blk    MapBlk
}

ToCltBlkData tells the client the contents of a nearby MapBlk.

func (*ToCltBlkData) DefaultPktInfo

func (*ToCltBlkData) DefaultPktInfo() rudp.PktInfo

type ToCltBreath

type ToCltBreath struct {
	Breath uint16
}

ToCltBreath tells the client how much breath it has.

func (*ToCltBreath) DefaultPktInfo

func (*ToCltBreath) DefaultPktInfo() rudp.PktInfo

type ToCltCSMRestrictionFlags

type ToCltCSMRestrictionFlags struct {
	Flags CSMRestrictionFlags

	// MapRange is the maximum distance from the player CSMs can read the map
	// if Flags&LimitMapRange != 0.
	MapRange uint32
}

ToCltCSMRestrictionFlags tells the client how use of CSMs should be restricted.

func (*ToCltCSMRestrictionFlags) DefaultPktInfo

func (*ToCltCSMRestrictionFlags) DefaultPktInfo() rudp.PktInfo

type ToCltChangeHUD

type ToCltChangeHUD struct {
	ID HUDID

	Field HUDField

	//mt:if %s.Field == HUDPos
	Pos [2]float32

	//mt:if %s.Field == HUDName
	Name string

	//mt:if %s.Field == HUDScale
	Scale [2]float32

	//mt:if %s.Field == HUDText
	Text string

	//mt:if %s.Field == HUDNumber
	Number uint32

	//mt:if %s.Field == HUDItem
	Item uint32

	//mt:if %s.Field == HUDDir
	Dir uint32

	//mt:if %s.Field == HUDAlign
	Align [2]float32

	//mt:if %s.Field == HUDOffset
	Offset [2]float32

	//mt:if %s.Field == HUDWorldPos
	WorldPos Pos

	//mt:if %s.Field == HUDSize
	Size [2]int32

	//mt:if %s.Field == HUDZIndex
	ZIndex int32

	//mt:if %s.Field == HUDText2
	Text2 string
}

ToCltChangeHUD tells the client to change a field in a HUD.

func (*ToCltChangeHUD) DefaultPktInfo

func (*ToCltChangeHUD) DefaultPktInfo() rudp.PktInfo

type ToCltChatMsg

type ToCltChatMsg struct {
	Type ChatMsgType

	//mt:utf16
	Sender, Text string

	Timestamp int64 // Unix time.
}

ToCltChatMsg tells the client that is has received a chat message.

func (*ToCltChatMsg) DefaultPktInfo

func (*ToCltChatMsg) DefaultPktInfo() rudp.PktInfo

type ToCltCloudParams

type ToCltCloudParams struct {
	Density      float32
	DiffuseColor color.NRGBA
	AmbientColor color.NRGBA
	Height       float32
	Thickness    float32
	Speed        [2]float32
}

ToCltCloudParams tells the client how to render the clouds.

func (*ToCltCloudParams) DefaultPktInfo

func (*ToCltCloudParams) DefaultPktInfo() rudp.PktInfo

type ToCltCmd

type ToCltCmd interface {
	Cmd
	// contains filtered or unexported methods
}

type ToCltDeathScreen

type ToCltDeathScreen struct {
	PointCam bool
	PointAt  Pos
}

ToCltDeathScreen tells the client to show the death screen.

func (*ToCltDeathScreen) DefaultPktInfo

func (*ToCltDeathScreen) DefaultPktInfo() rudp.PktInfo

type ToCltDelParticleSpawner

type ToCltDelParticleSpawner struct {
	ID ParticleSpawnerID
}

ToCltDelParticleSpawner tells the client to delete a particle spawner.

func (*ToCltDelParticleSpawner) DefaultPktInfo

func (*ToCltDelParticleSpawner) DefaultPktInfo() rudp.PktInfo

type ToCltDenySudoMode

type ToCltDenySudoMode struct{}

func (*ToCltDenySudoMode) DefaultPktInfo

func (*ToCltDenySudoMode) DefaultPktInfo() rudp.PktInfo

type ToCltDetachedInv

type ToCltDetachedInv struct {
	Name string
	Keep bool
	Len  uint16 // deprecated

	//mt:raw
	Inv string
}

ToCltDetachedInv updates a detached inventory on the client.

func (*ToCltDetachedInv) DefaultPktInfo

func (*ToCltDetachedInv) DefaultPktInfo() rudp.PktInfo

type ToCltDisco

type ToCltDisco struct{}

func (*ToCltDisco) DefaultPktInfo

func (*ToCltDisco) DefaultPktInfo() rudp.PktInfo

type ToCltEyeOffset

type ToCltEyeOffset struct {
	First, Third Vec
}

ToCltEyeOffset tells the client where to position the camera relative to the player.

func (*ToCltEyeOffset) DefaultPktInfo

func (*ToCltEyeOffset) DefaultPktInfo() rudp.PktInfo

type ToCltFOV

type ToCltFOV struct {
	FOV            float32
	Multiplier     bool
	TransitionTime float32
}

ToCltFOV tells the client to change its FOV.

func (*ToCltFOV) DefaultPktInfo

func (*ToCltFOV) DefaultPktInfo() rudp.PktInfo

type ToCltFadeSound

type ToCltFadeSound struct {
	ID   SoundID
	Step float32
	Gain float32
}

ToCltFadeSound tells the client to fade a sound.

func (*ToCltFadeSound) DefaultPktInfo

func (*ToCltFadeSound) DefaultPktInfo() rudp.PktInfo

type ToCltFormspecPrepend

type ToCltFormspecPrepend struct {
	Prepend string
}

ToCltFormspecPrepend tells the client to prepend a string to all formspecs.

func (*ToCltFormspecPrepend) DefaultPktInfo

func (*ToCltFormspecPrepend) DefaultPktInfo() rudp.PktInfo

type ToCltHP

type ToCltHP struct {
	HP uint16
}

ToCltHP updates the player's HP on the client.

func (*ToCltHP) DefaultPktInfo

func (*ToCltHP) DefaultPktInfo() rudp.PktInfo

type ToCltHUDFlags

type ToCltHUDFlags struct {
	// &^= Mask
	// |= Flags
	Flags, Mask HUDFlags
}

ToCltHUDFlags tells the client to update its HUD flags.

func (*ToCltHUDFlags) DefaultPktInfo

func (*ToCltHUDFlags) DefaultPktInfo() rudp.PktInfo

type ToCltHello

type ToCltHello struct {
	SerializeVer uint8
	Compression  CompressionModes
	ProtoVer     uint16
	AuthMethods
	Username string
}

ToCltHello is sent as a response to ToSrvInit. The client responds to ToCltHello by authenticating.

func (*ToCltHello) DefaultPktInfo

func (*ToCltHello) DefaultPktInfo() rudp.PktInfo

type ToCltInv

type ToCltInv struct {
	//mt:raw
	Inv string
}

ToCltInv updates the client's inventory.

func (*ToCltInv) DefaultPktInfo

func (*ToCltInv) DefaultPktInfo() rudp.PktInfo

type ToCltInvFormspec

type ToCltInvFormspec struct {
	//mt:len32
	Formspec string
}

ToCltInvFormspec tells the client its inventory formspec.

func (*ToCltInvFormspec) DefaultPktInfo

func (*ToCltInvFormspec) DefaultPktInfo() rudp.PktInfo

type ToCltItemDefs

type ToCltItemDefs struct {
	Defs    []ItemDef
	Aliases []struct{ Alias, Orig string }
}

ToCltItemDefs tells the client the definitions of items.

func (*ToCltItemDefs) DefaultPktInfo

func (*ToCltItemDefs) DefaultPktInfo() rudp.PktInfo

type ToCltKick

type ToCltKick struct {
	Reason KickReason

	//mt:if dr := %s.Reason; dr == Custom || dr == Shutdown || dr == Crash
	Custom string

	//mt:if dr := %s.Reason; dr == Shutdown || dr == Crash
	Reconnect bool
}

ToCltKick tells that the client that it has been kicked by the server.

func (*ToCltKick) DefaultPktInfo

func (*ToCltKick) DefaultPktInfo() rudp.PktInfo

func (ToCltKick) String

func (cmd ToCltKick) String() (msg string)

type ToCltLegacyKick

type ToCltLegacyKick struct {
	//mt:utf16
	Reason string
}

func (*ToCltLegacyKick) DefaultPktInfo

func (*ToCltLegacyKick) DefaultPktInfo() rudp.PktInfo

type ToCltLocalPlayerAnim

type ToCltLocalPlayerAnim struct {
	Idle, Walk, Dig, WalkDig [2]int32
	Speed                    float32
}

ToCltLocalPlayerAnim tells the client how to animate the player.

func (*ToCltLocalPlayerAnim) DefaultPktInfo

func (*ToCltLocalPlayerAnim) DefaultPktInfo() rudp.PktInfo

type ToCltMedia

type ToCltMedia struct {
	// N is the total number of ToCltMedia packets.
	// I is the index of this packet.
	N, I uint16

	//mt:len32
	Files []struct {
		Name string

		//mt:len32
		Data []byte
	}
}

ToCltMedia responds to a ToSrvMedia packet with the requested media files.

func (*ToCltMedia) DefaultPktInfo

func (*ToCltMedia) DefaultPktInfo() rudp.PktInfo

type ToCltMediaPush

type ToCltMediaPush struct {
	//mt:const uint16(sha1.Size)
	SHA1        [sha1.Size]byte
	Filename    string
	ShouldCache bool

	//mt:len32
	Data []byte
}

ToCltMediaPush is sent when a media file is dynamically added.

func (*ToCltMediaPush) DefaultPktInfo

func (*ToCltMediaPush) DefaultPktInfo() rudp.PktInfo

type ToCltMinimapModes

type ToCltMinimapModes struct {
	Current uint16
	Modes   []MinimapMode
}

ToCltMinimapModes tells the client the set of available minimap modes.

func (*ToCltMinimapModes) DefaultPktInfo

func (*ToCltMinimapModes) DefaultPktInfo() rudp.PktInfo

type ToCltModChanMsg

type ToCltModChanMsg struct {
	Channel string
	Sender  string
	Msg     string
}

ToCltModChanMsg tells the client it has been sent a message on a mod channel.

func (*ToCltModChanMsg) DefaultPktInfo

func (*ToCltModChanMsg) DefaultPktInfo() rudp.PktInfo

type ToCltModChanSig

type ToCltModChanSig struct {
	Signal  ModChanSig
	Channel string
}

ToCltModChanMsg tells the client it has received a signal on a mod channel.

func (*ToCltModChanSig) DefaultPktInfo

func (*ToCltModChanSig) DefaultPktInfo() rudp.PktInfo

type ToCltMoonParams

type ToCltMoonParams struct {
	Visible bool
	Texture
	ToneMap Texture
	Size    float32
}

ToCltMoonParams tells the client how to render the moon.

func (*ToCltMoonParams) DefaultPktInfo

func (*ToCltMoonParams) DefaultPktInfo() rudp.PktInfo

type ToCltMovePlayer

type ToCltMovePlayer struct {
	Pos
	Pitch, Yaw float32
}

ToCltMovePlayer tells the client that the player has been moved server-side.

func (*ToCltMovePlayer) DefaultPktInfo

func (*ToCltMovePlayer) DefaultPktInfo() rudp.PktInfo

type ToCltMovement

type ToCltMovement struct {
	DefaultAccel, AirAccel, FastAccel,
	WalkSpeed, CrouchSpeed, FastSpeed, ClimbSpeed, JumpSpeed,
	Fluidity, Smoothing, Sink,
	Gravity float32
}

ToCltMovement tells the client how to move.

func (*ToCltMovement) DefaultPktInfo

func (*ToCltMovement) DefaultPktInfo() rudp.PktInfo

type ToCltNodeDefs

type ToCltNodeDefs struct {

	// See (de)serialize.fmt.
	Defs []NodeDef
}

ToCltNodeDefs tells the client the definitions of nodes.

func (*ToCltNodeDefs) DefaultPktInfo

func (*ToCltNodeDefs) DefaultPktInfo() rudp.PktInfo

type ToCltNodeMetasChanged

type ToCltNodeMetasChanged struct {
	//mt:lenhdr 32
	Changed map[[3]int16]*NodeMeta
}

ToCltModChanMsg is sent when node metadata near the client changes.

func (*ToCltNodeMetasChanged) DefaultPktInfo

func (*ToCltNodeMetasChanged) DefaultPktInfo() rudp.PktInfo

type ToCltOverrideDayNightRatio

type ToCltOverrideDayNightRatio struct {
	Override bool
	Ratio    uint16
}

ToCltOverrideDayNightRatio overrides the client's day-night ratio

func (*ToCltOverrideDayNightRatio) DefaultPktInfo

func (*ToCltOverrideDayNightRatio) DefaultPktInfo() rudp.PktInfo

type ToCltPlaySound

type ToCltPlaySound struct {
	ID      SoundID
	Name    string
	Gain    float32
	SrcType SoundSrcType
	Pos
	SrcAOID   AOID
	Loop      bool
	Fade      float32
	Pitch     float32
	Ephemeral bool
}

ToCltPlaySound tells the client to play a sound.

func (*ToCltPlaySound) DefaultPktInfo

func (*ToCltPlaySound) DefaultPktInfo() rudp.PktInfo

type ToCltPrivs

type ToCltPrivs struct {
	Privs []string
}

ToCltPrivs tells the client its privs.

func (*ToCltPrivs) DefaultPktInfo

func (*ToCltPrivs) DefaultPktInfo() rudp.PktInfo

type ToCltRemoveNode

type ToCltRemoveNode struct {
	Pos [3]int16
}

ToCltRemoveNode tells the client that a nearby node changed to air.

func (*ToCltRemoveNode) DefaultPktInfo

func (*ToCltRemoveNode) DefaultPktInfo() rudp.PktInfo

type ToCltRmHUD

type ToCltRmHUD struct {
	ID HUDID
}

ToCltRmHUD tells the client to remove a HUD.

func (*ToCltRmHUD) DefaultPktInfo

func (*ToCltRmHUD) DefaultPktInfo() rudp.PktInfo

type ToCltSRPBytesSaltB

type ToCltSRPBytesSaltB struct {
	Salt, B []byte
}

func (*ToCltSRPBytesSaltB) DefaultPktInfo

func (*ToCltSRPBytesSaltB) DefaultPktInfo() rudp.PktInfo

type ToCltSetHotbarParam

type ToCltSetHotbarParam struct {
	Param HotbarParam

	//mt:if %s.Param == HotbarSize
	//mt:const uint16(4) // Size of Size field.
	Size int32

	//mt:if %s.Param != HotbarSize
	Img Texture
}

ToCltSetHotbarParam tells the client to set a hotbar parameter.

func (*ToCltSetHotbarParam) DefaultPktInfo

func (*ToCltSetHotbarParam) DefaultPktInfo() rudp.PktInfo

type ToCltShowFormspec

type ToCltShowFormspec struct {
	//mt:len32
	Formspec string

	Formname string
}

ToCltShowFormspec tells the client to show a formspec.

func (*ToCltShowFormspec) DefaultPktInfo

func (*ToCltShowFormspec) DefaultPktInfo() rudp.PktInfo

type ToCltSkyParams

type ToCltSkyParams struct {
	BgColor     color.NRGBA
	Type        string
	Clouds      bool
	SunFogTint  color.NRGBA
	MoonFogTint color.NRGBA
	FogTintType string

	//mt:if %s.Type == "skybox"
	Textures []Texture

	//mt:if %s.Type == "regular"
	DaySky, DayHorizon,
	DawnSky, DawnHorizon,
	NightSky, NightHorizon,
	Indoor color.NRGBA
}

ToCltSkyParams tells the client how to render the sky.

func (*ToCltSkyParams) DefaultPktInfo

func (*ToCltSkyParams) DefaultPktInfo() rudp.PktInfo

type ToCltSpawnParticle

type ToCltSpawnParticle struct {
	Pos, Vel, Acc  [3]float32
	ExpirationTime float32 // in seconds.
	Size           float32
	Collide        bool

	//mt:len32
	Texture

	Vertical    bool
	CollisionRm bool
	AnimParams  TileAnim
	Glow        uint8
	AOCollision bool
	NodeParam0  Content
	NodeParam2  uint8
	NodeTile    uint8
}

ToCltSpawnParticle tells the client to spawn a particle.

func (*ToCltSpawnParticle) DefaultPktInfo

func (*ToCltSpawnParticle) DefaultPktInfo() rudp.PktInfo

type ToCltStarParams

type ToCltStarParams struct {
	Visible bool
	Count   uint32
	Color   color.NRGBA
	Size    float32
}

ToCltStarParams tells the client how to render the stars.

func (*ToCltStarParams) DefaultPktInfo

func (*ToCltStarParams) DefaultPktInfo() rudp.PktInfo

type ToCltStopSound

type ToCltStopSound struct {
	ID SoundID
}

ToCltStopSound tells the client to stop playing a sound.

func (*ToCltStopSound) DefaultPktInfo

func (*ToCltStopSound) DefaultPktInfo() rudp.PktInfo

type ToCltSunParams

type ToCltSunParams struct {
	Visible bool
	Texture
	ToneMap Texture
	Rise    Texture
	Rising  bool
	Size    float32
}

ToCltSunParams tells the client how to render the sun.

func (*ToCltSunParams) DefaultPktInfo

func (*ToCltSunParams) DefaultPktInfo() rudp.PktInfo

type ToCltTimeOfDay

type ToCltTimeOfDay struct {
	Time  uint16  // %24000
	Speed float32 // Speed times faster than real time
}

ToCltTimeOfDay updates the client's in-game time of day.

func (*ToCltTimeOfDay) DefaultPktInfo

func (*ToCltTimeOfDay) DefaultPktInfo() rudp.PktInfo

type ToCltUpdatePlayerList

type ToCltUpdatePlayerList struct {
	Type    PlayerListUpdateType
	Players []string
}

ToCltUpdatePlayerList informs the client of players leaving or joining.

func (*ToCltUpdatePlayerList) DefaultPktInfo

func (*ToCltUpdatePlayerList) DefaultPktInfo() rudp.PktInfo

type ToSrvChatMsg

type ToSrvChatMsg struct {
	//mt:utf16
	Msg string
}

ToSrvChatMsg tells the server that the client has sent a chat message.

func (*ToSrvChatMsg) DefaultPktInfo

func (*ToSrvChatMsg) DefaultPktInfo() rudp.PktInfo

type ToSrvCltReady

type ToSrvCltReady struct {
	// Version information.
	Major, Minor, Patch uint8
	Reserved            uint8
	Version             string
	Formspec            uint16
}

func (*ToSrvCltReady) DefaultPktInfo

func (*ToSrvCltReady) DefaultPktInfo() rudp.PktInfo

type ToSrvCmd

type ToSrvCmd interface {
	Cmd
	// contains filtered or unexported methods
}

type ToSrvDeletedBlks

type ToSrvDeletedBlks struct {
	//mt:len8
	Blks [][3]int16
}

ToSrvDeletedBlks tells the server that the client has deleted Blks.

func (*ToSrvDeletedBlks) DefaultPktInfo

func (*ToSrvDeletedBlks) DefaultPktInfo() rudp.PktInfo

type ToSrvDisco

type ToSrvDisco struct{}

func (*ToSrvDisco) DefaultPktInfo

func (*ToSrvDisco) DefaultPktInfo() rudp.PktInfo

type ToSrvFallDmg

type ToSrvFallDmg struct {
	Amount uint16
}

ToSrvFallDmg tells the server that the client has taken fall damage.

func (*ToSrvFallDmg) DefaultPktInfo

func (*ToSrvFallDmg) DefaultPktInfo() rudp.PktInfo

type ToSrvFirstSRP

type ToSrvFirstSRP struct {
	Salt        []byte
	Verifier    []byte
	EmptyPasswd bool
}

func (*ToSrvFirstSRP) DefaultPktInfo

func (*ToSrvFirstSRP) DefaultPktInfo() rudp.PktInfo

type ToSrvGotBlks

type ToSrvGotBlks struct {
	//mt:len8
	Blks [][3]int16
}

ToSrvGotBlks tells the server that the client has received Blks.

func (*ToSrvGotBlks) DefaultPktInfo

func (*ToSrvGotBlks) DefaultPktInfo() rudp.PktInfo

type ToSrvInit

type ToSrvInit struct {
	SerializeVer             uint8
	SupportedCompression     CompressionModes
	MinProtoVer, MaxProtoVer uint16
	PlayerName               string

	//mt:opt
	SendFullItemMeta bool
}

ToSrvInit is sent as unreliable after ToSrvNil and is re-sent repeatedly until either the server replies with ToCltHello or 10 seconds pass and the connection times out.

func (*ToSrvInit) DefaultPktInfo

func (*ToSrvInit) DefaultPktInfo() rudp.PktInfo

type ToSrvInit2

type ToSrvInit2 struct {
	Lang string
}

ToSrvInit2 is sent after ToCltAcceptAuth is received. The server responds to ToSrvInit2 by sending ToCltItemDefs, ToCltNodeDefs, ToCltAnnounceMedia, ToCltMovement and ToCltCSMRestrictionFlags.

func (*ToSrvInit2) DefaultPktInfo

func (*ToSrvInit2) DefaultPktInfo() rudp.PktInfo

type ToSrvInteract

type ToSrvInteract struct {
	Action   Interaction
	ItemSlot uint16
	//mt:lenhdr 32
	Pointed PointedThing
	//mt:end
	Pos PlayerPos
}

ToSrvInteract tells the server that a node or AO has been interacted with.

func (*ToSrvInteract) DefaultPktInfo

func (*ToSrvInteract) DefaultPktInfo() rudp.PktInfo

type ToSrvInvAction

type ToSrvInvAction struct {
	//mt:raw
	Action string
}

ToSrvInvAction tells the server that the client has performed an inventory action.

func (*ToSrvInvAction) DefaultPktInfo

func (*ToSrvInvAction) DefaultPktInfo() rudp.PktInfo

type ToSrvInvFields

type ToSrvInvFields struct {
	Formname string
	Fields   []Field
}

func (*ToSrvInvFields) DefaultPktInfo

func (*ToSrvInvFields) DefaultPktInfo() rudp.PktInfo

type ToSrvJoinModChan

type ToSrvJoinModChan struct {
	Channel string
}

ToSrvJoinModChan attempts to join a mod channel.

func (*ToSrvJoinModChan) DefaultPktInfo

func (*ToSrvJoinModChan) DefaultPktInfo() rudp.PktInfo

type ToSrvLeaveModChan

type ToSrvLeaveModChan struct {
	Channel string
}

ToSrvLeaveModChan attempts to leave a mod channel.

func (*ToSrvLeaveModChan) DefaultPktInfo

func (*ToSrvLeaveModChan) DefaultPktInfo() rudp.PktInfo

type ToSrvMsgModChan

type ToSrvMsgModChan struct {
	Channel string
	Msg     string
}

ToSrvMsgModChan sends a message on a mod channel.

func (*ToSrvMsgModChan) DefaultPktInfo

func (*ToSrvMsgModChan) DefaultPktInfo() rudp.PktInfo

type ToSrvNil

type ToSrvNil struct{}

ToSrvNil is the first packet sent in a connection.

func (*ToSrvNil) DefaultPktInfo

func (*ToSrvNil) DefaultPktInfo() rudp.PktInfo

type ToSrvNodeMetaFields

type ToSrvNodeMetaFields struct {
	Pos      [3]int16
	Formname string
	Fields   []Field
}

func (*ToSrvNodeMetaFields) DefaultPktInfo

func (*ToSrvNodeMetaFields) DefaultPktInfo() rudp.PktInfo

type ToSrvPlayerPos

type ToSrvPlayerPos struct {
	Pos PlayerPos
}

ToSrvPlayerPos tells the server that the client's PlayerPos has changed.

func (*ToSrvPlayerPos) DefaultPktInfo

func (*ToSrvPlayerPos) DefaultPktInfo() rudp.PktInfo

type ToSrvRemovedSounds

type ToSrvRemovedSounds struct {
	IDs []SoundID
}

ToSrvRemovedSounds tells the server that the client has finished playing the sounds with the given IDs.

func (*ToSrvRemovedSounds) DefaultPktInfo

func (*ToSrvRemovedSounds) DefaultPktInfo() rudp.PktInfo

type ToSrvReqMedia

type ToSrvReqMedia struct {
	Filenames []string
}

ToSrvReqMedia requests media files from the server.

func (*ToSrvReqMedia) DefaultPktInfo

func (*ToSrvReqMedia) DefaultPktInfo() rudp.PktInfo

type ToSrvRespawn

type ToSrvRespawn struct{}

ToSrvRespawn tells the server that the player has respawned.

func (*ToSrvRespawn) DefaultPktInfo

func (*ToSrvRespawn) DefaultPktInfo() rudp.PktInfo

type ToSrvSRPBytesA

type ToSrvSRPBytesA struct {
	A      []byte
	NoSHA1 bool
}

func (*ToSrvSRPBytesA) DefaultPktInfo

func (*ToSrvSRPBytesA) DefaultPktInfo() rudp.PktInfo

type ToSrvSRPBytesM

type ToSrvSRPBytesM struct {
	M []byte
}

func (*ToSrvSRPBytesM) DefaultPktInfo

func (*ToSrvSRPBytesM) DefaultPktInfo() rudp.PktInfo

type ToSrvSelectItem

type ToSrvSelectItem struct {
	Slot uint16
}

ToSrvSelectItem tells the server the selected item in the client's hotbar.

func (*ToSrvSelectItem) DefaultPktInfo

func (*ToSrvSelectItem) DefaultPktInfo() rudp.PktInfo

type ToolCaps

type ToolCaps struct {
	//mt:if _ = %s; false
	NonNil bool

	AttackCooldown float32
	MaxDropLvl     int16

	//mt:len32
	GroupCaps []ToolGroupCap

	//mt:len32
	DmgGroups []Group

	//mt:32tou16
	PunchUses int32
}

func (ToolCaps) DigTime

func (tc ToolCaps) DigTime(groups map[string]int16) (time.Duration, bool)

func (ToolCaps) MarshalJSON

func (tc ToolCaps) MarshalJSON() ([]byte, error)

func (ToolCaps) String

func (tc ToolCaps) String() string

func (*ToolCaps) UnmarshalJSON

func (tc *ToolCaps) UnmarshalJSON(data []byte) error

type ToolGroupCap

type ToolGroupCap struct {
	Name string

	//mt:32to16
	Uses int32

	MaxLvl int16

	//mt:len32
	Times []DigTime
}

type Vec

type Vec [3]float32

A Vec is a 3D vector in units of 0.1 nodes.

func (Vec) Add

func (v Vec) Add(w Vec) Vec

Add returns v+w.

func (Vec) Sub

func (v Vec) Sub(w Vec) Vec

Sub returns v-w.

type WaveType

type WaveType uint8
const (
	NotWaving    WaveType = iota
	PlantWaving           // Only top waves from side to side.
	LeafWaving            // Wave side to side.
	LiquidWaving          // Wave up and down.
)

func (WaveType) String

func (i WaveType) String() string

Notes

Bugs

  • Stackstrings use variant of JSON called WTF-JSON where \u00XX escapes in string literals act like Go's \xXX escapes. This should not be fixed because it would break existing items.

Directories

Path Synopsis
cmd
proxy
Proxy is a Minetest proxy server supporting multiple concurrent connections.
Proxy is a Minetest proxy server supporting multiple concurrent connections.
Package rudp implements the low-level Minetest protocol described at https://dev.minetest.net/Network_Protocol#Low-level_protocol.
Package rudp implements the low-level Minetest protocol described at https://dev.minetest.net/Network_Protocol#Low-level_protocol.
cmd/proxy
Proxy is a Minetest RUDP proxy server supporting multiple concurrent connections.
Proxy is a Minetest RUDP proxy server supporting multiple concurrent connections.

Jump to

Keyboard shortcuts

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