Skip to content

[GAME] logic_playerproxy's GetAmmoOnWeapon input checks for secondary ammo on weapons that only have primary ammo (Grenades/RPG) #499

@Radial36

Description

@Radial36

Describe the bug

The GetAmmoOnWeapon input for logic_playerproxy mistakenly checks for secondary ammo values for grenades and the RPG, despite those weapons only having a primary ammo pool. It instead permanently adds a value of 3 or 1, for the RPG and grenades respectively, to the value it ends up passing.

Steps to reproduce

Steps to reproduce the behavior:

  1. Check the ammo of weapon_rpg with logic_playerproxy's GetAmmoOnWeapon input.
  2. Pass this value to a logic_compare, or any other easy way of seeing a passed value.
  3. Note that, due to GetAmmoOnWeapon checking for primary and secondary ammo, combining those values, and passing it as a parameter, the passed value is always 3 + current RPG ammo. This is incorrect to expected behaviour (Though it's functionally as intended), which is to pass the current ammo.

RPG with no ammo passes a value of 3, for a nonexistent secondary ammo pool.

Image

RPG with 3 ammo passes a value of 6, 3 primary ammo + 3 secondary ammo, for a weapon with no secondary ammo pool.

Image

Grenades also have this issue, passing along a secondary ammo value of 1.

Image

Expected behavior

the input is functioning perfectly fine and as intended, but it's simply not accounting for weapons with no secondary ammo mechanic. For the RPG/grenades, it should only pass the primary ammo.

Additional context

If fixing this is undesirable due to affecting existing maps/mods that may already account for this via map logic, I suggest the accompanying feature request: #500

VMF for testing this bug: weaponrpg_test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions