From 44db9b2387e5bf9f1b3f16544dccb9ec98d3ceb9 Mon Sep 17 00:00:00 2001
From: Eric Froemling
Date: Mon, 6 Apr 2020 12:55:01 -0700
Subject: [PATCH 01/16] changed ci to run on pull-requests
---
.github/workflows/ci.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4b33ee25..33ba820f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,6 +3,7 @@ name: CI
on:
# Run on pushes and also once per day (in case deps change under us)
push:
+ pull_request:
schedule:
# Note: '*' is a special character in YAML so we have to quote the str.
- cron: '0 12 * * *'
From 9a6c0948247470bd273b6c97259c1cb6e55a8ecd Mon Sep 17 00:00:00 2001
From: Eric Froemling
Date: Mon, 6 Apr 2020 14:05:58 -0700
Subject: [PATCH 02/16] Fixed spurious time value warnings and general tidying
---
.github/workflows/ci.yml | 3 +-
.../ba_data/python/bastd/ui/coop/browser.py | 87 +++++++++----------
2 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 33ba820f..5a0a64d4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,7 +1,8 @@
name: CI
on:
- # Run on pushes and also once per day (in case deps change under us)
+ # Run on pushes, pull-requests, and also once per day
+ # (in case deps change under us, etc.)
push:
pull_request:
schedule:
diff --git a/assets/src/ba_data/python/bastd/ui/coop/browser.py b/assets/src/ba_data/python/bastd/ui/coop/browser.py
index 491bc6c4..47cdf9e1 100644
--- a/assets/src/ba_data/python/bastd/ui/coop/browser.py
+++ b/assets/src/ba_data/python/bastd/ui/coop/browser.py
@@ -61,7 +61,7 @@ class CoopBrowserWindow(ba.Window):
app = ba.app
cfg = app.config
- # if they provided an origin-widget, scale up from that
+ # If they provided an origin-widget, scale up from that.
scale_origin: Optional[Tuple[float, float]]
if origin_widget is not None:
self._transition_out = 'out_scale'
@@ -71,8 +71,8 @@ class CoopBrowserWindow(ba.Window):
self._transition_out = 'out_right'
scale_origin = None
- # try to recreate the same number of buttons we had last time so our
- # re-selection code works
+ # Try to recreate the same number of buttons we had last time so our
+ # re-selection code works.
try:
self._tournament_button_count = app.config['Tournament Rows']
except Exception:
@@ -159,7 +159,7 @@ class CoopBrowserWindow(ba.Window):
self._store_button_widget = None
self._league_rank_button_widget = None
- # move our corner buttons dynamically to keep them out of the way of
+ # Move our corner buttons dynamically to keep them out of the way of
# the party icon :-(
self._update_corner_button_positions()
self._update_corner_button_positions_timer = ba.Timer(
@@ -179,7 +179,7 @@ class CoopBrowserWindow(ba.Window):
self._selected_challenge_level = (cfg.get(
'Selected Coop Challenge Level', None))
- # Don't want initial construction affecting our last-selected
+ # Don't want initial construction affecting our last-selected.
self._do_selection_callbacks = False
v = self._height - 95
txt = ba.textwidget(
@@ -229,22 +229,23 @@ class CoopBrowserWindow(ba.Window):
simple_culling_v=10.0)
self._subcontainer: Optional[ba.Widget] = None
- # take note of our account state; we'll refresh later if this changes
+ # Take note of our account state; we'll refresh later if this changes.
self._account_state_num = _ba.get_account_state_num()
- # same for fg/bg state..
+
+ # Same for fg/bg state.
self._fg_state = app.fg_state
self._refresh()
self._restore_state()
- # even though we might display cached tournament data immediately, we
- # don't consider it valid until we've pinged
+ # Even though we might display cached tournament data immediately, we
+ # don't consider it valid until we've pinged.
# the server for an update
self._tourney_data_up_to_date = False
- # if we've got a cached tournament list for our account and info for
- # each one of those tournaments,
- # go ahead and display it as a starting point...
+ # If we've got a cached tournament list for our account and info for
+ # each one of those tournaments, go ahead and display it as a
+ # starting point.
if (app.account_tournament_list is not None and
app.account_tournament_list[0] == _ba.get_account_state_num()
and all([
@@ -257,7 +258,7 @@ class CoopBrowserWindow(ba.Window):
]
self._update_for_data(tourney_data)
- # this will pull new data periodically, update timers, etc..
+ # This will pull new data periodically, update timers, etc.
self._update_timer = ba.Timer(1.0,
ba.WeakCall(self._update),
timetype=ba.TimeType.REAL,
@@ -267,31 +268,32 @@ class CoopBrowserWindow(ba.Window):
def _update(self) -> None:
cur_time = ba.time(ba.TimeType.REAL)
- # if its been a while since we got a tournament update, consider the
+ # If its been a while since we got a tournament update, consider the
# data invalid (prevents us from joining tournaments if our internet
- # connection goes down for a while)
+ # connection goes down for a while).
if (self._last_tournament_query_response_time is None
or ba.time(ba.TimeType.REAL) -
self._last_tournament_query_response_time > 60.0 * 2):
self._tourney_data_up_to_date = False
- # if our account state has changed, do a full request
+ # If our account state has changed, do a full request.
account_state_num = _ba.get_account_state_num()
if account_state_num != self._account_state_num:
self._account_state_num = account_state_num
self._save_state()
self._refresh()
- # also encourage a new tournament query since this will clear out
- # our current results..
+
+ # Also encourage a new tournament query since this will clear out
+ # our current results.
if not self._doing_tournament_query:
self._last_tournament_query_time = None
- # if we've been backgrounded/foregrounded, invalidate our
- # tournament entries (they will be refreshed below asap)
+ # If we've been backgrounded/foregrounded, invalidate our
+ # tournament entries (they will be refreshed below asap).
if self._fg_state != ba.app.fg_state:
self._tourney_data_up_to_date = False
- # send off a new tournament query if its been long enough or whatnot..
+ # Send off a new tournament query if its been long enough or whatnot.
if not self._doing_tournament_query and (
self._last_tournament_query_time is None
or cur_time - self._last_tournament_query_time > 30.0
@@ -306,17 +308,20 @@ class CoopBrowserWindow(ba.Window):
callback=ba.WeakCall(
self._on_tournament_query_response))
- # decrement time on our tournament buttons..
+ # Decrement time on our tournament buttons.
ads_enabled = _ba.have_incentivized_ad()
for tbtn in self._tournament_buttons:
tbtn['time_remaining'] = max(0, tbtn['time_remaining'] - 1)
if tbtn['time_remaining_value_text'] is not None:
ba.textwidget(
edit=tbtn['time_remaining_value_text'],
- text=ba.timestring(tbtn['time_remaining'], centi=False) if
+ text=ba.timestring(tbtn['time_remaining'],
+ centi=False,
+ suppress_format_warning=True) if
(tbtn['has_time_remaining']
and self._tourney_data_up_to_date) else '-')
- # also adjust the ad icon visibility
+
+ # Also adjust the ad icon visibility.
if tbtn.get('allow_ads', False) and _ba.has_video_ads():
ba.imagewidget(edit=tbtn['entry_fee_ad_image'],
opacity=1.0 if ads_enabled else 0.25)
@@ -427,7 +432,8 @@ class CoopBrowserWindow(ba.Window):
leader_score = (
ba.timestring(score[0] * 10,
centi=True,
- timeformat=ba.TimeFormat.MILLISECONDS)
+ timeformat=ba.TimeFormat.MILLISECONDS,
+ suppress_format_warning=True)
if entry['scoreType'] == 'time' else str(score[0]))
else:
tbtn['leader'] = None
@@ -445,7 +451,9 @@ class CoopBrowserWindow(ba.Window):
'-' if entry is None or 'totalTime' not in entry else ba.Lstr(
resource=self._r + '.ofTotalTimeText',
subs=[('${TOTAL}',
- ba.timestring(entry['totalTime'], centi=False))]))
+ ba.timestring(entry['totalTime'],
+ centi=False,
+ suppress_format_warning=True))]))
ba.textwidget(edit=tbtn['time_remaining_out_of_text'],
text=out_of_time_text)
@@ -516,18 +524,14 @@ class CoopBrowserWindow(ba.Window):
final_fee_str = (
ba.charstr(ba.SpecialChar.TICKET_BACKING) +
str(final_fee))
- # final_fee_str: Union[str, ba.Lstr] = (
- # '' if fee_var is None else ba.Lstr(
- # resource='getTicketsWindow.freeText') if final_fee == 0
- # else (ba.specialchar('ticket_backing') + str(final_fee)))
ad_tries_remaining = ba.app.tournament_info[
tbtn['tournament_id']]['adTriesRemaining']
free_tries_remaining = ba.app.tournament_info[
tbtn['tournament_id']]['freeTriesRemaining']
- # now, if this fee allows ads and we support video ads, show
- # the 'or ad' version
+ # Now, if this fee allows ads and we support video ads, show
+ # the 'or ad' version.
if allow_ads and _ba.has_video_ads():
ads_enabled = _ba.have_incentivized_ad()
ba.imagewidget(edit=tbtn['entry_fee_ad_image'],
@@ -542,7 +546,8 @@ class CoopBrowserWindow(ba.Window):
tbtn['button_y'] + tbtn['button_scale_y'] - 60),
scale=1.3,
text=final_fee_str)
- # possibly show number of ad-plays remaining
+
+ # Possibly show number of ad-plays remaining.
ba.textwidget(
edit=tbtn['entry_fee_text_remaining'],
position=(tbtn['button_x'] + 360,
@@ -559,7 +564,8 @@ class CoopBrowserWindow(ba.Window):
tbtn['button_y'] + tbtn['button_scale_y'] - 80),
scale=1.3,
text=final_fee_str)
- # possibly show number of free-plays remaining
+
+ # Possibly show number of free-plays remaining.
ba.textwidget(
edit=tbtn['entry_fee_text_remaining'],
position=(tbtn['button_x'] + 360,
@@ -927,15 +933,8 @@ class CoopBrowserWindow(ba.Window):
'Challenges:Meteor Shower',
'Challenges:Target Practice B',
'Challenges:Target Practice',
- # 'Challenges:Lake Frigid Race',
- # 'Challenges:Uber Runaround',
- # 'Challenges:Runaround',
- # 'Challenges:Pro Race',
- # 'Challenges:Pro Football',
- # 'Challenges:Epic Meteor Shower',
- # 'Challenges:Testing',
- # 'User:Ninja Fight',
]
+
# Show easter-egg-hunt either if its easter or we own it.
if _ba.get_account_misc_read_val(
'easter', False) or _ba.get_purchased('games.easter_egg_hunt'):
@@ -1456,7 +1455,7 @@ class CoopBrowserWindow(ba.Window):
ba.playsound(ba.getsound('error'))
return
- # game is whatever the tournament tells us it is
+ # Game is whatever the tournament tells us it is.
game = ba.app.tournament_info[
tournament_button['tournament_id']]['game']
@@ -1469,7 +1468,7 @@ class CoopBrowserWindow(ba.Window):
height=130)
return
- # infinite onslaught/runaround require pro; bring up a store link if
+ # Infinite onslaught/runaround require pro; bring up a store link if
# need be.
if tournament_button is None and game in (
'Challenges:Infinite Runaround',
From 8b0b332f1ab7fd129f8c154855eb14c9cf08e9dd Mon Sep 17 00:00:00 2001
From: Eric Froemling
Date: Mon, 6 Apr 2020 15:18:19 -0700
Subject: [PATCH 03/16] Added a proper DeathType enum to replace string values
---
assets/src/ba_data/python/ba/__init__.py | 10 ++--
assets/src/ba_data/python/ba/_gameactivity.py | 5 +-
assets/src/ba_data/python/ba/_messages.py | 18 +++++--
assets/src/ba_data/python/bastd/actor/flag.py | 2 +-
.../ba_data/python/bastd/actor/playerspaz.py | 5 +-
assets/src/ba_data/python/bastd/actor/spaz.py | 48 +++++++++++--------
.../src/ba_data/python/bastd/actor/spazbot.py | 2 +-
.../ba_data/python/bastd/game/runaround.py | 5 +-
.../ba_data/python/bastd/ui/coop/browser.py | 13 ++---
9 files changed, 65 insertions(+), 43 deletions(-)
diff --git a/assets/src/ba_data/python/ba/__init__.py b/assets/src/ba_data/python/ba/__init__.py
index 47742952..4478b4d2 100644
--- a/assets/src/ba_data/python/ba/__init__.py
+++ b/assets/src/ba_data/python/ba/__init__.py
@@ -74,11 +74,11 @@ from ba._general import WeakCall, Call
from ba._level import Level
from ba._lobby import Lobby, Chooser
from ba._math import normalized_color, is_point_in_box, vec3validate
-from ba._messages import (OutOfBoundsMessage, DieMessage, StandMessage,
- PickUpMessage, DropMessage, PickedUpMessage,
- DroppedMessage, ShouldShatterMessage,
- ImpactDamageMessage, FreezeMessage, ThawMessage,
- HitMessage)
+from ba._messages import (OutOfBoundsMessage, DeathType, DieMessage,
+ StandMessage, PickUpMessage, DropMessage,
+ PickedUpMessage, DroppedMessage,
+ ShouldShatterMessage, ImpactDamageMessage,
+ FreezeMessage, ThawMessage, HitMessage)
from ba._music import setmusic, MusicPlayer, MusicType, MusicPlayMode
from ba._powerup import PowerupMessage, PowerupAcceptMessage
from ba._teambasesession import TeamBaseSession
diff --git a/assets/src/ba_data/python/ba/_gameactivity.py b/assets/src/ba_data/python/ba/_gameactivity.py
index 8f817f63..60857ede 100644
--- a/assets/src/ba_data/python/ba/_gameactivity.py
+++ b/assets/src/ba_data/python/ba/_gameactivity.py
@@ -658,7 +658,7 @@ class GameActivity(Activity):
def on_player_leave(self, player: ba.Player) -> None:
from ba._general import Call
- from ba._messages import DieMessage
+ from ba._messages import DieMessage, DeathType
super().on_player_leave(player)
@@ -668,7 +668,8 @@ class GameActivity(Activity):
# will incorrectly try to respawn them, etc.
actor = player.actor
if actor is not None:
- _ba.pushcall(Call(actor.handlemessage, DieMessage(how='leftGame')))
+ _ba.pushcall(
+ Call(actor.handlemessage, DieMessage(how=DeathType.LEFT_GAME)))
player.set_actor(None)
def handlemessage(self, msg: Any) -> Any:
diff --git a/assets/src/ba_data/python/ba/_messages.py b/assets/src/ba_data/python/ba/_messages.py
index ad06a1c9..a82bd481 100644
--- a/assets/src/ba_data/python/ba/_messages.py
+++ b/assets/src/ba_data/python/ba/_messages.py
@@ -24,6 +24,7 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
+from enum import Enum
import _ba
@@ -40,6 +41,18 @@ class OutOfBoundsMessage:
"""
+class DeathType(Enum):
+ """A reason for a death.
+
+ Category: Enums
+ """
+ GENERIC = 'generic'
+ IMPACT = 'impact'
+ FALL = 'fall'
+ REACHED_GOAL = 'reached_goal'
+ LEFT_GAME = 'left_game'
+
+
@dataclass
class DieMessage:
"""A message telling an object to die.
@@ -57,12 +70,11 @@ class DieMessage:
its time with lingering corpses, sound effects, etc.
how
- The particular reason for death; 'fall', 'impact', 'leftGame', etc.
- This can be examined for scoring or other purposes.
+ The particular reason for death.
"""
immediate: bool = False
- how: str = 'generic'
+ how: DeathType = DeathType.GENERIC
@dataclass
diff --git a/assets/src/ba_data/python/bastd/actor/flag.py b/assets/src/ba_data/python/bastd/actor/flag.py
index b62055fd..6ef08a63 100644
--- a/assets/src/ba_data/python/bastd/actor/flag.py
+++ b/assets/src/ba_data/python/bastd/actor/flag.py
@@ -350,7 +350,7 @@ class Flag(ba.Actor):
elif isinstance(msg, ba.OutOfBoundsMessage):
# We just kill ourselves when out-of-bounds.. would we ever not
# want this?..
- self.handlemessage(ba.DieMessage(how='fall'))
+ self.handlemessage(ba.DieMessage(how=ba.DeathType.FALL))
elif isinstance(msg, ba.PickedUpMessage):
self._held_count += 1
if self._held_count == 1 and self._counter is not None:
diff --git a/assets/src/ba_data/python/bastd/actor/playerspaz.py b/assets/src/ba_data/python/bastd/actor/playerspaz.py
index 1af781fc..a600f3a9 100644
--- a/assets/src/ba_data/python/bastd/actor/playerspaz.py
+++ b/assets/src/ba_data/python/bastd/actor/playerspaz.py
@@ -53,7 +53,7 @@ class PlayerSpazDeathMessage:
"""
def __init__(self, spaz: PlayerSpaz, was_killed: bool,
- killerplayer: Optional[ba.Player], how: str):
+ killerplayer: Optional[ba.Player], how: ba.DeathType):
"""Instantiate a message with the given values."""
self.spaz = spaz
self.killed = was_killed
@@ -252,7 +252,8 @@ class PlayerSpaz(basespaz.Spaz):
if not self._dead:
# Immediate-mode or left-game deaths don't count as 'kills'.
- killed = (not msg.immediate and msg.how != 'leftGame')
+ killed = (not msg.immediate
+ and msg.how is not ba.DeathType.LEFT_GAME)
activity = self._activity()
diff --git a/assets/src/ba_data/python/bastd/actor/spaz.py b/assets/src/ba_data/python/bastd/actor/spaz.py
index 565bfa1b..28d06e1e 100644
--- a/assets/src/ba_data/python/bastd/actor/spaz.py
+++ b/assets/src/ba_data/python/bastd/actor/spaz.py
@@ -588,11 +588,12 @@ class Spaz(ba.Actor):
def on_punched(self, damage: int) -> None:
"""Called when this spaz gets punched."""
- def get_death_points(self, how: str) -> Tuple[int, int]:
+ def get_death_points(self, how: ba.DeathType) -> Tuple[int, int]:
"""Get the points awarded for killing this spaz."""
- del how # unused arg
+ del how # Unused.
num_hits = float(max(1, self._num_times_hit))
- # base points is simply 10 for 1-hit-kills and 5 otherwise
+
+ # Base points is simply 10 for 1-hit-kills and 5 otherwise.
importance = 2 if num_hits < 2 else 1
return (10 if num_hits < 2 else 5) * self.points_mult, importance
@@ -604,7 +605,8 @@ class Spaz(ba.Actor):
if not self._cursed:
factory = get_factory()
self._cursed = True
- # add the curse material..
+
+ # Add the curse material.
for attr in ['materials', 'roller_materials']:
materials = getattr(self.node, attr)
if factory.curse_material not in materials:
@@ -616,7 +618,7 @@ class Spaz(ba.Actor):
if self.curse_time is None:
self.node.curse_death_time = -1
else:
- # note: curse-death-time takes milliseconds
+ # Note: curse-death-time takes milliseconds.
tval = ba.time()
assert isinstance(tval, int)
self.node.curse_death_time = int(1000.0 *
@@ -629,7 +631,7 @@ class Spaz(ba.Actor):
"""
assert self.node
self.node.boxing_gloves = True
- if self._demo_mode: # preserve old behavior
+ if self._demo_mode: # Preserve old behavior.
self._punch_power_scale = 1.7
self._punch_cooldown = 300
else:
@@ -664,7 +666,7 @@ class Spaz(ba.Actor):
self.shield_decay_timer = ba.Timer(0.5,
ba.WeakCall(self.shield_decay),
repeat=True)
- # so user can see the decay
+ # So user can see the decay.
self.shield.always_show_health_bar = True
def shield_decay(self) -> None:
@@ -698,17 +700,18 @@ class Spaz(ba.Actor):
if self.node:
self.node.handlemessage("hurt_sound")
self.node.handlemessage("picked_up")
- # this counts as a hit
+
+ # This counts as a hit.
self._num_times_hit += 1
elif isinstance(msg, ba.ShouldShatterMessage):
- # eww; seems we have to do this in a timer or it wont work right
+ # Eww; seems we have to do this in a timer or it wont work right.
# (since we're getting called from within update() perhaps?..)
- # NOTE: should test to see if that's still the case
+ # NOTE: should test to see if that's still the case.
ba.timer(0.001, ba.WeakCall(self.shatter))
elif isinstance(msg, ba.ImpactDamageMessage):
- # eww; seems we have to do this in a timer or it wont work right
+ # Eww; seems we have to do this in a timer or it wont work right.
# (since we're getting called from within update() perhaps?..)
ba.timer(0.001, ba.WeakCall(self._hit_self, msg.intensity))
@@ -799,7 +802,8 @@ class Spaz(ba.Actor):
timeformat=ba.TimeFormat.MILLISECONDS))
elif msg.poweruptype == 'shield':
factory = get_factory()
- # let's allow powerup-equipped shields to lose hp over time
+
+ # Let's allow powerup-equipped shields to lose hp over time.
self.equip_shields(decay=factory.shield_decay_rate > 0)
elif msg.poweruptype == 'curse':
self.curse()
@@ -825,7 +829,8 @@ class Spaz(ba.Actor):
elif msg.poweruptype == 'health':
if self._cursed:
self._cursed = False
- # remove cursed material
+
+ # Remove cursed material.
factory = get_factory()
for attr in ['materials', 'roller_materials']:
materials = getattr(self.node, attr)
@@ -861,7 +866,7 @@ class Spaz(ba.Actor):
self.node.frozen = True
ba.timer(5.0, ba.WeakCall(self.handlemessage,
ba.ThawMessage()))
- # instantly shatter if we're already dead
+ # Instantly shatter if we're already dead.
# (otherwise its hard to tell we're dead)
if self.hitpoints <= 0:
self.shatter()
@@ -880,7 +885,7 @@ class Spaz(ba.Actor):
position=self.node.position)
return True
- # if we were recently hit, don't count this as another
+ # If we were recently hit, don't count this as another.
# (so punch flurries and bomb pileups essentially count as 1 hit)
local_time = ba.time(timeformat=ba.TimeFormat.MILLISECONDS)
assert isinstance(local_time, int)
@@ -893,13 +898,13 @@ class Spaz(ba.Actor):
velocity_mag = msg.velocity_magnitude * self.impact_scale
damage_scale = 0.22
- # if they've got a shield, deliver it to that instead..
+ # If they've got a shield, deliver it to that instead.
if self.shield:
if msg.flat_damage:
damage = msg.flat_damage * self.impact_scale
else:
- # hit our spaz with an impulse but tell it to only return
- # theoretical damage; not apply the impulse..
+ # Hit our spaz with an impulse but tell it to only return
+ # theoretical damage; not apply the impulse.
assert msg.force_direction is not None
self.node.handlemessage(
"impulse", msg.pos[0], msg.pos[1], msg.pos[2],
@@ -1086,7 +1091,8 @@ class Spaz(ba.Actor):
if self.frozen and (damage > 200 or self.hitpoints <= 0):
self.shatter()
elif self.hitpoints <= 0:
- self.node.handlemessage(ba.DieMessage(how='impact'))
+ self.node.handlemessage(
+ ba.DieMessage(how=ba.DeathType.IMPACT))
# if we're dead, take a look at the smoothed damage val
# (which gives us a smoothed average of recent damage) and shatter
@@ -1114,8 +1120,8 @@ class Spaz(ba.Actor):
ba.timer(2.0, self.node.delete)
elif isinstance(msg, ba.OutOfBoundsMessage):
- # by default we just die here
- self.handlemessage(ba.DieMessage(how='fall'))
+ # By default we just die here.
+ self.handlemessage(ba.DieMessage(how=ba.DeathType.FALL))
elif isinstance(msg, ba.StandMessage):
self._last_stand_pos = (msg.position[0], msg.position[1],
msg.position[2])
diff --git a/assets/src/ba_data/python/bastd/actor/spazbot.py b/assets/src/ba_data/python/bastd/actor/spazbot.py
index cc5ea5fb..c2a4d734 100644
--- a/assets/src/ba_data/python/bastd/actor/spazbot.py
+++ b/assets/src/ba_data/python/bastd/actor/spazbot.py
@@ -80,7 +80,7 @@ class SpazBotDeathMessage:
"""
def __init__(self, badguy: SpazBot, killerplayer: Optional[ba.Player],
- how: str):
+ how: ba.DeathType):
"""Instantiate with given values."""
self.badguy = badguy
self.killerplayer = killerplayer
diff --git a/assets/src/ba_data/python/bastd/game/runaround.py b/assets/src/ba_data/python/bastd/game/runaround.py
index d0dbf2f3..923db3ac 100644
--- a/assets/src/ba_data/python/bastd/game/runaround.py
+++ b/assets/src/ba_data/python/bastd/game/runaround.py
@@ -415,7 +415,8 @@ class RunaroundGame(ba.CoopGameActivity):
})
ba.animate(light, 'intensity', {0.0: 0, 0.1: 1, 0.5: 0}, loop=False)
ba.timer(1.0, light.delete)
- spaz.handlemessage(ba.DieMessage(immediate=True, how='goal'))
+ spaz.handlemessage(
+ ba.DieMessage(immediate=True, how=ba.DeathType.REACHED_GOAL))
if self._lives > 0:
self._lives -= 1
@@ -1141,7 +1142,7 @@ class RunaroundGame(ba.CoopGameActivity):
player, respawn_time)
elif isinstance(msg, spazbot.SpazBotDeathMessage):
- if msg.how == 'goal':
+ if msg.how is ba.DeathType.REACHED_GOAL:
return
pts, importance = msg.badguy.get_death_points(msg.how)
if msg.killerplayer is not None:
diff --git a/assets/src/ba_data/python/bastd/ui/coop/browser.py b/assets/src/ba_data/python/bastd/ui/coop/browser.py
index 47cdf9e1..902fcd02 100644
--- a/assets/src/ba_data/python/bastd/ui/coop/browser.py
+++ b/assets/src/ba_data/python/bastd/ui/coop/browser.py
@@ -301,12 +301,13 @@ class CoopBrowserWindow(ba.Window):
self._fg_state = ba.app.fg_state
self._last_tournament_query_time = cur_time
self._doing_tournament_query = True
- _ba.tournament_query(args={
- 'source': 'coop window refresh',
- 'numScores': 1
- },
- callback=ba.WeakCall(
- self._on_tournament_query_response))
+ _ba.tournament_query(
+ args={
+ 'source': 'coop window refresh',
+ 'numScores': 1
+ },
+ callback=ba.WeakCall(self._on_tournament_query_response),
+ )
# Decrement time on our tournament buttons.
ads_enabled = _ba.have_incentivized_ad()
From 5638debcc9beea01a580599fb291a036ddbc1847 Mon Sep 17 00:00:00 2001
From: Eric Froemling
Date: Mon, 6 Apr 2020 15:25:18 -0700
Subject: [PATCH 04/16] latest binaries, assets, and docs
---
docs/ba_module.md | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/docs/ba_module.md b/docs/ba_module.md
index 9d798d85..76b8d165 100644
--- a/docs/ba_module.md
+++ b/docs/ba_module.md
@@ -1,5 +1,5 @@
-
last updated on 2020-04-05 for Ballistica version 1.5.0 build 20001
+
last updated on 2020-04-06 for Ballistica version 1.5.0 build 20001
This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!