summaryrefslogtreecommitdiff
path: root/src/game/units.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r--src/game/units.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp
index e7263c0..43e6878 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -217,7 +217,16 @@ void unit_t::damage(int points, unit_t *attacker)
void unit_t::die(unit_t *killer)
{
- game->interface->print(name + " " + text::get(text::UNIT_DEATH) + ".");
+ switch (type) {
+ case UNIT_SOLDIER:
+ case UNIT_SPIDER:
+ game->interface->print(name + " " + text::get(text::UNIT_DEATH) + ".");
+ break;
+
+ default:
+ game->interface->print(name + " " + text::get(text::UNIT_DESTRUCTION) + ".");
+ break;
+ }
dead = true;
death_time = game->now;
@@ -300,13 +309,16 @@ void hivemind_attack(unit_t *source, v2f_t target)
if (unit->type != unit_t::UNIT_SPIDER)
continue;
- if ((unit->x - target).len() > 25.0f)
- continue;
-
if (unit->have_target)
continue;
unit->wake();
+
+ // Move towards the target if it's close, otherwise walk
+ // randomly to avoid fire.
+ if ((unit->x - target).len() > 25.0f)
+ continue;
+
unit->start_moving(target);
}
}