Package-level declarations

Types

Link copied to clipboard
class DescriptorWrapper(val serialName: String, wrapped: SerialDescriptor) : SerialDescriptor

A wrapper around SerialDescriptor that only overrides the serialName.

Link copied to clipboard
abstract class FlatSerializer<T : FlatWrap<A>, A : Any>(serialName: String, serializer: KSerializer<A>, create: (A) -> T) : KSerializer<T>

An abstract serializer for a FlatWrap that will use the wrapped value's serializer to serialize this class.

Link copied to clipboard
interface FlatWrap<A>

A class that holds only one value that we want to delegate serialization to.

Link copied to clipboard
class SerializerWrapper<T>(val descriptor: SerialDescriptor, wrapped: KSerializer<T>) : KSerializer<T>

A wrapper around KSerializer that only overrides the descriptor. Not technically needed but doing this just in case.

Functions

Link copied to clipboard
fun Entity.addChild(child: Entity)

Adds a child entity to this entity.

Link copied to clipboard
fun Entity.addChildren(children: Array<Entity>)

Adds a list of children entities to this entity.

Link copied to clipboard
fun Entity.addParent(parent: Entity)

Adds a parent entity to this entity.

Link copied to clipboard
fun Entity.addParents(parents: Array<Entity>)

Adds a list of parents entities to this entity.

Link copied to clipboard

Removes all of this entity's children, also unlinking this parent from them.

Link copied to clipboard

Removes all of this entity's parents, also unlinking this child from them.

Link copied to clipboard
inline fun <T> component(): Entity
fun component(kClass: KClass<*>): Entity
Link copied to clipboard
inline fun <T> componentId(): ComponentId

Gets or registers the id of a component of type T

fun componentId(kClass: KClass<*>): ComponentId

Gets or registers the id of a component by its kClass.


Gets or registers the id of a component by its kType.

Link copied to clipboard

Gets or registers the id of a component of type T, adding the HOLDS_DATA role if T is not nullable.

Link copied to clipboard
operator fun Family.contains(type: EntityType): Boolean
Link copied to clipboard
fun entity(): Entity

Creates a new empty entity. May reuse recently deleted entity ids.

inline fun entity(run: Entity.() -> Unit): Entity
Link copied to clipboard
Link copied to clipboard

Gets the ComponentInfo component from a component's id.

Link copied to clipboard
Link copied to clipboard
fun EntityType.hasRelationKind(kind: ComponentId, targetMustHoldData: Boolean = false): Boolean
Link copied to clipboard
fun EntityType.hasRelationTarget(target: EntityId, kindMustHoldData: Boolean = false): Boolean
Link copied to clipboard
inline fun <T : Component?> Entity.nullOrError(): T

Gets a component of type T from an entity, returning null if T is nullable, or an error otherwise.

Link copied to clipboard
inline fun Entity.onParent(parent: Entity? = this.parent, run: Entity.() -> Unit)

Runs code on the first parent of this entity.

Link copied to clipboard
Link copied to clipboard

Removes a child, also unlinking this parent from that child.

Link copied to clipboard

Removes a parent, also unlinking this child from that parent.

Link copied to clipboard
inline fun <T> temporaryEntity(run: (Entity) -> T): T

Creates a new empty entity that will get removed once run completes or fails.

Link copied to clipboard

Gets the entity associated with this Long.

Gets the entity associated with this EntityId, stripping it of any roles.

inline fun EntityId.toGeary(run: Entity.() -> Unit): Entity

Gets the entity associated with this EntityId, stripping it of any roles, and runs code on it.

Link copied to clipboard
inline fun <R, T : Component?> Entity.with(let: (T) -> R): R?
inline fun <R, T : Component?, T2 : Component?> Entity.with(let: (T, T2) -> R): R?
inline fun <T : Component, T2 : Component, T3 : Component> Entity.with(let: (T, T2, T3) -> Unit): Unit?
inline fun <T : Component, T2 : Component, T3 : Component, T4 : Component> Entity.with(let: (T, T2, T3, T4) -> Unit): Unit?
inline fun <T : Component, T2 : Component, T3 : Component, T4 : Component, T5 : Component> Entity.with(let: (T, T2, T3, T4, T5) -> Unit): Unit?
inline fun <T : Component, T2 : Component, T3 : Component, T4 : Component, T5 : Component, T6 : Component> Entity.with(let: (T, T2, T3, T4, T5, T6) -> Unit): Unit?
inline fun <T : Component, T2 : Component, T3 : Component, T4 : Component, T5 : Component, T6 : Component, T7 : Component> Entity.with(let: (T, T2, T3, T4, T5, T6, T7) -> Unit): Unit?

Runs when an entity has all passed components present.

Link copied to clipboard
fun <T> KSerializer<T>.withSerialName(name: String): SerializerWrapper<T>

Properties

Link copied to clipboard
Link copied to clipboard

Gets the first parent of this entity

Link copied to clipboard