# HG changeset patch # User KarstenBock@gmx.net # Date 1315142387 -7200 # Node ID 59a4337f328feae97c87b068478d4a802ec68a23 # Parent da8589a71d940305c4961d5648f9d0aa0beb9312 Added fifeagent as component to the Character entity and added a method that attaches the behaviour to the layer diff -r da8589a71d94 -r 59a4337f328f entities/character.py --- a/entities/character.py Sun Sep 04 13:44:10 2011 +0200 +++ b/entities/character.py Sun Sep 04 15:19:47 2011 +0200 @@ -15,7 +15,8 @@ class Character(Entity): def __init__(self, world, view_name, real_name, desc, statistics, max_bulk, - items=None): + identifier, layer=None, behaviour=None, gfx=None, items=None + ): self.characterstats.statistics = statistics self.description.view_name = view_name @@ -24,3 +25,13 @@ self.container.children = items or [] self.container.max_bulk = max_bulk + + self.fifeagent.identifier = identifier + self.fifeagent.layer = layer + self.fifeagent.behaviour = behaviour + self.fifeagent.gfx = gfx + + def setup_behaviour(self): + """Attach the behaviour to the layer""" + if self.fifeagent.behaviour: + self.fifeagent.behaviour.attachToLayer(self.fifeagent.identifier)