diff --git a/cmd/rove-server/internal/accounts.go b/cmd/rove-server/internal/accounts.go index 99362ad..9ae6db9 100644 --- a/cmd/rove-server/internal/accounts.go +++ b/cmd/rove-server/internal/accounts.go @@ -21,8 +21,8 @@ type Accountant interface { // Account represents a registered user type Account struct { // Name simply describes the account and must be unique - Name string `json:"name"` + Name string // Data represents internal account data - Data map[string]string `json:"data"` + Data map[string]string } diff --git a/cmd/rove-server/internal/simpleAccountant.go b/cmd/rove-server/internal/simpleAccountant.go index 3168f30..611ff59 100644 --- a/cmd/rove-server/internal/simpleAccountant.go +++ b/cmd/rove-server/internal/simpleAccountant.go @@ -9,7 +9,7 @@ import ( // SimpleAccountant manages a set of accounts type SimpleAccountant struct { - Accounts map[string]Account `json:"accounts"` + Accounts map[string]Account } // NewSimpleAccountant creates a new accountant diff --git a/cmd/rove/main.go b/cmd/rove/main.go index 2977baa..01e16ae 100644 --- a/cmd/rove/main.go +++ b/cmd/rove/main.go @@ -45,14 +45,14 @@ const gRPCport = 9090 // Account stores data for an account type Account struct { - Name string `json:"name"` - Secret string `json:"secret"` + Name string + Secret string } // Config is used to store internal data type Config struct { - Host string `json:"host,omitempty"` - Account Account `json:"account,omitempty"` + Host string + Account Account } // ConfigPath returns the configuration path diff --git a/pkg/maths/vector.go b/pkg/maths/vector.go index 92305cc..9b9d755 100644 --- a/pkg/maths/vector.go +++ b/pkg/maths/vector.go @@ -8,8 +8,8 @@ import ( // Vector desribes a 3D vector type Vector struct { - X int `json:"x"` - Y int `json:"y"` + X int + Y int } // Add adds one vector to another diff --git a/pkg/rove/chunkAtlas.go b/pkg/rove/chunkAtlas.go index f7ea36c..88f1102 100644 --- a/pkg/rove/chunkAtlas.go +++ b/pkg/rove/chunkAtlas.go @@ -11,27 +11,27 @@ import ( // chunk represents a fixed square grid of tiles type chunk struct { // Tiles represents the tiles within the chunk - Tiles []byte `json:"tiles"` + Tiles []byte // Objects represents the objects within the chunk // only one possible object per tile for now - Objects map[int]Object `json:"objects"` + Objects map[int]Object } // chunkBasedAtlas represents a grid of Chunks type chunkBasedAtlas struct { // Chunks represents all chunks in the world // This is intentionally not a 2D array so it can be expanded in all directions - Chunks []chunk `json:"chunks"` + Chunks []chunk // LowerBound is the origin of the bottom left corner of the current chunks in world space (current chunks cover >= this value) - LowerBound maths.Vector `json:"lowerBound"` + LowerBound maths.Vector // UpperBound is the top left corner of the current chunks (curent chunks cover < this value) - UpperBound maths.Vector `json:"upperBound"` + UpperBound maths.Vector // ChunkSize is the x/y dimensions of each square chunk - ChunkSize int `json:"chunksize"` + ChunkSize int // worldGen is the internal world generator worldGen WorldGen diff --git a/pkg/rove/objects.go b/pkg/rove/objects.go index 94595df..f1ce227 100644 --- a/pkg/rove/objects.go +++ b/pkg/rove/objects.go @@ -7,10 +7,10 @@ import ( // Object represents an object in the world type Object struct { // The type of the object - Type roveapi.Object `json:"type"` + Type roveapi.Object // Data is an internal type used for certain types of object - Data []byte `json:"data"` + Data []byte } // IsBlocking checks if an object is a blocking object diff --git a/pkg/rove/rover.go b/pkg/rove/rover.go index f1e0972..0bb9e4e 100644 --- a/pkg/rove/rover.go +++ b/pkg/rove/rover.go @@ -16,49 +16,49 @@ import ( // RoverLogEntry describes a single log entry for the rover type RoverLogEntry struct { // Time is the timestamp of the entry - Time time.Time `json:"time"` + Time time.Time // Text contains the information in this log entry - Text string `json:"text"` + Text string } // Rover describes a single rover in the world type Rover struct { // Unique name of this rover - Name string `json:"name"` + Name string // Pos represents where this rover is in the world - Pos maths.Vector `json:"pos"` + Pos maths.Vector // Bearing is the current direction the rover is facing - Bearing roveapi.Bearing `json:"bearing"` + Bearing roveapi.Bearing // Range represents the distance the unit's radar can see - Range int `json:"range"` + Range int // Inventory represents any items the rover is carrying - Inventory []Object `json:"inventory"` + Inventory []Object // Capacity is the maximum number of inventory items - Capacity int `json:"capacity"` + Capacity int // Integrity represents current rover health - Integrity int `json:"integrity"` + Integrity int // MaximumIntegrity is the full integrity of the rover - MaximumIntegrity int `json:"maximum-integrity"` + MaximumIntegrity int // Charge is the amount of energy the rover has - Charge int `json:"charge"` + Charge int // MaximumCharge is the maximum charge able to be stored - MaximumCharge int `json:"maximum-charge"` + MaximumCharge int // SailPosition is the current position of the sails - SailPosition roveapi.SailPosition `json:"sail-position"` + SailPosition roveapi.SailPosition // Logs Stores log of information - Logs []RoverLogEntry `json:"logs"` + Logs []RoverLogEntry } // DefaultRover returns a default rover object with default settings diff --git a/pkg/rove/world.go b/pkg/rove/world.go index 9d2e27c..fa7a0e2 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -16,21 +16,21 @@ type CommandStream []*roveapi.Command // World describes a self contained universe and everything in it type World struct { // TicksPerDay is the amount of ticks in a single day - TicksPerDay int `json:"ticks-per-day"` + TicksPerDay int // Current number of ticks from the start - CurrentTicks int `json:"current-ticks"` + CurrentTicks int // Rovers is a id->data map of all the rovers in the game - Rovers map[string]*Rover `json:"rovers"` + Rovers map[string]*Rover // Atlas represends the world map of chunks and tiles - Atlas Atlas `json:"atlas"` + Atlas Atlas // Commands is the set of currently executing command streams per rover - CommandQueue map[string]CommandStream `json:"commands"` + CommandQueue map[string]CommandStream // Incoming represents the set of commands to add to the queue at the end of the current tick - CommandIncoming map[string]CommandStream `json:"incoming"` + CommandIncoming map[string]CommandStream // Mutex to lock around all world operations worldMutex sync.RWMutex