summaryrefslogtreecommitdiff
path: root/src/game/unit_spider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/unit_spider.cpp')
-rw-r--r--src/game/unit_spider.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/game/unit_spider.cpp b/src/game/unit_spider.cpp
index 4f0fbd9..5d6253d 100644
--- a/src/game/unit_spider.cpp
+++ b/src/game/unit_spider.cpp
@@ -82,15 +82,21 @@ void unit_spider_t::on_wake(void)
void unit_spider_t::on_think(void)
{
+ if (game->now - wake_time > 10.0) {
+ sleep();
+ return;
+ }
+
target_and_attack();
- if (have_target || game->now - wake_time < 10.0) {
- if (!have_target && !move.moving)
- random_walk();
+ if (!have_target && !move.moving)
+ random_walk();
- keep_moving(4.0);
- } else
- sleep();
+ if (!keep_moving(4.0)) {
+ // Try to get unstuck.
+ next_targetting = game->now + 0.6;
+ random_walk();
+ }
}
void unit_spider_t::on_damage(unit_t *attacker)