...

Package world

Overview ▾

func Coordinates

func Coordinates(x, y, z int) string

Coordinates returns the provided coordinates as a comma-delimited string.

type Entity

Entity represents an entity within the world.

type Entity struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewEntity

func NewEntity(t int) *Entity

NewEntity returns a new Entity.

func (*Entity) Coordinates

func (e *Entity) Coordinates() (x, y, z int)

Coordinates returns the position of the entity.

func (*Entity) Is

func (e *Entity) Is(t int) bool

Is returns whether the Entity matches the specified type.

type Map

Map represents a collection of entities in a 3D space.

type Map struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewMap

func NewMap() *Map

NewMap returns a new Map.

func (*Map) Add

func (m *Map) Add(e *Entity, x, y, z int)

Add adds an entity to the Map.

func (*Map) Contents

func (m *Map) Contents() map[string]*Entity

Contents returns the entities contained in the Map.