Skip to content

Fix #552 Impossible to stop helicopter rotor if it has a driver - #3621

Merged
botder merged 13 commits into
multitheftauto:masterfrom
FileEX:bugfix/heli_rotor_speed
Dec 30, 2024
Merged

botder merged 13 commits into
multitheftauto:masterfrom
FileEX:bugfix/heli_rotor_speed

Conversation

@FileEX

@FileEX FileEX commented Jul 31, 2024 •

Copy link
Copy Markdown
Member

Fixed #552

This PR add two new functions

bool setVehicleRotorState(vehicle, bool state [, bool stopRotor = true ])
bool getVehicleRotorState(vehicle)

This function works in a similar way to setVehicleEngineState.

By specifying state to false, the rotor will not be processed, i.e. it will not change its speed and the helicopter/plane cannot be controlled.

The stopRotor parameter specifies whether the rotor is to be stopped (SetHeliRotorSpeed ​​to 0). If we specify false, the rotor will not change its speed, but will not be stopped, it will rotate at the same speed all the time.

Of course, instead of adding new functions, we could use setVehicleEngineState, but for backward compatibility reasons it is better not to do this and simply add these two new functions to avoid possible problems with older scripts.

This function also allows to achieve the effect that the rotor rotates even without a driver.

Comment thread Client/game_sa/CVehicleSA.cpp Outdated
Comment thread Client/game_sa/CVehicleSA.cpp Outdated
Comment thread Client/game_sa/CVehicleSA.cpp Outdated
Comment thread Client/game_sa/CVehicleSA.h Outdated
Comment thread Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp Outdated
Comment thread Client/game_sa/CVehicleSA.cpp
Comment thread Client/game_sa/CVehicleSA.cpp Outdated
@salwador

salwador commented Aug 1, 2024

Copy link
Copy Markdown

Will it work with planes, or only helicopters?

@FileEX

FileEX commented Aug 2, 2024

Copy link
Copy Markdown
Member Author

Will it work with planes, or only helicopters?

This PR only applies to helicopters. Does the same bug apply to planes?

@salwador

salwador commented Aug 2, 2024

Copy link
Copy Markdown

Does the same bug apply to planes?

Yep, same. At the moment, rotor can be stopped only in preRender.

Im ask because PR #2548 add combined method for set/get heli/plane rotor speed.
It would be good if the rotor-state methods was universal.

@TheNormalnij

Copy link
Copy Markdown
Contributor

Of course, instead of adding new functions, we could use setVehicleEngineState, but for backward compatibility reasons it is better not to do this and simply add these two new functions to avoid possible problems with older scripts.

What may be broken?

Comment thread Client/game_sa/CVehicleSA.cpp Outdated
Comment thread Client/game_sa/CVehicleSA.h
@FileEX

FileEX commented Aug 9, 2024

Copy link
Copy Markdown
Member Author

Of course, instead of adding new functions, we could use setVehicleEngineState, but for backward compatibility reasons it is better not to do this and simply add these two new functions to avoid possible problems with older scripts.

What may be broken?

As far as I know, the MTA team strongly attaches importance to backward compatibility.

In this case, various scripts using setVehicleEngineState could cause the helicopter's rotor to stop, and while this is perfectly desirable behavior for us, it may be undesirable for others. So I personally think it's safer and better to just add these simple functions

@FileEX

FileEX commented Aug 9, 2024

Copy link
Copy Markdown
Member Author

Does the same bug apply to planes?

Yep, same. At the moment, rotor can be stopped only in preRender.

Im ask because PR #2548 add combined method for set/get heli/plane rotor speed. It would be good if the rotor-state methods was universal.

I took this into account and introduced setVehicleRotorState & getVehicleRotorState which is for both helicopters and planes

@tederis tederis added the bugfix Solution to a bug of any kind label Aug 14, 2024
botder
botder previously approved these changes Dec 30, 2024
@botder
botder merged commit c7644f2 into multitheftauto:master Dec 30, 2024
@botder botder added this to the 1.6.1 milestone Dec 30, 2024
MTABot pushed a commit that referenced this pull request Dec 30, 2024
c7644f2 Impossible to stop helicopter rotor if it has a driver (PR #3621, Fixes #552)
808ddf0 Update client en_US pot
@FileEX
FileEX deleted the bugfix/heli_rotor_speed branch December 30, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Impossible to stop helicopter rotor if it has a driver

7 participants