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

Add spawnFlyingComponent & breakGlass arguments for setVehiclePanelState

Open FileEX opened this issue 1 year ago • 2 comments

This PR adds the spawnFlyingComponent argument (defaulting to true) to setVehiclePanelState, similar to what is available in setVehicleDoorState. Additionally, the PR introduces the feature to shatter the windscreen if windscreen_panel is set to 3; currently, the windscreen simply disappears.

Added breakGlass argument.

bool setVehiclePanelState(vehicle theVehicle, int panelID, int state [ , bool spawnFlyingComponent = true, bool breakGlass = false ] )

https://streamable.com/uxpph6

This PR helps avoid frustrating situations, such as when managing a garage of vehicles and changing their models. image

Closes #2122

FileEX avatar Jul 15 '24 18:07 FileEX

Well done!

Fernando-A-Rocha avatar Jul 15 '24 21:07 Fernando-A-Rocha

I added the breakGlass argument because the glass component does fall out (but it is poorly visible and falls underground). To maintain backward compatibility, the glass will fall out as before. If breakGlass is set to true, the glass will not fall out but will break as in the video.

FileEX avatar Jul 17 '24 14:07 FileEX

#3592 already adds spawnVehicleFlyingComponent so i think this PR should only add breakGlass ?

Fernando-A-Rocha avatar Nov 06 '24 10:11 Fernando-A-Rocha

#3592 already adds spawnVehicleFlyingComponent so i think this PR should only add breakGlass ?

The spawnVehicleFlyingComponent function allows you to create components, while the argument in the setVehiclePanelState function allows you to avoid creating them. By default, after calling the function, for example, the bumper is flying, which I showed in the screenshots and it can be annoying. It works exactly the same way as in the case of setVehicleDoorState. This argument is not intended to spawn components, but to not spawn them if someone does not want it, because they are spawned by default

FileEX avatar Nov 06 '24 10:11 FileEX

Sorry for the misunderstanding. You are right, this PR is ok

Fernando-A-Rocha avatar Nov 06 '24 11:11 Fernando-A-Rocha

Conflicts resolved

FileEX avatar Dec 31 '24 16:12 FileEX