DisjointSet is not Sync due to holding Cells, so we have to workaround this by using a Mutex. This should be fine since we only lock the mutex whenever we do pathfinding and only for a short time to figure out whether the regions are connected.
If in the future we find the mutex being slow, we can even move the locking of the mutex outside of the pathfinding call to only lock once per frame (excluding updating the set).
DisjointSet is not Sync due to holding Cells, so we have to workaround this by using a Mutex. This should be fine since we only lock the mutex whenever we do pathfinding and only for a short time to figure out whether the regions are connected.
If in the future we find the mutex being slow, we can even move the locking of the mutex outside of the pathfinding call to only lock once per frame (excluding updating the set).