Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-10-13 15:39:23 +0000
committerStijn Buys <ingar@osirion.org>2012-10-13 15:39:23 +0000
commit1883c2ea6cb3dd4ba5f26af31a0ad481d524dfef (patch)
tree277ba1ceb22cdf8615d1631c51abc2130a90ba87 /src/game/base/ship.cc
parent5dea1a263136c4cbe011de3325605dd3dc4523af (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.cc38
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