rwe
rwe copied to clipboard
Don't allow the units to move diagonally between obstacles where corners touch
Right now both the pathfinder and collision system allows units to move diagonally as long as the source and destination locations are free of obstacles, even if doing so would mean moving between obstacles that touch diagonally at the corner.
This behaviour is bad because it potentially breaks defences like dragons' teeth since units can move through an apparent hole in the wall.
It's also reasonably difficult for units to actually move this way in practice since they must make the diagonal jump in one frame, which normally isn't the case until the unit slides up against the obstacles into the corner.
Fixing this will probably need some careful consideration in conjunction with #26, which introduces "rough terrain" to the pathfinder.
It might make sense to forbid corner cutting at all next to obstacles, or only permit it when at least one diagonal is not occupied.