m-byte918 / MultiOgarII

A continued version of the original MultiOgar, an open source Ogar server implementation written with Node.js.
Apache License 2.0
126 stars 131 forks source link

Better fix for virus spawning, no infinite loop #1570

Closed joelsgp closed 3 years ago

joelsgp commented 3 years ago

As you can see I've fixed some duplicated code by making safeSpawn a method of Server, but more importantly I've put in a simple 10-loop limit that will prevent an infinite loop if a cell fails to spawn safely.

Feel free to close if you're already working on a better solution.

TopoR1 commented 3 years ago

Still not the best solution. using loops slows down performance. you'd be better off using async functions and just letting you wait instead of checking. I'm sure there is a better way to fix this.