package mt
import (
- "crypto/sha1"
"fmt"
"image/color"
"io"
"math"
+
+ "github.com/Minetest-j45/mt/rudp"
)
type ToCltCmd interface {
SudoAuthMethods AuthMethods
}
-type ToCltAcceptSudoMode struct{}
+type ToCltAcceptSudoMode struct {
+ SudoAuthMethods AuthMethods
+ //mt:const [15]byte{}
+}
type ToCltDenySudoMode struct{}
-// ToCltDisco tells that the client that it has been disconnected by the server.
-type ToCltDisco struct {
- Reason DiscoReason
- //mt:assert %s.Reason < maxDiscoReason
+// ToCltKick tells that the client that it has been kicked by the server.
+type ToCltKick struct {
+ Reason KickReason
+ //mt:assert %s.Reason < maxKickReason
//mt:if dr := %s.Reason; dr == Custom || dr == Shutdown || dr == Crash
Custom string
//mt:end
}
-type DiscoReason uint8
+// A KickReason is the reason a ToCltKick has been sent.
+type KickReason uint8
const (
- WrongPasswd DiscoReason = iota
+ WrongPasswd KickReason = iota
UnexpectedData
SrvIsSingleplayer
UnsupportedVer
Custom
Shutdown
Crash
- maxDiscoReason
+ maxKickReason
)
-func (cmd ToCltDisco) String() (msg string) {
+func (cmd ToCltKick) String() (msg string) {
switch cmd.Reason {
case WrongPasswd:
return "wrong password"
case Crash:
msg = "server crash"
default:
- msg = fmt.Sprintf("DiscoReason(%d)", cmd.Reason)
+ msg = fmt.Sprintf("KickReason(%d)", cmd.Reason)
}
if cmd.Custom != "" {
// ToCltMediaPush is sent when a media file is dynamically added.
type ToCltMediaPush struct {
- //mt:const uint16(sha1.Size)
- SHA1 [sha1.Size]byte
- Filename string
- ShouldCache bool
-
- //mt:len32
- Data []byte
+ RawHash string
+ Filename string
+ CallbackToken uint32
+ ShouldCache bool
}
// ToCltChatMsg tells the client that is has received a chat message.
// the AOs that it can see.
type ToCltAORmAdd struct {
Remove []AOID
- Add []struct {
- ID AOID
- //mt:const genericCAO
- //mt:lenhdr 32
- InitData AOInitData
- //mt:end
- }
+ Add []AOAdd
+}
+
+type AOAdd struct {
+ ID AOID
+ //mt:const genericCAO
+ //mt:lenhdr 32
+ InitData AOInitData
+ //mt:end
}
// ToCltAOMsgs updates the client about nearby AOs.
Pitch, Yaw float32
}
-type ToCltDiscoLegacy struct {
+type ToCltLegacyKick struct {
//mt:utf16
Reason string
}
NodeTile uint8
}
-type HUDID uint32
-
-// ToCltHUDAdd tells the client to add a HUD.
-type ToCltAddHUD struct {
- ID HUDID
-
+type HUD struct {
Type HUDType
Pos [2]float32
Text2 string
}
+type HUDID uint32
+
+// ToCltHUDAdd tells the client to add a HUD.
+type ToCltAddHUD struct {
+ ID HUDID
+ HUD
+}
+
type HUDType uint8
const (
//mt:end
//mt:if %s.Field == HUDZIndex
- ZIndex uint32
+ ZIndex int32
//mt:end
//mt:if %s.Field == HUDText2
chk(deserialize(r, &cmd.Modes[i]))
}
}
+
+type ToCltDisco struct{}
+
+func (*ToCltDisco) cmd() {}
+func (*ToCltDisco) toCltCmdNo() uint16 { return 0xffff }
+func (*ToCltDisco) DefaultPktInfo() rudp.PktInfo { return rudp.PktInfo{} }