Rename Type to ObjectType

This commit is contained in:
Marc Di Luzio 2020-07-19 11:47:19 +01:00
parent a0b811a659
commit 53d6ad08d9
2 changed files with 11 additions and 10 deletions

View file

@ -1,31 +1,32 @@
package atlas
// Type represents an object type
type Type byte
// ObjectType represents an object type
type ObjectType byte
// Types of objects
const (
// ObjectNone represents no object at all
ObjectNone = Type(GlyphNone)
ObjectNone = ObjectType(GlyphNone)
// ObjectRover represents a live rover
ObjectRover = Type(GlyphRover)
ObjectRover = ObjectType(GlyphRover)
// ObjectSmallRock is a small stashable rock
ObjectSmallRock = Type(GlyphSmallRock)
ObjectSmallRock = ObjectType(GlyphSmallRock)
// ObjectLargeRock is a large blocking rock
ObjectLargeRock = Type('O')
ObjectLargeRock = ObjectType(GlyphLargeRock)
)
// Object represents an object in the world
type Object struct {
Type Type `json:"type"`
// The type of the object
Type ObjectType `json:"type"`
}
// IsBlocking checks if an object is a blocking object
func (o *Object) IsBlocking() bool {
var blocking = [...]Type{
var blocking = [...]ObjectType{
ObjectRover,
ObjectLargeRock,
}
@ -40,7 +41,7 @@ func (o *Object) IsBlocking() bool {
// IsStashable checks if an object is stashable
func (o *Object) IsStashable() bool {
var stashable = [...]Type{
var stashable = [...]ObjectType{
ObjectSmallRock,
}

View file

@ -318,7 +318,7 @@ func (w *World) MoveRover(rover string, b maths.Bearing) (maths.Vector, error) {
}
// RoverStash will stash an item at the current rovers position
func (w *World) RoverStash(rover string) (atlas.Type, error) {
func (w *World) RoverStash(rover string) (atlas.ObjectType, error) {
w.worldMutex.Lock()
defer w.worldMutex.Unlock()