From 2c1bb8077931bc75b678d0b08aa25240d3b6e1a5 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Thu, 23 Jul 2020 19:01:16 +0100 Subject: [PATCH 01/18] Add salvage command Slight refactor to re-use command variables Also fixes the cmdline client turn command --- cmd/rove/main.go | 8 +- pkg/rove/command_test.go | 4 +- pkg/rove/world.go | 12 +- proto/roveapi/roveapi.pb.go | 481 +++++++++++++++++++++--------------- proto/roveapi/roveapi.proto | 26 +- 5 files changed, 306 insertions(+), 225 deletions(-) diff --git a/cmd/rove/main.go b/cmd/rove/main.go index 01e16ae..97a7a24 100644 --- a/cmd/rove/main.go +++ b/cmd/rove/main.go @@ -243,8 +243,8 @@ func InnerMain(command string, args ...string) error { } commands = append(commands, &roveapi.Command{ - Command: roveapi.CommandType_broadcast, - Broadcast: []byte(args[i]), + Command: roveapi.CommandType_turn, + Bearing: b, }, ) case "broadcast": @@ -256,8 +256,8 @@ func InnerMain(command string, args ...string) error { } commands = append(commands, &roveapi.Command{ - Command: roveapi.CommandType_broadcast, - Broadcast: []byte(args[i]), + Command: roveapi.CommandType_broadcast, + Data: []byte(args[i]), }, ) default: diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index d73b25c..8f4dd36 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -39,7 +39,7 @@ func TestCommand_Turn(t *testing.T) { a, err := w.SpawnRover() assert.NoError(t, err) - err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Turn: roveapi.Bearing_NorthWest}) + err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Bearing: roveapi.Bearing_NorthWest}) assert.NoError(t, err) w.Tick() @@ -122,7 +122,7 @@ func TestCommand_Broadcast(t *testing.T) { assert.NoError(t, err) // Enqueue the broadcast and tick - err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_broadcast, Broadcast: []byte("ABC")}) + err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_broadcast, Data: []byte("ABC")}) assert.NoError(t, err) w.Tick() diff --git a/pkg/rove/world.go b/pkg/rove/world.go index a81cf05..50348dc 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -435,16 +435,16 @@ func (w *World) Enqueue(rover string, commands ...*roveapi.Command) error { for _, c := range commands { switch c.Command { case roveapi.CommandType_broadcast: - if len(c.GetBroadcast()) > 3 { - return fmt.Errorf("too many characters in message (limit 3): %d", len(c.GetBroadcast())) + if len(c.GetData()) > 3 { + return fmt.Errorf("too many characters in message (limit 3): %d", len(c.GetData())) } - for _, b := range c.GetBroadcast() { + for _, b := range c.GetData() { if b < 37 || b > 126 { return fmt.Errorf("invalid message character: %c", b) } } case roveapi.CommandType_turn: - if c.GetTurn() == roveapi.Bearing_BearingUnknown { + if c.GetBearing() == roveapi.Bearing_BearingUnknown { return fmt.Errorf("turn command given unknown bearing") } case roveapi.CommandType_toggle: @@ -569,12 +569,12 @@ func (w *World) ExecuteCommand(c *roveapi.Command, rover string) (err error) { } case roveapi.CommandType_broadcast: - if err := w.RoverBroadcast(rover, c.GetBroadcast()); err != nil { + if err := w.RoverBroadcast(rover, c.GetData()); err != nil { return err } case roveapi.CommandType_turn: - if _, err := w.RoverTurn(rover, c.GetTurn()); err != nil { + if _, err := w.RoverTurn(rover, c.GetBearing()); err != nil { return err } diff --git a/proto/roveapi/roveapi.pb.go b/proto/roveapi/roveapi.pb.go index d5f0a46..c5e458c 100644 --- a/proto/roveapi/roveapi.pb.go +++ b/proto/roveapi/roveapi.pb.go @@ -41,14 +41,16 @@ const ( CommandType_none CommandType = 0 // Toggles the sails, either catching the wind, or charging from the sun CommandType_toggle CommandType = 1 - // Turns the rover in the specified bearing, requires data + // Turns the rover in the specified bearing (requires bearing) CommandType_turn CommandType = 2 // Stashes item at current location in rover inventory CommandType_stash CommandType = 3 // Repairs the rover using an inventory object CommandType_repair CommandType = 4 - // Broadcasts a message to nearby rovers, requires data + // Broadcasts a message to nearby rovers (requires data) CommandType_broadcast CommandType = 5 + // Salvages a neighboring dormant rover for parts (requres bearing and salvage) + CommandType_salvage CommandType = 6 ) // Enum value maps for CommandType. @@ -60,6 +62,7 @@ var ( 3: "stash", 4: "repair", 5: "broadcast", + 6: "salvage", } CommandType_value = map[string]int32{ "none": 0, @@ -68,6 +71,7 @@ var ( "stash": 3, "repair": 4, "broadcast": 5, + "salvage": 6, } ) @@ -167,6 +171,53 @@ func (Bearing) EnumDescriptor() ([]byte, []int) { return file_roveapi_roveapi_proto_rawDescGZIP(), []int{1} } +type SalvageType int32 + +const ( + SalvageType_SalvageUnknown SalvageType = 0 + // Salvage a nearby rover for parts + SalvageType_SalvageParts SalvageType = 1 +) + +// Enum value maps for SalvageType. +var ( + SalvageType_name = map[int32]string{ + 0: "SalvageUnknown", + 1: "SalvageParts", + } + SalvageType_value = map[string]int32{ + "SalvageUnknown": 0, + "SalvageParts": 1, + } +) + +func (x SalvageType) Enum() *SalvageType { + p := new(SalvageType) + *p = x + return p +} + +func (x SalvageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SalvageType) Descriptor() protoreflect.EnumDescriptor { + return file_roveapi_roveapi_proto_enumTypes[2].Descriptor() +} + +func (SalvageType) Type() protoreflect.EnumType { + return &file_roveapi_roveapi_proto_enumTypes[2] +} + +func (x SalvageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SalvageType.Descriptor instead. +func (SalvageType) EnumDescriptor() ([]byte, []int) { + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{2} +} + // Types of objects type Object int32 @@ -212,11 +263,11 @@ func (x Object) String() string { } func (Object) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[2].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[3].Descriptor() } func (Object) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[2] + return &file_roveapi_roveapi_proto_enumTypes[3] } func (x Object) Number() protoreflect.EnumNumber { @@ -225,7 +276,7 @@ func (x Object) Number() protoreflect.EnumNumber { // Deprecated: Use Object.Descriptor instead. func (Object) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{2} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3} } type Tile int32 @@ -268,11 +319,11 @@ func (x Tile) String() string { } func (Tile) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[3].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[4].Descriptor() } func (Tile) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[3] + return &file_roveapi_roveapi_proto_enumTypes[4] } func (x Tile) Number() protoreflect.EnumNumber { @@ -281,7 +332,7 @@ func (x Tile) Number() protoreflect.EnumNumber { // Deprecated: Use Tile.Descriptor instead. func (Tile) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{4} } // SailPosition represents the position of the sola sail @@ -320,11 +371,11 @@ func (x SailPosition) String() string { } func (SailPosition) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[4].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[5].Descriptor() } func (SailPosition) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[4] + return &file_roveapi_roveapi_proto_enumTypes[5] } func (x SailPosition) Number() protoreflect.EnumNumber { @@ -333,7 +384,7 @@ func (x SailPosition) Number() protoreflect.EnumNumber { // Deprecated: Use SailPosition.Descriptor instead. func (SailPosition) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{4} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{5} } // ServerStatusRequest is an empty placeholder @@ -624,11 +675,13 @@ type Command struct { // The command type Command CommandType `protobuf:"varint,1,opt,name=command,proto3,enum=roveapi.CommandType" json:"command,omitempty"` - // A simple message, must be composed of printable ASCII glyphs (32-126) - // maximum of three characters - Broadcast []byte `protobuf:"bytes,2,opt,name=broadcast,proto3" json:"broadcast,omitempty"` - // The bearing for the rover to turn to - Turn Bearing `protobuf:"varint,3,opt,name=turn,proto3,enum=roveapi.Bearing" json:"turn,omitempty"` + // broadcast - a simple message, must be composed of up to 3 printable ASCII glyphs (32-126) + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // move - the bearing for the rover to turn to + // salvage - the direction of the rover + Bearing Bearing `protobuf:"varint,3,opt,name=bearing,proto3,enum=roveapi.Bearing" json:"bearing,omitempty"` + // salvage - the type of salvage to execute + Salvage SalvageType `protobuf:"varint,4,opt,name=salvage,proto3,enum=roveapi.SalvageType" json:"salvage,omitempty"` } func (x *Command) Reset() { @@ -670,20 +723,27 @@ func (x *Command) GetCommand() CommandType { return CommandType_none } -func (x *Command) GetBroadcast() []byte { +func (x *Command) GetData() []byte { if x != nil { - return x.Broadcast + return x.Data } return nil } -func (x *Command) GetTurn() Bearing { +func (x *Command) GetBearing() Bearing { if x != nil { - return x.Turn + return x.Bearing } return Bearing_BearingUnknown } +func (x *Command) GetSalvage() SalvageType { + if x != nil { + return x.Salvage + } + return SalvageType_SalvageUnknown +} + // CommandRequest describes a set of commands to be requested for the rover type CommandRequest struct { state protoimpl.MessageState @@ -1397,141 +1457,148 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{ 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7d, 0x0a, 0x07, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, - 0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, - 0x6e, 0x67, 0x52, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, - 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72, + 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, + 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, + 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x2e, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x73, 0x61, + 0x6c, 0x76, 0x61, 0x67, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x75, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69, - 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, - 0x61, 0x70, 0x69, 0x2e, 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12, - 0x29, 0x0a, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e, - 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12, - 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 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, 0x22, 0xad, 0x01, 0x0a, - 0x13, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, - 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, - 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a, - 0x0b, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, - 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x07, 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, - 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, - 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, - 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, - 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 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, 0x84, 0x01, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, - 0x6e, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x24, 0x0a, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, - 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, - 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73, - 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, - 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, - 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, - 0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, - 0x53, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, - 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, - 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, - 0x61, 0x69, 0x72, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, - 0x73, 0x74, 0x10, 0x05, 0x2a, 0x83, 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, - 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, - 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, - 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, - 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, - 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, - 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, - 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, - 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x08, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, - 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, - 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, - 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, - 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, - 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, - 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, - 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, - 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, - 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, - 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, - 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, - 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, - 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, - 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, - 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x75, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x2e, 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x07, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0f, 0x2e, + 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, + 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, + 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x65, 0x78, 0x74, 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, 0x22, 0xad, 0x01, 0x0a, 0x13, 0x52, 0x6f, + 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, + 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, + 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, + 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, + 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, + 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x0b, 0x52, 0x6f, + 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, + 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, + 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, + 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, + 0x61, 0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 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, 0x84, + 0x01, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, + 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, + 0x04, 0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, + 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x52, + 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, + 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, + 0x67, 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x60, 0x0a, 0x0b, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, + 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, + 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x2a, 0x83, + 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, + 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, + 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, + 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, + 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, + 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, + 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, + 0x73, 0x74, 0x10, 0x08, 0x2a, 0x33, 0x0a, 0x0b, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x55, 0x6e, + 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x61, 0x6c, 0x76, 0x61, + 0x67, 0x65, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x01, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, + 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, + 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, + 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, + 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, + 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, + 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, + 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, + 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, + 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, + 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, + 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, + 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, + 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, + 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, + 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, + 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1546,66 +1613,68 @@ func file_roveapi_roveapi_proto_rawDescGZIP() []byte { return file_roveapi_roveapi_proto_rawDescData } -var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_roveapi_roveapi_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_roveapi_roveapi_proto_goTypes = []interface{}{ (CommandType)(0), // 0: roveapi.CommandType (Bearing)(0), // 1: roveapi.Bearing - (Object)(0), // 2: roveapi.Object - (Tile)(0), // 3: roveapi.Tile - (SailPosition)(0), // 4: roveapi.SailPosition - (*ServerStatusRequest)(nil), // 5: roveapi.ServerStatusRequest - (*ServerStatusResponse)(nil), // 6: roveapi.ServerStatusResponse - (*RegisterRequest)(nil), // 7: roveapi.RegisterRequest - (*Account)(nil), // 8: roveapi.Account - (*RegisterResponse)(nil), // 9: roveapi.RegisterResponse - (*Command)(nil), // 10: roveapi.Command - (*CommandRequest)(nil), // 11: roveapi.CommandRequest - (*CommandResponse)(nil), // 12: roveapi.CommandResponse - (*RadarRequest)(nil), // 13: roveapi.RadarRequest - (*RadarResponse)(nil), // 14: roveapi.RadarResponse - (*StatusRequest)(nil), // 15: roveapi.StatusRequest - (*Log)(nil), // 16: roveapi.Log - (*Vector)(nil), // 17: roveapi.Vector - (*RoverSpecifications)(nil), // 18: roveapi.RoverSpecifications - (*RoverStatus)(nil), // 19: roveapi.RoverStatus - (*RoverReadings)(nil), // 20: roveapi.RoverReadings - (*StatusResponse)(nil), // 21: roveapi.StatusResponse + (SalvageType)(0), // 2: roveapi.SalvageType + (Object)(0), // 3: roveapi.Object + (Tile)(0), // 4: roveapi.Tile + (SailPosition)(0), // 5: roveapi.SailPosition + (*ServerStatusRequest)(nil), // 6: roveapi.ServerStatusRequest + (*ServerStatusResponse)(nil), // 7: roveapi.ServerStatusResponse + (*RegisterRequest)(nil), // 8: roveapi.RegisterRequest + (*Account)(nil), // 9: roveapi.Account + (*RegisterResponse)(nil), // 10: roveapi.RegisterResponse + (*Command)(nil), // 11: roveapi.Command + (*CommandRequest)(nil), // 12: roveapi.CommandRequest + (*CommandResponse)(nil), // 13: roveapi.CommandResponse + (*RadarRequest)(nil), // 14: roveapi.RadarRequest + (*RadarResponse)(nil), // 15: roveapi.RadarResponse + (*StatusRequest)(nil), // 16: roveapi.StatusRequest + (*Log)(nil), // 17: roveapi.Log + (*Vector)(nil), // 18: roveapi.Vector + (*RoverSpecifications)(nil), // 19: roveapi.RoverSpecifications + (*RoverStatus)(nil), // 20: roveapi.RoverStatus + (*RoverReadings)(nil), // 21: roveapi.RoverReadings + (*StatusResponse)(nil), // 22: roveapi.StatusResponse } var file_roveapi_roveapi_proto_depIdxs = []int32{ - 8, // 0: roveapi.RegisterResponse.account:type_name -> roveapi.Account + 9, // 0: roveapi.RegisterResponse.account:type_name -> roveapi.Account 0, // 1: roveapi.Command.command:type_name -> roveapi.CommandType - 1, // 2: roveapi.Command.turn:type_name -> roveapi.Bearing - 8, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account - 10, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command - 8, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account - 3, // 6: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile - 2, // 7: roveapi.RadarResponse.objects:type_name -> roveapi.Object - 8, // 8: roveapi.StatusRequest.account:type_name -> roveapi.Account - 1, // 9: roveapi.RoverStatus.bearing:type_name -> roveapi.Bearing - 4, // 10: roveapi.RoverStatus.sailPosition:type_name -> roveapi.SailPosition - 10, // 11: roveapi.RoverStatus.queuedCommands:type_name -> roveapi.Command - 17, // 12: roveapi.RoverReadings.position:type_name -> roveapi.Vector - 1, // 13: roveapi.RoverReadings.wind:type_name -> roveapi.Bearing - 16, // 14: roveapi.RoverReadings.logs:type_name -> roveapi.Log - 18, // 15: roveapi.StatusResponse.spec:type_name -> roveapi.RoverSpecifications - 19, // 16: roveapi.StatusResponse.status:type_name -> roveapi.RoverStatus - 20, // 17: roveapi.StatusResponse.readings:type_name -> roveapi.RoverReadings - 5, // 18: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest - 7, // 19: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest - 11, // 20: roveapi.Rove.Command:input_type -> roveapi.CommandRequest - 13, // 21: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest - 15, // 22: roveapi.Rove.Status:input_type -> roveapi.StatusRequest - 6, // 23: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse - 9, // 24: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse - 12, // 25: roveapi.Rove.Command:output_type -> roveapi.CommandResponse - 14, // 26: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse - 21, // 27: roveapi.Rove.Status:output_type -> roveapi.StatusResponse - 23, // [23:28] is the sub-list for method output_type - 18, // [18:23] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 1, // 2: roveapi.Command.bearing:type_name -> roveapi.Bearing + 2, // 3: roveapi.Command.salvage:type_name -> roveapi.SalvageType + 9, // 4: roveapi.CommandRequest.account:type_name -> roveapi.Account + 11, // 5: roveapi.CommandRequest.commands:type_name -> roveapi.Command + 9, // 6: roveapi.RadarRequest.account:type_name -> roveapi.Account + 4, // 7: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile + 3, // 8: roveapi.RadarResponse.objects:type_name -> roveapi.Object + 9, // 9: roveapi.StatusRequest.account:type_name -> roveapi.Account + 1, // 10: roveapi.RoverStatus.bearing:type_name -> roveapi.Bearing + 5, // 11: roveapi.RoverStatus.sailPosition:type_name -> roveapi.SailPosition + 11, // 12: roveapi.RoverStatus.queuedCommands:type_name -> roveapi.Command + 18, // 13: roveapi.RoverReadings.position:type_name -> roveapi.Vector + 1, // 14: roveapi.RoverReadings.wind:type_name -> roveapi.Bearing + 17, // 15: roveapi.RoverReadings.logs:type_name -> roveapi.Log + 19, // 16: roveapi.StatusResponse.spec:type_name -> roveapi.RoverSpecifications + 20, // 17: roveapi.StatusResponse.status:type_name -> roveapi.RoverStatus + 21, // 18: roveapi.StatusResponse.readings:type_name -> roveapi.RoverReadings + 6, // 19: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest + 8, // 20: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest + 12, // 21: roveapi.Rove.Command:input_type -> roveapi.CommandRequest + 14, // 22: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest + 16, // 23: roveapi.Rove.Status:input_type -> roveapi.StatusRequest + 7, // 24: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse + 10, // 25: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse + 13, // 26: roveapi.Rove.Command:output_type -> roveapi.CommandResponse + 15, // 27: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse + 22, // 28: roveapi.Rove.Status:output_type -> roveapi.StatusResponse + 24, // [24:29] is the sub-list for method output_type + 19, // [19:24] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_roveapi_roveapi_proto_init() } @@ -1824,7 +1893,7 @@ func file_roveapi_roveapi_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_roveapi_roveapi_proto_rawDesc, - NumEnums: 5, + NumEnums: 6, NumMessages: 17, NumExtensions: 0, NumServices: 1, diff --git a/proto/roveapi/roveapi.proto b/proto/roveapi/roveapi.proto index cc7826a..2d8917e 100644 --- a/proto/roveapi/roveapi.proto +++ b/proto/roveapi/roveapi.proto @@ -91,14 +91,16 @@ enum CommandType { none = 0; // Toggles the sails, either catching the wind, or charging from the sun toggle = 1; - // Turns the rover in the specified bearing, requires data + // Turns the rover in the specified bearing (requires bearing) turn = 2; // Stashes item at current location in rover inventory stash = 3; // Repairs the rover using an inventory object repair = 4; - // Broadcasts a message to nearby rovers, requires data + // Broadcasts a message to nearby rovers (requires data) broadcast = 5; + // Salvages a neighboring dormant rover for parts (requres bearing and salvage) + salvage = 6; } // Bearing represents a compass direction @@ -115,17 +117,27 @@ enum Bearing { NorthWest = 8; } +enum SalvageType { + SalvageUnknown = 0; + + // Salvage a nearby rover for parts + SalvageParts = 1; +} + // Command is a single command for a rover message Command { // The command type CommandType command = 1; - // A simple message, must be composed of printable ASCII glyphs (32-126) - // maximum of three characters - bytes broadcast = 2; + // broadcast - a simple message, must be composed of up to 3 printable ASCII glyphs (32-126) + bytes data = 2; - // The bearing for the rover to turn to - Bearing turn = 3; + // move - the bearing for the rover to turn to + // salvage - the direction of the rover + Bearing bearing = 3; + + // salvage - the type of salvage to execute + SalvageType salvage = 4; } // CommandRequest describes a set of commands to be requested for the rover From ce6e10afbb0deb73601b07ff5640a23453d7abe0 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:08:03 +0100 Subject: [PATCH 02/18] Add salvage command to main.go man page --- cmd/rove/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/rove/main.go b/cmd/rove/main.go index 97a7a24..aaca561 100644 --- a/cmd/rove/main.go +++ b/cmd/rove/main.go @@ -37,6 +37,7 @@ func printUsage() { fmt.Fprintln(os.Stderr, "\tstash stores the object at the rover location in the inventory") fmt.Fprintln(os.Stderr, "\trepair uses an inventory object to repair the rover") fmt.Fprintln(os.Stderr, "\tbroadcast MSG broadcast a simple ASCII triplet to nearby rovers") + fmt.Fprintln(os.Stderr, "\tsalvage uses an inventory object to repair the rover") fmt.Fprintln(os.Stderr, "\nEnvironment") fmt.Fprintln(os.Stderr, "\tROVE_USER_DATA path to user data, defaults to "+defaultDataPath) } From 2f1ccdfdb91fa2676e417e376b127afae0946a18 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:08:39 +0100 Subject: [PATCH 03/18] Make repair require rover parts --- pkg/rove/command_test.go | 4 +- pkg/rove/objects.go | 1 + pkg/rove/world.go | 23 +- pkg/rove/world_test.go | 8 +- proto/roveapi/roveapi.pb.go | 461 ++++++++++++++++-------------------- proto/roveapi/roveapi.proto | 15 +- 6 files changed, 230 insertions(+), 282 deletions(-) diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index 8f4dd36..9ca2748 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -99,10 +99,10 @@ func TestCommand_Repair(t *testing.T) { assert.Equal(t, info.MaximumIntegrity-1, info.Integrity) // Stash a repair object - w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RockSmall}) + w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RoverParts}) obj, err := w.RoverStash(name) assert.NoError(t, err) - assert.Equal(t, roveapi.Object_RockSmall, obj) + assert.Equal(t, roveapi.Object_RoverParts, obj) // Enqueue the repair and tick err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_repair}) diff --git a/pkg/rove/objects.go b/pkg/rove/objects.go index f1ce227..d5fd237 100644 --- a/pkg/rove/objects.go +++ b/pkg/rove/objects.go @@ -33,6 +33,7 @@ func (o *Object) IsBlocking() bool { func (o *Object) IsStashable() bool { var stashable = [...]roveapi.Object{ roveapi.Object_RockSmall, + roveapi.Object_RoverParts, } for _, t := range stashable { diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 50348dc..de0bcae 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -352,11 +352,24 @@ func (w *World) RoverRepair(rover string) (int, error) { return 0, fmt.Errorf("no rover matching id") } - // Consume an inventory item to repair if possible - if len(r.Inventory) > 0 && r.Integrity < r.MaximumIntegrity { - r.Inventory = r.Inventory[:len(r.Inventory)-1] - r.Integrity = r.Integrity + 1 - r.AddLogEntryf("repaired self to %d", r.Integrity) + // Can't repair past max + if r.Integrity >= r.MaximumIntegrity { + return r.Integrity, nil + } + + // Find rover parts in inventory + for i, o := range r.Inventory { + if o.Type == roveapi.Object_RoverParts { + + // Copy-erase from slice + r.Inventory[i] = r.Inventory[len(r.Inventory)-1] + r.Inventory = r.Inventory[:len(r.Inventory)-1] + + // Repair + r.Integrity = r.Integrity + 1 + r.AddLogEntryf("repaired self to %d", r.Integrity) + break + } } return r.Integrity, nil diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index db9fcb6..53be582 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -248,10 +248,10 @@ func TestWorld_RoverRepair(t *testing.T) { assert.NoError(t, err, "couldn't get rover info") // Pick up something to repair with - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall}) + world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RoverParts}) o, err := world.RoverStash(a) assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object") + assert.Equal(t, roveapi.Object_RoverParts, o, "Failed to get correct object") world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge}) @@ -273,10 +273,10 @@ func TestWorld_RoverRepair(t *testing.T) { assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "repair", "Rover logs should contain the repair") // Check again that it can't repair past the max - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall}) + world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RoverParts}) o, err = world.RoverStash(a) assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object") + assert.Equal(t, roveapi.Object_RoverParts, o, "Failed to get correct object") err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a) assert.NoError(t, err, "Failed to repair rover") diff --git a/proto/roveapi/roveapi.pb.go b/proto/roveapi/roveapi.pb.go index c5e458c..e86ab46 100644 --- a/proto/roveapi/roveapi.pb.go +++ b/proto/roveapi/roveapi.pb.go @@ -49,7 +49,7 @@ const ( CommandType_repair CommandType = 4 // Broadcasts a message to nearby rovers (requires data) CommandType_broadcast CommandType = 5 - // Salvages a neighboring dormant rover for parts (requres bearing and salvage) + // Salvages a neighboring dormant rover for parts CommandType_salvage CommandType = 6 ) @@ -171,53 +171,6 @@ func (Bearing) EnumDescriptor() ([]byte, []int) { return file_roveapi_roveapi_proto_rawDescGZIP(), []int{1} } -type SalvageType int32 - -const ( - SalvageType_SalvageUnknown SalvageType = 0 - // Salvage a nearby rover for parts - SalvageType_SalvageParts SalvageType = 1 -) - -// Enum value maps for SalvageType. -var ( - SalvageType_name = map[int32]string{ - 0: "SalvageUnknown", - 1: "SalvageParts", - } - SalvageType_value = map[string]int32{ - "SalvageUnknown": 0, - "SalvageParts": 1, - } -) - -func (x SalvageType) Enum() *SalvageType { - p := new(SalvageType) - *p = x - return p -} - -func (x SalvageType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (SalvageType) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[2].Descriptor() -} - -func (SalvageType) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[2] -} - -func (x SalvageType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use SalvageType.Descriptor instead. -func (SalvageType) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{2} -} - // Types of objects type Object int32 @@ -232,6 +185,8 @@ const ( Object_RockSmall Object = 3 // RockLarge is a large blocking rock Object_RockLarge Object = 4 + // RoverParts is one unit of rover parts, used for repairing and fixing the rover + Object_RoverParts Object = 5 ) // Enum value maps for Object. @@ -242,6 +197,7 @@ var ( 2: "RoverDormant", 3: "RockSmall", 4: "RockLarge", + 5: "RoverParts", } Object_value = map[string]int32{ "ObjectUnknown": 0, @@ -249,6 +205,7 @@ var ( "RoverDormant": 2, "RockSmall": 3, "RockLarge": 4, + "RoverParts": 5, } ) @@ -263,11 +220,11 @@ func (x Object) String() string { } func (Object) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[3].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[2].Descriptor() } func (Object) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[3] + return &file_roveapi_roveapi_proto_enumTypes[2] } func (x Object) Number() protoreflect.EnumNumber { @@ -276,7 +233,7 @@ func (x Object) Number() protoreflect.EnumNumber { // Deprecated: Use Object.Descriptor instead. func (Object) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{2} } type Tile int32 @@ -319,11 +276,11 @@ func (x Tile) String() string { } func (Tile) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[4].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[3].Descriptor() } func (Tile) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[4] + return &file_roveapi_roveapi_proto_enumTypes[3] } func (x Tile) Number() protoreflect.EnumNumber { @@ -332,7 +289,7 @@ func (x Tile) Number() protoreflect.EnumNumber { // Deprecated: Use Tile.Descriptor instead. func (Tile) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{4} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3} } // SailPosition represents the position of the sola sail @@ -371,11 +328,11 @@ func (x SailPosition) String() string { } func (SailPosition) Descriptor() protoreflect.EnumDescriptor { - return file_roveapi_roveapi_proto_enumTypes[5].Descriptor() + return file_roveapi_roveapi_proto_enumTypes[4].Descriptor() } func (SailPosition) Type() protoreflect.EnumType { - return &file_roveapi_roveapi_proto_enumTypes[5] + return &file_roveapi_roveapi_proto_enumTypes[4] } func (x SailPosition) Number() protoreflect.EnumNumber { @@ -384,7 +341,7 @@ func (x SailPosition) Number() protoreflect.EnumNumber { // Deprecated: Use SailPosition.Descriptor instead. func (SailPosition) EnumDescriptor() ([]byte, []int) { - return file_roveapi_roveapi_proto_rawDescGZIP(), []int{5} + return file_roveapi_roveapi_proto_rawDescGZIP(), []int{4} } // ServerStatusRequest is an empty placeholder @@ -680,8 +637,6 @@ type Command struct { // move - the bearing for the rover to turn to // salvage - the direction of the rover Bearing Bearing `protobuf:"varint,3,opt,name=bearing,proto3,enum=roveapi.Bearing" json:"bearing,omitempty"` - // salvage - the type of salvage to execute - Salvage SalvageType `protobuf:"varint,4,opt,name=salvage,proto3,enum=roveapi.SalvageType" json:"salvage,omitempty"` } func (x *Command) Reset() { @@ -737,13 +692,6 @@ func (x *Command) GetBearing() Bearing { return Bearing_BearingUnknown } -func (x *Command) GetSalvage() SalvageType { - if x != nil { - return x.Salvage - } - return SalvageType_SalvageUnknown -} - // CommandRequest describes a set of commands to be requested for the rover type CommandRequest struct { state protoimpl.MessageState @@ -1457,148 +1405,143 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{ 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa9, 0x01, 0x0a, 0x07, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, - 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, - 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x73, 0x61, - 0x6c, 0x76, 0x61, 0x67, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x07, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72, + 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, + 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, 0x61, + 0x72, 0x69, 0x6e, 0x67, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, + 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x75, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x6f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x75, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x07, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0f, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, - 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, - 0x65, 0x78, 0x74, 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, 0x22, 0xad, 0x01, 0x0a, 0x13, 0x52, 0x6f, - 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, - 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, - 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, - 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, - 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, - 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x0b, 0x52, 0x6f, - 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, - 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, - 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, - 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, - 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, - 0x61, 0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 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, 0x84, - 0x01, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, - 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, - 0x04, 0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, - 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x52, - 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, - 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x60, 0x0a, 0x0b, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, - 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, - 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, - 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x2a, 0x83, - 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, - 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, - 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, - 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, - 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, - 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, - 0x73, 0x74, 0x10, 0x08, 0x2a, 0x33, 0x0a, 0x0b, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x55, 0x6e, - 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x61, 0x6c, 0x76, 0x61, - 0x67, 0x65, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x01, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, - 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, - 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, - 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, - 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, - 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, - 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, - 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, - 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, - 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, - 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, - 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, - 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, - 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, - 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, - 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, - 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, - 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, + 0x78, 0x74, 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, 0x22, 0xad, 0x01, 0x0a, 0x13, 0x52, 0x6f, 0x76, + 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, + 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, + 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, + 0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, + 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, + 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x0b, 0x52, 0x6f, 0x76, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72, + 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, + 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, 0x61, + 0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, 0x61, + 0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 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, 0x84, 0x01, + 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12, + 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x04, + 0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, 0x69, + 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, + 0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, + 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, + 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, + 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, + 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x60, 0x0a, 0x0b, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x6f, + 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, 0x01, + 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, + 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, 0x05, + 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x2a, 0x83, 0x01, + 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, + 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, + 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, + 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, + 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, + 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, + 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, + 0x74, 0x10, 0x08, 0x2a, 0x6a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, + 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, + 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, + 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, + 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, + 0x0e, 0x0a, 0x0a, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x05, 0x2a, + 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, + 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, + 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, + 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, + 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, + 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, + 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, + 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, + 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, + 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, + 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, + 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1613,68 +1556,66 @@ func file_roveapi_roveapi_proto_rawDescGZIP() []byte { return file_roveapi_roveapi_proto_rawDescData } -var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 6) +var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 5) var file_roveapi_roveapi_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_roveapi_roveapi_proto_goTypes = []interface{}{ (CommandType)(0), // 0: roveapi.CommandType (Bearing)(0), // 1: roveapi.Bearing - (SalvageType)(0), // 2: roveapi.SalvageType - (Object)(0), // 3: roveapi.Object - (Tile)(0), // 4: roveapi.Tile - (SailPosition)(0), // 5: roveapi.SailPosition - (*ServerStatusRequest)(nil), // 6: roveapi.ServerStatusRequest - (*ServerStatusResponse)(nil), // 7: roveapi.ServerStatusResponse - (*RegisterRequest)(nil), // 8: roveapi.RegisterRequest - (*Account)(nil), // 9: roveapi.Account - (*RegisterResponse)(nil), // 10: roveapi.RegisterResponse - (*Command)(nil), // 11: roveapi.Command - (*CommandRequest)(nil), // 12: roveapi.CommandRequest - (*CommandResponse)(nil), // 13: roveapi.CommandResponse - (*RadarRequest)(nil), // 14: roveapi.RadarRequest - (*RadarResponse)(nil), // 15: roveapi.RadarResponse - (*StatusRequest)(nil), // 16: roveapi.StatusRequest - (*Log)(nil), // 17: roveapi.Log - (*Vector)(nil), // 18: roveapi.Vector - (*RoverSpecifications)(nil), // 19: roveapi.RoverSpecifications - (*RoverStatus)(nil), // 20: roveapi.RoverStatus - (*RoverReadings)(nil), // 21: roveapi.RoverReadings - (*StatusResponse)(nil), // 22: roveapi.StatusResponse + (Object)(0), // 2: roveapi.Object + (Tile)(0), // 3: roveapi.Tile + (SailPosition)(0), // 4: roveapi.SailPosition + (*ServerStatusRequest)(nil), // 5: roveapi.ServerStatusRequest + (*ServerStatusResponse)(nil), // 6: roveapi.ServerStatusResponse + (*RegisterRequest)(nil), // 7: roveapi.RegisterRequest + (*Account)(nil), // 8: roveapi.Account + (*RegisterResponse)(nil), // 9: roveapi.RegisterResponse + (*Command)(nil), // 10: roveapi.Command + (*CommandRequest)(nil), // 11: roveapi.CommandRequest + (*CommandResponse)(nil), // 12: roveapi.CommandResponse + (*RadarRequest)(nil), // 13: roveapi.RadarRequest + (*RadarResponse)(nil), // 14: roveapi.RadarResponse + (*StatusRequest)(nil), // 15: roveapi.StatusRequest + (*Log)(nil), // 16: roveapi.Log + (*Vector)(nil), // 17: roveapi.Vector + (*RoverSpecifications)(nil), // 18: roveapi.RoverSpecifications + (*RoverStatus)(nil), // 19: roveapi.RoverStatus + (*RoverReadings)(nil), // 20: roveapi.RoverReadings + (*StatusResponse)(nil), // 21: roveapi.StatusResponse } var file_roveapi_roveapi_proto_depIdxs = []int32{ - 9, // 0: roveapi.RegisterResponse.account:type_name -> roveapi.Account + 8, // 0: roveapi.RegisterResponse.account:type_name -> roveapi.Account 0, // 1: roveapi.Command.command:type_name -> roveapi.CommandType 1, // 2: roveapi.Command.bearing:type_name -> roveapi.Bearing - 2, // 3: roveapi.Command.salvage:type_name -> roveapi.SalvageType - 9, // 4: roveapi.CommandRequest.account:type_name -> roveapi.Account - 11, // 5: roveapi.CommandRequest.commands:type_name -> roveapi.Command - 9, // 6: roveapi.RadarRequest.account:type_name -> roveapi.Account - 4, // 7: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile - 3, // 8: roveapi.RadarResponse.objects:type_name -> roveapi.Object - 9, // 9: roveapi.StatusRequest.account:type_name -> roveapi.Account - 1, // 10: roveapi.RoverStatus.bearing:type_name -> roveapi.Bearing - 5, // 11: roveapi.RoverStatus.sailPosition:type_name -> roveapi.SailPosition - 11, // 12: roveapi.RoverStatus.queuedCommands:type_name -> roveapi.Command - 18, // 13: roveapi.RoverReadings.position:type_name -> roveapi.Vector - 1, // 14: roveapi.RoverReadings.wind:type_name -> roveapi.Bearing - 17, // 15: roveapi.RoverReadings.logs:type_name -> roveapi.Log - 19, // 16: roveapi.StatusResponse.spec:type_name -> roveapi.RoverSpecifications - 20, // 17: roveapi.StatusResponse.status:type_name -> roveapi.RoverStatus - 21, // 18: roveapi.StatusResponse.readings:type_name -> roveapi.RoverReadings - 6, // 19: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest - 8, // 20: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest - 12, // 21: roveapi.Rove.Command:input_type -> roveapi.CommandRequest - 14, // 22: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest - 16, // 23: roveapi.Rove.Status:input_type -> roveapi.StatusRequest - 7, // 24: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse - 10, // 25: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse - 13, // 26: roveapi.Rove.Command:output_type -> roveapi.CommandResponse - 15, // 27: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse - 22, // 28: roveapi.Rove.Status:output_type -> roveapi.StatusResponse - 24, // [24:29] is the sub-list for method output_type - 19, // [19:24] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 8, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account + 10, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command + 8, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account + 3, // 6: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile + 2, // 7: roveapi.RadarResponse.objects:type_name -> roveapi.Object + 8, // 8: roveapi.StatusRequest.account:type_name -> roveapi.Account + 1, // 9: roveapi.RoverStatus.bearing:type_name -> roveapi.Bearing + 4, // 10: roveapi.RoverStatus.sailPosition:type_name -> roveapi.SailPosition + 10, // 11: roveapi.RoverStatus.queuedCommands:type_name -> roveapi.Command + 17, // 12: roveapi.RoverReadings.position:type_name -> roveapi.Vector + 1, // 13: roveapi.RoverReadings.wind:type_name -> roveapi.Bearing + 16, // 14: roveapi.RoverReadings.logs:type_name -> roveapi.Log + 18, // 15: roveapi.StatusResponse.spec:type_name -> roveapi.RoverSpecifications + 19, // 16: roveapi.StatusResponse.status:type_name -> roveapi.RoverStatus + 20, // 17: roveapi.StatusResponse.readings:type_name -> roveapi.RoverReadings + 5, // 18: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest + 7, // 19: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest + 11, // 20: roveapi.Rove.Command:input_type -> roveapi.CommandRequest + 13, // 21: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest + 15, // 22: roveapi.Rove.Status:input_type -> roveapi.StatusRequest + 6, // 23: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse + 9, // 24: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse + 12, // 25: roveapi.Rove.Command:output_type -> roveapi.CommandResponse + 14, // 26: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse + 21, // 27: roveapi.Rove.Status:output_type -> roveapi.StatusResponse + 23, // [23:28] is the sub-list for method output_type + 18, // [18:23] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_roveapi_roveapi_proto_init() } @@ -1893,7 +1834,7 @@ func file_roveapi_roveapi_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_roveapi_roveapi_proto_rawDesc, - NumEnums: 6, + NumEnums: 5, NumMessages: 17, NumExtensions: 0, NumServices: 1, diff --git a/proto/roveapi/roveapi.proto b/proto/roveapi/roveapi.proto index 2d8917e..6b9515c 100644 --- a/proto/roveapi/roveapi.proto +++ b/proto/roveapi/roveapi.proto @@ -99,7 +99,7 @@ enum CommandType { repair = 4; // Broadcasts a message to nearby rovers (requires data) broadcast = 5; - // Salvages a neighboring dormant rover for parts (requres bearing and salvage) + // Salvages a neighboring dormant rover for parts salvage = 6; } @@ -117,13 +117,6 @@ enum Bearing { NorthWest = 8; } -enum SalvageType { - SalvageUnknown = 0; - - // Salvage a nearby rover for parts - SalvageParts = 1; -} - // Command is a single command for a rover message Command { // The command type @@ -135,9 +128,6 @@ message Command { // move - the bearing for the rover to turn to // salvage - the direction of the rover Bearing bearing = 3; - - // salvage - the type of salvage to execute - SalvageType salvage = 4; } // CommandRequest describes a set of commands to be requested for the rover @@ -172,6 +162,9 @@ enum Object { // RockLarge is a large blocking rock RockLarge = 4; + + // RoverParts is one unit of rover parts, used for repairing and fixing the rover + RoverParts = 5; } enum Tile { From 524487ce149ddffb4ec39fb95950acf764e8f84c Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:27:54 +0100 Subject: [PATCH 04/18] Stop the dormant rover from being a blocking object --- pkg/rove/objects.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/rove/objects.go b/pkg/rove/objects.go index d5fd237..df10453 100644 --- a/pkg/rove/objects.go +++ b/pkg/rove/objects.go @@ -17,7 +17,6 @@ type Object struct { func (o *Object) IsBlocking() bool { var blocking = [...]roveapi.Object{ roveapi.Object_RoverLive, - roveapi.Object_RoverDormant, roveapi.Object_RockLarge, } From 7cccb4394f7eb0583ba603d34e1097e002149156 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:28:44 +0100 Subject: [PATCH 05/18] Fix the help text comment --- cmd/rove/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/rove/main.go b/cmd/rove/main.go index aaca561..b3a7ed6 100644 --- a/cmd/rove/main.go +++ b/cmd/rove/main.go @@ -37,7 +37,7 @@ func printUsage() { fmt.Fprintln(os.Stderr, "\tstash stores the object at the rover location in the inventory") fmt.Fprintln(os.Stderr, "\trepair uses an inventory object to repair the rover") fmt.Fprintln(os.Stderr, "\tbroadcast MSG broadcast a simple ASCII triplet to nearby rovers") - fmt.Fprintln(os.Stderr, "\tsalvage uses an inventory object to repair the rover") + fmt.Fprintln(os.Stderr, "\tsalvage salvages a dormant rover for parts") fmt.Fprintln(os.Stderr, "\nEnvironment") fmt.Fprintln(os.Stderr, "\tROVE_USER_DATA path to user data, defaults to "+defaultDataPath) } From c321f88d962fcdba8de9a9e8950f6c31f8f702b5 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:39:14 +0100 Subject: [PATCH 06/18] Add code for salvage command --- pkg/rove/command_test.go | 28 ++++++++++++++++++++++++ pkg/rove/world.go | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index 9ca2748..9a8a35a 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -131,6 +131,34 @@ func TestCommand_Broadcast(t *testing.T) { assert.Contains(t, info.Logs[len(info.Logs)-1].Text, "ABC") } +func TestCommand_Salvage(t *testing.T) { + w := NewWorld(8) + name, err := w.SpawnRover() + assert.NoError(t, err) + + info, err := w.GetRover(name) + assert.NoError(t, err) + + w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RoverDormant}) + + // Enqueue the broadcast and tick + err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_salvage}) + assert.NoError(t, err) + w.Tick() + + // Check we now have some rover parts + info, err = w.GetRover(name) + assert.NoError(t, err) + assert.NotEmpty(t, info.Inventory) + for _, i := range info.Inventory { + assert.Equal(t, roveapi.Object_RoverParts, i.Type) + } + + // Check the dormant rover is gone + _, obj := w.Atlas.QueryPosition(info.Pos) + assert.Equal(t, roveapi.Object_ObjectUnknown, obj.Type) +} + func TestCommand_Invalid(t *testing.T) { w := NewWorld(8) name, err := w.SpawnRover() diff --git a/pkg/rove/world.go b/pkg/rove/world.go index de0bcae..b18f23e 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -300,6 +300,46 @@ func (w *World) RoverStash(rover string) (roveapi.Object, error) { return obj.Type, nil } +// RoverSalvage will salvage a rover for parts +func (w *World) RoverSalvage(rover string) (roveapi.Object, error) { + w.worldMutex.Lock() + defer w.worldMutex.Unlock() + + r, ok := w.Rovers[rover] + if !ok { + return roveapi.Object_ObjectUnknown, fmt.Errorf("no rover matching id") + } + + // Can't pick up when full + if len(r.Inventory) >= r.Capacity { + r.AddLogEntryf("tried to salvage dormant rover but inventory was full") + return roveapi.Object_ObjectUnknown, nil + } + + // Ensure the rover has energy + if r.Charge <= 0 { + r.AddLogEntryf("tried to salvage dormant rover but had no charge") + return roveapi.Object_ObjectUnknown, nil + } + r.Charge-- + + _, obj := w.Atlas.QueryPosition(r.Pos) + if obj.Type != roveapi.Object_RoverDormant { + r.AddLogEntryf("tried to salvage dormant rover but found no rover to salvage") + return roveapi.Object_ObjectUnknown, nil + } + + r.AddLogEntryf("salvaged dormant rover") + for i := 0; i < 5; i++ { + if len(r.Inventory) == r.Capacity { + break + } + r.Inventory = append(r.Inventory, Object{Type: roveapi.Object_RoverParts}) + } + w.Atlas.SetObject(r.Pos, Object{Type: roveapi.Object_ObjectUnknown}) + return obj.Type, nil +} + // RoverToggle will toggle the sail position func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) { w.worldMutex.Lock() @@ -463,6 +503,7 @@ func (w *World) Enqueue(rover string, commands ...*roveapi.Command) error { case roveapi.CommandType_toggle: case roveapi.CommandType_stash: case roveapi.CommandType_repair: + case roveapi.CommandType_salvage: // Nothing to verify default: return fmt.Errorf("unknown command: %s", c.Command) @@ -591,6 +632,11 @@ func (w *World) ExecuteCommand(c *roveapi.Command, rover string) (err error) { return err } + case roveapi.CommandType_salvage: + if _, err := w.RoverSalvage(rover); err != nil { + return err + } + default: return fmt.Errorf("unknown command: %s", c.Command) } From be36f0631b830f849ef0148e21ef38576e196da8 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:39:25 +0100 Subject: [PATCH 07/18] Add logs for failed stashes --- pkg/rove/world.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/rove/world.go b/pkg/rove/world.go index b18f23e..a500287 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -280,11 +280,13 @@ func (w *World) RoverStash(rover string) (roveapi.Object, error) { // Can't pick up when full if len(r.Inventory) >= r.Capacity { + r.AddLogEntryf("tried to stash object but inventory was full") return roveapi.Object_ObjectUnknown, nil } // Ensure the rover has energy if r.Charge <= 0 { + r.AddLogEntryf("tried to stash object but had no charge") return roveapi.Object_ObjectUnknown, nil } r.Charge-- From b0ff3eb6ea58201a657a493be7dd36c4a00a4182 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:39:33 +0100 Subject: [PATCH 08/18] Remove redundant tests (covered in command_tests) --- pkg/rove/world_test.go | 130 ----------------------------------------- 1 file changed, 130 deletions(-) diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index 53be582..430d571 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -128,79 +128,6 @@ func TestWorld_RadarFromRover(t *testing.T) { assert.Equal(t, objs1, objs2) } -func TestWorld_RoverStash(t *testing.T) { - world := NewWorld(2) - a, err := world.SpawnRover() - assert.NoError(t, err) - - pos := maths.Vector{ - X: 0.0, - Y: 0.0, - } - - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_ObjectUnknown}) - err = world.WarpRover(a, pos) - assert.NoError(t, err, "Failed to set position for rover") - - rover, err := world.GetRover(a) - assert.NoError(t, err, "Failed to get rover") - - for i := 0; i < rover.Capacity; i++ { - // Place an object - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall}) - - // Pick it up - o, err := world.RoverStash(a) - assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object") - - // Check it's gone - _, obj := world.Atlas.QueryPosition(pos) - assert.Equal(t, roveapi.Object_ObjectUnknown, obj.Type, "Stash failed to remove object from atlas") - - // Check we have it - inv, err := world.RoverInventory(a) - assert.NoError(t, err, "Failed to get inventory") - assert.Equal(t, i+1, len(inv)) - assert.Equal(t, Object{Type: roveapi.Object_RockSmall}, inv[i]) - - // Check that this did reduce the charge - info, err := world.GetRover(a) - assert.NoError(t, err, "Failed to get rover") - assert.Equal(t, info.MaximumCharge-(i+1), info.Charge, "Rover lost charge for stash") - assert.Contains(t, info.Logs[len(info.Logs)-1].Text, "stashed", "Rover logs should contain the move") - } - - // Recharge the rover - for i := 0; i < rover.MaximumCharge; i++ { - _, err = world.RoverRecharge(a) - assert.NoError(t, err) - - } - - // Place an object - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall}) - - // Try to pick it up - o, err := world.RoverStash(a) - assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_ObjectUnknown, o, "Failed to get correct object") - - // Check it's still there - _, obj := world.Atlas.QueryPosition(pos) - assert.Equal(t, roveapi.Object_RockSmall, obj.Type, "Stash failed to remove object from atlas") - - // Check we don't have it - inv, err := world.RoverInventory(a) - assert.NoError(t, err, "Failed to get inventory") - assert.Equal(t, rover.Capacity, len(inv)) - - // Check that this didn't reduce the charge - info, err := world.GetRover(a) - assert.NoError(t, err, "Failed to get rover") - assert.Equal(t, info.MaximumCharge, info.Charge, "Rover lost charge for non-stash") -} - func TestWorld_RoverDamage(t *testing.T) { world := NewWorld(2) a, err := world.SpawnRover() @@ -229,63 +156,6 @@ func TestWorld_RoverDamage(t *testing.T) { assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "collision", "Rover logs should contain the collision") } -func TestWorld_RoverRepair(t *testing.T) { - world := NewWorld(2) - a, err := world.SpawnRover() - assert.NoError(t, err) - - pos := maths.Vector{ - X: 0.0, - Y: 0.0, - } - - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_ObjectUnknown}) - - err = world.WarpRover(a, pos) - assert.NoError(t, err, "Failed to set position for rover") - - originalInfo, err := world.GetRover(a) - assert.NoError(t, err, "couldn't get rover info") - - // Pick up something to repair with - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RoverParts}) - o, err := world.RoverStash(a) - assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_RoverParts, o, "Failed to get correct object") - - world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge}) - - // Try and bump into the rock - vec, err := world.TryMoveRover(a, roveapi.Bearing_North) - assert.NoError(t, err, "Failed to move rover") - assert.Equal(t, pos, vec, "Rover managed to move into large rock") - - newinfo, err := world.GetRover(a) - assert.NoError(t, err, "couldn't get rover info") - assert.Equal(t, originalInfo.Integrity-1, newinfo.Integrity, "rover should have lost integrity") - - err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a) - assert.NoError(t, err, "Failed to repair rover") - - newinfo, err = world.GetRover(a) - assert.NoError(t, err, "couldn't get rover info") - assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have gained integrity") - assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "repair", "Rover logs should contain the repair") - - // Check again that it can't repair past the max - world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RoverParts}) - o, err = world.RoverStash(a) - assert.NoError(t, err, "Failed to stash") - assert.Equal(t, roveapi.Object_RoverParts, o, "Failed to get correct object") - - err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a) - assert.NoError(t, err, "Failed to repair rover") - - newinfo, err = world.GetRover(a) - assert.NoError(t, err, "couldn't get rover info") - assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have kept the same integrity") -} - func TestWorld_Daytime(t *testing.T) { world := NewWorld(1) From edd3e5a6cbc3855ecd089c950e964ab3c70fce41 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:42:34 +0100 Subject: [PATCH 09/18] Fix test by removing object before warping rover --- pkg/rove/world_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index 430d571..e1fa700 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -138,6 +138,7 @@ func TestWorld_RoverDamage(t *testing.T) { Y: 0.0, } + world.Atlas.SetObject(pos, Object{Type: roveapi.Object_ObjectUnknown}) err = world.WarpRover(a, pos) assert.NoError(t, err, "Failed to set position for rover") From 5b2ea533f41081564724025b7fe7c8891d1e5819 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 19:46:32 +0100 Subject: [PATCH 10/18] Remove incorrect proto comment --- proto/roveapi/roveapi.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/roveapi/roveapi.proto b/proto/roveapi/roveapi.proto index 6b9515c..7acedac 100644 --- a/proto/roveapi/roveapi.proto +++ b/proto/roveapi/roveapi.proto @@ -126,7 +126,6 @@ message Command { bytes data = 2; // move - the bearing for the rover to turn to - // salvage - the direction of the rover Bearing bearing = 3; } From 1e4d642038660ceda198bc769c22d688efe5b7a1 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 20:01:35 +0100 Subject: [PATCH 11/18] Add rover transfer command and implementation Need to swap the accounts --- pkg/rove/world.go | 54 +++++++++++++++++++ proto/roveapi/roveapi.pb.go | 104 +++++++++++++++++++----------------- proto/roveapi/roveapi.proto | 2 + 3 files changed, 110 insertions(+), 50 deletions(-) diff --git a/pkg/rove/world.go b/pkg/rove/world.go index a500287..afe7605 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -1,6 +1,7 @@ package rove import ( + "encoding/json" "fmt" "log" "math/rand" @@ -342,6 +343,53 @@ func (w *World) RoverSalvage(rover string) (roveapi.Object, error) { return obj.Type, nil } +// RoverTransfer will transfer rover control to dormant rover +func (w *World) RoverTransfer(rover string) (string, error) { + w.worldMutex.Lock() + defer w.worldMutex.Unlock() + + oldRover, ok := w.Rovers[rover] + if !ok { + return "", fmt.Errorf("no rover matching id") + } + + _, obj := w.Atlas.QueryPosition(oldRover.Pos) + if obj.Type != roveapi.Object_RoverDormant { + oldRover.AddLogEntryf("tried to transfer to dormant rover but found no rover") + return "", nil + } + + // Unmarshal the dormant rover + var newRover Rover + err := json.Unmarshal(obj.Data, &newRover) + if err != nil { + return "", err + } + + // Add logs + oldRover.AddLogEntryf("transferring to dormant rover %s", newRover.Name) + newRover.AddLogEntryf("transferred from rover %s", oldRover.Name) + + // Marshal old rover + oldRoverData, err := json.Marshal(oldRover) + if err != nil { + return "", err + } + + // Add this new rover to tracking + w.Rovers[newRover.Name] = &newRover + + // TODO: Swap account rover to the dormant one + + // Place the old rover into the world + w.Atlas.SetObject(oldRover.Pos, Object{Type: roveapi.Object_RoverDormant, Data: oldRoverData}) + + // Remove old rover from current tracking + delete(w.Rovers, oldRover.Name) + + return newRover.Name, nil +} + // RoverToggle will toggle the sail position func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) { w.worldMutex.Lock() @@ -506,6 +554,7 @@ func (w *World) Enqueue(rover string, commands ...*roveapi.Command) error { case roveapi.CommandType_stash: case roveapi.CommandType_repair: case roveapi.CommandType_salvage: + case roveapi.CommandType_transfer: // Nothing to verify default: return fmt.Errorf("unknown command: %s", c.Command) @@ -639,6 +688,11 @@ func (w *World) ExecuteCommand(c *roveapi.Command, rover string) (err error) { return err } + case roveapi.CommandType_transfer: + if _, err := w.RoverTransfer(rover); err != nil { + return err + } + default: return fmt.Errorf("unknown command: %s", c.Command) } diff --git a/proto/roveapi/roveapi.pb.go b/proto/roveapi/roveapi.pb.go index e86ab46..cc6fe07 100644 --- a/proto/roveapi/roveapi.pb.go +++ b/proto/roveapi/roveapi.pb.go @@ -51,6 +51,8 @@ const ( CommandType_broadcast CommandType = 5 // Salvages a neighboring dormant rover for parts CommandType_salvage CommandType = 6 + // Transfers remote control into dormant rover + CommandType_transfer CommandType = 7 ) // Enum value maps for CommandType. @@ -63,6 +65,7 @@ var ( 4: "repair", 5: "broadcast", 6: "salvage", + 7: "transfer", } CommandType_value = map[string]int32{ "none": 0, @@ -72,6 +75,7 @@ var ( "repair": 4, "broadcast": 5, "salvage": 6, + "transfer": 7, } ) @@ -635,7 +639,6 @@ type Command struct { // broadcast - a simple message, must be composed of up to 3 printable ASCII glyphs (32-126) Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // move - the bearing for the rover to turn to - // salvage - the direction of the rover Bearing Bearing `protobuf:"varint,3,opt,name=bearing,proto3,enum=roveapi.Bearing" json:"bearing,omitempty"` } @@ -1487,61 +1490,62 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{ 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, - 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x60, 0x0a, 0x0b, 0x43, + 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x6e, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, 0x05, - 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x2a, 0x83, 0x01, - 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, - 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, - 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, - 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, - 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, - 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, - 0x74, 0x10, 0x08, 0x2a, 0x6a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, - 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, - 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, - 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, - 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, - 0x0e, 0x0a, 0x0a, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x05, 0x2a, - 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, - 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, - 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, - 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, - 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, - 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, - 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, - 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, - 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, + 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x12, 0x0c, 0x0a, + 0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x10, 0x07, 0x2a, 0x83, 0x01, 0x0a, 0x07, + 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69, + 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e, + 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x45, + 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, 0x12, 0x09, + 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, + 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74, + 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, + 0x08, 0x2a, 0x6a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, + 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, + 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, + 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, 0x0e, 0x0a, + 0x0a, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x05, 0x2a, 0x37, 0x0a, + 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, + 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, + 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, + 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, + 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, + 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, + 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, - 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, - 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, - 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, - 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, + 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, + 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, + 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, + 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/roveapi/roveapi.proto b/proto/roveapi/roveapi.proto index 7acedac..5470e19 100644 --- a/proto/roveapi/roveapi.proto +++ b/proto/roveapi/roveapi.proto @@ -101,6 +101,8 @@ enum CommandType { broadcast = 5; // Salvages a neighboring dormant rover for parts salvage = 6; + // Transfers remote control into dormant rover + transfer = 7; } // Bearing represents a compass direction From e840b3e47bc09e4e105aa2e89aae3fe62f15ed43 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 20:06:06 +0100 Subject: [PATCH 12/18] Move accountant into world --- cmd/rove-server/internal/routes.go | 14 +++++++------- cmd/rove-server/internal/server.go | 10 +++------- .../internal => pkg/accounts}/accounts.go | 2 +- .../internal => pkg/accounts}/accounts_test.go | 2 +- .../internal => pkg/accounts}/simpleAccountant.go | 2 +- pkg/rove/world.go | 5 +++++ 6 files changed, 18 insertions(+), 17 deletions(-) rename {cmd/rove-server/internal => pkg/accounts}/accounts.go (98%) rename {cmd/rove-server/internal => pkg/accounts}/accounts_test.go (98%) rename {cmd/rove-server/internal => pkg/accounts}/simpleAccountant.go (99%) diff --git a/cmd/rove-server/internal/routes.go b/cmd/rove-server/internal/routes.go index 86becd7..69dd820 100644 --- a/cmd/rove-server/internal/routes.go +++ b/cmd/rove-server/internal/routes.go @@ -34,7 +34,7 @@ func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*r return nil, fmt.Errorf("empty account name") } - if acc, err := s.accountant.RegisterAccount(req.Name); err != nil { + if acc, err := s.world.Accountant.RegisterAccount(req.Name); err != nil { return nil, err } else if _, err := s.SpawnRoverForAccount(req.Name); err != nil { @@ -57,13 +57,13 @@ func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*r func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (response *roveapi.StatusResponse, err error) { log.Printf("Handling status request: %s\n", req.Account.Name) - if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { + if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { return nil, err } else if !valid { return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name) - } else if resp, err := s.accountant.GetValue(req.Account.Name, "rover"); err != nil { + } else if resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover"); err != nil { return nil, err } else if rover, err := s.world.GetRover(resp); err != nil { @@ -117,7 +117,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi.RadarResponse, error) { log.Printf("Handling radar request: %s\n", req.Account.Name) - if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { + if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { return nil, err } else if !valid { @@ -126,7 +126,7 @@ func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi response := &roveapi.RadarResponse{} - resp, err := s.accountant.GetValue(req.Account.Name, "rover") + resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover") if err != nil { return nil, err @@ -149,14 +149,14 @@ func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*roveapi.CommandResponse, error) { log.Printf("Handling command request: %s and %+v\n", req.Account.Name, req.Commands) - if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { + if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil { return nil, err } else if !valid { return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name) } - resp, err := s.accountant.GetValue(req.Account.Name, "rover") + resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover") if err != nil { return nil, err } diff --git a/cmd/rove-server/internal/server.go b/cmd/rove-server/internal/server.go index 786eb00..564656e 100644 --- a/cmd/rove-server/internal/server.go +++ b/cmd/rove-server/internal/server.go @@ -27,9 +27,6 @@ type Server struct { // Internal state world *rove.World - // Accountant - accountant Accountant - // gRPC server netListener net.Listener grpcServ *grpc.Server @@ -80,7 +77,6 @@ func NewServer(opts ...ServerOption) *Server { persistence: EphemeralData, schedule: cron.New(), world: rove.NewWorld(32), - accountant: NewSimpleAccountant(), } // Apply all options @@ -188,7 +184,7 @@ func (s *Server) SaveWorld() error { if s.persistence == PersistentData { s.world.RLock() defer s.world.RUnlock() - if err := persistence.SaveAll("world", s.world, "accounts", s.accountant); err != nil { + if err := persistence.SaveAll("world", s.world); err != nil { return fmt.Errorf("failed to save out persistent data: %s", err) } } @@ -200,7 +196,7 @@ func (s *Server) LoadWorld() error { if s.persistence == PersistentData { s.world.Lock() defer s.world.Unlock() - if err := persistence.LoadAll("world", &s.world, "accounts", &s.accountant); err != nil { + if err := persistence.LoadAll("world", &s.world); err != nil { return err } } @@ -214,7 +210,7 @@ func (s *Server) SpawnRoverForAccount(account string) (string, error) { return "", err } - err = s.accountant.AssignData(account, "rover", inst) + err = s.world.Accountant.AssignData(account, "rover", inst) if err != nil { log.Printf("Failed to assign rover to account, %s", err) diff --git a/cmd/rove-server/internal/accounts.go b/pkg/accounts/accounts.go similarity index 98% rename from cmd/rove-server/internal/accounts.go rename to pkg/accounts/accounts.go index 9ae6db9..eb8637d 100644 --- a/cmd/rove-server/internal/accounts.go +++ b/pkg/accounts/accounts.go @@ -1,4 +1,4 @@ -package internal +package accounts // Accountant decribes something that stores accounts and account values type Accountant interface { diff --git a/cmd/rove-server/internal/accounts_test.go b/pkg/accounts/accounts_test.go similarity index 98% rename from cmd/rove-server/internal/accounts_test.go rename to pkg/accounts/accounts_test.go index 9e7891f..bd2416f 100644 --- a/cmd/rove-server/internal/accounts_test.go +++ b/pkg/accounts/accounts_test.go @@ -1,4 +1,4 @@ -package internal +package accounts import ( "testing" diff --git a/cmd/rove-server/internal/simpleAccountant.go b/pkg/accounts/simpleAccountant.go similarity index 99% rename from cmd/rove-server/internal/simpleAccountant.go rename to pkg/accounts/simpleAccountant.go index 611ff59..9d6c43f 100644 --- a/cmd/rove-server/internal/simpleAccountant.go +++ b/pkg/accounts/simpleAccountant.go @@ -1,4 +1,4 @@ -package internal +package accounts import ( "fmt" diff --git a/pkg/rove/world.go b/pkg/rove/world.go index afe7605..0d828ae 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -7,6 +7,7 @@ import ( "math/rand" "sync" + "github.com/mdiluz/rove/pkg/accounts" "github.com/mdiluz/rove/pkg/maths" "github.com/mdiluz/rove/proto/roveapi" ) @@ -40,6 +41,9 @@ type World struct { // Commands is the set of currently executing command streams per rover CommandQueue map[string]CommandStream + // Accountant + Accountant accounts.Accountant + // Mutex to lock around all world operations worldMutex sync.RWMutex // Mutex to lock around command operations @@ -54,6 +58,7 @@ func NewWorld(chunkSize int) *World { Atlas: NewChunkAtlas(chunkSize), TicksPerDay: 24, CurrentTicks: 0, + Accountant: accounts.NewSimpleAccountant(), } } From 6f2d67bd7c14e312cc5b44acef62addd2a8aa93e Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:22:32 +0100 Subject: [PATCH 13/18] Tag rovers by the controlling account --- cmd/rove-server/internal/server.go | 2 +- pkg/rove/command_test.go | 14 +++++++------- pkg/rove/rover.go | 3 +++ pkg/rove/world.go | 12 ++++++++++-- pkg/rove/world_test.go | 26 +++++++++++++------------- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/cmd/rove-server/internal/server.go b/cmd/rove-server/internal/server.go index 564656e..42392f3 100644 --- a/cmd/rove-server/internal/server.go +++ b/cmd/rove-server/internal/server.go @@ -205,7 +205,7 @@ func (s *Server) LoadWorld() error { // SpawnRoverForAccount spawns the rover rover for an account func (s *Server) SpawnRoverForAccount(account string) (string, error) { - inst, err := s.world.SpawnRover() + inst, err := s.world.SpawnRover(account) if err != nil { return "", err } diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index 9a8a35a..6560e53 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -10,7 +10,7 @@ import ( func TestCommand_Toggle(t *testing.T) { w := NewWorld(8) - a, err := w.SpawnRover() + a, err := w.SpawnRover("tmp") assert.NoError(t, err) r, err := w.GetRover(a) @@ -36,7 +36,7 @@ func TestCommand_Toggle(t *testing.T) { func TestCommand_Turn(t *testing.T) { w := NewWorld(8) - a, err := w.SpawnRover() + a, err := w.SpawnRover("tmp") assert.NoError(t, err) err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Bearing: roveapi.Bearing_NorthWest}) @@ -50,7 +50,7 @@ func TestCommand_Turn(t *testing.T) { func TestCommand_Stash(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover() + name, err := w.SpawnRover("tmp") assert.NoError(t, err) info, err := w.GetRover(name) @@ -78,7 +78,7 @@ func TestCommand_Stash(t *testing.T) { func TestCommand_Repair(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover() + name, err := w.SpawnRover("tmp") assert.NoError(t, err) info, err := w.GetRover(name) @@ -118,7 +118,7 @@ func TestCommand_Repair(t *testing.T) { func TestCommand_Broadcast(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover() + name, err := w.SpawnRover("tmp") assert.NoError(t, err) // Enqueue the broadcast and tick @@ -133,7 +133,7 @@ func TestCommand_Broadcast(t *testing.T) { func TestCommand_Salvage(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover() + name, err := w.SpawnRover("tmp") assert.NoError(t, err) info, err := w.GetRover(name) @@ -161,7 +161,7 @@ func TestCommand_Salvage(t *testing.T) { func TestCommand_Invalid(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover() + name, err := w.SpawnRover("tmp") assert.NoError(t, err) err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_none}) diff --git a/pkg/rove/rover.go b/pkg/rove/rover.go index ce0edcd..d0fb9cb 100644 --- a/pkg/rove/rover.go +++ b/pkg/rove/rover.go @@ -66,6 +66,9 @@ type Rover struct { // Logs Stores log of information Logs []RoverLogEntry + + // The account that owns this rover + Owner string } // DefaultRover returns a default rover object with default settings diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 0d828ae..922ab70 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -63,13 +63,16 @@ func NewWorld(chunkSize int) *World { } // SpawnRover adds an rover to the game -func (w *World) SpawnRover() (string, error) { +func (w *World) SpawnRover(account string) (string, error) { w.worldMutex.Lock() defer w.worldMutex.Unlock() // Initialise the rover rover := DefaultRover() + // Assign the owner + rover.Owner = account + // Spawn in a random place near the origin rover.Pos = maths.Vector{ X: 10 - rand.Intn(20), @@ -375,6 +378,9 @@ func (w *World) RoverTransfer(rover string) (string, error) { oldRover.AddLogEntryf("transferring to dormant rover %s", newRover.Name) newRover.AddLogEntryf("transferred from rover %s", oldRover.Name) + // Clear the old owner + oldRover.Owner = "" + // Marshal old rover oldRoverData, err := json.Marshal(oldRover) if err != nil { @@ -384,7 +390,9 @@ func (w *World) RoverTransfer(rover string) (string, error) { // Add this new rover to tracking w.Rovers[newRover.Name] = &newRover - // TODO: Swap account rover to the dormant one + // Swap account rover to the dormant one + newRover.Owner = oldRover.Owner + w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name) // Place the old rover into the world w.Atlas.SetObject(oldRover.Pos, Object{Type: roveapi.Object_RoverDormant, Data: oldRoverData}) diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index e1fa700..d0c4c01 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -18,9 +18,9 @@ func TestNewWorld(t *testing.T) { func TestWorld_CreateRover(t *testing.T) { world := NewWorld(8) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) - b, err := world.SpawnRover() + b, err := world.SpawnRover("tmp") assert.NoError(t, err) // Basic duplicate check @@ -33,7 +33,7 @@ func TestWorld_CreateRover(t *testing.T) { func TestWorld_GetRover(t *testing.T) { world := NewWorld(4) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) rover, err := world.GetRover(a) @@ -44,9 +44,9 @@ func TestWorld_GetRover(t *testing.T) { func TestWorld_DestroyRover(t *testing.T) { world := NewWorld(1) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) - b, err := world.SpawnRover() + b, err := world.SpawnRover("tmp") assert.NoError(t, err) err = world.DestroyRover(a) @@ -62,7 +62,7 @@ func TestWorld_DestroyRover(t *testing.T) { func TestWorld_GetSetMovePosition(t *testing.T) { world := NewWorld(4) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) pos := maths.Vector{ @@ -97,9 +97,9 @@ func TestWorld_GetSetMovePosition(t *testing.T) { func TestWorld_RadarFromRover(t *testing.T) { // Create world that should have visible walls on the radar world := NewWorld(2) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) - b, err := world.SpawnRover() + b, err := world.SpawnRover("tmp") assert.NoError(t, err) // Warp the rovers into position @@ -130,7 +130,7 @@ func TestWorld_RadarFromRover(t *testing.T) { func TestWorld_RoverDamage(t *testing.T) { world := NewWorld(2) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) pos := maths.Vector{ @@ -160,7 +160,7 @@ func TestWorld_RoverDamage(t *testing.T) { func TestWorld_Daytime(t *testing.T) { world := NewWorld(1) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) // Remove rover charge @@ -199,10 +199,10 @@ func TestWorld_Daytime(t *testing.T) { func TestWorld_Broadcast(t *testing.T) { world := NewWorld(8) - a, err := world.SpawnRover() + a, err := world.SpawnRover("tmp") assert.NoError(t, err) - b, err := world.SpawnRover() + b, err := world.SpawnRover("tmp") assert.NoError(t, err) // Warp rovers near to eachother @@ -265,7 +265,7 @@ func TestWorld_Sailing(t *testing.T) { world.Tick() // One initial tick to set the wind direction the first time world.Wind = roveapi.Bearing_North // Set the wind direction to north - name, err := world.SpawnRover() + name, err := world.SpawnRover("tmp") assert.NoError(t, err) // Warp the rover to 0,0 after clearing it From fdfcc88540587ead99d016ebf9e0e69c5e78ddb6 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:50:35 +0100 Subject: [PATCH 14/18] Move the account registration into the world --- cmd/rove-server/internal/server.go | 12 ------------ pkg/rove/world.go | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/cmd/rove-server/internal/server.go b/cmd/rove-server/internal/server.go index 42392f3..7debe0a 100644 --- a/cmd/rove-server/internal/server.go +++ b/cmd/rove-server/internal/server.go @@ -210,17 +210,5 @@ func (s *Server) SpawnRoverForAccount(account string) (string, error) { return "", err } - err = s.world.Accountant.AssignData(account, "rover", inst) - if err != nil { - log.Printf("Failed to assign rover to account, %s", err) - - // Try and clear up the rover - if err := s.world.DestroyRover(inst); err != nil { - log.Printf("Failed to destroy rover after failed rover assign: %s", err) - } - - return "", err - } - return inst, nil } diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 922ab70..09d271a 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -97,7 +97,7 @@ func (w *World) SpawnRover(account string) (string, error) { // Append the rover to the list w.Rovers[rover.Name] = rover - return rover.Name, nil + return rover.Name, w.Accountant.AssignData(account, "rover", rover.Name) } // GetRover gets a specific rover by name From 57621d169aaa0669484eef832f9ee8f3678f5176 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:50:47 +0100 Subject: [PATCH 15/18] Implement a test for transfer and fix bugs --- pkg/rove/command_test.go | 52 ++++++++++++++++++++++++++++++++++++++++ pkg/rove/world.go | 27 +++++++++++---------- 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index 6560e53..13b95bf 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -1,6 +1,7 @@ package rove import ( + "encoding/json" "testing" "github.com/mdiluz/rove/pkg/maths" @@ -159,6 +160,57 @@ func TestCommand_Salvage(t *testing.T) { assert.Equal(t, roveapi.Object_ObjectUnknown, obj.Type) } +func TestCommand_Transfer(t *testing.T) { + w := NewWorld(8) + acc, err := w.Accountant.RegisterAccount("tmp") + assert.NoError(t, err) + nameA, err := w.SpawnRover(acc.Name) + assert.NoError(t, err) + + infoA, err := w.GetRover(nameA) + assert.NoError(t, err) + + // Drop a dormant rover on the current position + infoB := DefaultRover() + infoB.Name = "abc" + infoB.Pos = infoA.Pos + data, err := json.Marshal(infoB) + assert.NoError(t, err) + w.Atlas.SetObject(infoA.Pos, Object{Type: roveapi.Object_RoverDormant, Data: data}) + + // Enqueue a transfer as well as a dud command + err = w.Enqueue(nameA, + &roveapi.Command{Command: roveapi.CommandType_transfer}, + &roveapi.Command{Command: roveapi.CommandType_broadcast, Data: []byte("xyz")}) + assert.NoError(t, err) + w.Tick() + + // Ensure both command queues are empty + assert.Empty(t, w.CommandQueue[nameA]) + assert.Empty(t, w.CommandQueue[infoB.Name]) + + // Verify the account now controls the new rover + accountRover, err := w.Accountant.GetValue(acc.Name, "rover") + assert.NoError(t, err) + assert.Equal(t, infoB.Name, accountRover) + + // Verify the position now has a dormant rover + _, obj := w.Atlas.QueryPosition(infoA.Pos) + assert.Equal(t, roveapi.Object_RoverDormant, obj.Type) + + // Verify the stored data matches + var stored Rover + err = json.Unmarshal(obj.Data, &stored) + assert.NoError(t, err) + assert.Equal(t, infoA.Name, stored.Name) + + // Verify the new rover data matches what we put in + infoB2, err := w.GetRover(infoB.Name) + assert.NoError(t, err) + assert.Equal(t, infoB.Name, infoB2.Name) + +} + func TestCommand_Invalid(t *testing.T) { w := NewWorld(8) name, err := w.SpawnRover("tmp") diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 09d271a..bf68395 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -378,28 +378,26 @@ func (w *World) RoverTransfer(rover string) (string, error) { oldRover.AddLogEntryf("transferring to dormant rover %s", newRover.Name) newRover.AddLogEntryf("transferred from rover %s", oldRover.Name) - // Clear the old owner + // Transfer the ownership + w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name) + newRover.Owner = oldRover.Owner oldRover.Owner = "" - // Marshal old rover + // Place the old rover in the world oldRoverData, err := json.Marshal(oldRover) if err != nil { return "", err } - - // Add this new rover to tracking - w.Rovers[newRover.Name] = &newRover - - // Swap account rover to the dormant one - newRover.Owner = oldRover.Owner - w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name) - - // Place the old rover into the world w.Atlas.SetObject(oldRover.Pos, Object{Type: roveapi.Object_RoverDormant, Data: oldRoverData}) - // Remove old rover from current tracking + // Swap the rovers in the tracking + w.Rovers[newRover.Name] = &newRover delete(w.Rovers, oldRover.Name) + // Clear the command queues for both rovers + delete(w.CommandQueue, oldRover.Name) + delete(w.CommandQueue, newRover.Name) + return newRover.Name, nil } @@ -599,7 +597,10 @@ func (w *World) Tick() { } // Extract the first command in the queue - w.CommandQueue[rover] = cmds[1:] + // Only if the command queue still has entries + if _, ok := w.CommandQueue[rover]; ok { + w.CommandQueue[rover] = cmds[1:] + } } else { // Clean out the empty entry From a93ce97b0bcfe4e21331e6d0d31f3b00a5e3805b Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:54:06 +0100 Subject: [PATCH 16/18] Only assign rovers to accounts if given an account --- pkg/rove/command_test.go | 14 +++++++------- pkg/rove/world.go | 8 +++++++- pkg/rove/world_test.go | 26 +++++++++++++------------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/pkg/rove/command_test.go b/pkg/rove/command_test.go index 13b95bf..935e35d 100644 --- a/pkg/rove/command_test.go +++ b/pkg/rove/command_test.go @@ -11,7 +11,7 @@ import ( func TestCommand_Toggle(t *testing.T) { w := NewWorld(8) - a, err := w.SpawnRover("tmp") + a, err := w.SpawnRover("") assert.NoError(t, err) r, err := w.GetRover(a) @@ -37,7 +37,7 @@ func TestCommand_Toggle(t *testing.T) { func TestCommand_Turn(t *testing.T) { w := NewWorld(8) - a, err := w.SpawnRover("tmp") + a, err := w.SpawnRover("") assert.NoError(t, err) err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Bearing: roveapi.Bearing_NorthWest}) @@ -51,7 +51,7 @@ func TestCommand_Turn(t *testing.T) { func TestCommand_Stash(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover("tmp") + name, err := w.SpawnRover("") assert.NoError(t, err) info, err := w.GetRover(name) @@ -79,7 +79,7 @@ func TestCommand_Stash(t *testing.T) { func TestCommand_Repair(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover("tmp") + name, err := w.SpawnRover("") assert.NoError(t, err) info, err := w.GetRover(name) @@ -119,7 +119,7 @@ func TestCommand_Repair(t *testing.T) { func TestCommand_Broadcast(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover("tmp") + name, err := w.SpawnRover("") assert.NoError(t, err) // Enqueue the broadcast and tick @@ -134,7 +134,7 @@ func TestCommand_Broadcast(t *testing.T) { func TestCommand_Salvage(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover("tmp") + name, err := w.SpawnRover("") assert.NoError(t, err) info, err := w.GetRover(name) @@ -213,7 +213,7 @@ func TestCommand_Transfer(t *testing.T) { func TestCommand_Invalid(t *testing.T) { w := NewWorld(8) - name, err := w.SpawnRover("tmp") + name, err := w.SpawnRover("") assert.NoError(t, err) err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_none}) diff --git a/pkg/rove/world.go b/pkg/rove/world.go index bf68395..3d651da 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -97,7 +97,13 @@ func (w *World) SpawnRover(account string) (string, error) { // Append the rover to the list w.Rovers[rover.Name] = rover - return rover.Name, w.Accountant.AssignData(account, "rover", rover.Name) + var err error + // Only assign if we've been given an account + if len(account) > 0 { + err = w.Accountant.AssignData(account, "rover", rover.Name) + } + + return rover.Name, err } // GetRover gets a specific rover by name diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index d0c4c01..747a891 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -18,9 +18,9 @@ func TestNewWorld(t *testing.T) { func TestWorld_CreateRover(t *testing.T) { world := NewWorld(8) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) - b, err := world.SpawnRover("tmp") + b, err := world.SpawnRover("") assert.NoError(t, err) // Basic duplicate check @@ -33,7 +33,7 @@ func TestWorld_CreateRover(t *testing.T) { func TestWorld_GetRover(t *testing.T) { world := NewWorld(4) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) rover, err := world.GetRover(a) @@ -44,9 +44,9 @@ func TestWorld_GetRover(t *testing.T) { func TestWorld_DestroyRover(t *testing.T) { world := NewWorld(1) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) - b, err := world.SpawnRover("tmp") + b, err := world.SpawnRover("") assert.NoError(t, err) err = world.DestroyRover(a) @@ -62,7 +62,7 @@ func TestWorld_DestroyRover(t *testing.T) { func TestWorld_GetSetMovePosition(t *testing.T) { world := NewWorld(4) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) pos := maths.Vector{ @@ -97,9 +97,9 @@ func TestWorld_GetSetMovePosition(t *testing.T) { func TestWorld_RadarFromRover(t *testing.T) { // Create world that should have visible walls on the radar world := NewWorld(2) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) - b, err := world.SpawnRover("tmp") + b, err := world.SpawnRover("") assert.NoError(t, err) // Warp the rovers into position @@ -130,7 +130,7 @@ func TestWorld_RadarFromRover(t *testing.T) { func TestWorld_RoverDamage(t *testing.T) { world := NewWorld(2) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) pos := maths.Vector{ @@ -160,7 +160,7 @@ func TestWorld_RoverDamage(t *testing.T) { func TestWorld_Daytime(t *testing.T) { world := NewWorld(1) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) // Remove rover charge @@ -199,10 +199,10 @@ func TestWorld_Daytime(t *testing.T) { func TestWorld_Broadcast(t *testing.T) { world := NewWorld(8) - a, err := world.SpawnRover("tmp") + a, err := world.SpawnRover("") assert.NoError(t, err) - b, err := world.SpawnRover("tmp") + b, err := world.SpawnRover("") assert.NoError(t, err) // Warp rovers near to eachother @@ -265,7 +265,7 @@ func TestWorld_Sailing(t *testing.T) { world.Tick() // One initial tick to set the wind direction the first time world.Wind = roveapi.Bearing_North // Set the wind direction to north - name, err := world.SpawnRover("tmp") + name, err := world.SpawnRover("") assert.NoError(t, err) // Warp the rover to 0,0 after clearing it From a0e04b7e3a287ee842d9240edd57f18e7e4271d3 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:56:35 +0100 Subject: [PATCH 17/18] Placed dormant world rovers randomly have better base stats --- pkg/rove/worldgen.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/rove/worldgen.go b/pkg/rove/worldgen.go index e36b7b6..724837d 100644 --- a/pkg/rove/worldgen.go +++ b/pkg/rove/worldgen.go @@ -3,6 +3,7 @@ package rove import ( "encoding/json" "log" + "math/rand" "github.com/mdiluz/rove/pkg/maths" "github.com/mdiluz/rove/proto/roveapi" @@ -76,6 +77,12 @@ func (g *NoiseWorldGen) GetObject(v maths.Vector) (obj Object) { // Set the rover variables r.Pos = v + // Upgrade this rover randomly + r.MaximumCharge += rand.Int() % 3 + r.MaximumIntegrity += rand.Int() % 3 + r.Capacity += rand.Int() % 3 + r.Range += rand.Int() % 3 + // For now, mark the log as corrupted r.AddLogEntryf("log corrupted") From 7be0f83c5ea64bdcaf3635bc747e664fb54eaf20 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Fri, 24 Jul 2020 22:58:59 +0100 Subject: [PATCH 18/18] Fix golanglint missing error check --- pkg/rove/world.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 3d651da..27ded3b 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -385,7 +385,10 @@ func (w *World) RoverTransfer(rover string) (string, error) { newRover.AddLogEntryf("transferred from rover %s", oldRover.Name) // Transfer the ownership - w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name) + err = w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name) + if err != nil { + return "", err + } newRover.Owner = oldRover.Owner oldRover.Owner = ""