Added a timer to the raycasts so it's not screwing over performance too hard
This commit is contained in:
@@ -15,6 +15,8 @@ namespace Barotrauma
|
||||
{
|
||||
protected float soundTimer;
|
||||
protected float soundInterval;
|
||||
protected float nameTimer;
|
||||
protected bool nameVisible;
|
||||
|
||||
private List<CharacterSound> 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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -31,14 +31,14 @@ namespace Barotrauma.Items.Components
|
||||
private WearableSprite[] wearableSprites;
|
||||
private LimbType[] limbType;
|
||||
private Limb[] limb;
|
||||
|
||||
private List<DamageModifier> damageModifiers;
|
||||
|
||||
public List<DamageModifier> DamageModifiers
|
||||
{
|
||||
get { return damageModifiers; }
|
||||
}
|
||||
|
||||
public bool Disguise;
|
||||
|
||||
public Wearable (Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user