Permalink
Browse files

Temporary fix for bouncers moving back to their spawn point

(Also updated .gitignore to add .DS_Store* as I am on a mac)
  • Loading branch information...
1 parent 80526af commit df1f1b22d6821edb5019df892109027d02456571 @evanschoffstall evanschoffstall committed Feb 1, 2012
Showing with 11 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +10 −5 src/guard/net/citizensnpcs/guards/types/Bouncer.java
View
1 .gitignore
@@ -8,3 +8,4 @@
\doc
/doc
Citizens.jar
+.DS_Store*
View
15 src/guard/net/citizensnpcs/guards/types/Bouncer.java
@@ -16,14 +16,19 @@ private boolean continueReturn(HumanNPC npc) {
return !LocationUtils.withinRange(npc.getLocation(), npc.getBaseLocation(), 3.5);
}
- private boolean findTarget(HumanNPC npc) {
+ private boolean findTarget(HumanNPC npc)
+ {
Guard guard = npc.getType("guard");
if (!guard.isAggressive())
return false;
- LivingEntity entity = Targeter
- .findTarget(Targeter.getNearby(npc.getPlayer(), guard.getProtectionRadius()), npc);
- if (entity != null
- && LocationUtils.withinRange(entity.getLocation(), npc.getBaseLocation(), guard.getProtectionRadius())) {
+ LivingEntity entity = Targeter.findTarget(Targeter.getNearby(npc.getPlayer(), guard.getProtectionRadius()), npc);
+ if (entity != null && LocationUtils.withinRange(entity.getLocation(), npc.getBaseLocation(), guard.getProtectionRadius()))
+ {
+ if (entity.isDead())
+ {
+ return false;
+ }
+
guard.target(entity, npc);
return true;
}

0 comments on commit df1f1b2

Please sign in to comment.