diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/base/game.cc | 23 |
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(); |