summaryrefslogtreecommitdiff
path: root/src/game/unit_soldier.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-25 17:52:18 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-25 17:52:18 +0200
commit4fa5f46575e545437ab774c97f9dc88ec304251d (patch)
treefe18d39cd490bb788f787b08dfcf00f93a1c24e5 /src/game/unit_soldier.cpp
parent273abc7c37e9bcdb7cf8d092ed356de01b906146 (diff)
Remake rockets into grenades.
Diffstat (limited to 'src/game/unit_soldier.cpp')
-rw-r--r--src/game/unit_soldier.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index c8e46d0..1e34d7c 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -57,6 +57,7 @@ unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER)
controllable = true;
health = max_health = 28;
+ storage.grenades = 3;
}
static v2f_t spread_aim(v2f_t x, v2f_t aim, float cof, procgen::prng_t *prng)
@@ -225,6 +226,21 @@ void unit_soldier_t::on_death(void)
aim_marker.reset();
}
+void unit_soldier_t::command_throw_grenade(v2f_t at)
+{
+ grenade_t *grenade;
+
+ if (!storage.grenades) {
+ say("Keine Granaten!");
+ return;
+ }
+
+ storage.grenades--;
+
+ grenade = new grenade_t(game, x, at, this);
+ grenade->place(&game->world);
+}
+
void unit_soldier_t::render_to(render::state_t *render)
{
sf::Color selection_color;