Skip to content

Commit

Permalink
fix spurious CTF flag_return_touches log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
efroemling committed Mar 15, 2024
1 parent d9a20f6 commit f6f9526
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 38 deletions.
42 changes: 21 additions & 21 deletions .efrocachemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 1.7.33 (build 21793, api 8, 2024-03-15)
### 1.7.33 (build 21794, api 8, 2024-03-15)
- Stress test input-devices are now a bit smarter; they won't press any buttons
while UIs are up (this could cause lots of chaos if it happened).
- Added a 'Show Demos When Idle' option in advanced settings. If enabled, the
Expand Down
2 changes: 1 addition & 1 deletion src/assets/ba_data/python/baenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21793
TARGET_BALLISTICA_BUILD = 21794
TARGET_BALLISTICA_VERSION = '1.7.33'


Expand Down
35 changes: 21 additions & 14 deletions src/assets/ba_data/python/bascenev1lib/game/capturetheflag.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def _handle_touching_own_flag(self, team: Team, connecting: bool) -> None:
team.touch_return_timer = None
team.touch_return_timer_ticking = None
if team.flag_return_touches < 0:
logging.exception('CTF flag_return_touches < 0')
logging.error('CTF flag_return_touches < 0', stack_info=True)

def _handle_death_flag_capture(self, player: Player) -> None:
"""Handles flag values when a player dies or leaves the game."""
Expand All @@ -536,22 +536,29 @@ def _handle_death_flag_capture(self, player: Player) -> None:
return

team = player.team
# For each "point" our player has touched theflag (Could be multiple),
# deduct one from both our player and
# the flag's return touches variable.

# For each "point" our player has touched theflag (Could be
# multiple), deduct one from both our player and the flag's
# return touches variable.
for _ in range(player.touching_own_flag):
# Deduct
player.touching_own_flag -= 1
team.flag_return_touches -= 1
# Update our flag's timer accordingly
# (Prevents immediate resets in case
# there might be more people touching it).
if team.flag_return_touches == 0:
team.touch_return_timer = None
team.touch_return_timer_ticking = None
# Safety check, just to be sure!
if team.flag_return_touches < 0:
logging.exception('CTF flag_return_touches < 0')

# (This was only incremented if we have non-zero
# return-times).
if float(self.flag_touch_return_time) > 0.0:
team.flag_return_touches -= 1
# Update our flag's timer accordingly
# (Prevents immediate resets in case
# there might be more people touching it).
if team.flag_return_touches == 0:
team.touch_return_timer = None
team.touch_return_timer_ticking = None
# Safety check, just to be sure!
if team.flag_return_touches < 0:
logging.error(
'CTF flag_return_touches < 0', stack_info=True
)

def _flash_base(self, team: Team, length: float = 2.0) -> None:
light = bs.newnode(
Expand Down
2 changes: 1 addition & 1 deletion src/ballistica/shared/ballistica.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {

// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21793;
const int kEngineBuildNumber = 21794;
const char* kEngineVersion = "1.7.33";
const int kEngineApiVersion = 8;

Expand Down

0 comments on commit f6f9526

Please sign in to comment.