]> git.lizzy.rs Git - mt.git/commitdiff
Add support for DamageEffect in ToCltHP
authorLizzy Fleckenstein <eliasfleckenstein@web.de>
Mon, 6 Feb 2023 16:34:41 +0000 (17:34 +0100)
committerLizzy Fleckenstein <eliasfleckenstein@web.de>
Mon, 6 Feb 2023 16:40:15 +0000 (17:40 +0100)
serialize.go
tocltcmds.go

index 8dc23538dc21de201f2041f65a690a85d64edcc0..a670b2c4b138fef15767ea2885663f9cddf9090e 100644 (file)
@@ -2861,18 +2861,57 @@ func (obj *ToCltHP) Serialize(w io.Writer) {
        {
                x := (*(*(struct {
                        HP uint16
+                       //mt:opt
+                       DamageEffect bool
                }))(obj)).HP
                write16(w, uint16(x))
        }
+       if err := pcall(func() {
+               {
+                       x := (*(*(struct {
+                               HP uint16
+                               //mt:opt
+                               DamageEffect bool
+                       }))(obj)).DamageEffect
+                       if x {
+                               write8(w, 1)
+                       } else {
+                               write8(w, 0)
+                       }
+               }
+       }); err != nil && err != io.EOF {
+               chk(err)
+       }
 }
 
 func (obj *ToCltHP) Deserialize(r io.Reader) {
        {
                p := &(*(*(struct {
                        HP uint16
+                       //mt:opt
+                       DamageEffect bool
                }))(obj)).HP
                *p = read16(r)
        }
+       if err := pcall(func() {
+               {
+                       p := &(*(*(struct {
+                               HP uint16
+                               //mt:opt
+                               DamageEffect bool
+                       }))(obj)).DamageEffect
+                       switch n := read8(r); n {
+                       case 0:
+                               *p = false
+                       case 1:
+                               *p = true
+                       default:
+                               chk(fmt.Errorf("invalid bool: %d", n))
+                       }
+               }
+       }); err != nil && err != io.EOF {
+               chk(err)
+       }
 }
 
 func (obj *ToCltMovePlayer) Serialize(w io.Writer) {
@@ -34979,22 +35018,23 @@ func (obj *ToolCaps) Serialize(w io.Writer) {
                ow := w
                w := new(bytes.Buffer)
                /*
-                  if r.N > 0 { (*(*(struct {
-                       //mt:if _ = %s; false
-                       NonNil  bool
+                       if r.N > 0 { (*(*(struct {
+                               //mt:if _ = %s; false
+                               NonNil  bool
 
-                       AttackCooldown  float32
-                       MaxDropLvl      int16
+                               AttackCooldown  float32
+                               MaxDropLvl      int16
 
-                       //mt:len32
-                       GroupCaps       []ToolGroupCap
+                               //mt:len32
+                               GroupCaps       []ToolGroupCap
 
-                       //mt:len32
-                       DmgGroups       []Group
+                               //mt:len32
+                               DmgGroups       []Group
 
-                       //mt:32tou16
-                       PunchUses       int32
-                  }))(obj)).NonNil = true}; /**/{
+                               //mt:32tou16
+                               PunchUses       int32
+                       }))(obj)).NonNil = true}; /*
+               */{
                        if (*(*(struct {
                                //mt:if _ = %s; false
                                NonNil bool
index 9563bc898dd4dd2fd30982acc3e794fa98d20b48..54ab78853c83df2abd9531d4ad52b042a9d19e9b 100644 (file)
@@ -233,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.