brute.entity

Entity Manager functions for the Brute Entity Component System

add-component

(add-component system entity instance)
Add a component instance to a given entity in the ES data structure and returns it.
Will overwrite a component if already set.

add-entity

(add-entity system entity)
Add the entity to the ES Data Structure and returns it

create-entity

(create-entity)
Create the entity and return it. Entities are just UUIDs

create-system

(create-system)
Creates the system data structure that will need to be passed to all entity functions

create-uuid

(create-uuid)
create a UUID

get-all-components-on-entity

(get-all-components-on-entity system entity)
Get all the components on a specific entity. Useful for debugging

get-all-entities

(get-all-entities system)
Returns a list of all the entities. Not that useful in application, but good for debugging/testing

get-all-entities-with-component

(get-all-entities-with-component system type)
Get all the entities that have a given component type

get-component

(get-component system entity type)
Get the component data for a specific component type

get-component-type

multimethod

Returns the type for a given component. Using a multimethod with 'class' as the dispatch-fn to allow for extensibility per application.
By default returns the class of the component.

kill-entity

(kill-entity system entity)
Destroy an entity completely from the ES data structure and returns it

remove-component

(remove-component system entity instance)
Remove a component instance from the ES data structure and returns it

update-component

(update-component system entity type fn & args)
Update an entity's component instance through through fn. Function is applied first with the specified component and any other args applied,
and should return the modified component instance. Return nil if you want no change to occur.