Add an inventory to the rover
This commit is contained in:
parent
15b8f0a427
commit
8019ea4e25
3 changed files with 24 additions and 3 deletions
14
pkg/game/items.go
Normal file
14
pkg/game/items.go
Normal 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"`
|
||||
}
|
|
@ -18,6 +18,9 @@ type RoverAttributes struct {
|
|||
|
||||
// Pos represents where this rover is in the world
|
||||
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
|
||||
|
@ -27,4 +30,7 @@ type Rover struct {
|
|||
|
||||
// Attributes represents the physical attributes of the rover
|
||||
Attributes RoverAttributes `json:"attributes"`
|
||||
|
||||
// Inventory represents any items the rover is carrying
|
||||
Inventory []Item `json:"inventory"`
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ func (w *World) SpawnRover() (uuid.UUID, error) {
|
|||
Attributes: RoverAttributes{
|
||||
Speed: 1.0,
|
||||
Range: 5.0,
|
||||
Capacity: 5,
|
||||
Name: "rover",
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue