fix(go): repair migration wire contracts and runtime lifecycle; document incomplete port
This commit is contained in:
1 parent
e43a310617
commit
32e47014b5
35 files changed
+16826
-438
No files matched your search
@@ -0,0 +1,54 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"ananta-ps/pkg/protocol"
|
||||
)
|
||||
|
||||
// Both movement RPCs carry a List7Bit of inline structs. LogicAgentSyncData
|
||||
// has no MoveId; SimpleMoveActionData adds one byte after the two vectors.
|
||||
func (s *Server) handleMovementReport(sess *Session, pkt *protocol.RpcPacket, simple bool) error {
|
||||
r := protocol.NewUxReader(pkt.Body)
|
||||
mark, err := r.U8()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if mark == 0 && r.Remaining() == 0 {
|
||||
return sess.ReturnEmptyOk(pkt.InvokeID, pkt.MethodID)
|
||||
}
|
||||
if mark != 0xff {
|
||||
return fmt.Errorf("invalid movement list marker")
|
||||
}
|
||||
count, err := r.Int7()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
size := 32
|
||||
if simple {
|
||||
size++
|
||||
}
|
||||
if count > r.Remaining()/size || count*size != r.Remaining() {
|
||||
return fmt.Errorf("invalid movement sample count")
|
||||
}
|
||||
x, y, z, yaw := sess.posX, sess.posY, sess.posZ, sess.facing
|
||||
for i := 0; i < count; i++ {
|
||||
id, _ := r.U64()
|
||||
var v [6]float32
|
||||
for j := range v {
|
||||
v[j], err = r.F32()
|
||||
if err != nil || math.IsNaN(float64(v[j])) || math.IsInf(float64(v[j]), 0) {
|
||||
return fmt.Errorf("invalid movement coordinate")
|
||||
}
|
||||
}
|
||||
if simple {
|
||||
_, _ = r.U8()
|
||||
}
|
||||
if id == sess.unitId {
|
||||
x, y, z, yaw = v[0], v[1], v[2], v[4]
|
||||
}
|
||||
}
|
||||
sess.posX, sess.posY, sess.posZ, sess.facing = x, y, z, yaw
|
||||
return sess.ReturnEmptyOk(pkt.InvokeID, pkt.MethodID)
|
||||
}
|
||||
Reference in new issue
Block a user