39 :
ShipAI(s), sub_select_time(0), subtarget(0), tgt_point_defense(false)
45 Point torque(rand()-16000, rand()-16000, rand()-16000);
56 for (
int i = 0; i < 64; i++) {
121 bool directed =
false;
122 double threat_level = 0;
123 double support_level = 1;
133 if (hold || !directed && threat_level >= 2*support_level) {
138 if (d_support > 35e3) {
267 bool station_keeping =
distance < 0;
269 if (station_keeping) {
356 double closing_speed = ship_speed;
365 if (closing_speed > 300) {
373 if (throttle < 1 && ship->GetFLCS() != 0)
385 speed = (d - 30e3) / 100;
389 if (ship_speed > speed) {
393 else if (ship_speed < speed - 10) {
427 if (ship_speed > speed) {
433 else if (ship_speed < speed - 10) {
442 double sv = ship_speed;
446 if (dv > 0) dt = dv * 1e-2 *
seconds;
447 else if (dv < 0) dt = dv * 1e-2 *
seconds;
459 if (ship_speed > 1 && brakes > 0)
476 if (self_rgn && !nav_rgn) {
481 bool use_farcaster = self_rgn != nav_rgn &&
494 if (dest && dest->
GetRegion() == nav_rgn) {
512 else if (self_rgn != nav_rgn) {
548 if (contact && !contact->
ActLock()) {
564 double dx = fabs(rmr.
x);
565 double dy = fabs(rmr.
y);
567 if (dx < 10*
DEGREES && dy < 10*DEGREES && rmr.z > 0) {
618 double range = delta.
length();
620 if (range < weapon->GetDesign()->max_range * 0.9 &&
624 else if (range < weapon->GetDesign()->max_range * 0.5)
680 double dlen = delta.
length();
710 double dlen = delta.
length();
773 return point -
self->Location();
786 result.
yaw = atan2(point.
x, point.
z) +
PI;
788 double adjacent = sqrt(point.
x*point.
x + point.
z*point.
z);
790 result.
pitch = atan(point.
y / adjacent);
792 if (!_finite(result.
yaw))
795 if (!_finite(result.
pitch))