Skip to content

Commit

Permalink
udm.on_pre_bump_weapon(): Fix conditioning for silencer option
Browse files Browse the repository at this point in the history
Signed-off-by: BackRaw <backraw@gmx.de>
  • Loading branch information
BackRaw committed Jul 18, 2018
1 parent 957b642 commit d4b5d6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions addons/source-python/plugins/udm/players/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ def carries_inventory(self):
return False

# Return False if the weapon is in a different silencer state than it's supposed to be
if item.silencer_option is not None and item.silencer_option !=\
weapon_equipped.get_property_bool('m_bSilencerOn'):
if item.data.has_silencer and item.silencer_option != weapon_equipped.get_property_bool('m_bSilencerOn'):
return False

# Return True if the player carries all the weapons in their selected inventory
Expand Down
2 changes: 1 addition & 1 deletion addons/source-python/plugins/udm/players/inventories.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self):
self._basename = None

# Store the silencer option for this inventory item
self.silencer_option = None
self.silencer_option = False

def set_basename(self, value):
"""Set the basename and silencer option if the weapon can be silenced."""
Expand Down
5 changes: 2 additions & 3 deletions addons/source-python/plugins/udm/udm.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,8 @@ def on_pre_bump_weapon(stack_data):
return False

# Handle the inventory item's silencer option
if inventory_item.silencer_option is not None:
if weapon.get_property_bool('m_bSilencerOn') != inventory_item.silencer_option:
weapon_manager.set_silencer(weapon, inventory_item.silencer_option)
if weapon_data.has_silencer and weapon.get_property_bool('m_bSilencerOn') != inventory_item.silencer_option:
weapon_manager.set_silencer(weapon, inventory_item.silencer_option)


@EntityPreHook(EntityCondition.is_human_player, 'drop_weapon')
Expand Down

0 comments on commit d4b5d6b

Please sign in to comment.