mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add new function spawnVehicleFlyingComponent

Open FileEX opened this issue 1 year ago • 0 comments

Closes #2121 and probably #2128

This PR adds a new function spawnVehicleFlyingComponent. With this function, we can spawn falling components along with their physics. This enables the creation of realistic scenarios such as car accidents on servers, advanced systems like potholes in roads, and more. Example video: https://www.youtube.com/watch?t=71&v=B5relHf21lo&feature=youtu.be

Once the PR is merged, I will create full documentation on the wiki for various nodes for vehicle classes.

Syntax

bool spawnVehicleFlyingComponent(element vehicle, number nodeIndex [, number collisionType, number removalTime ] )
  • nodeIndex - Specifies the component to be created (ranging from 1 to 25). Depending on the vehicle, these can be different components such as wheels, fenders, bicycle handlebars, helicopter propellers, train carriages, and many more.
  • collisionType - Specifies the type of collision for the component, by default it is selected based on the nodeIndex.
0 - COL_BUMPER
1 - COL_WHEEL
2 - COL_DOOR
3 - COL_BONNET
4 - COL_BOOT
5 - COL_PANEL
  • removalTime - The time in milliseconds after which the created component will be removed (it must be removed as it is a temporary object).

The limit for temporary objects with this function is 150, and their default removal time depends on their quantity (unless we set our own via the removalTime parameter).

FileEX avatar Jul 21 '24 01:07 FileEX