Skip to content

Projectile weapons raising error on IsWeapon #298

@satoon101

Description

@satoon101

CBaseEntityWrapper::IsWeapon() is returning False for Projectile weapons on CS:S (and likely other games). This is causing an error to be raised when iterating over WeaponIter when any of those entities exists on the server. Because they exist in the weapon_manager, it tries to get a Weapon instance, and it raises the following error:

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\packages\source-python\events\listener.py", line 92, in fire_game_event
    callback(game_event)
  File "..\addons\source-python\plugins\gungame\plugins\included\gg_dead_strip\gg_dead_strip.py", line 21, in _strip_weapons
    remove_idle_weapons()
  File "..\addons\source-python\plugins\gungame\core\weapons\helpers.py", line 35, in remove_idle_weapons
    tag for tag in ('tool', 'objective') if tag in weapon_manager.tags
  File "..\addons\source-python\packages\source-python\filters\iterator.py", line 53, in __iter__
    for item in self.iterator():
  File "..\addons\source-python\packages\source-python\filters\weapons.py", line 47, in iterator
    yield Weapon(index_from_edict(edict))
  File "..\addons\source-python\packages\source-python\entities\_base.py", line 127, in __call__
    obj = super().__call__(index)
  File "..\addons\source-python\packages\source-python\weapons\_base.py", line 40, in __init__
    WeaponMixin.__init__(self, index)

ValueError: Index '75' is not a valid weapon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions