From 4f7c805a9c515a5af9530afaf366948baa98d60c Mon Sep 17 00:00:00 2001 From: Alex Noir Date: Sun, 17 Dec 2017 15:17:15 +0300 Subject: [PATCH] Hide character names/health/etc. if you can't see their head or it doesn't exist. TODO: use Line of Sight instead of CheckVisibility --- Barotrauma/BarotraumaClient/Source/Characters/Character.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index ddcc3112f..aaf6a7bba 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -296,11 +296,18 @@ namespace Barotrauma if (this == controlled) return; + //Ideally it shouldn't send the character entirely if we can't see them but /shrug, this isn't the most hacker-proof game atm + Limb selfHead = controlled != null ? controlled.AnimController.GetLimb(LimbType.Head) : null; + Limb targHead = this.AnimController.GetLimb(LimbType.Head); + if (controlled != null && selfHead != null && targHead != null && Submarine.CheckVisibility(selfHead.SimPosition, targHead.SimPosition) != null) //TODO: use Line of Sight instead of CheckVisibility + return; + if (info != null) { string name = Info.DisplayName; if (controlled == null && name != Info.Name) name += " (Disguised)"; + Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom; Color nameColor = Color.White;