fix auto-attack when target not in direct vision
This commit is contained in:
+2
-5
@@ -311,13 +311,10 @@ export default class Entity {
|
||||
return absoluteClosestTarget
|
||||
}
|
||||
|
||||
const targetsInDirectVision = targetsInRange.filter((it) => entityIdsInDirectVision.includes(it.id))
|
||||
if (targetsInDirectVision.length < 1) { return }
|
||||
|
||||
const visibleEntityIds = this.visibleEntities()
|
||||
const visibleEntitiesInRange = targetsInRange.it((it) => visibleEntityIds.includes(it.id))
|
||||
const visibleEntitiesInRange = targetsInRange.filter((it) => visibleEntityIds.includes(it.id))
|
||||
|
||||
return visibleEntitiesInRange.filter((it) => visibleEntityIds.includes(it.id) && this.team != it.team && it.distanceTo(cursor) <= range + this.radius + it.radius)
|
||||
return visibleEntitiesInRange.reduce((e1, e2) => (e1?.distanceTo(cursor) ?? Infinity) < e2.distanceTo(cursor) ? e1 : e2, null)
|
||||
}
|
||||
|
||||
customBboxCollidables(bbox) {
|
||||
|
||||
Reference in New Issue
Block a user