Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-10-20 14:36:45 +0000
committerStijn Buys <ingar@osirion.org>2013-10-20 14:36:45 +0000
commitb277c65615482f17c966771341ae6b7a89cc9568 (patch)
treed5138749901e816ac1b197279b51e7ac23e15b82 /src/game/base/npc.cc
parent6704be2d5550f091c18c4cc50ef6d28bf55a31a4 (diff)
Make wingmen follow you through jumpgates.
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);
}
}
}