From f43f52903f29d010a72183de24ae8f56ab6702bb Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 21 Apr 2018 16:45:40 +0200 Subject: Add the scientist. --- src/game/units.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/game/units.cpp') 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(went); + + // WTF? + if (!ent) + continue; + + // Wake everything around. + if (!ent->ignore_waking) { + ent->wake_time = now; + + if (!ent->awake) + ent->wake(); + } + } +} + } // namespace game -- cgit