Merge pull request #30 from mdiluz/sailing
Swap out movement mechanics for sailing mechanics
This commit is contained in:
commit
d49d034f0e
17 changed files with 750 additions and 527 deletions
|
@ -21,8 +21,8 @@ type Accountant interface {
|
||||||
// Account represents a registered user
|
// Account represents a registered user
|
||||||
type Account struct {
|
type Account struct {
|
||||||
// Name simply describes the account and must be unique
|
// Name simply describes the account and must be unique
|
||||||
Name string `json:"name"`
|
Name string
|
||||||
|
|
||||||
// Data represents internal account data
|
// Data represents internal account data
|
||||||
Data map[string]string `json:"data"`
|
Data map[string]string
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/rove"
|
|
||||||
"github.com/mdiluz/rove/pkg/version"
|
"github.com/mdiluz/rove/pkg/version"
|
||||||
"github.com/mdiluz/rove/proto/roveapi"
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
)
|
)
|
||||||
|
@ -76,40 +75,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon
|
||||||
inv = append(inv, byte(i.Type))
|
inv = append(inv, byte(i.Type))
|
||||||
}
|
}
|
||||||
|
|
||||||
i, q := s.world.RoverCommands(resp)
|
incoming, queued := s.world.RoverCommands(resp)
|
||||||
var incoming, queued []*roveapi.Command
|
|
||||||
for _, i := range i {
|
|
||||||
c := &roveapi.Command{
|
|
||||||
Command: i.Command,
|
|
||||||
}
|
|
||||||
switch i.Command {
|
|
||||||
case roveapi.CommandType_move:
|
|
||||||
c.Data = &roveapi.Command_Bearing{
|
|
||||||
Bearing: i.Bearing,
|
|
||||||
}
|
|
||||||
case roveapi.CommandType_broadcast:
|
|
||||||
c.Data = &roveapi.Command_Message{
|
|
||||||
Message: i.Message,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
incoming = append(incoming, c)
|
|
||||||
}
|
|
||||||
for _, q := range q {
|
|
||||||
c := &roveapi.Command{
|
|
||||||
Command: q.Command,
|
|
||||||
}
|
|
||||||
switch q.Command {
|
|
||||||
case roveapi.CommandType_move:
|
|
||||||
c.Data = &roveapi.Command_Bearing{
|
|
||||||
Bearing: q.Bearing,
|
|
||||||
}
|
|
||||||
case roveapi.CommandType_broadcast:
|
|
||||||
c.Data = &roveapi.Command_Message{
|
|
||||||
Message: q.Message,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queued = append(queued, c)
|
|
||||||
}
|
|
||||||
var logs []*roveapi.Log
|
var logs []*roveapi.Log
|
||||||
for _, log := range rover.Logs {
|
for _, log := range rover.Logs {
|
||||||
logs = append(logs, &roveapi.Log{
|
logs = append(logs, &roveapi.Log{
|
||||||
|
@ -124,6 +90,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon
|
||||||
X: int32(rover.Pos.X),
|
X: int32(rover.Pos.X),
|
||||||
Y: int32(rover.Pos.Y),
|
Y: int32(rover.Pos.Y),
|
||||||
},
|
},
|
||||||
|
Bearing: rover.Bearing,
|
||||||
Range: int32(rover.Range),
|
Range: int32(rover.Range),
|
||||||
Inventory: inv,
|
Inventory: inv,
|
||||||
Capacity: int32(rover.Capacity),
|
Capacity: int32(rover.Capacity),
|
||||||
|
@ -133,7 +100,9 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon
|
||||||
MaximumCharge: int32(rover.MaximumCharge),
|
MaximumCharge: int32(rover.MaximumCharge),
|
||||||
IncomingCommands: incoming,
|
IncomingCommands: incoming,
|
||||||
QueuedCommands: queued,
|
QueuedCommands: queued,
|
||||||
|
SailPosition: rover.SailPosition,
|
||||||
Logs: logs,
|
Logs: logs,
|
||||||
|
Wind: s.world.Wind,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response, nil
|
return response, nil
|
||||||
|
@ -187,21 +156,7 @@ func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*rov
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmds []rove.Command
|
if err := s.world.Enqueue(resp, req.Commands...); err != nil {
|
||||||
for _, c := range req.Commands {
|
|
||||||
n := rove.Command{
|
|
||||||
Command: c.Command,
|
|
||||||
}
|
|
||||||
switch c.Command {
|
|
||||||
case roveapi.CommandType_move:
|
|
||||||
n.Bearing = c.GetBearing()
|
|
||||||
case roveapi.CommandType_broadcast:
|
|
||||||
n.Message = c.GetMessage()
|
|
||||||
}
|
|
||||||
cmds = append(cmds, n)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.world.Enqueue(resp, cmds...); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,8 +131,8 @@ func (s *Server) Run() {
|
||||||
|
|
||||||
log.Println("Executing server tick")
|
log.Println("Executing server tick")
|
||||||
|
|
||||||
// Run the command queues
|
// Tick the world
|
||||||
s.world.ExecuteCommandQueues()
|
s.world.Tick()
|
||||||
|
|
||||||
// Save out the new world state
|
// Save out the new world state
|
||||||
if err := s.SaveWorld(); err != nil {
|
if err := s.SaveWorld(); err != nil {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
// SimpleAccountant manages a set of accounts
|
// SimpleAccountant manages a set of accounts
|
||||||
type SimpleAccountant struct {
|
type SimpleAccountant struct {
|
||||||
Accounts map[string]Account `json:"accounts"`
|
Accounts map[string]Account
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSimpleAccountant creates a new accountant
|
// NewSimpleAccountant creates a new accountant
|
||||||
|
|
|
@ -33,10 +33,9 @@ func printUsage() {
|
||||||
fmt.Fprintln(os.Stderr, "\thelp outputs this usage information")
|
fmt.Fprintln(os.Stderr, "\thelp outputs this usage information")
|
||||||
fmt.Fprintln(os.Stderr, "\tversion outputs version info")
|
fmt.Fprintln(os.Stderr, "\tversion outputs version info")
|
||||||
fmt.Fprintln(os.Stderr, "\nRover commands:")
|
fmt.Fprintln(os.Stderr, "\nRover commands:")
|
||||||
fmt.Fprintln(os.Stderr, "\tmove BEARING moves the rover in the chosen direction")
|
fmt.Fprintln(os.Stderr, "\ttoggle toggles the sails, either catching the wind, or charging from the sun")
|
||||||
fmt.Fprintln(os.Stderr, "\tstash stores the object at the rover location in the inventory")
|
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, "\trepair uses an inventory object to repair the rover")
|
||||||
fmt.Fprintln(os.Stderr, "\trecharge wait a tick to recharge the rover")
|
|
||||||
fmt.Fprintln(os.Stderr, "\tbroadcast MSG broadcast a simple ASCII triplet to nearby rovers")
|
fmt.Fprintln(os.Stderr, "\tbroadcast MSG broadcast a simple ASCII triplet to nearby rovers")
|
||||||
fmt.Fprintln(os.Stderr, "\nEnvironment")
|
fmt.Fprintln(os.Stderr, "\nEnvironment")
|
||||||
fmt.Fprintln(os.Stderr, "\tROVE_USER_DATA path to user data, defaults to "+defaultDataPath)
|
fmt.Fprintln(os.Stderr, "\tROVE_USER_DATA path to user data, defaults to "+defaultDataPath)
|
||||||
|
@ -46,14 +45,14 @@ const gRPCport = 9090
|
||||||
|
|
||||||
// Account stores data for an account
|
// Account stores data for an account
|
||||||
type Account struct {
|
type Account struct {
|
||||||
Name string `json:"name"`
|
Name string
|
||||||
Secret string `json:"secret"`
|
Secret string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config is used to store internal data
|
// Config is used to store internal data
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string `json:"host,omitempty"`
|
Host string
|
||||||
Account Account `json:"account,omitempty"`
|
Account Account
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigPath returns the configuration path
|
// ConfigPath returns the configuration path
|
||||||
|
@ -128,12 +127,20 @@ func BearingFromString(s string) roveapi.Bearing {
|
||||||
switch s {
|
switch s {
|
||||||
case "N":
|
case "N":
|
||||||
return roveapi.Bearing_North
|
return roveapi.Bearing_North
|
||||||
|
case "NE":
|
||||||
|
return roveapi.Bearing_NorthEast
|
||||||
case "E":
|
case "E":
|
||||||
return roveapi.Bearing_East
|
return roveapi.Bearing_East
|
||||||
|
case "SE":
|
||||||
|
return roveapi.Bearing_SouthEast
|
||||||
case "S":
|
case "S":
|
||||||
return roveapi.Bearing_South
|
return roveapi.Bearing_South
|
||||||
|
case "SW":
|
||||||
|
return roveapi.Bearing_SouthWest
|
||||||
case "W":
|
case "W":
|
||||||
return roveapi.Bearing_West
|
return roveapi.Bearing_West
|
||||||
|
case "NW":
|
||||||
|
return roveapi.Bearing_NorthWest
|
||||||
}
|
}
|
||||||
return roveapi.Bearing_BearingUnknown
|
return roveapi.Bearing_BearingUnknown
|
||||||
}
|
}
|
||||||
|
@ -225,19 +232,19 @@ func InnerMain(command string, args ...string) error {
|
||||||
var commands []*roveapi.Command
|
var commands []*roveapi.Command
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
switch args[i] {
|
switch args[i] {
|
||||||
case "move":
|
case "turn":
|
||||||
i++
|
i++
|
||||||
if len(args) == i {
|
if len(args) == i {
|
||||||
return fmt.Errorf("move command must be passed bearing")
|
return fmt.Errorf("turn command must be passed a compass bearing")
|
||||||
}
|
}
|
||||||
var b roveapi.Bearing
|
b := BearingFromString(args[i])
|
||||||
if b = BearingFromString(args[i]); b == roveapi.Bearing_BearingUnknown {
|
if b == roveapi.Bearing_BearingUnknown {
|
||||||
return fmt.Errorf("unrecognised bearing: %s", args[i])
|
return fmt.Errorf("turn command must be given a valid bearing %s", args[i])
|
||||||
}
|
}
|
||||||
commands = append(commands,
|
commands = append(commands,
|
||||||
&roveapi.Command{
|
&roveapi.Command{
|
||||||
Command: roveapi.CommandType_move,
|
Command: roveapi.CommandType_broadcast,
|
||||||
Data: &roveapi.Command_Bearing{Bearing: b},
|
Broadcast: []byte(args[i]),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
case "broadcast":
|
case "broadcast":
|
||||||
|
@ -249,8 +256,8 @@ func InnerMain(command string, args ...string) error {
|
||||||
}
|
}
|
||||||
commands = append(commands,
|
commands = append(commands,
|
||||||
&roveapi.Command{
|
&roveapi.Command{
|
||||||
Command: roveapi.CommandType_broadcast,
|
Command: roveapi.CommandType_broadcast,
|
||||||
Data: &roveapi.Command_Message{Message: []byte(args[i])},
|
Broadcast: []byte(args[i]),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -50,12 +50,12 @@ func Test_InnerMain(t *testing.T) {
|
||||||
assert.Error(t, InnerMain("command"))
|
assert.Error(t, InnerMain("command"))
|
||||||
|
|
||||||
// Give it commands
|
// Give it commands
|
||||||
assert.NoError(t, InnerMain("command", "move", "N"))
|
assert.NoError(t, InnerMain("command", "toggle"))
|
||||||
assert.NoError(t, InnerMain("command", "stash"))
|
assert.NoError(t, InnerMain("command", "stash"))
|
||||||
assert.NoError(t, InnerMain("command", "repair"))
|
assert.NoError(t, InnerMain("command", "repair"))
|
||||||
assert.NoError(t, InnerMain("command", "broadcast", "abc"))
|
assert.NoError(t, InnerMain("command", "broadcast", "abc"))
|
||||||
|
|
||||||
// Give it malformed commands
|
// Give it malformed commands
|
||||||
assert.Error(t, InnerMain("command", "move", "stash"))
|
assert.Error(t, InnerMain("command", "unknown"))
|
||||||
assert.Error(t, InnerMain("command", "broadcast"))
|
assert.Error(t, InnerMain("command", "broadcast"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ services:
|
||||||
- PORT=9090
|
- PORT=9090
|
||||||
- DATA_PATH=/mnt/rove-server
|
- DATA_PATH=/mnt/rove-server
|
||||||
- WORDS_FILE=data/words_alpha.txt
|
- WORDS_FILE=data/words_alpha.txt
|
||||||
- TICK_RATE=5
|
- TICK_RATE=3
|
||||||
volumes:
|
volumes:
|
||||||
- persistent-data:/mnt/rove-server:rw
|
- persistent-data:/mnt/rove-server:rw
|
||||||
command: [ "./rove-server"]
|
command: [ "./rove-server"]
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
|
|
||||||
// Vector desribes a 3D vector
|
// Vector desribes a 3D vector
|
||||||
type Vector struct {
|
type Vector struct {
|
||||||
X int `json:"x"`
|
X int
|
||||||
Y int `json:"y"`
|
Y int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds one vector to another
|
// Add adds one vector to another
|
||||||
|
@ -89,13 +89,31 @@ func BearingToVector(b roveapi.Bearing) Vector {
|
||||||
switch b {
|
switch b {
|
||||||
case roveapi.Bearing_North:
|
case roveapi.Bearing_North:
|
||||||
return Vector{Y: 1}
|
return Vector{Y: 1}
|
||||||
|
case roveapi.Bearing_NorthEast:
|
||||||
|
return Vector{X: 1, Y: 1}
|
||||||
case roveapi.Bearing_East:
|
case roveapi.Bearing_East:
|
||||||
return Vector{X: 1}
|
return Vector{X: 1}
|
||||||
|
case roveapi.Bearing_SouthEast:
|
||||||
|
return Vector{X: 1, Y: -1}
|
||||||
case roveapi.Bearing_South:
|
case roveapi.Bearing_South:
|
||||||
return Vector{Y: -1}
|
return Vector{Y: -1}
|
||||||
|
case roveapi.Bearing_SouthWest:
|
||||||
|
return Vector{X: -1, Y: -1}
|
||||||
case roveapi.Bearing_West:
|
case roveapi.Bearing_West:
|
||||||
return Vector{X: -1}
|
return Vector{X: -1}
|
||||||
|
case roveapi.Bearing_NorthWest:
|
||||||
|
return Vector{X: -1, Y: 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Vector{}
|
return Vector{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dot returns the dot product of two vectors
|
||||||
|
func Dot(a Vector, b Vector) int {
|
||||||
|
return a.X*b.X + a.Y*b.Y
|
||||||
|
}
|
||||||
|
|
||||||
|
// AngleCos returns the cosine of the angle between two vectors
|
||||||
|
func AngleCos(a Vector, b Vector) float64 {
|
||||||
|
return float64(Dot(a, b)) / a.Length() * b.Length()
|
||||||
|
}
|
||||||
|
|
|
@ -11,27 +11,27 @@ import (
|
||||||
// chunk represents a fixed square grid of tiles
|
// chunk represents a fixed square grid of tiles
|
||||||
type chunk struct {
|
type chunk struct {
|
||||||
// Tiles represents the tiles within the chunk
|
// Tiles represents the tiles within the chunk
|
||||||
Tiles []byte `json:"tiles"`
|
Tiles []byte
|
||||||
|
|
||||||
// Objects represents the objects within the chunk
|
// Objects represents the objects within the chunk
|
||||||
// only one possible object per tile for now
|
// only one possible object per tile for now
|
||||||
Objects map[int]Object `json:"objects"`
|
Objects map[int]Object
|
||||||
}
|
}
|
||||||
|
|
||||||
// chunkBasedAtlas represents a grid of Chunks
|
// chunkBasedAtlas represents a grid of Chunks
|
||||||
type chunkBasedAtlas struct {
|
type chunkBasedAtlas struct {
|
||||||
// Chunks represents all chunks in the world
|
// Chunks represents all chunks in the world
|
||||||
// This is intentionally not a 2D array so it can be expanded in all directions
|
// This is intentionally not a 2D array so it can be expanded in all directions
|
||||||
Chunks []chunk `json:"chunks"`
|
Chunks []chunk
|
||||||
|
|
||||||
// LowerBound is the origin of the bottom left corner of the current chunks in world space (current chunks cover >= this value)
|
// LowerBound is the origin of the bottom left corner of the current chunks in world space (current chunks cover >= this value)
|
||||||
LowerBound maths.Vector `json:"lowerBound"`
|
LowerBound maths.Vector
|
||||||
|
|
||||||
// UpperBound is the top left corner of the current chunks (curent chunks cover < this value)
|
// UpperBound is the top left corner of the current chunks (curent chunks cover < this value)
|
||||||
UpperBound maths.Vector `json:"upperBound"`
|
UpperBound maths.Vector
|
||||||
|
|
||||||
// ChunkSize is the x/y dimensions of each square chunk
|
// ChunkSize is the x/y dimensions of each square chunk
|
||||||
ChunkSize int `json:"chunksize"`
|
ChunkSize int
|
||||||
|
|
||||||
// worldGen is the internal world generator
|
// worldGen is the internal world generator
|
||||||
worldGen WorldGen
|
worldGen WorldGen
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package rove
|
|
||||||
|
|
||||||
import "github.com/mdiluz/rove/proto/roveapi"
|
|
||||||
|
|
||||||
// Command represends a single command to execute
|
|
||||||
type Command struct {
|
|
||||||
Command roveapi.CommandType `json:"command"`
|
|
||||||
|
|
||||||
// Used in the move command
|
|
||||||
Bearing roveapi.Bearing `json:"bearing,omitempty"`
|
|
||||||
|
|
||||||
// Used in the broadcast command
|
|
||||||
Message []byte `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CommandStream is a list of commands to execute in order
|
|
||||||
type CommandStream []Command
|
|
|
@ -3,68 +3,65 @@ package rove
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
|
||||||
"github.com/mdiluz/rove/proto/roveapi"
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCommand_Move(t *testing.T) {
|
func TestCommand_Toggle(t *testing.T) {
|
||||||
world := NewWorld(8)
|
w := NewWorld(8)
|
||||||
a, err := world.SpawnRover()
|
a, err := w.SpawnRover()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
pos := maths.Vector{
|
|
||||||
X: 1.0,
|
|
||||||
Y: 2.0,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = world.WarpRover(a, pos)
|
r, err := w.GetRover(a)
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.SailPosition_SolarCharging, r.SailPosition)
|
||||||
|
|
||||||
// Try the move command
|
err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_toggle})
|
||||||
moveCommand := Command{Command: roveapi.CommandType_move, Bearing: roveapi.Bearing_North}
|
assert.NoError(t, err)
|
||||||
assert.NoError(t, world.Enqueue(a, moveCommand), "Failed to execute move command")
|
w.EnqueueAllIncoming()
|
||||||
|
w.Tick()
|
||||||
|
|
||||||
// Tick the world
|
r, err = w.GetRover(a)
|
||||||
world.EnqueueAllIncoming()
|
assert.NoError(t, err)
|
||||||
world.ExecuteCommandQueues()
|
assert.Equal(t, roveapi.SailPosition_CatchingWind, r.SailPosition)
|
||||||
|
|
||||||
newPos, err := world.RoverPosition(a)
|
err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_toggle})
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err)
|
||||||
pos.Add(maths.Vector{X: 0.0, Y: 1})
|
w.EnqueueAllIncoming()
|
||||||
assert.Equal(t, pos, newPos, "Failed to correctly set position for rover")
|
w.Tick()
|
||||||
|
|
||||||
|
r, err = w.GetRover(a)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.SailPosition_SolarCharging, r.SailPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommand_Recharge(t *testing.T) {
|
func TestCommand_Turn(t *testing.T) {
|
||||||
world := NewWorld(8)
|
w := NewWorld(8)
|
||||||
a, err := world.SpawnRover()
|
a, err := w.SpawnRover()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
pos := maths.Vector{
|
|
||||||
X: 1.0,
|
|
||||||
Y: 2.0,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = world.WarpRover(a, pos)
|
err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Turn: roveapi.Bearing_NorthWest})
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err)
|
||||||
|
w.EnqueueAllIncoming()
|
||||||
// Move to use up some charge
|
w.Tick()
|
||||||
moveCommand := Command{Command: roveapi.CommandType_move, Bearing: roveapi.Bearing_North}
|
|
||||||
assert.NoError(t, world.Enqueue(a, moveCommand), "Failed to queue move command")
|
|
||||||
|
|
||||||
// Tick the world
|
|
||||||
world.EnqueueAllIncoming()
|
|
||||||
world.ExecuteCommandQueues()
|
|
||||||
|
|
||||||
rover, _ := world.GetRover(a)
|
|
||||||
assert.Equal(t, rover.MaximumCharge-1, rover.Charge)
|
|
||||||
|
|
||||||
chargeCommand := Command{Command: roveapi.CommandType_recharge}
|
|
||||||
assert.NoError(t, world.Enqueue(a, chargeCommand), "Failed to queue recharge command")
|
|
||||||
|
|
||||||
// Tick the world
|
|
||||||
world.EnqueueAllIncoming()
|
|
||||||
world.ExecuteCommandQueues()
|
|
||||||
|
|
||||||
rover, _ = world.GetRover(a)
|
|
||||||
assert.Equal(t, rover.MaximumCharge, rover.Charge)
|
|
||||||
|
|
||||||
|
r, err := w.GetRover(a)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.Bearing_NorthWest, r.Bearing)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCommand_Stash(t *testing.T) {
|
||||||
|
// TODO: Test the stash command
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCommand_Repair(t *testing.T) {
|
||||||
|
// TODO: Test the repair command
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCommand_Broadcast(t *testing.T) {
|
||||||
|
// TODO: Test the stash command
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCommand_Invalid(t *testing.T) {
|
||||||
|
// TODO: Test an invalid command
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
// Object represents an object in the world
|
// Object represents an object in the world
|
||||||
type Object struct {
|
type Object struct {
|
||||||
// The type of the object
|
// The type of the object
|
||||||
Type roveapi.Object `json:"type"`
|
Type roveapi.Object
|
||||||
|
|
||||||
// Data is an internal type used for certain types of object
|
// Data is an internal type used for certain types of object
|
||||||
Data []byte `json:"data"`
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBlocking checks if an object is a blocking object
|
// IsBlocking checks if an object is a blocking object
|
||||||
|
|
|
@ -10,59 +10,71 @@ import (
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RoverLogEntry describes a single log entry for the rover
|
// RoverLogEntry describes a single log entry for the rover
|
||||||
type RoverLogEntry struct {
|
type RoverLogEntry struct {
|
||||||
// Time is the timestamp of the entry
|
// Time is the timestamp of the entry
|
||||||
Time time.Time `json:"time"`
|
Time time.Time
|
||||||
|
|
||||||
// Text contains the information in this log entry
|
// Text contains the information in this log entry
|
||||||
Text string `json:"text"`
|
Text string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rover describes a single rover in the world
|
// Rover describes a single rover in the world
|
||||||
type Rover struct {
|
type Rover struct {
|
||||||
// Unique name of this rover
|
// Unique name of this rover
|
||||||
Name string `json:"name"`
|
Name string
|
||||||
|
|
||||||
// Pos represents where this rover is in the world
|
// Pos represents where this rover is in the world
|
||||||
Pos maths.Vector `json:"pos"`
|
Pos maths.Vector
|
||||||
|
|
||||||
|
// Bearing is the current direction the rover is facing
|
||||||
|
Bearing roveapi.Bearing
|
||||||
|
|
||||||
// Range represents the distance the unit's radar can see
|
// Range represents the distance the unit's radar can see
|
||||||
Range int `json:"range"`
|
Range int
|
||||||
|
|
||||||
// Inventory represents any items the rover is carrying
|
// Inventory represents any items the rover is carrying
|
||||||
Inventory []Object `json:"inventory"`
|
Inventory []Object
|
||||||
|
|
||||||
// Capacity is the maximum number of inventory items
|
// Capacity is the maximum number of inventory items
|
||||||
Capacity int `json:"capacity"`
|
Capacity int
|
||||||
|
|
||||||
// Integrity represents current rover health
|
// Integrity represents current rover health
|
||||||
Integrity int `json:"integrity"`
|
Integrity int
|
||||||
|
|
||||||
// MaximumIntegrity is the full integrity of the rover
|
// MaximumIntegrity is the full integrity of the rover
|
||||||
MaximumIntegrity int `json:"maximum-integrity"`
|
MaximumIntegrity int
|
||||||
|
|
||||||
// Charge is the amount of energy the rover has
|
// Charge is the amount of energy the rover has
|
||||||
Charge int `json:"charge"`
|
Charge int
|
||||||
|
|
||||||
// MaximumCharge is the maximum charge able to be stored
|
// MaximumCharge is the maximum charge able to be stored
|
||||||
MaximumCharge int `json:"maximum-Charge"`
|
MaximumCharge int
|
||||||
|
|
||||||
|
// SailPosition is the current position of the sails
|
||||||
|
SailPosition roveapi.SailPosition
|
||||||
|
|
||||||
|
// Current number of ticks in this move, used for sailing speeds
|
||||||
|
MoveTicks int
|
||||||
|
|
||||||
// Logs Stores log of information
|
// Logs Stores log of information
|
||||||
Logs []RoverLogEntry `json:"logs"`
|
Logs []RoverLogEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultRover returns a default rover object with default settings
|
// DefaultRover returns a default rover object with default settings
|
||||||
func DefaultRover() Rover {
|
func DefaultRover() *Rover {
|
||||||
return Rover{
|
return &Rover{
|
||||||
Range: 4,
|
Range: 4,
|
||||||
Integrity: 10,
|
Integrity: 10,
|
||||||
MaximumIntegrity: 10,
|
MaximumIntegrity: 10,
|
||||||
Capacity: 10,
|
Capacity: 10,
|
||||||
Charge: 10,
|
Charge: 10,
|
||||||
MaximumCharge: 10,
|
MaximumCharge: 10,
|
||||||
|
Bearing: roveapi.Bearing_North,
|
||||||
|
SailPosition: roveapi.SailPosition_SolarCharging,
|
||||||
Name: GenerateRoverName(),
|
Name: GenerateRoverName(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,24 +10,35 @@ import (
|
||||||
"github.com/mdiluz/rove/proto/roveapi"
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
TicksPerNormalMove = 4
|
||||||
|
)
|
||||||
|
|
||||||
|
// CommandStream is a list of commands to execute in order
|
||||||
|
type CommandStream []*roveapi.Command
|
||||||
|
|
||||||
// World describes a self contained universe and everything in it
|
// World describes a self contained universe and everything in it
|
||||||
type World struct {
|
type World struct {
|
||||||
|
|
||||||
// TicksPerDay is the amount of ticks in a single day
|
// TicksPerDay is the amount of ticks in a single day
|
||||||
TicksPerDay int `json:"ticks-per-day"`
|
TicksPerDay int
|
||||||
|
|
||||||
// Current number of ticks from the start
|
// Current number of ticks from the start
|
||||||
CurrentTicks int `json:"current-ticks"`
|
CurrentTicks int
|
||||||
|
|
||||||
// Rovers is a id->data map of all the rovers in the game
|
// Rovers is a id->data map of all the rovers in the game
|
||||||
Rovers map[string]Rover `json:"rovers"`
|
Rovers map[string]*Rover
|
||||||
|
|
||||||
// Atlas represends the world map of chunks and tiles
|
// Atlas represends the world map of chunks and tiles
|
||||||
Atlas Atlas `json:"atlas"`
|
Atlas Atlas
|
||||||
|
|
||||||
|
// Wind is the current wind direction
|
||||||
|
Wind roveapi.Bearing
|
||||||
|
|
||||||
// Commands is the set of currently executing command streams per rover
|
// Commands is the set of currently executing command streams per rover
|
||||||
CommandQueue map[string]CommandStream `json:"commands"`
|
CommandQueue map[string]CommandStream
|
||||||
// Incoming represents the set of commands to add to the queue at the end of the current tick
|
// Incoming represents the set of commands to add to the queue at the end of the current tick
|
||||||
CommandIncoming map[string]CommandStream `json:"incoming"`
|
CommandIncoming map[string]CommandStream
|
||||||
|
|
||||||
// Mutex to lock around all world operations
|
// Mutex to lock around all world operations
|
||||||
worldMutex sync.RWMutex
|
worldMutex sync.RWMutex
|
||||||
|
@ -38,7 +49,7 @@ type World struct {
|
||||||
// NewWorld creates a new world object
|
// NewWorld creates a new world object
|
||||||
func NewWorld(chunkSize int) *World {
|
func NewWorld(chunkSize int) *World {
|
||||||
return &World{
|
return &World{
|
||||||
Rovers: make(map[string]Rover),
|
Rovers: make(map[string]*Rover),
|
||||||
CommandQueue: make(map[string]CommandStream),
|
CommandQueue: make(map[string]CommandStream),
|
||||||
CommandIncoming: make(map[string]CommandStream),
|
CommandIncoming: make(map[string]CommandStream),
|
||||||
Atlas: NewChunkAtlas(chunkSize),
|
Atlas: NewChunkAtlas(chunkSize),
|
||||||
|
@ -91,7 +102,7 @@ func (w *World) GetRover(rover string) (Rover, error) {
|
||||||
if !ok {
|
if !ok {
|
||||||
return Rover{}, fmt.Errorf("Failed to find rover with name: %s", rover)
|
return Rover{}, fmt.Errorf("Failed to find rover with name: %s", rover)
|
||||||
}
|
}
|
||||||
return i, nil
|
return *i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoverRecharge charges up a rover
|
// RoverRecharge charges up a rover
|
||||||
|
@ -114,7 +125,6 @@ func (w *World) RoverRecharge(rover string) (int, error) {
|
||||||
i.Charge++
|
i.Charge++
|
||||||
i.AddLogEntryf("recharged to %d", i.Charge)
|
i.AddLogEntryf("recharged to %d", i.Charge)
|
||||||
}
|
}
|
||||||
w.Rovers[rover] = i
|
|
||||||
|
|
||||||
return i.Charge, nil
|
return i.Charge, nil
|
||||||
}
|
}
|
||||||
|
@ -149,7 +159,6 @@ func (w *World) RoverBroadcast(rover string, message []byte) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
i.AddLogEntryf("broadcasted %s", string(message))
|
i.AddLogEntryf("broadcasted %s", string(message))
|
||||||
w.Rovers[rover] = i
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +199,6 @@ func (w *World) SetRoverPosition(rover string, pos maths.Vector) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Pos = pos
|
i.Pos = pos
|
||||||
w.Rovers[rover] = i
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,12 +235,11 @@ func (w *World) WarpRover(rover string, pos maths.Vector) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
i.Pos = pos
|
i.Pos = pos
|
||||||
w.Rovers[rover] = i
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveRover attempts to move a rover in a specific direction
|
// TryMoveRover attempts to move a rover in a specific direction
|
||||||
func (w *World) MoveRover(rover string, b roveapi.Bearing) (maths.Vector, error) {
|
func (w *World) TryMoveRover(rover string, b roveapi.Bearing) (maths.Vector, error) {
|
||||||
w.worldMutex.Lock()
|
w.worldMutex.Lock()
|
||||||
defer w.worldMutex.Unlock()
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
@ -241,12 +248,6 @@ func (w *World) MoveRover(rover string, b roveapi.Bearing) (maths.Vector, error)
|
||||||
return maths.Vector{}, fmt.Errorf("no rover matching id")
|
return maths.Vector{}, fmt.Errorf("no rover matching id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the rover has energy
|
|
||||||
if i.Charge <= 0 {
|
|
||||||
return i.Pos, nil
|
|
||||||
}
|
|
||||||
i.Charge--
|
|
||||||
|
|
||||||
// Try the new move position
|
// Try the new move position
|
||||||
newPos := i.Pos.Added(maths.BearingToVector(b))
|
newPos := i.Pos.Added(maths.BearingToVector(b))
|
||||||
|
|
||||||
|
@ -256,17 +257,14 @@ func (w *World) MoveRover(rover string, b roveapi.Bearing) (maths.Vector, error)
|
||||||
i.AddLogEntryf("moved %s to %+v", b.String(), newPos)
|
i.AddLogEntryf("moved %s to %+v", b.String(), newPos)
|
||||||
// Perform the move
|
// Perform the move
|
||||||
i.Pos = newPos
|
i.Pos = newPos
|
||||||
w.Rovers[rover] = i
|
|
||||||
} else {
|
} else {
|
||||||
// If it is a blocking tile, reduce the rover integrity
|
// If it is a blocking tile, reduce the rover integrity
|
||||||
i.AddLogEntryf("tried to move %s to %+v", b.String(), newPos)
|
i.AddLogEntryf("tried to move %s to %+v", b.String(), newPos)
|
||||||
i.Integrity = i.Integrity - 1
|
i.Integrity = i.Integrity - 1
|
||||||
i.AddLogEntryf("had a collision, new integrity %d", i.Integrity)
|
i.AddLogEntryf("had a collision, new integrity %d", i.Integrity)
|
||||||
if i.Integrity == 0 {
|
// TODO: The rover needs to be left dormant with the player
|
||||||
// TODO: The rover needs to be left dormant with the player
|
//if i.Integrity == 0 {
|
||||||
} else {
|
//}
|
||||||
w.Rovers[rover] = i
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i.Pos, nil
|
return i.Pos, nil
|
||||||
|
@ -300,11 +298,72 @@ func (w *World) RoverStash(rover string) (roveapi.Object, error) {
|
||||||
|
|
||||||
r.AddLogEntryf("stashed %c", obj.Type)
|
r.AddLogEntryf("stashed %c", obj.Type)
|
||||||
r.Inventory = append(r.Inventory, obj)
|
r.Inventory = append(r.Inventory, obj)
|
||||||
w.Rovers[rover] = r
|
|
||||||
w.Atlas.SetObject(r.Pos, Object{Type: roveapi.Object_ObjectUnknown})
|
w.Atlas.SetObject(r.Pos, Object{Type: roveapi.Object_ObjectUnknown})
|
||||||
return obj.Type, nil
|
return obj.Type, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RoverToggle will toggle the sail position
|
||||||
|
func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) {
|
||||||
|
w.worldMutex.Lock()
|
||||||
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
r, ok := w.Rovers[rover]
|
||||||
|
if !ok {
|
||||||
|
return roveapi.SailPosition_UnknownSailPosition, fmt.Errorf("no rover matching id")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap the sail position
|
||||||
|
switch r.SailPosition {
|
||||||
|
case roveapi.SailPosition_CatchingWind:
|
||||||
|
r.SailPosition = roveapi.SailPosition_SolarCharging
|
||||||
|
case roveapi.SailPosition_SolarCharging:
|
||||||
|
r.SailPosition = roveapi.SailPosition_CatchingWind
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the movement ticks
|
||||||
|
r.MoveTicks = 0
|
||||||
|
|
||||||
|
return r.SailPosition, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RoverTurn will turn the rover
|
||||||
|
func (w *World) RoverTurn(rover string, bearing roveapi.Bearing) (roveapi.Bearing, error) {
|
||||||
|
w.worldMutex.Lock()
|
||||||
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
r, ok := w.Rovers[rover]
|
||||||
|
if !ok {
|
||||||
|
return roveapi.Bearing_BearingUnknown, fmt.Errorf("no rover matching id")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the new bearing
|
||||||
|
r.Bearing = bearing
|
||||||
|
// Reset the movement ticks
|
||||||
|
r.MoveTicks = 0
|
||||||
|
|
||||||
|
return r.Bearing, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RoverRepair will turn the rover
|
||||||
|
func (w *World) RoverRepair(rover string) (int, error) {
|
||||||
|
w.worldMutex.Lock()
|
||||||
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
r, ok := w.Rovers[rover]
|
||||||
|
if !ok {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.Integrity, nil
|
||||||
|
}
|
||||||
|
|
||||||
// RadarFromRover can be used to query what a rover can currently see
|
// RadarFromRover can be used to query what a rover can currently see
|
||||||
func (w *World) RadarFromRover(rover string) (radar []roveapi.Tile, objs []roveapi.Object, err error) {
|
func (w *World) RadarFromRover(rover string) (radar []roveapi.Tile, objs []roveapi.Object, err error) {
|
||||||
w.worldMutex.RLock()
|
w.worldMutex.RLock()
|
||||||
|
@ -364,7 +423,7 @@ func (w *World) RadarFromRover(rover string) (radar []roveapi.Tile, objs []rovea
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoverCommands returns current commands for the given rover
|
// RoverCommands returns current commands for the given rover
|
||||||
func (w *World) RoverCommands(rover string) (incoming []Command, queued []Command) {
|
func (w *World) RoverCommands(rover string) (incoming CommandStream, queued CommandStream) {
|
||||||
if c, ok := w.CommandIncoming[rover]; ok {
|
if c, ok := w.CommandIncoming[rover]; ok {
|
||||||
incoming = c
|
incoming = c
|
||||||
}
|
}
|
||||||
|
@ -375,27 +434,27 @@ func (w *World) RoverCommands(rover string) (incoming []Command, queued []Comman
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enqueue will queue the commands given
|
// Enqueue will queue the commands given
|
||||||
func (w *World) Enqueue(rover string, commands ...Command) error {
|
func (w *World) Enqueue(rover string, commands ...*roveapi.Command) error {
|
||||||
|
|
||||||
// First validate the commands
|
// First validate the commands
|
||||||
for _, c := range commands {
|
for _, c := range commands {
|
||||||
switch c.Command {
|
switch c.Command {
|
||||||
case roveapi.CommandType_move:
|
|
||||||
if c.Bearing == roveapi.Bearing_BearingUnknown {
|
|
||||||
return fmt.Errorf("bearing must be valid")
|
|
||||||
}
|
|
||||||
case roveapi.CommandType_broadcast:
|
case roveapi.CommandType_broadcast:
|
||||||
if len(c.Message) > 3 {
|
if len(c.GetBroadcast()) > 3 {
|
||||||
return fmt.Errorf("too many characters in message (limit 3): %d", len(c.Message))
|
return fmt.Errorf("too many characters in message (limit 3): %d", len(c.GetBroadcast()))
|
||||||
}
|
}
|
||||||
for _, b := range c.Message {
|
for _, b := range c.GetBroadcast() {
|
||||||
if b < 37 || b > 126 {
|
if b < 37 || b > 126 {
|
||||||
return fmt.Errorf("invalid message character: %c", b)
|
return fmt.Errorf("invalid message character: %c", b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case roveapi.CommandType_turn:
|
||||||
|
if c.GetTurn() == roveapi.Bearing_BearingUnknown {
|
||||||
|
return fmt.Errorf("turn command given unknown bearing")
|
||||||
|
}
|
||||||
|
case roveapi.CommandType_toggle:
|
||||||
case roveapi.CommandType_stash:
|
case roveapi.CommandType_stash:
|
||||||
case roveapi.CommandType_repair:
|
case roveapi.CommandType_repair:
|
||||||
case roveapi.CommandType_recharge:
|
|
||||||
// Nothing to verify
|
// Nothing to verify
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown command: %s", c.Command)
|
return fmt.Errorf("unknown command: %s", c.Command)
|
||||||
|
@ -406,7 +465,6 @@ func (w *World) Enqueue(rover string, commands ...Command) error {
|
||||||
w.cmdMutex.Lock()
|
w.cmdMutex.Lock()
|
||||||
defer w.cmdMutex.Unlock()
|
defer w.cmdMutex.Unlock()
|
||||||
|
|
||||||
// Override the incoming command set
|
|
||||||
w.CommandIncoming[rover] = commands
|
w.CommandIncoming[rover] = commands
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -423,24 +481,24 @@ func (w *World) EnqueueAllIncoming() {
|
||||||
w.CommandIncoming = make(map[string]CommandStream)
|
w.CommandIncoming = make(map[string]CommandStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteCommandQueues will execute any commands in the current command queue
|
// Tick will execute any commands in the current command queue and tick the world
|
||||||
func (w *World) ExecuteCommandQueues() {
|
func (w *World) Tick() {
|
||||||
w.cmdMutex.Lock()
|
w.cmdMutex.Lock()
|
||||||
defer w.cmdMutex.Unlock()
|
defer w.cmdMutex.Unlock()
|
||||||
|
|
||||||
// Iterate through all the current commands
|
// Iterate through all the current commands
|
||||||
for rover, cmds := range w.CommandQueue {
|
for rover, cmds := range w.CommandQueue {
|
||||||
if len(cmds) != 0 {
|
if len(cmds) != 0 {
|
||||||
// Extract the first command in the queue
|
|
||||||
c := cmds[0]
|
|
||||||
w.CommandQueue[rover] = cmds[1:]
|
|
||||||
|
|
||||||
// Execute the command
|
// Execute the command
|
||||||
if err := w.ExecuteCommand(&c, rover); err != nil {
|
if err := w.ExecuteCommand(cmds[0], rover); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
// TODO: Report this error somehow
|
// TODO: Report this error somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract the first command in the queue
|
||||||
|
w.CommandQueue[rover] = cmds[1:]
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Clean out the empty entry
|
// Clean out the empty entry
|
||||||
delete(w.CommandQueue, rover)
|
delete(w.CommandQueue, rover)
|
||||||
|
@ -450,46 +508,97 @@ func (w *World) ExecuteCommandQueues() {
|
||||||
// Add any incoming commands from this tick and clear that queue
|
// Add any incoming commands from this tick and clear that queue
|
||||||
w.EnqueueAllIncoming()
|
w.EnqueueAllIncoming()
|
||||||
|
|
||||||
|
// Change the wind every day
|
||||||
|
if (w.CurrentTicks % w.TicksPerDay) == 0 {
|
||||||
|
w.Wind = roveapi.Bearing((rand.Int() % 8) + 1) // Random cardinal bearing
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move all the rovers based on current wind and sails
|
||||||
|
for n, r := range w.Rovers {
|
||||||
|
// Skip if we're not catching the wind
|
||||||
|
if r.SailPosition != roveapi.SailPosition_CatchingWind {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment the current move ticks
|
||||||
|
r.MoveTicks++
|
||||||
|
|
||||||
|
// Get the difference between the two bearings
|
||||||
|
// Normalise, we don't care about clockwise/anticlockwise
|
||||||
|
diff := maths.Abs(int(w.Wind - r.Bearing))
|
||||||
|
if diff > 4 {
|
||||||
|
diff = 8 - diff
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the travel "ticks"
|
||||||
|
var ticksToMove int
|
||||||
|
switch diff {
|
||||||
|
case 0:
|
||||||
|
// Going with the wind, travel at base speed of once every 4 ticks
|
||||||
|
ticksToMove = TicksPerNormalMove
|
||||||
|
case 1:
|
||||||
|
// At a slight angle, we can go a little faster
|
||||||
|
ticksToMove = TicksPerNormalMove / 2
|
||||||
|
case 2:
|
||||||
|
// Perpendicular to wind, max speed
|
||||||
|
ticksToMove = 1
|
||||||
|
case 3:
|
||||||
|
// Heading at 45 degrees into the wind, back to min speed
|
||||||
|
ticksToMove = TicksPerNormalMove
|
||||||
|
case 4:
|
||||||
|
// Heading durectly into the wind, no movement at all
|
||||||
|
default:
|
||||||
|
log.Fatalf("bearing difference of %d should be impossible", diff)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we've incremented over the current move ticks on the rover, we can try and make the move
|
||||||
|
if ticksToMove != 0 && r.MoveTicks >= ticksToMove {
|
||||||
|
_, err := w.TryMoveRover(n, r.Bearing)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
// TODO: Report this error somehow
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the move ticks
|
||||||
|
r.MoveTicks = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Print(ticksToMove)
|
||||||
|
}
|
||||||
|
|
||||||
// Increment the current tick count
|
// Increment the current tick count
|
||||||
w.CurrentTicks++
|
w.CurrentTicks++
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteCommand will execute a single command
|
// ExecuteCommand will execute a single command
|
||||||
func (w *World) ExecuteCommand(c *Command, rover string) (err error) {
|
func (w *World) ExecuteCommand(c *roveapi.Command, rover string) (err error) {
|
||||||
log.Printf("Executing command: %+v for %s\n", *c, rover)
|
log.Printf("Executing command: %+v for %s\n", c.Command, rover)
|
||||||
|
|
||||||
switch c.Command {
|
switch c.Command {
|
||||||
case roveapi.CommandType_move:
|
case roveapi.CommandType_toggle:
|
||||||
if _, err := w.MoveRover(rover, c.Bearing); err != nil {
|
if _, err := w.RoverToggle(rover); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case roveapi.CommandType_stash:
|
case roveapi.CommandType_stash:
|
||||||
if _, err := w.RoverStash(rover); err != nil {
|
if _, err := w.RoverStash(rover); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case roveapi.CommandType_repair:
|
case roveapi.CommandType_repair:
|
||||||
r, err := w.GetRover(rover)
|
if _, err := w.RoverRepair(rover); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// 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)
|
|
||||||
w.Rovers[rover] = r
|
|
||||||
}
|
|
||||||
case roveapi.CommandType_recharge:
|
|
||||||
_, err := w.RoverRecharge(rover)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case roveapi.CommandType_broadcast:
|
case roveapi.CommandType_broadcast:
|
||||||
if err := w.RoverBroadcast(rover, c.Message); err != nil {
|
if err := w.RoverBroadcast(rover, c.GetBroadcast()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case roveapi.CommandType_turn:
|
||||||
|
if _, err := w.RoverTurn(rover, c.GetTurn()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown command: %s", c.Command)
|
return fmt.Errorf("unknown command: %s", c.Command)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,25 +78,20 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
|
||||||
assert.Equal(t, pos, newPos, "Failed to correctly set position for rover")
|
assert.Equal(t, pos, newPos, "Failed to correctly set position for rover")
|
||||||
|
|
||||||
b := roveapi.Bearing_North
|
b := roveapi.Bearing_North
|
||||||
newPos, err = world.MoveRover(a, b)
|
newPos, err = world.TryMoveRover(a, b)
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err, "Failed to set position for rover")
|
||||||
pos.Add(maths.Vector{X: 0, Y: 1})
|
pos.Add(maths.Vector{X: 0, Y: 1})
|
||||||
assert.Equal(t, pos, newPos, "Failed to correctly move position for rover")
|
assert.Equal(t, pos, newPos, "Failed to correctly move position for rover")
|
||||||
|
|
||||||
rover, err := world.GetRover(a)
|
rover, err := world.GetRover(a)
|
||||||
assert.NoError(t, err, "Failed to get rover information")
|
assert.NoError(t, err, "Failed to get rover information")
|
||||||
assert.Equal(t, rover.MaximumCharge-1, rover.Charge, "Rover should have lost charge for moving")
|
|
||||||
assert.Contains(t, rover.Logs[len(rover.Logs)-1].Text, "moved", "Rover logs should contain the move")
|
assert.Contains(t, rover.Logs[len(rover.Logs)-1].Text, "moved", "Rover logs should contain the move")
|
||||||
|
|
||||||
// Place a tile in front of the rover
|
// Place a tile in front of the rover
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0, Y: 2}, Object{Type: roveapi.Object_RockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0, Y: 2}, Object{Type: roveapi.Object_RockLarge})
|
||||||
newPos, err = world.MoveRover(a, b)
|
newPos, err = world.TryMoveRover(a, b)
|
||||||
assert.NoError(t, err, "Failed to move rover")
|
assert.NoError(t, err, "Failed to move rover")
|
||||||
assert.Equal(t, pos, newPos, "Failed to correctly not move position for rover into wall")
|
assert.Equal(t, pos, newPos, "Failed to correctly not move position for rover into wall")
|
||||||
|
|
||||||
rover, err = world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover information")
|
|
||||||
assert.Equal(t, rover.MaximumCharge-2, rover.Charge, "Rover should have lost charge for move attempt")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWorld_RadarFromRover(t *testing.T) {
|
func TestWorld_RadarFromRover(t *testing.T) {
|
||||||
|
@ -224,7 +219,7 @@ func TestWorld_RoverDamage(t *testing.T) {
|
||||||
|
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge})
|
||||||
|
|
||||||
vec, err := world.MoveRover(a, roveapi.Bearing_North)
|
vec, err := world.TryMoveRover(a, roveapi.Bearing_North)
|
||||||
assert.NoError(t, err, "Failed to move rover")
|
assert.NoError(t, err, "Failed to move rover")
|
||||||
assert.Equal(t, pos, vec, "Rover managed to move into large rock")
|
assert.Equal(t, pos, vec, "Rover managed to move into large rock")
|
||||||
|
|
||||||
|
@ -261,7 +256,7 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge})
|
||||||
|
|
||||||
// Try and bump into the rock
|
// Try and bump into the rock
|
||||||
vec, err := world.MoveRover(a, roveapi.Bearing_North)
|
vec, err := world.TryMoveRover(a, roveapi.Bearing_North)
|
||||||
assert.NoError(t, err, "Failed to move rover")
|
assert.NoError(t, err, "Failed to move rover")
|
||||||
assert.Equal(t, pos, vec, "Rover managed to move into large rock")
|
assert.Equal(t, pos, vec, "Rover managed to move into large rock")
|
||||||
|
|
||||||
|
@ -269,7 +264,7 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
assert.NoError(t, err, "couldn't get rover info")
|
||||||
assert.Equal(t, originalInfo.Integrity-1, newinfo.Integrity, "rover should have lost integrity")
|
assert.Equal(t, originalInfo.Integrity-1, newinfo.Integrity, "rover should have lost integrity")
|
||||||
|
|
||||||
err = world.ExecuteCommand(&Command{Command: roveapi.CommandType_repair}, a)
|
err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a)
|
||||||
assert.NoError(t, err, "Failed to repair rover")
|
assert.NoError(t, err, "Failed to repair rover")
|
||||||
|
|
||||||
newinfo, err = world.GetRover(a)
|
newinfo, err = world.GetRover(a)
|
||||||
|
@ -283,7 +278,7 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
assert.NoError(t, err, "Failed to stash")
|
assert.NoError(t, err, "Failed to stash")
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
||||||
|
|
||||||
err = world.ExecuteCommand(&Command{Command: roveapi.CommandType_repair}, a)
|
err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a)
|
||||||
assert.NoError(t, err, "Failed to repair rover")
|
assert.NoError(t, err, "Failed to repair rover")
|
||||||
|
|
||||||
newinfo, err = world.GetRover(a)
|
newinfo, err = world.GetRover(a)
|
||||||
|
@ -291,39 +286,6 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have kept the same integrity")
|
assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have kept the same integrity")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWorld_Charge(t *testing.T) {
|
|
||||||
world := NewWorld(4)
|
|
||||||
a, err := world.SpawnRover()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
// Get the rover information
|
|
||||||
rover, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover information")
|
|
||||||
assert.Equal(t, rover.MaximumCharge, rover.Charge, "Rover should start with maximum charge")
|
|
||||||
|
|
||||||
// Use up all the charge
|
|
||||||
for i := 0; i < rover.MaximumCharge; i++ {
|
|
||||||
// Get the initial position
|
|
||||||
initialPos, err := world.RoverPosition(a)
|
|
||||||
assert.NoError(t, err, "Failed to get position for rover")
|
|
||||||
|
|
||||||
// Ensure the path ahead is empty
|
|
||||||
world.Atlas.SetTile(initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), roveapi.Tile_Rock)
|
|
||||||
world.Atlas.SetObject(initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), Object{Type: roveapi.Object_ObjectUnknown})
|
|
||||||
|
|
||||||
// Try and move north (along unblocked path)
|
|
||||||
newPos, err := world.MoveRover(a, roveapi.Bearing_North)
|
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
|
||||||
assert.Equal(t, initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), newPos, "Failed to correctly move position for rover")
|
|
||||||
|
|
||||||
// Ensure rover lost charge
|
|
||||||
rover, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover information")
|
|
||||||
assert.Equal(t, rover.MaximumCharge-(i+1), rover.Charge, "Rover should have lost charge")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWorld_Daytime(t *testing.T) {
|
func TestWorld_Daytime(t *testing.T) {
|
||||||
world := NewWorld(1)
|
world := NewWorld(1)
|
||||||
|
|
||||||
|
@ -343,7 +305,7 @@ func TestWorld_Daytime(t *testing.T) {
|
||||||
// Loop for half the day
|
// Loop for half the day
|
||||||
for i := 0; i < world.TicksPerDay/2; i++ {
|
for i := 0; i < world.TicksPerDay/2; i++ {
|
||||||
assert.True(t, world.Daytime())
|
assert.True(t, world.Daytime())
|
||||||
world.ExecuteCommandQueues()
|
world.Tick()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove rover charge again
|
// Remove rover charge again
|
||||||
|
@ -359,7 +321,7 @@ func TestWorld_Daytime(t *testing.T) {
|
||||||
// Loop for half the day
|
// Loop for half the day
|
||||||
for i := 0; i < world.TicksPerDay/2; i++ {
|
for i := 0; i < world.TicksPerDay/2; i++ {
|
||||||
assert.False(t, world.Daytime())
|
assert.False(t, world.Daytime())
|
||||||
world.ExecuteCommandQueues()
|
world.Tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,3 +388,81 @@ func TestWorld_Broadcast(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "HJK", "Rover A should have logged it's broadcast")
|
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "HJK", "Rover A should have logged it's broadcast")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWorld_Sailing(t *testing.T) {
|
||||||
|
world := NewWorld(8)
|
||||||
|
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()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// Warp the rover to 0,0 after clearing it
|
||||||
|
world.Atlas.SetObject(maths.Vector{X: 0, Y: 0}, Object{Type: roveapi.Object_ObjectUnknown})
|
||||||
|
assert.NoError(t, world.WarpRover(name, maths.Vector{X: 0, Y: 0}))
|
||||||
|
|
||||||
|
s, err := world.RoverToggle(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.SailPosition_CatchingWind, s)
|
||||||
|
|
||||||
|
b, err := world.RoverTurn(name, roveapi.Bearing_North)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.Bearing_North, b)
|
||||||
|
|
||||||
|
// Clear the space to the north
|
||||||
|
world.Atlas.SetObject(maths.Vector{X: 0, Y: 1}, Object{Type: roveapi.Object_ObjectUnknown})
|
||||||
|
|
||||||
|
// Tick the world and check we've moved not moved
|
||||||
|
world.Tick()
|
||||||
|
info, err := world.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, maths.Vector{Y: 0}, info.Pos)
|
||||||
|
|
||||||
|
// Loop a few more times
|
||||||
|
for i := 0; i < TicksPerNormalMove-2; i++ {
|
||||||
|
world.Tick()
|
||||||
|
info, err := world.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, maths.Vector{Y: 0}, info.Pos)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now check we've moved (after the TicksPerNormalMove number of ticks)
|
||||||
|
world.Tick()
|
||||||
|
info, err = world.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, maths.Vector{Y: 1}, info.Pos)
|
||||||
|
|
||||||
|
// Reset the world ticks back to stop any wind changes etc.
|
||||||
|
world.CurrentTicks = 1
|
||||||
|
|
||||||
|
// Face the rover south, into the wind
|
||||||
|
b, err = world.RoverTurn(name, roveapi.Bearing_South)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.Bearing_South, b)
|
||||||
|
|
||||||
|
// Tick a bunch, we should never move
|
||||||
|
for i := 0; i < TicksPerNormalMove*2; i++ {
|
||||||
|
world.Tick()
|
||||||
|
info, err := world.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, maths.Vector{Y: 1}, info.Pos)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the world ticks back to stop any wind changes etc.
|
||||||
|
world.CurrentTicks = 1
|
||||||
|
world.Wind = roveapi.Bearing_SouthEast // Set up a south easternly wind
|
||||||
|
|
||||||
|
// Turn the rover perpendicular
|
||||||
|
b, err = world.RoverTurn(name, roveapi.Bearing_NorthEast)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, roveapi.Bearing_NorthEast, b)
|
||||||
|
|
||||||
|
// Clear a space
|
||||||
|
world.Atlas.SetObject(maths.Vector{X: 1, Y: 2}, Object{Type: roveapi.Object_ObjectUnknown})
|
||||||
|
|
||||||
|
// Now check we've moved immediately
|
||||||
|
world.Tick()
|
||||||
|
info, err = world.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, maths.Vector{X: 1, Y: 2}, info.Pos)
|
||||||
|
}
|
||||||
|
|
|
@ -39,15 +39,15 @@ type CommandType int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CommandType_none CommandType = 0
|
CommandType_none CommandType = 0
|
||||||
// Move the rover in a direction, requires bearing
|
// Toggles the sails, either catching the wind, or charging from the sun
|
||||||
CommandType_move CommandType = 1
|
CommandType_toggle CommandType = 1
|
||||||
|
// Turns the rover in the specified bearing, requires data
|
||||||
|
CommandType_turn CommandType = 2
|
||||||
// Stashes item at current location in rover inventory
|
// Stashes item at current location in rover inventory
|
||||||
CommandType_stash CommandType = 2
|
CommandType_stash CommandType = 3
|
||||||
// Repairs the rover using an inventory object
|
// Repairs the rover using an inventory object
|
||||||
CommandType_repair CommandType = 3
|
CommandType_repair CommandType = 4
|
||||||
// Waits a tick to add more charge to the rover
|
// Broadcasts a message to nearby rovers, requires data
|
||||||
CommandType_recharge CommandType = 4
|
|
||||||
// Broadcasts a message to nearby rovers
|
|
||||||
CommandType_broadcast CommandType = 5
|
CommandType_broadcast CommandType = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -55,18 +55,18 @@ const (
|
||||||
var (
|
var (
|
||||||
CommandType_name = map[int32]string{
|
CommandType_name = map[int32]string{
|
||||||
0: "none",
|
0: "none",
|
||||||
1: "move",
|
1: "toggle",
|
||||||
2: "stash",
|
2: "turn",
|
||||||
3: "repair",
|
3: "stash",
|
||||||
4: "recharge",
|
4: "repair",
|
||||||
5: "broadcast",
|
5: "broadcast",
|
||||||
}
|
}
|
||||||
CommandType_value = map[string]int32{
|
CommandType_value = map[string]int32{
|
||||||
"none": 0,
|
"none": 0,
|
||||||
"move": 1,
|
"toggle": 1,
|
||||||
"stash": 2,
|
"turn": 2,
|
||||||
"repair": 3,
|
"stash": 3,
|
||||||
"recharge": 4,
|
"repair": 4,
|
||||||
"broadcast": 5,
|
"broadcast": 5,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -98,15 +98,20 @@ func (CommandType) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{0}
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bearing represents a compass direction
|
||||||
type Bearing int32
|
type Bearing int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// BearingUnknown an unknown invalid bearing
|
// BearingUnknown an unknown invalid bearing
|
||||||
Bearing_BearingUnknown Bearing = 0
|
Bearing_BearingUnknown Bearing = 0
|
||||||
Bearing_North Bearing = 1
|
Bearing_North Bearing = 1
|
||||||
Bearing_East Bearing = 2
|
Bearing_NorthEast Bearing = 2
|
||||||
Bearing_South Bearing = 3
|
Bearing_East Bearing = 3
|
||||||
Bearing_West Bearing = 4
|
Bearing_SouthEast Bearing = 4
|
||||||
|
Bearing_South Bearing = 5
|
||||||
|
Bearing_SouthWest Bearing = 6
|
||||||
|
Bearing_West Bearing = 7
|
||||||
|
Bearing_NorthWest Bearing = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for Bearing.
|
// Enum value maps for Bearing.
|
||||||
|
@ -114,16 +119,24 @@ var (
|
||||||
Bearing_name = map[int32]string{
|
Bearing_name = map[int32]string{
|
||||||
0: "BearingUnknown",
|
0: "BearingUnknown",
|
||||||
1: "North",
|
1: "North",
|
||||||
2: "East",
|
2: "NorthEast",
|
||||||
3: "South",
|
3: "East",
|
||||||
4: "West",
|
4: "SouthEast",
|
||||||
|
5: "South",
|
||||||
|
6: "SouthWest",
|
||||||
|
7: "West",
|
||||||
|
8: "NorthWest",
|
||||||
}
|
}
|
||||||
Bearing_value = map[string]int32{
|
Bearing_value = map[string]int32{
|
||||||
"BearingUnknown": 0,
|
"BearingUnknown": 0,
|
||||||
"North": 1,
|
"North": 1,
|
||||||
"East": 2,
|
"NorthEast": 2,
|
||||||
"South": 3,
|
"East": 3,
|
||||||
"West": 4,
|
"SouthEast": 4,
|
||||||
|
"South": 5,
|
||||||
|
"SouthWest": 6,
|
||||||
|
"West": 7,
|
||||||
|
"NorthWest": 8,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -271,6 +284,58 @@ func (Tile) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3}
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SailPosition represents the position of the sola sail
|
||||||
|
type SailPosition int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
SailPosition_UnknownSailPosition SailPosition = 0
|
||||||
|
// CatchingWind means the sail is catching the wind and moving the rover
|
||||||
|
SailPosition_CatchingWind SailPosition = 1
|
||||||
|
// SolarCharging means the sail is facing the sun and charging
|
||||||
|
SailPosition_SolarCharging SailPosition = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for SailPosition.
|
||||||
|
var (
|
||||||
|
SailPosition_name = map[int32]string{
|
||||||
|
0: "UnknownSailPosition",
|
||||||
|
1: "CatchingWind",
|
||||||
|
2: "SolarCharging",
|
||||||
|
}
|
||||||
|
SailPosition_value = map[string]int32{
|
||||||
|
"UnknownSailPosition": 0,
|
||||||
|
"CatchingWind": 1,
|
||||||
|
"SolarCharging": 2,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x SailPosition) Enum() *SailPosition {
|
||||||
|
p := new(SailPosition)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x SailPosition) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (SailPosition) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_roveapi_roveapi_proto_enumTypes[4].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (SailPosition) Type() protoreflect.EnumType {
|
||||||
|
return &file_roveapi_roveapi_proto_enumTypes[4]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x SailPosition) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SailPosition.Descriptor instead.
|
||||||
|
func (SailPosition) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
// ServerStatusRequest is an empty placeholder
|
// ServerStatusRequest is an empty placeholder
|
||||||
type ServerStatusRequest struct {
|
type ServerStatusRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
|
@ -559,10 +624,11 @@ type Command struct {
|
||||||
|
|
||||||
// The command type
|
// The command type
|
||||||
Command CommandType `protobuf:"varint,1,opt,name=command,proto3,enum=roveapi.CommandType" json:"command,omitempty"`
|
Command CommandType `protobuf:"varint,1,opt,name=command,proto3,enum=roveapi.CommandType" json:"command,omitempty"`
|
||||||
// Types that are assignable to Data:
|
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
||||||
// *Command_Bearing
|
// maximum of three characters
|
||||||
// *Command_Message
|
Broadcast []byte `protobuf:"bytes,2,opt,name=broadcast,proto3" json:"broadcast,omitempty"`
|
||||||
Data isCommand_Data `protobuf_oneof:"data"`
|
// The bearing for the rover to turn to
|
||||||
|
Turn Bearing `protobuf:"varint,3,opt,name=turn,proto3,enum=roveapi.Bearing" json:"turn,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) Reset() {
|
func (x *Command) Reset() {
|
||||||
|
@ -604,48 +670,20 @@ func (x *Command) GetCommand() CommandType {
|
||||||
return CommandType_none
|
return CommandType_none
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Command) GetData() isCommand_Data {
|
func (x *Command) GetBroadcast() []byte {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.Data
|
return x.Broadcast
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) GetBearing() Bearing {
|
func (x *Command) GetTurn() Bearing {
|
||||||
if x, ok := x.GetData().(*Command_Bearing); ok {
|
if x != nil {
|
||||||
return x.Bearing
|
return x.Turn
|
||||||
}
|
}
|
||||||
return Bearing_BearingUnknown
|
return Bearing_BearingUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) GetMessage() []byte {
|
|
||||||
if x, ok := x.GetData().(*Command_Message); ok {
|
|
||||||
return x.Message
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type isCommand_Data interface {
|
|
||||||
isCommand_Data()
|
|
||||||
}
|
|
||||||
|
|
||||||
type Command_Bearing struct {
|
|
||||||
// A bearing
|
|
||||||
// Used with MOVE
|
|
||||||
Bearing Bearing `protobuf:"varint,2,opt,name=bearing,proto3,enum=roveapi.Bearing,oneof"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Command_Message struct {
|
|
||||||
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
|
||||||
// maximum of three characters
|
|
||||||
// Used with BROADCAST
|
|
||||||
Message []byte `protobuf:"bytes,3,opt,name=message,proto3,oneof"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Command_Bearing) isCommand_Data() {}
|
|
||||||
|
|
||||||
func (*Command_Message) isCommand_Data() {}
|
|
||||||
|
|
||||||
// CommandRequest describes a set of commands to be requested for the rover
|
// CommandRequest describes a set of commands to be requested for the rover
|
||||||
type CommandRequest struct {
|
type CommandRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
|
@ -1033,26 +1071,32 @@ type StatusResponse struct {
|
||||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
// Position of the rover in world coordinates
|
// Position of the rover in world coordinates
|
||||||
Position *Vector `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"`
|
Position *Vector `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"`
|
||||||
|
// The current direction of the rover
|
||||||
|
Bearing Bearing `protobuf:"varint,3,opt,name=bearing,proto3,enum=roveapi.Bearing" json:"bearing,omitempty"`
|
||||||
// The range of this rover's radar and broadcasting
|
// The range of this rover's radar and broadcasting
|
||||||
Range int32 `protobuf:"varint,3,opt,name=range,proto3" json:"range,omitempty"`
|
Range int32 `protobuf:"varint,4,opt,name=range,proto3" json:"range,omitempty"`
|
||||||
// The items in the rover inventory
|
// The items in the rover inventory
|
||||||
Inventory []byte `protobuf:"bytes,4,opt,name=inventory,proto3" json:"inventory,omitempty"`
|
Inventory []byte `protobuf:"bytes,5,opt,name=inventory,proto3" json:"inventory,omitempty"`
|
||||||
// The capacity of the inventory
|
// The capacity of the inventory
|
||||||
Capacity int32 `protobuf:"varint,5,opt,name=capacity,proto3" json:"capacity,omitempty"`
|
Capacity int32 `protobuf:"varint,6,opt,name=capacity,proto3" json:"capacity,omitempty"`
|
||||||
// The current health of the rover
|
// The current health of the rover
|
||||||
Integrity int32 `protobuf:"varint,6,opt,name=integrity,proto3" json:"integrity,omitempty"`
|
Integrity int32 `protobuf:"varint,7,opt,name=integrity,proto3" json:"integrity,omitempty"`
|
||||||
// The maximum health of the rover
|
// The maximum health of the rover
|
||||||
MaximumIntegrity int32 `protobuf:"varint,7,opt,name=maximumIntegrity,proto3" json:"maximumIntegrity,omitempty"`
|
MaximumIntegrity int32 `protobuf:"varint,8,opt,name=maximumIntegrity,proto3" json:"maximumIntegrity,omitempty"`
|
||||||
// The energy stored in the rover
|
// The energy stored in the rover
|
||||||
Charge int32 `protobuf:"varint,8,opt,name=charge,proto3" json:"charge,omitempty"`
|
Charge int32 `protobuf:"varint,9,opt,name=charge,proto3" json:"charge,omitempty"`
|
||||||
// The max energy the rover can store
|
// The max energy the rover can store
|
||||||
MaximumCharge int32 `protobuf:"varint,9,opt,name=maximumCharge,proto3" json:"maximumCharge,omitempty"`
|
MaximumCharge int32 `protobuf:"varint,10,opt,name=maximumCharge,proto3" json:"maximumCharge,omitempty"`
|
||||||
|
// The current position of the sails
|
||||||
|
SailPosition SailPosition `protobuf:"varint,11,opt,name=sailPosition,proto3,enum=roveapi.SailPosition" json:"sailPosition,omitempty"`
|
||||||
// The set of currently incoming commands for this tick
|
// The set of currently incoming commands for this tick
|
||||||
IncomingCommands []*Command `protobuf:"bytes,10,rep,name=incomingCommands,proto3" json:"incomingCommands,omitempty"`
|
IncomingCommands []*Command `protobuf:"bytes,12,rep,name=incomingCommands,proto3" json:"incomingCommands,omitempty"`
|
||||||
// The set of currently queued commands
|
// The set of currently queued commands
|
||||||
QueuedCommands []*Command `protobuf:"bytes,11,rep,name=queuedCommands,proto3" json:"queuedCommands,omitempty"`
|
QueuedCommands []*Command `protobuf:"bytes,13,rep,name=queuedCommands,proto3" json:"queuedCommands,omitempty"`
|
||||||
// The most recent logs
|
// The most recent logs
|
||||||
Logs []*Log `protobuf:"bytes,12,rep,name=logs,proto3" json:"logs,omitempty"`
|
Logs []*Log `protobuf:"bytes,14,rep,name=logs,proto3" json:"logs,omitempty"`
|
||||||
|
// The current wind direction
|
||||||
|
Wind Bearing `protobuf:"varint,15,opt,name=wind,proto3,enum=roveapi.Bearing" json:"wind,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *StatusResponse) Reset() {
|
func (x *StatusResponse) Reset() {
|
||||||
|
@ -1101,6 +1145,13 @@ func (x *StatusResponse) GetPosition() *Vector {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *StatusResponse) GetBearing() Bearing {
|
||||||
|
if x != nil {
|
||||||
|
return x.Bearing
|
||||||
|
}
|
||||||
|
return Bearing_BearingUnknown
|
||||||
|
}
|
||||||
|
|
||||||
func (x *StatusResponse) GetRange() int32 {
|
func (x *StatusResponse) GetRange() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Range
|
return x.Range
|
||||||
|
@ -1150,6 +1201,13 @@ func (x *StatusResponse) GetMaximumCharge() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *StatusResponse) GetSailPosition() SailPosition {
|
||||||
|
if x != nil {
|
||||||
|
return x.SailPosition
|
||||||
|
}
|
||||||
|
return SailPosition_UnknownSailPosition
|
||||||
|
}
|
||||||
|
|
||||||
func (x *StatusResponse) GetIncomingCommands() []*Command {
|
func (x *StatusResponse) GetIncomingCommands() []*Command {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.IncomingCommands
|
return x.IncomingCommands
|
||||||
|
@ -1171,6 +1229,13 @@ func (x *StatusResponse) GetLogs() []*Log {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *StatusResponse) GetWind() Bearing {
|
||||||
|
if x != nil {
|
||||||
|
return x.Wind
|
||||||
|
}
|
||||||
|
return Bearing_BearingUnknown
|
||||||
|
}
|
||||||
|
|
||||||
var File_roveapi_roveapi_proto protoreflect.FileDescriptor
|
var File_roveapi_roveapi_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_roveapi_roveapi_proto_rawDesc = []byte{
|
var file_roveapi_roveapi_proto_rawDesc = []byte{
|
||||||
|
@ -1197,116 +1262,132 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{
|
||||||
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a,
|
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,
|
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,
|
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, 0x8b, 0x01, 0x0a, 0x07, 0x43, 0x6f,
|
0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7d, 0x0a, 0x07, 0x43, 0x6f, 0x6d,
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
|
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69,
|
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f,
|
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d,
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2c, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67,
|
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69,
|
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61,
|
||||||
0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x07, 0x62, 0x65, 0x61, 0x72,
|
0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
|
||||||
0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03,
|
0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69,
|
||||||
0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42,
|
0x6e, 0x67, 0x52, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d,
|
||||||
0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
|
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63,
|
||||||
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,
|
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,
|
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,
|
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
||||||
0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d,
|
0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d,
|
||||||
0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12,
|
0x61, 0x6e, 0x64, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
|
||||||
0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72,
|
||||||
0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xc3, 0x03, 0x0a, 0x0e,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12,
|
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
||||||
0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02,
|
0x75, 0x6e, 0x74, 0x22, 0x75, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x56,
|
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20,
|
||||||
0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69,
|
||||||
0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f,
|
0x61, 0x70, 0x69, 0x2e, 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12,
|
||||||
0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74,
|
0x29, 0x0a, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e,
|
||||||
0x6f, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18,
|
0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63,
|
||||||
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12,
|
0x74, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74,
|
||||||
0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01,
|
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61,
|
||||||
0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a,
|
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72,
|
||||||
0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74,
|
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07,
|
||||||
0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
|
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12,
|
||||||
0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61,
|
0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69,
|
||||||
0x72, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67,
|
0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72,
|
0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72,
|
||||||
0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
|
0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c,
|
||||||
0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x3c, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6f, 0x6d,
|
0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xd0, 0x04, 0x0a,
|
||||||
0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28,
|
0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||||
0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
|
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||||
0x61, 0x6e, 0x64, 0x52, 0x10, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d,
|
0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43,
|
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
|
0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
|
0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12,
|
0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72,
|
||||||
0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
|
0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67,
|
0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e,
|
||||||
0x73, 0x2a, 0x55, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65,
|
0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18,
|
||||||
0x12, 0x08, 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x6d, 0x6f,
|
0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79,
|
||||||
0x76, 0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x02, 0x12,
|
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01,
|
||||||
0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x72,
|
0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09,
|
||||||
0x65, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f,
|
0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, 0x05, 0x2a, 0x47, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72,
|
0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61,
|
||||||
0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e,
|
0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x08,
|
||||||
0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68,
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74,
|
||||||
0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05,
|
0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65,
|
||||||
0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74, 0x10,
|
0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x24,
|
||||||
0x04, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f,
|
0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18,
|
||||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d,
|
0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68,
|
||||||
0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a,
|
0x61, 0x72, 0x67, 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69,
|
||||||
0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12,
|
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x76,
|
||||||
0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d,
|
0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
|
||||||
0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a,
|
0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||||
0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b,
|
0x3c, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
|
||||||
0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01,
|
0x6e, 0x64, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04,
|
0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x10, 0x69, 0x6e, 0x63,
|
||||||
0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12,
|
0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x38, 0x0a,
|
||||||
0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
|
0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18,
|
||||||
0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e,
|
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74,
|
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41,
|
0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76,
|
0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x24, 0x0a, 0x04, 0x77, 0x69, 0x6e,
|
||||||
0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71,
|
0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52,
|
0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x2a,
|
||||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x53, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08,
|
||||||
0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72,
|
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,
|
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,
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61,
|
||||||
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61,
|
||||||
0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76,
|
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||||
0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61,
|
0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72,
|
||||||
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53,
|
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
|
||||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
|
0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68,
|
0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f,
|
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
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 (
|
var (
|
||||||
|
@ -1321,57 +1402,61 @@ func file_roveapi_roveapi_proto_rawDescGZIP() []byte {
|
||||||
return file_roveapi_roveapi_proto_rawDescData
|
return file_roveapi_roveapi_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
|
var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
|
||||||
var file_roveapi_roveapi_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
var file_roveapi_roveapi_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||||
var file_roveapi_roveapi_proto_goTypes = []interface{}{
|
var file_roveapi_roveapi_proto_goTypes = []interface{}{
|
||||||
(CommandType)(0), // 0: roveapi.CommandType
|
(CommandType)(0), // 0: roveapi.CommandType
|
||||||
(Bearing)(0), // 1: roveapi.Bearing
|
(Bearing)(0), // 1: roveapi.Bearing
|
||||||
(Object)(0), // 2: roveapi.Object
|
(Object)(0), // 2: roveapi.Object
|
||||||
(Tile)(0), // 3: roveapi.Tile
|
(Tile)(0), // 3: roveapi.Tile
|
||||||
(*ServerStatusRequest)(nil), // 4: roveapi.ServerStatusRequest
|
(SailPosition)(0), // 4: roveapi.SailPosition
|
||||||
(*ServerStatusResponse)(nil), // 5: roveapi.ServerStatusResponse
|
(*ServerStatusRequest)(nil), // 5: roveapi.ServerStatusRequest
|
||||||
(*RegisterRequest)(nil), // 6: roveapi.RegisterRequest
|
(*ServerStatusResponse)(nil), // 6: roveapi.ServerStatusResponse
|
||||||
(*Account)(nil), // 7: roveapi.Account
|
(*RegisterRequest)(nil), // 7: roveapi.RegisterRequest
|
||||||
(*RegisterResponse)(nil), // 8: roveapi.RegisterResponse
|
(*Account)(nil), // 8: roveapi.Account
|
||||||
(*Command)(nil), // 9: roveapi.Command
|
(*RegisterResponse)(nil), // 9: roveapi.RegisterResponse
|
||||||
(*CommandRequest)(nil), // 10: roveapi.CommandRequest
|
(*Command)(nil), // 10: roveapi.Command
|
||||||
(*CommandResponse)(nil), // 11: roveapi.CommandResponse
|
(*CommandRequest)(nil), // 11: roveapi.CommandRequest
|
||||||
(*RadarRequest)(nil), // 12: roveapi.RadarRequest
|
(*CommandResponse)(nil), // 12: roveapi.CommandResponse
|
||||||
(*RadarResponse)(nil), // 13: roveapi.RadarResponse
|
(*RadarRequest)(nil), // 13: roveapi.RadarRequest
|
||||||
(*StatusRequest)(nil), // 14: roveapi.StatusRequest
|
(*RadarResponse)(nil), // 14: roveapi.RadarResponse
|
||||||
(*Log)(nil), // 15: roveapi.Log
|
(*StatusRequest)(nil), // 15: roveapi.StatusRequest
|
||||||
(*Vector)(nil), // 16: roveapi.Vector
|
(*Log)(nil), // 16: roveapi.Log
|
||||||
(*StatusResponse)(nil), // 17: roveapi.StatusResponse
|
(*Vector)(nil), // 17: roveapi.Vector
|
||||||
|
(*StatusResponse)(nil), // 18: roveapi.StatusResponse
|
||||||
}
|
}
|
||||||
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
||||||
7, // 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
|
0, // 1: roveapi.Command.command:type_name -> roveapi.CommandType
|
||||||
1, // 2: roveapi.Command.bearing:type_name -> roveapi.Bearing
|
1, // 2: roveapi.Command.turn:type_name -> roveapi.Bearing
|
||||||
7, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
8, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
||||||
9, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
10, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
||||||
7, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
8, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
||||||
3, // 6: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile
|
3, // 6: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile
|
||||||
2, // 7: roveapi.RadarResponse.objects:type_name -> roveapi.Object
|
2, // 7: roveapi.RadarResponse.objects:type_name -> roveapi.Object
|
||||||
7, // 8: roveapi.StatusRequest.account:type_name -> roveapi.Account
|
8, // 8: roveapi.StatusRequest.account:type_name -> roveapi.Account
|
||||||
16, // 9: roveapi.StatusResponse.position:type_name -> roveapi.Vector
|
17, // 9: roveapi.StatusResponse.position:type_name -> roveapi.Vector
|
||||||
9, // 10: roveapi.StatusResponse.incomingCommands:type_name -> roveapi.Command
|
1, // 10: roveapi.StatusResponse.bearing:type_name -> roveapi.Bearing
|
||||||
9, // 11: roveapi.StatusResponse.queuedCommands:type_name -> roveapi.Command
|
4, // 11: roveapi.StatusResponse.sailPosition:type_name -> roveapi.SailPosition
|
||||||
15, // 12: roveapi.StatusResponse.logs:type_name -> roveapi.Log
|
10, // 12: roveapi.StatusResponse.incomingCommands:type_name -> roveapi.Command
|
||||||
4, // 13: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest
|
10, // 13: roveapi.StatusResponse.queuedCommands:type_name -> roveapi.Command
|
||||||
6, // 14: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest
|
16, // 14: roveapi.StatusResponse.logs:type_name -> roveapi.Log
|
||||||
10, // 15: roveapi.Rove.Command:input_type -> roveapi.CommandRequest
|
1, // 15: roveapi.StatusResponse.wind:type_name -> roveapi.Bearing
|
||||||
12, // 16: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest
|
5, // 16: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest
|
||||||
14, // 17: roveapi.Rove.Status:input_type -> roveapi.StatusRequest
|
7, // 17: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest
|
||||||
5, // 18: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse
|
11, // 18: roveapi.Rove.Command:input_type -> roveapi.CommandRequest
|
||||||
8, // 19: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse
|
13, // 19: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest
|
||||||
11, // 20: roveapi.Rove.Command:output_type -> roveapi.CommandResponse
|
15, // 20: roveapi.Rove.Status:input_type -> roveapi.StatusRequest
|
||||||
13, // 21: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse
|
6, // 21: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse
|
||||||
17, // 22: roveapi.Rove.Status:output_type -> roveapi.StatusResponse
|
9, // 22: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse
|
||||||
18, // [18:23] is the sub-list for method output_type
|
12, // 23: roveapi.Rove.Command:output_type -> roveapi.CommandResponse
|
||||||
13, // [13:18] is the sub-list for method input_type
|
14, // 24: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse
|
||||||
13, // [13:13] is the sub-list for extension type_name
|
18, // 25: roveapi.Rove.Status:output_type -> roveapi.StatusResponse
|
||||||
13, // [13:13] is the sub-list for extension extendee
|
21, // [21:26] is the sub-list for method output_type
|
||||||
0, // [0:13] is the sub-list for field type_name
|
16, // [16:21] is the sub-list for method input_type
|
||||||
|
16, // [16:16] is the sub-list for extension type_name
|
||||||
|
16, // [16:16] is the sub-list for extension extendee
|
||||||
|
0, // [0:16] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_roveapi_roveapi_proto_init() }
|
func init() { file_roveapi_roveapi_proto_init() }
|
||||||
|
@ -1549,16 +1634,12 @@ func file_roveapi_roveapi_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_roveapi_roveapi_proto_msgTypes[5].OneofWrappers = []interface{}{
|
|
||||||
(*Command_Bearing)(nil),
|
|
||||||
(*Command_Message)(nil),
|
|
||||||
}
|
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_roveapi_roveapi_proto_rawDesc,
|
RawDescriptor: file_roveapi_roveapi_proto_rawDesc,
|
||||||
NumEnums: 4,
|
NumEnums: 5,
|
||||||
NumMessages: 14,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
|
|
|
@ -89,25 +89,30 @@ message RegisterResponse {
|
||||||
// CommandType defines the type of a command to give to the rover
|
// CommandType defines the type of a command to give to the rover
|
||||||
enum CommandType {
|
enum CommandType {
|
||||||
none = 0;
|
none = 0;
|
||||||
// Move the rover in a direction, requires bearing
|
// Toggles the sails, either catching the wind, or charging from the sun
|
||||||
move = 1;
|
toggle = 1;
|
||||||
|
// Turns the rover in the specified bearing, requires data
|
||||||
|
turn = 2;
|
||||||
// Stashes item at current location in rover inventory
|
// Stashes item at current location in rover inventory
|
||||||
stash = 2;
|
stash = 3;
|
||||||
// Repairs the rover using an inventory object
|
// Repairs the rover using an inventory object
|
||||||
repair = 3;
|
repair = 4;
|
||||||
// Waits a tick to add more charge to the rover
|
// Broadcasts a message to nearby rovers, requires data
|
||||||
recharge = 4;
|
|
||||||
// Broadcasts a message to nearby rovers
|
|
||||||
broadcast = 5;
|
broadcast = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bearing represents a compass direction
|
||||||
enum Bearing {
|
enum Bearing {
|
||||||
// BearingUnknown an unknown invalid bearing
|
// BearingUnknown an unknown invalid bearing
|
||||||
BearingUnknown = 0;
|
BearingUnknown = 0;
|
||||||
North = 1;
|
North = 1;
|
||||||
East = 2;
|
NorthEast = 2;
|
||||||
South = 3;
|
East = 3;
|
||||||
West = 4;
|
SouthEast = 4;
|
||||||
|
South = 5;
|
||||||
|
SouthWest = 6;
|
||||||
|
West = 7;
|
||||||
|
NorthWest = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command is a single command for a rover
|
// Command is a single command for a rover
|
||||||
|
@ -115,16 +120,12 @@ message Command {
|
||||||
// The command type
|
// The command type
|
||||||
CommandType command = 1;
|
CommandType command = 1;
|
||||||
|
|
||||||
oneof data {
|
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
||||||
// A bearing
|
// maximum of three characters
|
||||||
// Used with MOVE
|
bytes broadcast = 2;
|
||||||
Bearing bearing = 2;
|
|
||||||
|
|
||||||
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
// The bearing for the rover to turn to
|
||||||
// maximum of three characters
|
Bearing turn = 3;
|
||||||
// Used with BROADCAST
|
|
||||||
bytes message = 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommandRequest describes a set of commands to be requested for the rover
|
// CommandRequest describes a set of commands to be requested for the rover
|
||||||
|
@ -219,6 +220,17 @@ message Vector {
|
||||||
int32 y = 2;
|
int32 y = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SailPosition represents the position of the sola sail
|
||||||
|
enum SailPosition {
|
||||||
|
UnknownSailPosition = 0;
|
||||||
|
|
||||||
|
// CatchingWind means the sail is catching the wind and moving the rover
|
||||||
|
CatchingWind = 1;
|
||||||
|
|
||||||
|
// SolarCharging means the sail is facing the sun and charging
|
||||||
|
SolarCharging = 2;
|
||||||
|
}
|
||||||
|
|
||||||
// StatusResponse is the response given to a status request
|
// StatusResponse is the response given to a status request
|
||||||
message StatusResponse {
|
message StatusResponse {
|
||||||
// The name of the rover
|
// The name of the rover
|
||||||
|
@ -227,33 +239,42 @@ message StatusResponse {
|
||||||
// Position of the rover in world coordinates
|
// Position of the rover in world coordinates
|
||||||
Vector position = 2;
|
Vector position = 2;
|
||||||
|
|
||||||
|
// The current direction of the rover
|
||||||
|
Bearing bearing = 3;
|
||||||
|
|
||||||
// The range of this rover's radar and broadcasting
|
// The range of this rover's radar and broadcasting
|
||||||
int32 range = 3;
|
int32 range = 4;
|
||||||
|
|
||||||
// The items in the rover inventory
|
// The items in the rover inventory
|
||||||
bytes inventory = 4;
|
bytes inventory = 5;
|
||||||
|
|
||||||
// The capacity of the inventory
|
// The capacity of the inventory
|
||||||
int32 capacity = 5;
|
int32 capacity = 6;
|
||||||
|
|
||||||
// The current health of the rover
|
// The current health of the rover
|
||||||
int32 integrity = 6;
|
int32 integrity = 7;
|
||||||
|
|
||||||
// The maximum health of the rover
|
// The maximum health of the rover
|
||||||
int32 maximumIntegrity = 7;
|
int32 maximumIntegrity = 8;
|
||||||
|
|
||||||
// The energy stored in the rover
|
// The energy stored in the rover
|
||||||
int32 charge = 8;
|
int32 charge = 9;
|
||||||
|
|
||||||
// The max energy the rover can store
|
// The max energy the rover can store
|
||||||
int32 maximumCharge = 9;
|
int32 maximumCharge = 10;
|
||||||
|
|
||||||
|
// The current position of the sails
|
||||||
|
SailPosition sailPosition = 11;
|
||||||
|
|
||||||
// The set of currently incoming commands for this tick
|
// The set of currently incoming commands for this tick
|
||||||
repeated Command incomingCommands = 10;
|
repeated Command incomingCommands = 12;
|
||||||
|
|
||||||
// The set of currently queued commands
|
// The set of currently queued commands
|
||||||
repeated Command queuedCommands = 11;
|
repeated Command queuedCommands = 13;
|
||||||
|
|
||||||
// The most recent logs
|
// The most recent logs
|
||||||
repeated Log logs = 12;
|
repeated Log logs = 14;
|
||||||
|
|
||||||
|
// The current wind direction
|
||||||
|
Bearing wind = 15;
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue