Add vehicle model special ability API part1#5016
Draft
Allerek wants to merge 3 commits into
Draft
Conversation
…/mtasa-blue into vehicles_abilities_part1
Model ID based functions, instead of vehicle element based ones.
Member
Contributor
Author
|
this one is way more extensive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Everything is a subject to change
Summary
This pull request adds a client-side vehicle special ability API for applying selected GTA SA native vehicle behaviors to vehicles whose model ID would not normally receive those behaviors.
New Lua functions:
Aliases are also available:
Supported ability names:
Example usage:
The API currently exposes these native behavior paths:
towtruckpackermisc_aramp rotation.fireTruckWater407.FireTruckControlpath for aiming, effects, audio, and hit handling.fireTruckLadder544.MODEL_FIRELAvehicle.noneGetter behavior:
returns one of:
If no override has been set, original GTA models report their native default ability:
Other models default to:
"none"Special ability overrides are cleared when:
setElementModel,This prevents stale behavior state from carrying over to a different DFF/COL/component layout.
Implementation notes:
fireTruckWater.MODEL_FIRELAchassis setup and calls native moving-collision ladder logic for configured custom ladder models.Motivation
MTA can request new vehicle model IDs at runtime with
engineRequestModel, but several GTA SA vehicle behaviors are hardcoded to original model IDs. This means a custom model that is visually and structurally built like a towtruck, packer, firetruck, or fire ladder cannot naturally use the original game behavior when it lives on a newly requested model ID.This change allows resources to opt a vehicle into one of those native special behavior paths explicitly, without permanently spoofing the vehicle's real model ID.
The main goals are:
This is especially useful for resources that use
engineRequestModelto add new vehicle models while still expecting original GTA SA special vehicle functionality.Test plan
towtruck1.zip
Testing was done with the local
towtruck1test resource under:The test resource includes custom replacement assets for:
A shareable copy of the test resource is prepared under:
That copy intentionally contains 0-byte placeholder
.txdand.dfffiles only, so third-party/proprietary model assets are not included in the PR. Before running that copy, replace the placeholders with valid vehicle model files using the same filenames listed above. If the placeholders are left in place, custom model import/replacement tests are expected to fail; this is intentional.Manual commands:
Expected behavior:
/testtowtowtruck./testtow2towtruck./testpackerpacker./testfirefireTruckWater./testladderfireTruckLadder./testabilitiesPASSorFAILfor both getter aliases:/testabilityresetsetElementModelreset,setElementModelreset,"none"behavior,engineReplaceModelreset,engineRestoreModelreset,engineFreeModelplus re-request behavior,towtruck2assets onto the same custom towtruck model ID.Important F8 checks:
The expected result is no
FAILlines.Specific reset cases that should pass:
Native behavior checks:
Towtruck:
Packer:
Firetruck water:
Firetruck ladder:
Checklist