Unstable 1.8.4.0
This commit is contained in:
@@ -180,7 +180,7 @@ namespace Barotrauma
|
||||
fakeBrokenTimer -= deltaTime;
|
||||
if (fakeBrokenTimer > 0.0f) { return; }
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
foreach (Item item in Item.RepairableItems)
|
||||
{
|
||||
var repairable = item.GetComponent<Repairable>();
|
||||
if (repairable == null) { continue; }
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public static Sprite DamageOverlay => DamageOverlayPrefab.Prefabs.ActivePrefab.DamageOverlay;
|
||||
|
||||
|
||||
|
||||
private Point screenResolution;
|
||||
|
||||
private float uiScale, inventoryScale;
|
||||
@@ -105,6 +104,12 @@ namespace Barotrauma
|
||||
private GUILayoutGroup treatmentLayout;
|
||||
private GUIListBox recommendedTreatmentContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Timer for updating visuals (limb tints and overlays) caused by the affliction
|
||||
/// </summary>
|
||||
private float updateVisualsTimer = Rand.Range(0.0f, UpdateVisualsInterval);
|
||||
const float UpdateVisualsInterval = 0.5f;
|
||||
|
||||
private float distortTimer;
|
||||
|
||||
// 0-1
|
||||
@@ -461,15 +466,17 @@ namespace Barotrauma
|
||||
private void OnAttacked(Character attacker, AttackResult attackResult)
|
||||
{
|
||||
if (Math.Abs(attackResult.Damage) < 0.01f) { return; }
|
||||
DamageOverlayTimer = MathHelper.Clamp(attackResult.Damage / MaxVitality, DamageOverlayTimer, 1.0f);
|
||||
if (healthShadowDelay <= 0.0f) { healthShadowDelay = 1.0f; }
|
||||
|
||||
if (ShowDamageOverlay)
|
||||
{
|
||||
DamageOverlayTimer = MathHelper.Clamp(attackResult.Damage / MaxVitality, DamageOverlayTimer, 1.0f);
|
||||
float additionalIntensity = MathHelper.Lerp(0, 1, MathUtils.InverseLerp(0, 0.1f, attackResult.Damage / MaxVitality));
|
||||
damageIntensity = MathHelper.Clamp(damageIntensity + additionalIntensity, 0, 1);
|
||||
}
|
||||
|
||||
if (healthShadowDelay <= 0.0f) { healthShadowDelay = 1.0f; }
|
||||
if (healthBarPulsateTimer <= 0.0f) { healthBarPulsatePhase = 0.0f; }
|
||||
healthBarPulsateTimer = 1.0f;
|
||||
|
||||
float additionalIntensity = MathHelper.Lerp(0, 1, MathUtils.InverseLerp(0, 0.1f, attackResult.Damage / MaxVitality));
|
||||
damageIntensity = MathHelper.Clamp(damageIntensity + additionalIntensity, 0, 1);
|
||||
|
||||
DisplayVitalityDelay = 0.5f;
|
||||
}
|
||||
|
||||
@@ -1036,6 +1043,12 @@ namespace Barotrauma
|
||||
var affliction = kvp.Key;
|
||||
affliction.Prefab.AfflictionOverlay?.Draw(spriteBatch, Vector2.Zero, Color.White * affliction.GetAfflictionOverlayMultiplier(), Vector2.Zero, 0.0f,
|
||||
new Vector2(GameMain.GraphicsWidth / DamageOverlay.size.X, GameMain.GraphicsHeight / DamageOverlay.size.Y));
|
||||
|
||||
var activeEffect = affliction.GetActiveEffect();
|
||||
if (activeEffect is { ThermalOverlayRange: > 0.0f })
|
||||
{
|
||||
StatusHUD.DrawThermalOverlay(spriteBatch, Character, Character, activeEffect.ThermalOverlayColor, activeEffect.ThermalOverlayRange, effectState: (float)Timing.TotalTimeUnpaused, showDeadCharacters: false);
|
||||
}
|
||||
}
|
||||
|
||||
float damageOverlayAlpha = DamageOverlayTimer;
|
||||
@@ -1130,6 +1143,8 @@ namespace Barotrauma
|
||||
if (!statusIconVisibleTime.ContainsKey(afflictionPrefab)) { statusIconVisibleTime.Add(afflictionPrefab, 0.0f); }
|
||||
statusIconVisibleTime[afflictionPrefab] += deltaTime;
|
||||
|
||||
Color color = GetAfflictionIconColor(afflictionPrefab, affliction);
|
||||
|
||||
var matchingIcon =
|
||||
afflictionIconContainer.GetChildByUserData(afflictionPrefab) ??
|
||||
hiddenAfflictionIconContainer.GetChildByUserData(afflictionPrefab);
|
||||
@@ -1138,9 +1153,13 @@ namespace Barotrauma
|
||||
matchingIcon = new GUIButton(new RectTransform(new Point(afflictionIconContainer.Rect.Height), afflictionIconContainer.RectTransform), style: null)
|
||||
{
|
||||
UserData = afflictionPrefab,
|
||||
ToolTip = affliction.Prefab.Name,
|
||||
ToolTip = $"‖color:{color.ToStringHex()}‖{affliction.Prefab.Name}‖color:end‖",
|
||||
CanBeSelected = false
|
||||
};
|
||||
if (affliction.Prefab.ShowDescriptionInTooltip)
|
||||
{
|
||||
matchingIcon.ToolTip = matchingIcon.ToolTip + "\n" + affliction.Prefab.GetDescription(affliction.Strength, AfflictionPrefab.Description.TargetType.Self);
|
||||
}
|
||||
if (affliction == pressureAffliction)
|
||||
{
|
||||
matchingIcon.ToolTip = TextManager.Get("PressureHUDWarning");
|
||||
@@ -1149,6 +1168,8 @@ namespace Barotrauma
|
||||
{
|
||||
matchingIcon.ToolTip = TextManager.Get("OxygenHUDWarning");
|
||||
}
|
||||
matchingIcon.ToolTip = RichString.Rich(matchingIcon.ToolTip);
|
||||
|
||||
new GUIImage(new RectTransform(Vector2.One, matchingIcon.RectTransform, Anchor.BottomCenter), afflictionPrefab.Icon, scaleToFit: true)
|
||||
{
|
||||
CanBeFocused = false
|
||||
@@ -1159,7 +1180,7 @@ namespace Barotrauma
|
||||
matchingIcon.RectTransform.Parent = hiddenAfflictionIconContainer.RectTransform;
|
||||
}
|
||||
var image = matchingIcon.GetChild<GUIImage>();
|
||||
image.Color = GetAfflictionIconColor(afflictionPrefab, affliction);
|
||||
image.Color = color;
|
||||
image.HoverColor = Color.Lerp(image.Color, Color.White, 0.5f);
|
||||
|
||||
if (affliction.DamagePerSecond > 1.0f && matchingIcon.FlashTimer <= 0.0f)
|
||||
@@ -1380,7 +1401,7 @@ namespace Barotrauma
|
||||
|
||||
recommendedTreatmentContainer.Content.ClearChildren();
|
||||
|
||||
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical");
|
||||
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel(Tags.MedicalSkill);
|
||||
|
||||
//key = item identifier
|
||||
//float = suitability
|
||||
@@ -1388,7 +1409,9 @@ namespace Barotrauma
|
||||
GetSuitableTreatments(treatmentSuitability,
|
||||
user: Character.Controlled,
|
||||
ignoreHiddenAfflictions: true,
|
||||
limb: selectedLimbIndex == -1 ? null : Character.AnimController.Limbs.Find(l => l.HealthIndex == selectedLimbIndex));
|
||||
limb: selectedLimbIndex == -1 ? null : Character.AnimController.Limbs.Find(l => l.HealthIndex == selectedLimbIndex),
|
||||
checkTreatmentSuggestionThreshold: true,
|
||||
checkTreatmentThreshold: false);
|
||||
|
||||
foreach (Identifier treatment in treatmentSuitability.Keys.ToList())
|
||||
{
|
||||
@@ -1949,7 +1972,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool ShouldDisplayAfflictionOnLimb(KeyValuePair<Affliction, LimbHealth> kvp, LimbHealth limbHealth)
|
||||
{
|
||||
if (!kvp.Key.ShouldShowIcon(Character)) { return false; }
|
||||
@@ -2058,23 +2080,23 @@ namespace Barotrauma
|
||||
newAfflictions.Add((limbHealths[limbIndex], afflictionPrefab, afflictionStrength));
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
foreach ((Affliction affliction, LimbHealth limbHealth) in afflictions)
|
||||
{
|
||||
//deactivate afflictions that weren't included in the network message
|
||||
if (!newAfflictions.Any(a => kvp.Key.Prefab == a.afflictionPrefab && kvp.Value == a.limb))
|
||||
if (newAfflictions.None(a => affliction.Prefab == a.afflictionPrefab && limbHealth == a.limb))
|
||||
{
|
||||
kvp.Key.Strength = 0.0f;
|
||||
affliction.Strength = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var (limb, afflictionPrefab, strength) in newAfflictions)
|
||||
{
|
||||
Affliction existingAffliction = null;
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
foreach ((Affliction affliction, LimbHealth limbHealth) in afflictions)
|
||||
{
|
||||
if (kvp.Key.Prefab == afflictionPrefab && kvp.Value == limb)
|
||||
if (affliction.Prefab == afflictionPrefab && limbHealth == limb)
|
||||
{
|
||||
existingAffliction = kvp.Key;
|
||||
existingAffliction = affliction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2123,9 +2145,8 @@ namespace Barotrauma
|
||||
|
||||
if (!Character.Params.Health.ApplyAfflictionColors) { return; }
|
||||
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
foreach ((Affliction affliction, LimbHealth _) in afflictions)
|
||||
{
|
||||
var affliction = kvp.Key;
|
||||
Color faceTint = affliction.GetFaceTint();
|
||||
if (faceTint.A > FaceTint.A) { FaceTint = faceTint; }
|
||||
Color bodyTint = affliction.GetBodyTint();
|
||||
@@ -2137,17 +2158,23 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (Limb limb in Character.AnimController.Limbs)
|
||||
{
|
||||
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
|
||||
limb.BurnOverlayStrength = 0.0f;
|
||||
limb.DamageOverlayStrength = 0.0f;
|
||||
foreach (KeyValuePair<Affliction, LimbHealth> kvp in afflictions)
|
||||
}
|
||||
|
||||
foreach ((Affliction affliction, LimbHealth limbHealth) in afflictions)
|
||||
{
|
||||
if (affliction.Prefab.BurnOverlayAlpha <= 0.0f && affliction.Prefab.DamageOverlayAlpha <= 0.0f) { continue; }
|
||||
|
||||
float burnStrength = affliction.Strength / Math.Min(affliction.Prefab.MaxStrength, 100) * affliction.Prefab.BurnOverlayAlpha;
|
||||
float damageOverlayStrength = affliction.Strength / Math.Min(affliction.Prefab.MaxStrength, 100) * affliction.Prefab.DamageOverlayAlpha;
|
||||
foreach (Limb limb in Character.AnimController.Limbs)
|
||||
{
|
||||
var affliction = kvp.Key;
|
||||
float burnStrength = affliction.Strength / Math.Min(affliction.Prefab.MaxStrength, 100) * affliction.Prefab.BurnOverlayAlpha;
|
||||
if (kvp.Value == limbHealths[limb.HealthIndex] || !affliction.Prefab.LimbSpecific)
|
||||
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
|
||||
if (limbHealth == limbHealths[limb.HealthIndex] || !affliction.Prefab.LimbSpecific)
|
||||
{
|
||||
limb.BurnOverlayStrength += burnStrength;
|
||||
limb.DamageOverlayStrength += affliction.Strength / Math.Min(affliction.Prefab.MaxStrength, 100) * affliction.Prefab.DamageOverlayAlpha;
|
||||
limb.DamageOverlayStrength += damageOverlayStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user