diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:27:44 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:27:44 +0200 |
commit | a055c2aa0aba2a3b80a37c49f3f89cc64d86abd6 (patch) | |
tree | 57bbdd5c9045760d3a94f8ec3b28ccac10620b07 /src/game/units.cpp | |
parent | e77c5b1e01eeb55625d8cf072bedd5a34658b865 (diff) |
Half-assed rockets.
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r-- | src/game/units.cpp | 20 |
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); } } |