Rename Type to ObjectType
This commit is contained in:
parent
a0b811a659
commit
53d6ad08d9
2 changed files with 11 additions and 10 deletions
|
@ -1,31 +1,32 @@
|
||||||
package atlas
|
package atlas
|
||||||
|
|
||||||
// Type represents an object type
|
// ObjectType represents an object type
|
||||||
type Type byte
|
type ObjectType byte
|
||||||
|
|
||||||
// Types of objects
|
// Types of objects
|
||||||
const (
|
const (
|
||||||
// ObjectNone represents no object at all
|
// ObjectNone represents no object at all
|
||||||
ObjectNone = Type(GlyphNone)
|
ObjectNone = ObjectType(GlyphNone)
|
||||||
|
|
||||||
// ObjectRover represents a live rover
|
// ObjectRover represents a live rover
|
||||||
ObjectRover = Type(GlyphRover)
|
ObjectRover = ObjectType(GlyphRover)
|
||||||
|
|
||||||
// ObjectSmallRock is a small stashable rock
|
// ObjectSmallRock is a small stashable rock
|
||||||
ObjectSmallRock = Type(GlyphSmallRock)
|
ObjectSmallRock = ObjectType(GlyphSmallRock)
|
||||||
|
|
||||||
// ObjectLargeRock is a large blocking rock
|
// ObjectLargeRock is a large blocking rock
|
||||||
ObjectLargeRock = Type('O')
|
ObjectLargeRock = ObjectType(GlyphLargeRock)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object represents an object in the world
|
// Object represents an object in the world
|
||||||
type Object struct {
|
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
|
// IsBlocking checks if an object is a blocking object
|
||||||
func (o *Object) IsBlocking() bool {
|
func (o *Object) IsBlocking() bool {
|
||||||
var blocking = [...]Type{
|
var blocking = [...]ObjectType{
|
||||||
ObjectRover,
|
ObjectRover,
|
||||||
ObjectLargeRock,
|
ObjectLargeRock,
|
||||||
}
|
}
|
||||||
|
@ -40,7 +41,7 @@ func (o *Object) IsBlocking() bool {
|
||||||
|
|
||||||
// IsStashable checks if an object is stashable
|
// IsStashable checks if an object is stashable
|
||||||
func (o *Object) IsStashable() bool {
|
func (o *Object) IsStashable() bool {
|
||||||
var stashable = [...]Type{
|
var stashable = [...]ObjectType{
|
||||||
ObjectSmallRock,
|
ObjectSmallRock,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// 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()
|
w.worldMutex.Lock()
|
||||||
defer w.worldMutex.Unlock()
|
defer w.worldMutex.Unlock()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue