diff options
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/game.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc index fa3e81a..54c59b7 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -1563,9 +1563,19 @@ void Game::func_goto(core::Player *player, const std::string &args) } core::Entity *dock = player->control()->zone()->search_entity(args); - Ship *ship = static_cast<Ship *>(player->control()); - + + // if target is docked,goto the dock instead + if (dock->moduletype() == ship_enttype) { + Ship *ship = static_cast<Ship *>(dock); + + if ((ship->state() == core::Entity::Docked) && (ship->dock())) { + player->send(ship->name() + " docked at " + ship->dock()->name()); + dock = ship->dock(); + } + } if (dock) { + Ship *ship = static_cast<Ship *>(player->control()); + 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()))); @@ -1574,19 +1584,17 @@ void Game::func_goto(core::Player *player, const std::string &args) } else 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_location().assign(dock->location() + (dock->axis().up() * (0.25f + 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_location().assign(dock->location() + (dock->axis().forward() * (0.25f + ship->radius() + dock->radius()))); ship->get_axis().assign(dock->axis()); ship->get_axis().change_direction(180.0f); } ship->set_state(core::Entity::Normal); + ship->nudge(); ship->reset(); player->set_view(0); |