(6d989732) Unstable v0.9.708.0
This commit is contained in:
@@ -28,6 +28,8 @@ namespace Barotrauma
|
||||
public float FadeOutTime { get; private set; } = 1;
|
||||
|
||||
public bool Static { get; private set; }
|
||||
public bool StaticSound { get; private set; }
|
||||
public bool StaticSight { get; private set; }
|
||||
|
||||
public float SoundRange
|
||||
{
|
||||
@@ -152,8 +154,8 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
// Non-static ai targets must be kept alive by a custom logic (e.g. item components)
|
||||
SightRange = MinSightRange;
|
||||
SoundRange = MinSoundRange;
|
||||
SightRange = StaticSight ? MaxSightRange : MinSightRange;
|
||||
SoundRange = StaticSound ? MaxSoundRange : MinSoundRange;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +169,13 @@ namespace Barotrauma
|
||||
MaxSoundRange = element.GetAttributeFloat("maxsoundrange", SoundRange);
|
||||
FadeOutTime = element.GetAttributeFloat("fadeouttime", FadeOutTime);
|
||||
Static = element.GetAttributeBool("static", Static);
|
||||
StaticSight = element.GetAttributeBool("staticsight", StaticSight);
|
||||
StaticSound = element.GetAttributeBool("staticsound", StaticSound);
|
||||
if (Static)
|
||||
{
|
||||
StaticSound = true;
|
||||
StaticSight = true;
|
||||
}
|
||||
SonarDisruption = element.GetAttributeFloat("sonardisruption", 0.0f);
|
||||
SonarLabel = element.GetAttributeString("sonarlabel", "");
|
||||
SonarIconIdentifier = element.GetAttributeString("sonaricon", "");
|
||||
@@ -189,11 +198,37 @@ namespace Barotrauma
|
||||
if (!Static && FadeOutTime > 0)
|
||||
{
|
||||
// The aitarget goes silent/invisible if the components don't keep it active
|
||||
SightRange -= deltaTime * (MaxSightRange / FadeOutTime);
|
||||
SoundRange -= deltaTime * (MaxSoundRange / FadeOutTime);
|
||||
if (!StaticSight)
|
||||
{
|
||||
DecreaseSightRange(deltaTime);
|
||||
}
|
||||
if (!StaticSound)
|
||||
{
|
||||
DecreaseSoundRange(deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void IncreaseSoundRange(float deltaTime, float speed = 1)
|
||||
{
|
||||
SoundRange += speed * deltaTime * (MaxSoundRange / FadeOutTime);
|
||||
}
|
||||
|
||||
public void IncreaseSightRange(float deltaTime, float speed = 1)
|
||||
{
|
||||
SightRange += speed * deltaTime * (MaxSightRange / FadeOutTime);
|
||||
}
|
||||
|
||||
public void DecreaseSoundRange(float deltaTime, float speed = 1)
|
||||
{
|
||||
SoundRange -= speed * deltaTime * (MaxSoundRange / FadeOutTime);
|
||||
}
|
||||
|
||||
public void DecreaseSightRange(float deltaTime, float speed = 1)
|
||||
{
|
||||
SightRange -= speed * deltaTime * (MaxSightRange / FadeOutTime);
|
||||
}
|
||||
|
||||
public bool IsWithinSector(Vector2 worldPosition)
|
||||
{
|
||||
if (sectorRad >= MathHelper.TwoPi) return true;
|
||||
|
||||
@@ -313,6 +313,10 @@ namespace Barotrauma
|
||||
selectedCharacter = value;
|
||||
if (selectedCharacter != null)
|
||||
selectedCharacter.selectedBy = this;
|
||||
|
||||
#if CLIENT
|
||||
CharacterHealth.SetHealthBarVisibility(value == null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -262,37 +262,8 @@ namespace Barotrauma
|
||||
|
||||
#if CLIENT
|
||||
private Sprite jobIcon;
|
||||
private Vector2 jobIconPos
|
||||
{
|
||||
get { return new Vector2(HUDLayoutSettings.HealthBarAreaLeft.Right, HUDLayoutSettings.HealthBarAreaLeft.Y - HUDLayoutSettings.Padding); }
|
||||
}
|
||||
#endif
|
||||
|
||||
private Sprite portraitBackground;
|
||||
public Sprite PortraitBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (portraitBackground == null)
|
||||
{
|
||||
var portraitBackgroundElement = CharacterConfigElement.Element("portraitbackground");
|
||||
if (portraitBackgroundElement != null)
|
||||
{
|
||||
portraitBackground = new Sprite(portraitBackgroundElement.Element("sprite"));
|
||||
}
|
||||
}
|
||||
return portraitBackground;
|
||||
}
|
||||
private set
|
||||
{
|
||||
if (portraitBackground != null)
|
||||
{
|
||||
portraitBackground.Remove();
|
||||
}
|
||||
portraitBackground = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<WearableSprite> attachmentSprites;
|
||||
public List<WearableSprite> AttachmentSprites
|
||||
{
|
||||
@@ -956,8 +927,20 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Invalid inventory data in character \"" + Name + "\" - no slot indices found");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//make sure there's no other item in the slot
|
||||
//this should not happen normally, but can occur if the character is accidentally given new job items while also loading previous items in the campaign
|
||||
for (int i = 0; i < inventory.Capacity; i++)
|
||||
{
|
||||
if (slotIndices.Contains(i) && inventory.Items[i] != null && inventory.Items[i] != newItem)
|
||||
{
|
||||
DebugConsole.ThrowError($"Error while loading character inventory data. The slot {i} was already occupied by the item \"{inventory.Items[i].Name} ({inventory.Items[i].ID})\" when loading the item \"{newItem.Name} ({newItem.ID})\"");
|
||||
inventory.Items[i].Drop(null, createNetworkEvent: false);
|
||||
}
|
||||
}
|
||||
|
||||
inventory.TryPutItem(newItem, slotIndices[0], false, false, null);
|
||||
newItem.ParentInventory = inventory;
|
||||
|
||||
//force the item to the correct slots
|
||||
// e.g. putting the item in a hand slot will also put it in the first available Any-slot,
|
||||
@@ -1016,7 +999,6 @@ namespace Barotrauma
|
||||
Character = null;
|
||||
HeadSprite = null;
|
||||
Portrait = null;
|
||||
PortraitBackground = null;
|
||||
AttachmentSprites = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user