From df20ff5ad47b1d8a04385956589a7564522258a6 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 18 Nov 2012 17:59:52 +0000 Subject: Support for ownerid() on projectiles and spacemines, show assassin name in death messages. --- src/game/base/ship.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/game/base/ship.cc') 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()); -- cgit v1.2.3