Starsector API
Loading...
Searching...
No Matches
GBITowardsEntity.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.ghosts;
2
3import com.fs.starfarer.api.campaign.SectorEntityToken;
4import com.fs.starfarer.api.util.Misc;
5
7
8 protected SectorEntityToken from;
9 protected SectorEntityToken to;
10
11 public GBITowardsEntity(float delay, SectorEntityToken from, SectorEntityToken to) {
12 super(delay);
13 this.from = from;
14 this.to = to;
15 }
16
17 @Override
18 public boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior) {
19 if (hasDelayRemaining()) return false;
20
21 float grace = 15f;
22 float angle = Misc.getAngleInDegrees(from.getLocation(), ghost.getEntity().getLocation());
23 float facing = Misc.getAngleInDegrees(from.getLocation(), to.getLocation());
24
25 return Misc.getAngleDiff(angle, facing) < grace;
26 }
27
28
29}
boolean shouldInterruptBehavior(SensorGhost ghost, GhostBehavior behavior)
GBITowardsEntity(float delay, SectorEntityToken from, SectorEntityToken to)