Large refactor, move object and tile types out into the proto
This commit is contained in:
parent
24d4fe9273
commit
305f64ec38
9 changed files with 338 additions and 210 deletions
|
@ -287,10 +287,10 @@ func InnerMain(command string, args ...string) error {
|
||||||
for i := 0; i < num; i++ {
|
for i := 0; i < num; i++ {
|
||||||
t := response.Tiles[i+num*j]
|
t := response.Tiles[i+num*j]
|
||||||
o := response.Objects[i+num*j]
|
o := response.Objects[i+num*j]
|
||||||
if o != byte(atlas.ObjectNone) {
|
if o != roveapi.Object_ObjectNone {
|
||||||
fmt.Printf("%c", o)
|
fmt.Printf("%c", atlas.ObjectGlyph(o))
|
||||||
} else if t != byte(atlas.TileNone) {
|
} else if t != roveapi.Tile_TileNone {
|
||||||
fmt.Printf("%c", t)
|
fmt.Printf("%c", atlas.TileGlyph(t))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" ")
|
fmt.Printf(" ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,35 +4,19 @@ import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tile describes the type of terrain
|
// TileGlyph returns the glyph for this tile type
|
||||||
type Tile byte
|
func TileGlyph(t roveapi.Tile) Glyph {
|
||||||
|
|
||||||
const (
|
|
||||||
// TileNone is a keyword for nothing
|
|
||||||
TileNone = Tile(0)
|
|
||||||
|
|
||||||
// TileRock is solid rock ground
|
|
||||||
TileRock = Tile(1)
|
|
||||||
|
|
||||||
// TileGravel is loose rocks
|
|
||||||
TileGravel = Tile(2)
|
|
||||||
|
|
||||||
// TileSand is sand
|
|
||||||
TileSand = Tile(3)
|
|
||||||
)
|
|
||||||
|
|
||||||
// Glyph returns the glyph for this tile type
|
|
||||||
func (t Tile) Glyph() Glyph {
|
|
||||||
switch t {
|
switch t {
|
||||||
case TileNone:
|
case roveapi.Tile_TileNone:
|
||||||
return GlyphNone
|
return GlyphNone
|
||||||
case TileRock:
|
case roveapi.Tile_Rock:
|
||||||
return GlyphGroundRock
|
return GlyphGroundRock
|
||||||
case TileGravel:
|
case roveapi.Tile_Gravel:
|
||||||
return GlyphGroundGravel
|
return GlyphGroundGravel
|
||||||
case TileSand:
|
case roveapi.Tile_Sand:
|
||||||
return GlyphGroundSand
|
return GlyphGroundSand
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +27,11 @@ func (t Tile) Glyph() Glyph {
|
||||||
// Atlas represents a 2D world atlas of tiles and objects
|
// Atlas represents a 2D world atlas of tiles and objects
|
||||||
type Atlas interface {
|
type Atlas interface {
|
||||||
// SetTile sets a location on the Atlas to a type of tile
|
// SetTile sets a location on the Atlas to a type of tile
|
||||||
SetTile(v maths.Vector, tile Tile)
|
SetTile(v maths.Vector, tile roveapi.Tile)
|
||||||
|
|
||||||
// SetObject will set a location on the Atlas to contain an object
|
// SetObject will set a location on the Atlas to contain an object
|
||||||
SetObject(v maths.Vector, obj Object)
|
SetObject(v maths.Vector, obj Object)
|
||||||
|
|
||||||
// QueryPosition queries a position on the atlas
|
// QueryPosition queries a position on the atlas
|
||||||
QueryPosition(v maths.Vector) (byte, Object)
|
QueryPosition(v maths.Vector) (roveapi.Tile, Object)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -169,15 +170,15 @@ func TestAtlas_GetSetTile(t *testing.T) {
|
||||||
a := NewChunkAtlas(10)
|
a := NewChunkAtlas(10)
|
||||||
assert.NotNil(t, a)
|
assert.NotNil(t, a)
|
||||||
|
|
||||||
// Set the origin tile to 1 and test it
|
// Set the origin tile and test it
|
||||||
a.SetTile(maths.Vector{X: 0, Y: 0}, 1)
|
a.SetTile(maths.Vector{X: 0, Y: 0}, roveapi.Tile_Gravel)
|
||||||
tile, _ := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
tile, _ := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
||||||
assert.Equal(t, byte(1), tile)
|
assert.Equal(t, roveapi.Tile_Gravel, tile)
|
||||||
|
|
||||||
// Set another tile to 1 and test it
|
// Set another tile and test it
|
||||||
a.SetTile(maths.Vector{X: 5, Y: -2}, 2)
|
a.SetTile(maths.Vector{X: 5, Y: -2}, roveapi.Tile_Rock)
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: 5, Y: -2})
|
tile, _ = a.QueryPosition(maths.Vector{X: 5, Y: -2})
|
||||||
assert.Equal(t, byte(2), tile)
|
assert.Equal(t, roveapi.Tile_Rock, tile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtlas_GetSetObject(t *testing.T) {
|
func TestAtlas_GetSetObject(t *testing.T) {
|
||||||
|
@ -185,14 +186,14 @@ func TestAtlas_GetSetObject(t *testing.T) {
|
||||||
assert.NotNil(t, a)
|
assert.NotNil(t, a)
|
||||||
|
|
||||||
// Set the origin tile to 1 and test it
|
// Set the origin tile to 1 and test it
|
||||||
a.SetObject(maths.Vector{X: 0, Y: 0}, Object{Type: ObjectRockLarge})
|
a.SetObject(maths.Vector{X: 0, Y: 0}, Object{Type: roveapi.Object_RockLarge})
|
||||||
_, obj := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
_, obj := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
||||||
assert.Equal(t, Object{Type: ObjectRockLarge}, obj)
|
assert.Equal(t, Object{Type: roveapi.Object_RockLarge}, obj)
|
||||||
|
|
||||||
// Set another tile to 1 and test it
|
// Set another tile to 1 and test it
|
||||||
a.SetObject(maths.Vector{X: 5, Y: -2}, Object{Type: ObjectRockSmall})
|
a.SetObject(maths.Vector{X: 5, Y: -2}, Object{Type: roveapi.Object_RockSmall})
|
||||||
_, obj = a.QueryPosition(maths.Vector{X: 5, Y: -2})
|
_, obj = a.QueryPosition(maths.Vector{X: 5, Y: -2})
|
||||||
assert.Equal(t, Object{Type: ObjectRockSmall}, obj)
|
assert.Equal(t, Object{Type: roveapi.Object_RockSmall}, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtlas_Grown(t *testing.T) {
|
func TestAtlas_Grown(t *testing.T) {
|
||||||
|
@ -202,28 +203,28 @@ func TestAtlas_Grown(t *testing.T) {
|
||||||
assert.Equal(t, 1, len(a.Chunks))
|
assert.Equal(t, 1, len(a.Chunks))
|
||||||
|
|
||||||
// Set a few tiles to values
|
// Set a few tiles to values
|
||||||
a.SetTile(maths.Vector{X: 0, Y: 0}, 1)
|
a.SetTile(maths.Vector{X: 0, Y: 0}, roveapi.Tile_Gravel)
|
||||||
a.SetTile(maths.Vector{X: -1, Y: -1}, 2)
|
a.SetTile(maths.Vector{X: -1, Y: -1}, roveapi.Tile_Rock)
|
||||||
a.SetTile(maths.Vector{X: 1, Y: -2}, 3)
|
a.SetTile(maths.Vector{X: 1, Y: -2}, roveapi.Tile_Sand)
|
||||||
|
|
||||||
// Check tile values
|
// Check tile values
|
||||||
tile, _ := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
tile, _ := a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
||||||
assert.Equal(t, byte(1), tile)
|
assert.Equal(t, roveapi.Tile_Gravel, tile)
|
||||||
|
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: -1, Y: -1})
|
tile, _ = a.QueryPosition(maths.Vector{X: -1, Y: -1})
|
||||||
assert.Equal(t, byte(2), tile)
|
assert.Equal(t, roveapi.Tile_Rock, tile)
|
||||||
|
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: 1, Y: -2})
|
tile, _ = a.QueryPosition(maths.Vector{X: 1, Y: -2})
|
||||||
assert.Equal(t, byte(3), tile)
|
assert.Equal(t, roveapi.Tile_Sand, tile)
|
||||||
|
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
tile, _ = a.QueryPosition(maths.Vector{X: 0, Y: 0})
|
||||||
assert.Equal(t, byte(1), tile)
|
assert.Equal(t, roveapi.Tile_Gravel, tile)
|
||||||
|
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: -1, Y: -1})
|
tile, _ = a.QueryPosition(maths.Vector{X: -1, Y: -1})
|
||||||
assert.Equal(t, byte(2), tile)
|
assert.Equal(t, roveapi.Tile_Rock, tile)
|
||||||
|
|
||||||
tile, _ = a.QueryPosition(maths.Vector{X: 1, Y: -2})
|
tile, _ = a.QueryPosition(maths.Vector{X: 1, Y: -2})
|
||||||
assert.Equal(t, byte(3), tile)
|
assert.Equal(t, roveapi.Tile_Sand, tile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtlas_GetSetCorrect(t *testing.T) {
|
func TestAtlas_GetSetCorrect(t *testing.T) {
|
||||||
|
@ -237,12 +238,12 @@ func TestAtlas_GetSetCorrect(t *testing.T) {
|
||||||
assert.Equal(t, 1, len(a.Chunks))
|
assert.Equal(t, 1, len(a.Chunks))
|
||||||
|
|
||||||
pos := maths.Vector{X: x, Y: y}
|
pos := maths.Vector{X: x, Y: y}
|
||||||
a.SetTile(pos, TileRock)
|
a.SetTile(pos, roveapi.Tile_Rock)
|
||||||
a.SetObject(pos, Object{Type: ObjectRockLarge})
|
a.SetObject(pos, Object{Type: roveapi.Object_RockLarge})
|
||||||
tile, obj := a.QueryPosition(pos)
|
tile, obj := a.QueryPosition(pos)
|
||||||
|
|
||||||
assert.Equal(t, TileRock, Tile(tile))
|
assert.Equal(t, roveapi.Tile_Rock, roveapi.Tile(tile))
|
||||||
assert.Equal(t, Object{Type: ObjectRockLarge}, obj)
|
assert.Equal(t, Object{Type: roveapi.Object_RockLarge}, obj)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,10 +260,10 @@ func TestAtlas_WorldGen(t *testing.T) {
|
||||||
for j := num - 1; j >= 0; j-- {
|
for j := num - 1; j >= 0; j-- {
|
||||||
for i := 0; i < num; i++ {
|
for i := 0; i < num; i++ {
|
||||||
t, o := a.QueryPosition(maths.Vector{X: i, Y: j})
|
t, o := a.QueryPosition(maths.Vector{X: i, Y: j})
|
||||||
if o.Type != ObjectNone {
|
if o.Type != roveapi.Object_ObjectNone {
|
||||||
fmt.Printf("%c", o.Type)
|
fmt.Printf("%c", ObjectGlyph(o.Type))
|
||||||
} else if t != byte(TileNone) {
|
} else if t != roveapi.Tile_TileNone {
|
||||||
fmt.Printf("%c", t)
|
fmt.Printf("%c", TileGlyph(t))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" ")
|
fmt.Printf(" ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
"github.com/ojrac/opensimplex-go"
|
"github.com/ojrac/opensimplex-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ func NewChunkAtlas(chunkSize int) Atlas {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTile sets an individual tile's kind
|
// SetTile sets an individual tile's kind
|
||||||
func (a *chunkBasedAtlas) SetTile(v maths.Vector, tile Tile) {
|
func (a *chunkBasedAtlas) SetTile(v maths.Vector, tile roveapi.Tile) {
|
||||||
c := a.worldSpaceToChunkWithGrow(v)
|
c := a.worldSpaceToChunkWithGrow(v)
|
||||||
local := a.worldSpaceToChunkLocal(v)
|
local := a.worldSpaceToChunkLocal(v)
|
||||||
a.setTile(c, local, byte(tile))
|
a.setTile(c, local, byte(tile))
|
||||||
|
@ -77,13 +78,13 @@ func (a *chunkBasedAtlas) SetObject(v maths.Vector, obj Object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryPosition will return information for a specific position
|
// QueryPosition will return information for a specific position
|
||||||
func (a *chunkBasedAtlas) QueryPosition(v maths.Vector) (byte, Object) {
|
func (a *chunkBasedAtlas) QueryPosition(v maths.Vector) (roveapi.Tile, Object) {
|
||||||
c := a.worldSpaceToChunkWithGrow(v)
|
c := a.worldSpaceToChunkWithGrow(v)
|
||||||
local := a.worldSpaceToChunkLocal(v)
|
local := a.worldSpaceToChunkLocal(v)
|
||||||
a.populate(c)
|
a.populate(c)
|
||||||
chunk := a.Chunks[c]
|
chunk := a.Chunks[c]
|
||||||
i := a.chunkTileIndex(local)
|
i := a.chunkTileIndex(local)
|
||||||
return chunk.Tiles[i], chunk.Objects[i]
|
return roveapi.Tile(chunk.Tiles[i]), chunk.Objects[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
// chunkTileID returns the tile index within a chunk
|
// chunkTileID returns the tile index within a chunk
|
||||||
|
@ -107,28 +108,28 @@ func (a *chunkBasedAtlas) populate(chunk int) {
|
||||||
|
|
||||||
// Get the terrain noise value for this location
|
// Get the terrain noise value for this location
|
||||||
t := a.terrainNoise.Eval2(float64(origin.X+i)/terrainNoiseScale, float64(origin.Y+j)/terrainNoiseScale)
|
t := a.terrainNoise.Eval2(float64(origin.X+i)/terrainNoiseScale, float64(origin.Y+j)/terrainNoiseScale)
|
||||||
var tile Tile
|
var tile roveapi.Tile
|
||||||
switch {
|
switch {
|
||||||
case t > 0.5:
|
case t > 0.5:
|
||||||
tile = TileGravel
|
tile = roveapi.Tile_Gravel
|
||||||
case t > 0.05:
|
case t > 0.05:
|
||||||
tile = TileSand
|
tile = roveapi.Tile_Sand
|
||||||
default:
|
default:
|
||||||
tile = TileRock
|
tile = roveapi.Tile_Rock
|
||||||
}
|
}
|
||||||
c.Tiles[j*a.ChunkSize+i] = byte(tile)
|
c.Tiles[j*a.ChunkSize+i] = byte(tile)
|
||||||
|
|
||||||
// Get the object noise value for this location
|
// Get the object noise value for this location
|
||||||
o := a.objectNoise.Eval2(float64(origin.X+i)/objectNoiseScale, float64(origin.Y+j)/objectNoiseScale)
|
o := a.objectNoise.Eval2(float64(origin.X+i)/objectNoiseScale, float64(origin.Y+j)/objectNoiseScale)
|
||||||
var obj = ObjectNone
|
var obj = roveapi.Object_ObjectNone
|
||||||
switch {
|
switch {
|
||||||
case o > 0.6:
|
case o > 0.6:
|
||||||
obj = ObjectRockLarge
|
obj = roveapi.Object_RockLarge
|
||||||
case o > 0.5:
|
case o > 0.5:
|
||||||
obj = ObjectRockSmall
|
obj = roveapi.Object_RockSmall
|
||||||
}
|
}
|
||||||
if obj != ObjectNone {
|
if obj != roveapi.Object_ObjectNone {
|
||||||
c.Objects[j*a.ChunkSize+i] = Object{Type: ObjectType(obj)}
|
c.Objects[j*a.ChunkSize+i] = Object{Type: roveapi.Object(obj)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,9 +137,9 @@ func (a *chunkBasedAtlas) populate(chunk int) {
|
||||||
// Set up any objects
|
// Set up any objects
|
||||||
for i := 0; i < len(c.Tiles); i++ {
|
for i := 0; i < len(c.Tiles); i++ {
|
||||||
if rand.Intn(16) == 0 {
|
if rand.Intn(16) == 0 {
|
||||||
c.Objects[i] = Object{Type: ObjectRockLarge}
|
c.Objects[i] = Object{Type: roveapi.Object_RockLarge}
|
||||||
} else if rand.Intn(32) == 0 {
|
} else if rand.Intn(32) == 0 {
|
||||||
c.Objects[i] = Object{Type: ObjectRockSmall}
|
c.Objects[i] = Object{Type: roveapi.Object_RockSmall}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ func (a *chunkBasedAtlas) setObject(chunk int, local maths.Vector, object Object
|
||||||
|
|
||||||
c := a.Chunks[chunk]
|
c := a.Chunks[chunk]
|
||||||
i := a.chunkTileIndex(local)
|
i := a.chunkTileIndex(local)
|
||||||
if object.Type != ObjectNone {
|
if object.Type != roveapi.Object_ObjectNone {
|
||||||
c.Objects[i] = object
|
c.Objects[i] = object
|
||||||
} else {
|
} else {
|
||||||
delete(c.Objects, i)
|
delete(c.Objects, i)
|
||||||
|
|
|
@ -1,35 +1,21 @@
|
||||||
package atlas
|
package atlas
|
||||||
|
|
||||||
import "log"
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
// ObjectType represents an object type
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
type ObjectType byte
|
|
||||||
|
|
||||||
// Types of objects
|
|
||||||
const (
|
|
||||||
// ObjectNone represents no object at all
|
|
||||||
ObjectNone = ObjectType(0)
|
|
||||||
|
|
||||||
// ObjectRover represents a live rover
|
|
||||||
ObjectRoverLive = ObjectType(1)
|
|
||||||
|
|
||||||
// ObjectSmallRock is a small stashable rock
|
|
||||||
ObjectRockSmall = ObjectType(2)
|
|
||||||
|
|
||||||
// ObjectLargeRock is a large blocking rock
|
|
||||||
ObjectRockLarge = ObjectType(3)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Glyph returns the glyph for this object type
|
// ObjectGlyph returns the glyph for this object type
|
||||||
func (o ObjectType) Glyph() Glyph {
|
func ObjectGlyph(o roveapi.Object) Glyph {
|
||||||
switch o {
|
switch o {
|
||||||
case ObjectNone:
|
case roveapi.Object_ObjectNone:
|
||||||
return GlyphNone
|
return GlyphNone
|
||||||
case ObjectRoverLive:
|
case roveapi.Object_RoverLive:
|
||||||
return GlyphRoverLive
|
return GlyphRoverLive
|
||||||
case ObjectRockSmall:
|
case roveapi.Object_RockSmall:
|
||||||
return GlyphRockSmall
|
return GlyphRockSmall
|
||||||
case ObjectRockLarge:
|
case roveapi.Object_RockLarge:
|
||||||
return GlyphRockLarge
|
return GlyphRockLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,14 +26,14 @@ func (o ObjectType) Glyph() Glyph {
|
||||||
// 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 ObjectType `json:"type"`
|
Type roveapi.Object `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsBlocking checks if an object is a blocking object
|
// IsBlocking checks if an object is a blocking object
|
||||||
func (o *Object) IsBlocking() bool {
|
func (o *Object) IsBlocking() bool {
|
||||||
var blocking = [...]ObjectType{
|
var blocking = [...]roveapi.Object{
|
||||||
ObjectRoverLive,
|
roveapi.Object_RoverLive,
|
||||||
ObjectRockLarge,
|
roveapi.Object_RockLarge,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range blocking {
|
for _, t := range blocking {
|
||||||
|
@ -60,8 +46,8 @@ func (o *Object) IsBlocking() bool {
|
||||||
|
|
||||||
// IsStashable checks if an object is stashable
|
// IsStashable checks if an object is stashable
|
||||||
func (o *Object) IsStashable() bool {
|
func (o *Object) IsStashable() bool {
|
||||||
var stashable = [...]ObjectType{
|
var stashable = [...]roveapi.Object{
|
||||||
ObjectRockSmall,
|
roveapi.Object_RockSmall,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range stashable {
|
for _, t := range stashable {
|
||||||
|
|
|
@ -318,40 +318,40 @@ func (w *World) MoveRover(rover string, b maths.Bearing) (maths.Vector, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoverStash will stash an item at the current rovers position
|
// RoverStash will stash an item at the current rovers position
|
||||||
func (w *World) RoverStash(rover string) (atlas.ObjectType, error) {
|
func (w *World) RoverStash(rover string) (roveapi.Object, error) {
|
||||||
w.worldMutex.Lock()
|
w.worldMutex.Lock()
|
||||||
defer w.worldMutex.Unlock()
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
r, ok := w.Rovers[rover]
|
r, ok := w.Rovers[rover]
|
||||||
if !ok {
|
if !ok {
|
||||||
return atlas.ObjectNone, fmt.Errorf("no rover matching id")
|
return roveapi.Object_ObjectNone, fmt.Errorf("no rover matching id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't pick up when full
|
// Can't pick up when full
|
||||||
if len(r.Inventory) >= r.Capacity {
|
if len(r.Inventory) >= r.Capacity {
|
||||||
return atlas.ObjectNone, nil
|
return roveapi.Object_ObjectNone, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the rover has energy
|
// Ensure the rover has energy
|
||||||
if r.Charge <= 0 {
|
if r.Charge <= 0 {
|
||||||
return atlas.ObjectNone, nil
|
return roveapi.Object_ObjectNone, nil
|
||||||
}
|
}
|
||||||
r.Charge--
|
r.Charge--
|
||||||
|
|
||||||
_, obj := w.Atlas.QueryPosition(r.Pos)
|
_, obj := w.Atlas.QueryPosition(r.Pos)
|
||||||
if !obj.IsStashable() {
|
if !obj.IsStashable() {
|
||||||
return atlas.ObjectNone, nil
|
return roveapi.Object_ObjectNone, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
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.Rovers[rover] = r
|
||||||
w.Atlas.SetObject(r.Pos, atlas.Object{Type: atlas.ObjectNone})
|
w.Atlas.SetObject(r.Pos, atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
return obj.Type, nil
|
return obj.Type, 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 []byte, objs []byte, err error) {
|
func (w *World) RadarFromRover(rover string) (radar []roveapi.Tile, objs []roveapi.Object, err error) {
|
||||||
w.worldMutex.RLock()
|
w.worldMutex.RLock()
|
||||||
defer w.worldMutex.RUnlock()
|
defer w.worldMutex.RUnlock()
|
||||||
|
|
||||||
|
@ -376,8 +376,8 @@ func (w *World) RadarFromRover(rover string) (radar []byte, objs []byte, err err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gather up all tiles within the range
|
// Gather up all tiles within the range
|
||||||
radar = make([]byte, radarSpan*radarSpan)
|
radar = make([]roveapi.Tile, radarSpan*radarSpan)
|
||||||
objs = make([]byte, radarSpan*radarSpan)
|
objs = make([]roveapi.Object, radarSpan*radarSpan)
|
||||||
for j := radarMin.Y; j <= radarMax.Y; j++ {
|
for j := radarMin.Y; j <= radarMax.Y; j++ {
|
||||||
for i := radarMin.X; i <= radarMax.X; i++ {
|
for i := radarMin.X; i <= radarMax.X; i++ {
|
||||||
q := maths.Vector{X: i, Y: j}
|
q := maths.Vector{X: i, Y: j}
|
||||||
|
@ -388,7 +388,7 @@ func (w *World) RadarFromRover(rover string) (radar []byte, objs []byte, err err
|
||||||
relative := q.Added(radarMin.Negated())
|
relative := q.Added(radarMin.Negated())
|
||||||
index := relative.X + relative.Y*radarSpan
|
index := relative.X + relative.Y*radarSpan
|
||||||
radar[index] = tile
|
radar[index] = tile
|
||||||
objs[index] = byte(obj.Type)
|
objs[index] = obj.Type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ func (w *World) RadarFromRover(rover string) (radar []byte, objs []byte, err err
|
||||||
if dist.X <= r.Range && dist.Y <= r.Range {
|
if dist.X <= r.Range && dist.Y <= r.Range {
|
||||||
relative := r.Pos.Added(radarMin.Negated())
|
relative := r.Pos.Added(radarMin.Negated())
|
||||||
index := relative.X + relative.Y*radarSpan
|
index := relative.X + relative.Y*radarSpan
|
||||||
objs[index] = byte(atlas.ObjectRoverLive)
|
objs[index] = roveapi.Object_RoverLive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
|
||||||
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}, atlas.Object{Type: atlas.ObjectRockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0, Y: 2}, atlas.Object{Type: roveapi.Object_RockLarge})
|
||||||
newPos, err = world.MoveRover(a, b)
|
newPos, err = world.MoveRover(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")
|
||||||
|
@ -120,8 +120,8 @@ func TestWorld_RadarFromRover(t *testing.T) {
|
||||||
assert.Equal(t, fullRange*fullRange, len(objs), "Radar returned wrong length")
|
assert.Equal(t, fullRange*fullRange, len(objs), "Radar returned wrong length")
|
||||||
|
|
||||||
// Test the expected values
|
// Test the expected values
|
||||||
assert.Equal(t, byte(atlas.ObjectRoverLive), objs[1+fullRange])
|
assert.Equal(t, roveapi.Object_RoverLive, objs[1+fullRange])
|
||||||
assert.Equal(t, byte(atlas.ObjectRoverLive), objs[4+4*fullRange])
|
assert.Equal(t, roveapi.Object_RoverLive, objs[4+4*fullRange])
|
||||||
|
|
||||||
// Check the radar results are stable
|
// Check the radar results are stable
|
||||||
radar1, objs1, err := world.RadarFromRover(a)
|
radar1, objs1, err := world.RadarFromRover(a)
|
||||||
|
@ -142,34 +142,34 @@ func TestWorld_RoverStash(t *testing.T) {
|
||||||
Y: 0.0,
|
Y: 0.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectNone})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
err = world.WarpRover(a, pos)
|
err = world.WarpRover(a, pos)
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err, "Failed to set position for rover")
|
||||||
|
|
||||||
// Set to a traversible tile
|
// Set to a traversible tile
|
||||||
world.Atlas.SetTile(pos, atlas.TileRock)
|
world.Atlas.SetTile(pos, roveapi.Tile_TileNone)
|
||||||
|
|
||||||
rover, err := world.GetRover(a)
|
rover, err := world.GetRover(a)
|
||||||
assert.NoError(t, err, "Failed to get rover")
|
assert.NoError(t, err, "Failed to get rover")
|
||||||
|
|
||||||
for i := 0; i < rover.Capacity; i++ {
|
for i := 0; i < rover.Capacity; i++ {
|
||||||
// Place an object
|
// Place an object
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectRockSmall})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_RockSmall})
|
||||||
|
|
||||||
// Pick it up
|
// Pick it up
|
||||||
o, err := world.RoverStash(a)
|
o, err := world.RoverStash(a)
|
||||||
assert.NoError(t, err, "Failed to stash")
|
assert.NoError(t, err, "Failed to stash")
|
||||||
assert.Equal(t, atlas.ObjectRockSmall, o, "Failed to get correct object")
|
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
||||||
|
|
||||||
// Check it's gone
|
// Check it's gone
|
||||||
_, obj := world.Atlas.QueryPosition(pos)
|
_, obj := world.Atlas.QueryPosition(pos)
|
||||||
assert.Equal(t, atlas.ObjectNone, obj.Type, "Stash failed to remove object from atlas")
|
assert.Equal(t, roveapi.Object_ObjectNone, obj.Type, "Stash failed to remove object from atlas")
|
||||||
|
|
||||||
// Check we have it
|
// Check we have it
|
||||||
inv, err := world.RoverInventory(a)
|
inv, err := world.RoverInventory(a)
|
||||||
assert.NoError(t, err, "Failed to get inventory")
|
assert.NoError(t, err, "Failed to get inventory")
|
||||||
assert.Equal(t, i+1, len(inv))
|
assert.Equal(t, i+1, len(inv))
|
||||||
assert.Equal(t, atlas.Object{Type: atlas.ObjectRockSmall}, inv[i])
|
assert.Equal(t, atlas.Object{Type: roveapi.Object_RockSmall}, inv[i])
|
||||||
|
|
||||||
// Check that this did reduce the charge
|
// Check that this did reduce the charge
|
||||||
info, err := world.GetRover(a)
|
info, err := world.GetRover(a)
|
||||||
|
@ -186,16 +186,16 @@ func TestWorld_RoverStash(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place an object
|
// Place an object
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectRockSmall})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_RockSmall})
|
||||||
|
|
||||||
// Try to pick it up
|
// Try to pick it up
|
||||||
o, err := world.RoverStash(a)
|
o, err := world.RoverStash(a)
|
||||||
assert.NoError(t, err, "Failed to stash")
|
assert.NoError(t, err, "Failed to stash")
|
||||||
assert.Equal(t, atlas.ObjectNone, o, "Failed to get correct object")
|
assert.Equal(t, roveapi.Object_ObjectNone, o, "Failed to get correct object")
|
||||||
|
|
||||||
// Check it's still there
|
// Check it's still there
|
||||||
_, obj := world.Atlas.QueryPosition(pos)
|
_, obj := world.Atlas.QueryPosition(pos)
|
||||||
assert.Equal(t, atlas.ObjectRockSmall, obj.Type, "Stash failed to remove object from atlas")
|
assert.Equal(t, roveapi.Object_RockSmall, obj.Type, "Stash failed to remove object from atlas")
|
||||||
|
|
||||||
// Check we don't have it
|
// Check we don't have it
|
||||||
inv, err := world.RoverInventory(a)
|
inv, err := world.RoverInventory(a)
|
||||||
|
@ -224,7 +224,7 @@ func TestWorld_RoverDamage(t *testing.T) {
|
||||||
info, err := world.GetRover(a)
|
info, err := world.GetRover(a)
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
assert.NoError(t, err, "couldn't get rover info")
|
||||||
|
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, atlas.Object{Type: atlas.ObjectRockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, atlas.Object{Type: roveapi.Object_RockLarge})
|
||||||
|
|
||||||
vec, err := world.MoveRover(a, maths.North)
|
vec, err := world.MoveRover(a, maths.North)
|
||||||
assert.NoError(t, err, "Failed to move rover")
|
assert.NoError(t, err, "Failed to move rover")
|
||||||
|
@ -246,8 +246,8 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
Y: 0.0,
|
Y: 0.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
world.Atlas.SetTile(pos, atlas.TileNone)
|
world.Atlas.SetTile(pos, roveapi.Tile_TileNone)
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectNone})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
|
|
||||||
err = world.WarpRover(a, pos)
|
err = world.WarpRover(a, pos)
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
assert.NoError(t, err, "Failed to set position for rover")
|
||||||
|
@ -256,12 +256,12 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
assert.NoError(t, err, "couldn't get rover info")
|
||||||
|
|
||||||
// Pick up something to repair with
|
// Pick up something to repair with
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectRockSmall})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_RockSmall})
|
||||||
o, err := world.RoverStash(a)
|
o, err := world.RoverStash(a)
|
||||||
assert.NoError(t, err, "Failed to stash")
|
assert.NoError(t, err, "Failed to stash")
|
||||||
assert.Equal(t, atlas.ObjectRockSmall, o, "Failed to get correct object")
|
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
||||||
|
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, atlas.Object{Type: atlas.ObjectRockLarge})
|
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, atlas.Object{Type: roveapi.Object_RockLarge})
|
||||||
|
|
||||||
// Try and bump into the rock
|
// Try and bump into the rock
|
||||||
vec, err := world.MoveRover(a, maths.North)
|
vec, err := world.MoveRover(a, maths.North)
|
||||||
|
@ -281,10 +281,10 @@ func TestWorld_RoverRepair(t *testing.T) {
|
||||||
assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "repair", "Rover logs should contain the repair")
|
assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "repair", "Rover logs should contain the repair")
|
||||||
|
|
||||||
// Check again that it can't repair past the max
|
// Check again that it can't repair past the max
|
||||||
world.Atlas.SetObject(pos, atlas.Object{Type: atlas.ObjectRockSmall})
|
world.Atlas.SetObject(pos, atlas.Object{Type: roveapi.Object_RockSmall})
|
||||||
o, err = world.RoverStash(a)
|
o, err = world.RoverStash(a)
|
||||||
assert.NoError(t, err, "Failed to stash")
|
assert.NoError(t, err, "Failed to stash")
|
||||||
assert.Equal(t, atlas.ObjectRockSmall, 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(&Command{Command: roveapi.CommandType_repair}, a)
|
||||||
assert.NoError(t, err, "Failed to repair rover")
|
assert.NoError(t, err, "Failed to repair rover")
|
||||||
|
@ -311,8 +311,8 @@ func TestWorld_Charge(t *testing.T) {
|
||||||
assert.NoError(t, err, "Failed to get position for rover")
|
assert.NoError(t, err, "Failed to get position for rover")
|
||||||
|
|
||||||
// Ensure the path ahead is empty
|
// Ensure the path ahead is empty
|
||||||
world.Atlas.SetTile(initialPos.Added(maths.North.Vector()), atlas.TileRock)
|
world.Atlas.SetTile(initialPos.Added(maths.North.Vector()), roveapi.Tile_Rock)
|
||||||
world.Atlas.SetObject(initialPos.Added(maths.North.Vector()), atlas.Object{Type: atlas.ObjectNone})
|
world.Atlas.SetObject(initialPos.Added(maths.North.Vector()), atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
|
|
||||||
// Try and move north (along unblocked path)
|
// Try and move north (along unblocked path)
|
||||||
newPos, err := world.MoveRover(a, maths.North)
|
newPos, err := world.MoveRover(a, maths.North)
|
||||||
|
@ -394,7 +394,7 @@ func TestWorld_Broadcast(t *testing.T) {
|
||||||
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "ABC", "Rover A should have logged it's broadcast")
|
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "ABC", "Rover A should have logged it's broadcast")
|
||||||
|
|
||||||
// Warp B outside of the range of A
|
// Warp B outside of the range of A
|
||||||
world.Atlas.SetObject(maths.Vector{X: ra.Range, Y: 0}, atlas.Object{Type: atlas.ObjectNone})
|
world.Atlas.SetObject(maths.Vector{X: ra.Range, Y: 0}, atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
assert.NoError(t, world.WarpRover(b, maths.Vector{X: ra.Range, Y: 0}))
|
assert.NoError(t, world.WarpRover(b, maths.Vector{X: ra.Range, Y: 0}))
|
||||||
|
|
||||||
// Broadcast from a again
|
// Broadcast from a again
|
||||||
|
@ -411,7 +411,7 @@ func TestWorld_Broadcast(t *testing.T) {
|
||||||
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "XYZ", "Rover A should have logged it's broadcast")
|
assert.Contains(t, rb.Logs[len(rb.Logs)-1].Text, "XYZ", "Rover A should have logged it's broadcast")
|
||||||
|
|
||||||
// Warp B outside of the range of A
|
// Warp B outside of the range of A
|
||||||
world.Atlas.SetObject(maths.Vector{X: ra.Range + 1, Y: 0}, atlas.Object{Type: atlas.ObjectNone})
|
world.Atlas.SetObject(maths.Vector{X: ra.Range + 1, Y: 0}, atlas.Object{Type: roveapi.Object_ObjectNone})
|
||||||
assert.NoError(t, world.WarpRover(b, maths.Vector{X: ra.Range + 1, Y: 0}))
|
assert.NoError(t, world.WarpRover(b, maths.Vector{X: ra.Range + 1, Y: 0}))
|
||||||
|
|
||||||
// Broadcast from a again
|
// Broadcast from a again
|
||||||
|
|
|
@ -98,6 +98,119 @@ func (CommandType) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{0}
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Types of objects
|
||||||
|
type Object int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ObjectNone represents no object at all
|
||||||
|
Object_ObjectNone Object = 0
|
||||||
|
// RoverLive represents a live rover
|
||||||
|
Object_RoverLive Object = 1
|
||||||
|
// RockSmall is a small stashable rock
|
||||||
|
Object_RockSmall Object = 2
|
||||||
|
// RockLarge is a large blocking rock
|
||||||
|
Object_RockLarge Object = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for Object.
|
||||||
|
var (
|
||||||
|
Object_name = map[int32]string{
|
||||||
|
0: "ObjectNone",
|
||||||
|
1: "RoverLive",
|
||||||
|
2: "RockSmall",
|
||||||
|
3: "RockLarge",
|
||||||
|
}
|
||||||
|
Object_value = map[string]int32{
|
||||||
|
"ObjectNone": 0,
|
||||||
|
"RoverLive": 1,
|
||||||
|
"RockSmall": 2,
|
||||||
|
"RockLarge": 3,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x Object) Enum() *Object {
|
||||||
|
p := new(Object)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Object) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Object) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_roveapi_roveapi_proto_enumTypes[1].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Object) Type() protoreflect.EnumType {
|
||||||
|
return &file_roveapi_roveapi_proto_enumTypes[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Object) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Object.Descriptor instead.
|
||||||
|
func (Object) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Tile int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TileNone is a keyword for nothing
|
||||||
|
Tile_TileNone Tile = 0
|
||||||
|
// Rock is solid rock ground
|
||||||
|
Tile_Rock Tile = 1
|
||||||
|
// Gravel is loose rocks
|
||||||
|
Tile_Gravel Tile = 2
|
||||||
|
// Sand is sand
|
||||||
|
Tile_Sand Tile = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for Tile.
|
||||||
|
var (
|
||||||
|
Tile_name = map[int32]string{
|
||||||
|
0: "TileNone",
|
||||||
|
1: "Rock",
|
||||||
|
2: "Gravel",
|
||||||
|
3: "Sand",
|
||||||
|
}
|
||||||
|
Tile_value = map[string]int32{
|
||||||
|
"TileNone": 0,
|
||||||
|
"Rock": 1,
|
||||||
|
"Gravel": 2,
|
||||||
|
"Sand": 3,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x Tile) Enum() *Tile {
|
||||||
|
p := new(Tile)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Tile) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Tile) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_roveapi_roveapi_proto_enumTypes[2].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Tile) Type() protoreflect.EnumType {
|
||||||
|
return &file_roveapi_roveapi_proto_enumTypes[2]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Tile) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Tile.Descriptor instead.
|
||||||
|
func (Tile) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_roveapi_roveapi_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
// ServerStatusRequest is an empty placeholder
|
// ServerStatusRequest is an empty placeholder
|
||||||
type ServerStatusRequest struct {
|
type ServerStatusRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
|
@ -629,9 +742,9 @@ type RadarResponse struct {
|
||||||
Range int32 `protobuf:"varint,1,opt,name=range,proto3" json:"range,omitempty"`
|
Range int32 `protobuf:"varint,1,opt,name=range,proto3" json:"range,omitempty"`
|
||||||
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom
|
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom
|
||||||
// left and in row->column order
|
// left and in row->column order
|
||||||
Tiles []byte `protobuf:"bytes,2,opt,name=tiles,proto3" json:"tiles,omitempty"`
|
Tiles []Tile `protobuf:"varint,2,rep,packed,name=tiles,proto3,enum=roveapi.Tile" json:"tiles,omitempty"`
|
||||||
// A similar array to the tile array, but containing objects
|
// A similar array to the tile array, but containing objects
|
||||||
Objects []byte `protobuf:"bytes,3,opt,name=objects,proto3" json:"objects,omitempty"`
|
Objects []Object `protobuf:"varint,3,rep,packed,name=objects,proto3,enum=roveapi.Object" json:"objects,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RadarResponse) Reset() {
|
func (x *RadarResponse) Reset() {
|
||||||
|
@ -673,14 +786,14 @@ func (x *RadarResponse) GetRange() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RadarResponse) GetTiles() []byte {
|
func (x *RadarResponse) GetTiles() []Tile {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Tiles
|
return x.Tiles
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RadarResponse) GetObjects() []byte {
|
func (x *RadarResponse) GetObjects() []Object {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Objects
|
return x.Objects
|
||||||
}
|
}
|
||||||
|
@ -1044,11 +1157,13 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{
|
||||||
0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01,
|
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,
|
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,
|
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22,
|
||||||
0x55, 0x0a, 0x0d, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
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,
|
0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x18,
|
0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x18,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07,
|
0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f,
|
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,
|
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,
|
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,
|
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
|
@ -1092,31 +1207,39 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{
|
||||||
0x01, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06,
|
0x01, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06,
|
||||||
0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x68,
|
0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x68,
|
||||||
0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63,
|
0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63,
|
||||||
0x61, 0x73, 0x74, 0x10, 0x05, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d,
|
0x61, 0x73, 0x74, 0x10, 0x05, 0x2a, 0x45, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12,
|
||||||
0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c,
|
0x0e, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12,
|
||||||
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53,
|
0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x0d,
|
||||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72,
|
0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x02, 0x12, 0x0d, 0x0a,
|
||||||
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61,
|
0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x03, 0x2a, 0x34, 0x0a, 0x04,
|
||||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a,
|
0x54, 0x69, 0x6c, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x69, 0x6c, 0x65, 0x4e, 0x6f, 0x6e, 0x65,
|
||||||
0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
|
||||||
0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64,
|
||||||
0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65,
|
0x10, 0x03, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53,
|
||||||
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f,
|
||||||
0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f,
|
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74,
|
||||||
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71,
|
0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43,
|
0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||||
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65,
|
||||||
0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69,
|
||||||
0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72,
|
0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74,
|
0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53,
|
0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72,
|
0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73,
|
0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
|
0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a,
|
||||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76,
|
0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69,
|
||||||
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62,
|
0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73,
|
||||||
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||||
|
0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74,
|
||||||
|
0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
|
0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
|
0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||||
|
0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1131,51 +1254,55 @@ 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, 1)
|
var file_roveapi_roveapi_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||||
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
|
||||||
(*ServerStatusRequest)(nil), // 1: roveapi.ServerStatusRequest
|
(Object)(0), // 1: roveapi.Object
|
||||||
(*ServerStatusResponse)(nil), // 2: roveapi.ServerStatusResponse
|
(Tile)(0), // 2: roveapi.Tile
|
||||||
(*RegisterRequest)(nil), // 3: roveapi.RegisterRequest
|
(*ServerStatusRequest)(nil), // 3: roveapi.ServerStatusRequest
|
||||||
(*Account)(nil), // 4: roveapi.Account
|
(*ServerStatusResponse)(nil), // 4: roveapi.ServerStatusResponse
|
||||||
(*RegisterResponse)(nil), // 5: roveapi.RegisterResponse
|
(*RegisterRequest)(nil), // 5: roveapi.RegisterRequest
|
||||||
(*Command)(nil), // 6: roveapi.Command
|
(*Account)(nil), // 6: roveapi.Account
|
||||||
(*CommandRequest)(nil), // 7: roveapi.CommandRequest
|
(*RegisterResponse)(nil), // 7: roveapi.RegisterResponse
|
||||||
(*CommandResponse)(nil), // 8: roveapi.CommandResponse
|
(*Command)(nil), // 8: roveapi.Command
|
||||||
(*RadarRequest)(nil), // 9: roveapi.RadarRequest
|
(*CommandRequest)(nil), // 9: roveapi.CommandRequest
|
||||||
(*RadarResponse)(nil), // 10: roveapi.RadarResponse
|
(*CommandResponse)(nil), // 10: roveapi.CommandResponse
|
||||||
(*StatusRequest)(nil), // 11: roveapi.StatusRequest
|
(*RadarRequest)(nil), // 11: roveapi.RadarRequest
|
||||||
(*Log)(nil), // 12: roveapi.Log
|
(*RadarResponse)(nil), // 12: roveapi.RadarResponse
|
||||||
(*Vector)(nil), // 13: roveapi.Vector
|
(*StatusRequest)(nil), // 13: roveapi.StatusRequest
|
||||||
(*StatusResponse)(nil), // 14: roveapi.StatusResponse
|
(*Log)(nil), // 14: roveapi.Log
|
||||||
|
(*Vector)(nil), // 15: roveapi.Vector
|
||||||
|
(*StatusResponse)(nil), // 16: roveapi.StatusResponse
|
||||||
}
|
}
|
||||||
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
||||||
4, // 0: roveapi.RegisterResponse.account:type_name -> roveapi.Account
|
6, // 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
|
||||||
4, // 2: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
6, // 2: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
||||||
6, // 3: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
8, // 3: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
||||||
4, // 4: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
6, // 4: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
||||||
4, // 5: roveapi.StatusRequest.account:type_name -> roveapi.Account
|
2, // 5: roveapi.RadarResponse.tiles:type_name -> roveapi.Tile
|
||||||
13, // 6: roveapi.StatusResponse.position:type_name -> roveapi.Vector
|
1, // 6: roveapi.RadarResponse.objects:type_name -> roveapi.Object
|
||||||
6, // 7: roveapi.StatusResponse.incomingCommands:type_name -> roveapi.Command
|
6, // 7: roveapi.StatusRequest.account:type_name -> roveapi.Account
|
||||||
6, // 8: roveapi.StatusResponse.queuedCommands:type_name -> roveapi.Command
|
15, // 8: roveapi.StatusResponse.position:type_name -> roveapi.Vector
|
||||||
12, // 9: roveapi.StatusResponse.logs:type_name -> roveapi.Log
|
8, // 9: roveapi.StatusResponse.incomingCommands:type_name -> roveapi.Command
|
||||||
1, // 10: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest
|
8, // 10: roveapi.StatusResponse.queuedCommands:type_name -> roveapi.Command
|
||||||
3, // 11: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest
|
14, // 11: roveapi.StatusResponse.logs:type_name -> roveapi.Log
|
||||||
7, // 12: roveapi.Rove.Command:input_type -> roveapi.CommandRequest
|
3, // 12: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest
|
||||||
9, // 13: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest
|
5, // 13: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest
|
||||||
11, // 14: roveapi.Rove.Status:input_type -> roveapi.StatusRequest
|
9, // 14: roveapi.Rove.Command:input_type -> roveapi.CommandRequest
|
||||||
2, // 15: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse
|
11, // 15: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest
|
||||||
5, // 16: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse
|
13, // 16: roveapi.Rove.Status:input_type -> roveapi.StatusRequest
|
||||||
8, // 17: roveapi.Rove.Command:output_type -> roveapi.CommandResponse
|
4, // 17: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse
|
||||||
10, // 18: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse
|
7, // 18: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse
|
||||||
14, // 19: roveapi.Rove.Status:output_type -> roveapi.StatusResponse
|
10, // 19: roveapi.Rove.Command:output_type -> roveapi.CommandResponse
|
||||||
15, // [15:20] is the sub-list for method output_type
|
12, // 20: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse
|
||||||
10, // [10:15] is the sub-list for method input_type
|
16, // 21: roveapi.Rove.Status:output_type -> roveapi.StatusResponse
|
||||||
10, // [10:10] is the sub-list for extension type_name
|
17, // [17:22] is the sub-list for method output_type
|
||||||
10, // [10:10] is the sub-list for extension extendee
|
12, // [12:17] is the sub-list for method input_type
|
||||||
0, // [0:10] is the sub-list for field type_name
|
12, // [12:12] is the sub-list for extension type_name
|
||||||
|
12, // [12:12] is the sub-list for extension extendee
|
||||||
|
0, // [0:12] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_roveapi_roveapi_proto_init() }
|
func init() { file_roveapi_roveapi_proto_init() }
|
||||||
|
@ -1362,7 +1489,7 @@ func file_roveapi_roveapi_proto_init() {
|
||||||
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: 1,
|
NumEnums: 3,
|
||||||
NumMessages: 14,
|
NumMessages: 14,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
|
|
|
@ -134,6 +134,35 @@ message CommandResponse {}
|
||||||
// Radar
|
// Radar
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Types of objects
|
||||||
|
enum Object {
|
||||||
|
// ObjectNone represents no object at all
|
||||||
|
ObjectNone = 0;
|
||||||
|
|
||||||
|
// RoverLive represents a live rover
|
||||||
|
RoverLive = 1;
|
||||||
|
|
||||||
|
// RockSmall is a small stashable rock
|
||||||
|
RockSmall = 2;
|
||||||
|
|
||||||
|
// RockLarge is a large blocking rock
|
||||||
|
RockLarge = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Tile {
|
||||||
|
// TileNone is a keyword for nothing
|
||||||
|
TileNone = 0;
|
||||||
|
|
||||||
|
// Rock is solid rock ground
|
||||||
|
Rock = 1;
|
||||||
|
|
||||||
|
// Gravel is loose rocks
|
||||||
|
Gravel = 2;
|
||||||
|
|
||||||
|
// Sand is sand
|
||||||
|
Sand = 3;
|
||||||
|
}
|
||||||
|
|
||||||
// RadarRequest is the data needed to request the radar for a rover
|
// RadarRequest is the data needed to request the radar for a rover
|
||||||
message RadarRequest {
|
message RadarRequest {
|
||||||
// The account for this request
|
// The account for this request
|
||||||
|
@ -147,10 +176,10 @@ message RadarResponse {
|
||||||
|
|
||||||
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom
|
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom
|
||||||
// left and in row->column order
|
// left and in row->column order
|
||||||
bytes tiles = 2;
|
repeated Tile tiles = 2;
|
||||||
|
|
||||||
// A similar array to the tile array, but containing objects
|
// A similar array to the tile array, but containing objects
|
||||||
bytes objects = 3;
|
repeated Object objects = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue