Skip to content

Commit

Permalink
(7ee8dbc11) v0.9.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Regalis11 committed Mar 31, 2020
1 parent 3e99a49 commit b647059
Show file tree
Hide file tree
Showing 147 changed files with 2,294 additions and 1,292 deletions.
6 changes: 0 additions & 6 deletions Barotrauma/BarotraumaClient/ClientCode.shproj.user

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ partial class AITarget

public void Draw(SpriteBatch spriteBatch)
{
if (!ShowAITargets) return;
if (!ShowAITargets) { return; }
var pos = new Vector2(WorldPosition.X, -WorldPosition.Y);
if (soundRange > 0.0f)
{
Expand Down Expand Up @@ -43,7 +43,7 @@ public void Draw(SpriteBatch spriteBatch)
}
else
{
color = Color.WhiteSmoke;
//color = Color.WhiteSmoke;
// disable the indicators for structures, because they clutter the debug view
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void DebugDraw(SpriteBatch spriteBatch)
if (State == AIState.Idle && PreviousState == AIState.Attack)
{
var target = _selectedAiTarget ?? _lastAiTarget;
if (target != null)
if (target != null && target.Entity != null)
{
var memory = GetTargetMemory(target);
Vector2 targetPos = memory.Location;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ partial class HumanAIController : AIController
}*/
}

partial void SetOrderProjSpecific(Order order, string option)
{
GameMain.GameSession.CrewManager.DisplayCharacterOrder(Character, order, option);
}

public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
Vector2 pos = Character.WorldPosition;
Expand All @@ -40,7 +35,7 @@ public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spri
var currentOrder = ObjectiveManager.CurrentOrder;
if (currentOrder != null)
{
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
else if (ObjectiveManager.WaitTimer > 0)
{
Expand All @@ -51,17 +46,17 @@ public override void DebugDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spri
{
if (currentOrder == null)
{
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
var subObjective = currentObjective.SubObjectives.FirstOrDefault();
var subObjective = currentObjective.CurrentSubObjective;
if (subObjective != null)
{
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
var activeObjective = ObjectiveManager.GetActiveObjective();
if (activeObjective != null)
{
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,7 @@ public void DoVisibilityCheck(Camera cam)

public void Draw(SpriteBatch spriteBatch, Camera cam)
{
if (!Enabled) return;

if (!Enabled) { return; }
AnimController.Draw(spriteBatch, cam);
}

Expand All @@ -656,8 +655,6 @@ public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
if (GameMain.DebugDraw)
{
AnimController.DebugDraw(spriteBatch);

if (aiTarget != null) aiTarget.Draw(spriteBatch);
}

if (GUI.DisableHUD) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static void Update(float deltaTime, Character character, Camera cam)

if (!character.IsUnconscious && character.Stun <= 0.0f)
{
if (character.Info != null && !character.ShouldLockHud())
if (character.Info != null && !character.ShouldLockHud() && character.SelectedCharacter == null)
{
bool mouseOnPortrait = HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition) && GUI.MouseOn == null;
if (mouseOnPortrait && PlayerInput.PrimaryMouseButtonClicked())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ namespace Barotrauma
{
partial class AfflictionHusk : Affliction
{
partial void UpdateMessages(float prevStrength, Character character)
partial void UpdateMessages()
{
if (Strength < Prefab.MaxStrength * 0.5f)
switch (State)
{
if (prevStrength % 10.0f > 0.05f && Strength % 10.0f < 0.05f)
{
case InfectionState.Dormant:
GUI.AddMessage(TextManager.Get("HuskDormant"), GUI.Style.Red);
}
}
else if (Strength < Prefab.MaxStrength)
{
if (state == InfectionState.Dormant && Character.Controlled == character)
{
break;
case InfectionState.Transition:
GUI.AddMessage(TextManager.Get("HuskCantSpeak"), GUI.Style.Red);
}
}
else if (state != InfectionState.Active && Character.Controlled == character)
{
GUI.AddMessage(TextManager.GetWithVariable("HuskActivate", "[Attack]", GameMain.Config.KeyBindText(InputType.Attack)),
GUI.Style.Red);
break;
case InfectionState.Active:
if (character.Params.UseHuskAppendage)
{
GUI.AddMessage(TextManager.GetWithVariable("HuskActivate", "[Attack]", GameMain.Config.KeyBindText(InputType.Attack)), GUI.Style.Red);
}
break;
case InfectionState.Final:
default:
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static IEnumerable<HeartratePosition> ScaleAndDisplace(IEnumerable<Heartr
private List<HeartratePosition> heartratePositions;
private float currentHeartrateTime;
private float heartbeatTimer;
private Texture2D heartrateFade;
private static Texture2D heartrateFade;

private readonly HeartratePosition[] heartbeatPattern =
{
Expand Down Expand Up @@ -478,7 +478,7 @@ private Point healthBarSize

cprFrame = new GUIFrame(new RectTransform(new Vector2(0.7f, 1.0f), cprLayout.RectTransform), style: "GUIFrameListBox");

heartrateFade = TextureLoader.FromFile("Content/UI/Health/HeartrateFade.png");
heartrateFade ??= TextureLoader.FromFile("Content/UI/Health/HeartrateFade.png");

new GUICustomComponent(new RectTransform(Vector2.One * 0.95f, cprFrame.RectTransform, Anchor.Center), DrawHeartrate, UpdateHeartrate);

Expand Down Expand Up @@ -816,9 +816,7 @@ public void UpdateHUD(float deltaTime)
if (highlightedLimbIndex < 0 && selectedLimbIndex < 0)
{
// If no limb is selected or highlighted, select the one with the most critical afflictions.
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
.OrderByDescending(a => a.DamagePerSecond)
.ThenByDescending(a => a.Strength).FirstOrDefault();
var affliction = SortAfflictionsBySeverity(GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)).FirstOrDefault();
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
{
var limbHealth = GetMatchingLimbHealth(affliction);
Expand Down Expand Up @@ -1185,7 +1183,8 @@ private void CreateAfflictionInfos(IEnumerable<Affliction> afflictions)
Dictionary<string, float> treatmentSuitability = new Dictionary<string, float>();
GetSuitableTreatments(treatmentSuitability, normalize: true, randomization: randomVariance);

Affliction mostSevereAffliction = afflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !afflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? afflictions.FirstOrDefault();
//Affliction mostSevereAffliction = afflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !afflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? afflictions.FirstOrDefault();
Affliction mostSevereAffliction = SortAfflictionsBySeverity(afflictions).FirstOrDefault();
GUIButton buttonToSelect = null;

foreach (Affliction affliction in afflictions)
Expand Down Expand Up @@ -1811,8 +1810,8 @@ private void DrawHealthWindow(SpriteBatch spriteBatch, Rectangle drawArea, bool
float iconScale = 0.25f * scale;
Vector2 iconPos = highlightArea.Center.ToVector2();

Affliction mostSevereAffliction = thisAfflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !thisAfflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? thisAfflictions.FirstOrDefault();

//Affliction mostSevereAffliction = thisAfflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !thisAfflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? thisAfflictions.FirstOrDefault();
Affliction mostSevereAffliction = SortAfflictionsBySeverity(thisAfflictions).FirstOrDefault();
if (mostSevereAffliction != null) { DrawLimbAfflictionIcon(spriteBatch, mostSevereAffliction, iconScale, ref iconPos); }

if (thisAfflictions.Count() > 1)
Expand Down Expand Up @@ -1992,6 +1991,9 @@ public void ClientRead(IReadMessage inc)
}
}

medUIExtra?.Remove();
medUIExtra = null;

limbIndicatorOverlay?.Remove();
limbIndicatorOverlay = null;
}
Expand Down
14 changes: 11 additions & 3 deletions Barotrauma/BarotraumaClient/ClientSource/Characters/Limb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,18 @@ public bool EnableHuskSprite
}
set
{
if (HuskSprite != null && value != enableHuskSprite)
if (enableHuskSprite == value) { return; }
enableHuskSprite = value;
if (enableHuskSprite)
{
if (HuskSprite == null)
{
LoadHuskSprite();
}
}
if (HuskSprite != null)
{
if (value)
if (enableHuskSprite)
{
List<WearableSprite> otherWearablesWithHusk = new List<WearableSprite>() { HuskSprite };
otherWearablesWithHusk.AddRange(OtherWearables);
Expand All @@ -235,7 +244,6 @@ public bool EnableHuskSprite
UpdateWearableTypesToHide();
}
}
enableHuskSprite = value;
}
}

Expand Down
34 changes: 34 additions & 0 deletions Barotrauma/BarotraumaClient/ClientSource/DebugConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,34 @@ public static void Toggle()
}
}

private static bool IsCommandPermitted(string command, GameClient client)
{
switch (command)
{
case "kick":
return client.HasPermission(ClientPermissions.Kick);
case "ban":
case "banip":
case "banendpoint":
return client.HasPermission(ClientPermissions.Ban);
case "unban":
case "unbanip":
return client.HasPermission(ClientPermissions.Unban);
case "netstats":
case "help":
case "dumpids":
case "admin":
case "entitylist":
case "togglehud":
case "toggleupperhud":
case "togglecharacternames":
case "fpscounter":
return true;
default:
return client.HasConsoleCommandPermission(command);
}
}

public static void DequeueMessages()
{
while (queuedMessages.Count > 0)
Expand Down Expand Up @@ -367,6 +395,7 @@ private static void InitProjectSpecific()
NewMessage("Steam achievements have been disabled during this play session.", Color.Red);
#endif
}));
AssignRelayToServer("enablecheats", true);

commands.Add(new Command("mainmenu|menu", "mainmenu/menu: Go to the main menu.", (string[] args) =>
{
Expand Down Expand Up @@ -2113,6 +2142,11 @@ private static void InitProjectSpecific()

commands.Add(new Command("flipx", "flipx: mirror the main submarine horizontally", (string[] args) =>
{
if (GameMain.NetworkMember != null)
{
ThrowError("Cannot use the flipx command while playing online.");
return;
}
Submarine.MainSub?.FlipX();
}, isCheat: true));

Expand Down
42 changes: 26 additions & 16 deletions Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,31 +135,33 @@ public bool TypingChatMessage(GUITextBox textBox, string text)
}
}

Color textColor = textBox.Color;
switch (command)
{
case "r":
case "radio":
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Radio];
textColor = ChatMessage.MessageColor[(int)ChatMessageType.Radio];
break;
case "d":
case "dead":
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
textColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
break;
default:
if (Character.Controlled != null && (Character.Controlled.IsDead || Character.Controlled.SpeechImpediment >= 100.0f))
{
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
textColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
}
else if (command != "") //PMing
{
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Private];
textColor = ChatMessage.MessageColor[(int)ChatMessageType.Private];
}
else
{
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
textColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
}
break;
}
textBox.TextColor = textBox.TextBlock.SelectedTextColor = textColor;

return true;
}
Expand Down Expand Up @@ -252,21 +254,29 @@ void Recalculate()
Visible = false,
CanBeFocused = false
};
var senderText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), popupMsg.RectTransform, Anchor.TopRight),
senderName, textColor: senderColor, font: GUI.SmallFont, textAlignment: Alignment.TopRight)
var content = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), popupMsg.RectTransform, Anchor.Center));
Vector2 senderTextSize = Vector2.Zero;
if (!string.IsNullOrEmpty(senderName))
{
CanBeFocused = false
};
var msgPopupText = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.0f), popupMsg.RectTransform, Anchor.TopRight)
{ AbsoluteOffset = new Point(0, senderText.Rect.Height) },
displayedText, textColor: message.Color, font: GUI.SmallFont, textAlignment: Alignment.TopRight, style: null, wrap: true)
var senderText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform),
senderName, textColor: senderColor, style: null, font: GUI.SmallFont)
{
CanBeFocused = false
};
senderTextSize = senderText.Font.MeasureString(senderText.WrappedText);
senderText.RectTransform.MinSize = new Point(0, senderText.Rect.Height);
}
var msgPopupText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform),
displayedText, textColor: message.Color, font: GUI.SmallFont, textAlignment: Alignment.BottomLeft, style: null, wrap: true)
{
CanBeFocused = false
};
int textWidth = (int)Math.Max(
msgPopupText.Font.MeasureString(msgPopupText.WrappedText).X,
senderText.Font.MeasureString(senderText.WrappedText).X);
popupMsg.RectTransform.Resize(new Point(textWidth + 20, msgPopupText.Rect.Bottom - senderText.Rect.Y), resizeChildren: false);
msgPopupText.RectTransform.MinSize = new Point(0, msgPopupText.Rect.Height);
Vector2 msgSize = msgPopupText.Font.MeasureString(msgPopupText.WrappedText);
int textWidth = (int)Math.Max(msgSize.X + msgPopupText.Padding.X + msgPopupText.Padding.Z, senderTextSize.X) + 10;
popupMsg.RectTransform.Resize(new Point((int)(textWidth / content.RectTransform.RelativeSize.X) , (int)((senderTextSize.Y + msgSize.Y) / content.RectTransform.RelativeSize.Y)), resizeChildren: true);
popupMsg.RectTransform.IsFixedSize = true;
content.Recalculate();
popupMessages.Enqueue(popupMsg);
}

Expand Down
10 changes: 0 additions & 10 deletions Barotrauma/BarotraumaClient/ClientSource/GUI/ComponentStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@

namespace Barotrauma
{
public enum TransitionMode
{
Linear,
Smooth,
Smoother,
EaseIn,
EaseOut,
Exponential
}

public enum SpriteFallBackState
{
None,
Expand Down
Loading

0 comments on commit b647059

Please sign in to comment.