2024-06-22 05:15:25 +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:15:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type InputTiming struct {
|
|
|
|
ChunkHeader *chunk7.ChunkHeader
|
|
|
|
|
|
|
|
IntendedPredTick int
|
|
|
|
TimeLeft int
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) MsgId() int {
|
2024-06-22 05:15:25 +00:00
|
|
|
return network7.MsgSysInputTiming
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) MsgType() network7.MsgType {
|
2024-06-22 05:15:25 +00:00
|
|
|
return network7.TypeNet
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) System() bool {
|
2024-06-22 05:15:25 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) Vital() bool {
|
2024-06-22 05:15:25 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) Pack() []byte {
|
2024-06-22 05:15:25 +00:00
|
|
|
return slices.Concat(
|
|
|
|
packer.PackInt(msg.IntendedPredTick),
|
|
|
|
packer.PackInt(msg.TimeLeft),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *InputTiming) Unpack(u *packer.Unpacker) error {
|
2024-06-22 05:15:25 +00:00
|
|
|
msg.IntendedPredTick = u.GetInt()
|
|
|
|
msg.TimeLeft = u.GetInt()
|
2024-06-23 19:18:54 +00:00
|
|
|
return nil
|
2024-06-22 05:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *InputTiming) Header() *chunk7.ChunkHeader {
|
|
|
|
return msg.ChunkHeader
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *InputTiming) SetHeader(header *chunk7.ChunkHeader) {
|
|
|
|
msg.ChunkHeader = header
|
|
|
|
}
|