diff --git a/aggregator.py b/aggregator.py index 6002fe0..e6e1e28 100644 --- a/aggregator.py +++ b/aggregator.py @@ -23,7 +23,7 @@ CELEBRATION_DURATION = 5 # Seconds to show celebration after recovery # Emote variations with paired animations OPTIMAL_EMOTES = [ ("( ^_^)", "breathing"), # calm, content - ("( ᵔᴥᵔ)", "floating"), # dreamy + ("( ˙▿˙)", "floating"), # content ("(◕‿◕)", "bouncing"), # cheerful ("( ・ω・)", "swaying"), # curious ("( ˘▽˘)", "breathing"), # cozy @@ -50,6 +50,9 @@ active_events = {} # id -> {priority, message, timestamp, ttl} # State tracking for personality previous_priority = 4 celebrating_until = 0 +blinking_until = 0 +blink_emote = None +blink_animation = None last_emote_change = 0 current_optimal_emote = OPTIMAL_EMOTES[0][0] current_optimal_animation = OPTIMAL_EMOTES[0][1] @@ -63,7 +66,8 @@ SLEEP_ANIMATION = "sleeping" def get_current_state(): """Determine current state based on active events.""" - global previous_priority, celebrating_until, last_emote_change, current_optimal_emote, current_optimal_animation + global previous_priority, celebrating_until, blinking_until, blink_emote, blink_animation + global last_emote_change, current_optimal_emote, current_optimal_animation # Sleep mode overrides everything if is_sleeping: @@ -107,15 +111,19 @@ def get_current_state(): if now < celebrating_until: # Celebration mode emote, animation = CELEBRATION_EMOTE + elif now < blinking_until: + # Brief blink/wink (1-2 seconds) + emote = blink_emote + animation = blink_animation else: - # Rotate optimal emotes every 5 minutes, occasional idle expression + # Rotate optimal emotes every 5 minutes if now - last_emote_change > 300: last_emote_change = now - # 15% chance of an idle expression (wink/blink) + current_optimal_emote, current_optimal_animation = random.choice(OPTIMAL_EMOTES) + # 15% chance of a brief blink/wink if random.random() < 0.15: - current_optimal_emote, current_optimal_animation = random.choice(IDLE_EMOTES) - else: - current_optimal_emote, current_optimal_animation = random.choice(OPTIMAL_EMOTES) + blink_emote, blink_animation = random.choice(IDLE_EMOTES) + blinking_until = now + random.uniform(1, 2) emote = current_optimal_emote animation = current_optimal_animation