diff options
author | Stijn Buys <ingar@osirion.org> | 2013-10-13 19:58:53 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-10-13 19:58:53 +0000 |
commit | d192894dc60562c04a98ea0ba361045178e096d7 (patch) | |
tree | e7167fbae241984e6c7ed1350f29c04f64bb4a18 /src/game | |
parent | 22efe13cd7a489c13e91f166cff80cbae350785b (diff) |
Added NPC impulse drive.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/base/npc.cc | 27 |
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(); + } } } } |