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 soundTimer;
|
||||||
protected float soundInterval;
|
protected float soundInterval;
|
||||||
|
protected float nameTimer;
|
||||||
|
protected bool nameVisible;
|
||||||
|
|
||||||
private List<CharacterSound> sounds;
|
private List<CharacterSound> sounds;
|
||||||
|
|
||||||
@@ -296,10 +298,32 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (this == controlled) return;
|
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
|
nameTimer -= (float)Timing.Step;
|
||||||
Limb selfHead = controlled != null ? controlled.AnimController.GetLimb(LimbType.Head) : null;
|
if (nameTimer <= 0.0f)
|
||||||
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
|
//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 && 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;
|
return;
|
||||||
|
|
||||||
if (info != null)
|
if (info != null)
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
string description = Items[i].Description;
|
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[] readTags = Items[i].Tags.Split(',');
|
||||||
string idName = null;
|
string idName = null;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Barotrauma.Items.Components
|
|||||||
private WearableSprite[] wearableSprites;
|
private WearableSprite[] wearableSprites;
|
||||||
private LimbType[] limbType;
|
private LimbType[] limbType;
|
||||||
private Limb[] limb;
|
private Limb[] limb;
|
||||||
|
|
||||||
private List<DamageModifier> damageModifiers;
|
private List<DamageModifier> damageModifiers;
|
||||||
|
|
||||||
public List<DamageModifier> DamageModifiers
|
public List<DamageModifier> DamageModifiers
|
||||||
@@ -38,7 +39,6 @@ namespace Barotrauma.Items.Components
|
|||||||
get { return damageModifiers; }
|
get { return damageModifiers; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Disguise;
|
|
||||||
public Wearable (Item item, XElement element)
|
public Wearable (Item item, XElement element)
|
||||||
: base(item, element)
|
: base(item, element)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user