Fix onMarkerHit not firing in interiors (#5018)#5020
Conversation
…d classes - Introduced ShouldTrackCollision method in CClientColCallback, CClientMarker, and CClientPickup to determine if collisions should be tracked based on entity conditions. - Updated CClientColManager to utilize the new tracking logic during hit detection. - Refactored collision handling in CClientMarker and CClientPickup to streamline event calls and ensure proper interior and dimension checks. - Enhanced CStaticFunctionDefinitions to refresh collision states after interior changes for markers and pickups. This update improves collision management and event handling across various entity types in the deathmatch logic.
No code changes; previous checks were cancelled with hosted runner not acquired.
Clarifies why collision state is gated separately from geometry hits (fixes stale interior collisions, multitheftauto#5018).
…ocumentation for clarity
|
Do you know what caused this (a specific commit/PR)? Or has it always been broken? |
November 23, 2008
August 4, 2009
March 18, 2021
July 31, 2025
ConclusionThe missing collision refresh is longstanding, but the stale server-side collision behavior appears to originate from |
Agreed with this timeline. The stale collision state was introduced when interior checks were added to callbacks (f2a99c7, 2009) without updating CColManager to skip recording collisions when interiors don't match. The missing refresh on SetElementInterior (de63661, 2008) made it easier to trigger. This PR addresses both: interior filtering is now part of collision state management, and hit detection is refreshed on interior changes. |
Summary
Fixed
onMarkerHitnot firing in interiors when a geometric collision was recorded but the event was silently cancelled due to an interior mismatch. Interior (and dimension for pickups) checks were moved from callbacks into collision state management; hit detection is now refreshed aftersetElementInteriorandcreateMarker.Affected events:
onMarkerHit,onMarkerLeave,onPickupHit,onPickupLeaveonClientMarkerHit,onClientMarkerLeave,onClientPickupHit,onClientPickupLeaveMotivation
Fixes #5018
CColManager::HandleHitDetectionResultrecorded collisions based on geometry only, whileCMarker::Callback_OnCollisionblocked the event entirely when interiors did not match. This mismatch created a stale collision state: even after the player later entered the correct interior,CollisionExistswas alreadytrue, soonMarkerHitnever fired again.The same root cause also affected pickup and client-side marker/pickup events.
Test plan
Original repro (server console):
onMarkerHitshould fire.Additional scenarios:
setElementInterior(me, 14)→onMarkerHitfires.setElementInterior(me, 0)is called →onMarkerLeavefires.onMarkerHitstill fires withmatchingDimension = false.onPickupHit.onClientMarkerHittested with the local player using the same scenarios.isElementWithinMarkerreturnstrueandonMarkerHitfires consistently.Checklist