Build 0.21.6.0
This commit is contained in:
@@ -216,16 +216,19 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (brokenSprite == null || !IsBroken)
|
||||
{
|
||||
spriteBatch.Draw(doorSprite.Texture, pos,
|
||||
getSourceRect(doorSprite, openState, IsHorizontal),
|
||||
color, 0.0f, doorSprite.Origin, item.Scale, item.SpriteEffects, doorSprite.Depth);
|
||||
if (doorSprite?.Texture != null)
|
||||
{
|
||||
spriteBatch.Draw(doorSprite.Texture, pos,
|
||||
getSourceRect(doorSprite, openState, IsHorizontal),
|
||||
color, 0.0f, doorSprite.Origin, item.Scale, item.SpriteEffects, doorSprite.Depth);
|
||||
}
|
||||
}
|
||||
|
||||
float maxCondition = item.Repairables.Any() ?
|
||||
item.Repairables.Min(r => r.RepairThreshold) / 100.0f * item.MaxCondition :
|
||||
item.MaxCondition;
|
||||
float healthRatio = item.Health / maxCondition;
|
||||
if (brokenSprite != null && healthRatio < 1.0f)
|
||||
if (brokenSprite?.Texture != null && healthRatio < 1.0f)
|
||||
{
|
||||
Vector2 scale = scaleBrokenSprite ? new Vector2(1.0f - healthRatio) : Vector2.One;
|
||||
if (IsHorizontal) { scale.X = 1; } else { scale.Y = 1; }
|
||||
@@ -285,34 +288,45 @@ namespace Barotrauma.Items.Components
|
||||
//sent by the server, or reverting it back to its old state if no msg from server was received
|
||||
PredictedState = open;
|
||||
resetPredictionTimer = CorrectionDelay;
|
||||
if (stateChanged) PlaySound(forcedOpen ? ActionType.OnPicked : ActionType.OnUse);
|
||||
if (stateChanged && !IsBroken)
|
||||
{
|
||||
PlayInteractionSound();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isOpen = open;
|
||||
if (!isNetworkMessage || open != PredictedState)
|
||||
{
|
||||
StopPicking(null);
|
||||
ActionType actionType = ActionType.OnUse;
|
||||
if (forcedOpen)
|
||||
StopPicking(null);
|
||||
if (!IsBroken)
|
||||
{
|
||||
actionType = ActionType.OnPicked;
|
||||
PlayInteractionSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (open && HasSoundsOfType[(int)ActionType.OnOpen])
|
||||
{
|
||||
actionType = ActionType.OnOpen;
|
||||
}
|
||||
else if (!open && HasSoundsOfType[(int)ActionType.OnClose])
|
||||
{
|
||||
actionType = ActionType.OnClose;
|
||||
}
|
||||
}
|
||||
PlaySound(actionType);
|
||||
if (isOpen) { stuck = MathHelper.Clamp(stuck - StuckReductionOnOpen, 0.0f, 100.0f); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlayInteractionSound()
|
||||
{
|
||||
ActionType actionType = ActionType.OnUse;
|
||||
if (forcedOpen)
|
||||
{
|
||||
actionType = ActionType.OnPicked;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (open && HasSoundsOfType[(int)ActionType.OnOpen])
|
||||
{
|
||||
actionType = ActionType.OnOpen;
|
||||
}
|
||||
else if (!open && HasSoundsOfType[(int)ActionType.OnClose])
|
||||
{
|
||||
actionType = ActionType.OnClose;
|
||||
}
|
||||
}
|
||||
PlaySound(actionType);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ClientEventRead(IReadMessage msg, float sendingTime)
|
||||
|
||||
@@ -78,14 +78,21 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing = false, float itemDepth = -1)
|
||||
{
|
||||
if (Light.LightSprite != null && (item.body == null || item.body.Enabled) && lightBrightness > 0.0f && IsOn && Light.Enabled)
|
||||
if (Light?.LightSprite == null) { return; }
|
||||
if ((item.body == null || item.body.Enabled) && lightBrightness > 0.0f && IsOn && Light.Enabled)
|
||||
{
|
||||
Vector2 origin = Light.LightSprite.Origin;
|
||||
if ((Light.LightSpriteEffect & SpriteEffects.FlipHorizontally) == SpriteEffects.FlipHorizontally) { origin.X = Light.LightSprite.SourceRect.Width - origin.X; }
|
||||
if ((Light.LightSpriteEffect & SpriteEffects.FlipVertically) == SpriteEffects.FlipVertically) { origin.Y = Light.LightSprite.SourceRect.Height - origin.Y; }
|
||||
|
||||
Vector2 drawPos = item.body?.DrawPosition ?? item.DrawPosition;
|
||||
Light.LightSprite.Draw(spriteBatch, new Vector2(drawPos.X, -drawPos.Y), lightColor * lightBrightness, origin, -Light.Rotation, item.Scale, Light.LightSpriteEffect, itemDepth - 0.0001f);
|
||||
|
||||
Color color = lightColor;
|
||||
if (Light.OverrideLightSpriteAlpha.HasValue)
|
||||
{
|
||||
color = new Color(lightColor, Light.OverrideLightSpriteAlpha.Value);
|
||||
}
|
||||
Light.LightSprite.Draw(spriteBatch, new Vector2(drawPos.X, -drawPos.Y), color * lightBrightness, origin, -Light.Rotation, item.Scale, Light.LightSpriteEffect, itemDepth - 0.0001f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace Barotrauma.Items.Components
|
||||
var wire = it.GetComponent<Wire>();
|
||||
if (wire != null && wire.Connections.Any(c => c != null)) { return false; }
|
||||
|
||||
if (it.Container?.GetComponent<ItemContainer>() is { DrawInventory: false }) { return false; }
|
||||
if (it.Container?.GetComponent<ItemContainer>() is { DrawInventory: false } or { AllowAccess: false }) { return false; }
|
||||
|
||||
if (it.HasTag("traitormissionitem")) { return false; }
|
||||
|
||||
|
||||
@@ -72,7 +72,9 @@ namespace Barotrauma.Items.Components
|
||||
public override bool RecreateGUIOnResolutionChange => true;
|
||||
|
||||
public bool TriggerInfographic { get; set; }
|
||||
|
||||
|
||||
public bool IsInfographicVisible => infographic != null && infographic.Visible;
|
||||
|
||||
partial void InitProjSpecific(ContentXElement element)
|
||||
{
|
||||
CreateGUI();
|
||||
@@ -108,6 +110,9 @@ namespace Barotrauma.Items.Components
|
||||
{ AbsoluteOffset = GUIStyle.ItemFrameOffset },
|
||||
isHorizontal: true)
|
||||
{
|
||||
CanBeFocused = true,
|
||||
HoverCursor = CursorState.Default,
|
||||
AlwaysOverrideCursor = true,
|
||||
RelativeSpacing = 0.012f,
|
||||
Stretch = true
|
||||
};
|
||||
@@ -675,7 +680,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (TriggerInfographic)
|
||||
if (GuiFrame is not null && GuiFrame.Visible && TriggerInfographic)
|
||||
{
|
||||
CreateInfrographic();
|
||||
TriggerInfographic = false;
|
||||
@@ -851,8 +856,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
AbsoluteOffset = new Point(0, -50).Multiply(GUI.Scale)
|
||||
};
|
||||
new GUIButton(closeButtonRt, TextManager.Get("close"))
|
||||
new GUIButton(closeButtonRt, TextManager.Get("closeinfographic"))
|
||||
{
|
||||
UserData = UIHighlightAction.ElementId.CloseButton,
|
||||
OnClicked = (_, _) =>
|
||||
{
|
||||
CloseInfographic(Character.Controlled);
|
||||
@@ -871,6 +877,7 @@ namespace Barotrauma.Items.Components
|
||||
string style = arrowStyle == InfographicArrowStyle.Straight ? "InfographicArrow" : "InfographicArrowCurved";
|
||||
return new GUIImage(rt, style)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
Rotation = MathHelper.ToRadians(rotationDegrees),
|
||||
SpriteEffects = spriteEffects
|
||||
};
|
||||
|
||||
@@ -329,6 +329,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
partial void UpdateSignalsProjSpecific()
|
||||
{
|
||||
if (signals == null) { return; }
|
||||
for (int i = 0; i < signals.Length && i < uiElements.Count; i++)
|
||||
{
|
||||
if (uiElements[i] is GUITextBox tb)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
private static void GetDamageModifierText(ref LocalizedString description, DamageModifier damageModifier, Identifier afflictionIdentifier)
|
||||
{
|
||||
int roundedValue = (int)Math.Round((1 - damageModifier.DamageMultiplier * damageModifier.ProbabilityMultiplier) * 100);
|
||||
int roundedValue = (int)Math.Round((1 - Math.Min(damageModifier.DamageMultiplier, damageModifier.ProbabilityMultiplier)) * 100);
|
||||
if (roundedValue == 0) { return; }
|
||||
string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Barotrauma.Items.Components
|
||||
TextManager.Get($"afflictiontype.{afflictionIdentifier}").Fallback(afflictionIdentifier.Value);
|
||||
|
||||
if (!description.IsNullOrWhiteSpace()) { description += '\n'; }
|
||||
description += $" ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {afflictionName}";
|
||||
description += $" ‖color:{colorStr}‖{roundedValue:-0;+#}%‖color:end‖ {afflictionName}";
|
||||
}
|
||||
|
||||
public override void AddTooltipInfo(ref LocalizedString name, ref LocalizedString description)
|
||||
@@ -36,7 +36,6 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (Identifier afflictionIdentifier in damageModifier.ParsedAfflictionIdentifiers)
|
||||
{
|
||||
GetDamageModifierText(ref description, damageModifier, afflictionIdentifier);
|
||||
|
||||
Reference in New Issue
Block a user