diff options
author | Stijn Buys <ingar@osirion.org> | 2012-10-13 15:39:23 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-10-13 15:39:23 +0000 |
commit | 1883c2ea6cb3dd4ba5f26af31a0ad481d524dfef (patch) | |
tree | 277ba1ceb22cdf8615d1631c51abc2130a90ba87 /src/game/base/ship.cc | |
parent | 5dea1a263136c4cbe011de3325605dd3dc4523af (diff) |
Corrected bugs in the respawn command, detect ship collisions with planets and stars.
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 4efba27..9874337 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -419,6 +419,44 @@ void Ship::action (btScalar seconds) } } +void Ship::collision(core::Entity *other) +{ + if (state() == core::Entity::Destroyed) { + return; + } + + if (state() == core::Entity::Docked) { + return; + } + + // do not fly into planets + if (other->moduletype() == planet_enttype) { + explode(); + + if (owner()) { + std::string message("^B"); + message.append(owner()->name()); + message.append(" ^Bran into "); + message.append(other->name()); + message.append("."); + core::server()->broadcast(message); + } else { + die(); + } + } else if (other->moduletype() == star_enttype) { + explode(); + + if (owner()) { + std::string message("^B"); + message.append(owner()->name()); + message.append(" ^Bcould not resist the light."); + core::server()->broadcast(message); + } else { + die(); + } + } +} + void Ship::frame(const unsigned long elapsed) { //const float direction_reaction = 2.0f; // directional control reaction time |