-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[TF2] Fix team skins for tf_projectile_rocket #1532
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
base: master
Are you sure you want to change the base?
Conversation
Added support for team skins with rockets. The method CTFProjectile_Rocket::Deflected calls for switching team skins, but this doesn't occur when the rocket is spawned. As a result, the rocket will always have the RED team's skin, never changing skin unless airblasted. This commit fixes that, by setting the team skin when spawned.
This is my first time making a PR for any project, so I apologise if anything's messy with this. Please let me know if my formatting or methodology is not up-to-speed and I'll happily make amendments if necessary. |
This may cause a crash if the rocket isn't owned by a player. You don't even have to check for players specifically, all entities have |
Added team skin support to rockets. It's partially broken by default so this fixes it. Also added as a PR: ValveSoftware/source-sdk-2013#1532
Thank you bakugo for pointing this out
Thank you for pointing that out, I've updated that bit from (I presume the commit automatically gets added to the PR?) |
Your code no longer compiles at all, you didn't change the type of the variable. You should at least try compiling before committing. |
Sorry. I'm doing this late at night and only used the in-browser editor to do that quick fix and glossed over that. Thank you for being patient with me, and I apologise for wasting your time. |
sorry it's late at night so my changes are gonna be a bit more haphazard
Add handler for potential crash (trying to get team number of a null entity if rocket is spawned in with ent_create). If no entity is found, just use skin 0.
tf_projectile_rocket
has no proper full support for team-based skingroups. When a rocket is fired, it will always be skin 0, the RED team skin. This would be considered fully-intended behaviour since no rocket model (neitherw_rocket.mdl
norw_rocket_airstrike.mdl
) uses team skins in the vanilla game (outside of clientside content mods and potentially custom maps changing the model withSetModel
). However, this would only be the case were it not for the methodCTFProjectile_Rocket::Deflected
, which changes the team skin when the rocket is airblasted to the skingroup of the team that the deflector belongs to.As a result, the lack of team skin setting when the rocket is spawned is possibly erroneous.
This pull request fixes this discrepancy by adding the team skin support when the rocket is spawned.
Whilst not affecting anything in the vanilla game, this provides a fix for any clientside mods or custom content (such as maps that change the model with I/O or VScript) that utilise team skins for the rockets.