Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/base/npc.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index 2cd193b..bb4c180 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -118,6 +118,29 @@ void NPC::frame(const unsigned long elapsed)
const float r = 2.0f * (radius() + leader()->radius());
+ if (distance > 2.0f * r + 50.0f) {
+ if (state() == core::Entity::Normal) {
+ // enable impulse drive
+ func_impulse();
+ }
+ } else {
+ if (state() == core::Entity::Impulse) {
+
+ if (leader()->state() != core::Entity::Impulse) {
+ // disbable impulse drive
+ func_impulse();
+ }
+
+ } else if (state() == core::Entity::Normal) {
+
+ if ((leader()->state() == core::Entity::Impulse) || (leader()->state() == core::Entity::ImpulseInitiate)) {
+ // enable impulse drive
+ func_impulse();
+ }
+ }
+
+ }
+
if (distance > 2.0f * r) {
target_thrust = 1.0f;
} else if (distance > r) {
@@ -136,6 +159,10 @@ void NPC::frame(const unsigned long elapsed)
target_afterburner = 0.0f;
target_thrust = 0;
+
+ if (state() == core::Entity::Impulse) {
+ func_impulse();
+ }
}
}
}