new: face expression when a new unit is detected depends on the units bond level
This commit is contained in:
parent
f00c861844
commit
032e183ff7
@ -55,6 +55,9 @@ class Peer(object):
|
||||
def first_encounter(self):
|
||||
return self.encounters == 1
|
||||
|
||||
def is_good_friend(self, config):
|
||||
return self.encounters >= config['personality']['bond_encounters_factor']
|
||||
|
||||
def face(self):
|
||||
return self.adv.get('face', faces.FRIEND)
|
||||
|
||||
|
@ -202,9 +202,10 @@ class View(object):
|
||||
self.update()
|
||||
|
||||
def on_new_peer(self, peer):
|
||||
self.set('face', faces.FRIEND)
|
||||
self.set('face', faces.FRIEND if peer.is_good_friend(self._config) else faces.EXCITED)
|
||||
self.set('status', self._voice.on_new_peer(peer))
|
||||
self.update()
|
||||
time.sleep(3)
|
||||
|
||||
def on_lost_peer(self, peer):
|
||||
self.set('face', faces.LONELY)
|
||||
|
@ -75,6 +75,8 @@ class Voice:
|
||||
self._('Hello {name}! Nice to meet you.').format(name=peer.name())])
|
||||
else:
|
||||
return random.choice([
|
||||
self._('Yo {name}! Sup?').format(name=peer.name()),
|
||||
self._('Hey {name} how are you doing?').format(name=peer.name()),
|
||||
self._('Unit {name} is nearby!').format(name=peer.name())])
|
||||
|
||||
def on_lost_peer(self, peer):
|
||||
|
Loading…
x
Reference in New Issue
Block a user