diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-25 18:27:13 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-25 18:27:13 +0200 |
commit | e4be331008ca5e64ef2d42f51c5cf5799dd61abc (patch) | |
tree | b451e3f0740ab5685e311f50645e6c81a8939e02 /src/game/unit_soldier.cpp | |
parent | 7103fffc57798ac0bd0ce0819a86b8411cf2c1ae (diff) |
Ammunition mechanic for soldiers.
Diffstat (limited to 'src/game/unit_soldier.cpp')
-rw-r--r-- | src/game/unit_soldier.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp index f2caaf3..4747060 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.max_shells = storage.shells = 20; storage.max_grenades = storage.grenades = 3; } @@ -112,6 +113,14 @@ void unit_soldier_t::fire_shotgun(v2f_t aim) if (next_attack && game->time < next_attack) return; + if (!storage.shells) { + next_attack = game->time + SEC(1); + say("Keine Munition mehr!"); + return; + } + + storage.shells--; + trace = world->ray_v_all_p3d(x, aim, CF_SOLID|CF_BODY|CF_BODY_SMALL, -1, this); if (!manual_firing && trace.hit && trace.ent && trace.ent->type == ET_UNIT) { |