Commands check LOS & distance if correct type

This commit is contained in:
Treeku
2014-04-07 18:56:29 +02:00
committed by CharonInferar
parent 51f89dced7
commit 9b87eb0f59
+17 -4
View File
@@ -118,6 +118,14 @@ public class CommandService implements INetworkDispatch {
return false;
}
if (target != null && actor.getPosition().getDistance(target.getPosition) > command.getMaxRangeToTarget()) {
return false;
}
if (!core.simulationService.checkLineOfSight(actor, target)) {
return false;
}
break;
case 2: // Self Only
if (target == null) {
@@ -138,6 +146,10 @@ public class CommandService implements INetworkDispatch {
target = actor;
}
if (!core.simulationService.checkLineOfSight(actor, target)) {
return false;
}
break;
default:
break;
@@ -159,6 +171,11 @@ public class CommandService implements INetworkDispatch {
return false;
}
// Without this we could be buffing ally NPCs and such
if (object.getSlottedObject("ghost") == null) {
return;
}
break;
case 1: // Enemy Only
if (target == null || !(target instanceof TangibleObject)) {
@@ -178,10 +195,6 @@ public class CommandService implements INetworkDispatch {
break;
}
if (target != null && actor.getPosition().getDistance(target.getPosition) > command.getMaxRangeToTarget()) {
return false;
}
if (command.shouldCallOnTarget()) {
if (target == null || !(target instanceof CreatureObject)) {
return false;