]> git.lizzy.rs Git - mt.git/blobdiff - tocltcmds.go
Add WaitGroup to SerializePkt
[mt.git] / tocltcmds.go
index 37d7bed084469ea4203f030d0a79bcf3bb7fa349..54ab78853c83df2abd9531d4ad52b042a9d19e9b 100644 (file)
@@ -6,7 +6,7 @@ import (
        "io"
        "math"
 
-       "github.com/Minetest-j45/mt/rudp"
+       "github.com/dragonfireclient/mt/rudp"
 )
 
 type ToCltCmd interface {
@@ -122,7 +122,9 @@ func (cmd ToCltKick) String() (msg string) {
 // ToCltBlkData tells the client the contents of a nearby MapBlk.
 type ToCltBlkData struct {
        Blkpos [3]int16
-       Blk    MapBlk
+       //mt:zstd
+       Blk MapBlk
+       //mt:end
 }
 
 // ToCltAddNode tells the client that a nearby node changed
@@ -231,6 +233,8 @@ type ToCltAOMsgs struct {
 // ToCltHP updates the player's HP on the client.
 type ToCltHP struct {
        HP uint16
+       //mt:opt
+       DamageEffect bool
 }
 
 // ToCltMovePlayer tells the client that the player has been moved server-side.
@@ -429,6 +433,7 @@ type HUD struct {
        Size     [2]int32
        ZIndex   int16
        Text2    string
+       Style    HUDStyleFlags
 }
 
 type HUDID uint32
@@ -516,6 +521,10 @@ type ToCltChangeHUD struct {
        //mt:if %s.Field == HUDText2
        Text2 string
        //mt:end
+
+       //mt:if %s.Field == HUDStyle
+       Style HUDStyleFlags
+       //mt:end
 }
 
 type HUDField uint8
@@ -534,11 +543,22 @@ const (
        HUDSize
        HUDZIndex
        HUDText2
+       HUDStyle
        hudMax
 )
 
 //go:generate stringer -trimprefix HUD -type HUDField
 
+type HUDStyleFlags uint32
+
+const (
+       StyleBold HUDStyleFlags = 1 << iota
+       StyleItalic
+       StyleMono
+)
+
+//go:generate stringer -trimprefix Style -type HUDStyleFlags
+
 // ToCltHUDFlags tells the client to update its HUD flags.
 type ToCltHUDFlags struct {
        // &^= Mask
@@ -740,7 +760,7 @@ type ToCltMinimapModes struct {
 
 var _ serializer = (*ToCltMinimapModes)(nil)
 
-func (cmd *ToCltMinimapModes) serialize(w io.Writer) {
+func (cmd *ToCltMinimapModes) Serialize(w io.Writer) {
        buf := make([]byte, 4)
        if len(cmd.Modes) > math.MaxUint16 {
                chk(ErrTooLong)
@@ -756,7 +776,7 @@ func (cmd *ToCltMinimapModes) serialize(w io.Writer) {
 
 var _ deserializer = (*ToCltMinimapModes)(nil)
 
-func (cmd *ToCltMinimapModes) deserialize(r io.Reader) {
+func (cmd *ToCltMinimapModes) Deserialize(r io.Reader) {
        buf := make([]byte, 4)
        _, err := io.ReadFull(r, buf)
        chk(err)