I'm writing a script that tracks the party's world position, and performs an action when the party moves into a different cube (= 3d tile).
And I found a strange bug:
1) Create a dungeon that goes from elevation -7 to +7
2) Place ladders from elevation -7 to +6
3) Place a timer with an interval of 0
4) Connect the timer to a script that checks if party.party:isClimbing() has changed from true to false, i.e. the party has just stopped climbing
5) When the party has just stopped climbing, print its world position y and elevation:
Code: Select all
print("worldPositionY", party:getWorldPositionY(), "elevation", party.elevation)
Expected output:
world position y = 3 * elevation
Actual output:
For all elevations except 0, the actual output equals the expected output.
But for elevation 0, the actual output is
worldPositionY -3.6738191276416e-017 elevation 0
I.e. a negative number with a very small absolute value, but not exactly 0.
Screenshot
https://imgur.com/inGEj8f
This happens with all ladder types in vanilla LoG2:
- ladder
- ladder_metal
- ladder_metal_4m