comparison clients/rio_de_hola/scripts/agents/beekeeper.py @ 98:214e3eb81eb2

better structure for techdemo scripts + svn:ignore fixes
author jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 21 Jul 2008 13:46:15 +0000
parents clients/rio_de_hola/scripts/beekeeper.py@4a0efb7baf70
children ae3b8139c7c7
comparison
equal deleted inserted replaced
97:346738d09188 98:214e3eb81eb2
1 from agent import Agent
2 import settings as TDS
3 import fife, random
4
5 _STATE_NONE, _STATE_TALK = 0, 1
6
7 class Beekeeper(Agent):
8 def __init__(self, model, agentName, layer, uniqInMap=True):
9 super(Beekeeper, self).__init__(model, agentName, layer, uniqInMap)
10 self.state = _STATE_NONE
11
12 def onInstanceActionFinished(self, instance, action):
13 self.talk()
14
15 def start(self):
16 self.facingLoc = self.agent.getLocation()
17 c = self.facingLoc.getExactLayerCoordinatesRef()
18 c.x += random.randint(-1, 1)
19 c.y += random.randint(-1, 1)
20 self.talk()
21
22 def talk(self):
23 self.state = _STATE_TALK
24 self.agent.act('talk', self.facingLoc, True) # never calls back