-
Notifications
You must be signed in to change notification settings - Fork 9
Components
The components that we combine into entities are simple name:data associations declared in the .json.
The components module contains certain .py files for placing functions to construct components on instancing, and serialize them before saving as .json
When an entity is initialized, component constructor functions with matching names are found and called:
The constructor functions take 1 arg (the value of the component) and return the transformed value. (an example is rolling the maxhp for entities)
If you need a component to modify data other than its own value, use Actions to hook the component into an init update of some sort.
These are called before instances are serialized to .json (if there is non serializable data, convert it here):
They take 1 arg of component value and return transformed value.
These functions merge two component declarations( used when merging the 'extends' ancestor list when instancing):
They take 2 args of component data.
TODO deserialize functions are needed such as when a save file is re-loaded