Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/npc.cc')
-rw-r--r--src/game/base/npc.cc42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index be7a754..8e820a7 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -84,6 +84,8 @@ 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) {
@@ -98,6 +100,15 @@ void NPC::frame(const unsigned long elapsed)
unset_autopilot_flag(Ship::AutoPilotEnabled);
}
+ } 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);
+
} else {
if (state() == core::Entity::Docked) {
@@ -116,20 +127,27 @@ void NPC::frame(const unsigned long elapsed)
}
} else {
- unset_autopilot_flag(Ship::AutoPilotEnabled);
-
- target_direction = 0;
- target_pitch = 0;
- target_roll = 0;
- target_strafe = 0.0f;
- target_vstrafe = 0.0f;
-
- target_afterburner = 0.0f;
- target_thrust = 0;
- if (state() == core::Entity::Impulse) {
+ // leader is not in this zone
+ if (!autopilot_target()) {
+
+ target_direction = 0;
+ target_pitch = 0;
+ target_roll = 0;
+ target_strafe = 0.0f;
+ target_vstrafe = 0.0f;
+
+ target_afterburner = 0.0f;
+ target_thrust = 0;
+
+ if (state() == core::Entity::Impulse) {
- func_impulse();
+ func_impulse();
+ }
+ } else {
+ set_autopilot_flag(Ship::AutoPilotEnabled);
+ set_autopilot_flag(Ship::AutoPilotDock);
+ unset_autopilot_flag(Ship::AutoPilotFormation);
}
}
}