Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projectile upgrades buildings attribute doesn't work on rescue ranger #81

Open
higps opened this issue May 5, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@higps
Copy link
Contributor

higps commented May 5, 2023

Initial troubleshooting checklist

  • [x ] The attribute is loaded, or this bug report is about a plugin load failure. (Check sm plugins list on the server.)
  • [x ] The attribute is the most recent revision.

Describe the bug
When setting the attribute:
TF2CustAttr_SetString(Weapon1, "projectile upgrades buildings", "50");
Shooting my own buildings does nothing to upgrade them when I have metal.

To Reproduce
Add the attribute to any projectile weapon and shoot unupgraded buildings with the projectile.

Expected behavior
The building to be upgraded.

Server environment (please complete the following information):

  • Operating System: [Linux Ubuntu 18.04)
  • SourceMod version: [SourceMod 1.11.0.6927]

Additional context
I tested this with Pomson as well as on friendly buildings
No errors are thrown.

@higps higps added the bug Something isn't working label May 5, 2023
@nosoop
Copy link
Owner

nosoop commented May 5, 2023

As the code itself specifies, it currently only works with syringes due to some known crashes with rockets (arrows, including the Rescue Ranger's repair claw, use rockets as their base). It would be fine on the Pomson once the checks are patched out, however.

Definitely should be fixed; just a pain to track down. Might have to swap it out to a detour.

The crash occurs at DHookGetParam and leads to a null dereference; if you'd like to investigate, you can start experimenting there.

@nosoop
Copy link
Owner

nosoop commented May 8, 2023

On further inspection, rockets don't inherit from the TF base projectile class, so it's just hooking the wrong function (it's hooking ::GetDamageType on Linux and ::Explode on Windows).

Should be able to hook ::RocketTouch on them instead, though now the question is about how to properly differentiate between projectiles in a future-proof manner (while it's unlikely that new projectiles will be added, I'd prefer to not have to hardcode this behavior to a known set).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants