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>2014-12-22 22:45:38 +0000
committerStijn Buys <ingar@osirion.org>2014-12-22 22:45:38 +0000
commite38ab774ed6a82e75069214c3169215b0b3638a9 (patch)
tree5c40f2a513381cba8cab58612276277eef533bb6 /src/game/base/npc.cc
parent4ca3ba6e59b871fc77662eccb51e0c773a95299f (diff)
Added 'wingmen recall' engine function to make wingmen dock at a player's carrier.
Diffstat (limited to 'src/game/base/npc.cc')
-rw-r--r--src/game/base/npc.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index f327f16..f9a600e 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -302,13 +302,12 @@ void NPC::frame(const unsigned long elapsed)
if (dock()->moduletype() == ship_enttype)
{
Ship *carrier = static_cast<Ship *>(dock());
+ set_location(carrier->location());
+ set_axis(carrier->axis());
if (zone() != carrier->zone())
{
set_zone(carrier->zone());
- }
- set_location(carrier->location());
- set_axis(carrier->axis());
-
+ }
if (carrier->state() == core::Entity::Destroyed)
{
explode();
@@ -331,7 +330,7 @@ void NPC::frame(const unsigned long elapsed)
} else
{
npc_repair_timestamp = 0;
- if (carrier->state() == core::Entity::Normal)
+ if ( (carrier->state() == core::Entity::Normal) && ((carrier != leader()) || !leader()->has_autopilot_flag(Ship::AutoPilotRecall)) )
{
launch();
}
@@ -341,7 +340,7 @@ void NPC::frame(const unsigned long elapsed)
}
}
} else {
- if (leader()->has_flag(core::Entity::Dockable) && (health() < NPC_REPAIR_WIMPY))
+ if (leader()->has_flag(core::Entity::Dockable) && ((health() < NPC_REPAIR_WIMPY) || leader()->has_autopilot_flag(Ship::AutoPilotRecall)) )
{
set_autopilot_target(leader());
@@ -382,10 +381,18 @@ void NPC::frame(const unsigned long elapsed)
}
} else {
-
// leader is not in this zone
- if (!autopilot_target()) {
-
+ if ((state() == core::Entity::Docked) && (dock()) && (dock()->moduletype() == ship_enttype))
+ {
+ Ship *carrier = static_cast<Ship *>(dock());
+ set_location(carrier->location());
+ set_axis(carrier->axis());
+ if (zone() != carrier->zone())
+ {
+ set_zone(carrier->zone());
+ }
+ } else if (!autopilot_target())
+ {
target_direction = 0;
target_pitch = 0;
target_roll = 0;