Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions addons/source-python/packages/source-python/entities/specials.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,22 @@ def take_damage(
if attacker is None and weapon is not None:

# Try to get the attacker based off of the weapon's owner
with suppress(ValueError):
with suppress(ValueError, OverflowError):
attacker_index = index_from_inthandle(weapon.current_owner)
if attacker_index is not None:
attacker = Entity(attacker_index)
attacker = Entity(attacker_index)

# Is there an attacker but no weapon?
if attacker is not None and weapon is None:

# Does the attacker have a weapon attribute?
if hasattr(attacker, 'active_weapon'):
with suppress(ValueError, OverflowError):

# Get the attacker's current weapon index
weapon_index = index_from_inthandle(
attacker.active_weapon, False)
# Get the attacker's current weapon index
weapon_index = index_from_inthandle(
attacker.active_weapon)

# Get the weapon's Weapon instance if it is valid
if weapon_index is not None:
# Get the weapon's Weapon instance
weapon = Weapon(weapon_index)

# Is hitgroup a valid attribute?
Expand Down