Description
This request is the result of a discussion in #development on 12th June 2019.
Is your feature request related to a problem? Please describe.
The problem is that when you replace an existing vehicle with a custom model, it will retain the amount of seats that GTA hardcoded for said vehicle. For example, when you apply a model for a 2-doored vehicle to a vehicle that has 4 doors (like a sedan), MTA will allow you to enter more seats than the model physically has, resulting in awkward appearance; players crammed up in invisible space on the backseat or trunk.
Likewise, if you apply a model for a 4-doored vehicle to a vehicle that originally has 2 doors, you won't be able to use the rear doors/seats by pressing Enter, despite them appearing correctly.
The reason behind this problem is easy to comprehend: GTA hardcoded the amount of seats for each vehicle, by its ID. You can tell because making sure the DFF's format tells about the amount of doors the mod has (like door objects and dummies all in the right place) won't make them usable if the original vehicle has a different number of doors.
Describe the solution you'd like
MTA can easily support dynamic seats based on the amount of doors a custom model contains. In fact, some other projects (like multiplayers) already support it seamlessly.
My theory for the technical approach is:
- If a custom DFF is loaded, read the amount of door dummies said DFF has.
- Now overwrite the hardcoded SA values for said vehicle, based on the amount of door dummies (doors) the custom model has.
As a modeller, I can tell you that door dummies are a reliable and accurate representation of the amount of doors.
Describe alternatives you've considered
Scripters can work around the lack of support by handling vehicle entering themselves; for example play entering animation, and teleport player into a certain location within the vehicle's frame, supposedly the true location of a seat.
Additional context
In order to prevent issues and guarantee a proper implementation, we need to take additional measures if developers decide to add support. So far, only a single matter comes to mind, but if anyone can think of anything else, feel free to comment:
- Restore the value of seats back to hardcoded GTA when the model gets unloaded.