mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-31 03:39:04 +08:00
setting shenanigans
This commit is contained in:
parent
d0c7b4497b
commit
1043a38d9d
@ -23,6 +23,7 @@ class RespawnIcon:
|
|||||||
def __init__(self, player: bs.Player, respawn_time: float):
|
def __init__(self, player: bs.Player, respawn_time: float):
|
||||||
"""Instantiate with a Player and respawn_time (in seconds)."""
|
"""Instantiate with a Player and respawn_time (in seconds)."""
|
||||||
self._visible = True
|
self._visible = True
|
||||||
|
self._dots_epic_only = False
|
||||||
|
|
||||||
on_right, offs_extra, respawn_icons = self._get_context(player)
|
on_right, offs_extra, respawn_icons = self._get_context(player)
|
||||||
|
|
||||||
@ -110,26 +111,33 @@ class RespawnIcon:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
dpos = [ipos[0] + (7 if on_right else -7), ipos[1] - 16]
|
dpos = [ipos[0] + (7 if on_right else -7), ipos[1] - 16]
|
||||||
self._dec_text: bs.NodeActor | None = bs.NodeActor(
|
self._dec_text: bs.NodeActor | None = None
|
||||||
bs.newnode(
|
if (
|
||||||
'text',
|
self._dots_epic_only
|
||||||
attrs={
|
and bs.getactivity().globalsnode.slow_motion
|
||||||
'position': dpos,
|
or not self._dots_epic_only
|
||||||
'h_attach': 'right' if on_right else 'left',
|
):
|
||||||
'h_align': 'right' if on_right else 'left',
|
self._dec_text = bs.NodeActor(
|
||||||
'scale': 0.65,
|
bs.newnode(
|
||||||
'shadow': 0.5,
|
'text',
|
||||||
'flatness': 0.5,
|
attrs={
|
||||||
'v_attach': 'top',
|
'position': dpos,
|
||||||
'color': bs.safecolor(icon['tint_color']),
|
'h_attach': 'right' if on_right else 'left',
|
||||||
'text': '...',
|
'h_align': 'right' if on_right else 'left',
|
||||||
},
|
'scale': 0.65,
|
||||||
|
'shadow': 0.5,
|
||||||
|
'flatness': 0.5,
|
||||||
|
'v_attach': 'top',
|
||||||
|
'color': bs.safecolor(icon['tint_color']),
|
||||||
|
'text': '',
|
||||||
|
},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
assert self._text.node
|
assert self._text.node
|
||||||
bs.animate(self._text.node, 'scale', {0: 0, 0.1: 0.9})
|
bs.animate(self._text.node, 'scale', {0: 0, 0.1: 0.9})
|
||||||
bs.animate(self._dec_text.node, 'scale', {0: 0, 0.1: 0.65})
|
if self._dec_text:
|
||||||
|
bs.animate(self._dec_text.node, 'scale', {0: 0, 0.1: 0.65})
|
||||||
|
|
||||||
self._respawn_time = bs.time() + respawn_time
|
self._respawn_time = bs.time() + respawn_time
|
||||||
self._update()
|
self._update()
|
||||||
@ -146,7 +154,7 @@ class RespawnIcon:
|
|||||||
"""Return info on where we should be shown and stored."""
|
"""Return info on where we should be shown and stored."""
|
||||||
activity = bs.getactivity()
|
activity = bs.getactivity()
|
||||||
|
|
||||||
if isinstance(bs.getsession(), bs.DualTeamSession):
|
if isinstance(activity.session, bs.DualTeamSession):
|
||||||
on_right = player.team.id % 2 == 1
|
on_right = player.team.id % 2 == 1
|
||||||
|
|
||||||
# Store a list of icons in the team.
|
# Store a list of icons in the team.
|
||||||
@ -181,10 +189,11 @@ class RespawnIcon:
|
|||||||
assert self._text is not None
|
assert self._text is not None
|
||||||
if self._text.node:
|
if self._text.node:
|
||||||
self._text.node.text = str(remaining)
|
self._text.node.text = str(remaining)
|
||||||
self._dec_text.node.text = '...'
|
if self._dec_text:
|
||||||
bs.timer(0.25, dec_step)
|
self._dec_text.node.text = '...'
|
||||||
bs.timer(0.5, dec_step)
|
bs.timer(0.25, dec_step)
|
||||||
bs.timer(0.75, dec_step)
|
bs.timer(0.5, dec_step)
|
||||||
|
bs.timer(0.75, dec_step)
|
||||||
else:
|
else:
|
||||||
self._visible = False
|
self._visible = False
|
||||||
self._image = (
|
self._image = (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user