Add rover inventory capacity and test
This commit is contained in:
parent
e6ff453ff1
commit
2eaed1447d
7 changed files with 104 additions and 47 deletions
pkg/game
|
@ -77,6 +77,7 @@ func (w *World) SpawnRover() (string, error) {
|
|||
rover := Rover{
|
||||
Range: 4.0,
|
||||
Integrity: 10,
|
||||
Capacity: 10,
|
||||
Name: uuid.New().String(),
|
||||
}
|
||||
|
||||
|
@ -249,6 +250,11 @@ func (w *World) RoverStash(rover string) (objects.Type, error) {
|
|||
return objects.None, fmt.Errorf("no rover matching id")
|
||||
}
|
||||
|
||||
// Can't pick up when full
|
||||
if len(r.Inventory) >= r.Capacity {
|
||||
return objects.None, nil
|
||||
}
|
||||
|
||||
_, obj := w.Atlas.QueryPosition(r.Pos)
|
||||
if !obj.IsStashable() {
|
||||
return objects.None, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue