rove/pkg/atlas/objects.go

41 lines
718 B
Go
Raw Normal View History

2020-07-10 18:39:33 +01:00
package atlas
import (
"github.com/mdiluz/rove/proto/roveapi"
)
// Object represents an object in the world
type Object struct {
2020-07-19 11:47:19 +01:00
// The type of the object
Type roveapi.Object `json:"type"`
}
2020-06-30 23:59:58 +01:00
// IsBlocking checks if an object is a blocking object
func (o *Object) IsBlocking() bool {
var blocking = [...]roveapi.Object{
roveapi.Object_RoverLive,
roveapi.Object_RockLarge,
}
for _, t := range blocking {
if o.Type == t {
return true
}
}
return false
}
2020-06-30 23:59:58 +01:00
// IsStashable checks if an object is stashable
func (o *Object) IsStashable() bool {
var stashable = [...]roveapi.Object{
roveapi.Object_RockSmall,
}
for _, t := range stashable {
if o.Type == t {
return true
}
}
return false
}