mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-04 05:16:21 -04:00
Commands check LOS & distance if correct type
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user