Documentation
¶
Index ¶
- Variables
- func AddBoolComponent(id string, component string, value bool) error
- func AddBoolToMapComponent(id string, component string, key string, value bool) error
- func AddEntity(entityType string, args map[string]interface{}) (string, error)
- func AddEntityWithID(entityType string, id string, args map[string]interface{}) error
- func AddInt64ComponentToEntity(id string, component string, value int64) error
- func AddInt64ToMapComponent(id string, component string, key string, value int64) error
- func AddIntComponent(id string, component string, value int) error
- func AddIntToMapComponent(id string, component string, key string, value int) error
- func AddMapComponentToEntity(id string, component string, value map[string]interface{}) error
- func AddOrUpdateIntInMapComponent(id string, component string, key string, value int) error
- func AddOrUpdateStringComponentToEntity(id string, component string, value string) error
- func AddOrUpdateStringInMapComponent(id string, component string, key string, value string) error
- func AddSetComponent(id string, component string, value []interface{}) error
- func AddStringComponentToEntity(id string, component string, value string) error
- func AddStringToMapComponent(id string, component string, key string, value string) error
- func AddToInt64SetComponent(id string, component string, value int64) error
- func AddToIntSetComponent(id string, component string, value int) error
- func AddToStringSetComponent(id string, component string, value string) error
- func ComponentExists(id string, component string) (bool, error)
- func CreateEntity(entityType string, args map[string]interface{}) (map[string]interface{}, error)
- func EntitiesWithComponent(component string) ([]string, error)
- func EntitiesWithComponentValue(component string, value interface{}) ([]string, error)
- func EntityExists(id string) (bool, error)
- func GetBoolComponent(id string, component string) (bool, error)
- func GetHashComponent(id string, component string) (map[string]interface{}, error)
- func GetInt64Component(id string, component string) (int64, error)
- func GetInt64FromMapComponent(id string, component string, element string) (int64, error)
- func GetIntComponent(id string, component string) (int, error)
- func GetIntFromMapComponent(id string, component string, element string) (int, error)
- func GetStringComponent(id string, component string) (string, error)
- func GetStringFromMapComponent(id string, component string, element string) (string, error)
- func IsEntityTypeRegistered(entityType string) bool
- func RegisterEntityType(entityType entity_type.EntityType)
- func RegisterSystem(system system.System)
- func RemoveComponent(id string, name string) error
- func RemoveEntity(id string) error
- func RemoveFromInt64SetComponent(id string, component string, value int64) error
- func RemoveFromIntSetComponent(id string, component string, value int) error
- func RemoveFromStringSetComponent(id string, component string, value string) error
- func ReplaceEntity(id string, args map[string]interface{}) error
- func UpdateBoolComponent(id string, component string, value bool) error
- func UpdateBoolInMapComponent(id string, component string, key string, value bool) error
- func UpdateEntity(id string, args map[string]interface{}) error
- func UpdateInt64Component(id string, component string, value int64) error
- func UpdateInt64InMapComponent(id string, component string, key string, value int64) error
- func UpdateIntComponent(id string, component string, value int) error
- func UpdateIntInMapComponent(id string, component string, key string, value int) error
- func UpdateOrAddEntity(entityType string, id string, args map[string]interface{}) error
- func UpdateStringComponent(id string, component string, value string) error
- func UpdateStringInMapComponent(id string, component string, key string, value string) error
Constants ¶
This section is empty.
Variables ¶
var Plugin = plugin{}
Functions ¶
func AddBoolComponent ¶
AddBoolComponent adds a boolean component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, an error will be thrown.
func AddBoolToMapComponent ¶
AddBoolToMapComponent adds a boolean component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists an error will be thrown. Once a value is added to the map, the type of that key is enforced. Attempting to change // the type of a key will result in an error in later updated.
func AddEntity ¶
AddEntity adds an entity to the entity registry. It takes the entity id, and a map of arguments to be passed to the entity type's constructor. If the entity type is not registered, an error will be returned. If the entity already exists, an error will be returned.
func AddEntityWithID ¶
AddEntityWithID adds an entity with the provided id to the entity registry. It takes the entity id, and a map of arguments to be passed to the entity type's constructor. If the entity type is not registered, an error will be returned. If the entity already exists, an error will be returned.
func AddInt64ComponentToEntity ¶
AddInt64ComponentToEntity adds an integer64 component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, an error will be thrown.
func AddInt64ToMapComponent ¶
AddInt64ToMapComponent adds an integer64 component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists an error will be thrown. Once a value is added to the map, the type of that key is enforced. Attempting to change the type of a key will result in an error in later updated.
func AddIntComponent ¶
AddIntComponent adds an integer component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, an error will be thrown.
func AddIntToMapComponent ¶
AddIntToMapComponent adds an integer component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists an error will be thrown. Once a value is added to the map, the type of that key is enforced. Attempting to change the type of a key will result in an error in later updated.
func AddMapComponentToEntity ¶
AddMapComponentToEntity adds a map component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, an error will be thrown. Once a value is added to the map, the type of that key is enforced. Attempting to change the type of a key will result in an error in later updated.
func AddOrUpdateIntInMapComponent ¶
AddOrUpdateIntInMapComponent adds or updates an integer component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists, the value will be updated. Once a value is added to the map, the type of that key is enforced. Attempting to change the type of key will result in an error in later updated.
func AddOrUpdateStringComponentToEntity ¶
AddOrUpdateStringComponentToEntity adds or updates a string component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, it will be updated.
func AddOrUpdateStringInMapComponent ¶
AddOrUpdateStringInMapComponent adds or updates a string component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists, the value will be updated. Once a value is added to the map, the type of that key is enforced. Attempting to change the type of key will result in an error in later updated.
func AddSetComponent ¶
AddSetComponent adds a set component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id already exists error will be thrown. If a component with the same name already exists, an error will be thrown. Once a value is added to the set, the type of that value is enforced for all members of the set. Attempting to change the type of a value will result in an error in later updates.
func AddStringComponentToEntity ¶
AddStringComponentToEntity adds a string component to an entity. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name already exists, an error will be thrown.
func AddStringToMapComponent ¶
AddStringToMapComponent adds a string component to a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key already exists an error will be thrown. Once a value is added to the map, the type of that key is enforced. Attempting to change // the type of a key will result in an error in later updated.
func AddToInt64SetComponent ¶
AddToInt64SetComponent adds an integer64 value to a set component. It takes the entity ID, component name, and the value to add to the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not an integer64, an error will be thrown.
func AddToIntSetComponent ¶
AddToIntSetComponent adds an integer value to a set component. It takes the entity ID, component name, and the value to add to the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not an integer, an error will be thrown.
func AddToStringSetComponent ¶
AddToStringSetComponent adds a string value to a set component. It takes the entity ID, component name, and the value to add to the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not a string, an error will be thrown.
func ComponentExists ¶
ComponentExists checks if a component exists. It takes the entity ID and the component name.
func CreateEntity ¶
func EntitiesWithComponent ¶
func EntityExists ¶
func GetBoolComponent ¶
GetBoolComponent returns a boolean component from an entity. It takes the entity ID and component name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a boolean, an error will be thrown.
func GetHashComponent ¶
GetHashComponent returns a hash component from an entity. It takes the entity ID and component name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a hash, an error will be thrown.
func GetInt64Component ¶
GetInt64Component returns an integer64 component from an entity. It takes the entity ID and component name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not an integer64, an error will be thrown.
func GetInt64FromMapComponent ¶
GetInt64FromMapComponent returns the int64 value of an element in a map component. It takes the entity ID, component name, and the element name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a map, an error will be thrown. If the element does not exist, an error will be thrown. If the element is not an integer64, an error will be thrown.
func GetIntComponent ¶
GetIntComponent returns an integer component from an entity. It takes the entity ID and component name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not an integer, an error will be thrown.
func GetIntFromMapComponent ¶
GetIntFromMapComponent returns the int value of an element in a map component. It takes the entity ID, component name, and the element name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a map, an error will be thrown. If the element does not exist, an error will be thrown. If the element is not an integer, an error will be thrown.
func GetStringComponent ¶
GetStringComponent returns the value of the string component. It takes the entity ID and component name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a string, an error will be thrown.
func GetStringFromMapComponent ¶
GetStringFromMapComponent returns the string value of an element in a map component. It takes the entity ID, component name, and the element name. If the entity does not exist or the component does not exist, an error will be thrown. If the component is not a map, an error will be thrown. If the element does not exist, an error will be thrown. If the element is not a string, an error will be thrown.
func IsEntityTypeRegistered ¶
IsEntityTypeRegistered checks if an entity type is registered. It takes the entity type name.
func RegisterEntityType ¶
func RegisterEntityType(entityType entity_type.EntityType)
RegisterEntityType registers an entity type. Entity Types must implmeent the `EntityType` interface. It is expected that developers can override default EntityType implementations with their own implementations.Q
func RegisterSystem ¶
RegisterSystem registers a system with the registry. If a system with the same name is already registered, it will be overwritten.
func RemoveComponent ¶
RemoveComponent removes the component from the entity. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown.
func RemoveEntity ¶
RemoveEntity removes an entity from the entity registry. It takes the entity type and id. If an entity with the same id does not exist an error will be thrown.
func RemoveFromInt64SetComponent ¶
RemoveFromInt64SetComponent removes an integer64 value from a set component. It takes the entity ID, component name, and the value to remove from the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not an integer64, an error will be thrown.
func RemoveFromIntSetComponent ¶
RemoveFromIntSetComponent removes an integer value from a set component. It takes the entity ID, component name, and the value to remove from the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not an integer, an error will be thrown.
func RemoveFromStringSetComponent ¶
RemoveFromStringSetComponent removes a string value from a set component. It takes the entity ID, component name, and the value to remove from the set. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the value type is not a string, an error will be thrown.
func ReplaceEntity ¶
ReplaceEntity removes and then replaces an entity in the entity registry. It takes the entity type, id, and a map of components. It will remove the entity with the provided id and then add the provided components to the entity. If an entity with the same id does not exist, or the entity type does not match an error will be thrown.
func UpdateBoolComponent ¶
UpdateBoolComponent updates a bool component in the entity registry. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown.
func UpdateBoolInMapComponent ¶
UpdateBoolInMapComponent updates a bool component in a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key soes not already exist an error will be thrown. Once a value is added to the map, the type of that key is enforced. If the value is not the correct type an error will be thrown.
func UpdateEntity ¶
UpdateEntity updates an entity in the entity registry. It takes the entity type, id, and a map of components. It will apply the provided components to the entity. If an entity with the same id does not exist, or the entity type does not match an error will be thrown. If the entity type does not match the existing an error will be thrown. Any components that are not provided will be removed from the entity.
func UpdateInt64Component ¶
UpdateInt64Component updates an integer64 component in the entity registry. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown.
func UpdateInt64InMapComponent ¶
UpdateInt64InMapComponent updates an integer64 component in a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key soes not already exist an error will be thrown. Once a value is added to the map, the type of that key is enforced. If the value is not the correct type an error will be thrown.
func UpdateIntComponent ¶
UpdateIntComponent updates an integer component in the entity registry. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown.
func UpdateIntInMapComponent ¶
UpdateIntInMapComponent updates an integer component in a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key soes not already exist an error will be thrown. Once a value is added to the map, the type of that key is enforced. If the value is not the correct type an error will be thrown.
func UpdateOrAddEntity ¶
UpdateOrAddEntity updates an entity in the entity registry. It takes the entity type, id, and a map of components. It will apply the provided components to the entity. If an entity with the same id does not exist, it will add the entity with the provided id and components. If the entity type does not match the existing an error will be thrown. Any components that are not provided will be removed from the entity.
func UpdateStringComponent ¶
UpdateStringComponent updates a string component in the entity registry. It takes the entity ID, component name, and the value of the component. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown.
func UpdateStringInMapComponent ¶
UpdateStringInMapComponent updates a string component in a map component. It takes the entity ID, component name, the key to which to add the value, and the value to add to the map. If an entity with the same id does not exist an error will be thrown. If a component with the same name does not exist, an error will be thrown. If the key soes not already exist an error will be thrown. Once a value is added to the map, the type of that key is enforced. If the value is not the correct type an error will be thrown.
Types ¶
This section is empty.