diff options
author | Stijn Buys <ingar@osirion.org> | 2012-11-18 17:59:52 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-11-18 17:59:52 +0000 |
commit | df20ff5ad47b1d8a04385956589a7564522258a6 (patch) | |
tree | 55112286358004c7f5099c9a78f74cc5113063f3 /src/game/base/ship.cc | |
parent | 2cd1f55f26f2236641fa2f3b36d9d23b99ca072f (diff) |
Support for ownerid() on projectiles and spacemines,
show assassin name in death messages.
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 676ba65..dc039e4 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -42,6 +42,7 @@ Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityContro ship_spawn = 0; ship_maxarmor = 100.0f; + ship_armor = 0.0f; ship_maxshield = 0.0f; ship_shield = 0.0f; @@ -499,7 +500,24 @@ void Ship::collision(core::Entity *other) ship_armor = 0; std::string message("^B"); message.append(owner()->name()); - message.append(" ^Bwent boom."); + + core::Player *assassin = 0; + + if (spacemine->ownerid()) { + assassin = core::server()->find_player(spacemine->ownerid()); + } + + 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."); + } + } else { + message.append(" ^Bwent boom."); + } core::server()->broadcast(message); } else { die(); @@ -860,6 +878,9 @@ void Ship::frame(const unsigned long elapsed) Projectile * projectile = new Projectile((*it)->lifespan()); projectile->set_damage(10.0f); projectile->set_color(color()); + if (owner()) { + projectile->set_ownerid(owner()->id()); + } projectile->set_zone(zone()); projectile->set_axis(axis() * (*it)->axis()); projectile->set_location(location() + (axis() * (*it)->location() * modelscale) + projectile->axis().forward() * projectile->radius()); |