001package com.fs.starfarer.api.impl.campaign.ghosts; 002 003import com.fs.starfarer.api.campaign.SectorEntityToken; 004import com.fs.starfarer.api.util.Misc; 005 006public class GBITowardsDirection extends BaseGhostBehaviorInterrupt { 007 008 protected float facing; 009 protected SectorEntityToken from; 010 011 public GBITowardsDirection(float delay, SectorEntityToken from, float facing) { 012 super(delay); 013 this.from = from; 014 this.facing = facing; 015 } 016 017 @Override 018 public boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior) { 019 if (hasDelayRemaining()) return false; 020 021 float grace = 15f; 022 float angle = Misc.getAngleInDegrees(from.getLocation(), ghost.getEntity().getLocation()); 023 024 return Misc.getAngleDiff(angle, facing) < grace; 025 } 026 027 028}