comparison clients/rio_de_hola/scripts/beekeeper.py @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
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