Unstable 0.1500.7.0 (No edition)
This commit is contained in:
@@ -342,7 +342,7 @@ namespace Barotrauma
|
||||
|
||||
partial void SetupDrawOrder()
|
||||
{
|
||||
//make sure every character gets drawn at a distinct "layer"
|
||||
//make sure every character gets drawn at a distinct "layer"
|
||||
//(instead of having some of the limbs appear behind and some in front of other characters)
|
||||
float startDepth = 0.1f;
|
||||
float increment = 0.001f;
|
||||
@@ -355,8 +355,16 @@ namespace Barotrauma
|
||||
List<Limb> depthSortedLimbs = Limbs.OrderBy(l => l.DefaultSpriteDepth).ToList();
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
if (limb.ActiveSprite == null) { continue; }
|
||||
limb.ActiveSprite.Depth = startDepth + depthSortedLimbs.IndexOf(limb) * 0.00001f;
|
||||
var sprite = limb.GetActiveSprite();
|
||||
if (sprite == null) { continue; }
|
||||
sprite.Depth = startDepth + depthSortedLimbs.IndexOf(limb) * 0.00001f;
|
||||
foreach (var conditionalSprite in limb.ConditionalSprites)
|
||||
{
|
||||
if (conditionalSprite.Exclusive)
|
||||
{
|
||||
conditionalSprite.ActiveSprite.Depth = sprite.Depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
|
||||
@@ -128,6 +128,50 @@ namespace Barotrauma
|
||||
get { return gibEmitters; }
|
||||
}
|
||||
|
||||
private class GUIMessage
|
||||
{
|
||||
public string RawText;
|
||||
public string Identifier;
|
||||
public string Text;
|
||||
|
||||
private int _value;
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
Text = RawText.Replace("[value]", _value.ToString());
|
||||
Size = GUI.Font.MeasureString(Text);
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color;
|
||||
public float Lifetime;
|
||||
public float Timer;
|
||||
|
||||
public Vector2 Size;
|
||||
|
||||
public bool PlaySound;
|
||||
|
||||
public GUIMessage(string rawText, Color color, float delay, string identifier = null, int? value = null)
|
||||
{
|
||||
RawText = Text = rawText;
|
||||
if (value.HasValue)
|
||||
{
|
||||
Text = rawText.Replace("[value]", value.Value.ToString());
|
||||
Value = value.Value;
|
||||
}
|
||||
Timer = -delay;
|
||||
Size = GUI.Font.MeasureString(Text);
|
||||
Color = color;
|
||||
Identifier = identifier;
|
||||
Lifetime = 3.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private List<GUIMessage> guiMessages = new List<GUIMessage>();
|
||||
|
||||
public static bool IsMouseOnUI => GUI.MouseOn != null ||
|
||||
(CharacterInventory.IsMouseOnInventory && !CharacterInventory.DraggingItemToWorld);
|
||||
|
||||
@@ -618,6 +662,17 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
foreach (GUIMessage message in guiMessages)
|
||||
{
|
||||
bool wasPending = message.Timer < 0.0f;
|
||||
message.Timer += deltaTime;
|
||||
if (wasPending && message.Timer >= 0.0f && message.PlaySound)
|
||||
{
|
||||
SoundPlayer.PlayUISound(GUISoundType.UIMessage);
|
||||
}
|
||||
}
|
||||
guiMessages.RemoveAll(m => m.Timer >= m.Lifetime);
|
||||
|
||||
if (!enabled) { return; }
|
||||
|
||||
if (!IsIncapacitated)
|
||||
@@ -736,6 +791,27 @@ namespace Barotrauma
|
||||
CharacterHUD.Draw(spriteBatch, this, cam);
|
||||
if (drawHealth && !CharacterHUD.IsCampaignInterfaceOpen) { CharacterHealth.DrawHUD(spriteBatch); }
|
||||
}
|
||||
|
||||
public void DrawGUIMessages(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (info == null || !Enabled || InvisibleTimer > 0.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 messagePos = DrawPosition;
|
||||
messagePos.Y += hudInfoHeight;
|
||||
messagePos = cam.WorldToScreen(messagePos) - Vector2.UnitY * GUI.IntScale(60);
|
||||
foreach (GUIMessage message in guiMessages)
|
||||
{
|
||||
if (message.Timer < 0) { continue; }
|
||||
Vector2 drawPos = messagePos + Vector2.UnitX * (GUI.IntScale(60) - message.Size.X);
|
||||
drawPos = new Vector2((int)drawPos.X, (int)drawPos.Y);
|
||||
float alpha = MathHelper.SmoothStep(1.0f, 0.0f, message.Timer / message.Lifetime);
|
||||
GUI.DrawString(spriteBatch, drawPos, message.Text, message.Color * alpha);
|
||||
messagePos -= Vector2.UnitY * message.Size.Y * 1.2f;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
@@ -942,6 +1018,55 @@ namespace Barotrauma
|
||||
return nameColor;
|
||||
}
|
||||
|
||||
public void AddMessage(string rawText, Color color, bool playSound, string identifier = null, int? value = null)
|
||||
{
|
||||
GUIMessage existingMessage = null;
|
||||
|
||||
float delay = 0.0f;
|
||||
if (guiMessages.Any())
|
||||
{
|
||||
delay = guiMessages.Min(m => m.Timer) - 0.5f;
|
||||
if (delay < 0)
|
||||
{
|
||||
delay = -delay;
|
||||
if (guiMessages.Count > 5)
|
||||
{
|
||||
//reduce delays if there's lots of messages
|
||||
guiMessages.Where(m => m.Timer < 0.0f).ForEach(m => m.Timer *= 0.9f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (identifier != null)
|
||||
{
|
||||
existingMessage = guiMessages.Find(m => m.Identifier == identifier && m.Timer < m.Lifetime * 0.5f);
|
||||
}
|
||||
if (existingMessage == null || !value.HasValue)
|
||||
{
|
||||
var newMessage = new GUIMessage(rawText, color, delay, identifier, value);
|
||||
guiMessages.Insert(0, newMessage);
|
||||
if (playSound)
|
||||
{
|
||||
if (delay > 0.0f)
|
||||
{
|
||||
newMessage.PlaySound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundPlayer.PlayUISound(GUISoundType.UIMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
existingMessage.Value += value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's one already linked to the object)
|
||||
/// The progress bar will automatically fade out after 1 sec if the method hasn't been called during that time
|
||||
@@ -1046,24 +1171,14 @@ namespace Barotrauma
|
||||
if (newAmount > prevAmount)
|
||||
{
|
||||
int increase = newAmount - prevAmount;
|
||||
GUI.AddMessage(
|
||||
"+" + TextManager.GetWithVariable("currencyformat", "[credits]", increase.ToString()),
|
||||
GUI.Style.Yellow,
|
||||
Position + Vector2.UnitY * 150.0f,
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: true,
|
||||
subId: Submarine?.ID ?? -1);
|
||||
AddMessage("+" + TextManager.GetWithVariable("currencyformat", "[credits]", "[value]"),
|
||||
GUI.Style.Yellow, playSound: this == Controlled, "money", increase);
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnTalentGiven(string talentIdentifier)
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("talentname." + talentIdentifier.ToString()),
|
||||
GUI.Style.Yellow,
|
||||
Position + Vector2.UnitY * 150.0f,
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: true,
|
||||
subId: Submarine?.ID ?? -1);
|
||||
AddMessage(TextManager.Get("talentname." + talentIdentifier.ToString()), GUI.Style.Yellow, playSound: this == Controlled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Barotrauma
|
||||
return frame;
|
||||
}
|
||||
|
||||
partial void OnSkillChanged(string skillIdentifier, float prevLevel, float newLevel, Vector2 textPopupPos)
|
||||
partial void OnSkillChanged(string skillIdentifier, float prevLevel, float newLevel)
|
||||
{
|
||||
if (TeamID == CharacterTeamType.FriendlyNPC) { return; }
|
||||
if (Character.Controlled != null && Character.Controlled.TeamID != TeamID) { return; }
|
||||
@@ -198,17 +198,14 @@ namespace Barotrauma
|
||||
if ((int)newLevel > (int)prevLevel)
|
||||
{
|
||||
int increase = Math.Max((int)newLevel - (int)prevLevel, 1);
|
||||
GUI.AddMessage(
|
||||
string.Format("+{0} {1}", increase, TextManager.Get("SkillName." + skillIdentifier)),
|
||||
specialIncrease ? GUI.Style.Orange : GUI.Style.Green,
|
||||
textPopupPos,
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: specialIncrease,
|
||||
subId: Character?.Submarine?.ID ?? -1);
|
||||
Character?.AddMessage(
|
||||
"+[value] "+ TextManager.Get("SkillName." + skillIdentifier),
|
||||
specialIncrease ? GUI.Style.Orange : GUI.Style.Green,
|
||||
playSound: Character == Character.Controlled, skillIdentifier, increase);
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnExperienceChanged(int prevAmount, int newAmount, Vector2 textPopupPos)
|
||||
partial void OnExperienceChanged(int prevAmount, int newAmount)
|
||||
{
|
||||
if (Character.Controlled != null && Character.Controlled.TeamID != TeamID) { return; }
|
||||
|
||||
@@ -217,13 +214,9 @@ namespace Barotrauma
|
||||
if (newAmount > prevAmount)
|
||||
{
|
||||
int increase = newAmount - prevAmount;
|
||||
GUI.AddMessage(
|
||||
string.Format("+{0} {1}", increase, TextManager.Get("experienceshort")),
|
||||
GUI.Style.Blue,
|
||||
textPopupPos,
|
||||
Vector2.UnitY * 10.0f,
|
||||
playSound: true,
|
||||
subId: Character?.Submarine?.ID ?? -1);
|
||||
Character?.AddMessage(
|
||||
"+[value] " + TextManager.Get("experienceshort"),
|
||||
GUI.Style.Blue, playSound: Character == Character.Controlled, "exp", increase);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace Barotrauma
|
||||
{
|
||||
string skillIdentifier = msg.ReadString();
|
||||
float skillLevel = msg.ReadSingle();
|
||||
info?.SetSkillLevel(skillIdentifier, skillLevel, Position + Vector2.UnitY * 150.0f);
|
||||
info?.SetSkillLevel(skillIdentifier, skillLevel);
|
||||
}
|
||||
break;
|
||||
case 4: // NetEntityEvent.Type.SetAttackTarget
|
||||
@@ -390,7 +390,7 @@ namespace Barotrauma
|
||||
}
|
||||
targetLimb = targetCharacter.AnimController.Limbs[targetLimbIndex];
|
||||
}
|
||||
if (attackLimb?.attack != null)
|
||||
if (attackLimb?.attack != null && Controlled != this)
|
||||
{
|
||||
if (eventType == 4)
|
||||
{
|
||||
@@ -467,8 +467,9 @@ namespace Barotrauma
|
||||
ushort talentCount = msg.ReadUInt16();
|
||||
for (int i = 0; i < talentCount; i++)
|
||||
{
|
||||
bool addedThisRound = msg.ReadBoolean();
|
||||
UInt32 talentIdentifier = msg.ReadUInt32();
|
||||
GiveTalent(talentIdentifier);
|
||||
GiveTalent(talentIdentifier, addedThisRound);
|
||||
}
|
||||
break;
|
||||
case 12: //NetEntityEvent.Type.UpdateMoney:
|
||||
|
||||
@@ -1969,8 +1969,8 @@ namespace Barotrauma
|
||||
if (limbHealths[limb.HealthIndex].Afflictions.Count == 0) continue;
|
||||
foreach (Affliction a in limbHealths[limb.HealthIndex].Afflictions)
|
||||
{
|
||||
limb.BurnOverlayStrength += a.Strength / a.Prefab.MaxStrength * a.Prefab.BurnOverlayAlpha;
|
||||
limb.DamageOverlayStrength += a.Strength / a.Prefab.MaxStrength * a.Prefab.DamageOverlayAlpha;
|
||||
limb.BurnOverlayStrength += a.Strength / Math.Min(a.Prefab.MaxStrength, 100) * a.Prefab.BurnOverlayAlpha;
|
||||
limb.DamageOverlayStrength += a.Strength / Math.Min(a.Prefab.MaxStrength, 100) * a.Prefab.DamageOverlayAlpha;
|
||||
}
|
||||
limb.BurnOverlayStrength /= limbHealths[limb.HealthIndex].Afflictions.Count;
|
||||
limb.DamageOverlayStrength /= limbHealths[limb.HealthIndex].Afflictions.Count;
|
||||
|
||||
@@ -167,6 +167,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public Sprite GetActiveSprite(bool excludeConditionalSprites = true)
|
||||
=> excludeConditionalSprites ? (_deformSprite != null ? _deformSprite.Sprite : Sprite)
|
||||
: ActiveSprite;
|
||||
|
||||
public float DefaultSpriteDepth { get; private set; }
|
||||
|
||||
public WearableSprite HuskSprite { get; private set; }
|
||||
@@ -397,7 +401,7 @@ namespace Barotrauma
|
||||
return deformations;
|
||||
}
|
||||
}
|
||||
DefaultSpriteDepth = ActiveSprite.Depth;
|
||||
DefaultSpriteDepth = GetActiveSprite()?.Depth ?? 0.0f;
|
||||
LightSource?.CheckConditionals();
|
||||
}
|
||||
|
||||
@@ -901,7 +905,7 @@ namespace Barotrauma
|
||||
}
|
||||
foreach (WearableSprite wearable in WearingItems)
|
||||
{
|
||||
if (onlyDrawable != null && onlyDrawable != wearable) continue;
|
||||
if (onlyDrawable != null && onlyDrawable != wearable && wearable.CanBeHiddenByOtherWearables) { continue; }
|
||||
DrawWearable(wearable, depthStep, spriteBatch, blankColor, alpha: color.A / 255f, spriteEffect);
|
||||
//if there are multiple sprites on this limb, make the successive ones be drawn in front
|
||||
depthStep += step;
|
||||
|
||||
@@ -695,7 +695,12 @@ namespace Barotrauma
|
||||
|
||||
AssignOnExecute("control", (string[] args) =>
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
if (args.Length < 1) { return; }
|
||||
if (GameMain.NetworkMember != null)
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("control " + string.Join(' ', args[0]));
|
||||
return;
|
||||
}
|
||||
var character = FindMatchingCharacter(args, true);
|
||||
if (character != null)
|
||||
{
|
||||
|
||||
@@ -941,7 +941,7 @@ namespace Barotrauma
|
||||
inventoryIndex = updateList.IndexOf(CharacterHUD.HUDFrame);
|
||||
}
|
||||
|
||||
if ((!PlayerInput.PrimaryMouseButtonHeld() && !PlayerInput.PrimaryMouseButtonClicked()) || prevMouseOn == null)
|
||||
if ((!PlayerInput.PrimaryMouseButtonHeld() && !PlayerInput.PrimaryMouseButtonClicked()) || (prevMouseOn == null && !PlayerInput.SecondaryMouseButtonHeld()))
|
||||
{
|
||||
for (var i = updateList.Count - 1; i > inventoryIndex; i--)
|
||||
{
|
||||
@@ -2454,7 +2454,7 @@ namespace Barotrauma
|
||||
{
|
||||
Submarine sub = Submarine.Loaded.FirstOrDefault(s => s.ID == subId);
|
||||
|
||||
var newMessage = new GUIMessage(message, color, pos, velocity, lifeTime, Alignment.Center, LargeFont, sub: sub);
|
||||
var newMessage = new GUIMessage(message, color, pos, velocity, lifeTime, Alignment.Center, Font, sub: sub);
|
||||
if (playSound) { SoundPlayer.PlayUISound(soundType); }
|
||||
bool overlapFound = true;
|
||||
int tries = 0;
|
||||
@@ -2477,8 +2477,7 @@ namespace Barotrauma
|
||||
moveDir = Rand.Vector(1.0f);
|
||||
}
|
||||
moveDir.Y = -Math.Abs(moveDir.Y);
|
||||
newMessage.Pos += moveDir * 20;
|
||||
overlapFound = true;
|
||||
newMessage.Pos -= Vector2.UnitY * 10;
|
||||
}
|
||||
tries++;
|
||||
if (tries > 20) { break; }
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Barotrauma
|
||||
if (BlendState != null)
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(blendState: BlendState, samplerState: GUI.SamplerState);
|
||||
spriteBatch.Begin(blendState: BlendState, samplerState: GUI.SamplerState, rasterizerState: GameMain.ScissorTestEnable);
|
||||
}
|
||||
|
||||
if (style != null)
|
||||
|
||||
@@ -1026,7 +1026,6 @@ namespace Barotrauma
|
||||
ContentBackground.DrawManually(spriteBatch, alsoChildren: false);
|
||||
|
||||
Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;
|
||||
RasterizerState prevRasterizerState = spriteBatch.GraphicsDevice.RasterizerState;
|
||||
if (HideChildrenOutsideFrame)
|
||||
{
|
||||
spriteBatch.End();
|
||||
@@ -1054,7 +1053,7 @@ namespace Barotrauma
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect;
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, samplerState: GUI.SamplerState, rasterizerState: prevRasterizerState);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, samplerState: GUI.SamplerState, rasterizerState: GameMain.ScissorTestEnable);
|
||||
}
|
||||
|
||||
if (ScrollBarVisible)
|
||||
|
||||
@@ -511,5 +511,22 @@ namespace Barotrauma
|
||||
|
||||
targetComponent.ApplyStyle(componentStyle);
|
||||
}
|
||||
|
||||
public Color GetQualityColor(int quality)
|
||||
{
|
||||
switch (quality)
|
||||
{
|
||||
case 1:
|
||||
return ItemQualityColorGood;
|
||||
case 2:
|
||||
return ItemQualityColorExcellent;
|
||||
case 3:
|
||||
return ItemQualityColorMasterwork;
|
||||
case -1:
|
||||
return ItemQualityColorPoor;
|
||||
default:
|
||||
return ItemQualityColorNormal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +444,9 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public virtual void DrawHUD(SpriteBatch spriteBatch, Character character) { }
|
||||
|
||||
public virtual void AddToGUIUpdateList()
|
||||
public virtual void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
GuiFrame?.AddToGUIUpdateList();
|
||||
GuiFrame?.AddToGUIUpdateList(order: order);
|
||||
}
|
||||
|
||||
public virtual void UpdateHUD(Character character, float deltaTime, Camera cam) { }
|
||||
|
||||
@@ -410,13 +410,13 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
public override void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
base.AddToGUIUpdateList();
|
||||
hullInfoFrame.AddToGUIUpdateList(order: 1);
|
||||
base.AddToGUIUpdateList(order);
|
||||
hullInfoFrame.AddToGUIUpdateList(order: order + 1);
|
||||
if (currentMode == MiniMapMode.ItemFinder && searchBar.Selected)
|
||||
{
|
||||
searchAutoComplete.AddToGUIUpdateList(order: 1);
|
||||
searchAutoComplete.AddToGUIUpdateList(order: order + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace Barotrauma.Items.Components
|
||||
currentTarget?.UpdateHUD(cam, character,deltaTime);
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
public override void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
currentTarget?.AddToGUIUpdateList();
|
||||
currentTarget?.AddToGUIUpdateList(order: -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,11 +88,6 @@ namespace Barotrauma.Items.Components
|
||||
return character == Character.Controlled && character == user && character.SelectedConstruction == item;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
GuiFrame?.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
||||
{
|
||||
if (character != Character.Controlled || character != user || character.SelectedConstruction != item) { return; }
|
||||
|
||||
@@ -118,9 +118,9 @@ namespace Barotrauma.Items.Components
|
||||
// This method is overrided instead of the UpdateHUD method because this ensures the input box is selected
|
||||
// even when the terminal component is selected for the very first time. Doing the input box selection in the
|
||||
// UpdateHUD method only selects the input box on every terminal selection except for the very first time.
|
||||
public override void AddToGUIUpdateList()
|
||||
public override void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
base.AddToGUIUpdateList();
|
||||
base.AddToGUIUpdateList(order: order);
|
||||
if (shouldSelectInputBox)
|
||||
{
|
||||
inputBox.Select();
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class Wearable
|
||||
{
|
||||
private void GetDamageModifierText(ref string description, float damageMultiplier, string afflictionIdentifier)
|
||||
private void GetDamageModifierText(ref string description, DamageModifier damageModifier, string afflictionIdentifier)
|
||||
{
|
||||
int roundedValue = (int)Math.Round((1 - damageMultiplier) * 100);
|
||||
int roundedValue = (int)Math.Round((1 - damageModifier.DamageMultiplier * damageModifier.ProbabilityMultiplier) * 100);
|
||||
if (roundedValue == 0) { return; }
|
||||
string colorStr = XMLExtensions.ColorToString(GUI.Style.Green);
|
||||
description += $"\n ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {AfflictionPrefab.List.FirstOrDefault(ap => ap.Identifier.Equals(afflictionIdentifier, StringComparison.OrdinalIgnoreCase))?.Name ?? afflictionIdentifier}";
|
||||
@@ -15,7 +15,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void AddTooltipInfo(ref string name, ref string description)
|
||||
{
|
||||
if (damageModifiers.Any(d => !MathUtils.NearlyEqual(d.DamageMultiplier, 1f)) || SkillModifiers.Any())
|
||||
if (damageModifiers.Any(d => !MathUtils.NearlyEqual(d.DamageMultiplier, 1f) || !MathUtils.NearlyEqual(d.ProbabilityMultiplier, 1f)) || SkillModifiers.Any())
|
||||
{
|
||||
description += "\n";
|
||||
}
|
||||
@@ -31,11 +31,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (string afflictionIdentifier in damageModifier.ParsedAfflictionIdentifiers)
|
||||
{
|
||||
GetDamageModifierText(ref description, damageModifier.DamageMultiplier, afflictionIdentifier);
|
||||
GetDamageModifierText(ref description, damageModifier, afflictionIdentifier);
|
||||
}
|
||||
foreach (string afflictionIdentifier in damageModifier.ParsedAfflictionTypes)
|
||||
{
|
||||
GetDamageModifierText(ref description, damageModifier.DamageMultiplier, afflictionIdentifier);
|
||||
GetDamageModifierText(ref description, damageModifier, afflictionIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +601,10 @@ namespace Barotrauma
|
||||
{
|
||||
var slotRef = new SlotReference(this, slot, slotIndex, isSubSlot, slots[slotIndex].FirstOrDefault()?.GetComponent<ItemContainer>()?.Inventory);
|
||||
if (Screen.Selected is SubEditorScreen editor && !editor.WiringMode && slotRef.ParentInventory is CharacterInventory) { return; }
|
||||
selectedSlot = slotRef;
|
||||
if (CanSelectSlot(slotRef))
|
||||
{
|
||||
selectedSlot = slotRef;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DraggingItems.Any())
|
||||
@@ -1302,39 +1305,46 @@ namespace Barotrauma
|
||||
DraggingItems.Clear();
|
||||
}
|
||||
|
||||
if (selectedSlot != null)
|
||||
if (selectedSlot != null && !CanSelectSlot(selectedSlot))
|
||||
{
|
||||
if (!selectedSlot.Slot.MouseOn())
|
||||
selectedSlot = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool CanSelectSlot(SlotReference selectedSlot)
|
||||
{
|
||||
if (!selectedSlot.Slot.MouseOn())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var rootOwner = (selectedSlot.ParentInventory?.Owner as Item)?.GetRootInventoryOwner();
|
||||
if (selectedSlot.ParentInventory?.Owner != Character.Controlled &&
|
||||
selectedSlot.ParentInventory?.Owner != Character.Controlled.SelectedCharacter &&
|
||||
selectedSlot.ParentInventory?.Owner != Character.Controlled.SelectedConstruction &&
|
||||
!(Character.Controlled.SelectedConstruction?.linkedTo.Contains(selectedSlot.ParentInventory?.Owner) ?? false) &&
|
||||
rootOwner != Character.Controlled &&
|
||||
rootOwner != Character.Controlled.SelectedCharacter &&
|
||||
rootOwner != Character.Controlled.SelectedConstruction &&
|
||||
!(Character.Controlled.SelectedConstruction?.linkedTo.Contains(rootOwner) ?? false))
|
||||
{
|
||||
selectedSlot = null;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
var parentItem = (selectedSlot?.ParentInventory?.Owner as Item) ?? selectedSlot?.Item;
|
||||
if ((parentItem?.GetRootInventoryOwner() is Character ownerCharacter) &&
|
||||
ownerCharacter == Character.Controlled &&
|
||||
CharacterHealth.OpenHealthWindow?.Character != ownerCharacter &&
|
||||
ownerCharacter.Inventory.IsInLimbSlot(parentItem, InvSlotType.HealthInterface))
|
||||
{
|
||||
var rootOwner = (selectedSlot.ParentInventory?.Owner as Item)?.GetRootInventoryOwner();
|
||||
if (selectedSlot.ParentInventory?.Owner != Character.Controlled &&
|
||||
selectedSlot.ParentInventory?.Owner != Character.Controlled.SelectedCharacter &&
|
||||
selectedSlot.ParentInventory?.Owner != Character.Controlled.SelectedConstruction &&
|
||||
!(Character.Controlled.SelectedConstruction?.linkedTo.Contains(selectedSlot.ParentInventory?.Owner) ?? false) &&
|
||||
rootOwner != Character.Controlled &&
|
||||
rootOwner != Character.Controlled.SelectedCharacter &&
|
||||
rootOwner != Character.Controlled.SelectedConstruction &&
|
||||
!(Character.Controlled.SelectedConstruction?.linkedTo.Contains(rootOwner) ?? false))
|
||||
{
|
||||
selectedSlot = null;
|
||||
}
|
||||
var parentItem = (selectedSlot?.ParentInventory?.Owner as Item) ?? selectedSlot?.Item;
|
||||
if ((parentItem?.GetRootInventoryOwner() is Character ownerCharacter) &&
|
||||
ownerCharacter == Character.Controlled &&
|
||||
CharacterHealth.OpenHealthWindow?.Character != ownerCharacter &&
|
||||
ownerCharacter.Inventory.IsInLimbSlot(parentItem, InvSlotType.HealthInterface))
|
||||
{
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Item == parentItem);
|
||||
selectedSlot = null;
|
||||
}
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Item == parentItem);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected static Rectangle GetSubInventoryHoverArea(SlotReference subSlot)
|
||||
{
|
||||
Rectangle hoverArea;
|
||||
@@ -1548,7 +1558,7 @@ namespace Barotrauma
|
||||
var indicatorStyle = GUI.Style.GetComponentStyle("ContainedStateIndicator.Default");
|
||||
Sprite indicatorSprite = indicatorStyle?.GetDefaultSprite();
|
||||
Sprite emptyIndicatorSprite = indicatorStyle?.GetSprite(GUIComponent.ComponentState.Hover);
|
||||
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, conditionIndicatorArea, item.Condition / item.MaxCondition);
|
||||
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, conditionIndicatorArea, item.Condition / item.MaxCondition);
|
||||
}
|
||||
|
||||
if (itemContainer != null && itemContainer.ShowContainedStateIndicator)
|
||||
@@ -1591,6 +1601,19 @@ namespace Barotrauma
|
||||
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, containedIndicatorArea, containedState,
|
||||
pulsate: !usingDefaultSprite && containedState >= 0.0f && containedState < 0.25f && inventory == Character.Controlled?.Inventory && Character.Controlled.HasEquippedItem(item));
|
||||
}
|
||||
|
||||
if (item.Quality != 0)
|
||||
{
|
||||
var style = GUI.Style.GetComponentStyle("InnerGlowSmall");
|
||||
if (style == null)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, rect, GUI.Style.GetQualityColor(item.Quality) * 0.7f);
|
||||
}
|
||||
else
|
||||
{
|
||||
style.Sprites[GUIComponent.ComponentState.None].FirstOrDefault()?.Draw(spriteBatch, rect, GUI.Style.GetQualityColor(item.Quality) * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1199,7 +1199,7 @@ namespace Barotrauma
|
||||
return texts;
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
public override void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
if (Screen.Selected is SubEditorScreen)
|
||||
{
|
||||
@@ -1231,7 +1231,7 @@ namespace Barotrauma
|
||||
bool wasUsingAlternativeLayout = ic.UseAlternativeLayout;
|
||||
ic.UseAlternativeLayout = useAlternativeLayout;
|
||||
needsLayoutUpdate |= ic.UseAlternativeLayout != wasUsingAlternativeLayout;
|
||||
ic.AddToGUIUpdateList();
|
||||
ic.AddToGUIUpdateList(order);
|
||||
}
|
||||
|
||||
if (itemInUseWarning != null && itemInUseWarning.Visible)
|
||||
|
||||
@@ -1021,9 +1021,9 @@ namespace Barotrauma
|
||||
return newEntities;
|
||||
}
|
||||
|
||||
public virtual void AddToGUIUpdateList()
|
||||
public virtual void AddToGUIUpdateList(int order = 0)
|
||||
{
|
||||
if (editingHUD != null && editingHUD.UserData == this) editingHUD.AddToGUIUpdateList();
|
||||
if (editingHUD != null && editingHUD.UserData == this) { editingHUD.AddToGUIUpdateList(order: order); }
|
||||
}
|
||||
|
||||
public virtual void UpdateEditing(Camera cam, float deltaTime) { }
|
||||
|
||||
+6
-5
@@ -497,7 +497,6 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
if (PlayerInput.KeyHit(InputType.Run))
|
||||
{
|
||||
// TODO: refactor this horrible hacky index manipulation mess
|
||||
int index = 0;
|
||||
bool isSwimming = character.AnimController.ForceSelectAnimationType == AnimationType.SwimFast || character.AnimController.ForceSelectAnimationType == AnimationType.SwimSlow;
|
||||
bool isMovingFast = character.AnimController.ForceSelectAnimationType == AnimationType.Run || character.AnimController.ForceSelectAnimationType == AnimationType.SwimFast;
|
||||
@@ -505,23 +504,25 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
if (isSwimming || !character.AnimController.CanWalk)
|
||||
{
|
||||
index = !character.AnimController.CanWalk ? 0 : (int)AnimationType.SwimSlow - 1;
|
||||
index = !character.AnimController.CanWalk ? (int)AnimationType.SwimFast : (int)AnimationType.SwimSlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = (int)AnimationType.Walk - 1;
|
||||
index = (int)AnimationType.Walk;
|
||||
}
|
||||
index -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSwimming || !character.AnimController.CanWalk)
|
||||
{
|
||||
index = !character.AnimController.CanWalk ? 1 : (int)AnimationType.SwimFast - 1;
|
||||
index = !character.AnimController.CanWalk ? (int)AnimationType.SwimSlow : (int)AnimationType.SwimFast;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = (int)AnimationType.Run - 1;
|
||||
index = (int)AnimationType.Run;
|
||||
}
|
||||
index -= 1;
|
||||
}
|
||||
if (animSelection.SelectedIndex != index)
|
||||
{
|
||||
|
||||
@@ -92,8 +92,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (GameMain.GameSession != null) GameMain.GameSession.AddToGUIUpdateList();
|
||||
|
||||
GameMain.GameSession?.AddToGUIUpdateList();
|
||||
Character.AddAllToGUIUpdateList();
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ namespace Barotrauma
|
||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
||||
{
|
||||
if (Submarine.MainSubs[i] == null) continue;
|
||||
if (Level.Loaded != null && Submarine.MainSubs[i].WorldPosition.Y < Level.MaxEntityDepth) continue;
|
||||
if (Level.Loaded != null && Submarine.MainSubs[i].WorldPosition.Y < Level.MaxEntityDepth) { continue; }
|
||||
|
||||
Vector2 position = Submarine.MainSubs[i].SubBody != null ? Submarine.MainSubs[i].WorldPosition : Submarine.MainSubs[i].HiddenSubPosition;
|
||||
|
||||
@@ -151,6 +150,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (!GUI.DisableHUD)
|
||||
{
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
c.DrawGUIMessages(spriteBatch, cam);
|
||||
}
|
||||
}
|
||||
|
||||
GUI.Draw(cam, spriteBatch);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -1737,9 +1737,10 @@ namespace Barotrauma
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), TextManager.GetWithVariable("startingequipmentname", "[number]", (variant + 1).ToString()), font: GUI.SubHeadingFont, textAlignment: Alignment.Center);
|
||||
|
||||
var itemIdentifiers = jobPrefab.ItemIdentifiers[variant]
|
||||
.Distinct()
|
||||
.Where(id => jobPrefab.ShowItemPreview[variant][id]);
|
||||
var itemIdentifiers = jobPrefab.PreviewItems[variant]
|
||||
.Where(it => it.ShowPreview)
|
||||
.Select(it => it.ItemIdentifier)
|
||||
.Distinct();
|
||||
|
||||
int itemsPerRow = 5;
|
||||
int rows = (int)Math.Max(Math.Ceiling(itemIdentifiers.Count() / (float)itemsPerRow), 1);
|
||||
@@ -2624,9 +2625,10 @@ namespace Barotrauma
|
||||
|
||||
private void DrawJobVariantItems(SpriteBatch spriteBatch, GUICustomComponent component, Pair<JobPrefab, int> jobPrefab, int itemsPerRow)
|
||||
{
|
||||
var itemIdentifiers = jobPrefab.First.ItemIdentifiers[jobPrefab.Second]
|
||||
.Distinct()
|
||||
.Where(id => jobPrefab.First.ShowItemPreview[jobPrefab.Second][id]);
|
||||
var itemIdentifiers = jobPrefab.First.PreviewItems[jobPrefab.Second]
|
||||
.Where(it => it.ShowPreview)
|
||||
.Select(it => it.ItemIdentifier)
|
||||
.Distinct();
|
||||
|
||||
Point slotSize = new Point(component.Rect.Height);
|
||||
int spacing = (int)(5 * GUI.Scale);
|
||||
@@ -2645,7 +2647,7 @@ namespace Barotrauma
|
||||
int i = 0;
|
||||
Rectangle tooltipRect = Rectangle.Empty;
|
||||
string tooltip = null;
|
||||
foreach (string itemIdentifier in itemIdentifiers)
|
||||
foreach (var itemIdentifier in itemIdentifiers)
|
||||
{
|
||||
if (!(MapEntityPrefab.Find(null, identifier: itemIdentifier, showErrorMessages: false) is ItemPrefab itemPrefab)) { continue; }
|
||||
|
||||
@@ -2664,7 +2666,7 @@ namespace Barotrauma
|
||||
float iconScale = Math.Min(Math.Min(slotSize.X / icon.size.X, slotSize.Y / icon.size.Y), 2.0f) * 0.9f;
|
||||
icon.Draw(spriteBatch, slotPos + slotSize.ToVector2() * 0.5f, scale: iconScale);
|
||||
|
||||
int count = jobPrefab.First.ItemIdentifiers[jobPrefab.Second].Count(id => id == itemIdentifier);
|
||||
int count = jobPrefab.First.PreviewItems[jobPrefab.Second].Count(it => it.ShowPreview && it.ItemIdentifier == itemIdentifier);
|
||||
if (count > 1)
|
||||
{
|
||||
string itemCountText = "x" + count;
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Sprite \"" + file + "\" not found!");
|
||||
DebugConsole.ThrowError($"Sprite \"{file}\" not found! {Environment.StackTrace.CleanupStackTrace()}");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user