mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-04 22:43:17 +08:00
Merge pull request #672 from 3alTemp/kill-on-leave
Register players leaving after getting damaged as kills
This commit is contained in:
commit
7fac5a32a2
@ -40,6 +40,8 @@
|
|||||||
EraOSBeta!)
|
EraOSBeta!)
|
||||||
- Added a UI for customizing Series Length in Teams and Points-to-Win in FFA
|
- Added a UI for customizing Series Length in Teams and Points-to-Win in FFA
|
||||||
(Thanks EraOSBeta!)
|
(Thanks EraOSBeta!)
|
||||||
|
- Players leaving the game after getting hurt will now grant kills. (Thanks
|
||||||
|
Temp!)
|
||||||
- Sphinx based Python documentation generation is now wired up (Thanks
|
- Sphinx based Python documentation generation is now wired up (Thanks
|
||||||
Loup-Garou911XD!)
|
Loup-Garou911XD!)
|
||||||
- Renaming & overwriting existing profiles is no longer possible (Thanks Temp!)
|
- Renaming & overwriting existing profiles is no longer possible (Thanks Temp!)
|
||||||
|
|||||||
@ -223,10 +223,21 @@ class PlayerSpaz(Spaz):
|
|||||||
elif isinstance(msg, bs.DieMessage):
|
elif isinstance(msg, bs.DieMessage):
|
||||||
# Report player deaths to the game.
|
# Report player deaths to the game.
|
||||||
if not self._dead:
|
if not self._dead:
|
||||||
# Immediate-mode or left-game deaths don't count as 'kills'.
|
# Was this player killed while being held?
|
||||||
killed = (
|
was_held = self.held_count > 0 and self.last_player_held_by
|
||||||
not msg.immediate and msg.how is not bs.DeathType.LEFT_GAME
|
# Was this player attacked before death?
|
||||||
|
was_attacked_recently = (
|
||||||
|
self.last_player_attacked_by
|
||||||
|
and bs.time() - self.last_attacked_time < 4.0
|
||||||
)
|
)
|
||||||
|
# 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()
|
activity = self._activity()
|
||||||
|
|
||||||
@ -236,7 +247,7 @@ class PlayerSpaz(Spaz):
|
|||||||
else:
|
else:
|
||||||
# If this player was being held at the time of death,
|
# If this player was being held at the time of death,
|
||||||
# the holder is the killer.
|
# 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
|
killerplayer = self.last_player_held_by
|
||||||
else:
|
else:
|
||||||
# Otherwise, if they were attacked by someone in the
|
# Otherwise, if they were attacked by someone in the
|
||||||
@ -246,10 +257,7 @@ class PlayerSpaz(Spaz):
|
|||||||
# all bot kills would register as suicides; need to
|
# all bot kills would register as suicides; need to
|
||||||
# change this from last_player_attacked_by to
|
# change this from last_player_attacked_by to
|
||||||
# something like last_actor_attacked_by to fix that.
|
# something like last_actor_attacked_by to fix that.
|
||||||
if (
|
if was_attacked_recently:
|
||||||
self.last_player_attacked_by
|
|
||||||
and bs.time() - self.last_attacked_time < 4.0
|
|
||||||
):
|
|
||||||
killerplayer = self.last_player_attacked_by
|
killerplayer = self.last_player_attacked_by
|
||||||
else:
|
else:
|
||||||
# ok, call it a suicide unless we're in co-op
|
# ok, call it a suicide unless we're in co-op
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user