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>2010-11-18 20:20:24 +0000
committerStijn Buys <ingar@osirion.org>2010-11-18 20:20:24 +0000
commitff5ca9e0463e2b940fcaeb060c431438d6a5a08c (patch)
treeb3ff17494a3b7484d7d93a89c22b8bce4753fd3e
parente08ef4bba07fbf8852695852af11953a29a4e309 (diff)
Have the goto engine function make your ship appear above another player, instead of in front of him.
-rw-r--r--src/game/base/game.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 18b5497..c171711 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -832,13 +832,26 @@ void Game::func_goto(core::Player *player, const std::string &args)
Ship *ship = static_cast<Ship *>(player->control());
if (dock) {
- if (dock->type() == core::Entity::Globe)
+ if (dock->type() == core::Entity::Globe) {
+ // target is a planet: keep a safe distance
ship->get_location().assign(dock->location() + (dock->axis().forward() *(planet_safe_distance + ship->radius() + dock->radius())));
- else
- ship->get_location().assign(dock->location() + (dock->axis().forward() *(ship->radius() + dock->radius())));
+ ship->get_axis().assign(dock->axis());
+ ship->get_axis().change_direction(180.0f);
- ship->get_axis().assign(dock->axis());
- ship->get_axis().change_direction(180.0f);
+ } if (dock->type() == core::Entity::Controlable) {
+ // target is a controlable: appear above it
+
+ // FIxME target might be docked -> requires ship docked_at awareness
+ // we might want to match the target's state() and speed()
+ ship->get_location().assign(dock->location() + (dock->axis().up() *(ship->radius() + dock->radius())));
+ ship->get_axis().assign(dock->axis());
+
+ } else {
+ // targe is something else, appear in front of it
+ ship->get_location().assign(dock->location() + (dock->axis().forward() *(ship->radius() + dock->radius())));
+ ship->get_axis().assign(dock->axis());
+ ship->get_axis().change_direction(180.0f);
+ }
ship->set_state(core::Entity::Normal);
ship->reset();