sector

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2018 License: AGPL-3.0 Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BondPoint

type BondPoint struct {
	ID       ulid.ID
	SectorID ulid.ID
	Position geometry.Vec3
}

BondPoint represents a connecting point to another sector.

type Entities

type Entities struct {
	SectorID  ulid.ID
	EntityIDs []ulid.ID
}

Entities represents a entity sector in a world.

type EntitiesMapper

type EntitiesMapper interface {
	GetEntities(EntitiesSubset) (Entities, error)
	AddEntityToSector(ulid.ID, ulid.ID) error
	RemoveEntityToSector(ulid.ID, ulid.ID) error
}

EntitiesMapper set or get sector entities. Can also add or remove individual entity to sector.

type EntitiesSubset

type EntitiesSubset struct {
	SectorID ulid.ID
}

EntitiesSubset retrieves one Entities per sector ulid.ID only.

type Mapper

type Mapper interface {
	SetSector(S) error
	GetSector(Subset) (S, error)
}

Mapper is the service for S.

type S

type S struct {
	ID         ulid.ID
	Size       geometry.Vec3
	BondPoints []BondPoint
}

S represents a cuboid in the world.

func (S) Adjacents

func (s S) Adjacents() map[ulid.ID]struct{}

Adjacents returns ids of adjacent sectors.

func (S) ClosestBP

func (s S) ClosestBP(position geometry.Vec3) BondPoint

ClosestBP returns the closest bond points in bps of position.

func (S) FindBP

func (s S) FindBP(id ulid.ID) BondPoint

FindBP returns a bond point corresponding to this id for this sector.

func (S) Out

func (s S) Out(position geometry.Vec3) bool

Out returns if a position is still in the sector.

type Starter

type Starter struct {
	SectorID ulid.ID
}

Starter is a starter sector

type StarterMapper

type StarterMapper interface {
	GetRandomStarter(StarterSubset) (Starter, error)
	SetStarter(Starter) error
	DelStarter(StarterSubset) error
}

StarterMapper interfaces starter data interactions.

type StarterSubset

type StarterSubset struct {
	ID ulid.ID
}

StarterSubset retrieves a Starter by ID.

type Subset

type Subset struct {
	ID ulid.ID
}

Subset allows to retrieve on sector by ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL