Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/ship.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 03c44aa..6a7ac56 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -713,7 +713,7 @@ void Ship::hit(core::Entity *other)
explode();
if (owner()) {
- // broadcast death message
+ // broadcast death message
std::string message("^B");
message.append(owner()->name());
@@ -760,6 +760,19 @@ void Ship::hit(core::Entity *other)
if (assassin) {
assassin->sound("game/target_hit");
}
+
+ // send got hit sound to owner
+ if (owner()) {
+ const float chance = math::randomf(100.0f);
+
+ if (chance < 33.0f) {
+ owner()->sound("game/hit01");
+ } else if (chance < 66.0f) {
+ owner()->sound("game/hit02");
+ } else {
+ owner()->sound("game/hit03");
+ }
+ }
}
}
}