new: face expression while looking around will change dependig if the unit is with friends or alone
This commit is contained in:
parent
ce0c248cf4
commit
97cccf5a1d
pwnagotchi
@ -33,6 +33,7 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
|||||||
self._current_channel = 0
|
self._current_channel = 0
|
||||||
self._supported_channels = utils.iface_channels(config['main']['iface'])
|
self._supported_channels = utils.iface_channels(config['main']['iface'])
|
||||||
self._view = view
|
self._view = view
|
||||||
|
self._view.set_agent(self)
|
||||||
self._access_points = []
|
self._access_points = []
|
||||||
self._last_pwnd = None
|
self._last_pwnd = None
|
||||||
self._history = {}
|
self._history = {}
|
||||||
|
@ -32,6 +32,9 @@ class Automata(object):
|
|||||||
def set_ready(self):
|
def set_ready(self):
|
||||||
plugins.on('ready', self)
|
plugins.on('ready', self)
|
||||||
|
|
||||||
|
def in_good_mood(self):
|
||||||
|
return self._has_support_network_for(1.0)
|
||||||
|
|
||||||
def _has_support_network_for(self, factor):
|
def _has_support_network_for(self, factor):
|
||||||
bond_factor = self._config['personality']['bond_encounters_factor']
|
bond_factor = self._config['personality']['bond_encounters_factor']
|
||||||
total_encounters = sum(peer.encounters for _, peer in self._peers.items())
|
total_encounters = sum(peer.encounters for _, peer in self._peers.items())
|
||||||
|
@ -171,6 +171,8 @@ ui:
|
|||||||
faces:
|
faces:
|
||||||
look_r: '( ⚆_⚆)'
|
look_r: '( ⚆_⚆)'
|
||||||
look_l: '(☉_☉ )'
|
look_l: '(☉_☉ )'
|
||||||
|
look_r_happy: '( ◕‿◕)'
|
||||||
|
look_l_happy: '(◕‿◕ )'
|
||||||
sleep: '(⇀‿‿↼)'
|
sleep: '(⇀‿‿↼)'
|
||||||
sleep2: '(≖‿‿≖)'
|
sleep2: '(≖‿‿≖)'
|
||||||
awake: '(◕‿‿◕)'
|
awake: '(◕‿‿◕)'
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
LOOK_R = '( ⚆_⚆)'
|
LOOK_R = '( ⚆_⚆)'
|
||||||
LOOK_L = '(☉_☉ )'
|
LOOK_L = '(☉_☉ )'
|
||||||
|
LOOK_R_HAPPY = '( ◕‿◕)'
|
||||||
|
LOOK_L_HAPPY = '(◕‿◕ )'
|
||||||
SLEEP = '(⇀‿‿↼)'
|
SLEEP = '(⇀‿‿↼)'
|
||||||
SLEEP2 = '(≖‿‿≖)'
|
SLEEP2 = '(≖‿‿≖)'
|
||||||
AWAKE = '(◕‿‿◕)'
|
AWAKE = '(◕‿‿◕)'
|
||||||
|
@ -26,6 +26,7 @@ class View(object):
|
|||||||
# setup faces from the configuration in case the user customized them
|
# setup faces from the configuration in case the user customized them
|
||||||
faces.load_from_config(config['ui']['faces'])
|
faces.load_from_config(config['ui']['faces'])
|
||||||
|
|
||||||
|
self._agent = None
|
||||||
self._render_cbs = []
|
self._render_cbs = []
|
||||||
self._config = config
|
self._config = config
|
||||||
self._canvas = None
|
self._canvas = None
|
||||||
@ -89,6 +90,9 @@ class View(object):
|
|||||||
|
|
||||||
ROOT = self
|
ROOT = self
|
||||||
|
|
||||||
|
def set_agent(self, agent):
|
||||||
|
self._agent = agent
|
||||||
|
|
||||||
def has_element(self, key):
|
def has_element(self, key):
|
||||||
self._state.has_element(key)
|
self._state.has_element(key)
|
||||||
|
|
||||||
@ -248,10 +252,11 @@ class View(object):
|
|||||||
self.set('status', self._voice.on_awakening())
|
self.set('status', self._voice.on_awakening())
|
||||||
else:
|
else:
|
||||||
self.set('status', self._voice.on_waiting(int(secs)))
|
self.set('status', self._voice.on_waiting(int(secs)))
|
||||||
|
good_mood = self._agent.in_good_mood()
|
||||||
if step % 2 == 0:
|
if step % 2 == 0:
|
||||||
self.set('face', faces.LOOK_R)
|
self.set('face', faces.LOOK_R_HAPPY if good_mood else faces.LOOK_R)
|
||||||
else:
|
else:
|
||||||
self.set('face', faces.LOOK_L)
|
self.set('face', faces.LOOK_L_HAPPY if good_mood else faces.LOOK_L)
|
||||||
|
|
||||||
time.sleep(part)
|
time.sleep(part)
|
||||||
secs -= part
|
secs -= part
|
||||||
|
Loading…
x
Reference in New Issue
Block a user