From ff5ca9e0463e2b940fcaeb060c431438d6a5a08c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 18 Nov 2010 20:20:24 +0000 Subject: Have the goto engine function make your ship appear above another player, instead of in front of him. --- src/game/base/game.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/game/base') 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(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(); -- cgit v1.2.3