Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-10 20:44:07 +0000
committerStijn Buys <ingar@osirion.org>2013-11-10 20:44:07 +0000
commit2ae807c202489e0126733c29095947662ad527b1 (patch)
treed805ae8c81f5f15389b304e5c851619a73957da4 /src/game
parent5eaf6cc1f9ab772139a2dbe6d325a7ab9879e01b (diff)
Ignore server-side entities when using 'goto' and added a safety distance and a nudge check.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.cc22
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);