This commit is contained in:
Anuken
2019-09-25 13:51:23 -04:00
parent 04cfec3213
commit 5ac7fa5eca
3 changed files with 20 additions and 22 deletions

View File

@@ -50,11 +50,8 @@ public class Pathfinder implements Runnable{
} }
} }
//run next frame to try and prevent a crash //special preset which may help speed things up; this is optional
Core.app.post(() -> { preloadPath(waveTeam, PathTarget.enemyCores);
//special preset which may help speed things up; this is optional
preloadPath(waveTeam, PathTarget.enemyCores);
});
start(); start();
}); });
@@ -121,19 +118,23 @@ public class Pathfinder implements Runnable{
public void run(){ public void run(){
while(true){ while(true){
if(net.client()) return; if(net.client()) return;
queue.run();
//total update time no longer than maxUpdate
for(PathData data : list){
updateFrontier(data, maxUpdate / list.size);
}
try{ try{
Thread.sleep(updateInterval);
}catch(InterruptedException e){ queue.run();
//stop looping when interrupted externally
return; //total update time no longer than maxUpdate
for(PathData data : list){
updateFrontier(data, maxUpdate / list.size);
}
try{
Thread.sleep(updateInterval);
}catch(InterruptedException e){
//stop looping when interrupted externally
return;
}
}catch(Exception e){
e.printStackTrace();
} }
} }
} }

View File

@@ -133,7 +133,7 @@ public class NetClient implements ApplicationListener{
//called on all clients //called on all clients
@Remote(called = Loc.server, targets = Loc.server, variants = Variant.both) @Remote(called = Loc.server, targets = Loc.server, variants = Variant.both)
public static void sendMessage(String message, String sender, Player playersender){ public static void sendMessage(String message, String sender, Player playersender){
if(Vars.ui != null){ if(Vars.ui != null && !(playersender != null && net.server() && sender.startsWith("[#" + player.getTeam().color.toString() + "]<T>"))){
Vars.ui.chatfrag.addMessage(message, sender); Vars.ui.chatfrag.addMessage(message, sender);
} }

View File

@@ -38,11 +38,8 @@ public abstract class FlyingUnit extends BaseUnit{
if(target == null) targetClosestEnemyFlag(BlockFlag.turret); if(target == null) targetClosestEnemyFlag(BlockFlag.turret);
} }
if(target == null){ if(getClosestSpawner() == null && getSpawner() != null){
target = getSpawner(); target = getSpawner();
}
if(target == getSpawner() && getSpawner() != null){
circle(80f + Mathf.randomSeed(id) * 120); circle(80f + Mathf.randomSeed(id) * 120);
}else if(target != null){ }else if(target != null){
attack(type.attackLength); attack(type.attackLength);