diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs index aaf6a7bba..da4bf9838 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs @@ -15,6 +15,8 @@ namespace Barotrauma { protected float soundTimer; protected float soundInterval; + protected float nameTimer; + protected bool nameVisible; private List sounds; @@ -295,11 +297,33 @@ namespace Barotrauma } if (this == controlled) return; + + nameTimer -= (float)Timing.Step; + if (nameTimer <= 0.0f) + { + //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); - //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 + if (controlled != null && controlled.Submarine == Submarine) + { + if (selfHead != null && targHead != null) + { + Body closestBody = Submarine.CheckVisibility(selfHead.SimPosition, targHead.SimPosition); + Structure wall = null; + if (closestBody != null) + wall = closestBody.UserData as Structure; + nameVisible = closestBody == null || wall == null || !wall.CastShadow; + } + else + nameVisible = false; + } + else + nameVisible = true; //Ideally it should check for visibility from outside the sub/from sub-to-sub, but this will work for now. + nameTimer = Rand.Range(0.5f, 2f); + } + + if (!nameVisible) return; if (info != null) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs index 166974b34..377c51275 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs @@ -297,7 +297,7 @@ namespace Barotrauma else { string description = Items[i].Description; - if (Items[i].Prefab.Name == "ID Card") + if (Items[i].Prefab.NameMatches("ID Card")) { string[] readTags = Items[i].Tags.Split(','); string idName = null; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs index 248d4257d..168387bc8 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs @@ -31,14 +31,14 @@ namespace Barotrauma.Items.Components private WearableSprite[] wearableSprites; private LimbType[] limbType; private Limb[] limb; + private List damageModifiers; public List DamageModifiers { get { return damageModifiers; } } - - public bool Disguise; + public Wearable (Item item, XElement element) : base(item, element) {