RanvierMUD / core

Core engine code for Ranvier
https://ranviermud.com
MIT License
45 stars 41 forks source link

Allow diagonal directions to be optional #122

Closed azigler closed 1 year ago

azigler commented 4 years ago

This PR allows disabling diagonal directions via a diagonalDirections property in ranvier.json. The Room#getExits function is the only method in core that references diagonal directions.

I added a Room#checkDiagonalDirections method that allows you to check if diagonal are supported from within anywhere else in state. You can override ranvier.json on a per-Room basis by adding a diagonalDirections property to a Room's metadata.

Please note that bundles implementing CommandParser, commands like look, and any listener in player-events for move may have their own uses of diagonals. Those references to diagonals are isolated to bundles and not a part of core. However, you can use the new Room#checkDiagonalDirections to consistently control the use of diagonal directions in your game.

As well, this PR allows you to fully ignore diagonal directions in core if you so wish.

By default, not including a diagonalDirections property in ranvier.json or a Room's metadata will result in diagonals being enabled. This is the current default setting in Ranvier when using a coordinate system.

seanohue commented 4 years ago

Really nice QOL feature for those of us who might want to keep things solely grid-based, and it seems flexible.