3 import "github.com/anon55555/mt/rudp"
5 type ToSrvCmd interface {
10 //go:generate ./cmdno.sh tosrvcmds ToSrv toSrv uint16 Cmd newToSrvCmd
12 // ToSrvNil is the first packet sent in a connection.
13 type ToSrvNil struct{}
15 // ToSrvInit is sent as unreliable after ToSrvNil and is re-sent repeatedly
16 // until either the server replies with ToCltHello or 10 seconds pass and
17 // the connection times out.
18 type ToSrvInit struct {
20 SupportedCompression CompressionModes
21 MinProtoVer, MaxProtoVer uint16
28 // ToSrvInit2 is sent after ToCltAcceptAuth is received.
29 // The server responds to ToSrvInit2 by sending ToCltItemDefs, ToCltNodeDefs,
30 // ToCltAnnounceMedia, ToCltMovement and ToCltCSMRestrictionFlags.
31 type ToSrvInit2 struct {
35 // ToSrvJoinModChan attempts to join a mod channel.
36 type ToSrvJoinModChan struct {
40 // ToSrvLeaveModChan attempts to leave a mod channel.
41 type ToSrvLeaveModChan struct {
45 // ToSrvMsgModChan sends a message on a mod channel.
46 type ToSrvMsgModChan struct {
51 // ToSrvPlayerPos tells the server that the client's PlayerPos has changed.
52 type ToSrvPlayerPos struct {
56 // ToSrvGotBlks tells the server that the client has received Blks.
57 type ToSrvGotBlks struct {
62 // ToSrvHaveMedia tells the server that the client has received the media.
63 type ToSrvHaveMedia struct {
68 // ToSrvDeletedBlks tells the server that the client has deleted Blks.
69 type ToSrvDeletedBlks struct {
74 // ToSrvInvAction tells the server that the client has performed an inventory action.
75 type ToSrvInvAction struct {
80 // ToSrvChatMsg tells the server that the client has sent a chat message.
81 type ToSrvChatMsg struct {
86 // ToSrvFallDmg tells the server that the client has taken fall damage.
87 type ToSrvFallDmg struct {
91 // ToSrvSelectItem tells the server the selected item in the client's hotbar.
92 type ToSrvSelectItem struct {
96 // ToSrvRespawn tells the server that the player has respawned.
97 type ToSrvRespawn struct{}
99 // ToSrvInteract tells the server that a node or AO has been interacted with.
100 type ToSrvInteract struct {
109 type Interaction uint8
112 Dig Interaction = iota
116 Use // Left click snowball-like.
117 Activate // Right click air.
120 //go:generate stringer -type Interaction
122 // ToSrvRemovedSounds tells the server that the client has finished playing
123 // the sounds with the given IDs.
124 type ToSrvRemovedSounds struct {
128 type ToSrvNodeMetaFields struct {
134 type ToSrvInvFields struct {
139 // ToSrvReqMedia requests media files from the server.
140 type ToSrvReqMedia struct {
144 type ToSrvCltReady struct {
145 // Version information.
146 Major, Minor, Patch uint8
152 type ToSrvFirstSRP struct {
158 type ToSrvSRPBytesA struct {
163 type ToSrvSRPBytesM struct {
167 type ToSrvDisco struct{}
169 func (*ToSrvDisco) cmd() {}
170 func (*ToSrvDisco) toSrvCmdNo() uint16 { return 0xffff }
171 func (*ToSrvDisco) DefaultPktInfo() rudp.PktInfo { return rudp.PktInfo{} }