Mercurial > fife-parpg
comparison clients/rio_de_hola/scripts/agents/hero.py @ 121:ae3b8139c7c7
* Applying settings patch by greyghost
* See: #274
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 05 Aug 2008 14:44:15 +0000 |
parents | 214e3eb81eb2 |
children | 9a1529f9625e |
comparison
equal
deleted
inserted
replaced
120:e21b1a26fa5f | 121:ae3b8139c7c7 |
---|---|
1 import random | 1 import random |
2 from agent import Agent | 2 from agent import Agent |
3 import settings as TDS | 3 from settings import Setting |
4 | |
5 TDS = Setting() | |
4 | 6 |
5 _STATE_NONE, _STATE_IDLE, _STATE_RUN, _STATE_KICK, _STATE_TALK = xrange(5) | 7 _STATE_NONE, _STATE_IDLE, _STATE_RUN, _STATE_KICK, _STATE_TALK = xrange(5) |
6 | 8 |
7 class Hero(Agent): | 9 class Hero(Agent): |
8 def __init__(self, model, agentName, layer, uniqInMap=True): | 10 def __init__(self, model, agentName, layer, uniqInMap=True): |
15 if action.getId() != 'stand': | 17 if action.getId() != 'stand': |
16 self.idlecounter = 1 | 18 self.idlecounter = 1 |
17 else: | 19 else: |
18 self.idlecounter += 1 | 20 self.idlecounter += 1 |
19 if self.idlecounter % 7 == 0: | 21 if self.idlecounter % 7 == 0: |
20 txtindex = random.randint(0, len(TDS.heroTexts) - 1) | 22 heroTexts = TDS.readSetting("heroTexts", type='list', text=True) |
21 instance.say(TDS.heroTexts[txtindex], 2500) | 23 txtindex = random.randint(0, len(heroTexts) - 1) |
24 instance.say(heroTexts[txtindex], 2500) | |
22 | 25 |
23 def start(self): | 26 def start(self): |
24 self.idle() | 27 self.idle() |
25 | 28 |
26 def idle(self): | 29 def idle(self): |
27 self.state = _STATE_IDLE | 30 self.state = _STATE_IDLE |
28 self.agent.act('stand', self.agent.getFacingLocation()) | 31 self.agent.act('stand', self.agent.getFacingLocation()) |
29 | 32 |
30 def run(self, location): | 33 def run(self, location): |
31 self.state = _STATE_RUN | 34 self.state = _STATE_RUN |
32 self.agent.move('run', location, 4 * TDS.TestAgentSpeed) | 35 self.agent.move('run', location, 4 * float(TDS.readSetting("TestAgentSpeed"))) |
33 | 36 |
34 def kick(self, target): | 37 def kick(self, target): |
35 self.state = _STATE_KICK | 38 self.state = _STATE_KICK |
36 self.agent.act('kick', target) | 39 self.agent.act('kick', target) |
37 | 40 |