comparison src/parpg/entities/__init__.py @ 116:9b5498e3bda0

Move the identifier field from the FifeAgent component to the new General component. Added General Entity.
author KarstenBock@gmx.net
date Sat, 24 Sep 2011 15:48:24 +0200
parents d89e88a90c9e
children
comparison
equal deleted inserted replaced
115:a85d58fcd253 116:9b5498e3bda0
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. 14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>.
15 15
16 import sys 16 import sys
17 17
18 from parpg.bGrease import Entity 18 from general import General
19 19
20 def createEntity(info, world, extra = None): 20 def createEntity(info, identifier, world, extra = None):
21 """Called when we need to get an actual object. 21 """Called when we need to get an actual object.
22 @type info: dict 22 @type info: dict
23 @param info: stores information about the object we want to create 23 @param info: stores information about the object we want to create
24 @type extra: dict 24 @type extra: dict
25 @param extra: stores additionally required attributes 25 @param extra: stores additionally required attributes
30 # add the extra info 30 # add the extra info
31 for key, val in extra.items(): 31 for key, val in extra.items():
32 info[key].update(val) 32 info[key].update(val)
33 33
34 # this is for testing purposes 34 # this is for testing purposes
35 new_ent = Entity(world) 35 new_ent = General(world, identifier)
36 for component, data in info.items(): 36 for component, data in info.items():
37 comp_obj = getattr(new_ent, component) 37 comp_obj = getattr(new_ent, component)
38 for key, value in data.items(): 38 for key, value in data.items():
39 setattr(comp_obj, key, value) 39 setattr(comp_obj, key, value)
40 return new_ent 40 return new_ent