Merge pull request #34 from mdiluz/implement-salvage
Add rover salvage mechanics
This commit is contained in:
commit
fa05e7f253
14 changed files with 453 additions and 349 deletions
|
@ -34,7 +34,7 @@ func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*r
|
||||||
return nil, fmt.Errorf("empty account name")
|
return nil, fmt.Errorf("empty account name")
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc, err := s.accountant.RegisterAccount(req.Name); err != nil {
|
if acc, err := s.world.Accountant.RegisterAccount(req.Name); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
} else if _, err := s.SpawnRoverForAccount(req.Name); err != nil {
|
} else if _, err := s.SpawnRoverForAccount(req.Name); err != nil {
|
||||||
|
@ -57,13 +57,13 @@ func (s *Server) Register(ctx context.Context, req *roveapi.RegisterRequest) (*r
|
||||||
func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (response *roveapi.StatusResponse, err error) {
|
func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (response *roveapi.StatusResponse, err error) {
|
||||||
log.Printf("Handling status request: %s\n", req.Account.Name)
|
log.Printf("Handling status request: %s\n", req.Account.Name)
|
||||||
|
|
||||||
if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
} else if !valid {
|
} else if !valid {
|
||||||
return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name)
|
return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name)
|
||||||
|
|
||||||
} else if resp, err := s.accountant.GetValue(req.Account.Name, "rover"); err != nil {
|
} else if resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
} else if rover, err := s.world.GetRover(resp); err != nil {
|
} else if rover, err := s.world.GetRover(resp); err != nil {
|
||||||
|
@ -117,7 +117,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon
|
||||||
func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi.RadarResponse, error) {
|
func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi.RadarResponse, error) {
|
||||||
log.Printf("Handling radar request: %s\n", req.Account.Name)
|
log.Printf("Handling radar request: %s\n", req.Account.Name)
|
||||||
|
|
||||||
if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
} else if !valid {
|
} else if !valid {
|
||||||
|
@ -126,7 +126,7 @@ func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi
|
||||||
|
|
||||||
response := &roveapi.RadarResponse{}
|
response := &roveapi.RadarResponse{}
|
||||||
|
|
||||||
resp, err := s.accountant.GetValue(req.Account.Name, "rover")
|
resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
|
@ -149,14 +149,14 @@ func (s *Server) Radar(ctx context.Context, req *roveapi.RadarRequest) (*roveapi
|
||||||
func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*roveapi.CommandResponse, error) {
|
func (s *Server) Command(ctx context.Context, req *roveapi.CommandRequest) (*roveapi.CommandResponse, error) {
|
||||||
log.Printf("Handling command request: %s and %+v\n", req.Account.Name, req.Commands)
|
log.Printf("Handling command request: %s and %+v\n", req.Account.Name, req.Commands)
|
||||||
|
|
||||||
if valid, err := s.accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
if valid, err := s.world.Accountant.VerifySecret(req.Account.Name, req.Account.Secret); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
||||||
} else if !valid {
|
} else if !valid {
|
||||||
return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name)
|
return nil, fmt.Errorf("Secret incorrect for account %s", req.Account.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := s.accountant.GetValue(req.Account.Name, "rover")
|
resp, err := s.world.Accountant.GetValue(req.Account.Name, "rover")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,6 @@ type Server struct {
|
||||||
// Internal state
|
// Internal state
|
||||||
world *rove.World
|
world *rove.World
|
||||||
|
|
||||||
// Accountant
|
|
||||||
accountant Accountant
|
|
||||||
|
|
||||||
// gRPC server
|
// gRPC server
|
||||||
netListener net.Listener
|
netListener net.Listener
|
||||||
grpcServ *grpc.Server
|
grpcServ *grpc.Server
|
||||||
|
@ -80,7 +77,6 @@ func NewServer(opts ...ServerOption) *Server {
|
||||||
persistence: EphemeralData,
|
persistence: EphemeralData,
|
||||||
schedule: cron.New(),
|
schedule: cron.New(),
|
||||||
world: rove.NewWorld(32),
|
world: rove.NewWorld(32),
|
||||||
accountant: NewSimpleAccountant(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply all options
|
// Apply all options
|
||||||
|
@ -188,7 +184,7 @@ func (s *Server) SaveWorld() error {
|
||||||
if s.persistence == PersistentData {
|
if s.persistence == PersistentData {
|
||||||
s.world.RLock()
|
s.world.RLock()
|
||||||
defer s.world.RUnlock()
|
defer s.world.RUnlock()
|
||||||
if err := persistence.SaveAll("world", s.world, "accounts", s.accountant); err != nil {
|
if err := persistence.SaveAll("world", s.world); err != nil {
|
||||||
return fmt.Errorf("failed to save out persistent data: %s", err)
|
return fmt.Errorf("failed to save out persistent data: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +196,7 @@ func (s *Server) LoadWorld() error {
|
||||||
if s.persistence == PersistentData {
|
if s.persistence == PersistentData {
|
||||||
s.world.Lock()
|
s.world.Lock()
|
||||||
defer s.world.Unlock()
|
defer s.world.Unlock()
|
||||||
if err := persistence.LoadAll("world", &s.world, "accounts", &s.accountant); err != nil {
|
if err := persistence.LoadAll("world", &s.world); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,22 +205,10 @@ func (s *Server) LoadWorld() error {
|
||||||
|
|
||||||
// SpawnRoverForAccount spawns the rover rover for an account
|
// SpawnRoverForAccount spawns the rover rover for an account
|
||||||
func (s *Server) SpawnRoverForAccount(account string) (string, error) {
|
func (s *Server) SpawnRoverForAccount(account string) (string, error) {
|
||||||
inst, err := s.world.SpawnRover()
|
inst, err := s.world.SpawnRover(account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.accountant.AssignData(account, "rover", inst)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Failed to assign rover to account, %s", err)
|
|
||||||
|
|
||||||
// Try and clear up the rover
|
|
||||||
if err := s.world.DestroyRover(inst); err != nil {
|
|
||||||
log.Printf("Failed to destroy rover after failed rover assign: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return inst, nil
|
return inst, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ func printUsage() {
|
||||||
fmt.Fprintln(os.Stderr, "\tstash stores the object at the rover location in the inventory")
|
fmt.Fprintln(os.Stderr, "\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, "\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, "\tsalvage salvages a dormant rover for parts")
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
@ -243,8 +244,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_turn,
|
||||||
Broadcast: []byte(args[i]),
|
Bearing: b,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
case "broadcast":
|
case "broadcast":
|
||||||
|
@ -256,8 +257,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,
|
||||||
Broadcast: []byte(args[i]),
|
Data: []byte(args[i]),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package internal
|
package accounts
|
||||||
|
|
||||||
// Accountant decribes something that stores accounts and account values
|
// Accountant decribes something that stores accounts and account values
|
||||||
type Accountant interface {
|
type Accountant interface {
|
|
@ -1,4 +1,4 @@
|
||||||
package internal
|
package accounts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package internal
|
package accounts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,6 +1,7 @@
|
||||||
package rove
|
package rove
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
|
@ -10,7 +11,7 @@ import (
|
||||||
|
|
||||||
func TestCommand_Toggle(t *testing.T) {
|
func TestCommand_Toggle(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
a, err := w.SpawnRover()
|
a, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
r, err := w.GetRover(a)
|
r, err := w.GetRover(a)
|
||||||
|
@ -36,10 +37,10 @@ func TestCommand_Toggle(t *testing.T) {
|
||||||
|
|
||||||
func TestCommand_Turn(t *testing.T) {
|
func TestCommand_Turn(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
a, err := w.SpawnRover()
|
a, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Turn: roveapi.Bearing_NorthWest})
|
err = w.Enqueue(a, &roveapi.Command{Command: roveapi.CommandType_turn, Bearing: roveapi.Bearing_NorthWest})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
w.Tick()
|
w.Tick()
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ func TestCommand_Turn(t *testing.T) {
|
||||||
|
|
||||||
func TestCommand_Stash(t *testing.T) {
|
func TestCommand_Stash(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
name, err := w.SpawnRover()
|
name, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
info, err := w.GetRover(name)
|
info, err := w.GetRover(name)
|
||||||
|
@ -78,7 +79,7 @@ func TestCommand_Stash(t *testing.T) {
|
||||||
|
|
||||||
func TestCommand_Repair(t *testing.T) {
|
func TestCommand_Repair(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
name, err := w.SpawnRover()
|
name, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
info, err := w.GetRover(name)
|
info, err := w.GetRover(name)
|
||||||
|
@ -99,10 +100,10 @@ func TestCommand_Repair(t *testing.T) {
|
||||||
assert.Equal(t, info.MaximumIntegrity-1, info.Integrity)
|
assert.Equal(t, info.MaximumIntegrity-1, info.Integrity)
|
||||||
|
|
||||||
// Stash a repair object
|
// Stash a repair object
|
||||||
w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RockSmall})
|
w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RoverParts})
|
||||||
obj, err := w.RoverStash(name)
|
obj, err := w.RoverStash(name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, obj)
|
assert.Equal(t, roveapi.Object_RoverParts, obj)
|
||||||
|
|
||||||
// Enqueue the repair and tick
|
// Enqueue the repair and tick
|
||||||
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_repair})
|
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_repair})
|
||||||
|
@ -118,11 +119,11 @@ func TestCommand_Repair(t *testing.T) {
|
||||||
|
|
||||||
func TestCommand_Broadcast(t *testing.T) {
|
func TestCommand_Broadcast(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
name, err := w.SpawnRover()
|
name, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Enqueue the broadcast and tick
|
// Enqueue the broadcast and tick
|
||||||
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_broadcast, Broadcast: []byte("ABC")})
|
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_broadcast, Data: []byte("ABC")})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
w.Tick()
|
w.Tick()
|
||||||
|
|
||||||
|
@ -131,9 +132,88 @@ func TestCommand_Broadcast(t *testing.T) {
|
||||||
assert.Contains(t, info.Logs[len(info.Logs)-1].Text, "ABC")
|
assert.Contains(t, info.Logs[len(info.Logs)-1].Text, "ABC")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCommand_Salvage(t *testing.T) {
|
||||||
|
w := NewWorld(8)
|
||||||
|
name, err := w.SpawnRover("")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
info, err := w.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
w.Atlas.SetObject(info.Pos, Object{Type: roveapi.Object_RoverDormant})
|
||||||
|
|
||||||
|
// Enqueue the broadcast and tick
|
||||||
|
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_salvage})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
w.Tick()
|
||||||
|
|
||||||
|
// Check we now have some rover parts
|
||||||
|
info, err = w.GetRover(name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotEmpty(t, info.Inventory)
|
||||||
|
for _, i := range info.Inventory {
|
||||||
|
assert.Equal(t, roveapi.Object_RoverParts, i.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the dormant rover is gone
|
||||||
|
_, obj := w.Atlas.QueryPosition(info.Pos)
|
||||||
|
assert.Equal(t, roveapi.Object_ObjectUnknown, obj.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCommand_Transfer(t *testing.T) {
|
||||||
|
w := NewWorld(8)
|
||||||
|
acc, err := w.Accountant.RegisterAccount("tmp")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
nameA, err := w.SpawnRover(acc.Name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
infoA, err := w.GetRover(nameA)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// Drop a dormant rover on the current position
|
||||||
|
infoB := DefaultRover()
|
||||||
|
infoB.Name = "abc"
|
||||||
|
infoB.Pos = infoA.Pos
|
||||||
|
data, err := json.Marshal(infoB)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
w.Atlas.SetObject(infoA.Pos, Object{Type: roveapi.Object_RoverDormant, Data: data})
|
||||||
|
|
||||||
|
// Enqueue a transfer as well as a dud command
|
||||||
|
err = w.Enqueue(nameA,
|
||||||
|
&roveapi.Command{Command: roveapi.CommandType_transfer},
|
||||||
|
&roveapi.Command{Command: roveapi.CommandType_broadcast, Data: []byte("xyz")})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
w.Tick()
|
||||||
|
|
||||||
|
// Ensure both command queues are empty
|
||||||
|
assert.Empty(t, w.CommandQueue[nameA])
|
||||||
|
assert.Empty(t, w.CommandQueue[infoB.Name])
|
||||||
|
|
||||||
|
// Verify the account now controls the new rover
|
||||||
|
accountRover, err := w.Accountant.GetValue(acc.Name, "rover")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, infoB.Name, accountRover)
|
||||||
|
|
||||||
|
// Verify the position now has a dormant rover
|
||||||
|
_, obj := w.Atlas.QueryPosition(infoA.Pos)
|
||||||
|
assert.Equal(t, roveapi.Object_RoverDormant, obj.Type)
|
||||||
|
|
||||||
|
// Verify the stored data matches
|
||||||
|
var stored Rover
|
||||||
|
err = json.Unmarshal(obj.Data, &stored)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, infoA.Name, stored.Name)
|
||||||
|
|
||||||
|
// Verify the new rover data matches what we put in
|
||||||
|
infoB2, err := w.GetRover(infoB.Name)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, infoB.Name, infoB2.Name)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func TestCommand_Invalid(t *testing.T) {
|
func TestCommand_Invalid(t *testing.T) {
|
||||||
w := NewWorld(8)
|
w := NewWorld(8)
|
||||||
name, err := w.SpawnRover()
|
name, err := w.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_none})
|
err = w.Enqueue(name, &roveapi.Command{Command: roveapi.CommandType_none})
|
||||||
|
|
|
@ -17,7 +17,6 @@ type Object struct {
|
||||||
func (o *Object) IsBlocking() bool {
|
func (o *Object) IsBlocking() bool {
|
||||||
var blocking = [...]roveapi.Object{
|
var blocking = [...]roveapi.Object{
|
||||||
roveapi.Object_RoverLive,
|
roveapi.Object_RoverLive,
|
||||||
roveapi.Object_RoverDormant,
|
|
||||||
roveapi.Object_RockLarge,
|
roveapi.Object_RockLarge,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +32,7 @@ func (o *Object) IsBlocking() bool {
|
||||||
func (o *Object) IsStashable() bool {
|
func (o *Object) IsStashable() bool {
|
||||||
var stashable = [...]roveapi.Object{
|
var stashable = [...]roveapi.Object{
|
||||||
roveapi.Object_RockSmall,
|
roveapi.Object_RockSmall,
|
||||||
|
roveapi.Object_RoverParts,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range stashable {
|
for _, t := range stashable {
|
||||||
|
|
|
@ -66,6 +66,9 @@ type Rover struct {
|
||||||
|
|
||||||
// Logs Stores log of information
|
// Logs Stores log of information
|
||||||
Logs []RoverLogEntry
|
Logs []RoverLogEntry
|
||||||
|
|
||||||
|
// The account that owns this rover
|
||||||
|
Owner string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultRover returns a default rover object with default settings
|
// DefaultRover returns a default rover object with default settings
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package rove
|
package rove
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/mdiluz/rove/pkg/accounts"
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
"github.com/mdiluz/rove/proto/roveapi"
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
)
|
)
|
||||||
|
@ -39,6 +41,9 @@ type World struct {
|
||||||
// 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
|
CommandQueue map[string]CommandStream
|
||||||
|
|
||||||
|
// Accountant
|
||||||
|
Accountant accounts.Accountant
|
||||||
|
|
||||||
// Mutex to lock around all world operations
|
// Mutex to lock around all world operations
|
||||||
worldMutex sync.RWMutex
|
worldMutex sync.RWMutex
|
||||||
// Mutex to lock around command operations
|
// Mutex to lock around command operations
|
||||||
|
@ -53,17 +58,21 @@ func NewWorld(chunkSize int) *World {
|
||||||
Atlas: NewChunkAtlas(chunkSize),
|
Atlas: NewChunkAtlas(chunkSize),
|
||||||
TicksPerDay: 24,
|
TicksPerDay: 24,
|
||||||
CurrentTicks: 0,
|
CurrentTicks: 0,
|
||||||
|
Accountant: accounts.NewSimpleAccountant(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpawnRover adds an rover to the game
|
// SpawnRover adds an rover to the game
|
||||||
func (w *World) SpawnRover() (string, error) {
|
func (w *World) SpawnRover(account string) (string, error) {
|
||||||
w.worldMutex.Lock()
|
w.worldMutex.Lock()
|
||||||
defer w.worldMutex.Unlock()
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
// Initialise the rover
|
// Initialise the rover
|
||||||
rover := DefaultRover()
|
rover := DefaultRover()
|
||||||
|
|
||||||
|
// Assign the owner
|
||||||
|
rover.Owner = account
|
||||||
|
|
||||||
// Spawn in a random place near the origin
|
// Spawn in a random place near the origin
|
||||||
rover.Pos = maths.Vector{
|
rover.Pos = maths.Vector{
|
||||||
X: 10 - rand.Intn(20),
|
X: 10 - rand.Intn(20),
|
||||||
|
@ -88,7 +97,13 @@ func (w *World) SpawnRover() (string, error) {
|
||||||
// Append the rover to the list
|
// Append the rover to the list
|
||||||
w.Rovers[rover.Name] = rover
|
w.Rovers[rover.Name] = rover
|
||||||
|
|
||||||
return rover.Name, nil
|
var err error
|
||||||
|
// Only assign if we've been given an account
|
||||||
|
if len(account) > 0 {
|
||||||
|
err = w.Accountant.AssignData(account, "rover", rover.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rover.Name, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRover gets a specific rover by name
|
// GetRover gets a specific rover by name
|
||||||
|
@ -280,11 +295,13 @@ func (w *World) RoverStash(rover string) (roveapi.Object, error) {
|
||||||
|
|
||||||
// Can't pick up when full
|
// Can't pick up when full
|
||||||
if len(r.Inventory) >= r.Capacity {
|
if len(r.Inventory) >= r.Capacity {
|
||||||
|
r.AddLogEntryf("tried to stash object but inventory was full")
|
||||||
return roveapi.Object_ObjectUnknown, nil
|
return roveapi.Object_ObjectUnknown, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the rover has energy
|
// Ensure the rover has energy
|
||||||
if r.Charge <= 0 {
|
if r.Charge <= 0 {
|
||||||
|
r.AddLogEntryf("tried to stash object but had no charge")
|
||||||
return roveapi.Object_ObjectUnknown, nil
|
return roveapi.Object_ObjectUnknown, nil
|
||||||
}
|
}
|
||||||
r.Charge--
|
r.Charge--
|
||||||
|
@ -300,6 +317,99 @@ func (w *World) RoverStash(rover string) (roveapi.Object, error) {
|
||||||
return obj.Type, nil
|
return obj.Type, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RoverSalvage will salvage a rover for parts
|
||||||
|
func (w *World) RoverSalvage(rover string) (roveapi.Object, error) {
|
||||||
|
w.worldMutex.Lock()
|
||||||
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
r, ok := w.Rovers[rover]
|
||||||
|
if !ok {
|
||||||
|
return roveapi.Object_ObjectUnknown, fmt.Errorf("no rover matching id")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't pick up when full
|
||||||
|
if len(r.Inventory) >= r.Capacity {
|
||||||
|
r.AddLogEntryf("tried to salvage dormant rover but inventory was full")
|
||||||
|
return roveapi.Object_ObjectUnknown, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the rover has energy
|
||||||
|
if r.Charge <= 0 {
|
||||||
|
r.AddLogEntryf("tried to salvage dormant rover but had no charge")
|
||||||
|
return roveapi.Object_ObjectUnknown, nil
|
||||||
|
}
|
||||||
|
r.Charge--
|
||||||
|
|
||||||
|
_, obj := w.Atlas.QueryPosition(r.Pos)
|
||||||
|
if obj.Type != roveapi.Object_RoverDormant {
|
||||||
|
r.AddLogEntryf("tried to salvage dormant rover but found no rover to salvage")
|
||||||
|
return roveapi.Object_ObjectUnknown, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
r.AddLogEntryf("salvaged dormant rover")
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
if len(r.Inventory) == r.Capacity {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
r.Inventory = append(r.Inventory, Object{Type: roveapi.Object_RoverParts})
|
||||||
|
}
|
||||||
|
w.Atlas.SetObject(r.Pos, Object{Type: roveapi.Object_ObjectUnknown})
|
||||||
|
return obj.Type, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RoverTransfer will transfer rover control to dormant rover
|
||||||
|
func (w *World) RoverTransfer(rover string) (string, error) {
|
||||||
|
w.worldMutex.Lock()
|
||||||
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
oldRover, ok := w.Rovers[rover]
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("no rover matching id")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, obj := w.Atlas.QueryPosition(oldRover.Pos)
|
||||||
|
if obj.Type != roveapi.Object_RoverDormant {
|
||||||
|
oldRover.AddLogEntryf("tried to transfer to dormant rover but found no rover")
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unmarshal the dormant rover
|
||||||
|
var newRover Rover
|
||||||
|
err := json.Unmarshal(obj.Data, &newRover)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add logs
|
||||||
|
oldRover.AddLogEntryf("transferring to dormant rover %s", newRover.Name)
|
||||||
|
newRover.AddLogEntryf("transferred from rover %s", oldRover.Name)
|
||||||
|
|
||||||
|
// Transfer the ownership
|
||||||
|
err = w.Accountant.AssignData(oldRover.Owner, "rover", newRover.Name)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
newRover.Owner = oldRover.Owner
|
||||||
|
oldRover.Owner = ""
|
||||||
|
|
||||||
|
// Place the old rover in the world
|
||||||
|
oldRoverData, err := json.Marshal(oldRover)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
w.Atlas.SetObject(oldRover.Pos, Object{Type: roveapi.Object_RoverDormant, Data: oldRoverData})
|
||||||
|
|
||||||
|
// Swap the rovers in the tracking
|
||||||
|
w.Rovers[newRover.Name] = &newRover
|
||||||
|
delete(w.Rovers, oldRover.Name)
|
||||||
|
|
||||||
|
// Clear the command queues for both rovers
|
||||||
|
delete(w.CommandQueue, oldRover.Name)
|
||||||
|
delete(w.CommandQueue, newRover.Name)
|
||||||
|
|
||||||
|
return newRover.Name, nil
|
||||||
|
}
|
||||||
|
|
||||||
// RoverToggle will toggle the sail position
|
// RoverToggle will toggle the sail position
|
||||||
func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) {
|
func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) {
|
||||||
w.worldMutex.Lock()
|
w.worldMutex.Lock()
|
||||||
|
@ -352,11 +462,24 @@ func (w *World) RoverRepair(rover string) (int, error) {
|
||||||
return 0, fmt.Errorf("no rover matching id")
|
return 0, fmt.Errorf("no rover matching id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consume an inventory item to repair if possible
|
// Can't repair past max
|
||||||
if len(r.Inventory) > 0 && r.Integrity < r.MaximumIntegrity {
|
if r.Integrity >= r.MaximumIntegrity {
|
||||||
r.Inventory = r.Inventory[:len(r.Inventory)-1]
|
return r.Integrity, nil
|
||||||
r.Integrity = r.Integrity + 1
|
}
|
||||||
r.AddLogEntryf("repaired self to %d", r.Integrity)
|
|
||||||
|
// Find rover parts in inventory
|
||||||
|
for i, o := range r.Inventory {
|
||||||
|
if o.Type == roveapi.Object_RoverParts {
|
||||||
|
|
||||||
|
// Copy-erase from slice
|
||||||
|
r.Inventory[i] = r.Inventory[len(r.Inventory)-1]
|
||||||
|
r.Inventory = r.Inventory[:len(r.Inventory)-1]
|
||||||
|
|
||||||
|
// Repair
|
||||||
|
r.Integrity = r.Integrity + 1
|
||||||
|
r.AddLogEntryf("repaired self to %d", r.Integrity)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Integrity, nil
|
return r.Integrity, nil
|
||||||
|
@ -435,21 +558,23 @@ func (w *World) Enqueue(rover string, commands ...*roveapi.Command) error {
|
||||||
for _, c := range commands {
|
for _, c := range commands {
|
||||||
switch c.Command {
|
switch c.Command {
|
||||||
case roveapi.CommandType_broadcast:
|
case roveapi.CommandType_broadcast:
|
||||||
if len(c.GetBroadcast()) > 3 {
|
if len(c.GetData()) > 3 {
|
||||||
return fmt.Errorf("too many characters in message (limit 3): %d", len(c.GetBroadcast()))
|
return fmt.Errorf("too many characters in message (limit 3): %d", len(c.GetData()))
|
||||||
}
|
}
|
||||||
for _, b := range c.GetBroadcast() {
|
for _, b := range c.GetData() {
|
||||||
if b < 37 || b > 126 {
|
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:
|
case roveapi.CommandType_turn:
|
||||||
if c.GetTurn() == roveapi.Bearing_BearingUnknown {
|
if c.GetBearing() == roveapi.Bearing_BearingUnknown {
|
||||||
return fmt.Errorf("turn command given unknown bearing")
|
return fmt.Errorf("turn command given unknown bearing")
|
||||||
}
|
}
|
||||||
case roveapi.CommandType_toggle:
|
case roveapi.CommandType_toggle:
|
||||||
case roveapi.CommandType_stash:
|
case roveapi.CommandType_stash:
|
||||||
case roveapi.CommandType_repair:
|
case roveapi.CommandType_repair:
|
||||||
|
case roveapi.CommandType_salvage:
|
||||||
|
case roveapi.CommandType_transfer:
|
||||||
// Nothing to verify
|
// Nothing to verify
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unknown command: %s", c.Command)
|
return fmt.Errorf("unknown command: %s", c.Command)
|
||||||
|
@ -481,7 +606,10 @@ func (w *World) Tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the first command in the queue
|
// Extract the first command in the queue
|
||||||
w.CommandQueue[rover] = cmds[1:]
|
// Only if the command queue still has entries
|
||||||
|
if _, ok := w.CommandQueue[rover]; ok {
|
||||||
|
w.CommandQueue[rover] = cmds[1:]
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Clean out the empty entry
|
// Clean out the empty entry
|
||||||
|
@ -569,12 +697,22 @@ func (w *World) ExecuteCommand(c *roveapi.Command, rover string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case roveapi.CommandType_broadcast:
|
case roveapi.CommandType_broadcast:
|
||||||
if err := w.RoverBroadcast(rover, c.GetBroadcast()); err != nil {
|
if err := w.RoverBroadcast(rover, c.GetData()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case roveapi.CommandType_turn:
|
case roveapi.CommandType_turn:
|
||||||
if _, err := w.RoverTurn(rover, c.GetTurn()); err != nil {
|
if _, err := w.RoverTurn(rover, c.GetBearing()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
case roveapi.CommandType_salvage:
|
||||||
|
if _, err := w.RoverSalvage(rover); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
case roveapi.CommandType_transfer:
|
||||||
|
if _, err := w.RoverTransfer(rover); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ func TestNewWorld(t *testing.T) {
|
||||||
|
|
||||||
func TestWorld_CreateRover(t *testing.T) {
|
func TestWorld_CreateRover(t *testing.T) {
|
||||||
world := NewWorld(8)
|
world := NewWorld(8)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
b, err := world.SpawnRover()
|
b, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Basic duplicate check
|
// Basic duplicate check
|
||||||
|
@ -33,7 +33,7 @@ func TestWorld_CreateRover(t *testing.T) {
|
||||||
|
|
||||||
func TestWorld_GetRover(t *testing.T) {
|
func TestWorld_GetRover(t *testing.T) {
|
||||||
world := NewWorld(4)
|
world := NewWorld(4)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
rover, err := world.GetRover(a)
|
rover, err := world.GetRover(a)
|
||||||
|
@ -44,9 +44,9 @@ func TestWorld_GetRover(t *testing.T) {
|
||||||
|
|
||||||
func TestWorld_DestroyRover(t *testing.T) {
|
func TestWorld_DestroyRover(t *testing.T) {
|
||||||
world := NewWorld(1)
|
world := NewWorld(1)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
b, err := world.SpawnRover()
|
b, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
err = world.DestroyRover(a)
|
err = world.DestroyRover(a)
|
||||||
|
@ -62,7 +62,7 @@ func TestWorld_DestroyRover(t *testing.T) {
|
||||||
|
|
||||||
func TestWorld_GetSetMovePosition(t *testing.T) {
|
func TestWorld_GetSetMovePosition(t *testing.T) {
|
||||||
world := NewWorld(4)
|
world := NewWorld(4)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
pos := maths.Vector{
|
pos := maths.Vector{
|
||||||
|
@ -97,9 +97,9 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
|
||||||
func TestWorld_RadarFromRover(t *testing.T) {
|
func TestWorld_RadarFromRover(t *testing.T) {
|
||||||
// Create world that should have visible walls on the radar
|
// Create world that should have visible walls on the radar
|
||||||
world := NewWorld(2)
|
world := NewWorld(2)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
b, err := world.SpawnRover()
|
b, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Warp the rovers into position
|
// Warp the rovers into position
|
||||||
|
@ -128,9 +128,9 @@ func TestWorld_RadarFromRover(t *testing.T) {
|
||||||
assert.Equal(t, objs1, objs2)
|
assert.Equal(t, objs1, objs2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWorld_RoverStash(t *testing.T) {
|
func TestWorld_RoverDamage(t *testing.T) {
|
||||||
world := NewWorld(2)
|
world := NewWorld(2)
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
pos := maths.Vector{
|
pos := maths.Vector{
|
||||||
|
@ -142,78 +142,6 @@ func TestWorld_RoverStash(t *testing.T) {
|
||||||
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")
|
||||||
|
|
||||||
rover, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover")
|
|
||||||
|
|
||||||
for i := 0; i < rover.Capacity; i++ {
|
|
||||||
// Place an object
|
|
||||||
world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall})
|
|
||||||
|
|
||||||
// Pick it up
|
|
||||||
o, err := world.RoverStash(a)
|
|
||||||
assert.NoError(t, err, "Failed to stash")
|
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
|
||||||
|
|
||||||
// Check it's gone
|
|
||||||
_, obj := world.Atlas.QueryPosition(pos)
|
|
||||||
assert.Equal(t, roveapi.Object_ObjectUnknown, obj.Type, "Stash failed to remove object from atlas")
|
|
||||||
|
|
||||||
// Check we have it
|
|
||||||
inv, err := world.RoverInventory(a)
|
|
||||||
assert.NoError(t, err, "Failed to get inventory")
|
|
||||||
assert.Equal(t, i+1, len(inv))
|
|
||||||
assert.Equal(t, Object{Type: roveapi.Object_RockSmall}, inv[i])
|
|
||||||
|
|
||||||
// Check that this did reduce the charge
|
|
||||||
info, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover")
|
|
||||||
assert.Equal(t, info.MaximumCharge-(i+1), info.Charge, "Rover lost charge for stash")
|
|
||||||
assert.Contains(t, info.Logs[len(info.Logs)-1].Text, "stashed", "Rover logs should contain the move")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recharge the rover
|
|
||||||
for i := 0; i < rover.MaximumCharge; i++ {
|
|
||||||
_, err = world.RoverRecharge(a)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Place an object
|
|
||||||
world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall})
|
|
||||||
|
|
||||||
// Try to pick it up
|
|
||||||
o, err := world.RoverStash(a)
|
|
||||||
assert.NoError(t, err, "Failed to stash")
|
|
||||||
assert.Equal(t, roveapi.Object_ObjectUnknown, o, "Failed to get correct object")
|
|
||||||
|
|
||||||
// Check it's still there
|
|
||||||
_, obj := world.Atlas.QueryPosition(pos)
|
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, obj.Type, "Stash failed to remove object from atlas")
|
|
||||||
|
|
||||||
// Check we don't have it
|
|
||||||
inv, err := world.RoverInventory(a)
|
|
||||||
assert.NoError(t, err, "Failed to get inventory")
|
|
||||||
assert.Equal(t, rover.Capacity, len(inv))
|
|
||||||
|
|
||||||
// Check that this didn't reduce the charge
|
|
||||||
info, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "Failed to get rover")
|
|
||||||
assert.Equal(t, info.MaximumCharge, info.Charge, "Rover lost charge for non-stash")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWorld_RoverDamage(t *testing.T) {
|
|
||||||
world := NewWorld(2)
|
|
||||||
a, err := world.SpawnRover()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
pos := maths.Vector{
|
|
||||||
X: 0.0,
|
|
||||||
Y: 0.0,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = world.WarpRover(a, pos)
|
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
|
||||||
|
|
||||||
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")
|
||||||
|
|
||||||
|
@ -229,67 +157,10 @@ func TestWorld_RoverDamage(t *testing.T) {
|
||||||
assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "collision", "Rover logs should contain the collision")
|
assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "collision", "Rover logs should contain the collision")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWorld_RoverRepair(t *testing.T) {
|
|
||||||
world := NewWorld(2)
|
|
||||||
a, err := world.SpawnRover()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
pos := maths.Vector{
|
|
||||||
X: 0.0,
|
|
||||||
Y: 0.0,
|
|
||||||
}
|
|
||||||
|
|
||||||
world.Atlas.SetObject(pos, Object{Type: roveapi.Object_ObjectUnknown})
|
|
||||||
|
|
||||||
err = world.WarpRover(a, pos)
|
|
||||||
assert.NoError(t, err, "Failed to set position for rover")
|
|
||||||
|
|
||||||
originalInfo, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
|
||||||
|
|
||||||
// Pick up something to repair with
|
|
||||||
world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall})
|
|
||||||
o, err := world.RoverStash(a)
|
|
||||||
assert.NoError(t, err, "Failed to stash")
|
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
|
||||||
|
|
||||||
world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge})
|
|
||||||
|
|
||||||
// Try and bump into the rock
|
|
||||||
vec, err := world.TryMoveRover(a, roveapi.Bearing_North)
|
|
||||||
assert.NoError(t, err, "Failed to move rover")
|
|
||||||
assert.Equal(t, pos, vec, "Rover managed to move into large rock")
|
|
||||||
|
|
||||||
newinfo, err := world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
|
||||||
assert.Equal(t, originalInfo.Integrity-1, newinfo.Integrity, "rover should have lost integrity")
|
|
||||||
|
|
||||||
err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a)
|
|
||||||
assert.NoError(t, err, "Failed to repair rover")
|
|
||||||
|
|
||||||
newinfo, err = world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
|
||||||
assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have gained integrity")
|
|
||||||
assert.Contains(t, newinfo.Logs[len(newinfo.Logs)-1].Text, "repair", "Rover logs should contain the repair")
|
|
||||||
|
|
||||||
// Check again that it can't repair past the max
|
|
||||||
world.Atlas.SetObject(pos, Object{Type: roveapi.Object_RockSmall})
|
|
||||||
o, err = world.RoverStash(a)
|
|
||||||
assert.NoError(t, err, "Failed to stash")
|
|
||||||
assert.Equal(t, roveapi.Object_RockSmall, o, "Failed to get correct object")
|
|
||||||
|
|
||||||
err = world.ExecuteCommand(&roveapi.Command{Command: roveapi.CommandType_repair}, a)
|
|
||||||
assert.NoError(t, err, "Failed to repair rover")
|
|
||||||
|
|
||||||
newinfo, err = world.GetRover(a)
|
|
||||||
assert.NoError(t, err, "couldn't get rover info")
|
|
||||||
assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have kept the same integrity")
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestWorld_Daytime(t *testing.T) {
|
func TestWorld_Daytime(t *testing.T) {
|
||||||
world := NewWorld(1)
|
world := NewWorld(1)
|
||||||
|
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Remove rover charge
|
// Remove rover charge
|
||||||
|
@ -328,10 +199,10 @@ func TestWorld_Daytime(t *testing.T) {
|
||||||
func TestWorld_Broadcast(t *testing.T) {
|
func TestWorld_Broadcast(t *testing.T) {
|
||||||
world := NewWorld(8)
|
world := NewWorld(8)
|
||||||
|
|
||||||
a, err := world.SpawnRover()
|
a, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
b, err := world.SpawnRover()
|
b, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Warp rovers near to eachother
|
// Warp rovers near to eachother
|
||||||
|
@ -394,7 +265,7 @@ func TestWorld_Sailing(t *testing.T) {
|
||||||
world.Tick() // One initial tick to set the wind direction the first time
|
world.Tick() // One initial tick to set the wind direction the first time
|
||||||
world.Wind = roveapi.Bearing_North // Set the wind direction to north
|
world.Wind = roveapi.Bearing_North // Set the wind direction to north
|
||||||
|
|
||||||
name, err := world.SpawnRover()
|
name, err := world.SpawnRover("")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
// Warp the rover to 0,0 after clearing it
|
// Warp the rover to 0,0 after clearing it
|
||||||
|
|
|
@ -3,6 +3,7 @@ package rove
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
"github.com/mdiluz/rove/pkg/maths"
|
"github.com/mdiluz/rove/pkg/maths"
|
||||||
"github.com/mdiluz/rove/proto/roveapi"
|
"github.com/mdiluz/rove/proto/roveapi"
|
||||||
|
@ -76,6 +77,12 @@ func (g *NoiseWorldGen) GetObject(v maths.Vector) (obj Object) {
|
||||||
// Set the rover variables
|
// Set the rover variables
|
||||||
r.Pos = v
|
r.Pos = v
|
||||||
|
|
||||||
|
// Upgrade this rover randomly
|
||||||
|
r.MaximumCharge += rand.Int() % 3
|
||||||
|
r.MaximumIntegrity += rand.Int() % 3
|
||||||
|
r.Capacity += rand.Int() % 3
|
||||||
|
r.Range += rand.Int() % 3
|
||||||
|
|
||||||
// For now, mark the log as corrupted
|
// For now, mark the log as corrupted
|
||||||
r.AddLogEntryf("log corrupted")
|
r.AddLogEntryf("log corrupted")
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,18 @@ const (
|
||||||
CommandType_none CommandType = 0
|
CommandType_none CommandType = 0
|
||||||
// Toggles the sails, either catching the wind, or charging from the sun
|
// Toggles the sails, either catching the wind, or charging from the sun
|
||||||
CommandType_toggle CommandType = 1
|
CommandType_toggle CommandType = 1
|
||||||
// Turns the rover in the specified bearing, requires data
|
// Turns the rover in the specified bearing (requires bearing)
|
||||||
CommandType_turn CommandType = 2
|
CommandType_turn CommandType = 2
|
||||||
// Stashes item at current location in rover inventory
|
// Stashes item at current location in rover inventory
|
||||||
CommandType_stash CommandType = 3
|
CommandType_stash CommandType = 3
|
||||||
// Repairs the rover using an inventory object
|
// Repairs the rover using an inventory object
|
||||||
CommandType_repair CommandType = 4
|
CommandType_repair CommandType = 4
|
||||||
// Broadcasts a message to nearby rovers, requires data
|
// Broadcasts a message to nearby rovers (requires data)
|
||||||
CommandType_broadcast CommandType = 5
|
CommandType_broadcast CommandType = 5
|
||||||
|
// Salvages a neighboring dormant rover for parts
|
||||||
|
CommandType_salvage CommandType = 6
|
||||||
|
// Transfers remote control into dormant rover
|
||||||
|
CommandType_transfer CommandType = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for CommandType.
|
// Enum value maps for CommandType.
|
||||||
|
@ -60,6 +64,8 @@ var (
|
||||||
3: "stash",
|
3: "stash",
|
||||||
4: "repair",
|
4: "repair",
|
||||||
5: "broadcast",
|
5: "broadcast",
|
||||||
|
6: "salvage",
|
||||||
|
7: "transfer",
|
||||||
}
|
}
|
||||||
CommandType_value = map[string]int32{
|
CommandType_value = map[string]int32{
|
||||||
"none": 0,
|
"none": 0,
|
||||||
|
@ -68,6 +74,8 @@ var (
|
||||||
"stash": 3,
|
"stash": 3,
|
||||||
"repair": 4,
|
"repair": 4,
|
||||||
"broadcast": 5,
|
"broadcast": 5,
|
||||||
|
"salvage": 6,
|
||||||
|
"transfer": 7,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -181,6 +189,8 @@ const (
|
||||||
Object_RockSmall Object = 3
|
Object_RockSmall Object = 3
|
||||||
// RockLarge is a large blocking rock
|
// RockLarge is a large blocking rock
|
||||||
Object_RockLarge Object = 4
|
Object_RockLarge Object = 4
|
||||||
|
// RoverParts is one unit of rover parts, used for repairing and fixing the rover
|
||||||
|
Object_RoverParts Object = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for Object.
|
// Enum value maps for Object.
|
||||||
|
@ -191,6 +201,7 @@ var (
|
||||||
2: "RoverDormant",
|
2: "RoverDormant",
|
||||||
3: "RockSmall",
|
3: "RockSmall",
|
||||||
4: "RockLarge",
|
4: "RockLarge",
|
||||||
|
5: "RoverParts",
|
||||||
}
|
}
|
||||||
Object_value = map[string]int32{
|
Object_value = map[string]int32{
|
||||||
"ObjectUnknown": 0,
|
"ObjectUnknown": 0,
|
||||||
|
@ -198,6 +209,7 @@ var (
|
||||||
"RoverDormant": 2,
|
"RoverDormant": 2,
|
||||||
"RockSmall": 3,
|
"RockSmall": 3,
|
||||||
"RockLarge": 4,
|
"RockLarge": 4,
|
||||||
|
"RoverParts": 5,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -624,11 +636,10 @@ 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"`
|
||||||
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
// broadcast - a simple message, must be composed of up to 3 printable ASCII glyphs (32-126)
|
||||||
// maximum of three characters
|
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
Broadcast []byte `protobuf:"bytes,2,opt,name=broadcast,proto3" json:"broadcast,omitempty"`
|
// move - the bearing for the rover to turn to
|
||||||
// The bearing for the rover to turn to
|
Bearing Bearing `protobuf:"varint,3,opt,name=bearing,proto3,enum=roveapi.Bearing" json:"bearing,omitempty"`
|
||||||
Turn Bearing `protobuf:"varint,3,opt,name=turn,proto3,enum=roveapi.Bearing" json:"turn,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) Reset() {
|
func (x *Command) Reset() {
|
||||||
|
@ -670,16 +681,16 @@ func (x *Command) GetCommand() CommandType {
|
||||||
return CommandType_none
|
return CommandType_none
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) GetBroadcast() []byte {
|
func (x *Command) GetData() []byte {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Broadcast
|
return x.Data
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Command) GetTurn() Bearing {
|
func (x *Command) GetBearing() Bearing {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Turn
|
return x.Bearing
|
||||||
}
|
}
|
||||||
return Bearing_BearingUnknown
|
return Bearing_BearingUnknown
|
||||||
}
|
}
|
||||||
|
@ -1397,141 +1408,144 @@ 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, 0x7d, 0x0a, 0x07, 0x43, 0x6f, 0x6d,
|
0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x07, 0x43, 0x6f, 0x6d,
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18,
|
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d,
|
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d,
|
||||||
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73,
|
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61,
|
0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72,
|
||||||
0x73, 0x74, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
|
0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69,
|
0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, 0x61,
|
||||||
0x6e, 0x67, 0x52, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d,
|
0x72, 0x69, 0x6e, 0x67, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
|
||||||
0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63,
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f,
|
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70,
|
||||||
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61,
|
0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x02,
|
||||||
0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43,
|
||||||
0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d,
|
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73,
|
||||||
0x61, 0x6e, 0x64, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
|
0x22, 0x11, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x0c, 0x52, 0x61, 0x64, 0x61, 0x72,
|
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,
|
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,
|
||||||
0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
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,
|
0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69,
|
||||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20,
|
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x69,
|
0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65,
|
||||||
0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
0x78, 0x74, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01,
|
||||||
0x61, 0x70, 0x69, 0x2e, 0x54, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x74, 0x69, 0x6c, 0x65, 0x73, 0x12,
|
0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18,
|
||||||
0x29, 0x0a, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0e,
|
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x13, 0x52, 0x6f, 0x76,
|
||||||
0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63,
|
0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||||
0x74, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x74,
|
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x61,
|
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20,
|
||||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72,
|
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61,
|
||||||
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07,
|
0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61,
|
||||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x12,
|
0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
|
||||||
0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x69,
|
0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
|
||||||
0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69,
|
||||||
0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72,
|
0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61,
|
||||||
0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c,
|
0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d,
|
||||||
0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xad, 0x01, 0x0a,
|
0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a, 0x0b, 0x52, 0x6f, 0x76,
|
||||||
0x13, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
|
0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x65, 0x61, 0x72,
|
||||||
0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
|
0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67,
|
0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x62, 0x65, 0x61,
|
||||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a,
|
0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69,
|
||||||
0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x76,
|
||||||
0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6d, 0x61,
|
0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
|
||||||
0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04,
|
0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x49, 0x6e, 0x74,
|
0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01,
|
||||||
0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
|
0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1c, 0x0a,
|
||||||
0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6d,
|
0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
|
||||||
0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x22, 0x82, 0x02, 0x0a,
|
0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63,
|
||||||
0x0b, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07,
|
0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x68, 0x61,
|
||||||
0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e,
|
0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52,
|
0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x72, 0x6f,
|
||||||
0x07, 0x62, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x39, 0x0a, 0x0c, 0x73, 0x61, 0x69, 0x6c,
|
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x0e, 0x71,
|
||||||
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15,
|
0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x22, 0x84, 0x01,
|
||||||
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73,
|
0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x12,
|
||||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74,
|
0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79,
|
0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x65, 0x63, 0x74,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72,
|
0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x04,
|
||||||
0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x18, 0x04,
|
0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76,
|
||||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x69, 0x74, 0x79, 0x12,
|
0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, 0x69,
|
||||||
0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
|
||||||
0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65,
|
0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x67, 0x52, 0x04,
|
||||||
0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||||
0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18,
|
||||||
0x64, 0x52, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
|
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
||||||
0x73, 0x22, 0x84, 0x01, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69,
|
0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
|
||||||
0x6e, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x74, 0x61,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e,
|
0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
|
0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
|
||||||
0x12, 0x24, 0x0a, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10,
|
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69,
|
||||||
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67,
|
0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x52, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x03,
|
0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67,
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x4c,
|
0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a, 0x6e, 0x0a, 0x0b, 0x43,
|
||||||
0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61,
|
0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x6f,
|
||||||
0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x73,
|
0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, 0x01,
|
||||||
0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65,
|
0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74,
|
||||||
0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69,
|
0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10,
|
||||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x2c, 0x0a,
|
0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, 0x05,
|
||||||
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
|
0x12, 0x0b, 0x0a, 0x07, 0x73, 0x61, 0x6c, 0x76, 0x61, 0x67, 0x65, 0x10, 0x06, 0x12, 0x0c, 0x0a,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61,
|
0x08, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x10, 0x07, 0x2a, 0x83, 0x01, 0x0a, 0x07,
|
||||||
0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x08, 0x72,
|
0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69,
|
||||||
0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
|
0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x61,
|
0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x45,
|
||||||
0x64, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x73, 0x2a,
|
0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x03, 0x12,
|
||||||
0x53, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08,
|
0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, 0x12, 0x09,
|
||||||
0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67,
|
0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75,
|
||||||
0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09,
|
0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74,
|
||||||
0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70,
|
0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10,
|
||||||
0x61, 0x69, 0x72, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61,
|
0x08, 0x2a, 0x6a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f,
|
||||||
0x73, 0x74, 0x10, 0x05, 0x2a, 0x83, 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67,
|
0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d,
|
||||||
0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f,
|
0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a,
|
||||||
0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12,
|
0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12,
|
||||||
0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08,
|
0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d,
|
||||||
0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74,
|
0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x12, 0x0e, 0x0a,
|
||||||
0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68,
|
0x0a, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x73, 0x10, 0x05, 0x2a, 0x37, 0x0a,
|
||||||
0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10,
|
0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b,
|
||||||
0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e,
|
0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01,
|
||||||
0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x08, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62,
|
0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04,
|
||||||
0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e,
|
0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f,
|
||||||
0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72,
|
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77,
|
||||||
0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44,
|
0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12,
|
||||||
0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b,
|
0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10,
|
||||||
0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c,
|
0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69,
|
||||||
0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f,
|
0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a,
|
||||||
0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12,
|
0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e,
|
||||||
0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61,
|
0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74,
|
||||||
0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a,
|
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f,
|
||||||
0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74,
|
||||||
0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f,
|
0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08,
|
||||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63,
|
0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f,
|
0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02,
|
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67,
|
||||||
0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69,
|
0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76,
|
||||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
|
0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53,
|
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
||||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
|
0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
||||||
0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69,
|
0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f,
|
0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52,
|
||||||
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d,
|
0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74,
|
||||||
0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f,
|
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f,
|
||||||
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72,
|
0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
|
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61,
|
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65,
|
||||||
0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61,
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06,
|
||||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
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 (
|
||||||
|
@ -1575,7 +1589,7 @@ var file_roveapi_roveapi_proto_goTypes = []interface{}{
|
||||||
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
var file_roveapi_roveapi_proto_depIdxs = []int32{
|
||||||
8, // 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.turn:type_name -> roveapi.Bearing
|
1, // 2: roveapi.Command.bearing:type_name -> roveapi.Bearing
|
||||||
8, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
8, // 3: roveapi.CommandRequest.account:type_name -> roveapi.Account
|
||||||
10, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
10, // 4: roveapi.CommandRequest.commands:type_name -> roveapi.Command
|
||||||
8, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
8, // 5: roveapi.RadarRequest.account:type_name -> roveapi.Account
|
||||||
|
|
|
@ -91,14 +91,18 @@ enum CommandType {
|
||||||
none = 0;
|
none = 0;
|
||||||
// Toggles the sails, either catching the wind, or charging from the sun
|
// Toggles the sails, either catching the wind, or charging from the sun
|
||||||
toggle = 1;
|
toggle = 1;
|
||||||
// Turns the rover in the specified bearing, requires data
|
// Turns the rover in the specified bearing (requires bearing)
|
||||||
turn = 2;
|
turn = 2;
|
||||||
// Stashes item at current location in rover inventory
|
// Stashes item at current location in rover inventory
|
||||||
stash = 3;
|
stash = 3;
|
||||||
// Repairs the rover using an inventory object
|
// Repairs the rover using an inventory object
|
||||||
repair = 4;
|
repair = 4;
|
||||||
// Broadcasts a message to nearby rovers, requires data
|
// Broadcasts a message to nearby rovers (requires data)
|
||||||
broadcast = 5;
|
broadcast = 5;
|
||||||
|
// Salvages a neighboring dormant rover for parts
|
||||||
|
salvage = 6;
|
||||||
|
// Transfers remote control into dormant rover
|
||||||
|
transfer = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bearing represents a compass direction
|
// Bearing represents a compass direction
|
||||||
|
@ -120,12 +124,11 @@ message Command {
|
||||||
// The command type
|
// The command type
|
||||||
CommandType command = 1;
|
CommandType command = 1;
|
||||||
|
|
||||||
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
// broadcast - a simple message, must be composed of up to 3 printable ASCII glyphs (32-126)
|
||||||
// maximum of three characters
|
bytes data = 2;
|
||||||
bytes broadcast = 2;
|
|
||||||
|
|
||||||
// The bearing for the rover to turn to
|
// move - the bearing for the rover to turn to
|
||||||
Bearing turn = 3;
|
Bearing bearing = 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
|
||||||
|
@ -160,6 +163,9 @@ enum Object {
|
||||||
|
|
||||||
// RockLarge is a large blocking rock
|
// RockLarge is a large blocking rock
|
||||||
RockLarge = 4;
|
RockLarge = 4;
|
||||||
|
|
||||||
|
// RoverParts is one unit of rover parts, used for repairing and fixing the rover
|
||||||
|
RoverParts = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Tile {
|
enum Tile {
|
||||||
|
|
Loading…
Add table
Reference in a new issue