Add an inventory to the rover

This commit is contained in:
Marc Di Luzio 2020-06-26 18:13:23 +01:00
parent 15b8f0a427
commit 8019ea4e25
3 changed files with 24 additions and 3 deletions

14
pkg/game/items.go Normal file
View file

@ -0,0 +1,14 @@
package game
// Each item is a specific type
const (
ItemNone = byte(0)
// Describes a single rock
ItemRock = byte(1)
)
// Item describes an item that can be held
type Item struct {
Type byte `json:"type"`
}

View file

@ -18,6 +18,9 @@ type RoverAttributes struct {
// Pos represents where this rover is in the world // Pos represents where this rover is in the world
Pos vector.Vector `json:"pos"` Pos vector.Vector `json:"pos"`
// Capacity represents the maximum number of items the rover can carry
Capacity int `json:"capacity"`
} }
// Rover describes a single rover in the world // Rover describes a single rover in the world
@ -27,4 +30,7 @@ type Rover struct {
// Attributes represents the physical attributes of the rover // Attributes represents the physical attributes of the rover
Attributes RoverAttributes `json:"attributes"` Attributes RoverAttributes `json:"attributes"`
// Inventory represents any items the rover is carrying
Inventory []Item `json:"inventory"`
} }

View file

@ -90,6 +90,7 @@ func (w *World) SpawnRover() (uuid.UUID, error) {
Attributes: RoverAttributes{ Attributes: RoverAttributes{
Speed: 1.0, Speed: 1.0,
Range: 5.0, Range: 5.0,
Capacity: 5,
Name: "rover", Name: "rover",
}, },
} }