Skip to content

Fix getVehicleDummyPosition returning 0,0,0 for the second exhaust#4949

Open
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/exhaust-second-dummy-position
Open

Fix getVehicleDummyPosition returning 0,0,0 for the second exhaust#4949
TheCrazy17 wants to merge 1 commit into
multitheftauto:masterfrom
TheCrazy17:fix/exhaust-second-dummy-position

Conversation

@TheCrazy17

Copy link
Copy Markdown

Summary

Most vehicle models don't have an exhaust_second dummy, so the game places the second exhaust by mirroring the primary exhaust on the X axis. However, getVehicleDummyPosition(veh, "exhaust_second") returned the raw stored value (0, 0, 0 - the vehicle centre) instead of the mirrored position where the effects actually appear, e.g. after using resetVehicleDummyPositions.

The getter now applies the same mirroring fallback the game uses, so the reported position always matches the effective one. No visual or behavioural changes - only the returned value is fixed.

Motivation

Fixes #4761

Test plan

Using the script from the issue:

local veh = getPedOccupiedVehicle(localPlayer)
setVehicleDummyPosition(veh, "exhaust_second", 0, 0, -5000)
resetVehicleDummyPositions(veh)
print(getVehicleDummyPosition(veh, "exhaust_second"))
-- before: 0, 0, 0 | after: mirrored exhaust position (e.g. -0.39, -1.93, 0.15)
  • Returns the mirrored primary exhaust position after a reset, matching where the exhaust/nitro effects render.
  • Also works on freshly spawned vehicles without any set/reset.
  • Vehicles whose model does define exhaust_second still return their real dummy position.
  • Setting/resetting dummy positions and the effect rendering itself are unchanged.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

…xhaust

Most vehicle models have no second exhaust dummy, in which case the game
mirrors the primary exhaust on the X axis when placing exhaust and nitro
effects (a fallback MTA's dummy hooks replicate). getVehicleDummyPosition
returned the raw stored value instead, so "exhaust_second" reported 0, 0, 0
- vehicle centre - while the effects visibly appeared at the mirrored
position, e.g. after resetVehicleDummyPositions. Apply the same fallback in
the getter so the reported position matches the effective one.

Fixes multitheftauto#4761
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.

resetVehicleDummyPositions causing exhaust_second dummy to reset to the incorrect position

1 participant