CI fix I think...

This commit is contained in:
3alTemp 2024-03-01 21:34:38 -06:00
parent d6cce8e3fb
commit 020aa8829a

View File

@ -19,12 +19,12 @@ class RespawnIcon:
_MASKTEXSTORENAME = bs.storagename('masktex')
_ICONSSTORENAME = bs.storagename('icons')
steps_epic_only: bool = False
def __init__(self, player: bs.Player, respawn_time: float):
"""Instantiate with a Player and respawn_time (in seconds)."""
# pylint: disable=too-many-locals
self._visible = True
self._dots_epic_only = False
on_right, offs_extra, respawn_icons = self._get_context(player)
@ -114,9 +114,9 @@ class RespawnIcon:
dpos = [ipos[0] + (7 if on_right else -7), ipos[1] - 16]
self._dec_text: bs.NodeActor | None = None
if (
self.steps_epic_only
self._dots_epic_only
and bs.getactivity().globalsnode.slow_motion
or not self.steps_epic_only
or not self._dots_epic_only
):
self._dec_text = bs.NodeActor(
bs.newnode(
@ -141,6 +141,7 @@ class RespawnIcon:
bs.animate(self._dec_text.node, 'scale', {0: 0, 0.1: 0.65})
self._respawn_time = bs.time() + respawn_time
self._dec_timer: bs.Timer | None = None
self._update()
self._timer: bs.Timer | None = bs.Timer(
1.0, bs.WeakCall(self._update), repeat=True
@ -180,21 +181,25 @@ class RespawnIcon:
offs_extra = -20
return on_right, offs_extra, icons
def _dec_step(self):
self._dec_text.node.text = self._dec_text.node.text[:-1]
# Kill our timer if the string is nothing.
if self._dec_text.node.text == '':
self._dec_timer = None
def _update(self) -> None:
remaining = int(round(self._respawn_time - bs.time()))
def dec_step():
self._dec_text.node.text = self._dec_text.node.text[:-1]
if remaining > 0:
assert self._text is not None
if self._text.node:
self._text.node.text = str(remaining)
if self._dec_text:
self._dec_text.node.text = '...'
bs.timer(0.25, dec_step)
bs.timer(0.5, dec_step)
bs.timer(0.75, dec_step)
# Start our decimals timer
self._dec_timer = bs.Timer(
0.25, bs.WeakCall(self._dec_step), repeat=True
)
else:
self._visible = False
self._image = (