ecs

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityIndexBits   = 20
	EntityIndexMask   = 1<<EntityIndexBits - 1
	EntityVersionBits = 32 - EntityIndexBits
	EntityVersionMask = math.MaxUint32 ^ EntityIndexMask
	DeadEntityID      = EntityIndexMask
)
View Source
const (
	EnumDirectionDirectionUnknown = 0
	EnumDirectionNorth            = 1
	EnumDirectionSouth            = 2
	EnumDirectionEast             = 4
	EnumDirectionWest             = 8
)

Variables

View Source
var (
	ErrEntityVersionMismatch = errors.New("entity version mismatch")
)

Functions

func EntitiesToU32s added in v0.2.0

func EntitiesToU32s(entities ...Entity) []uint32

func EnumDirectionSliceToPB added in v0.2.1

func EnumDirectionSliceToPB(e []EnumDirection) (pb []ecspb.DirectionEnum)

func MergeWorldWriteAheadLogs added in v0.2.0

func MergeWorldWriteAheadLogs(patchs ...*ecspb.WorldPatch) *ecspb.WorldPatch

func NewWorldPatch added in v0.2.0

func NewWorldPatch() *ecspb.WorldPatch

func ResetWorldPatch added in v0.2.0

func ResetWorldPatch(patch *ecspb.WorldPatch) *ecspb.WorldPatch

Types

type AlliedWith

type AlliedWith []Entity

func AlliedWithFromEntities

func AlliedWithFromEntities(e ...Entity) AlliedWith

func AlliedWithFromEntity

func AlliedWithFromEntity(c []Entity) AlliedWith

func AlliedWithFromPB added in v0.2.1

func AlliedWithFromPB(w *World, pb *ecspb.AlliedWithComponent) AlliedWith

func (AlliedWith) ToEntities

func (c AlliedWith) ToEntities() []Entity

func (AlliedWith) ToEntity

func (c AlliedWith) ToEntity() []Entity

func (AlliedWith) ToPB added in v0.2.0

func (AlliedWith) ToU32s added in v0.2.0

func (c AlliedWith) ToU32s() []uint32

type AlliedWithReadIterator

type AlliedWithReadIterator struct {
	// contains filtered or unexported fields
}

func (*AlliedWithReadIterator) HasNext

func (iter *AlliedWithReadIterator) HasNext() bool

func (*AlliedWithReadIterator) NextAlliedWith

func (iter *AlliedWithReadIterator) NextAlliedWith() (Entity, AlliedWith)

func (*AlliedWithReadIterator) NextEntity

func (iter *AlliedWithReadIterator) NextEntity() Entity

func (*AlliedWithReadIterator) Reset

func (iter *AlliedWithReadIterator) Reset()

type AlliedWithWriteIterator

type AlliedWithWriteIterator struct {
	// contains filtered or unexported fields
}

func (*AlliedWithWriteIterator) HasNext

func (iter *AlliedWithWriteIterator) HasNext() bool

func (*AlliedWithWriteIterator) NextAlliedWith

func (iter *AlliedWithWriteIterator) NextAlliedWith() (Entity, *AlliedWith, func())

func (*AlliedWithWriteIterator) NextEntity

func (iter *AlliedWithWriteIterator) NextEntity() Entity

func (*AlliedWithWriteIterator) Reset

func (iter *AlliedWithWriteIterator) Reset()

type ChildOf

type ChildOf Entity

func ChildOfFromEntity

func ChildOfFromEntity(c Entity) ChildOf

func (ChildOf) FromEntity

func (c ChildOf) FromEntity(e Entity) ChildOf

func (ChildOf) ToEntity

func (c ChildOf) ToEntity() Entity

func (ChildOf) ToPB added in v0.2.0

func (c ChildOf) ToPB() *ecspb.ChildOfComponent

type ChildOfReadIterator

type ChildOfReadIterator struct {
	// contains filtered or unexported fields
}

func (*ChildOfReadIterator) HasNext

func (iter *ChildOfReadIterator) HasNext() bool

func (*ChildOfReadIterator) NextChildOf

func (iter *ChildOfReadIterator) NextChildOf() (Entity, ChildOf)

func (*ChildOfReadIterator) NextEntity

func (iter *ChildOfReadIterator) NextEntity() Entity

func (*ChildOfReadIterator) Reset

func (iter *ChildOfReadIterator) Reset()

type ChildOfWriteIterator

type ChildOfWriteIterator struct {
	// contains filtered or unexported fields
}

func (*ChildOfWriteIterator) HasNext

func (iter *ChildOfWriteIterator) HasNext() bool

func (*ChildOfWriteIterator) NextChildOf

func (iter *ChildOfWriteIterator) NextChildOf() (Entity, *ChildOf, func())

func (*ChildOfWriteIterator) NextEntity

func (iter *ChildOfWriteIterator) NextEntity() Entity

func (*ChildOfWriteIterator) Reset

func (iter *ChildOfWriteIterator) Reset()

type Direction added in v0.2.0

type Direction EnumDirection

func DirectionFromEnumDirection added in v0.2.0

func DirectionFromEnumDirection(c EnumDirection) Direction

func (Direction) ToEnumDirection added in v0.2.0

func (c Direction) ToEnumDirection() EnumDirection

func (Direction) ToPB added in v0.2.0

type DirectionReadIterator added in v0.2.0

type DirectionReadIterator struct {
	// contains filtered or unexported fields
}

func (*DirectionReadIterator) HasNext added in v0.2.0

func (iter *DirectionReadIterator) HasNext() bool

func (*DirectionReadIterator) NextDirection added in v0.2.0

func (iter *DirectionReadIterator) NextDirection() (Entity, Direction)

func (*DirectionReadIterator) NextEntity added in v0.2.0

func (iter *DirectionReadIterator) NextEntity() Entity

func (*DirectionReadIterator) Reset added in v0.2.0

func (iter *DirectionReadIterator) Reset()

type DirectionWriteIterator added in v0.2.0

type DirectionWriteIterator struct {
	// contains filtered or unexported fields
}

func (*DirectionWriteIterator) HasNext added in v0.2.0

func (iter *DirectionWriteIterator) HasNext() bool

func (*DirectionWriteIterator) NextDirection added in v0.2.0

func (iter *DirectionWriteIterator) NextDirection() (Entity, *Direction, func())

func (*DirectionWriteIterator) NextEntity added in v0.2.0

func (iter *DirectionWriteIterator) NextEntity() Entity

func (*DirectionWriteIterator) Reset added in v0.2.0

func (iter *DirectionWriteIterator) Reset()

type DockedTo

type DockedTo Entity

func DockedToFromEntity

func DockedToFromEntity(c Entity) DockedTo

func (DockedTo) FromEntity

func (c DockedTo) FromEntity(e Entity) DockedTo

func (DockedTo) ToEntity

func (c DockedTo) ToEntity() Entity

func (DockedTo) ToPB added in v0.2.0

func (c DockedTo) ToPB() *ecspb.DockedToComponent

type DockedToReadIterator

type DockedToReadIterator struct {
	// contains filtered or unexported fields
}

func (*DockedToReadIterator) HasNext

func (iter *DockedToReadIterator) HasNext() bool

func (*DockedToReadIterator) NextDockedTo

func (iter *DockedToReadIterator) NextDockedTo() (Entity, DockedTo)

func (*DockedToReadIterator) NextEntity

func (iter *DockedToReadIterator) NextEntity() Entity

func (*DockedToReadIterator) Reset

func (iter *DockedToReadIterator) Reset()

type DockedToWriteIterator

type DockedToWriteIterator struct {
	// contains filtered or unexported fields
}

func (*DockedToWriteIterator) HasNext

func (iter *DockedToWriteIterator) HasNext() bool

func (*DockedToWriteIterator) NextDockedTo

func (iter *DockedToWriteIterator) NextDockedTo() (Entity, *DockedTo, func())

func (*DockedToWriteIterator) NextEntity

func (iter *DockedToWriteIterator) NextEntity() Entity

func (*DockedToWriteIterator) Reset

func (iter *DockedToWriteIterator) Reset()

type Eats

type Eats struct {
	Entities []Entity `json:"entities"`
	Amounts  []uint8  `json:"amounts"`
}

func (Eats) ToPB added in v0.2.0

func (c Eats) ToPB() *ecspb.EatsComponent

type EatsReadIterator

type EatsReadIterator struct {
	// contains filtered or unexported fields
}

func (*EatsReadIterator) HasNext

func (iter *EatsReadIterator) HasNext() bool

func (*EatsReadIterator) NextEats

func (iter *EatsReadIterator) NextEats() (Entity, Eats)

func (*EatsReadIterator) NextEntity

func (iter *EatsReadIterator) NextEntity() Entity

func (*EatsReadIterator) Reset

func (iter *EatsReadIterator) Reset()

type EatsWriteIterator

type EatsWriteIterator struct {
	// contains filtered or unexported fields
}

func (*EatsWriteIterator) HasNext

func (iter *EatsWriteIterator) HasNext() bool

func (*EatsWriteIterator) NextEats

func (iter *EatsWriteIterator) NextEats() (Entity, *Eats, func())

func (*EatsWriteIterator) NextEntity

func (iter *EatsWriteIterator) NextEntity() Entity

func (*EatsWriteIterator) Reset

func (iter *EatsWriteIterator) Reset()

type Enemy

type Enemy struct{}

type EnemyReadIterator

type EnemyReadIterator struct {
	// contains filtered or unexported fields
}

func (*EnemyReadIterator) HasNext

func (iter *EnemyReadIterator) HasNext() bool

func (*EnemyReadIterator) NextEntity

func (iter *EnemyReadIterator) NextEntity() Entity

func (*EnemyReadIterator) Reset

func (iter *EnemyReadIterator) Reset()

type EnemyWriteIterator

type EnemyWriteIterator struct {
	// contains filtered or unexported fields
}

func (*EnemyWriteIterator) HasNext

func (iter *EnemyWriteIterator) HasNext() bool

func (*EnemyWriteIterator) NextEntity

func (iter *EnemyWriteIterator) NextEntity() Entity

func (*EnemyWriteIterator) Reset

func (iter *EnemyWriteIterator) Reset()

type Entity

type Entity struct {
	// contains filtered or unexported fields
}

func (Entity) AlliedWithContains

func (e Entity) AlliedWithContains(other Entity) bool

func (Entity) Destroy

func (e Entity) Destroy()

func (Entity) Equals added in v0.2.1

func (e Entity) Equals(other Entity) bool

func (Entity) GrowsContains

func (e Entity) GrowsContains(other Entity) bool

func (Entity) HasAlliedWith

func (e Entity) HasAlliedWith() bool

func (Entity) HasChildOf

func (e Entity) HasChildOf() bool

func (Entity) HasDirection added in v0.2.0

func (e Entity) HasDirection() bool

func (Entity) HasDockedTo

func (e Entity) HasDockedTo() bool

func (Entity) HasEats

func (e Entity) HasEats() bool

func (Entity) HasEnemyTag

func (e Entity) HasEnemyTag() bool

func (Entity) HasFaction

func (e Entity) HasFaction() bool

func (Entity) HasGravity

func (e Entity) HasGravity() bool

func (Entity) HasGrows

func (e Entity) HasGrows() bool

func (Entity) HasIsA

func (e Entity) HasIsA() bool

func (Entity) HasLikes

func (e Entity) HasLikes() bool

func (Entity) HasName

func (e Entity) HasName() bool

func (Entity) HasPlanetTag

func (e Entity) HasPlanetTag() bool

func (Entity) HasPosition

func (e Entity) HasPosition() bool

func (Entity) HasRotation

func (e Entity) HasRotation() bool

func (Entity) HasRuledBy

func (e Entity) HasRuledBy() bool

func (Entity) HasSpaceshipTag

func (e Entity) HasSpaceshipTag() bool

func (Entity) HasSpacestationTag

func (e Entity) HasSpacestationTag() bool

func (Entity) HasVelocity

func (e Entity) HasVelocity() bool

func (Entity) In added in v0.2.1

func (e Entity) In(entities ...Entity) bool

func (Entity) Index

func (e Entity) Index() int

func (Entity) IndexU32

func (e Entity) IndexU32() uint32

func (Entity) IsAlive

func (e Entity) IsAlive() bool

func (Entity) IsResourceEntity

func (e Entity) IsResourceEntity() bool

func (Entity) LikesContains

func (e Entity) LikesContains(other Entity) bool

func (Entity) MustReadAlliedWith added in v0.2.1

func (e Entity) MustReadAlliedWith() AlliedWith

func (Entity) MustReadDirection added in v0.2.1

func (e Entity) MustReadDirection() Direction

func (Entity) MustReadEats added in v0.2.1

func (e Entity) MustReadEats() Eats

func (Entity) MustReadGravity added in v0.2.1

func (e Entity) MustReadGravity() Gravity

func (Entity) MustReadGrows added in v0.2.1

func (e Entity) MustReadGrows() Grows

func (Entity) MustReadLikes added in v0.2.1

func (e Entity) MustReadLikes() Likes

func (Entity) MustReadName added in v0.2.1

func (e Entity) MustReadName() Name

func (Entity) MustReadPosition added in v0.2.1

func (e Entity) MustReadPosition() Position

func (Entity) MustReadRotation added in v0.2.1

func (e Entity) MustReadRotation() Rotation

func (Entity) MustReadVelocity added in v0.2.1

func (e Entity) MustReadVelocity() Velocity

func (Entity) Raw

func (e Entity) Raw() uint32

func (Entity) ReadAlliedWith

func (e Entity) ReadAlliedWith() ([]Entity, bool)

func (Entity) ReadChildOf

func (e Entity) ReadChildOf() (Entity, bool)

func (Entity) ReadDirection added in v0.2.0

func (e Entity) ReadDirection() (Direction, bool)

func (Entity) ReadDockedTo

func (e Entity) ReadDockedTo() (Entity, bool)

func (Entity) ReadEats

func (e Entity) ReadEats() (Eats, bool)

func (Entity) ReadFaction

func (e Entity) ReadFaction() (Entity, bool)

func (Entity) ReadGravity

func (e Entity) ReadGravity() (Gravity, bool)

func (Entity) ReadGrows

func (e Entity) ReadGrows() ([]Entity, bool)

func (Entity) ReadIsA

func (e Entity) ReadIsA() (Entity, bool)

func (Entity) ReadLikes

func (e Entity) ReadLikes() ([]Entity, bool)

func (Entity) ReadName

func (e Entity) ReadName() (Name, bool)

func (Entity) ReadPosition

func (e Entity) ReadPosition() (Position, bool)

func (Entity) ReadRotation

func (e Entity) ReadRotation() (Rotation, bool)

func (Entity) ReadRuledBy

func (e Entity) ReadRuledBy() (Entity, bool)

func (Entity) ReadVelocity

func (e Entity) ReadVelocity() (Velocity, bool)

func (Entity) RemoveAllAlliedWith

func (e Entity) RemoveAllAlliedWith() Entity

func (Entity) RemoveAllGrows

func (e Entity) RemoveAllGrows() Entity

func (Entity) RemoveAllLikes

func (e Entity) RemoveAllLikes() Entity

func (Entity) RemoveAlliedWith

func (e Entity) RemoveAlliedWith(toRemove ...Entity) Entity

func (Entity) RemoveChildOf

func (e Entity) RemoveChildOf() Entity

func (Entity) RemoveDirection added in v0.2.0

func (e Entity) RemoveDirection() Entity

func (Entity) RemoveDockedTo

func (e Entity) RemoveDockedTo() Entity

func (Entity) RemoveEats

func (e Entity) RemoveEats() Entity

func (Entity) RemoveEnemyTag

func (e Entity) RemoveEnemyTag() Entity

func (Entity) RemoveFaction

func (e Entity) RemoveFaction() Entity

func (Entity) RemoveGravity

func (e Entity) RemoveGravity() Entity

func (Entity) RemoveGrows

func (e Entity) RemoveGrows(toRemove ...Entity) Entity

func (Entity) RemoveIsA

func (e Entity) RemoveIsA() Entity

func (Entity) RemoveLikes

func (e Entity) RemoveLikes(toRemove ...Entity) Entity

func (Entity) RemoveName

func (e Entity) RemoveName() Entity

func (Entity) RemovePlanetTag

func (e Entity) RemovePlanetTag() Entity

func (Entity) RemovePosition

func (e Entity) RemovePosition() Entity

func (Entity) RemoveRotation

func (e Entity) RemoveRotation() Entity

func (Entity) RemoveRuledBy

func (e Entity) RemoveRuledBy() Entity

func (Entity) RemoveSpaceshipTag

func (e Entity) RemoveSpaceshipTag() Entity

func (Entity) RemoveSpacestationTag

func (e Entity) RemoveSpacestationTag() Entity

func (Entity) RemoveVelocity

func (e Entity) RemoveVelocity() Entity

func (Entity) SetAlliedWith

func (e Entity) SetAlliedWith(other ...Entity) Entity

func (Entity) SetChildOf

func (e Entity) SetChildOf(other Entity) Entity

func (Entity) SetDirection added in v0.2.0

func (e Entity) SetDirection(other Direction) Entity

func (Entity) SetDockedTo

func (e Entity) SetDockedTo(other Entity) Entity

func (Entity) SetEats

func (e Entity) SetEats(other Eats) Entity

func (Entity) SetEatsValues added in v0.2.0

func (e Entity) SetEatsValues(
	entities0 []Entity,
	amounts1 []uint8,
) Entity

func (Entity) SetFaction

func (e Entity) SetFaction(other Entity) Entity

func (Entity) SetGravity

func (e Entity) SetGravity(other Gravity) Entity

func (Entity) SetGrows

func (e Entity) SetGrows(other ...Entity) Entity

func (Entity) SetIsA

func (e Entity) SetIsA(other Entity) Entity

func (Entity) SetLikes

func (e Entity) SetLikes(other ...Entity) Entity

func (Entity) SetName

func (e Entity) SetName(other Name) Entity

func (Entity) SetPosition

func (e Entity) SetPosition(other Position) Entity

func (Entity) SetPositionValues added in v0.2.0

func (e Entity) SetPositionValues(
	x0 float32,
	y1 float32,
	z2 float32,
) Entity

func (Entity) SetRotation

func (e Entity) SetRotation(other Rotation) Entity

func (Entity) SetRotationValues added in v0.2.0

func (e Entity) SetRotationValues(
	x0 float32,
	y1 float32,
	z2 float32,
	w3 float32,
) Entity

func (Entity) SetRuledBy

func (e Entity) SetRuledBy(other Entity) Entity

func (Entity) SetVelocity

func (e Entity) SetVelocity(other Velocity) Entity

func (Entity) SetVelocityValues added in v0.2.0

func (e Entity) SetVelocityValues(
	x0 float32,
	y1 float32,
	z2 float32,
) Entity

func (Entity) TagWithEnemy

func (e Entity) TagWithEnemy() Entity

func (Entity) TagWithPlanet

func (e Entity) TagWithPlanet() Entity

func (Entity) TagWithSpaceship

func (e Entity) TagWithSpaceship() Entity

func (Entity) TagWithSpacestation

func (e Entity) TagWithSpacestation() Entity

func (Entity) UpdateVersion

func (e Entity) UpdateVersion() Entity

func (Entity) Version

func (e Entity) Version() uint32

func (Entity) World

func (e Entity) World() *World

func (Entity) WritableAlliedWith

func (e Entity) WritableAlliedWith() (c *AlliedWith, done func())

func (Entity) WritableChildOf

func (e Entity) WritableChildOf() (c *ChildOf, done func())

func (Entity) WritableDirection added in v0.2.0

func (e Entity) WritableDirection() (c *Direction, done func())

func (Entity) WritableDockedTo

func (e Entity) WritableDockedTo() (c *DockedTo, done func())

func (Entity) WritableEats

func (e Entity) WritableEats() (c *Eats, done func())

func (Entity) WritableFaction

func (e Entity) WritableFaction() (c *Faction, done func())

func (Entity) WritableGravity

func (e Entity) WritableGravity() (c *Gravity, done func())

func (Entity) WritableGrows

func (e Entity) WritableGrows() (c *Grows, done func())

func (Entity) WritableIsA

func (e Entity) WritableIsA() (c *IsA, done func())

func (Entity) WritableLikes

func (e Entity) WritableLikes() (c *Likes, done func())

func (Entity) WritableName

func (e Entity) WritableName() (c *Name, done func())

func (Entity) WritablePosition

func (e Entity) WritablePosition() (c *Position, done func())

func (Entity) WritableRotation

func (e Entity) WritableRotation() (c *Rotation, done func())

func (Entity) WritableRuledBy

func (e Entity) WritableRuledBy() (c *RuledBy, done func())

func (Entity) WritableVelocity

func (e Entity) WritableVelocity() (c *Velocity, done func())

type EntityCreatedEvent

type EntityCreatedEvent struct {
	Entity Entity
}

type EntityDestroyedEvent

type EntityDestroyedEvent struct {
	Entity Entity
}

type EnumDirection added in v0.2.0

type EnumDirection uint32

func EnumDirectionFromU32 added in v0.2.1

func EnumDirectionFromU32(i uint32) EnumDirection

func EnumDirectionSet added in v0.2.0

func EnumDirectionSet(flags ...EnumDirection) EnumDirection

func EnumDirectionSliceFromPB added in v0.2.1

func EnumDirectionSliceFromPB(pb []ecspb.DirectionEnum) (e []EnumDirection)

func (EnumDirection) AllSet added in v0.2.0

func (e EnumDirection) AllSet() (flags []EnumDirection)

func (EnumDirection) Clear added in v0.2.0

func (e EnumDirection) Clear(flags ...EnumDirection) EnumDirection

func (EnumDirection) Has added in v0.2.0

func (e EnumDirection) Has(flags ...EnumDirection) bool

func (EnumDirection) Set added in v0.2.0

func (e EnumDirection) Set(flags ...EnumDirection) EnumDirection

func (EnumDirection) String added in v0.2.0

func (e EnumDirection) String() (string, bool)

func (EnumDirection) ToPB added in v0.2.1

func (EnumDirection) ToU32 added in v0.2.1

func (e EnumDirection) ToU32() uint32

func (EnumDirection) Toggle added in v0.2.0

func (e EnumDirection) Toggle(flags ...EnumDirection) EnumDirection

func (EnumDirection) ToggleAll added in v0.2.0

func (e EnumDirection) ToggleAll() EnumDirection

type Faction

type Faction Entity

func FactionFromEntity

func FactionFromEntity(c Entity) Faction

func (Faction) FromEntity

func (c Faction) FromEntity(e Entity) Faction

func (Faction) ToEntity

func (c Faction) ToEntity() Entity

func (Faction) ToPB added in v0.2.0

func (c Faction) ToPB() *ecspb.FactionComponent

type FactionReadIterator

type FactionReadIterator struct {
	// contains filtered or unexported fields
}

func (*FactionReadIterator) HasNext

func (iter *FactionReadIterator) HasNext() bool

func (*FactionReadIterator) NextEntity

func (iter *FactionReadIterator) NextEntity() Entity

func (*FactionReadIterator) NextFaction

func (iter *FactionReadIterator) NextFaction() (Entity, Faction)

func (*FactionReadIterator) Reset

func (iter *FactionReadIterator) Reset()

type FactionWriteIterator

type FactionWriteIterator struct {
	// contains filtered or unexported fields
}

func (*FactionWriteIterator) HasNext

func (iter *FactionWriteIterator) HasNext() bool

func (*FactionWriteIterator) NextEntity

func (iter *FactionWriteIterator) NextEntity() Entity

func (*FactionWriteIterator) NextFaction

func (iter *FactionWriteIterator) NextFaction() (Entity, *Faction, func())

func (*FactionWriteIterator) Reset

func (iter *FactionWriteIterator) Reset()

type Gravity

type Gravity float32

func GravityFromFloat32

func GravityFromFloat32(c float32) Gravity

func (Gravity) ToFloat32

func (c Gravity) ToFloat32() float32

func (Gravity) ToPB added in v0.2.0

func (c Gravity) ToPB() *ecspb.GravityComponent

type GravityReadIterator

type GravityReadIterator struct {
	// contains filtered or unexported fields
}

func (*GravityReadIterator) HasNext

func (iter *GravityReadIterator) HasNext() bool

func (*GravityReadIterator) NextEntity

func (iter *GravityReadIterator) NextEntity() Entity

func (*GravityReadIterator) NextGravity

func (iter *GravityReadIterator) NextGravity() (Entity, Gravity)

func (*GravityReadIterator) Reset

func (iter *GravityReadIterator) Reset()

type GravityWriteIterator

type GravityWriteIterator struct {
	// contains filtered or unexported fields
}

func (*GravityWriteIterator) HasNext

func (iter *GravityWriteIterator) HasNext() bool

func (*GravityWriteIterator) NextEntity

func (iter *GravityWriteIterator) NextEntity() Entity

func (*GravityWriteIterator) NextGravity

func (iter *GravityWriteIterator) NextGravity() (Entity, *Gravity, func())

func (*GravityWriteIterator) Reset

func (iter *GravityWriteIterator) Reset()

type Grows

type Grows []Entity

func GrowsFromEntities

func GrowsFromEntities(e ...Entity) Grows

func GrowsFromEntity

func GrowsFromEntity(c []Entity) Grows

func GrowsFromPB added in v0.2.1

func GrowsFromPB(w *World, pb *ecspb.GrowsComponent) Grows

func (Grows) ToEntities

func (c Grows) ToEntities() []Entity

func (Grows) ToEntity

func (c Grows) ToEntity() []Entity

func (Grows) ToPB added in v0.2.0

func (c Grows) ToPB() *ecspb.GrowsComponent

func (Grows) ToU32s added in v0.2.0

func (c Grows) ToU32s() []uint32

type GrowsReadIterator

type GrowsReadIterator struct {
	// contains filtered or unexported fields
}

func (*GrowsReadIterator) HasNext

func (iter *GrowsReadIterator) HasNext() bool

func (*GrowsReadIterator) NextEntity

func (iter *GrowsReadIterator) NextEntity() Entity

func (*GrowsReadIterator) NextGrows

func (iter *GrowsReadIterator) NextGrows() (Entity, Grows)

func (*GrowsReadIterator) Reset

func (iter *GrowsReadIterator) Reset()

type GrowsWriteIterator

type GrowsWriteIterator struct {
	// contains filtered or unexported fields
}

func (*GrowsWriteIterator) HasNext

func (iter *GrowsWriteIterator) HasNext() bool

func (*GrowsWriteIterator) NextEntity

func (iter *GrowsWriteIterator) NextEntity() Entity

func (*GrowsWriteIterator) NextGrows

func (iter *GrowsWriteIterator) NextGrows() (Entity, *Grows, func())

func (*GrowsWriteIterator) Reset

func (iter *GrowsWriteIterator) Reset()

type IsA

type IsA Entity

func IsAFromEntity

func IsAFromEntity(c Entity) IsA

func (IsA) FromEntity

func (c IsA) FromEntity(e Entity) IsA

func (IsA) ToEntity

func (c IsA) ToEntity() Entity

func (IsA) ToPB added in v0.2.0

func (c IsA) ToPB() *ecspb.IsAComponent

type IsAReadIterator

type IsAReadIterator struct {
	// contains filtered or unexported fields
}

func (*IsAReadIterator) HasNext

func (iter *IsAReadIterator) HasNext() bool

func (*IsAReadIterator) NextEntity

func (iter *IsAReadIterator) NextEntity() Entity

func (*IsAReadIterator) NextIsA

func (iter *IsAReadIterator) NextIsA() (Entity, IsA)

func (*IsAReadIterator) Reset

func (iter *IsAReadIterator) Reset()

type IsAWriteIterator

type IsAWriteIterator struct {
	// contains filtered or unexported fields
}

func (*IsAWriteIterator) HasNext

func (iter *IsAWriteIterator) HasNext() bool

func (*IsAWriteIterator) NextEntity

func (iter *IsAWriteIterator) NextEntity() Entity

func (*IsAWriteIterator) NextIsA

func (iter *IsAWriteIterator) NextIsA() (Entity, *IsA, func())

func (*IsAWriteIterator) Reset

func (iter *IsAWriteIterator) Reset()

type LessThan

type LessThan[T any] func(a, b Entity) bool

LessThan is Delegate type that sorting uses as a comparator

type Likes

type Likes []Entity

func LikesFromEntities

func LikesFromEntities(e ...Entity) Likes

func LikesFromEntity

func LikesFromEntity(c []Entity) Likes

func LikesFromPB added in v0.2.1

func LikesFromPB(w *World, pb *ecspb.LikesComponent) Likes

func (Likes) ToEntities

func (c Likes) ToEntities() []Entity

func (Likes) ToEntity

func (c Likes) ToEntity() []Entity

func (Likes) ToPB added in v0.2.0

func (c Likes) ToPB() *ecspb.LikesComponent

func (Likes) ToU32s added in v0.2.0

func (c Likes) ToU32s() []uint32

type LikesReadIterator

type LikesReadIterator struct {
	// contains filtered or unexported fields
}

func (*LikesReadIterator) HasNext

func (iter *LikesReadIterator) HasNext() bool

func (*LikesReadIterator) NextEntity

func (iter *LikesReadIterator) NextEntity() Entity

func (*LikesReadIterator) NextLikes

func (iter *LikesReadIterator) NextLikes() (Entity, Likes)

func (*LikesReadIterator) Reset

func (iter *LikesReadIterator) Reset()

type LikesWriteIterator

type LikesWriteIterator struct {
	// contains filtered or unexported fields
}

func (*LikesWriteIterator) HasNext

func (iter *LikesWriteIterator) HasNext() bool

func (*LikesWriteIterator) NextEntity

func (iter *LikesWriteIterator) NextEntity() Entity

func (*LikesWriteIterator) NextLikes

func (iter *LikesWriteIterator) NextLikes() (Entity, *Likes, func())

func (*LikesWriteIterator) Reset

func (iter *LikesWriteIterator) Reset()

type Name

type Name string

func NameFromString

func NameFromString(c string) Name

func (Name) ToPB added in v0.2.0

func (c Name) ToPB() *ecspb.NameComponent

func (Name) ToString

func (c Name) ToString() string

type NameReadIterator

type NameReadIterator struct {
	// contains filtered or unexported fields
}

func (*NameReadIterator) HasNext

func (iter *NameReadIterator) HasNext() bool

func (*NameReadIterator) NextEntity

func (iter *NameReadIterator) NextEntity() Entity

func (*NameReadIterator) NextName

func (iter *NameReadIterator) NextName() (Entity, Name)

func (*NameReadIterator) Reset

func (iter *NameReadIterator) Reset()

type NameWriteIterator

type NameWriteIterator struct {
	// contains filtered or unexported fields
}

func (*NameWriteIterator) HasNext

func (iter *NameWriteIterator) HasNext() bool

func (*NameWriteIterator) NextEntity

func (iter *NameWriteIterator) NextEntity() Entity

func (*NameWriteIterator) NextName

func (iter *NameWriteIterator) NextName() (Entity, *Name, func())

func (*NameWriteIterator) Reset

func (iter *NameWriteIterator) Reset()

type Planet

type Planet struct{}

type PlanetReadIterator

type PlanetReadIterator struct {
	// contains filtered or unexported fields
}

func (*PlanetReadIterator) HasNext

func (iter *PlanetReadIterator) HasNext() bool

func (*PlanetReadIterator) NextEntity

func (iter *PlanetReadIterator) NextEntity() Entity

func (*PlanetReadIterator) Reset

func (iter *PlanetReadIterator) Reset()

type PlanetWriteIterator

type PlanetWriteIterator struct {
	// contains filtered or unexported fields
}

func (*PlanetWriteIterator) HasNext

func (iter *PlanetWriteIterator) HasNext() bool

func (*PlanetWriteIterator) NextEntity

func (iter *PlanetWriteIterator) NextEntity() Entity

func (*PlanetWriteIterator) Reset

func (iter *PlanetWriteIterator) Reset()

type Position

type Position struct {
	X float32 `json:"x"`
	Y float32 `json:"y"`
	Z float32 `json:"z"`
}

func (Position) ToPB added in v0.2.0

func (c Position) ToPB() *ecspb.PositionComponent

type PositionReadIterator

type PositionReadIterator struct {
	// contains filtered or unexported fields
}

func (*PositionReadIterator) HasNext

func (iter *PositionReadIterator) HasNext() bool

func (*PositionReadIterator) NextEntity

func (iter *PositionReadIterator) NextEntity() Entity

func (*PositionReadIterator) NextPosition

func (iter *PositionReadIterator) NextPosition() (Entity, Position)

func (*PositionReadIterator) Reset

func (iter *PositionReadIterator) Reset()

type PositionVelocitySet

type PositionVelocitySet struct {
	// contains filtered or unexported fields
}

func NewPositionVelocitySet

func NewPositionVelocitySet(w *World) *PositionVelocitySet

func (*PositionVelocitySet) All added in v0.2.1

func (set *PositionVelocitySet) All() []Entity

func (*PositionVelocitySet) Len

func (set *PositionVelocitySet) Len() int

func (*PositionVelocitySet) NewIterator

func (set *PositionVelocitySet) NewIterator() *PositionVelocitySetIter

func (*PositionVelocitySet) PossibleUpdate

func (set *PositionVelocitySet) PossibleUpdate(entities ...Entity)

type PositionVelocitySetIter

type PositionVelocitySetIter struct {
	// contains filtered or unexported fields
}

func (*PositionVelocitySetIter) HasNext

func (iter *PositionVelocitySetIter) HasNext() bool

func (*PositionVelocitySetIter) Next

func (iter *PositionVelocitySetIter) Next() (
	Entity,
	Velocity,
	*Position,
)

func (*PositionVelocitySetIter) Reset

func (iter *PositionVelocitySetIter) Reset()

type PositionWriteIterator

type PositionWriteIterator struct {
	// contains filtered or unexported fields
}

func (*PositionWriteIterator) HasNext

func (iter *PositionWriteIterator) HasNext() bool

func (*PositionWriteIterator) NextEntity

func (iter *PositionWriteIterator) NextEntity() Entity

func (*PositionWriteIterator) NextPosition

func (iter *PositionWriteIterator) NextPosition() (Entity, *Position, func())

func (*PositionWriteIterator) Reset

func (iter *PositionWriteIterator) Reset()

type Rotation

type Rotation struct {
	X float32 `json:"x"`
	Y float32 `json:"y"`
	Z float32 `json:"z"`
	W float32 `json:"w"`
}

func (Rotation) ToPB added in v0.2.0

func (c Rotation) ToPB() *ecspb.RotationComponent

type RotationReadIterator

type RotationReadIterator struct {
	// contains filtered or unexported fields
}

func (*RotationReadIterator) HasNext

func (iter *RotationReadIterator) HasNext() bool

func (*RotationReadIterator) NextEntity

func (iter *RotationReadIterator) NextEntity() Entity

func (*RotationReadIterator) NextRotation

func (iter *RotationReadIterator) NextRotation() (Entity, Rotation)

func (*RotationReadIterator) Reset

func (iter *RotationReadIterator) Reset()

type RotationWriteIterator

type RotationWriteIterator struct {
	// contains filtered or unexported fields
}

func (*RotationWriteIterator) HasNext

func (iter *RotationWriteIterator) HasNext() bool

func (*RotationWriteIterator) NextEntity

func (iter *RotationWriteIterator) NextEntity() Entity

func (*RotationWriteIterator) NextRotation

func (iter *RotationWriteIterator) NextRotation() (Entity, *Rotation, func())

func (*RotationWriteIterator) Reset

func (iter *RotationWriteIterator) Reset()

type RuledBy

type RuledBy Entity

func RuledByFromEntity

func RuledByFromEntity(c Entity) RuledBy

func (RuledBy) FromEntity

func (c RuledBy) FromEntity(e Entity) RuledBy

func (RuledBy) ToEntity

func (c RuledBy) ToEntity() Entity

func (RuledBy) ToPB added in v0.2.0

func (c RuledBy) ToPB() *ecspb.RuledByComponent

type RuledByReadIterator

type RuledByReadIterator struct {
	// contains filtered or unexported fields
}

func (*RuledByReadIterator) HasNext

func (iter *RuledByReadIterator) HasNext() bool

func (*RuledByReadIterator) NextEntity

func (iter *RuledByReadIterator) NextEntity() Entity

func (*RuledByReadIterator) NextRuledBy

func (iter *RuledByReadIterator) NextRuledBy() (Entity, RuledBy)

func (*RuledByReadIterator) Reset

func (iter *RuledByReadIterator) Reset()

type RuledByWriteIterator

type RuledByWriteIterator struct {
	// contains filtered or unexported fields
}

func (*RuledByWriteIterator) HasNext

func (iter *RuledByWriteIterator) HasNext() bool

func (*RuledByWriteIterator) NextEntity

func (iter *RuledByWriteIterator) NextEntity() Entity

func (*RuledByWriteIterator) NextRuledBy

func (iter *RuledByWriteIterator) NextRuledBy() (Entity, *RuledBy, func())

func (*RuledByWriteIterator) Reset

func (iter *RuledByWriteIterator) Reset()

type Spaceship

type Spaceship struct{}

type SpaceshipReadIterator

type SpaceshipReadIterator struct {
	// contains filtered or unexported fields
}

func (*SpaceshipReadIterator) HasNext

func (iter *SpaceshipReadIterator) HasNext() bool

func (*SpaceshipReadIterator) NextEntity

func (iter *SpaceshipReadIterator) NextEntity() Entity

func (*SpaceshipReadIterator) Reset

func (iter *SpaceshipReadIterator) Reset()

type SpaceshipWriteIterator

type SpaceshipWriteIterator struct {
	// contains filtered or unexported fields
}

func (*SpaceshipWriteIterator) HasNext

func (iter *SpaceshipWriteIterator) HasNext() bool

func (*SpaceshipWriteIterator) NextEntity

func (iter *SpaceshipWriteIterator) NextEntity() Entity

func (*SpaceshipWriteIterator) Reset

func (iter *SpaceshipWriteIterator) Reset()

type Spacestation

type Spacestation struct{}

type SpacestationReadIterator

type SpacestationReadIterator struct {
	// contains filtered or unexported fields
}

func (*SpacestationReadIterator) HasNext

func (iter *SpacestationReadIterator) HasNext() bool

func (*SpacestationReadIterator) NextEntity

func (iter *SpacestationReadIterator) NextEntity() Entity

func (*SpacestationReadIterator) Reset

func (iter *SpacestationReadIterator) Reset()

type SpacestationWriteIterator

type SpacestationWriteIterator struct {
	// contains filtered or unexported fields
}

func (*SpacestationWriteIterator) HasNext

func (iter *SpacestationWriteIterator) HasNext() bool

func (*SpacestationWriteIterator) NextEntity

func (iter *SpacestationWriteIterator) NextEntity() Entity

func (*SpacestationWriteIterator) Reset

func (iter *SpacestationWriteIterator) Reset()

type SparseSet

type SparseSet[T any] struct {
	LessThan LessThan[T]
	// contains filtered or unexported fields
}

func NewSparseSet

func NewSparseSet[T any](lessThan LessThan[T]) *SparseSet[T]

func (*SparseSet[T]) Clear

func (ss *SparseSet[T]) Clear()

func (*SparseSet[T]) Has

func (ss *SparseSet[T]) Has(e Entity) bool

func (*SparseSet[T]) IterateSafe

func (ss *SparseSet[T]) IterateSafe(fn func(e Entity, c T) error) error

func (*SparseSet[T]) IterateUnsafe

func (ss *SparseSet[T]) IterateUnsafe(fn func(e Entity, c T))

func (*SparseSet[T]) Len

func (ss *SparseSet[T]) Len() int

func (*SparseSet[T]) Read

func (ss *SparseSet[T]) Read(e Entity) (c T, versionMatched bool)

func (*SparseSet[T]) Remove

func (ss *SparseSet[T]) Remove(entities ...Entity)

func (*SparseSet[T]) Set

func (ss *SparseSet[T]) Set(c T, entities ...Entity) error

func (*SparseSet[T]) Sort

func (s *SparseSet[T]) Sort()

Sort an array using the provided comparator

func (*SparseSet[T]) Writeable

func (ss *SparseSet[T]) Writeable(e Entity) (c *T, versionMatched bool)

type SparseSetSortFunc

type SparseSetSortFunc[T any] func(a, b T) bool

type System

type System interface {
	Name() string
	ReliesOn() []string
	Initialize(w *World) error
	Tick(ctx context.Context, w *World) error
}

type UnsubscribeFunc

type UnsubscribeFunc func()

type Velocity

type Velocity struct {
	X float32 `json:"x"`
	Y float32 `json:"y"`
	Z float32 `json:"z"`
}

func (Velocity) ToPB added in v0.2.0

func (c Velocity) ToPB() *ecspb.VelocityComponent

type VelocityReadIterator

type VelocityReadIterator struct {
	// contains filtered or unexported fields
}

func (*VelocityReadIterator) HasNext

func (iter *VelocityReadIterator) HasNext() bool

func (*VelocityReadIterator) NextEntity

func (iter *VelocityReadIterator) NextEntity() Entity

func (*VelocityReadIterator) NextVelocity

func (iter *VelocityReadIterator) NextVelocity() (Entity, Velocity)

func (*VelocityReadIterator) Reset

func (iter *VelocityReadIterator) Reset()

type VelocityWriteIterator

type VelocityWriteIterator struct {
	// contains filtered or unexported fields
}

func (*VelocityWriteIterator) HasNext

func (iter *VelocityWriteIterator) HasNext() bool

func (*VelocityWriteIterator) NextEntity

func (iter *VelocityWriteIterator) NextEntity() Entity

func (*VelocityWriteIterator) NextVelocity

func (iter *VelocityWriteIterator) NextVelocity() (Entity, *Velocity, func())

func (*VelocityWriteIterator) Reset

func (iter *VelocityWriteIterator) Reset()

type World

type World struct {
	PositionVelocitySet *PositionVelocitySet
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld() *World

func (*World) AddSystems

func (w *World) AddSystems(ss ...System) (err error)

AddSystems adds systems to the world. Systems are run in the order they are added.

func (*World) AlliedWithEntities

func (w *World) AlliedWithEntities() []Entity

func (*World) AlliedWithReadIter

func (w *World) AlliedWithReadIter() *AlliedWithReadIterator

func (*World) AlliedWithResource

func (w *World) AlliedWithResource() ([]Entity, bool)

AlliedWithResource Retrieve the resource from the world

func (*World) AlliedWithWriteIter

func (w *World) AlliedWithWriteIter() *AlliedWithWriteIterator

func (*World) ApplyAlliedWithPatch added in v0.2.0

func (w *World) ApplyAlliedWithPatch(e Entity, patch *ecspb.AlliedWithComponent) Entity

func (*World) ApplyChildOfPatch added in v0.2.0

func (w *World) ApplyChildOfPatch(e Entity, patch *ecspb.ChildOfComponent) Entity

func (*World) ApplyDirectionPatch added in v0.2.0

func (w *World) ApplyDirectionPatch(e Entity, patch *ecspb.DirectionComponent) Entity

func (*World) ApplyDockedToPatch added in v0.2.0

func (w *World) ApplyDockedToPatch(e Entity, patch *ecspb.DockedToComponent) Entity

func (*World) ApplyEatsPatch added in v0.2.0

func (w *World) ApplyEatsPatch(e Entity, patch *ecspb.EatsComponent) Entity

func (*World) ApplyEnemyPatch added in v0.2.0

func (w *World) ApplyEnemyPatch(e Entity, pb *emptypb.Empty) Entity

func (*World) ApplyFactionPatch added in v0.2.0

func (w *World) ApplyFactionPatch(e Entity, patch *ecspb.FactionComponent) Entity

func (*World) ApplyGravityPatch added in v0.2.0

func (w *World) ApplyGravityPatch(e Entity, patch *ecspb.GravityComponent) Entity

func (*World) ApplyGrowsPatch added in v0.2.0

func (w *World) ApplyGrowsPatch(e Entity, patch *ecspb.GrowsComponent) Entity

func (*World) ApplyIsAPatch added in v0.2.0

func (w *World) ApplyIsAPatch(e Entity, patch *ecspb.IsAComponent) Entity

func (*World) ApplyLikesPatch added in v0.2.0

func (w *World) ApplyLikesPatch(e Entity, patch *ecspb.LikesComponent) Entity

func (*World) ApplyNamePatch added in v0.2.0

func (w *World) ApplyNamePatch(e Entity, patch *ecspb.NameComponent) Entity

func (*World) ApplyPatches added in v0.2.0

func (w *World) ApplyPatches(patches ...*ecspb.WorldPatch)

func (*World) ApplyPlanetPatch added in v0.2.0

func (w *World) ApplyPlanetPatch(e Entity, pb *emptypb.Empty) Entity

func (*World) ApplyPositionPatch added in v0.2.0

func (w *World) ApplyPositionPatch(e Entity, patch *ecspb.PositionComponent) Entity

func (*World) ApplyRotationPatch added in v0.2.0

func (w *World) ApplyRotationPatch(e Entity, patch *ecspb.RotationComponent) Entity

func (*World) ApplyRuledByPatch added in v0.2.0

func (w *World) ApplyRuledByPatch(e Entity, patch *ecspb.RuledByComponent) Entity

func (*World) ApplySpaceshipPatch added in v0.2.0

func (w *World) ApplySpaceshipPatch(e Entity, pb *emptypb.Empty) Entity

func (*World) ApplySpacestationPatch added in v0.2.0

func (w *World) ApplySpacestationPatch(e Entity, pb *emptypb.Empty) Entity

func (*World) ApplyVelocityPatch added in v0.2.0

func (w *World) ApplyVelocityPatch(e Entity, patch *ecspb.VelocityComponent) Entity

func (*World) ChildOfEntities

func (w *World) ChildOfEntities() []Entity

func (*World) ChildOfReadIter

func (w *World) ChildOfReadIter() *ChildOfReadIterator

func (*World) ChildOfResource

func (w *World) ChildOfResource() (Entity, bool)

ChildOfResource Retrieve the resource from the world

func (*World) ChildOfWriteIter

func (w *World) ChildOfWriteIter() *ChildOfWriteIterator

func (*World) DestroyEntities added in v0.2.0

func (w *World) DestroyEntities(es ...Entity)

func (*World) DirectionEntities added in v0.2.0

func (w *World) DirectionEntities() []Entity

func (*World) DirectionReadIter added in v0.2.0

func (w *World) DirectionReadIter() *DirectionReadIterator

func (*World) DirectionResource added in v0.2.0

func (w *World) DirectionResource() (Direction, bool)

DirectionResource Retrieve the resource from the world

func (*World) DirectionWriteIter added in v0.2.0

func (w *World) DirectionWriteIter() *DirectionWriteIterator

func (*World) DisableSystem

func (w *World) DisableSystem(ss ...System) error

DisableSystem disables systems from running. Systems are disabled in the order they are passed.

func (*World) DockedToEntities

func (w *World) DockedToEntities() []Entity

func (*World) DockedToReadIter

func (w *World) DockedToReadIter() *DockedToReadIterator

func (*World) DockedToResource

func (w *World) DockedToResource() (Entity, bool)

DockedToResource Retrieve the resource from the world

func (*World) DockedToWriteIter

func (w *World) DockedToWriteIter() *DockedToWriteIterator

func (*World) EatsEntities

func (w *World) EatsEntities() []Entity

func (*World) EatsReadIter

func (w *World) EatsReadIter() *EatsReadIterator

func (*World) EatsResource

func (w *World) EatsResource() (Eats, bool)

EatsResource Retrieve the resource from the world

func (*World) EatsWriteIter

func (w *World) EatsWriteIter() *EatsWriteIterator

func (*World) EnableSystem

func (w *World) EnableSystem(ss ...System) error

EnableSystem enables systems to run. Systems are enabled in the order they are passed.

func (*World) EnemyEntities

func (w *World) EnemyEntities() []Entity

func (*World) EnemyReadIter

func (w *World) EnemyReadIter() *EnemyReadIterator

func (*World) EnemyWriteIter

func (w *World) EnemyWriteIter() *EnemyWriteIterator

func (*World) Entities

func (w *World) Entities(count int) []Entity

func (*World) EntitiesFromU32s added in v0.2.0

func (w *World) EntitiesFromU32s(vals ...uint32) (entities []Entity)

func (*World) Entity

func (w *World) Entity() (e Entity)

Entity returns a new (or try to reuse dead) entity.

func (*World) EntityFromU32

func (w *World) EntityFromU32(val uint32) Entity

func (*World) EntityWithName

func (w *World) EntityWithName(name string) Entity

func (*World) FactionEntities

func (w *World) FactionEntities() []Entity

func (*World) FactionReadIter

func (w *World) FactionReadIter() *FactionReadIterator

func (*World) FactionResource

func (w *World) FactionResource() (Entity, bool)

FactionResource Retrieve the resource from the world

func (*World) FactionWriteIter

func (w *World) FactionWriteIter() *FactionWriteIterator

func (*World) GravityEntities

func (w *World) GravityEntities() []Entity

func (*World) GravityReadIter

func (w *World) GravityReadIter() *GravityReadIterator

func (*World) GravityResource

func (w *World) GravityResource() (Gravity, bool)

GravityResource Retrieve the resource from the world

func (*World) GravityWriteIter

func (w *World) GravityWriteIter() *GravityWriteIterator

func (*World) GrowsEntities

func (w *World) GrowsEntities() []Entity

func (*World) GrowsReadIter

func (w *World) GrowsReadIter() *GrowsReadIterator

func (*World) GrowsResource

func (w *World) GrowsResource() ([]Entity, bool)

GrowsResource Retrieve the resource from the world

func (*World) GrowsWriteIter

func (w *World) GrowsWriteIter() *GrowsWriteIterator

func (*World) HasAlliedWithResource

func (w *World) HasAlliedWithResource() bool

HasAlliedWithResource checks if the world has a AlliedWith}}

func (*World) HasChildOfResource

func (w *World) HasChildOfResource() bool

HasChildOfResource checks if the world has a ChildOf}}

func (*World) HasDirectionResource added in v0.2.0

func (w *World) HasDirectionResource() bool

HasDirectionResource checks if the world has a Direction}}

func (*World) HasDockedToResource

func (w *World) HasDockedToResource() bool

HasDockedToResource checks if the world has a DockedTo}}

func (*World) HasEatsResource

func (w *World) HasEatsResource() bool

HasEatsResource checks if the world has a Eats}}

func (*World) HasFactionResource

func (w *World) HasFactionResource() bool

HasFactionResource checks if the world has a Faction}}

func (*World) HasGravityResource

func (w *World) HasGravityResource() bool

HasGravityResource checks if the world has a Gravity}}

func (*World) HasGrowsResource

func (w *World) HasGrowsResource() bool

HasGrowsResource checks if the world has a Grows}}

func (*World) HasIsAResource

func (w *World) HasIsAResource() bool

HasIsAResource checks if the world has a IsA}}

func (*World) HasLikesResource

func (w *World) HasLikesResource() bool

HasLikesResource checks if the world has a Likes}}

func (*World) HasNameResource

func (w *World) HasNameResource() bool

HasNameResource checks if the world has a Name}}

func (*World) HasPositionResource

func (w *World) HasPositionResource() bool

HasPositionResource checks if the world has a Position}}

func (*World) HasRotationResource

func (w *World) HasRotationResource() bool

HasRotationResource checks if the world has a Rotation}}

func (*World) HasRuledByResource

func (w *World) HasRuledByResource() bool

HasRuledByResource checks if the world has a RuledBy}}

func (*World) HasVelocityResource

func (w *World) HasVelocityResource() bool

HasVelocityResource checks if the world has a Velocity}}

func (*World) IsAEntities

func (w *World) IsAEntities() []Entity

func (*World) IsAReadIter

func (w *World) IsAReadIter() *IsAReadIterator

func (*World) IsAResource

func (w *World) IsAResource() (Entity, bool)

IsAResource Retrieve the resource from the world

func (*World) IsAWriteIter

func (w *World) IsAWriteIter() *IsAWriteIterator

func (*World) LikesEntities

func (w *World) LikesEntities() []Entity

func (*World) LikesReadIter

func (w *World) LikesReadIter() *LikesReadIterator

func (*World) LikesResource

func (w *World) LikesResource() ([]Entity, bool)

LikesResource Retrieve the resource from the world

func (*World) LikesWriteIter

func (w *World) LikesWriteIter() *LikesWriteIterator

func (*World) MarshalPatch added in v0.2.1

func (w *World) MarshalPatch() ([]byte, error)

func (*World) MarshalPatchJSON added in v0.2.1

func (w *World) MarshalPatchJSON() ([]byte, error)

func (*World) MarshalPatchPrettyJSON added in v0.2.1

func (w *World) MarshalPatchPrettyJSON() ([]byte, error)

func (*World) NameEntities

func (w *World) NameEntities() []Entity

func (*World) NameReadIter

func (w *World) NameReadIter() *NameReadIterator

func (*World) NameResource

func (w *World) NameResource() (Name, bool)

NameResource Retrieve the resource from the world

func (*World) NameWriteIter

func (w *World) NameWriteIter() *NameWriteIterator

func (*World) NewEats added in v0.2.1

func (w *World) NewEats(
	entitiesField []Entity,
	amountsField []uint8,
) Eats

func (*World) NewPosition added in v0.2.1

func (w *World) NewPosition(
	xField float32,
	yField float32,
	zField float32,
) Position

func (*World) NewRotation added in v0.2.1

func (w *World) NewRotation(
	xField float32,
	yField float32,
	zField float32,
	wField float32,
) Rotation

func (*World) NewVelocity added in v0.2.1

func (w *World) NewVelocity(
	xField float32,
	yField float32,
	zField float32,
) Velocity

func (*World) OnEntityCreated

func (w *World) OnEntityCreated(fn func(EntityCreatedEvent)) UnsubscribeFunc

func (*World) OnEntityDestroyed

func (w *World) OnEntityDestroyed(fn func(EntityDestroyedEvent)) UnsubscribeFunc

func (*World) PlanetEntities

func (w *World) PlanetEntities() []Entity

func (*World) PlanetReadIter

func (w *World) PlanetReadIter() *PlanetReadIterator

func (*World) PlanetWriteIter

func (w *World) PlanetWriteIter() *PlanetWriteIterator

func (*World) PositionEntities

func (w *World) PositionEntities() []Entity

func (*World) PositionReadIter

func (w *World) PositionReadIter() *PositionReadIterator

func (*World) PositionResource

func (w *World) PositionResource() (Position, bool)

PositionResource Retrieve the resource from the world

func (*World) PositionWriteIter

func (w *World) PositionWriteIter() *PositionWriteIterator

func (*World) RemoveAlliedWithResource

func (w *World) RemoveAlliedWithResource() Entity

RemoveAlliedWithResource removes the resource from the world

func (*World) RemoveAlliedWiths

func (w *World) RemoveAlliedWiths(entities ...Entity)

func (*World) RemoveChildOf

func (w *World) RemoveChildOf(entities ...Entity)

func (*World) RemoveChildOfResource

func (w *World) RemoveChildOfResource() Entity

RemoveChildOfResource removes the resource from the world

func (*World) RemoveDirectionResource added in v0.2.0

func (w *World) RemoveDirectionResource() Entity

RemoveDirectionResource removes the resource from the world

func (*World) RemoveDirections added in v0.2.0

func (w *World) RemoveDirections(entities ...Entity)

func (*World) RemoveDockedToResource

func (w *World) RemoveDockedToResource() Entity

RemoveDockedToResource removes the resource from the world

func (*World) RemoveDockedTos

func (w *World) RemoveDockedTos(entities ...Entity)

func (*World) RemoveEats

func (w *World) RemoveEats(entities ...Entity)

func (*World) RemoveEatsResource

func (w *World) RemoveEatsResource() Entity

RemoveEatsResource removes the resource from the world

func (*World) RemoveEnemyTags

func (w *World) RemoveEnemyTags(entities ...Entity)

func (*World) RemoveFactionResource

func (w *World) RemoveFactionResource() Entity

RemoveFactionResource removes the resource from the world

func (*World) RemoveFactions

func (w *World) RemoveFactions(entities ...Entity)

func (*World) RemoveGravities

func (w *World) RemoveGravities(entities ...Entity)

func (*World) RemoveGravityResource

func (w *World) RemoveGravityResource() Entity

RemoveGravityResource removes the resource from the world

func (*World) RemoveGrows

func (w *World) RemoveGrows(entities ...Entity)

func (*World) RemoveGrowsResource

func (w *World) RemoveGrowsResource() Entity

RemoveGrowsResource removes the resource from the world

func (*World) RemoveIsA

func (w *World) RemoveIsA(entities ...Entity)

func (*World) RemoveIsAResource

func (w *World) RemoveIsAResource() Entity

RemoveIsAResource removes the resource from the world

func (*World) RemoveLikes

func (w *World) RemoveLikes(entities ...Entity)

func (*World) RemoveLikesResource

func (w *World) RemoveLikesResource() Entity

RemoveLikesResource removes the resource from the world

func (*World) RemoveNameResource

func (w *World) RemoveNameResource() Entity

RemoveNameResource removes the resource from the world

func (*World) RemoveNames

func (w *World) RemoveNames(entities ...Entity)

func (*World) RemovePlanetTags

func (w *World) RemovePlanetTags(entities ...Entity)

func (*World) RemovePositionResource

func (w *World) RemovePositionResource() Entity

RemovePositionResource removes the resource from the world

func (*World) RemovePositions

func (w *World) RemovePositions(entities ...Entity)

func (*World) RemoveRotationResource

func (w *World) RemoveRotationResource() Entity

RemoveRotationResource removes the resource from the world

func (*World) RemoveRotations

func (w *World) RemoveRotations(entities ...Entity)

func (*World) RemoveRuledByResource

func (w *World) RemoveRuledByResource() Entity

RemoveRuledByResource removes the resource from the world

func (*World) RemoveRuledBys

func (w *World) RemoveRuledBys(entities ...Entity)

func (*World) RemoveSpaceshipTags

func (w *World) RemoveSpaceshipTags(entities ...Entity)

func (*World) RemoveSpacestationTags

func (w *World) RemoveSpacestationTags(entities ...Entity)

func (*World) RemoveSystems

func (w *World) RemoveSystems(ss ...System) error

RemoveSystems removes systems from the world. Systems are removed in the order they are passed.

func (*World) RemoveVelocities

func (w *World) RemoveVelocities(entities ...Entity)

func (*World) RemoveVelocityResource

func (w *World) RemoveVelocityResource() Entity

RemoveVelocityResource removes the resource from the world

func (*World) Reset

func (w *World) Reset()

func (*World) ResetChildOf

func (w *World) ResetChildOf() Entity

func (*World) ResetDirection added in v0.2.0

func (w *World) ResetDirection() EnumDirection

func (*World) ResetDockedTo

func (w *World) ResetDockedTo() Entity

func (*World) ResetEats

func (w *World) ResetEats() Eats

func (*World) ResetFaction

func (w *World) ResetFaction() Entity

func (*World) ResetGravity

func (w *World) ResetGravity() float32

func (*World) ResetIsA

func (w *World) ResetIsA() Entity

func (*World) ResetName

func (w *World) ResetName() string

func (*World) ResetPatch added in v0.2.1

func (w *World) ResetPatch()

func (*World) ResetPosition

func (w *World) ResetPosition() Position

func (*World) ResetRotation

func (w *World) ResetRotation() Rotation

func (*World) ResetRuledBy

func (w *World) ResetRuledBy() Entity

func (*World) ResetVelocity

func (w *World) ResetVelocity() Velocity

func (*World) RotationEntities

func (w *World) RotationEntities() []Entity

func (*World) RotationReadIter

func (w *World) RotationReadIter() *RotationReadIterator

func (*World) RotationResource

func (w *World) RotationResource() (Rotation, bool)

RotationResource Retrieve the resource from the world

func (*World) RotationWriteIter

func (w *World) RotationWriteIter() *RotationWriteIterator

func (*World) RuledByEntities

func (w *World) RuledByEntities() []Entity

func (*World) RuledByReadIter

func (w *World) RuledByReadIter() *RuledByReadIterator

func (*World) RuledByResource

func (w *World) RuledByResource() (Entity, bool)

RuledByResource Retrieve the resource from the world

func (*World) RuledByWriteIter

func (w *World) RuledByWriteIter() *RuledByWriteIterator

func (*World) SetAlliedWithResource

func (w *World) SetAlliedWithResource(e ...Entity) Entity

SetAlliedWithResource set the resource in the world

func (*World) SetAlliedWithSortFn

func (w *World) SetAlliedWithSortFn(lessThan func(a, b Entity) bool)

func (*World) SetAlliedWiths

func (w *World) SetAlliedWiths(c AlliedWith, entities ...Entity)

func (*World) SetChildOf

func (w *World) SetChildOf(c ChildOf, entities ...Entity)

func (*World) SetChildOfResource

func (w *World) SetChildOfResource(e Entity) Entity

SetChildOfResource set the resource in the world

func (*World) SetChildOfSortFn

func (w *World) SetChildOfSortFn(lessThan func(a, b Entity) bool)

func (*World) SetDirectionResource added in v0.2.0

func (w *World) SetDirectionResource(c Direction) Entity

SetDirectionResource set the resource in the world

func (*World) SetDirectionSortFn added in v0.2.0

func (w *World) SetDirectionSortFn(lessThan func(a, b Entity) bool)

func (*World) SetDirections added in v0.2.0

func (w *World) SetDirections(c Direction, entities ...Entity)

func (*World) SetDockedToResource

func (w *World) SetDockedToResource(e Entity) Entity

SetDockedToResource set the resource in the world

func (*World) SetDockedToSortFn

func (w *World) SetDockedToSortFn(lessThan func(a, b Entity) bool)

func (*World) SetDockedTos

func (w *World) SetDockedTos(c DockedTo, entities ...Entity)

func (*World) SetEats

func (w *World) SetEats(c Eats, entities ...Entity)

func (*World) SetEatsResource

func (w *World) SetEatsResource(c Eats) Entity

SetEatsResource set the resource in the world

func (*World) SetEatsResourceValues added in v0.2.0

func (w *World) SetEatsResourceValues(
	entities0 []Entity,
	amounts1 []uint8,
) Entity

func (*World) SetEatsSortFn

func (w *World) SetEatsSortFn(lessThan func(a, b Entity) bool)

func (*World) SetFactionResource

func (w *World) SetFactionResource(e Entity) Entity

SetFactionResource set the resource in the world

func (*World) SetFactionSortFn

func (w *World) SetFactionSortFn(lessThan func(a, b Entity) bool)

func (*World) SetFactions

func (w *World) SetFactions(c Faction, entities ...Entity)

func (*World) SetGravities

func (w *World) SetGravities(c Gravity, entities ...Entity)

func (*World) SetGravityResource

func (w *World) SetGravityResource(c Gravity) Entity

SetGravityResource set the resource in the world

func (*World) SetGravitySortFn

func (w *World) SetGravitySortFn(lessThan func(a, b Entity) bool)

func (*World) SetGrows

func (w *World) SetGrows(c Grows, entities ...Entity)

func (*World) SetGrowsResource

func (w *World) SetGrowsResource(e ...Entity) Entity

SetGrowsResource set the resource in the world

func (*World) SetGrowsSortFn

func (w *World) SetGrowsSortFn(lessThan func(a, b Entity) bool)

func (*World) SetIsA

func (w *World) SetIsA(c IsA, entities ...Entity)

func (*World) SetIsAResource

func (w *World) SetIsAResource(e Entity) Entity

SetIsAResource set the resource in the world

func (*World) SetIsASortFn

func (w *World) SetIsASortFn(lessThan func(a, b Entity) bool)

func (*World) SetLikes

func (w *World) SetLikes(c Likes, entities ...Entity)

func (*World) SetLikesResource

func (w *World) SetLikesResource(e ...Entity) Entity

SetLikesResource set the resource in the world

func (*World) SetLikesSortFn

func (w *World) SetLikesSortFn(lessThan func(a, b Entity) bool)

func (*World) SetNameResource

func (w *World) SetNameResource(c Name) Entity

SetNameResource set the resource in the world

func (*World) SetNameSortFn

func (w *World) SetNameSortFn(lessThan func(a, b Entity) bool)

func (*World) SetNames

func (w *World) SetNames(c Name, entities ...Entity)

func (*World) SetPositionResource

func (w *World) SetPositionResource(c Position) Entity

SetPositionResource set the resource in the world

func (*World) SetPositionResourceValues added in v0.2.0

func (w *World) SetPositionResourceValues(
	x0 float32,
	y1 float32,
	z2 float32,
) Entity

func (*World) SetPositionSortFn

func (w *World) SetPositionSortFn(lessThan func(a, b Entity) bool)

func (*World) SetPositions

func (w *World) SetPositions(c Position, entities ...Entity)

func (*World) SetRotationResource

func (w *World) SetRotationResource(c Rotation) Entity

SetRotationResource set the resource in the world

func (*World) SetRotationResourceValues added in v0.2.0

func (w *World) SetRotationResourceValues(
	x0 float32,
	y1 float32,
	z2 float32,
	w3 float32,
) Entity

func (*World) SetRotationSortFn

func (w *World) SetRotationSortFn(lessThan func(a, b Entity) bool)

func (*World) SetRotations

func (w *World) SetRotations(c Rotation, entities ...Entity)

func (*World) SetRuledByResource

func (w *World) SetRuledByResource(e Entity) Entity

SetRuledByResource set the resource in the world

func (*World) SetRuledBySortFn

func (w *World) SetRuledBySortFn(lessThan func(a, b Entity) bool)

func (*World) SetRuledBys

func (w *World) SetRuledBys(c RuledBy, entities ...Entity)

func (*World) SetVelocities

func (w *World) SetVelocities(c Velocity, entities ...Entity)

func (*World) SetVelocityResource

func (w *World) SetVelocityResource(c Velocity) Entity

SetVelocityResource set the resource in the world

func (*World) SetVelocityResourceValues added in v0.2.0

func (w *World) SetVelocityResourceValues(
	x0 float32,
	y1 float32,
	z2 float32,
) Entity

func (*World) SetVelocitySortFn

func (w *World) SetVelocitySortFn(lessThan func(a, b Entity) bool)

func (*World) SortAlliedWiths

func (w *World) SortAlliedWiths()

func (*World) SortChildOf

func (w *World) SortChildOf()

func (*World) SortDirections added in v0.2.0

func (w *World) SortDirections()

func (*World) SortDockedTos

func (w *World) SortDockedTos()

func (*World) SortEats

func (w *World) SortEats()

func (*World) SortFactions

func (w *World) SortFactions()

func (*World) SortGravities

func (w *World) SortGravities()

func (*World) SortGrows

func (w *World) SortGrows()

func (*World) SortIsA

func (w *World) SortIsA()

func (*World) SortLikes

func (w *World) SortLikes()

func (*World) SortNames

func (w *World) SortNames()

func (*World) SortPositions

func (w *World) SortPositions()

func (*World) SortRotations

func (w *World) SortRotations()

func (*World) SortRuledBys

func (w *World) SortRuledBys()

func (*World) SortVelocities

func (w *World) SortVelocities()

func (*World) SpaceshipEntities

func (w *World) SpaceshipEntities() []Entity

func (*World) SpaceshipReadIter

func (w *World) SpaceshipReadIter() *SpaceshipReadIterator

func (*World) SpaceshipWriteIter

func (w *World) SpaceshipWriteIter() *SpaceshipWriteIterator

func (*World) SpacestationEntities

func (w *World) SpacestationEntities() []Entity

func (*World) SpacestationReadIter

func (w *World) SpacestationReadIter() *SpacestationReadIterator

func (*World) SpacestationWriteIter

func (w *World) SpacestationWriteIter() *SpacestationWriteIterator

func (*World) Tick

func (w *World) Tick(ctx context.Context) error

Tick runs all systems in the world. Systems are run in the order they were added.

func (*World) TickCount

func (w *World) TickCount() int

TickCount returns the number of times the world has ticked.

func (*World) UnmarshalPatch added in v0.2.1

func (w *World) UnmarshalPatch(data []byte) error

func (*World) UnmarshalPatchJSON added in v0.2.1

func (w *World) UnmarshalPatchJSON(data []byte) error

func (*World) VelocityEntities

func (w *World) VelocityEntities() []Entity

func (*World) VelocityReadIter

func (w *World) VelocityReadIter() *VelocityReadIterator

func (*World) VelocityResource

func (w *World) VelocityResource() (Velocity, bool)

VelocityResource Retrieve the resource from the world

func (*World) VelocityWriteIter

func (w *World) VelocityWriteIter() *VelocityWriteIterator

func (*World) WriteableAlliedWithResource added in v0.2.1

func (w *World) WriteableAlliedWithResource() (c *AlliedWith, done func())

WriteableAlliedWithResource returns a writable reference to the resource

func (*World) WriteableChildOfResource added in v0.2.1

func (w *World) WriteableChildOfResource() (c *ChildOf, done func())

WriteableChildOfResource returns a writable reference to the resource

func (*World) WriteableDirectionResource added in v0.2.1

func (w *World) WriteableDirectionResource() (c *Direction, done func())

WriteableDirectionResource returns a writable reference to the resource

func (*World) WriteableDockedToResource added in v0.2.1

func (w *World) WriteableDockedToResource() (c *DockedTo, done func())

WriteableDockedToResource returns a writable reference to the resource

func (*World) WriteableEatsResource added in v0.2.1

func (w *World) WriteableEatsResource() (c *Eats, done func())

WriteableEatsResource returns a writable reference to the resource

func (*World) WriteableFactionResource added in v0.2.1

func (w *World) WriteableFactionResource() (c *Faction, done func())

WriteableFactionResource returns a writable reference to the resource

func (*World) WriteableGravityResource added in v0.2.1

func (w *World) WriteableGravityResource() (c *Gravity, done func())

WriteableGravityResource returns a writable reference to the resource

func (*World) WriteableGrowsResource added in v0.2.1

func (w *World) WriteableGrowsResource() (c *Grows, done func())

WriteableGrowsResource returns a writable reference to the resource

func (*World) WriteableIsAResource added in v0.2.1

func (w *World) WriteableIsAResource() (c *IsA, done func())

WriteableIsAResource returns a writable reference to the resource

func (*World) WriteableLikesResource added in v0.2.1

func (w *World) WriteableLikesResource() (c *Likes, done func())

WriteableLikesResource returns a writable reference to the resource

func (*World) WriteableNameResource added in v0.2.1

func (w *World) WriteableNameResource() (c *Name, done func())

WriteableNameResource returns a writable reference to the resource

func (*World) WriteablePositionResource added in v0.2.1

func (w *World) WriteablePositionResource() (c *Position, done func())

WriteablePositionResource returns a writable reference to the resource

func (*World) WriteableRotationResource added in v0.2.1

func (w *World) WriteableRotationResource() (c *Rotation, done func())

WriteableRotationResource returns a writable reference to the resource

func (*World) WriteableRuledByResource added in v0.2.1

func (w *World) WriteableRuledByResource() (c *RuledBy, done func())

WriteableRuledByResource returns a writable reference to the resource

func (*World) WriteableVelocityResource added in v0.2.1

func (w *World) WriteableVelocityResource() (c *Velocity, done func())

WriteableVelocityResource returns a writable reference to the resource

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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