simplified mob aI
This commit is contained in:
@@ -16,16 +16,17 @@ import java.util.HashSet;
|
||||
public class StandardMob {
|
||||
|
||||
public static void run(Mob mob){
|
||||
if(!mob.isAlive()){
|
||||
CheckForRespawn(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
||||
|
||||
if(inRange.isEmpty())
|
||||
return;
|
||||
|
||||
if(!mob.isAlive()){
|
||||
CheckForRespawn(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.isMoving()) {
|
||||
mob.setLoc(mob.getMovementLoc());
|
||||
mob.updateLocation();
|
||||
@@ -78,7 +79,6 @@ public class StandardMob {
|
||||
}
|
||||
|
||||
if (!mob.despawned) {
|
||||
|
||||
if (mob.getCharItemManager().getInventoryCount() > 0) {
|
||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
||||
mob.despawn();
|
||||
@@ -193,9 +193,18 @@ public class StandardMob {
|
||||
if(mob.combatTarget != null){
|
||||
//chase player
|
||||
if(!CombatUtilities.inRange2D(mob,mob.combatTarget,mob.getRange())) {
|
||||
if(mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter target = (PlayerCharacter)mob.combatTarget;
|
||||
if(target.isMoving()){
|
||||
MovementUtilities.aiMove(mob, mob.combatTarget.loc, false);
|
||||
return;
|
||||
}else{
|
||||
Vector3fImmutable smoothLoc = Vector3fImmutable.getRandomPointOnCircle(mob.combatTarget.loc,mob.getRange() -1);
|
||||
MovementUtilities.aiMove(mob, smoothLoc, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
MovementUtilities.aiMove(mob, mob.combatTarget.loc, false);
|
||||
}else{
|
||||
mob.stopMovement(mob.getMovementLoc());
|
||||
}
|
||||
|
||||
}else{
|
||||
@@ -228,8 +237,6 @@ public class StandardMob {
|
||||
if(!CombatUtilities.inRange2D(mob,mob.combatTarget,mob.getRange()))
|
||||
return;
|
||||
|
||||
mob.updateLocation();
|
||||
//InterestManager.forceLoad(mob);
|
||||
InterestManager.setObjectDirty(mob);
|
||||
|
||||
if (mainHand == null && offHand == null) {
|
||||
|
||||
Reference in New Issue
Block a user