]>
git.r.bdr.sh - rbdr/serpentity/blob - lib/serpentity/entity.js
cf2a623dd8bcb4844a182a2dc630249736339baf
2 * The entity gives the entity framework its name. It exists only
5 Class(Serpentity
, "Entity")({
7 addedComponents : null,
9 init : function init(config
) {
14 for (property
in config
) {
15 if (config
.hasOwnProperty(property
)) {
16 this[property
] = config
[property
];
22 * Adds a component to the entity.
24 * returns true if added, false if already present
26 add : function add(component
) {
27 if (this.components
.hasOwnProperty(component
.constructor)) {
30 this.components
[component
.constructor] = component
;
35 * returns true if component is included, false otherwise
37 hasComponent : function hasComponent(componentClass
) {
38 if (this.components
.hasOwnProperty(componentClass
)) {