Documentation
¶
Overview ¶
Package mt implements the high-level Minetest protocol. This version is compatible with Minetest 5.4.1.
Index ¶
- Constants
- Variables
- func Blkpos2Pos(blkpos [3]int16, i uint16) (pos [3]int16)
- func BuiltinNodeDefs(n int) map[Content]NodeDef
- func Pos2Blkpos(pos [3]int16) (blkpos [3]int16, i uint16)
- type AOAdd
- type AOAnim
- type AOAttach
- type AOBonePos
- type AOCmdAnim
- type AOCmdAnimSpeed
- type AOCmdArmorGroups
- type AOCmdAttach
- type AOCmdBonePos
- type AOCmdHP
- type AOCmdPhysOverride
- type AOCmdPos
- type AOCmdProps
- type AOCmdSpawnInfant
- type AOCmdSprite
- type AOCmdTextureMod
- type AOID
- type AOInitData
- type AOMsg
- type AOPhysOverride
- type AOPos
- type AOProps
- type AOSprite
- type AlignType
- type AlphaUse
- type AnimType
- type AuthMethods
- type Box
- type CSMRestrictionFlags
- type ChatMsgType
- type Cmd
- type CompressionModes
- type Content
- type DigTime
- type Dir
- type DirBoxes
- type DrawType
- type Field
- type Group
- type HUD
- type HUDField
- type HUDFlags
- type HUDID
- type HUDType
- type HotbarParam
- type IDAOMsg
- type Interaction
- type Inv
- type InvList
- type Item
- type ItemDef
- type ItemMeta
- type ItemType
- type Keys
- type KickReason
- type LightBank
- type LiquidType
- type Listener
- type LitFromBlks
- type MapBlk
- type MapBlkFlags
- type MinimapMode
- type MinimapType
- type ModChanSig
- type NamedInvList
- type Node
- type NodeBox
- type NodeBoxType
- type NodeDef
- type NodeMeta
- type NodeMetaField
- type Param1Type
- type Param2Type
- type ParticleSpawnerID
- type Peer
- type Pkt
- type PlayerListUpdateType
- type PlayerPos
- func (p PlayerPos) FOV() float32
- func (p PlayerPos) Pitch() float32
- func (p PlayerPos) Pos() (pos Pos)
- func (p *PlayerPos) SetFOV(fov float32)
- func (p *PlayerPos) SetPitch(pitch float32)
- func (p *PlayerPos) SetPos(pos Pos)
- func (p *PlayerPos) SetVel(vel Vec)
- func (p *PlayerPos) SetYaw(yaw float32)
- func (p PlayerPos) StoodOn() [3]int16
- func (p PlayerPos) Vel() (vel Vec)
- func (p PlayerPos) Yaw() float32
- type PointedAO
- type PointedNode
- type PointedThing
- type Pos
- type SoundDef
- type SoundID
- type SoundSrcType
- type Stack
- type Texture
- type TileAnim
- type TileDef
- type TileFlags
- type ToCltAOMsgs
- type ToCltAORmAdd
- type ToCltAcceptAuth
- type ToCltAcceptSudoMode
- type ToCltAddHUD
- type ToCltAddNode
- type ToCltAddParticleSpawner
- type ToCltAddPlayerVel
- type ToCltAnnounceMedia
- type ToCltBlkData
- type ToCltBreath
- type ToCltCSMRestrictionFlags
- type ToCltChangeHUD
- type ToCltChatMsg
- type ToCltCloudParams
- type ToCltCmd
- type ToCltDeathScreen
- type ToCltDelParticleSpawner
- type ToCltDenySudoMode
- type ToCltDetachedInv
- type ToCltDisco
- type ToCltEyeOffset
- type ToCltFOV
- type ToCltFadeSound
- type ToCltFormspecPrepend
- type ToCltHP
- type ToCltHUDFlags
- type ToCltHello
- type ToCltInv
- type ToCltInvFormspec
- type ToCltItemDefs
- type ToCltKick
- type ToCltLegacyKick
- type ToCltLocalPlayerAnim
- type ToCltMedia
- type ToCltMediaPush
- type ToCltMinimapModes
- type ToCltModChanMsg
- type ToCltModChanSig
- type ToCltMoonParams
- type ToCltMovePlayer
- type ToCltMovement
- type ToCltNodeDefs
- type ToCltNodeMetasChanged
- type ToCltOverrideDayNightRatio
- type ToCltPlaySound
- type ToCltPrivs
- type ToCltRemoveNode
- type ToCltRmHUD
- type ToCltSRPBytesSaltB
- type ToCltSetHotbarParam
- type ToCltShowFormspec
- type ToCltSkyParams
- type ToCltSpawnParticle
- type ToCltStarParams
- type ToCltStopSound
- type ToCltSunParams
- type ToCltTimeOfDay
- type ToCltUpdatePlayerList
- type ToSrvChatMsg
- type ToSrvCltReady
- type ToSrvCmd
- type ToSrvDeletedBlks
- type ToSrvDisco
- type ToSrvFallDmg
- type ToSrvFirstSRP
- type ToSrvGotBlks
- type ToSrvInit
- type ToSrvInit2
- type ToSrvInteract
- type ToSrvInvAction
- type ToSrvInvFields
- type ToSrvJoinModChan
- type ToSrvLeaveModChan
- type ToSrvMsgModChan
- type ToSrvNil
- type ToSrvNodeMetaFields
- type ToSrvPlayerPos
- type ToSrvRemovedSounds
- type ToSrvReqMedia
- type ToSrvRespawn
- type ToSrvSRPBytesA
- type ToSrvSRPBytesM
- type ToSrvSelectItem
- type ToolCaps
- type ToolGroupCap
- type Vec
- type WaveType
- Bugs
Constants ¶
const ( MaxLight = 14 // Maximum artificial light. SunLight = 15 )
Variables ¶
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.
var ErrTooLong = errors.New("len too long")
ErrTooLong reports a length that is too long to serialize.
Functions ¶
func Blkpos2Pos ¶
BlkPos2Pos converts a MapBlk position and index to a node position.
func BuiltinNodeDefs ¶
func Pos2Blkpos ¶
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 AOCmdAnimSpeed ¶
type AOCmdAnimSpeed struct {
Speed float32
}
type AOCmdArmorGroups ¶
type AOCmdArmorGroups struct {
Armor []Group
}
type AOCmdAttach ¶
type AOCmdAttach struct {
Attach AOAttach
}
type AOCmdBonePos ¶
type AOCmdPhysOverride ¶
type AOCmdPhysOverride struct {
Phys AOPhysOverride
}
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 AOInitData ¶
type AOPhysOverride ¶
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 AuthMethods ¶
type AuthMethods uint32
const ( LegacyPasswd AuthMethods = 1 << iota SRP FirstSRP )
func (AuthMethods) String ¶
func (i AuthMethods) String() string
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 CompressionModes ¶
type CompressionModes uint16
type Dir ¶
type Dir uint8
A Dir represents a direction parallel to an axis.
type HotbarParam ¶
type HotbarParam uint16
const ( HotbarSize HotbarParam = 1 + iota HotbarImg HotbarSelImg )
func (HotbarParam) String ¶
func (i HotbarParam) String() string
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 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 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 LiquidType ¶
type LiquidType uint8
const ( NotALiquid LiquidType = iota FlowingLiquid LiquidSrc )
func (LiquidType) String ¶
func (i LiquidType) String() string
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 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 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 PlayerListUpdateType ¶
type PlayerListUpdateType uint8
const ( InitPlayers PlayerListUpdateType = iota // init AddPlayers // add RemovePlayers // remove )
func (PlayerListUpdateType) String ¶
func (i PlayerListUpdateType) String() string
type PlayerPos ¶
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.
type SoundSrcType ¶
type SoundSrcType uint8
const ( NoSrc SoundSrcType = iota // nowhere PosSrc // pos AOSrc // ao )
func (SoundSrcType) String ¶
func (i SoundSrcType) 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 ¶
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 ¶
ToCltHUDAdd tells the client to add a HUD.
func (*ToCltAddHUD) DefaultPktInfo ¶
func (*ToCltAddHUD) DefaultPktInfo() rudp.PktInfo
type ToCltAddNode ¶
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 ¶
ToCltAnnounceMedia tells the client what media is available on request. See ToSrvReqMedia.
func (*ToCltAnnounceMedia) DefaultPktInfo ¶
func (*ToCltAnnounceMedia) DefaultPktInfo() rudp.PktInfo
type ToCltBlkData ¶
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 ToCltDeathScreen ¶
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 ¶
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 ToCltFadeSound ¶
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 ¶
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 ¶
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 ¶
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 ¶
type ToCltLegacyKick ¶
type ToCltLegacyKick struct {
//mt:utf16
Reason string
}
func (*ToCltLegacyKick) DefaultPktInfo ¶
func (*ToCltLegacyKick) DefaultPktInfo() rudp.PktInfo
type ToCltLocalPlayerAnim ¶
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 ¶
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 ¶
ToCltMoonParams tells the client how to render the moon.
func (*ToCltMoonParams) DefaultPktInfo ¶
func (*ToCltMoonParams) DefaultPktInfo() rudp.PktInfo
type ToCltMovePlayer ¶
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 ¶
ToCltModChanMsg is sent when node metadata near the client changes.
func (*ToCltNodeMetasChanged) DefaultPktInfo ¶
func (*ToCltNodeMetasChanged) DefaultPktInfo() rudp.PktInfo
type ToCltOverrideDayNightRatio ¶
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 ¶
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 ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
type ToSrvNodeMetaFields ¶
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 ¶
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) MarshalJSON ¶
func (*ToolCaps) UnmarshalJSON ¶
type ToolGroupCap ¶
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.
Source Files
¶
- aligntype_string.go
- alphause_string.go
- animtype_string.go
- ao.go
- aocmds_cmdno.go
- auth.go
- authmethods_string.go
- bytereader.go
- chatmsgtype_string.go
- cmd.go
- cmds.go
- compression.go
- dir.go
- dir_string.go
- drawtype_string.go
- hotbarparam_string.go
- hudfield_string.go
- hudtype_string.go
- interaction_string.go
- inv.go
- itemdef.go
- itemmeta.go
- itemtype_string.go
- light.go
- lightbank_string.go
- liquidtype_string.go
- mapblk.go
- minimap.go
- minimaptype_string.go
- modchansig_string.go
- mt.go
- nodebox.go
- nodeboxtype_string.go
- nodedef.go
- nodemeta.go
- param1type_string.go
- param2type_string.go
- pktinfos.go
- playerlistupdatetype_string.go
- playerpos.go
- pointedthing.go
- pos.go
- proto.go
- readrune.go
- serialize.go
- sound.go
- soundsrctype_string.go
- stack.go
- texture.go
- tileanim.go
- tiledef.go
- tileflags_string.go
- tocltcmds.go
- tocltcmds_cmdno.go
- toolcaps.go
- toolcaps_json.go
- tosrvcmds.go
- tosrvcmds_cmdno.go
- vec.go
- wavetype_string.go
- zerialize.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
proxy
command
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
command
Proxy is a Minetest RUDP proxy server supporting multiple concurrent connections.
|
Proxy is a Minetest RUDP proxy server supporting multiple concurrent connections. |