[TF2] Fix dispenser healing being briefly interrupted when touching the dispenser #1298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes ValveSoftware/Source-1-Games#5124
The dispenser has an
m_hTouchingEntities
vector that keeps track of which entities are near it. Entities are added to and removed from this vector both when touching the dispenser itself and its associatedm_hTouchTrigger
, meaning players will be present in the vector twice if they are touching both.CObjectDispenser::EndTouch()
does not take this into account, and stops healing players when they stop touching the dispenser itself, even if they're still touching the surrounding trigger, resulting in a brief interruption in healing before it's resumed byDispenseThink()
shortly after.Fixed by not interrupting healing in
EndTouch()
if the player is still present in the vector after being removed from it once.There's also another bug with the same cause that results in dispensers giving double the amount of metal when the engineer is touching them, but I'm not sure if that should be fixed since it noticeably affects balance.