From 1a42c50052a4f63e119d13e5bdd05d3b71498bf3 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Sun, 3 Mar 2024 21:46:46 -0600 Subject: [PATCH 1/5] El code --- .../python/bascenev1lib/actor/playerspaz.py | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 2ea3ead7..0eabd825 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -225,9 +225,22 @@ class PlayerSpaz(Spaz): elif isinstance(msg, bs.DieMessage): # Report player deaths to the game. if not self._dead: + # Was this player killed while being held? + was_held = ( + self.held_count > 0 + and self.last_player_held_by + ) + # Was this player attacked before death? + was_attacked_recently = ( + self.last_player_attacked_by + and bs.time() - self.last_attacked_time < 4.0 + ) # Immediate-mode or left-game deaths don't count as 'kills'. killed = ( - not msg.immediate and msg.how is not bs.DeathType.LEFT_GAME + not msg.immediate + and msg.how is not bs.DeathType.LEFT_GAME + or was_held + or was_attacked_recently ) activity = self._activity() @@ -238,7 +251,7 @@ class PlayerSpaz(Spaz): else: # If this player was being held at the time of death, # the holder is the killer. - if self.held_count > 0 and self.last_player_held_by: + if was_held: killerplayer = self.last_player_held_by else: # Otherwise, if they were attacked by someone in the @@ -248,10 +261,7 @@ class PlayerSpaz(Spaz): # all bot kills would register as suicides; need to # change this from last_player_attacked_by to # something like last_actor_attacked_by to fix that. - if ( - self.last_player_attacked_by - and bs.time() - self.last_attacked_time < 4.0 - ): + if was_attacked_recently: killerplayer = self.last_player_attacked_by else: # ok, call it a suicide unless we're in co-op From c125cbe123fd4c5364147cb1e7252a5a94cefdf0 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Sun, 3 Mar 2024 22:09:44 -0600 Subject: [PATCH 2/5] El code --- .../python/bascenev1lib/actor/playerspaz.py | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 2ea3ead7..578a9ef7 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -225,9 +225,22 @@ class PlayerSpaz(Spaz): elif isinstance(msg, bs.DieMessage): # Report player deaths to the game. if not self._dead: + # Was this player killed while being held? + was_held = ( + self.held_count > 0 + and self.last_player_held_by + ) + # Was this player attacked before death? + was_attacked_recently = ( + self.last_player_attacked_by + and bs.time() - self.last_attacked_time < 4.0 + ) # Immediate-mode or left-game deaths don't count as 'kills'. - killed = ( - not msg.immediate and msg.how is not bs.DeathType.LEFT_GAME + killed = bool( + not msg.immediate + and msg.how is not bs.DeathType.LEFT_GAME + or was_held + or was_attacked_recently ) activity = self._activity() @@ -238,7 +251,7 @@ class PlayerSpaz(Spaz): else: # If this player was being held at the time of death, # the holder is the killer. - if self.held_count > 0 and self.last_player_held_by: + if was_held: killerplayer = self.last_player_held_by else: # Otherwise, if they were attacked by someone in the @@ -248,10 +261,7 @@ class PlayerSpaz(Spaz): # all bot kills would register as suicides; need to # change this from last_player_attacked_by to # something like last_actor_attacked_by to fix that. - if ( - self.last_player_attacked_by - and bs.time() - self.last_attacked_time < 4.0 - ): + if was_attacked_recently: killerplayer = self.last_player_attacked_by else: # ok, call it a suicide unless we're in co-op From f30e8be399af4322466b8db7bc2cbd186e288706 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Sun, 3 Mar 2024 22:11:20 -0600 Subject: [PATCH 3/5] yeah --- src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 6b065d82..578a9ef7 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -236,11 +236,7 @@ class PlayerSpaz(Spaz): and bs.time() - self.last_attacked_time < 4.0 ) # Immediate-mode or left-game deaths don't count as 'kills'. -<<<<<<< HEAD killed = bool( -======= - killed = ( ->>>>>>> 1a42c50052a4f63e119d13e5bdd05d3b71498bf3 not msg.immediate and msg.how is not bs.DeathType.LEFT_GAME or was_held From 5ad94067eb998352dc1dd24cf4ce54ed64b04a6e Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Sun, 3 Mar 2024 22:26:16 -0600 Subject: [PATCH 4/5] changed logs, flown pres --- CHANGELOG.md | 2 ++ .../ba_data/python/bascenev1lib/actor/playerspaz.py | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e9f4499..a47749b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ EraOSBeta!) - Added a UI for customizing Series Length in Teams and Points-to-Win in FFA (Thanks EraOSBeta!) +- Players leaving the game after getting hurt will now grant kills. (Thanks + Temp!) ### 1.7.32 (build 21741, api 8, 2023-12-20) - Fixed a screen message that no one will ever see (Thanks vishal332008?...) diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 578a9ef7..120773b2 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -79,14 +79,12 @@ class PlayerSpaz(Spaz): @overload def getplayer( self, playertype: type[PlayerT], doraise: Literal[False] = False - ) -> PlayerT | None: - ... + ) -> PlayerT | None: ... @overload def getplayer( self, playertype: type[PlayerT], doraise: Literal[True] - ) -> PlayerT: - ... + ) -> PlayerT: ... def getplayer( self, playertype: type[PlayerT], doraise: bool = False @@ -226,10 +224,7 @@ class PlayerSpaz(Spaz): # Report player deaths to the game. if not self._dead: # Was this player killed while being held? - was_held = ( - self.held_count > 0 - and self.last_player_held_by - ) + was_held = self.held_count > 0 and self.last_player_held_by # Was this player attacked before death? was_attacked_recently = ( self.last_player_attacked_by From 3786e2bfb3385fc5bf6091f3c222fececb52e122 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Wed, 13 Mar 2024 19:39:26 -0600 Subject: [PATCH 5/5] Tweakeroo'd --- .../ba_data/python/bascenev1lib/actor/playerspaz.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 120773b2..fabfd2ef 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -230,14 +230,15 @@ class PlayerSpaz(Spaz): self.last_player_attacked_by and bs.time() - self.last_attacked_time < 4.0 ) - # Immediate-mode or left-game deaths don't count as 'kills'. - killed = bool( - not msg.immediate - and msg.how is not bs.DeathType.LEFT_GAME - or was_held - or was_attacked_recently + # Leaving the game doesn't count as a kill *unless* + # someone does it intentionally while being attacked. + left_game_cleanly = ( + msg.how is bs.DeathType.LEFT_GAME + and not (was_held or was_attacked_recently) ) + killed = not (msg.immediate or left_game_cleanly) + activity = self._activity() player = self.getplayer(bs.Player, False)