leberechtreinhold / dba3_tts

A module for playing De Bellis Antiquitatis 3 on Tabletop Simulator
https://steamcommunity.com/sharedfiles/filedetails/?id=2105272640
MIT License
3 stars 2 forks source link

Hide trees when the obscure a base #20

Closed marcpawl closed 3 years ago

marcpawl commented 3 years ago

Features: -- Can be toggled on and off -- Setting is stored and loaded with the game.

How it works: -- Instead of changing the terrain by adding a tree as an attachment, the tree and the terrain is locked so it cannot be moved.

-- The tree registers for callback when there is a collision.

-- A map from the tree to a set of bases that collide with the tree is kept. When the set is empty the tree is shown, when non-empty the tree is hidden. Making the tree hidden and visisble is done by calling Object:setInvisibleTo.

-- The map is kept up to date at all times, so we can just adjust the visibility when toggling of hiding terrain.

-- The map is saved and loaded with the game.

Bug: https://github.com/leberechtreinhold/dba3_tts/issues/19 The size of the trees returned in the API is too small, so collisions are not detected if a tree's branches hang over a base. Since there is no collision, the tree is not hidden.

See: https://www.youtube.com/watch?v=R8Iq862mrdw

marcpawl commented 3 years ago

I will create a different commit