diff options
author | Stijn Buys <ingar@osirion.org> | 2008-12-28 12:33:04 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-12-28 12:33:04 +0000 |
commit | 4e1d951705204899ee99d7fcedf582b25b86b506 (patch) | |
tree | 03cb919ff062368dfc334b9f71b932cf89e31517 /src/game/base/station.cc | |
parent | 82c63c49134a6fca91d908792438e6284dc4cebf (diff) |
generic docking API,
race activating requires docking
Diffstat (limited to 'src/game/base/station.cc')
-rw-r--r-- | src/game/base/station.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/game/base/station.cc b/src/game/base/station.cc index 4efd662..59f51ac 100644 --- a/src/game/base/station.cc +++ b/src/game/base/station.cc @@ -31,5 +31,27 @@ void Station::set_shipdealer(ShipDealer *shipdealer) station_shipdealer = shipdealer; } + +void Station::dock(core::Entity *entity) +{ + if (entity->moduletype() != ship_enttype) + return; + + Ship * ship = static_cast<Ship *>(entity); + + if (math::distance(location(), ship->location()) > radius() + ship->radius()) { + if (ship->owner()) + ship->owner()->send("Target out of range"); + return; + } + + ship->location().assign(entity->location()); + ship->set_eventstate(core::Entity::Docked); + + if (ship->owner() && ship->owner()->control() == ship) { + ship->owner()->set_view(this); + ship->owner()->send("^BDocking at " + entity->name()); + } } +} |