summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/unit_soldier.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index 351970e..e49c25a 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -85,6 +85,13 @@ void unit_soldier_t::shoot(v2f_t aim)
end = x + (aim - x).norm() * 40;
trace = world->ray_v_all(x, end, CF_SOLID|CF_BODY|CF_BODY_SMALL, this);
+ if (trace.hit && trace.ent && trace.ent->type == ET_UNIT) {
+ unit_t *unit = dynamic_cast<unit_t*>(trace.ent);
+
+ // Refuse to shoot friendlies.
+ if (unit->friendly)
+ return;
+ }
muzzle_point = x + v2f_t(0, -1.0f);