Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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