From 4fa5f46575e545437ab774c97f9dc88ec304251d Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Wed, 25 Apr 2018 17:52:18 +0200 Subject: Remake rockets into grenades. --- src/game/unit_soldier.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/game/unit_soldier.cpp') 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; -- cgit