luna-rs / luna

A scalable and efficient Runescape server targeting revision #377
MIT License
153 stars 42 forks source link

WalkingQueue redesign #186

Open notjuanortiz opened 4 years ago

notjuanortiz commented 4 years ago

The WalkingQueue class does not test well due to the level of cognitive complexity of many methods within the class, which breaks a few SOLID principles.

A redesign of the class is necessary if we want to extend the functionality of mobile entities, without introducing more unstable code.

The current functionalities encompassed within this class include:

notjuanortiz commented 4 years ago

To differentiate between walking and running, the best approach IMO would be to make use of the State Object design pattern. This also allows us to easily implement other movement states, such as Stunned, Frozen, and Snared, without having to modifying existing states (in theory).