diff options
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 42 |
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) { |