tts-community / tts-community-bug-tracker

Community maintained list of Tabletop Simulator bugs.
2 stars 0 forks source link

Grid.snapping incorrectly returns 1 when snapping is enabled #28

Closed Benjamin-Dobell closed 3 years ago

Benjamin-Dobell commented 4 years ago

Describe the bug

Grid.snapping incorrectly returns 1, if it is set to 3 or 4 i.e. if Center snapping is enabled, with or without line snapping.

To Reproduce

  1. Create a blank mod and add the following to Global:
function onLoad()
    Grid.snapping = 1
    log(Grid.snapping, 'Grid.snapping = 1')
    Grid.snapping = 2
    log(Grid.snapping, 'Grid.snapping = 2')
    Grid.snapping = 3
    log(Grid.snapping, 'Grid.snapping = 3')
    Grid.snapping = 4
    log(Grid.snapping, 'Grid.snapping = 4')
end

Seeing the logged output:

Grid.snapping = 1 1 Grid.snapping = 2 2 Grid.snapping = 3 1 Grid.snapping = 4 1

Expected behavior Should see logged:

Grid.snapping = 1 1 Grid.snapping = 2 2 Grid.snapping = 3 3 Grid.snapping = 4 4

Lua Scripts & XML UI: If applicable, Lua:

function onLoad()
    Grid.snapping = 1
    log(Grid.snapping, 'Grid.snapping = 1')
    Grid.snapping = 2
    log(Grid.snapping, 'Grid.snapping = 2')
    Grid.snapping = 3
    log(Grid.snapping, 'Grid.snapping = 3')
    Grid.snapping = 4
    log(Grid.snapping, 'Grid.snapping = 4')
end

Tabletop Simulator Info (please complete the following information):

Known workarounds None. If the value is set via a script, you'll know the value, but if a user changes the value, the script won't be able to detect that.

Benjamin-Dobell commented 3 years ago

Fixed in v13.