Skip to content

Fix #5333: Preserve vehicle variant on setElementModel - #5402

Open
iManGaaX wants to merge 2 commits into
multitheftauto:masterfrom
iManGaaX:resolve/issue-5333
Open

iManGaaX wants to merge 2 commits into
multitheftauto:masterfrom
iManGaaX:resolve/issue-5333

Conversation

@iManGaaX

@iManGaaX iManGaaX commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

setElementModel no longer drops the vehicle variant

  • Server: CVehicle::SetModel keeps the current variant instead of randomizing it; a new one is only picked when the variation cannot be used on the new model (Slamvan/Caddy/Cropduster/NRG-500/BF-400 need a specific extra), using the new VehicleManager::IsVariationValidForModel

  • Client: model changes coming from the server are applied as-is (no more re-randomizing in SetModelBlocking), and client-side setElementModel follows the same rule; servers that do not send the variants keep the old behaviour

  • If on(Client)ElementModelChange cancels the change, the original variant is restored

Server and client now report the same getVehicleVariant after a model change

Closes #5333.

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.

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.

Vehicle variant for add-on vehicles is ignored until applied twice

1 participant