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 // ToSrvDeletedBlks tells the server that the client has deleted Blks.
63 type ToSrvDeletedBlks struct {
68 // ToSrvInvAction tells the server that the client has performed an inventory action.
69 type ToSrvInvAction struct {
74 // ToSrvChatMsg tells the server that the client has sent a chat message.
75 type ToSrvChatMsg struct {
80 // ToSrvFallDmg tells the server that the client has taken fall damage.
81 type ToSrvFallDmg struct {
85 // ToSrvSelectItem tells the server the selected item in the client's hotbar.
86 type ToSrvSelectItem struct {
90 // ToSrvRespawn tells the server that the player has respawned.
91 type ToSrvRespawn struct{}
93 // ToSrvInteract tells the server that a node or AO has been interacted with.
94 type ToSrvInteract struct {
103 type Interaction uint8
106 Dig Interaction = iota
110 Use // Left click snowball-like.
111 Activate // Right click air.
114 //go:generate stringer -type Interaction
116 // ToSrvRemovedSounds tells the server that the client has finished playing
117 // the sounds with the given IDs.
118 type ToSrvRemovedSounds struct {
122 type ToSrvNodeMetaFields struct {
128 type ToSrvInvFields struct {
133 // ToSrvReqMedia requests media files from the server.
134 type ToSrvReqMedia struct {
138 type ToSrvCltReady struct {
139 // Version information.
140 Major, Minor, Patch uint8
146 type ToSrvFirstSRP struct {
152 type ToSrvSRPBytesA struct {
157 type ToSrvSRPBytesM struct {
161 type ToSrvDisco struct{}
163 func (*ToSrvDisco) cmd() {}
164 func (*ToSrvDisco) toSrvCmdNo() uint16 { return 0xffff }
165 func (*ToSrvDisco) DefaultPktInfo() rudp.PktInfo { return rudp.PktInfo{} }