lkn-core v0.3.0 Lkn.Core.Entity behaviour View Source
A behaviour module for implementing an Entity.
Note: An Entity can either be a Map or a Puppet. To actually
implement an Entity, you should use either
Lkn.Core.Puppet.defpuppet/2
or Lkn.Core.Map.defmap/2
. In other
words, if your code contains @behaviour Lkn.Core.Entity
, you are
doing it wrong. From a developer point of view, only the
start_link/3
function is really useful.
Link to this section Summary
Types
The third argument of the start_link/3
function which is passed to
the init_properties/1
callback
A key to identify and reach an Entity, that is either a
Lkn.Core.Puppet
or a Lkn.Core.Map
A property of the Entity, e.g. its health point, its current speed, etc
A value associated to a given Entity’s property
Functions
Compute a digest which hopefully describes the entity
Retreive the current value of the given property, if it exists
Starts an Entity process linked to the current process
Stop the given Entity
Callbacks
Initializes the Entity’s map of properties
Link to this section Types
The third argument of the start_link/3
function which is passed to
the init_properties/1
callback.
A key to identify and reach an Entity, that is either a
Lkn.Core.Puppet
or a Lkn.Core.Map
.
A property of the Entity, e.g. its health point, its current speed, etc.
A value associated to a given Entity’s property.
Link to this section Functions
Compute a digest which hopefully describes the entity
Retreive the current value of the given property, if it exists.
There is no write
counterpart, because only a Component
can
modify it.
start_link(module, k, init_args) :: Supervisor.on_start
Starts an Entity process linked to the current process.
Stop the given Entity
This
Link to this section Callbacks
Initializes the Entity’s map of properties.
This map is used by