2020-06-12 22:51:18 +01:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2020-06-13 13:38:12 +01:00
|
|
|
// Rove
|
|
|
|
//
|
|
|
|
// Rove is an asychronous nomadic game about exploring a planet as part of a loose community
|
2020-06-12 22:51:18 +01:00
|
|
|
package rove;
|
|
|
|
|
2020-06-13 00:23:21 +01:00
|
|
|
option go_package = "github.com/mdiluz/rove/pkg/rove";
|
|
|
|
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
2020-06-13 10:43:35 +01:00
|
|
|
service Rove {
|
2020-06-13 00:23:21 +01:00
|
|
|
// Server status
|
|
|
|
//
|
|
|
|
// Responds with various details about the current server status
|
2020-06-13 11:57:27 +01:00
|
|
|
rpc Status(StatusRequest) returns (StatusResponse) {
|
2020-06-13 00:23:21 +01:00
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/status"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Register an account
|
|
|
|
//
|
|
|
|
// Tries to register an account with the given name
|
2020-06-13 11:57:27 +01:00
|
|
|
rpc Register(RegisterRequest) returns (RegisterResponse) {
|
2020-06-13 00:23:21 +01:00
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/register"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2020-06-12 22:51:18 +01:00
|
|
|
|
|
|
|
// Send commands to rover
|
|
|
|
//
|
|
|
|
// Sending commands to this endpoint will queue them to be executed during the following ticks, in the order sent
|
2020-06-13 11:57:27 +01:00
|
|
|
rpc Commands(CommandsRequest) returns (CommandsResponse) {
|
2020-06-13 00:23:21 +01:00
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/commands"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2020-06-12 22:51:18 +01:00
|
|
|
|
|
|
|
// Get radar information
|
|
|
|
//
|
|
|
|
// Gets the radar output for the given rover
|
2020-06-13 00:23:21 +01:00
|
|
|
rpc Radar(RadarRequest) returns (RadarResponse) {
|
|
|
|
option (google.api.http) = {
|
2020-06-13 13:18:22 +01:00
|
|
|
post: "/radar"
|
|
|
|
body: "*"
|
2020-06-13 00:23:21 +01:00
|
|
|
};
|
|
|
|
}
|
2020-06-12 22:51:18 +01:00
|
|
|
|
|
|
|
// Get rover information
|
|
|
|
//
|
|
|
|
// Gets information for the account's rover
|
2020-06-13 00:23:21 +01:00
|
|
|
rpc Rover(RoverRequest) returns (RoverResponse) {
|
|
|
|
option (google.api.http) = {
|
2020-06-13 13:18:22 +01:00
|
|
|
post: "/rover"
|
|
|
|
body: "*"
|
2020-06-13 00:23:21 +01:00
|
|
|
};
|
|
|
|
}
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message Command {
|
2020-06-26 22:26:27 +01:00
|
|
|
// The command to execute
|
|
|
|
// "move" - Move the rover in a direction, requires bearing
|
|
|
|
// "stash" - Stashes item at current location in rover inventory
|
2020-06-27 01:35:09 +01:00
|
|
|
// "repair" - Repairs the rover using an inventory object
|
2020-06-12 22:51:18 +01:00
|
|
|
string command = 1;
|
|
|
|
|
2020-06-13 11:57:27 +01:00
|
|
|
// The bearing, example: NE
|
2020-06-12 22:51:18 +01:00
|
|
|
string bearing = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CommandsRequest {
|
2020-06-26 22:26:27 +01:00
|
|
|
// The account to execute these commands
|
2020-06-12 22:51:18 +01:00
|
|
|
string account = 1;
|
2020-06-13 11:57:27 +01:00
|
|
|
|
|
|
|
// The set of desired commands
|
2020-06-12 22:51:18 +01:00
|
|
|
repeated Command commands = 2;
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:57:27 +01:00
|
|
|
// Empty placeholder
|
|
|
|
message CommandsResponse {}
|
|
|
|
|
2020-06-12 22:51:18 +01:00
|
|
|
message Error {
|
|
|
|
// An explanation for the HTTP error returned
|
|
|
|
string error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RadarRequest {
|
2020-06-13 11:57:27 +01:00
|
|
|
// The account for this request
|
2020-06-12 22:51:18 +01:00
|
|
|
string account = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RadarResponse {
|
|
|
|
// The range in tiles from the rover of the radar data
|
|
|
|
int32 range = 1;
|
|
|
|
|
|
|
|
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom left and in row->column order
|
|
|
|
bytes tiles = 2;
|
|
|
|
}
|
|
|
|
|
2020-06-13 11:57:27 +01:00
|
|
|
// Empty placeholder
|
|
|
|
message RegisterResponse{}
|
|
|
|
|
2020-06-12 22:51:18 +01:00
|
|
|
message RegisterRequest {
|
2020-06-13 11:57:27 +01:00
|
|
|
// The desired account name
|
2020-06-12 22:51:18 +01:00
|
|
|
string name = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RoverRequest {
|
2020-06-13 11:57:27 +01:00
|
|
|
// The account for this request
|
2020-06-12 22:51:18 +01:00
|
|
|
string account = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message RoverResponse {
|
|
|
|
// The name of the rover
|
|
|
|
string name = 1;
|
|
|
|
|
|
|
|
// Position of the rover in world coordinates
|
|
|
|
Vector position = 2;
|
|
|
|
|
|
|
|
// The range of this rover's radar
|
|
|
|
int32 range = 3;
|
2020-06-26 23:44:52 +01:00
|
|
|
|
|
|
|
// The items in the rover inventory
|
|
|
|
bytes inventory = 4;
|
2020-06-27 01:14:17 +01:00
|
|
|
|
|
|
|
// The current health of the rover
|
|
|
|
int32 Integrity = 5;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-06-13 11:57:27 +01:00
|
|
|
// Empty placeholder
|
|
|
|
message StatusRequest {}
|
|
|
|
|
2020-06-12 22:51:18 +01:00
|
|
|
message StatusResponse {
|
|
|
|
// The time the next tick will occur
|
|
|
|
string next_tick = 1;
|
|
|
|
|
|
|
|
// Whether the server is ready to accept requests
|
|
|
|
bool ready = 2;
|
|
|
|
|
|
|
|
// The tick rate of the server in minutes (how many minutes per tick)
|
|
|
|
int32 tick = 3;
|
|
|
|
|
|
|
|
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
|
|
|
string version = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Vector {
|
|
|
|
int32 x = 1;
|
|
|
|
int32 y = 2;
|
|
|
|
}
|