Merge pull request #1 from mdiluz/day-night-cycle
Add a day-night cycle for solar charging
This commit is contained in:
commit
df30a0d689
9 changed files with 154 additions and 70 deletions
|
@ -14,7 +14,8 @@ func (s *Server) ServerStatus(context.Context, *rove.ServerStatusRequest) (*rove
|
|||
response := &rove.ServerStatusResponse{
|
||||
Ready: true,
|
||||
Version: version.Version,
|
||||
Tick: int32(s.tick),
|
||||
TickRate: int32(s.minutesPerTick),
|
||||
CurrentTick: int32(s.world.CurrentTicks),
|
||||
}
|
||||
|
||||
// TODO: Verify the accountant is up and ready too
|
||||
|
|
|
@ -38,7 +38,7 @@ type Server struct {
|
|||
// Config settings
|
||||
address string
|
||||
persistence int
|
||||
tick int
|
||||
minutesPerTick int
|
||||
|
||||
// sync point for sub-threads
|
||||
sync sync.WaitGroup
|
||||
|
@ -68,7 +68,7 @@ func OptionPersistentData() ServerOption {
|
|||
// 0 means no automatic server tick
|
||||
func OptionTick(minutes int) ServerOption {
|
||||
return func(s *Server) {
|
||||
s.tick = minutes
|
||||
s.minutesPerTick = minutes
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ func (s *Server) Run() {
|
|||
defer s.sync.Done()
|
||||
|
||||
// Set up the schedule if requested
|
||||
if s.tick != 0 {
|
||||
if err := s.schedule.AddFunc(fmt.Sprintf("0 */%d * * *", s.tick), func() {
|
||||
if s.minutesPerTick != 0 {
|
||||
if err := s.schedule.AddFunc(fmt.Sprintf("0 */%d * * *", s.minutesPerTick), func() {
|
||||
// Ensure we don't quit during this function
|
||||
s.sync.Add(1)
|
||||
defer s.sync.Done()
|
||||
|
|
|
@ -175,7 +175,8 @@ func InnerMain(command string, args ...string) error {
|
|||
default:
|
||||
fmt.Printf("Ready: %t\n", response.Ready)
|
||||
fmt.Printf("Version: %s\n", response.Version)
|
||||
fmt.Printf("Tick: %d\n", response.Tick)
|
||||
fmt.Printf("Tick Rate: %d\n", response.TickRate)
|
||||
fmt.Printf("Current Tick: %d\n", response.CurrentTick)
|
||||
fmt.Printf("Next Tick: %s\n", response.NextTick)
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ services:
|
|||
- PORT=9090
|
||||
- DATA_PATH=/mnt/rove-server
|
||||
- WORDS_FILE=data/words_alpha.txt
|
||||
- TICK_RATE=5
|
||||
volumes:
|
||||
- persistent-data:/mnt/rove-server:rw
|
||||
command: [ "./rove-server"]
|
||||
|
|
|
@ -37,6 +37,12 @@ type World struct {
|
|||
|
||||
// Set of possible words to use for names
|
||||
words []string
|
||||
|
||||
// TicksPerDay is the amount of ticks in a single day
|
||||
TicksPerDay int `json:"ticks-per-day"`
|
||||
|
||||
// Current number of ticks from the start
|
||||
CurrentTicks int `json:"current-ticks"`
|
||||
}
|
||||
|
||||
var wordsFile = os.Getenv("WORDS_FILE")
|
||||
|
@ -65,6 +71,8 @@ func NewWorld(chunkSize int) *World {
|
|||
CommandIncoming: make(map[string]CommandStream),
|
||||
Atlas: atlas.NewAtlas(chunkSize),
|
||||
words: lines,
|
||||
TicksPerDay: 24,
|
||||
CurrentTicks: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,6 +152,11 @@ func (w *World) RoverRecharge(rover string) (int, error) {
|
|||
return 0, fmt.Errorf("Failed to find rover with name: %s", rover)
|
||||
}
|
||||
|
||||
// We can only recharge during the day
|
||||
if !w.Daytime() {
|
||||
return i.Charge, nil
|
||||
}
|
||||
|
||||
// Add one charge
|
||||
if i.Charge < i.MaximumCharge {
|
||||
i.Charge++
|
||||
|
@ -436,6 +449,9 @@ func (w *World) ExecuteCommandQueues() {
|
|||
|
||||
// Add any incoming commands from this tick and clear that queue
|
||||
w.EnqueueAllIncoming()
|
||||
|
||||
// Increment the current tick count
|
||||
w.CurrentTicks++
|
||||
}
|
||||
|
||||
// ExecuteCommand will execute a single command
|
||||
|
@ -478,6 +494,13 @@ func (w *World) ExecuteCommand(c *Command, rover string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// Daytime returns if it's currently daytime
|
||||
// for simplicity this uses the 1st half of the day as daytime, the 2nd half as nighttime
|
||||
func (w *World) Daytime() bool {
|
||||
tickInDay := w.CurrentTicks % w.TicksPerDay
|
||||
return tickInDay < w.TicksPerDay/2
|
||||
}
|
||||
|
||||
// RLock read locks the world
|
||||
func (w *World) RLock() {
|
||||
w.worldMutex.RLock()
|
||||
|
|
|
@ -313,3 +313,42 @@ func TestWorld_Charge(t *testing.T) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func TestWorld_Daytime(t *testing.T) {
|
||||
world := NewWorld(1)
|
||||
|
||||
a, err := world.SpawnRover()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Remove rover charge
|
||||
rover := world.Rovers[a]
|
||||
rover.Charge = 0
|
||||
world.Rovers[a] = rover
|
||||
|
||||
// Try and recharge, should work
|
||||
_, err = world.RoverRecharge(a)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, world.Rovers[a].Charge)
|
||||
|
||||
// Loop for half the day
|
||||
for i := 0; i < world.TicksPerDay/2; i++ {
|
||||
assert.True(t, world.Daytime())
|
||||
world.ExecuteCommandQueues()
|
||||
}
|
||||
|
||||
// Remove rover charge again
|
||||
rover = world.Rovers[a]
|
||||
rover.Charge = 0
|
||||
world.Rovers[a] = rover
|
||||
|
||||
// Try and recharge, should fail
|
||||
_, err = world.RoverRecharge(a)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 0, world.Rovers[a].Charge)
|
||||
|
||||
// Loop for half the day
|
||||
for i := 0; i < world.TicksPerDay/2; i++ {
|
||||
assert.False(t, world.Daytime())
|
||||
world.ExecuteCommandQueues()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -670,14 +670,16 @@ type ServerStatusResponse struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The time the next tick will occur
|
||||
NextTick string `protobuf:"bytes,1,opt,name=next_tick,json=nextTick,proto3" json:"next_tick,omitempty"`
|
||||
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
||||
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// Whether the server is ready to accept requests
|
||||
Ready bool `protobuf:"varint,2,opt,name=ready,proto3" json:"ready,omitempty"`
|
||||
// The tick rate of the server in minutes (how many minutes per tick)
|
||||
Tick int32 `protobuf:"varint,3,opt,name=tick,proto3" json:"tick,omitempty"`
|
||||
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
||||
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
|
||||
TickRate int32 `protobuf:"varint,3,opt,name=tickRate,proto3" json:"tickRate,omitempty"`
|
||||
// The current tick of the server
|
||||
CurrentTick int32 `protobuf:"varint,4,opt,name=currentTick,proto3" json:"currentTick,omitempty"`
|
||||
// The time the next tick will occur
|
||||
NextTick string `protobuf:"bytes,5,opt,name=next_tick,json=nextTick,proto3" json:"next_tick,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ServerStatusResponse) Reset() {
|
||||
|
@ -712,9 +714,9 @@ func (*ServerStatusResponse) Descriptor() ([]byte, []int) {
|
|||
return file_rove_rove_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *ServerStatusResponse) GetNextTick() string {
|
||||
func (x *ServerStatusResponse) GetVersion() string {
|
||||
if x != nil {
|
||||
return x.NextTick
|
||||
return x.Version
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -726,16 +728,23 @@ func (x *ServerStatusResponse) GetReady() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (x *ServerStatusResponse) GetTick() int32 {
|
||||
func (x *ServerStatusResponse) GetTickRate() int32 {
|
||||
if x != nil {
|
||||
return x.Tick
|
||||
return x.TickRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ServerStatusResponse) GetVersion() string {
|
||||
func (x *ServerStatusResponse) GetCurrentTick() int32 {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
return x.CurrentTick
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ServerStatusResponse) GetNextTick() string {
|
||||
if x != nil {
|
||||
return x.NextTick
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -855,45 +864,47 @@ var file_rove_rove_proto_rawDesc = []byte{
|
|||
0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
|
||||
0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22,
|
||||
0x15, 0x0a, 0x13, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x77, 0x0a, 0x14, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b,
|
||||
0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x72,
|
||||
0x65, 0x61, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64,
|
||||
0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x04, 0x74, 0x69, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22,
|
||||
0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x01, 0x79, 0x32, 0x91, 0x03, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x5d,
|
||||
0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19,
|
||||
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a,
|
||||
0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e,
|
||||
0x22, 0x09, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4b,
|
||||
0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08,
|
||||
0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52,
|
||||
0x61, 0x64, 0x61, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61,
|
||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e,
|
||||
0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x01, 0x2a,
|
||||
0x12, 0x47, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x2e, 0x72, 0x6f, 0x76,
|
||||
0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, 0x2f,
|
||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72,
|
||||
0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x14, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61,
|
||||
0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x74, 0x69, 0x63, 0x6b, 0x52, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x08, 0x74, 0x69, 0x63, 0x6b, 0x52, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63,
|
||||
0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0b, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65,
|
||||
0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79,
|
||||
0x32, 0x91, 0x03, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x5d, 0x0a, 0x0c, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69,
|
||||
0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69,
|
||||
0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f,
|
||||
0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x72, 0x65,
|
||||
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4b, 0x0a, 0x07, 0x43, 0x6f, 0x6d,
|
||||
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x72, 0x6f, 0x76,
|
||||
0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x61, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12,
|
||||
0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b,
|
||||
0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x47, 0x0a, 0x06, 0x53,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6f, 0x76,
|
||||
0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x22, 0x07, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70,
|
||||
0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -285,23 +285,28 @@
|
|||
"roveServerStatusResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"next_tick": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
"title": "The time the next tick will occur"
|
||||
"title": "The version of the server in v{major}.{minor}-{delta}-{sha} form"
|
||||
},
|
||||
"ready": {
|
||||
"type": "boolean",
|
||||
"format": "boolean",
|
||||
"title": "Whether the server is ready to accept requests"
|
||||
},
|
||||
"tick": {
|
||||
"tickRate": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "The tick rate of the server in minutes (how many minutes per tick)"
|
||||
},
|
||||
"version": {
|
||||
"currentTick": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "The current tick of the server"
|
||||
},
|
||||
"next_tick": {
|
||||
"type": "string",
|
||||
"title": "The version of the server in v{major}.{minor}-{delta}-{sha} form"
|
||||
"title": "The time the next tick will occur"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -156,17 +156,20 @@ message StatusResponse {
|
|||
message ServerStatusRequest {}
|
||||
|
||||
message ServerStatusResponse {
|
||||
// The time the next tick will occur
|
||||
string next_tick = 1;
|
||||
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
||||
string version = 1;
|
||||
|
||||
// Whether the server is ready to accept requests
|
||||
bool ready = 2;
|
||||
|
||||
// The tick rate of the server in minutes (how many minutes per tick)
|
||||
int32 tick = 3;
|
||||
int32 tickRate = 3;
|
||||
|
||||
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
||||
string version = 4;
|
||||
// The current tick of the server
|
||||
int32 currentTick = 4;
|
||||
|
||||
// The time the next tick will occur
|
||||
string next_tick = 5;
|
||||
}
|
||||
|
||||
message Vector {
|
||||
|
|
Loading…
Add table
Reference in a new issue