Skip to content

Add ability to enable/disable vehicle model hierarchy typo fixes#4918

Open
SpeedyFolf wants to merge 6 commits into
multitheftauto:masterfrom
SpeedyFolf:feature/vehicle-model-hierarchy-typo-fixes
Open

Add ability to enable/disable vehicle model hierarchy typo fixes#4918
SpeedyFolf wants to merge 6 commits into
multitheftauto:masterfrom
SpeedyFolf:feature/vehicle-model-hierarchy-typo-fixes

Conversation

@SpeedyFolf
Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in clientside fix (SilentPatch-style) so GTA can match canonical vehicle component names from handling/IDE to typo'd frame names in stock .dff hierarchies (e.g. wheel_lm vs wheel_lm_dummy, boat_moving vs boat_moving_hi, transmission / taillight / misc / elevator spellings). Disclaimer: This was created with assistance from Cursor, an AI coding tool.

Implementation:

  • Hooks the existing _stricmp call site used during CVehicleModelInfo setup (same approach as SilentPatch SA: 0x4C5311), with a small sorted alias table.
  • CMultiplayer / CMultiplayerSA: SetVehicleHierarchyTypoFixesEnabled / GetVehicleHierarchyTypoFixesEnabled (default off).
  • Hook installed from CMultiplayerSA::InitHooks_Vehicles (new CMultiplayerSA_VehicleHierarchyTypoFixes.cpp).
  • Lua (client only): engineSetVehicleHierarchyTypoFixesEnabled, engineGetVehicleHierarchyTypoFixesEnabled, and Engine.set/getVehicleHierarchyTypoFixesEnabled.

Motivation

Server/scripters today fix broken components (wheels, boat moving parts, lights, etc.) by shipping custom DFFs that only rename hierarchy nodes. That duplicates data and increases download size. Matching SilentPatch's optional behaviour in the client lets scripts enable the same matching without replacing models, while keeping vanilla behaviour for everyone else by default.

Test plan

  1. Default off: Fresh connect - engineGetVehicleHierarchyTypoFixesEnabled() is false; stock vehicles behave as before (no regression when unused).
  2. On from start: In a client script, engineSetVehicleHierarchyTypoFixesEnabled(true) early (e.g. onClientResourceStart), then spawn/stream affected models - verify e.g. DFT-30 wheel, Predator/Tropic moving boat part, Dumper transmission dummies, Uranus taillights, Sweeper misc, Dodo elevator, etc., match expected fixed behaviour (same as my DFF-replace resource).
  3. Mid-session toggle: With model already loaded, toggling alone does not visually update until engineRestreamModel(vehicleModelId) is used.
  4. crun: engineSetVehicleHierarchyTypoFixesEnabled(true) / false and getters - console shows success.

This is not reset in ResetWorldProperties, just like setGlitchEnabled() glitches; resources/maps should disable this when they're stopped like other opt-in client features.

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.

Introduce an optional SilentPatch-style fix that matches canonical vehicle component names to typo'd hierarchy nodes in stock DFF files. Adds CMultiplayer API methods (Set/GetVehicleHierarchyTypoFixesEnabled) and CMultiplayerSA overrides, a new implementation file that hooks the stricmp call used during CVehicleModelInfo setup with a small mapping table, and initializes the hook from the vehicle init. Exposes Lua bindings (engineSet/GetVehicleHierarchyTypoFixesEnabled and Engine.set/getVehicleHierarchyTypoFixesEnabled) and ensures the feature is disabled by default during ResetWorldProperties to preserve vanilla behaviour.
People can just be responsible and disable this themselves when their map ends like the fastsprint "glitch".
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.

1 participant