space-wizards / space-station-14

A multiplayer game about paranoia and chaos on a space station. Remake of the cult-classic Space Station 13.
https://spacestation14.io
MIT License
2.63k stars 3.31k forks source link

`TryFindRandomTile` logic is still completely busted #27725

Open mirrorcult opened 5 months ago

mirrorcult commented 5 months ago

Description

has a 10 try for loop that tries to pick a random tile within grid aabb which will just randomly fail sometimes

needs to not do this shit and just bfs from a tile within the fixture aabbs to find an open tile or something see #26694

mirrorcult commented 5 months ago

also the way the weighting works right now is inefficient as it recalculates the tilecount each call, for stuff like variation rules it needs a way to cache it as these all run within the same tick and the tilecount isnt going to change