Skip to content

Conversation

DudeTheNinja
Copy link

@DudeTheNinja DudeTheNinja commented Sep 15, 2025

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 (neither w_rocket.mdl nor w_rocket_airstrike.mdl) uses team skins in the vanilla game (outside of clientside content mods and potentially custom maps changing the model with SetModel). However, this would only be the case were it not for the method CTFProjectile_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.

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.
@DudeTheNinja
Copy link
Author

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.

@bakugo
Copy link

bakugo commented Sep 15, 2025

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 GetTeamNumber() so you can just call GetOwnerEntity(), check if the result is null, and then call GetTeamNumber() on that.

DudeTheNinja added a commit to DudeTheNinja/tf_dudetheninja that referenced this pull request Sep 15, 2025
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
@DudeTheNinja
Copy link
Author

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 GetTeamNumber() so you can just call GetOwnerEntity(), check if the result is null, and then call GetTeamNumber() on that.

Thank you for pointing that out, I've updated that bit from GetOwnerPlayer() to GetOwnerEntity() .

(I presume the commit automatically gets added to the PR?)

@bakugo
Copy link

bakugo commented Sep 15, 2025

Your code no longer compiles at all, you didn't change the type of the variable. You should at least try compiling before committing.

@DudeTheNinja
Copy link
Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants