Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 02:16:55 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 02:16:55 +0000
commit714ca6fdf281e0a9503d3a0cfe683ac78fc1d30c (patch)
tree74cd78ab0cc744a408ecf00efff43eb0ac6d62aa /src/game
parent9dc3cc532820349a0f0e087afb60132927fd3411 (diff)
Reduce patrol hunt distance,
improved patrol attack behaviour.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/npc.cc42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index 992ba6c..d09f8a2 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -120,7 +120,7 @@ Ship *NPC::target_closest_enemy()
const float r = radius() + ship->radius();
// too far
- if (d > r + core::range::fxdistance * 2.0f) {
+ if (d > r + core::range::fxdistance) {
continue;
}
@@ -143,15 +143,7 @@ Ship *NPC::target_closest_enemy()
if (reputation >= -50.0f) {
continue;
}
-
- // reputation threshold to get hunted
- if (d > core::range::fxdistance + r) {
-
- if ((!ship->owner()) || (reputation > -100.0f)) {
- continue;;
- }
- }
-
+
current_enemy = ship;
current_distance = d;
}
@@ -200,7 +192,6 @@ void NPC::frame(const unsigned long elapsed)
} else if (leader()->zone() == zone()) {
// leader is in this zone
-
if (leader()->state() == Docked) {
if (state() != core::Entity::Docked) {
@@ -210,6 +201,7 @@ void NPC::frame(const unsigned long elapsed)
set_autopilot_flag(Ship::AutoPilotEnabled);
set_autopilot_flag(Ship::AutoPilotDock);
unset_autopilot_flag(Ship::AutoPilotFormation);
+ unset_autopilot_flag(Ship::AutoPilotCombat);
} else {
unset_autopilot_flag(Ship::AutoPilotEnabled);
@@ -218,11 +210,11 @@ void NPC::frame(const unsigned long elapsed)
} else if ((leader()->state() == JumpInitiate) || (leader()->state() == Jump)) {
// goto wherever the leader is jumping
-
set_autopilot_target(leader()->jumpdepart());
set_autopilot_flag(Ship::AutoPilotEnabled);
set_autopilot_flag(Ship::AutoPilotDock);
unset_autopilot_flag(Ship::AutoPilotFormation);
+ unset_autopilot_flag(Ship::AutoPilotCombat);
} else {
@@ -231,14 +223,23 @@ void NPC::frame(const unsigned long elapsed)
launch();
} else {
-
- set_autopilot_target(leader());
-
- set_autopilot_flag(Ship::AutoPilotEnabled);
- unset_autopilot_flag(Ship::AutoPilotDock);
- set_autopilot_flag(Ship::AutoPilotFormation);
+ Ship *enemy = target_closest_enemy();
- target_closest_enemy();
+ if (enemy && leader()->has_autopilot_flag(Ship::AutoPilotCombat)) {
+ set_autopilot_target(enemy);
+
+ set_autopilot_flag(Ship::AutoPilotEnabled);
+ set_autopilot_flag(Ship::AutoPilotCombat);
+ unset_autopilot_flag(Ship::AutoPilotDock);
+ unset_autopilot_flag(Ship::AutoPilotFormation);
+ } else {
+ set_autopilot_target(leader());
+
+ set_autopilot_flag(Ship::AutoPilotEnabled);
+ unset_autopilot_flag(Ship::AutoPilotCombat);
+ unset_autopilot_flag(Ship::AutoPilotDock);
+ set_autopilot_flag(Ship::AutoPilotFormation);
+ }
}
}
@@ -264,6 +265,7 @@ void NPC::frame(const unsigned long elapsed)
set_autopilot_flag(Ship::AutoPilotEnabled);
set_autopilot_flag(Ship::AutoPilotDock);
unset_autopilot_flag(Ship::AutoPilotFormation);
+ unset_autopilot_flag(Ship::AutoPilotCombat);
}
}
@@ -287,6 +289,8 @@ void NPC::frame(const unsigned long elapsed)
}
}
+ } else {
+ die();
}
}