diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-21 16:45:40 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-21 16:45:40 +0200 |
commit | f43f52903f29d010a72183de24ae8f56ab6702bb (patch) | |
tree | 3e4ef5c81644086891ad9fb78fce0cb7e5c1858e /src/game/units.cpp | |
parent | b84b39f099e8a1f66fb95d371b60b1546fb3142a (diff) |
Add the scientist.
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r-- | src/game/units.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp index c4bc8de..2b3b081 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -67,7 +67,8 @@ void unit_t::render_to(render::state_t *render) sf::Color::White); } - if (selected == selection_cookie && type != UNIT_SOLDIER) + if (selected == selection_cookie && type != UNIT_SOLDIER && + type != UNIT_SCIENTIST) render->render_hlrect(render_bounds, sf::Color::Green); if (debug_AI) { @@ -217,6 +218,7 @@ void unit_t::die(unit_t *killer) { switch (type) { case UNIT_SOLDIER: + case UNIT_SCIENTIST: case UNIT_SPIDER: game->interface->print(name + " " + text::get(text::UNIT_DEATH) + "."); break; @@ -336,4 +338,28 @@ void state_t::hivemind_alert(v2f_t x, float r, bool do_move, v2f_t move_to) } } +void state_t::wake_area(v2f_t x) +{ + rectf_t bounds; + + bounds[0] = x - v2f_t(10, 10); + bounds[1] = x + v2f_t(10, 10); + + for (world::entity_t *went : world.get_entities(bounds, -1)) { + auto ent = dynamic_cast<game::entity_t*>(went); + + // WTF? + if (!ent) + continue; + + // Wake everything around. + if (!ent->ignore_waking) { + ent->wake_time = now; + + if (!ent->awake) + ent->wake(); + } + } +} + } // namespace game |