2024-06-22 05:07:47 +00:00
|
|
|
package messages7
|
|
|
|
|
|
|
|
import (
|
|
|
|
"slices"
|
|
|
|
|
2024-06-22 05:59:27 +00:00
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
|
2024-06-22 05:07:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type SnapEmpty struct {
|
|
|
|
ChunkHeader *chunk7.ChunkHeader
|
|
|
|
|
|
|
|
GameTick int
|
|
|
|
DeltaTick int
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) MsgId() int {
|
2024-06-22 05:07:47 +00:00
|
|
|
return network7.MsgSysSnapEmpty
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) MsgType() network7.MsgType {
|
2024-06-22 05:07:47 +00:00
|
|
|
return network7.TypeNet
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) System() bool {
|
2024-06-22 05:07:47 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) Vital() bool {
|
2024-06-22 05:07:47 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) Pack() []byte {
|
2024-06-22 05:07:47 +00:00
|
|
|
return slices.Concat(
|
|
|
|
packer.PackInt(msg.GameTick),
|
|
|
|
packer.PackInt(msg.DeltaTick),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *SnapEmpty) Unpack(u *packer.Unpacker) error {
|
2024-06-22 05:07:47 +00:00
|
|
|
msg.GameTick = u.GetInt()
|
|
|
|
msg.DeltaTick = u.GetInt()
|
2024-06-23 19:18:54 +00:00
|
|
|
return nil
|
2024-06-22 05:07:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *SnapEmpty) Header() *chunk7.ChunkHeader {
|
|
|
|
return msg.ChunkHeader
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *SnapEmpty) SetHeader(header *chunk7.ChunkHeader) {
|
|
|
|
msg.ChunkHeader = header
|
|
|
|
}
|