From 8e929e89f09aeb65120d82b8ae996079a7c47869 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 13 Mar 2024 17:28:43 -0700 Subject: [PATCH] pubsync and ci fix --- .../python/bascenev1lib/game/runaround.py | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/game/runaround.py b/src/assets/ba_data/python/bascenev1lib/game/runaround.py index f94e2359..b09d5ed2 100644 --- a/src/assets/ba_data/python/bascenev1lib/game/runaround.py +++ b/src/assets/ba_data/python/bascenev1lib/game/runaround.py @@ -14,7 +14,7 @@ import random import logging from enum import Enum from dataclasses import dataclass -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, cast, Sequence from typing_extensions import override import bascenev1 as bs @@ -45,7 +45,7 @@ from bascenev1lib.actor.spazbot import ( ) if TYPE_CHECKING: - from typing import Any, Sequence + from typing import Any class Preset(Enum): @@ -557,9 +557,7 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]): if self._lives < 5: hbtime = 0.39 + (0.21 * self._lives) self._lives_hbtime = bs.Timer( - hbtime, - lambda: self.heart_dyin(True, hbtime), - repeat=True + hbtime, lambda: self.heart_dyin(True, hbtime), repeat=True ) self.heart_dyin(True) else: @@ -1408,10 +1406,8 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]): def _set_can_end_wave(self) -> None: self._can_end_wave = True - def heart_dyin(self, - status: bool, - time: float = 1.22) -> None: - """ Makes the UI heart beat at low health. """ + def heart_dyin(self, status: bool, time: float = 1.22) -> None: + """Makes the UI heart beat at low health.""" assert self._lives_bg is not None if self._lives_bg.node.exists(): return @@ -1419,19 +1415,33 @@ class RunaroundGame(bs.CoopGameActivity[Player, Team]): # Make the heart beat intensely! if status: - bs.animate_array(heart, 'scale', 2, { - 0:(90,90), - time*0.1:(105,105), - time*0.21:(88,88), - time*0.42:(90,90), - time*0.52:(105,105), - time*0.63:(88,88), - time:(90,90), - }) + bs.animate_array( + heart, + 'scale', + 2, + { + 0: (90, 90), + time * 0.1: (105, 105), + time * 0.21: (88, 88), + time * 0.42: (90, 90), + time * 0.52: (105, 105), + time * 0.63: (88, 88), + time: (90, 90), + }, + ) # Neutralize heartbeat (Done did when dead.) else: - bs.animate_array(heart, 'scale', 2, { - 0.0: list(heart.scale), - time: (90,90), - }) + # Ew; janky old scenev1 has a single 'Node' Python type so + # it thinks heart.scale could be a few different things + # (float, Sequence[float], etc.). So we have to force the + # issue with a cast(). This should go away with scenev2/etc. + bs.animate_array( + heart, + 'scale', + 2, + { + 0.0: cast(Sequence[float], heart.scale), + time: (90, 90), + }, + )