multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.41k stars 438 forks source link

bCheckWaves argument in getWaterLevel() does nothing #458

Closed Einheit-101 closed 3 years ago

Einheit-101 commented 6 years ago

Describe the bug Currently getWaterLevel() returns the same values, no matter if bCheckWaves is true or false.

To Reproduce

  1. go to map editor, go to water
  2. set wave height to 0.2 in admin panel
  3. crun x, y, z = getElementPosition(me)
  4. crun getWaterLevel(x, y, z, true) ->> returns correct water level with waves taken into account
  5. crun getWaterLevel(x, y, z, false) ->> still returns water level with waves taken into account

Expected behavior getWaterLevel(x, y, z, false) should return a constant number, the actual water level that has been set with setWaterLevel() or the default water level, in this case 0.2. It should not take care of wave height.

MTA Client (please complete the following information): MTA SA 1.5.6 for Windows r14334

botder commented 3 years ago

That parameter does not let you ignore the waves, this is just bad naming. That parameter makes the function return false, if the difference between reported water level and provided z value is greated than 3.0, or: (level - positionZ) > 3.0.

botder commented 3 years ago

If there is demand for a getWaterLevel, which ignores water level, then I could create a pull request for that: https://github.com/botder/mtasa-blue/tree/feature/waterlevel-nowaves. That branch adds getWaterLevelNoWaves, which returns the z position followed by the wave cos/sin values.

Einheit-101 commented 3 years ago

I think there is no real need for this. I recommend changing wiki description, maybe. But would it be possible to hide that wave quad with a new function to be able to replace it with a custom wave shader? Right now GTA is rendering 2 water surfaces together, one being the flat water and one being the animated waves.

botder commented 3 years ago

I changed the description in the wiki. Create a new issue if you want a new feature for world water/waves.

patrikjuvonen commented 3 years ago

Change reflected on Wiki https://wiki.multitheftauto.com/wiki/GetWaterLevel Issue closed