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>2013-11-07 20:08:05 +0000
committerStijn Buys <ingar@osirion.org>2013-11-07 20:08:05 +0000
commit87d5637c09dca61a650fe81d83ef328943176503 (patch)
tree60b97aa68a593d71b9a5566242da8d7f0676c3ef /src/game/base/ship.cc
parentcd9ad2786e0e4b0f0448363252d4b010dfe6515c (diff)
Save/load player reputation,
count player NPC and PVP kills.
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r--src/game/base/ship.cc42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 5df0ced..664b557 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -427,6 +427,8 @@ void Ship::explode()
target_thrust = 0;
entity_thrust = 0;
+
+ ship_armor = 0;
set_state(core::Entity::Destroyed);
@@ -641,31 +643,37 @@ void Ship::hit(core::Entity *other)
if (ship_armor <= 0) {
explode();
+ core::Player *assassin = 0;
+ if (spacemine->owner_id()) {
+ assassin = core::server()->find_player(spacemine->owner_id());
+ }
+
if (owner()) {
- ship_armor = 0;
std::string message("^B");
message.append(owner()->name());
-
- core::Player *assassin = 0;
-
- if (spacemine->owner_id()) {
- assassin = core::server()->find_player(spacemine->owner_id());
- }
-
- if (assassin) {
+
+ if (assassin) {
if (assassin == owner()) {
message.append(" ^Bran into his own mine.");
} else {
message.append(" ^Bran into ");
message.append(assassin->name());
message.append(" ^B's mine.");
+
+ // asssissin killed a player
+ assassin->set_pvpkills(assassin->pvpkills() + 1);
}
} else {
message.append(" ^Bwent boom.");
}
core::server()->broadcast(message);
+
+
} else {
- die();
+ if (assassin) {
+ // assissin killed an NPC
+ assassin->set_npckills(assassin->npckills() + 1);
+ }
}
}
@@ -690,7 +698,7 @@ void Ship::hit(core::Entity *other)
explode();
if (owner()) {
- ship_armor = 0;
+ // broadcast death message
std::string message("^B");
message.append(owner()->name());
@@ -708,10 +716,20 @@ void Ship::hit(core::Entity *other)
core::server()->broadcast(message);
}
- // send kill sound to assassin
if (assassin) {
+ // send kill sound to assassin
assassin->sound("game/target_kill");
+
+ // update assassin stats
+ if (owner()) {
+ // asssissin killed a player
+ assassin->set_pvpkills(assassin->pvpkills() + 1);
+ } else {
+ // assissin killed an NPC
+ assassin->set_npckills(assassin->npckills() + 1);
+ }
}
+
} else {
// send hit sound to assassin
if (assassin) {