delay between mob actions to reduce synchronized appearance
This commit is contained in:
@@ -16,6 +16,8 @@ import engine.server.MBServerStatics;
|
|||||||
import engine.util.ThreadUtils;
|
import engine.util.ThreadUtils;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
public class MobileFSMManager {
|
public class MobileFSMManager {
|
||||||
|
|
||||||
@@ -70,8 +72,9 @@ public class MobileFSMManager {
|
|||||||
long mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD;
|
long mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD;
|
||||||
|
|
||||||
while (alive) {
|
while (alive) {
|
||||||
|
//assign random range of delay between 1ms and 2000ms so mob actions don't appear synchronized
|
||||||
ThreadUtils.sleep(1);
|
Random r = new Random();
|
||||||
|
ThreadUtils.sleep(r.nextInt(2000-1) + 1);
|
||||||
|
|
||||||
if (System.currentTimeMillis() > mobPulse) {
|
if (System.currentTimeMillis() > mobPulse) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user