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-10-17 18:39:28 +0000
committerStijn Buys <ingar@osirion.org>2013-10-17 18:39:28 +0000
commit28bafa75762012a088a52f71e5b18838a4e678c2 (patch)
treed431acaa1dde1f9257b06de334a50e6e114117dc /src/game
parent928bd2d6ca25f857dca906fc1e79b61f7e8fc348 (diff)
Use the ship autopilot interface for NPCs, have wingmen dock at a bases when the player does.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/npc.cc33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index 3c8c9bf..be7a754 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -86,23 +86,37 @@ void NPC::frame(const unsigned long elapsed)
if (leader()->state() == Docked) {
- // TODO dock where the leader is docked
- if (leader()->dock()) {
- frame_autopilot_goto(elapsed, leader()->dock());
+ if (state() != core::Entity::Docked) {
+
+ set_autopilot_target(leader()->dock());
+
+ set_autopilot_flag(Ship::AutoPilotEnabled);
+ set_autopilot_flag(Ship::AutoPilotDock);
+ unset_autopilot_flag(Ship::AutoPilotFormation);
+
+ } else {
+ unset_autopilot_flag(Ship::AutoPilotEnabled);
}
-
+
} else {
- if (math::distance(location(), leader()->location()) > 4.0f * ( radius() + leader()->radius())) {
- // goto the leader
- frame_autopilot_goto(elapsed, leader());
+ if (state() == core::Entity::Docked) {
+
+ // FIXME check launch conditions when docked at another player's ship
+ launch();
+
} else {
- // formatian flying
- frame_autopilot_formation(elapsed, leader());
+
+ set_autopilot_target(leader());
+
+ set_autopilot_flag(Ship::AutoPilotEnabled);
+ unset_autopilot_flag(Ship::AutoPilotDock);
+ set_autopilot_flag(Ship::AutoPilotFormation);
}
}
} else {
+ unset_autopilot_flag(Ship::AutoPilotEnabled);
target_direction = 0;
target_pitch = 0;
@@ -114,6 +128,7 @@ void NPC::frame(const unsigned long elapsed)
target_thrust = 0;
if (state() == core::Entity::Impulse) {
+
func_impulse();
}
}