(ad567dea) v0.9.7.1
This commit is contained in:
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,6 +1,9 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Found a bug? Help us squash it by making a bug report!
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
@@ -13,8 +16,7 @@ A clear and concise description of what the bug is.
|
||||
If possible, describe how the developers can reproduce the issue. It is often extremely hard to fix a bug if we don't know how to make it happen.
|
||||
|
||||
**Version**
|
||||
Which version of the game did the bug happen in. You can see the version number at the bottom left corner of the main menu, and in a file called "Version.txt" inside the game folder.
|
||||
Also, please include the operating system you're using (Windows/Linux/Mac).
|
||||
Which version of the game did the bug happen in. Also, please include the operating system you're using (Windows/Linux/Mac).
|
||||
|
||||
**Additional information**
|
||||
Add any other context about the problem here.
|
||||
|
||||
@@ -335,8 +335,7 @@ namespace Barotrauma
|
||||
//an ad-hoc way of allowing the players to have roughly the same maximum view distance regardless of the resolution,
|
||||
//while still keeping the zoom around 1.0 when not looking further away (because otherwise we'd always be downsampling
|
||||
//on lower resolutions, which doesn't look that good)
|
||||
float newZoom = MathHelper.Lerp(unscaledZoom, scaledZoom,
|
||||
(GameMain.Config == null || GameMain.Config.EnableMouseLook) ? (float)Math.Sqrt(zoomOutAmount) : 0.3f);
|
||||
float newZoom = MathHelper.Lerp(unscaledZoom, scaledZoom, (float)Math.Sqrt(zoomOutAmount));
|
||||
|
||||
Zoom += (newZoom - zoom) / ZoomSmoothness;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!ShowAITargets) { return; }
|
||||
if (!ShowAITargets) return;
|
||||
var pos = new Vector2(WorldPosition.X, -WorldPosition.Y);
|
||||
if (soundRange > 0.0f)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
//color = Color.WhiteSmoke;
|
||||
color = Color.WhiteSmoke;
|
||||
// disable the indicators for structures, because they clutter the debug view
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma
|
||||
if (State == AIState.Idle && PreviousState == AIState.Attack)
|
||||
{
|
||||
var target = _selectedAiTarget ?? _lastAiTarget;
|
||||
if (target != null && target.Entity != null)
|
||||
if (target != null)
|
||||
{
|
||||
var memory = GetTargetMemory(target);
|
||||
Vector2 targetPos = memory.Location;
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace Barotrauma
|
||||
}*/
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -35,7 +40,7 @@ namespace Barotrauma
|
||||
var currentOrder = ObjectiveManager.CurrentOrder;
|
||||
if (currentOrder != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"ORDER: {currentOrder.DebugTag} ({currentOrder.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
else if (ObjectiveManager.WaitTimer > 0)
|
||||
{
|
||||
@@ -46,17 +51,17 @@ namespace Barotrauma
|
||||
{
|
||||
if (currentOrder == null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 20), $"MAIN OBJECTIVE: {currentObjective.DebugTag} ({currentObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
var subObjective = currentObjective.CurrentSubObjective;
|
||||
var subObjective = currentObjective.SubObjectives.FirstOrDefault();
|
||||
if (subObjective != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 40), $"SUBOBJECTIVE: {subObjective.DebugTag} ({subObjective.GetPriority().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.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
GUI.DrawString(spriteBatch, pos + textOffset + new Vector2(0, 60), $"ACTIVE OBJECTIVE: {activeObjective.DebugTag} ({activeObjective.GetPriority().FormatZeroDecimal()})", Color.White, Color.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,11 +603,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
partial void SetOrderProjSpecific(Order order, string orderOption)
|
||||
{
|
||||
GameMain.GameSession?.CrewManager?.DisplayCharacterOrder(this, order, orderOption);
|
||||
}
|
||||
|
||||
public static void AddAllToGUIUpdateList()
|
||||
{
|
||||
for (int i = 0; i < CharacterList.Count; i++)
|
||||
@@ -643,7 +638,8 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (!Enabled) { return; }
|
||||
if (!Enabled) return;
|
||||
|
||||
AnimController.Draw(spriteBatch, cam);
|
||||
}
|
||||
|
||||
@@ -660,6 +656,8 @@ namespace Barotrauma
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
AnimController.DebugDraw(spriteBatch);
|
||||
|
||||
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
if (GUI.DisableHUD) return;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Barotrauma
|
||||
|
||||
if (!character.IsUnconscious && character.Stun <= 0.0f)
|
||||
{
|
||||
if (character.Info != null && !character.ShouldLockHud() && character.SelectedCharacter == null)
|
||||
if (character.Info != null && !character.ShouldLockHud())
|
||||
{
|
||||
bool mouseOnPortrait = HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition) && GUI.MouseOn == null;
|
||||
if (mouseOnPortrait && PlayerInput.PrimaryMouseButtonClicked())
|
||||
@@ -309,7 +309,7 @@ namespace Barotrauma
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Y + HUDLayoutSettings.BottomRightInfoArea.Height * 0.1f),
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Width / 2),
|
||||
(int)(HUDLayoutSettings.BottomRightInfoArea.Height * 0.7f)));
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), new Vector2(-12 * GUI.Scale, 4 * GUI.Scale), targetWidth: HUDLayoutSettings.PortraitArea.Width, true);
|
||||
character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(), new Vector2((int)(-4 * GUI.Scale), (int)(2 * GUI.Scale)), targetWidth: HUDLayoutSettings.PortraitArea.Width, true);
|
||||
}
|
||||
mouseOnPortrait = HUDLayoutSettings.BottomRightInfoArea.Contains(PlayerInput.MousePosition) && !character.ShouldLockHud();
|
||||
if (mouseOnPortrait)
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace Barotrauma
|
||||
{
|
||||
partial class CharacterInfo
|
||||
{
|
||||
public const float BgScale = 1.2f;
|
||||
private static Sprite infoAreaPortraitBG;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
infoAreaPortraitBG = GUI.Style.GetComponentStyle("InfoAreaPortraitBG")?.Sprites[GUIComponent.ComponentState.None][0].Sprite;
|
||||
new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
infoAreaPortraitBG = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(833, 298, 142, 98), null, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,6 @@ namespace Barotrauma
|
||||
|
||||
public void DrawBackground(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (infoAreaPortraitBG == null) { return; }
|
||||
infoAreaPortraitBG.Draw(spriteBatch, HUDLayoutSettings.BottomRightInfoArea.Location.ToVector2(), Color.White, Vector2.Zero, 0.0f,
|
||||
scale: new Vector2(
|
||||
HUDLayoutSettings.BottomRightInfoArea.Width / (float)infoAreaPortraitBG.SourceRect.Width,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -385,37 +384,6 @@ namespace Barotrauma
|
||||
character = Create(speciesName, position, seed, info, GameMain.Client.ID != ownerId, hasAi);
|
||||
character.ID = id;
|
||||
character.TeamID = (TeamType)teamID;
|
||||
|
||||
// Check if the character has a current order
|
||||
if (inc.ReadBoolean())
|
||||
{
|
||||
int orderPrefabIndex = inc.ReadByte();
|
||||
Entity targetEntity = FindEntityByID(inc.ReadUInt16());
|
||||
Character orderGiver = inc.ReadBoolean() ? FindEntityByID(inc.ReadUInt16()) as Character : null;
|
||||
int orderOptionIndex = inc.ReadByte();
|
||||
|
||||
if (orderPrefabIndex >= 0 && orderPrefabIndex < Order.PrefabList.Count)
|
||||
{
|
||||
var orderPrefab = Order.PrefabList[orderPrefabIndex];
|
||||
if ((orderPrefab.ItemComponentType == null && orderPrefab.ItemIdentifiers.None()) ||
|
||||
(targetEntity != null && (targetEntity as Item).Components.Any(c => c?.GetType() == orderPrefab.ItemComponentType)))
|
||||
{
|
||||
character.SetOrder(
|
||||
new Order(orderPrefab, targetEntity, (targetEntity as Item)?.Components.FirstOrDefault(c => c?.GetType() == orderPrefab.ItemComponentType), orderGiver: orderGiver),
|
||||
orderOptionIndex >= 0 && orderOptionIndex < orderPrefab.Options.Length ? orderPrefab.Options[orderOptionIndex] : null,
|
||||
orderGiver, speak: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Could not set order \"" + orderPrefab.Identifier + "\" for character \"" + character.Name + "\" because required target entity was not found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Invalid order prefab index - index (" + orderPrefabIndex + ") out of bounds.");
|
||||
}
|
||||
}
|
||||
|
||||
bool containsStatusData = inc.ReadBoolean();
|
||||
if (containsStatusData)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Barotrauma
|
||||
|
||||
public SoundType Type => Params.State;
|
||||
public Gender Gender => Params.Gender;
|
||||
public float Volume => roundSound == null ? 0.0f : roundSound.Volume;
|
||||
public float Range => roundSound == null ? 0.0f : roundSound.Range;
|
||||
public float Volume => roundSound.Volume;
|
||||
public float Range => roundSound.Range;
|
||||
public Sound Sound => roundSound?.Sound;
|
||||
|
||||
public CharacterSound(CharacterParams.SoundParams soundParams)
|
||||
|
||||
@@ -246,13 +246,11 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private GUIFrame healthBarHolder;
|
||||
|
||||
private Point healthBarOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
// 0.38775510204f = percentage of offset before reaching the healthbar portion of the graphic going from bottom upwards
|
||||
return new Point(2, (int)(HUDLayoutSettings.HealthBarArea.Size.Y * 0.38775510204f));
|
||||
return new Point(5 - (int)Math.Ceiling(1 - 1 * GUI.Scale), (int)Math.Min(Math.Ceiling(17 * GUI.Scale), 20));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +258,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point((int)Math.Ceiling(HUDLayoutSettings.HealthBarArea.Size.X - 45 * GUI.Scale), (int)(healthBarHolder.Rect.Height - Math.Min(23 * GUI.Scale, 25)) / 2);
|
||||
return new Point(healthBarHolder.Rect.Width - (int)Math.Ceiling(Math.Min(46 * GUI.Scale, 53)), (int)(healthBarHolder.Rect.Height - Math.Min(23 * GUI.Scale, 25)) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +303,7 @@ namespace Barotrauma
|
||||
healthShadowSize = 1.0f;
|
||||
|
||||
healthBar = new GUIProgressBar(new RectTransform(healthBarSize, healthBarHolder.RectTransform, Anchor.BottomRight),
|
||||
barSize: 1.0f, color: GUI.Style.HealthBarColorHigh, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
barSize: 1.0f, color: GUIColorSettings.HealthBarColorHigh, style: horizontal ? "CharacterHealthBarSlider" : "GUIProgressBarVertical", showFrame: false)
|
||||
{
|
||||
HoverCursor = CursorState.Hand,
|
||||
Enabled = true,
|
||||
@@ -522,10 +520,8 @@ namespace Barotrauma
|
||||
|
||||
UpdateAlignment();
|
||||
|
||||
suicideButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
{
|
||||
MinSize = new Point(150, 20), RelativeOffset = new Vector2(0.0f, 0.01f)
|
||||
},
|
||||
suicideButton = new GUIButton(new RectTransform(new Vector2(0.06f, 0.02f), GUI.Canvas, Anchor.TopCenter)
|
||||
{ MinSize = new Point(150, 20), RelativeOffset = new Vector2(0.0f, 0.01f) },
|
||||
TextManager.Get("GiveInButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer"),
|
||||
@@ -820,7 +816,9 @@ namespace Barotrauma
|
||||
if (highlightedLimbIndex < 0 && selectedLimbIndex < 0)
|
||||
{
|
||||
// If no limb is selected or highlighted, select the one with the most critical afflictions.
|
||||
var affliction = SortAfflictionsBySeverity(GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)).FirstOrDefault();
|
||||
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
|
||||
.OrderByDescending(a => a.DamagePerSecond)
|
||||
.ThenByDescending(a => a.Strength).FirstOrDefault();
|
||||
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
|
||||
{
|
||||
var limbHealth = GetMatchingLimbHealth(affliction);
|
||||
@@ -851,7 +849,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(DisplayedVitality / MaxVitality, GUI.Style.HealthBarColorLow, GUI.Style.HealthBarColorMedium, GUI.Style.HealthBarColorHigh);
|
||||
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(DisplayedVitality / MaxVitality, GUIColorSettings.HealthBarColorLow, GUIColorSettings.HealthBarColorMedium, GUIColorSettings.HealthBarColorHigh);
|
||||
healthBar.HoverColor = healthWindowHealthBar.HoverColor = healthBar.Color * 2.0f;
|
||||
healthBar.BarSize = healthWindowHealthBar.BarSize =
|
||||
(DisplayedVitality > 0.0f) ?
|
||||
@@ -1136,11 +1134,11 @@ namespace Barotrauma
|
||||
{
|
||||
if (prefab.IsBuff)
|
||||
{
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUI.Style.BuffColorLow, GUI.Style.BuffColorMedium, GUI.Style.BuffColorHigh);
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUIColorSettings.BuffColorLow, GUIColorSettings.BuffColorMedium, GUIColorSettings.BuffColorHigh);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUI.Style.DebuffColorLow, GUI.Style.DebuffColorMedium, GUI.Style.DebuffColorHigh);
|
||||
return ToolBox.GradientLerp(affliction.Strength / prefab.MaxStrength, GUIColorSettings.DebuffColorLow, GUIColorSettings.DebuffColorMedium, GUIColorSettings.DebuffColorHigh);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1187,8 +1185,7 @@ namespace Barotrauma
|
||||
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 = SortAfflictionsBySeverity(afflictions).FirstOrDefault();
|
||||
Affliction mostSevereAffliction = afflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !afflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? afflictions.FirstOrDefault();
|
||||
GUIButton buttonToSelect = null;
|
||||
|
||||
foreach (Affliction affliction in afflictions)
|
||||
@@ -1814,8 +1811,8 @@ namespace Barotrauma
|
||||
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 = SortAfflictionsBySeverity(thisAfflictions).FirstOrDefault();
|
||||
Affliction mostSevereAffliction = thisAfflictions.FirstOrDefault(a => !a.Prefab.IsBuff && !thisAfflictions.Any(a2 => !a2.Prefab.IsBuff && a2.Strength > a.Strength)) ?? thisAfflictions.FirstOrDefault();
|
||||
|
||||
if (mostSevereAffliction != null) { DrawLimbAfflictionIcon(spriteBatch, mostSevereAffliction, iconScale, ref iconPos); }
|
||||
|
||||
if (thisAfflictions.Count() > 1)
|
||||
|
||||
@@ -440,7 +440,6 @@ namespace Barotrauma
|
||||
AssignRelayToServer("ban", false);
|
||||
AssignRelayToServer("banid", false);
|
||||
AssignRelayToServer("dumpids", false);
|
||||
AssignRelayToServer("dumptofile", false);
|
||||
AssignRelayToServer("findentityids", false);
|
||||
AssignRelayToServer("campaigninfo", false);
|
||||
AssignRelayToServer("help", false);
|
||||
@@ -1058,69 +1057,23 @@ namespace Barotrauma
|
||||
if (args.Length != 2 || Screen.Selected != GameMain.SubEditorScreen) { return; }
|
||||
foreach (MapEntity me in MapEntity.SelectedList)
|
||||
{
|
||||
bool propertyFound = false;
|
||||
if (!(me is ISerializableEntity serializableEntity)) { continue; }
|
||||
if (serializableEntity.SerializableProperties == null) { continue; }
|
||||
|
||||
if (serializableEntity.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty property))
|
||||
if (me is ISerializableEntity serializableEntity)
|
||||
{
|
||||
propertyFound = true;
|
||||
object prevValue = property.GetValue(me);
|
||||
if (property.TrySetValue(me, args[1]))
|
||||
if (serializableEntity.SerializableProperties == null)
|
||||
{
|
||||
NewMessage($"Changed the value \"{args[0]}\" from {(prevValue?.ToString() ?? null)} to {args[1]} on entity \"{me.ToString()}\".", Color.LightGreen);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (!serializableEntity.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty property))
|
||||
{
|
||||
NewMessage($"Failed to set the value of \"{args[0]}\" to \"{args[1]}\" on the entity \"{me.ToString()}\".", Color.Orange);
|
||||
NewMessage("Property \"" + args[0] + "\" not found in the entity \"" + me.ToString() + "\".", Color.Orange);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (me is Item item)
|
||||
{
|
||||
foreach (ItemComponent ic in item.Components)
|
||||
if (!property.TrySetValue(me, args[1]))
|
||||
{
|
||||
ic.SerializableProperties.TryGetValue(args[0].ToLowerInvariant(), out SerializableProperty componentProperty);
|
||||
if (componentProperty == null) { continue; }
|
||||
propertyFound = true;
|
||||
object prevValue = componentProperty.GetValue(ic);
|
||||
if (componentProperty.TrySetValue(ic, args[1]))
|
||||
{
|
||||
NewMessage($"Changed the value \"{args[0]}\" from {prevValue} to {args[1]} on item \"{me.ToString()}\", component \"{ic.GetType().Name}\".", Color.LightGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewMessage($"Failed to set the value of \"{args[0]}\" to \"{args[1]}\" on the item \"{me.ToString()}\", component \"{ic.GetType().Name}\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!propertyFound)
|
||||
{
|
||||
NewMessage($"Property \"{args[0]}\" not found in the entity \"{me.ToString()}\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
List<string> propertyList = new List<string>();
|
||||
foreach (MapEntity me in MapEntity.SelectedList)
|
||||
{
|
||||
if (!(me is ISerializableEntity serializableEntity)) { continue; }
|
||||
if (serializableEntity.SerializableProperties == null) { continue; }
|
||||
propertyList.AddRange(serializableEntity.SerializableProperties.Select(p => p.Key));
|
||||
if (me is Item item)
|
||||
{
|
||||
foreach (ItemComponent ic in item.Components)
|
||||
{
|
||||
propertyList.AddRange(ic.SerializableProperties.Select(p => p.Key));
|
||||
NewMessage("Failed to set the value of \"" + args[0] + "\" to \"" + args[1] + "\" on the entity \"" + me.ToString() + "\".", Color.Orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new string[][]
|
||||
{
|
||||
propertyList.Distinct().ToArray(),
|
||||
new string[0]
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("checkmissingloca", "", (string[] args) =>
|
||||
@@ -2360,7 +2313,7 @@ namespace Barotrauma
|
||||
switch (firstArg)
|
||||
{
|
||||
case "name":
|
||||
var sprites = Sprite.LoadedSprites.Where(s => s.Name != null && s.Name.Equals(secondArg, StringComparison.OrdinalIgnoreCase));
|
||||
var sprites = Sprite.LoadedSprites.Where(s => s.Name?.ToLowerInvariant() == secondArg.ToLowerInvariant());
|
||||
if (sprites.Any())
|
||||
{
|
||||
foreach (var s in sprites)
|
||||
@@ -2376,7 +2329,7 @@ namespace Barotrauma
|
||||
}
|
||||
case "identifier":
|
||||
case "id":
|
||||
sprites = Sprite.LoadedSprites.Where(s => s.EntityID != null && s.EntityID.Equals(secondArg, StringComparison.OrdinalIgnoreCase));
|
||||
sprites = Sprite.LoadedSprites.Where(s => s.EntityID?.ToLowerInvariant() == secondArg.ToLowerInvariant());
|
||||
if (sprites.Any())
|
||||
{
|
||||
foreach (var s in sprites)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("icon", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "icon") { continue; }
|
||||
Icon = new Sprite(subElement);
|
||||
IconColor = subElement.GetAttributeColor("color", Color.White);
|
||||
}
|
||||
|
||||
@@ -252,29 +252,21 @@ namespace Barotrauma
|
||||
Visible = false,
|
||||
CanBeFocused = false
|
||||
};
|
||||
var content = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), popupMsg.RectTransform, Anchor.Center));
|
||||
Vector2 senderTextSize = Vector2.Zero;
|
||||
if (!string.IsNullOrEmpty(senderName))
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
CanBeFocused = 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();
|
||||
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)
|
||||
{
|
||||
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);
|
||||
popupMessages.Enqueue(popupMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Barotrauma
|
||||
Point size = new Point(0, 0);
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("size", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "size") { continue; }
|
||||
Point maxResolution = subElement.GetAttributePoint("maxresolution", new Point(int.MaxValue, int.MaxValue));
|
||||
if (GameMain.GraphicsWidth <= maxResolution.X && GameMain.GraphicsHeight <= maxResolution.Y)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
public class GUIColorSettings
|
||||
{
|
||||
// Inventory
|
||||
public static Color EquipmentSlotIconColor = new Color(99, 70, 64);
|
||||
|
||||
// Health HUD
|
||||
public static Color BuffColorLow = Color.LightGreen;
|
||||
public static Color BuffColorMedium = Color.Green;
|
||||
public static Color BuffColorHigh = Color.DarkGreen;
|
||||
|
||||
public static Color DebuffColorLow = Color.DarkSalmon;
|
||||
public static Color DebuffColorMedium = Color.Red;
|
||||
public static Color DebuffColorHigh = Color.DarkRed;
|
||||
|
||||
public static Color HealthBarColorLow = Color.Red;
|
||||
public static Color HealthBarColorMedium = Color.Orange;
|
||||
public static Color HealthBarColorHigh = new Color(78, 114, 88);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -801,7 +801,8 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("conditional", StringComparison.OrdinalIgnoreCase) && !CheckConditional(subElement))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "conditional" &&
|
||||
!CheckConditional(subElement))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -850,7 +851,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("conditional", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "conditional") { continue; }
|
||||
FromXML(subElement, component is GUIListBox listBox ? listBox.Content.RectTransform : component.RectTransform);
|
||||
}
|
||||
|
||||
@@ -1018,7 +1019,7 @@ namespace Barotrauma
|
||||
|
||||
private static GUIFrame LoadGUIFrame(XElement element, RectTransform parent)
|
||||
{
|
||||
string style = element.GetAttributeString("style", element.Name.ToString().Equals("spacing", StringComparison.OrdinalIgnoreCase) ? null : "");
|
||||
string style = element.GetAttributeString("style", element.Name.ToString().ToLowerInvariant() == "spacing" ? null : "");
|
||||
if (style == "null") { style = null; }
|
||||
return new GUIFrame(RectTransform.Load(element, parent), style: style);
|
||||
}
|
||||
|
||||
@@ -59,36 +59,11 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public Color Blue { get; private set; } = Color.Blue;
|
||||
|
||||
public Color ColorInventoryEmpty { get; private set; } = Color.Red;
|
||||
public Color ColorInventoryHalf { get; private set; } = Color.Orange;
|
||||
public Color ColorInventoryFull { get; private set; } = Color.LightGreen;
|
||||
public Color ColorInventoryBackground { get; private set; } = Color.Gray;
|
||||
|
||||
public Color TextColor { get; private set; } = Color.White * 0.8f;
|
||||
public Color TextColorBright { get; private set; } = Color.White * 0.9f;
|
||||
public Color TextColorDark { get; private set; } = Color.Black * 0.9f;
|
||||
public Color TextColorDim { get; private set; } = Color.White * 0.6f;
|
||||
|
||||
// Inventory
|
||||
public Color EquipmentSlotIconColor { get; private set; } = new Color(99, 70, 64);
|
||||
|
||||
// Health HUD
|
||||
public Color BuffColorLow { get; private set; } = Color.LightGreen;
|
||||
public Color BuffColorMedium { get; private set; } = Color.Green;
|
||||
public Color BuffColorHigh { get; private set; } = Color.DarkGreen;
|
||||
|
||||
public Color DebuffColorLow { get; private set; } = Color.DarkSalmon;
|
||||
public Color DebuffColorMedium { get; private set; } = Color.Red;
|
||||
public Color DebuffColorHigh { get; private set; } = Color.DarkRed;
|
||||
|
||||
public Color HealthBarColorLow { get; private set; } = Color.Red;
|
||||
public Color HealthBarColorMedium { get; private set; } = Color.Orange;
|
||||
public Color HealthBarColorHigh { get; private set; } = new Color(78, 114, 88);
|
||||
|
||||
public Color EquipmentIndicatorNotEquipped { get; private set; } = Color.Gray;
|
||||
public Color EquipmentIndicatorEquipped { get; private set; } = new Color(105, 202, 125);
|
||||
public Color EquipmentIndicatorRunningOut { get; private set; } = new Color(202, 105, 105);
|
||||
|
||||
public static Point ItemFrameMargin => new Point(50, 56).Multiply(GUI.SlicedSpriteScale);
|
||||
public static Point ItemFrameOffset => new Point(0, 3).Multiply(GUI.SlicedSpriteScale);
|
||||
|
||||
@@ -128,22 +103,10 @@ namespace Barotrauma
|
||||
case "blue":
|
||||
Blue = subElement.GetAttributeColor("color", Blue);
|
||||
break;
|
||||
case "colorinventoryempty":
|
||||
ColorInventoryEmpty = subElement.GetAttributeColor("color", ColorInventoryEmpty);
|
||||
break;
|
||||
case "colorinventoryhalf":
|
||||
ColorInventoryHalf = subElement.GetAttributeColor("color", ColorInventoryHalf);
|
||||
break;
|
||||
case "colorinventoryfull":
|
||||
ColorInventoryFull = subElement.GetAttributeColor("color", ColorInventoryFull);
|
||||
break;
|
||||
case "colorinventorybackground":
|
||||
ColorInventoryBackground = subElement.GetAttributeColor("color", ColorInventoryBackground);
|
||||
break;
|
||||
case "textcolordark":
|
||||
TextColorDark = subElement.GetAttributeColor("color", TextColorDark);
|
||||
break;
|
||||
case "textcolorbright":
|
||||
case "TextColorBright":
|
||||
TextColorBright = subElement.GetAttributeColor("color", TextColorBright);
|
||||
break;
|
||||
case "textcolordim":
|
||||
@@ -153,45 +116,6 @@ namespace Barotrauma
|
||||
case "textcolor":
|
||||
TextColor = subElement.GetAttributeColor("color", TextColor);
|
||||
break;
|
||||
case "equipmentsloticoncolor":
|
||||
EquipmentSlotIconColor = subElement.GetAttributeColor("color", EquipmentSlotIconColor);
|
||||
break;
|
||||
case "buffcolorlow":
|
||||
BuffColorLow = subElement.GetAttributeColor("color", BuffColorLow);
|
||||
break;
|
||||
case "buffcolormedium":
|
||||
BuffColorMedium = subElement.GetAttributeColor("color", BuffColorMedium);
|
||||
break;
|
||||
case "buffcolorhigh":
|
||||
BuffColorHigh = subElement.GetAttributeColor("color", BuffColorHigh);
|
||||
break;
|
||||
case "debuffcolorlow":
|
||||
DebuffColorLow = subElement.GetAttributeColor("color", DebuffColorLow);
|
||||
break;
|
||||
case "debuffcolormedium":
|
||||
DebuffColorMedium = subElement.GetAttributeColor("color", DebuffColorMedium);
|
||||
break;
|
||||
case "debuffcolorhigh":
|
||||
DebuffColorHigh = subElement.GetAttributeColor("color", DebuffColorHigh);
|
||||
break;
|
||||
case "healthbarcolorlow":
|
||||
HealthBarColorLow = subElement.GetAttributeColor("color", HealthBarColorLow);
|
||||
break;
|
||||
case "healthbarcolormedium":
|
||||
HealthBarColorMedium = subElement.GetAttributeColor("color", HealthBarColorMedium);
|
||||
break;
|
||||
case "healthbarcolorhigh":
|
||||
HealthBarColorHigh = subElement.GetAttributeColor("color", HealthBarColorHigh);
|
||||
break;
|
||||
case "equipmentindicatornotequipped":
|
||||
EquipmentIndicatorNotEquipped = subElement.GetAttributeColor("color", EquipmentIndicatorNotEquipped);
|
||||
break;
|
||||
case "equipmentindicatorequipped":
|
||||
EquipmentIndicatorEquipped = subElement.GetAttributeColor("color", EquipmentIndicatorEquipped);
|
||||
break;
|
||||
case "equipmentindicatorrunningout":
|
||||
EquipmentIndicatorRunningOut = subElement.GetAttributeColor("color", EquipmentIndicatorRunningOut);
|
||||
break;
|
||||
case "uiglow":
|
||||
UIGlow = new UISprite(subElement);
|
||||
break;
|
||||
@@ -326,8 +250,9 @@ namespace Barotrauma
|
||||
//check if any of the language override fonts want to override the font size as well
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
uint overrideFontSize = GetFontSize(subElement, 0);
|
||||
if (overrideFontSize > 0) { return overrideFontSize; }
|
||||
@@ -336,7 +261,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("size", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "size") { continue; }
|
||||
Point maxResolution = subElement.GetAttributePoint("maxresolution", new Point(int.MaxValue, int.MaxValue));
|
||||
if (GameMain.GraphicsWidth <= maxResolution.X && GameMain.GraphicsHeight <= maxResolution.Y)
|
||||
{
|
||||
@@ -350,8 +275,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeString("file", "");
|
||||
}
|
||||
@@ -363,8 +289,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeBool("dynamicloading", false);
|
||||
}
|
||||
@@ -376,8 +303,9 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("override", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (GameMain.Config.Language.Equals(subElement.GetAttributeString("language", ""), StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
return subElement.GetAttributeBool("iscjk", false);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,11 @@ namespace Barotrauma
|
||||
{
|
||||
if (text == null) { return; }
|
||||
|
||||
censoredText = string.IsNullOrEmpty(text) ? "" : new string('\u2022', text.Length);
|
||||
censoredText = "";
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
censoredText += "\u2022";
|
||||
}
|
||||
|
||||
var rect = Rect;
|
||||
|
||||
|
||||
@@ -112,16 +112,16 @@ namespace Barotrauma
|
||||
//slice from the top of the screen for misc buttons (info, end round, server controls)
|
||||
ButtonAreaTop = new Rectangle(Padding, Padding, GameMain.GraphicsWidth - Padding * 2, (int)(50 * GUI.Scale));
|
||||
|
||||
int infoAreaWidth = (int)(142 * GUI.Scale);
|
||||
int infoAreaHeight = (int)(98 * GUI.Scale);
|
||||
int portraitSize = (int)(infoAreaHeight * 0.95f);
|
||||
int infoAreaWidth = (int)(142 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int infoAreaHeight = (int)(98 * GUI.Scale * CharacterInfo.BgScale);
|
||||
int portraitSize = (int)(125 * GUI.Scale);
|
||||
BottomRightInfoArea = new Rectangle(GameMain.GraphicsWidth - Padding * 2 - infoAreaWidth, GameMain.GraphicsHeight - Padding * 2 - infoAreaHeight, infoAreaWidth, infoAreaHeight);
|
||||
PortraitArea = new Rectangle(GameMain.GraphicsWidth - portraitSize, BottomRightInfoArea.Bottom - portraitSize + Padding / 2, portraitSize, portraitSize);
|
||||
PortraitArea = new Rectangle(GameMain.GraphicsWidth - Padding - portraitSize, GameMain.GraphicsHeight - Padding - portraitSize, portraitSize, portraitSize);
|
||||
|
||||
//horizontal slices at the corners of the screen for health bar and affliction icons
|
||||
int afflictionAreaHeight = (int)(50 * GUI.Scale);
|
||||
int healthBarWidth = BottomRightInfoArea.Width + CharacterInventory.SlotSize.X + CharacterInventory.Spacing * 2 + CharacterInventory.HideButtonWidth;
|
||||
int healthBarHeight = (int)(50f * GUI.Scale);
|
||||
int healthBarWidth = (int)((BottomRightInfoArea.Width + CharacterInventory.SlotSize.X + CharacterInventory.Spacing) * 1.1f);
|
||||
int healthBarHeight = (int)Math.Max(50f * GUI.Scale, 25f);
|
||||
HealthBarArea = new Rectangle(BottomRightInfoArea.X - (healthBarWidth - BottomRightInfoArea.Width) + (int)(2 * GUI.Scale), BottomRightInfoArea.Y - healthBarHeight + (int)(10 * GUI.Scale), healthBarWidth, healthBarHeight);
|
||||
AfflictionAreaLeft = new Rectangle(HealthBarArea.X, HealthBarArea.Y - Padding - afflictionAreaHeight, HealthBarArea.Width, afflictionAreaHeight);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Barotrauma
|
||||
if (vanillaContent == null)
|
||||
{
|
||||
// TODO: Dynamic method for defining and finding the vanilla content package.
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).Equals("vanilla 0.9.xml", StringComparison.OrdinalIgnoreCase));
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).ToLowerInvariant() == "vanilla 0.9.xml");
|
||||
}
|
||||
return vanillaContent;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ namespace Barotrauma
|
||||
SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume, 0);
|
||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 20.0f, 0);
|
||||
|
||||
if (Config.EnableSplashScreen && !ConsoleArguments.Contains("-skipintro"))
|
||||
{
|
||||
@@ -421,27 +421,17 @@ namespace Barotrauma
|
||||
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
|
||||
DebugConsole.Init();
|
||||
|
||||
if (Config.AutoUpdateWorkshopItems)
|
||||
CrossThread.RequestExecutionOnMainThread(() =>
|
||||
{
|
||||
bool waitingForWorkshopUpdates = true;
|
||||
bool result = false;
|
||||
TaskPool.Add(SteamManager.AutoUpdateWorkshopItems(), (task) =>
|
||||
if (Config.AutoUpdateWorkshopItems)
|
||||
{
|
||||
result = task.Result;
|
||||
waitingForWorkshopUpdates = false;
|
||||
});
|
||||
|
||||
while (waitingForWorkshopUpdates) { yield return CoroutineStatus.Running; }
|
||||
|
||||
if (result)
|
||||
{
|
||||
CrossThread.RequestExecutionOnMainThread(() =>
|
||||
if (SteamManager.AutoUpdateWorkshopItems())
|
||||
{
|
||||
ContentPackage.LoadAll();
|
||||
Config.ReloadContentPackages();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (SelectedPackages.None())
|
||||
@@ -1096,10 +1086,7 @@ namespace Barotrauma
|
||||
UserData = "https://steamcommunity.com/app/602960/discussions/1/",
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!SteamManager.OverlayCustomURL(userdata as string))
|
||||
{
|
||||
ShowOpenUrlInWebBrowserPrompt(userdata as string);
|
||||
}
|
||||
SteamManager.OverlayCustomURL(userdata as string);
|
||||
msgBox.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (toggleCrewListOpen == value) { return; }
|
||||
toggleCrewListOpen = GameMain.Config.CrewMenuOpen = value;
|
||||
toggleCrewButton.Children.ForEach(c => c.SpriteEffects = toggleCrewListOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +70,13 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("character", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "character") continue;
|
||||
|
||||
var characterInfo = new CharacterInfo(subElement);
|
||||
characterInfos.Add(characterInfo);
|
||||
foreach (XElement invElement in subElement.Elements())
|
||||
{
|
||||
if (!invElement.Name.ToString().Equals("inventory", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (invElement.Name.ToString().ToLowerInvariant() != "inventory") continue;
|
||||
characterInfo.InventoryData = invElement;
|
||||
break;
|
||||
}
|
||||
@@ -97,13 +98,11 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var commandButtonHeight = (int)(GUI.Scale * 40);
|
||||
var buttonSize = new Point((int)(182f / 99f * commandButtonHeight), commandButtonHeight);
|
||||
var crewListToggleButtonHeight = (int)(64f * buttonSize.X / 175f);
|
||||
var buttonHeight = (int)(GUI.Scale * 40);
|
||||
|
||||
crewArea = new GUIFrame(
|
||||
new RectTransform(
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - commandButtonHeight - crewListToggleButtonHeight - 2 * HUDLayoutSettings.Padding),
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - (int)(1.5f * buttonHeight) - 2 * HUDLayoutSettings.Padding),
|
||||
crewAreaWithButtons.RectTransform,
|
||||
Anchor.BottomLeft),
|
||||
style: null,
|
||||
@@ -112,6 +111,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var buttonSize = new Point((int)(182.0f / 99.0f * buttonHeight), buttonHeight);
|
||||
commandButton = new GUIButton(
|
||||
new RectTransform(buttonSize, parent: crewAreaWithButtons.RectTransform),
|
||||
style: "CommandButton")
|
||||
@@ -139,13 +139,14 @@ namespace Barotrauma
|
||||
Spacing = (int)(GUI.Scale * 10)
|
||||
};
|
||||
|
||||
buttonSize.Y = crewListToggleButtonHeight;
|
||||
toggleCrewButton = new GUIButton(
|
||||
new RectTransform(buttonSize, parent: crewAreaWithButtons.RectTransform)
|
||||
new RectTransform(
|
||||
new Point(buttonSize.X, (int)(0.5f * buttonHeight)),
|
||||
parent: crewAreaWithButtons.RectTransform)
|
||||
{
|
||||
AbsoluteOffset = new Point(0, commandButtonHeight + HUDLayoutSettings.Padding)
|
||||
AbsoluteOffset = new Point(0, buttonHeight + HUDLayoutSettings.Padding)
|
||||
},
|
||||
style: "CrewListToggleButton")
|
||||
style: "UIToggleButton")
|
||||
{
|
||||
OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
@@ -211,7 +212,7 @@ namespace Barotrauma
|
||||
var chatBox = ChatBox ?? GameMain.Client?.ChatBox;
|
||||
if (chatBox != null)
|
||||
{
|
||||
chatBox.ToggleButton = new GUIButton(new RectTransform(new Point((int)(182f * GUI.Scale * 0.4f), (int)(99f * GUI.Scale * 0.4f)), chatBox.GUIFrame.Parent.RectTransform), style: "ChatToggleButton");
|
||||
chatBox.ToggleButton = new GUIButton(new RectTransform(new Point((int)(182f * GUI.Scale * 0.4f), (int)(99f * GUI.Scale * 0.4f)), guiFrame.RectTransform), style: "ChatToggleButton");
|
||||
chatBox.ToggleButton.RectTransform.AbsoluteOffset = new Point(0, HUDLayoutSettings.ChatBoxArea.Height - chatBox.ToggleButton.Rect.Height);
|
||||
chatBox.ToggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
@@ -329,7 +330,17 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
AddCharacterToCrewList(character);
|
||||
DisplayCharacterOrder(character, character.CurrentOrder, character.CurrentOrderOption);
|
||||
|
||||
if (character is AICharacter)
|
||||
{
|
||||
var ai = character.AIController as HumanAIController;
|
||||
if (ai == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in crewmanager - attempted to give orders to a character with no HumanAIController");
|
||||
return;
|
||||
}
|
||||
character.SetOrder(ai.CurrentOrder, "", null, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCharacterInfo(CharacterInfo characterInfo)
|
||||
@@ -777,11 +788,11 @@ namespace Barotrauma
|
||||
characterFrame.SetAsFirstChild();
|
||||
}
|
||||
|
||||
private void DisplayPreviousCharacterOrder(Character character, GUILayoutGroup characterComponent, OrderInfo orderInfo)
|
||||
private void DisplayPreviousCharacterOrder(Character character, GUILayoutGroup characterComponent, OrderInfo currentOrderInfo)
|
||||
{
|
||||
if (orderInfo.Order == null || orderInfo.Order.Identifier == dismissedOrderPrefab.Identifier) { return; }
|
||||
if (currentOrderInfo.Order == null || currentOrderInfo.Order.Identifier == dismissedOrderPrefab.Identifier) { return; }
|
||||
|
||||
var previousOrderInfo = new OrderInfo(orderInfo);
|
||||
var previousOrderInfo = new OrderInfo(currentOrderInfo);
|
||||
var prevOrderFrame = new GUIButton(
|
||||
new RectTransform(
|
||||
characterComponent.GetChildByUserData("job").RectTransform.RelativeSize,
|
||||
@@ -824,12 +835,12 @@ namespace Barotrauma
|
||||
|
||||
private GUIComponent GetCurrentOrderComponent(GUILayoutGroup characterComponent)
|
||||
{
|
||||
return characterComponent?.FindChild(c => c?.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "currentorder");
|
||||
return characterComponent.FindChild(c => c.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "currentorder");
|
||||
}
|
||||
|
||||
private GUIComponent GetPreviousOrderComponent(GUILayoutGroup characterComponent)
|
||||
{
|
||||
return characterComponent?.FindChild(c => c?.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "previousorder");
|
||||
return characterComponent.FindChild(c => c.UserData is OrderInfo orderInfo && orderInfo.ComponentIdentifier == "previousorder");
|
||||
}
|
||||
|
||||
private struct OrderInfo
|
||||
@@ -899,11 +910,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!(c.UserData is Character character) || character.IsDead || character.Removed) { continue; }
|
||||
AddCharacter(character);
|
||||
if (GetPreviousOrderComponent(c.GetChild<GUILayoutGroup>())?.UserData is OrderInfo prevInfo &&
|
||||
crewList.Content.Children.FirstOrDefault(c => c?.UserData == character)?.GetChild<GUILayoutGroup>() is GUILayoutGroup newLayoutGroup)
|
||||
{
|
||||
DisplayPreviousCharacterOrder(character, newLayoutGroup, prevInfo);
|
||||
}
|
||||
DisplayCharacterOrder(character, character.CurrentOrder, (character.AIController as HumanAIController)?.CurrentOrderOption);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,21 +1293,13 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
return Character.Controlled == null || Character.Controlled.Info != null && Character.Controlled.SpeechImpediment < 100.0f;
|
||||
#else
|
||||
return Character.Controlled != null && Character.Controlled.SpeechImpediment < 100.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanSomeoneHearCharacter()
|
||||
{
|
||||
#if DEBUG
|
||||
return true;
|
||||
#else
|
||||
return Character.Controlled != null && characters.Any(c => c != Character.Controlled && c.CanHearCharacter(Character.Controlled));
|
||||
#endif
|
||||
}
|
||||
|
||||
private void CreateCommandUI(Character characterContext = null)
|
||||
@@ -1506,7 +1505,17 @@ namespace Barotrauma
|
||||
shortcutCenterNode = null;
|
||||
}
|
||||
CreateNodes(userData);
|
||||
CreateReturnNodeHotkey();
|
||||
if (returnNode != null && returnNode.Visible)
|
||||
{
|
||||
var hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
CreateHotkeyIcon(returnNode.RectTransform, hotkey % 10, true);
|
||||
returnNodeHotkey = Keys.D0 + hotkey % 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnNodeHotkey = Keys.None;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1530,20 +1539,10 @@ namespace Barotrauma
|
||||
returnNode = null;
|
||||
}
|
||||
CreateNodes(userData);
|
||||
CreateReturnNodeHotkey();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateReturnNodeHotkey()
|
||||
{
|
||||
if (returnNode != null && returnNode.Visible)
|
||||
{
|
||||
var hotkey = 1;
|
||||
if (targetFrame == null || !targetFrame.Visible)
|
||||
{
|
||||
hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
}
|
||||
var hotkey = optionNodes.Count + 1;
|
||||
if (expandNode != null && expandNode.Visible) { hotkey += 1; }
|
||||
CreateHotkeyIcon(returnNode.RectTransform, hotkey % 10, true);
|
||||
returnNodeHotkey = Keys.D0 + hotkey % 10;
|
||||
}
|
||||
@@ -1551,6 +1550,7 @@ namespace Barotrauma
|
||||
{
|
||||
returnNodeHotkey = Keys.None;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetCenterNode(GUIButton node)
|
||||
@@ -2148,11 +2148,7 @@ namespace Barotrauma
|
||||
ToolTip = character.Info.DisplayName + " (" + character.Info.Job.Name + ")"
|
||||
};
|
||||
|
||||
#if DEBUG
|
||||
bool canHear = true;
|
||||
#else
|
||||
bool canHear = character.CanHearCharacter(Character.Controlled);
|
||||
#endif
|
||||
if (!canHear)
|
||||
{
|
||||
node.CanBeFocused = icon.CanBeFocused = false;
|
||||
@@ -2275,10 +2271,8 @@ namespace Barotrauma
|
||||
|
||||
private Character GetBestCharacterForOrder(Order order)
|
||||
{
|
||||
#if !DEBUG
|
||||
if (Character.Controlled == null) { return null; }
|
||||
#endif
|
||||
return characters.FindAll(c => Character.Controlled == null || (c != Character.Controlled && c.TeamID == Character.Controlled.TeamID))
|
||||
return characters.FindAll(c => c != Character.Controlled && c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ThenByDescending(c => order.HasAppropriateJob(c))
|
||||
.ThenBy(c => c.CurrentOrder?.Weight)
|
||||
@@ -2287,18 +2281,16 @@ namespace Barotrauma
|
||||
|
||||
private List<Character> GetCharactersSortedForOrder(Order order)
|
||||
{
|
||||
#if !DEBUG
|
||||
if (Character.Controlled == null) { return new List<Character>(); }
|
||||
#endif
|
||||
if (order.Identifier == "follow")
|
||||
{
|
||||
return characters.FindAll(c => Character.Controlled == null || (c != Character.Controlled && c.TeamID == Character.Controlled.TeamID))
|
||||
return characters.FindAll(c => c != Character.Controlled && c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return characters.FindAll(c => Character.Controlled == null || c.TeamID == Character.Controlled.TeamID)
|
||||
return characters.FindAll(c => c.TeamID == Character.Controlled.TeamID)
|
||||
.OrderByDescending(c => c.CurrentOrder == null || c.CurrentOrder.Identifier == dismissedOrderPrefab.Identifier)
|
||||
.ThenByDescending(c => order.HasAppropriateJob(c))
|
||||
.ThenBy(c => c.CurrentOrder?.Weight)
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Barotrauma
|
||||
if (Character.Controlled.Submarine != outpost) { return null; }
|
||||
|
||||
//if there's a sub docked to the outpost, we can leave the level
|
||||
if (outpost.DockedTo.Any())
|
||||
if (outpost.DockedTo.Count > 0)
|
||||
{
|
||||
var dockedSub = outpost.DockedTo.FirstOrDefault();
|
||||
return dockedSub.DockedTo.Contains(Submarine.MainSub) ? Submarine.MainSub : dockedSub;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
@@ -222,7 +221,7 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
|
||||
yield return new WaitForSeconds(1.0f, false);
|
||||
} while (Submarine.MainSub.DockedTo.Any());
|
||||
} while (Submarine.MainSub.DockedTo.Count > 0);
|
||||
RemoveCompletedObjective(segments[4]);
|
||||
yield return new WaitForSeconds(2f, false);
|
||||
TriggerTutorialSegment(5); // Navigate to destination
|
||||
@@ -246,7 +245,7 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
|
||||
yield return new WaitForSeconds(1.0f, false);
|
||||
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Any());
|
||||
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0);
|
||||
RemoveCompletedObjective(segments[6]);
|
||||
yield return new WaitForSeconds(3f, false);
|
||||
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.GetWithVariable("Captain.Radio.Complete", "[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null);
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Barotrauma
|
||||
|
||||
private GUIFrame infoFrameContent;
|
||||
public RoundSummary RoundSummary { get; private set; }
|
||||
public static bool IsInfoFrameOpen => GameMain.GameSession?.infoFrame != null;
|
||||
|
||||
private bool ToggleInfoFrame()
|
||||
{
|
||||
|
||||
@@ -1182,7 +1182,7 @@ namespace Barotrauma
|
||||
{ RelativeOffset = new Vector2(0.02f, 0.02f) })
|
||||
{ RelativeSpacing = 0.01f };
|
||||
|
||||
var automaticQuickStartTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Automatic quickstart enabled", style: "GUITickBox");
|
||||
var automaticQuickStartTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Enable automatic quickstart", style: "GUITickBox");
|
||||
automaticQuickStartTickBox.Selected = AutomaticQuickStartEnabled;
|
||||
automaticQuickStartTickBox.ToolTip = "Will the game automatically move on to Quickstart when the game is launched";
|
||||
automaticQuickStartTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1192,7 +1192,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var showSplashScreenTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Splash screen enabled", style: "GUITickBox");
|
||||
var showSplashScreenTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Show splash screen", style: "GUITickBox");
|
||||
showSplashScreenTickBox.Selected = EnableSplashScreen;
|
||||
showSplashScreenTickBox.ToolTip = "Are the splash screens shown when the game is launched";
|
||||
showSplashScreenTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1202,7 +1202,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var verboseLoggingTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Verbose logging enabled", style: "GUITickBox");
|
||||
var verboseLoggingTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "Enable verbose logging", style: "GUITickBox");
|
||||
verboseLoggingTickBox.Selected = VerboseLogging;
|
||||
verboseLoggingTickBox.ToolTip = "Should verbose logging be used";
|
||||
verboseLoggingTickBox.OnSelected = (tickBox) =>
|
||||
@@ -1211,16 +1211,6 @@ namespace Barotrauma
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
};
|
||||
|
||||
var textManagerDebugModeTickBox = new GUITickBox(new RectTransform(tickBoxScale / 0.18f, debugTickBoxes.RectTransform, scaleBasis: ScaleBasis.BothHeight), "TextManager debug mode enabled", style: "GUITickBox");
|
||||
textManagerDebugModeTickBox.Selected = TextManagerDebugModeEnabled;
|
||||
textManagerDebugModeTickBox.ToolTip = "Does the TextManager return the text tags for debug purposes?";
|
||||
textManagerDebugModeTickBox.OnSelected = (tickBox) =>
|
||||
{
|
||||
TextManagerDebugModeEnabled = tickBox.Selected;
|
||||
UnsavedSettings = true;
|
||||
return true;
|
||||
};
|
||||
#endif
|
||||
|
||||
UnsavedSettings = false; // Reset unsaved settings to false once the UI has been created
|
||||
@@ -1289,7 +1279,7 @@ namespace Barotrauma
|
||||
string[] prefixes = { "OpenAL Soft on " };
|
||||
foreach (string prefix in prefixes)
|
||||
{
|
||||
if (name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
if (name.StartsWith(prefix, StringComparison.InvariantCulture))
|
||||
{
|
||||
return name.Remove(0, prefix.Length);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Barotrauma
|
||||
public Vector2[] SlotPositions;
|
||||
public static Point SlotSize;
|
||||
public static int Spacing;
|
||||
public static int HideButtonWidth;
|
||||
|
||||
private Layout layout;
|
||||
public Layout CurrentLayout
|
||||
@@ -72,44 +71,22 @@ namespace Barotrauma
|
||||
{
|
||||
get { return personalSlotArea; }
|
||||
}
|
||||
|
||||
private GUIImage[] indicators = new GUIImage[5];
|
||||
private int[] indicatorIndexes = new int[5];
|
||||
private Vector2 indicatorSpriteSize;
|
||||
private GUILayoutGroup indicatorGroup;
|
||||
|
||||
|
||||
partial void InitProjSpecific(XElement element)
|
||||
{
|
||||
Hidden = true;
|
||||
|
||||
hideButton = new GUIButton(new RectTransform(new Point((int)(31f * (HUDLayoutSettings.BottomRightInfoArea.Height / 100f)), HUDLayoutSettings.BottomRightInfoArea.Height), GUI.Canvas)
|
||||
hideButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), (int)(60 * GUI.Scale)), GUI.Canvas)
|
||||
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||
"", style: "EquipmentToggleButton");
|
||||
|
||||
indicatorGroup = new GUILayoutGroup(new RectTransform(Point.Zero, hideButton.RectTransform)) { IsHorizontal = false };
|
||||
indicatorGroup.ChildAnchor = Anchor.TopCenter;
|
||||
indicatorSpriteSize = GUI.Style.GetComponentStyle("EquipmentIndicatorDivingSuit").Sprites[GUIComponent.ComponentState.None][0].Sprite.size;
|
||||
|
||||
indicators[0] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorDivingSuit");
|
||||
indicators[1] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorID");
|
||||
indicators[2] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorOutfit");
|
||||
indicators[3] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorHeadwear");
|
||||
indicators[4] = new GUIImage(new RectTransform(Point.Zero, indicatorGroup.RectTransform), "EquipmentIndicatorHeadphones");
|
||||
|
||||
indicatorIndexes[0] = FindLimbSlot(InvSlotType.OuterClothes);
|
||||
indicatorIndexes[1] = FindLimbSlot(InvSlotType.Card);
|
||||
indicatorIndexes[2] = FindLimbSlot(InvSlotType.InnerClothes);
|
||||
indicatorIndexes[3] = FindLimbSlot(InvSlotType.Head);
|
||||
indicatorIndexes[4] = FindLimbSlot(InvSlotType.Headset);
|
||||
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
indicators[i].CanBeFocused = false;
|
||||
}
|
||||
|
||||
"", style: "UIToggleButton");
|
||||
hideButton.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipHorizontally);
|
||||
hideButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
hidePersonalSlots = !hidePersonalSlots;
|
||||
foreach (GUIComponent child in btn.Children)
|
||||
{
|
||||
child.SpriteEffects = hidePersonalSlots ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -268,26 +245,6 @@ namespace Barotrauma
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SetIndicatorSizes()
|
||||
{
|
||||
indicatorGroup.RectTransform.AbsoluteOffset = new Point((int)Math.Round(4 * GUI.Scale), (int)Math.Round(7 * GUI.Scale));
|
||||
indicatorGroup.RectTransform.NonScaledSize = new Point(hideButton.Rect.Width - indicatorGroup.RectTransform.AbsoluteOffset.X * 2, hideButton.Rect.Height - indicatorGroup.RectTransform.AbsoluteOffset.Y * 2);
|
||||
indicatorGroup.AbsoluteSpacing = (int)Math.Ceiling(2 * GUI.Scale);
|
||||
|
||||
int indicatorHeight = (indicatorGroup.RectTransform.NonScaledSize.Y - indicatorGroup.AbsoluteSpacing * (indicators.Length - 1)) / indicators.Length;
|
||||
int indicatorWidth = (int)(indicatorSpriteSize.X / (indicatorSpriteSize.Y / indicatorHeight));
|
||||
|
||||
if (HideButtonWidth % 2 != indicatorWidth % 2) indicatorWidth++;
|
||||
|
||||
Point indicatorSize = new Point(indicatorWidth, indicatorHeight);
|
||||
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
indicators[i].RectTransform.NonScaledSize = indicatorSize;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSlotPositions(Layout layout)
|
||||
{
|
||||
bool isFourByThree = GUI.IsFourByThree();
|
||||
@@ -300,8 +257,6 @@ namespace Barotrauma
|
||||
Spacing = (int)(8 * UIScale);
|
||||
}
|
||||
|
||||
HideButtonWidth = (int)(31f * (HUDLayoutSettings.BottomRightInfoArea.Height / 100f));
|
||||
|
||||
SlotSize = !isFourByThree ? (SlotSpriteSmall.size * UIScale).ToPoint() : (SlotSpriteSmall.size * UIScale * .925f).ToPoint();
|
||||
int bottomOffset = SlotSize.Y + Spacing * 2 + ContainedIndicatorHeight;
|
||||
|
||||
@@ -317,7 +272,8 @@ namespace Barotrauma
|
||||
int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
|
||||
|
||||
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (SlotSize.X + Spacing) / 2;
|
||||
int upperX = HUDLayoutSettings.BottomRightInfoArea.X - SlotSize.X - Spacing * 4 - HideButtonWidth;
|
||||
int upperX = HUDLayoutSettings.BottomRightInfoArea.X - Spacing * 2 - SlotSize.X - SlotSize.X / 2;
|
||||
//int upperX = GameMain.GraphicsWidth - personalSlotCount * (slotSize.X + spacing) + (int)(11 * GUI.Scale) + spacing;
|
||||
|
||||
//make sure the rightmost normal slot doesn't overlap with the personal slots
|
||||
x -= Math.Max((x + normalSlotCount * (SlotSize.X + Spacing)) - (upperX - personalSlotCount * (SlotSize.X + Spacing)), 0);
|
||||
@@ -344,13 +300,11 @@ namespace Barotrauma
|
||||
if (hideButtonSlotIndex > -1)
|
||||
{
|
||||
hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
|
||||
hideButton.RectTransform.NonScaledSize = new Point(HideButtonWidth, HUDLayoutSettings.BottomRightInfoArea.Height);
|
||||
hideButton.RectTransform.NonScaledSize = new Point(SlotSize.X / 2, HUDLayoutSettings.BottomRightInfoArea.Height);
|
||||
hideButton.RectTransform.AbsoluteOffset = new Point(
|
||||
personalSlotArea.Right + Spacing * 2,
|
||||
personalSlotArea.Right + Spacing,
|
||||
HUDLayoutSettings.BottomRightInfoArea.Y);
|
||||
hideButton.Visible = true;
|
||||
|
||||
SetIndicatorSizes();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -503,8 +457,7 @@ namespace Barotrauma
|
||||
hidePersonalSlotsState = hidePersonalSlots ?
|
||||
Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
|
||||
Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
|
||||
|
||||
bool personalSlotsMoving = hidePersonalSlotsState > 0 && hidePersonalSlotsState < 1f;
|
||||
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
|
||||
@@ -513,7 +466,6 @@ namespace Barotrauma
|
||||
if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
|
||||
}
|
||||
slots[i].IsMoving = personalSlotsMoving;
|
||||
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
|
||||
}
|
||||
}
|
||||
@@ -599,8 +551,6 @@ namespace Barotrauma
|
||||
|
||||
if (character == Character.Controlled && character.SelectedCharacter == null) // Permanently open subinventories only available when the default UI layout is in use -> not when grabbing characters
|
||||
{
|
||||
UpdateEquipmentIndicators();
|
||||
|
||||
//remove the highlighted slots of other characters' inventories when not grabbing anyone
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.ParentInventory != this && s.ParentInventory?.Owner is Character);
|
||||
|
||||
@@ -701,39 +651,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEquipmentIndicators()
|
||||
{
|
||||
for (int i = 0; i < indicators.Length; i++)
|
||||
{
|
||||
Item item = Items[indicatorIndexes[i]];
|
||||
if (item != null)
|
||||
{
|
||||
Wearable wearable = item.GetComponent<Wearable>();
|
||||
if (wearable != null && wearable.DisplayContainedStatus)
|
||||
{
|
||||
float conditionPercentage = item.GetContainedItemConditionPercentage();
|
||||
|
||||
if (conditionPercentage != -1)
|
||||
{
|
||||
indicators[i].Color = ToolBox.GradientLerp(conditionPercentage, GUI.Style.EquipmentIndicatorRunningOut, GUI.Style.EquipmentIndicatorEquipped);
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorRunningOut;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorEquipped;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
indicators[i].Color = GUI.Style.EquipmentIndicatorNotEquipped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSubInventory(SlotReference slotRef, float deltaTime, Camera cam, List<SlotReference> hideSubInventories, bool isEquippedSubInventory)
|
||||
{
|
||||
@@ -1047,7 +964,7 @@ namespace Barotrauma
|
||||
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
|
||||
{
|
||||
var icon = limbSlotIcons[SlotTypes[i]];
|
||||
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, GUI.Style.EquipmentSlotIconColor, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
||||
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, GUIColorSettings.EquipmentSlotIconColor, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ namespace Barotrauma.Items.Components
|
||||
var inputArea = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 1f), bottomFrame.RectTransform, Anchor.BottomCenter), isHorizontal: true, childAnchor: Anchor.BottomLeft);
|
||||
|
||||
// === INPUT SLOTS === //
|
||||
inputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.7f, 1f), inputArea.RectTransform), style: null);
|
||||
inputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.8f, 1f), inputArea.RectTransform), style: null);
|
||||
new GUICustomComponent(new RectTransform(Vector2.One, inputInventoryHolder.RectTransform), DrawInputOverLay) { CanBeFocused = false };
|
||||
|
||||
// === ACTIVATE BUTTON === //
|
||||
var buttonFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.8f), inputArea.RectTransform), childAnchor: Anchor.CenterRight);
|
||||
var buttonFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.2f, 0.8f), inputArea.RectTransform), childAnchor: Anchor.CenterRight);
|
||||
activateButton = new GUIButton(new RectTransform(new Vector2(1f, 0.6f), buttonFrame.RectTransform),
|
||||
TextManager.Get("FabricatorCreate"), style: "DeviceButton")
|
||||
{
|
||||
@@ -154,7 +154,7 @@ namespace Barotrauma.Items.Components
|
||||
};
|
||||
// === POWER WARNING === //
|
||||
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform),
|
||||
TextManager.Get("FabricatorNoPower"), textColor: GUI.Style.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow", wrap: true)
|
||||
TextManager.Get("FabricatorNoPower"), textColor: GUI.Style.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
||||
{
|
||||
HoverColor = Color.Black,
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -356,8 +356,6 @@ namespace Barotrauma.Items.Components
|
||||
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
||||
{
|
||||
overlayComponent.RectTransform.SetAsLastChild();
|
||||
|
||||
if (outputContainer.Inventory.Items.First() != null) { return; }
|
||||
|
||||
FabricationRecipe targetItem = fabricatedItem ?? selectedItem;
|
||||
if (targetItem != null)
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace Barotrauma.Items.Components
|
||||
disruptedDirections.Clear();
|
||||
foreach (AITarget t in AITarget.List)
|
||||
{
|
||||
if (t.SoundRange <= 0.0f || float.IsNaN(t.SoundRange) || float.IsInfinity(t.SoundRange)) { continue; }
|
||||
if (t.SoundRange <= 0.0f || !t.Enabled || float.IsNaN(t.SoundRange) || float.IsInfinity(t.SoundRange)) { continue; }
|
||||
|
||||
float distSqr = Vector2.DistanceSquared(t.WorldPosition, transducerCenter);
|
||||
if (distSqr > t.SoundRange * t.SoundRange * 2) { continue; }
|
||||
|
||||
@@ -665,7 +665,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (Vector2.DistanceSquared(PlayerInput.MousePosition, steerArea.Rect.Center.ToVector2()) < steerRadius * steerRadius)
|
||||
{
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen && !GameSession.IsInfoFrameOpen)
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen)
|
||||
{
|
||||
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
||||
displaySubPos.Y = -displaySubPos.Y;
|
||||
|
||||
@@ -236,7 +236,15 @@ namespace Barotrauma.Items.Components
|
||||
DeteriorateAlways = msg.ReadBoolean();
|
||||
ushort currentFixerID = msg.ReadUInt16();
|
||||
currentFixerAction = (FixActions)msg.ReadRangedInteger(0, 2);
|
||||
CurrentFixer = currentFixerID != 0 ? Entity.FindEntityByID(currentFixerID) as Character : null;
|
||||
|
||||
if (currentFixerID == 0)
|
||||
{
|
||||
CurrentFixer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentFixer = Entity.FindEntityByID(currentFixerID) as Character;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("wiresprite", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "wiresprite")
|
||||
{
|
||||
overrideSprite = new Sprite(subElement);
|
||||
break;
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawCharacterInfo(SpriteBatch spriteBatch, Character target, float alpha = 1.0f)
|
||||
{
|
||||
Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.DrawPosition);
|
||||
Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.WorldPosition);
|
||||
hudPos += Vector2.UnitX * 50.0f;
|
||||
|
||||
List<string> texts = new List<string>();
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Barotrauma.Items.Components
|
||||
string errorMsg = "Error while reading a docking port network event (Dock method did not create a joint between the ports)." +
|
||||
" Submarine: " + (item.Submarine?.Name ?? "null") +
|
||||
", target submarine: " + (DockingTarget.item.Submarine?.Name ?? "null");
|
||||
if (item.Submarine?.ConnectedDockingPorts.ContainsKey(DockingTarget.item.Submarine) ?? false)
|
||||
if (item.Submarine?.DockedTo.Contains(DockingTarget.item.Submarine) ?? false)
|
||||
{
|
||||
errorMsg += "\nAlready docked.";
|
||||
}
|
||||
|
||||
@@ -45,17 +45,12 @@ namespace Barotrauma
|
||||
|
||||
public float QuickUseTimer;
|
||||
public string QuickUseButtonToolTip;
|
||||
public bool IsMoving = false;
|
||||
|
||||
private static Rectangle offScreenRect = new Rectangle(new Point(-1000, 0), Point.Zero);
|
||||
public GUIComponent.ComponentState EquipButtonState;
|
||||
public Rectangle EquipButtonRect
|
||||
{
|
||||
get
|
||||
{
|
||||
// Returns a point off-screen, Rectangle.Empty places buttons in the top left of the screen
|
||||
if (IsMoving) return offScreenRect;
|
||||
|
||||
int buttonDir = Math.Sign(SubInventoryDir);
|
||||
|
||||
float sizeY = Inventory.UnequippedIndicator.size.Y * Inventory.UIScale * Inventory.IndicatorScaleAdjustment;
|
||||
@@ -289,7 +284,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
protected static HashSet<SlotReference> highlightedSubInventorySlots = new HashSet<SlotReference>();
|
||||
private static List<SlotReference> subInventorySlotsToDraw = new List<SlotReference>();
|
||||
|
||||
protected static SlotReference selectedSlot;
|
||||
|
||||
@@ -1054,14 +1048,11 @@ namespace Barotrauma
|
||||
return hoverArea;
|
||||
}
|
||||
|
||||
|
||||
public static void DrawFront(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (GUI.PauseMenuOpen || GUI.SettingsMenuOpen) { return; }
|
||||
if (GUI.PauseMenuOpen || GUI.SettingsMenuOpen) return;
|
||||
|
||||
subInventorySlotsToDraw.Clear();
|
||||
subInventorySlotsToDraw.AddRange(highlightedSubInventorySlots);
|
||||
foreach (var slot in subInventorySlotsToDraw)
|
||||
foreach (var slot in highlightedSubInventorySlots)
|
||||
{
|
||||
int slotIndex = Array.IndexOf(slot.ParentInventory.slots, slot.Slot);
|
||||
if (slotIndex > -1 && slotIndex < slot.ParentInventory.slots.Length)
|
||||
@@ -1145,11 +1136,11 @@ namespace Barotrauma
|
||||
/*if (inventory != null && (CharacterInventory.PersonalSlots.HasFlag(type) || (inventory.isSubInventory && (inventory.Owner as Item) != null
|
||||
&& (inventory.Owner as Item).AllowedSlots.Any(a => CharacterInventory.PersonalSlots.HasFlag(a)))))
|
||||
{
|
||||
slotColor = slot.IsHighlighted ? GUI.Style.EquipmentSlotColor : GUI.Style.EquipmentSlotColor * 0.8f;
|
||||
slotColor = slot.IsHighlighted ? GUIColorSettings.EquipmentSlotColor : GUIColorSettings.EquipmentSlotColor * 0.8f;
|
||||
}
|
||||
else
|
||||
{
|
||||
slotColor = slot.IsHighlighted ? GUI.Style.InventorySlotColor : GUI.Style.InventorySlotColor * 0.8f;
|
||||
slotColor = slot.IsHighlighted ? GUIColorSettings.InventorySlotColor : GUIColorSettings.InventorySlotColor * 0.8f;
|
||||
}*/
|
||||
|
||||
if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; }
|
||||
@@ -1208,15 +1199,13 @@ namespace Barotrauma
|
||||
dir < 0 ? rect.Bottom + HUDLayoutSettings.Padding / 2 : rect.Y - HUDLayoutSettings.Padding / 2 - ContainedIndicatorHeight, rect.Width, ContainedIndicatorHeight);
|
||||
containedIndicatorArea.Inflate(-4, 0);
|
||||
|
||||
Color backgroundColor = GUI.Style.ColorInventoryBackground;
|
||||
|
||||
if (itemContainer.ContainedStateIndicator?.Texture == null)
|
||||
{
|
||||
containedIndicatorArea.Inflate(0, -2);
|
||||
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, backgroundColor, true);
|
||||
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.Gray * 0.9f, true);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height),
|
||||
ToolBox.GradientLerp(containedState, GUI.Style.ColorInventoryEmpty, GUI.Style.ColorInventoryHalf, GUI.Style.ColorInventoryFull) * 0.8f, true);
|
||||
ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.LightGreen) * 0.8f, true);
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(containedIndicatorArea.X + (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Y),
|
||||
new Vector2(containedIndicatorArea.X + (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Bottom),
|
||||
@@ -1235,12 +1224,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
||||
(inventory != null && inventory.Locked) ? backgroundColor * 0.5f : backgroundColor,
|
||||
(inventory != null && inventory.Locked) ? Color.Gray * 0.5f : Color.Gray * 0.9f,
|
||||
origin: indicatorSprite.size / 2,
|
||||
rotate: 0.0f,
|
||||
scale: indicatorScale);
|
||||
|
||||
Color indicatorColor = ToolBox.GradientLerp(containedState, GUI.Style.ColorInventoryEmpty, GUI.Style.ColorInventoryHalf, GUI.Style.ColorInventoryFull);
|
||||
Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.LightGreen);
|
||||
if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; }
|
||||
|
||||
spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(),
|
||||
|
||||
@@ -333,6 +333,15 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
aiTarget?.Draw(spriteBatch);
|
||||
var containedItems = ContainedItems;
|
||||
if (containedItems != null)
|
||||
{
|
||||
foreach (Item item in containedItems)
|
||||
{
|
||||
item.AiTarget?.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
if (body != null)
|
||||
{
|
||||
body.DebugDraw(spriteBatch, Color.White);
|
||||
|
||||
@@ -248,6 +248,8 @@ namespace Barotrauma
|
||||
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
if (aiTarget != null) aiTarget.Draw(spriteBatch);
|
||||
|
||||
Rectangle drawRect =
|
||||
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
|
||||
@@ -269,8 +271,7 @@ namespace Barotrauma
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * Math.Min(waterVolume / Volume, 1.0f))), Color.Cyan, true);
|
||||
if (WaterVolume > Volume)
|
||||
{
|
||||
float maxExcessWater = Volume * MaxCompress;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * (waterVolume - Volume) / maxExcessWater)), GUI.Style.Red, true);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, (int)(100 * (waterVolume - Volume) / MaxCompress)), GUI.Style.Red, true);
|
||||
}
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.Center.X, -drawRect.Y + drawRect.Height / 2, 10, 100), Color.Black);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("sprite", System.StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "sprite") continue;
|
||||
|
||||
Sprite = new Sprite(subElement, lazyLoad: true);
|
||||
break;
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Barotrauma
|
||||
int j = 0;
|
||||
foreach (XElement subElement in Prefab.Config.Elements())
|
||||
{
|
||||
if (!subElement.Name.ToString().Equals("deformablesprite", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "deformablesprite") continue;
|
||||
foreach (XElement animationElement in subElement.Elements())
|
||||
{
|
||||
var newDeformation = SpriteDeformation.Load(animationElement, Prefab.Name);
|
||||
|
||||
@@ -4,7 +4,6 @@ using Barotrauma.SpriteDeformations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -121,7 +120,7 @@ namespace Barotrauma
|
||||
|
||||
SerializableProperty.SerializeProperties(this, element);
|
||||
|
||||
foreach (XElement subElement in element.Elements().ToList())
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
@@ -140,7 +139,7 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (LightSourceParams lightSourceParams in LightSourceParams)
|
||||
{
|
||||
var lightElement = new XElement("LightSource");
|
||||
@@ -161,7 +160,7 @@ namespace Barotrauma
|
||||
bool elementFound = false;
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("overridecommonness", System.StringComparison.OrdinalIgnoreCase)
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "overridecommonness"
|
||||
&& subElement.GetAttributeString("leveltype", "") == overrideCommonness.Key)
|
||||
{
|
||||
subElement.Attribute("commonness").Value = overrideCommonness.Value.ToString("G", CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -589,14 +589,6 @@ namespace Barotrauma
|
||||
if (structure.FlippedX && structure.Prefab.CanSpriteFlipX) spriteEffects ^= SpriteEffects.FlipHorizontally;
|
||||
if (structure.flippedY && structure.Prefab.CanSpriteFlipY) spriteEffects ^= SpriteEffects.FlipVertically;
|
||||
}
|
||||
else if (e is WayPoint wayPoint)
|
||||
{
|
||||
Vector2 drawPos = e.WorldPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
drawPos += moveAmount;
|
||||
wayPoint.Draw(spriteBatch, drawPos);
|
||||
continue;
|
||||
}
|
||||
e.prefab?.DrawPlacing(spriteBatch,
|
||||
new Rectangle(e.WorldRect.Location + new Point((int)moveAmount.X, (int)-moveAmount.Y), e.WorldRect.Size), e.Scale, spriteEffects);
|
||||
GUI.DrawRectangle(spriteBatch,
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Barotrauma
|
||||
spriteBatch,
|
||||
new Vector2(rect.X + drawOffset.X, -(rect.Y + drawOffset.Y)),
|
||||
new Vector2(rect.Width, rect.Height),
|
||||
color: Prefab.BackgroundSpriteColor,
|
||||
color: color,
|
||||
textureScale: TextureScale * Scale,
|
||||
startOffset: backGroundOffset,
|
||||
depth: Math.Max(Prefab.BackgroundSprite.Depth + (ID % 255) * 0.000001f, depth + 0.000001f));
|
||||
@@ -350,6 +350,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AiTarget?.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,6 @@ namespace Barotrauma
|
||||
{
|
||||
partial class StructurePrefab : MapEntityPrefab
|
||||
{
|
||||
public Color BackgroundSpriteColor
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public override void UpdatePlacing(Camera cam)
|
||||
{
|
||||
Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub);
|
||||
|
||||
@@ -56,8 +56,6 @@ namespace Barotrauma
|
||||
private static List<RoundSound> roundSounds = null;
|
||||
public static RoundSound LoadRoundSound(XElement element, bool stream = false)
|
||||
{
|
||||
if (GameMain.SoundManager?.Disabled ?? true) { return null; }
|
||||
|
||||
string filename = element.GetAttributeString("file", "");
|
||||
if (string.IsNullOrEmpty(filename)) filename = element.GetAttributeString("sound", "");
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ namespace Barotrauma
|
||||
{
|
||||
partial class WayPoint : MapEntity
|
||||
{
|
||||
private static Dictionary<SpawnType, Sprite> iconSprites;
|
||||
private const int WaypointSize = 12, SpawnPointSize = 32;
|
||||
private static Texture2D iconTexture;
|
||||
private const int IconSize = 32;
|
||||
private static int[] iconIndices = { 3, 0, 1, 2 };
|
||||
|
||||
public override bool IsVisible(Rectangle worldView)
|
||||
{
|
||||
@@ -22,58 +23,58 @@ namespace Barotrauma
|
||||
get { return !IsHidden(); }
|
||||
}
|
||||
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
if (!editing && !GameMain.DebugDraw) { return; }
|
||||
|
||||
if (IsHidden()) { return; }
|
||||
|
||||
//Rectangle drawRect =
|
||||
// Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
|
||||
Vector2 drawPos = Position;
|
||||
if (Submarine != null) { drawPos += Submarine.DrawPosition; }
|
||||
if (Submarine != null) drawPos += Submarine.DrawPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
Draw(spriteBatch, drawPos);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 drawPos)
|
||||
{
|
||||
Color clr = currentHull == null ? Color.CadetBlue : GUI.Style.Green;
|
||||
if (spawnType != SpawnType.Path) { clr = Color.Gray; }
|
||||
Color clr = currentHull == null ? Color.Blue : Color.White;
|
||||
if (isObstructed)
|
||||
{
|
||||
clr = Color.Black;
|
||||
}
|
||||
if (IsHighlighted || IsHighlighted) { clr = Color.Lerp(clr, Color.White, 0.8f); }
|
||||
if (IsSelected) clr = GUI.Style.Red;
|
||||
if (IsHighlighted) clr = Color.DarkRed;
|
||||
|
||||
int iconSize = spawnType == SpawnType.Path ? WaypointSize : SpawnPointSize;
|
||||
if (ConnectedGap != null || Ladders != null || Stairs != null || SpawnType != SpawnType.Path) { iconSize = (int)(iconSize * 1.5f); }
|
||||
int iconX = iconIndices[(int)spawnType] * IconSize % iconTexture.Width;
|
||||
int iconY = (int)(Math.Floor(iconIndices[(int)spawnType] * IconSize / (float)iconTexture.Width)) * IconSize;
|
||||
|
||||
if (IsSelected || IsHighlighted)
|
||||
int iconSize = IconSize;
|
||||
if (ConnectedGap != null)
|
||||
{
|
||||
int glowSize = (int)(iconSize * 1.5f);
|
||||
GUI.Style.UIGlowCircular.Draw(spriteBatch,
|
||||
new Rectangle((int)(drawPos.X - glowSize / 2), (int)(drawPos.Y - glowSize / 2), glowSize, glowSize),
|
||||
Color.White);
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
if (Ladders != null)
|
||||
{
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
if (Stairs != null)
|
||||
{
|
||||
iconSize = (int)(iconSize * 1.5f);
|
||||
}
|
||||
|
||||
Sprite sprite = iconSprites[SpawnType];
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
sprite = iconSprites[SpawnType.Path];
|
||||
}
|
||||
sprite.Draw(spriteBatch, drawPos, clr, scale: iconSize / (float)sprite.SourceRect.Width, depth: 0.001f);
|
||||
sprite.RelativeOrigin = Vector2.One * 0.5f;
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
AssignedJob.Icon.Draw(spriteBatch, drawPos, AssignedJob.UIColor, scale: iconSize / (float)AssignedJob.Icon.SourceRect.Width * 0.8f, depth: 0.0f);
|
||||
}
|
||||
spriteBatch.Draw(iconTexture,
|
||||
new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize),
|
||||
new Rectangle(iconX, iconY, IconSize, IconSize), clr);
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), clr, true);
|
||||
|
||||
//GUI.SmallFont.DrawString(spriteBatch, Position.ToString(), new Vector2(Position.X, -Position.Y), Color.White);
|
||||
|
||||
foreach (MapEntity e in linkedTo)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
drawPos,
|
||||
new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
|
||||
(isObstructed ? Color.Gray : GUI.Style.Green) * 0.7f, width: 5, depth: 0.002f);
|
||||
isObstructed ? Color.Gray : GUI.Style.Green, width: 5);
|
||||
}
|
||||
|
||||
GUI.SmallFont.DrawString(spriteBatch,
|
||||
@@ -82,14 +83,6 @@ namespace Barotrauma
|
||||
Color.WhiteSmoke);
|
||||
}
|
||||
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (IsHidden()) { return false; }
|
||||
float dist = Vector2.DistanceSquared(position, WorldPosition);
|
||||
float radius = (SpawnType == SpawnType.Path ? WaypointSize : SpawnPointSize) * 0.6f;
|
||||
return dist < radius * radius;
|
||||
}
|
||||
|
||||
private bool IsHidden()
|
||||
{
|
||||
if (spawnType == SpawnType.Path)
|
||||
|
||||
@@ -71,8 +71,7 @@ namespace Barotrauma.Networking
|
||||
else
|
||||
{
|
||||
VoipSound.SetPosition(null);
|
||||
VoipSound.Gain = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partial void InitProjSpecific()
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -61,18 +60,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
private bool connected;
|
||||
|
||||
private enum RoundInitStatus
|
||||
{
|
||||
NotStarted,
|
||||
Starting,
|
||||
Started,
|
||||
TimedOut,
|
||||
Error,
|
||||
Interrupted
|
||||
}
|
||||
|
||||
private RoundInitStatus roundInitStatus = RoundInitStatus.NotStarted;
|
||||
|
||||
private byte myID;
|
||||
|
||||
private List<Client> otherClients;
|
||||
@@ -161,8 +148,6 @@ namespace Barotrauma.Networking
|
||||
this.ownerKey = ownerKey;
|
||||
this.steamP2POwner = steamP2POwner;
|
||||
|
||||
roundInitStatus = RoundInitStatus.NotStarted;
|
||||
|
||||
allowReconnect = true;
|
||||
|
||||
netStats = new NetStats();
|
||||
@@ -487,17 +472,13 @@ namespace Barotrauma.Networking
|
||||
|
||||
var msgBox = new GUIMessageBox(pwMsg, "", new string[] { TextManager.Get("OK"), TextManager.Get("Cancel") },
|
||||
relativeSize: new Vector2(0.25f, 0.1f), minSize: new Point(400, 170));
|
||||
var passwordHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform), childAnchor: Anchor.TopCenter);
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1f), passwordHolder.RectTransform) { MinSize = new Point(0, 20) })
|
||||
var passwordHolder = new GUILayoutGroup(new RectTransform(Vector2.One, msgBox.Content.RectTransform), childAnchor: Anchor.TopCenter);
|
||||
var passwordBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1f) , passwordHolder.RectTransform) { MinSize = new Point(0, 20) })
|
||||
{
|
||||
UserData = "password",
|
||||
Censor = true
|
||||
};
|
||||
|
||||
msgBox.Content.Recalculate();
|
||||
msgBox.Content.RectTransform.MinSize = new Point(0, msgBox.Content.RectTransform.Children.Sum(c => c.Rect.Height));
|
||||
msgBox.Content.Parent.RectTransform.MinSize = new Point(0, (int)(msgBox.Content.RectTransform.MinSize.Y / msgBox.Content.RectTransform.RelativeSize.Y));
|
||||
|
||||
var okButton = msgBox.Buttons[0];
|
||||
var cancelButton = msgBox.Buttons[1];
|
||||
|
||||
@@ -543,7 +524,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
foreach (Client c in ConnectedClients)
|
||||
{
|
||||
if (c.Character != null && c.Character.Removed) { c.Character = null; }
|
||||
c.UpdateSoundPosition();
|
||||
}
|
||||
|
||||
@@ -578,13 +558,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
try
|
||||
{
|
||||
incomingMessagesToProcess.Clear();
|
||||
incomingMessagesToProcess.AddRange(pendingIncomingMessages);
|
||||
foreach (var inc in incomingMessagesToProcess)
|
||||
{
|
||||
ReadDataMessage(inc);
|
||||
}
|
||||
pendingIncomingMessages.Clear();
|
||||
clientPeer?.Update(deltaTime);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -659,23 +632,11 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
private bool waitingForStartRoundFinalize = false;
|
||||
|
||||
private readonly List<IReadMessage> pendingIncomingMessages = new List<IReadMessage>();
|
||||
private readonly List<IReadMessage> incomingMessagesToProcess = new List<IReadMessage>();
|
||||
private CoroutineHandle startGameCoroutine;
|
||||
|
||||
private void ReadDataMessage(IReadMessage inc)
|
||||
{
|
||||
ServerPacketHeader header = (ServerPacketHeader)inc.ReadByte();
|
||||
|
||||
if (header != ServerPacketHeader.STARTGAMEFINALIZE &&
|
||||
header != ServerPacketHeader.ENDGAME &&
|
||||
waitingForStartRoundFinalize)
|
||||
{
|
||||
pendingIncomingMessages.Add(inc);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case ServerPacketHeader.UPDATE_LOBBY:
|
||||
@@ -753,10 +714,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAME:
|
||||
GameMain.Instance.ShowLoading(StartGame(inc), false);
|
||||
break;
|
||||
case ServerPacketHeader.STARTGAMEFINALIZE:
|
||||
ReadStartGameFinalize(inc);
|
||||
startGameCoroutine = GameMain.Instance.ShowLoading(StartGame(inc), false);
|
||||
break;
|
||||
case ServerPacketHeader.ENDGAME:
|
||||
string endMessage = inc.ReadString();
|
||||
@@ -767,8 +725,6 @@ namespace Barotrauma.Networking
|
||||
GameMain.GameSession.WinningTeam = winningTeam;
|
||||
GameMain.GameSession.Mission.Completed = true;
|
||||
}
|
||||
|
||||
roundInitStatus = RoundInitStatus.Interrupted;
|
||||
CoroutineManager.StartCoroutine(EndGame(endMessage), "EndGame");
|
||||
break;
|
||||
case ServerPacketHeader.CAMPAIGN_SETUP_INFO:
|
||||
@@ -819,37 +775,7 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadStartGameFinalize(IReadMessage inc)
|
||||
{
|
||||
ushort contentToPreloadCount = inc.ReadUInt16();
|
||||
List<ContentFile> contentToPreload = new List<ContentFile>();
|
||||
for (int i = 0; i < contentToPreloadCount; i++)
|
||||
{
|
||||
ContentType contentType = (ContentType)inc.ReadByte();
|
||||
string filePath = inc.ReadString();
|
||||
contentToPreload.Add(new ContentFile(filePath, contentType));
|
||||
}
|
||||
|
||||
GameMain.GameSession.EventManager.PreloadContent(contentToPreload);
|
||||
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + Level.Loaded.Seed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
throw new Exception(errorMsg);
|
||||
}
|
||||
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
roundInitStatus = RoundInitStatus.Started;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnDisconnect()
|
||||
{
|
||||
if (SteamManager.IsInitialized)
|
||||
@@ -958,7 +884,6 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
connected = false;
|
||||
connectCancelled = true;
|
||||
|
||||
string msg = "";
|
||||
@@ -1183,8 +1108,6 @@ namespace Barotrauma.Networking
|
||||
if (Character != null) Character.Remove();
|
||||
HasSpawned = false;
|
||||
eventErrorWritten = false;
|
||||
waitingForStartRoundFinalize = false;
|
||||
GameMain.NetLobbyScreen.StopWaitingForStartRound();
|
||||
|
||||
while (CoroutineManager.IsCoroutineRunning("EndGame"))
|
||||
{
|
||||
@@ -1203,11 +1126,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
EndVoteTickBox.Selected = false;
|
||||
|
||||
roundInitStatus = RoundInitStatus.Starting;
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
//int levelEqualityCheckVal = inc.ReadInt32();
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
float levelDifficulty = inc.ReadSingle();
|
||||
|
||||
byte losMode = inc.ReadByte();
|
||||
@@ -1225,15 +1146,23 @@ namespace Barotrauma.Networking
|
||||
int missionIndex = inc.ReadInt16();
|
||||
|
||||
bool respawnAllowed = inc.ReadBoolean();
|
||||
bool loadSecondSub = inc.ReadBoolean();
|
||||
|
||||
bool disguisesAllowed = inc.ReadBoolean();
|
||||
bool rewiringAllowed = inc.ReadBoolean();
|
||||
|
||||
bool allowRagdollButton = inc.ReadBoolean();
|
||||
|
||||
serverSettings.ReadMonsterEnabled(inc);
|
||||
ushort contentToPreloadCount = inc.ReadUInt16();
|
||||
List<ContentFile> contentToPreload = new List<ContentFile>();
|
||||
for (int i = 0; i < contentToPreloadCount; i++)
|
||||
{
|
||||
ContentType contentType = (ContentType)inc.ReadByte();
|
||||
string filePath = inc.ReadString();
|
||||
contentToPreload.Add(new ContentFile(filePath, contentType));
|
||||
}
|
||||
|
||||
bool includesFinalize = inc.ReadBoolean(); inc.ReadPadBits();
|
||||
serverSettings.ReadMonsterEnabled(inc);
|
||||
|
||||
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
||||
MultiPlayerCampaign campaign =
|
||||
@@ -1269,8 +1198,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
Rand.SetSyncedSeed(seed);
|
||||
|
||||
Task startRoundTask;
|
||||
|
||||
if (campaign == null)
|
||||
{
|
||||
//this shouldn't happen, TrySelectSub should stop the coroutine if the correct sub/shuttle cannot be found
|
||||
@@ -1310,132 +1237,21 @@ namespace Barotrauma.Networking
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
MissionPrefab missionPrefab = missionIndex < 0 ? null : MissionPrefab.List[missionIndex];
|
||||
|
||||
GameMain.GameSession = missionIndex < 0 ?
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionType.None) :
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, missionPrefab);
|
||||
|
||||
//startRoundTask = Task.Run(async () => { await Task.Yield(); GameMain.GameSession.StartRound(levelSeed, levelDifficulty); });
|
||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty);
|
||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionPrefab.List[missionIndex]);
|
||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameMain.GameSession?.CrewManager != null) GameMain.GameSession.CrewManager.Reset();
|
||||
/*startRoundTask = Task.Run(async () =>
|
||||
{
|
||||
await Task.Yield();
|
||||
GameMain.GameSession.StartRound(campaign.Map.SelectedConnection.Level,
|
||||
reloadSub: true,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
});*/
|
||||
GameMain.GameSession.StartRound(campaign.Map.SelectedConnection.Level,
|
||||
reloadSub: true,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
reloadSub: true,
|
||||
loadSecondSub: false,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
}
|
||||
|
||||
waitingForStartRoundFinalize = true;
|
||||
|
||||
DateTime? timeOut = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (timeOut.HasValue)
|
||||
{
|
||||
if (DateTime.Now > timeOut)
|
||||
{
|
||||
DebugConsole.ThrowError("Error while starting the round (did not receive STARTROUNDFINALIZE message from the server). Stopping the round...");
|
||||
roundInitStatus = RoundInitStatus.TimedOut;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (includesFinalize)
|
||||
{
|
||||
ReadStartGameFinalize(inc);
|
||||
}
|
||||
else
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.REQUEST_STARTGAMEFINALIZE);
|
||||
clientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
//wait for up to 30 seconds for the server to send the STARTGAMEFINALIZE message
|
||||
timeOut = DateTime.Now + new TimeSpan(0, 0, seconds: 30);
|
||||
/*if (startRoundTask.Status == TaskStatus.RanToCompletion)
|
||||
{
|
||||
if (includesFinalize)
|
||||
{
|
||||
ReadStartGameFinalize(inc);
|
||||
}
|
||||
else
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.REQUEST_STARTGAMEFINALIZE);
|
||||
clientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
//wait for up to 30 seconds for the server to send the STARTGAMEFINALIZE message
|
||||
timeOut = DateTime.Now + new TimeSpan(0, 0, seconds: 30);
|
||||
}
|
||||
else if (startRoundTask.Status == TaskStatus.Faulted)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round: startRoundTask failed.", startRoundTask.Exception.InnerExceptions[0]);
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
break;
|
||||
}
|
||||
else if (startRoundTask.Status == TaskStatus.Canceled)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round: startRoundTask was canceled.");
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!connected)
|
||||
{
|
||||
roundInitStatus = RoundInitStatus.Interrupted;
|
||||
break;
|
||||
}
|
||||
|
||||
if (roundInitStatus != RoundInitStatus.Starting)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
clientPeer.Update((float)Timing.Step);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round.", e, true);
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
//startRoundTask?.Wait();
|
||||
break;
|
||||
}
|
||||
|
||||
//waiting for a STARTGAMEFINALIZE message
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
waitingForStartRoundFinalize = false;
|
||||
|
||||
if (roundInitStatus != RoundInitStatus.Started)
|
||||
{
|
||||
if (roundInitStatus != RoundInitStatus.Interrupted)
|
||||
{
|
||||
DebugConsole.ThrowError(roundInitStatus.ToString());
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
}
|
||||
GameMain.GameSession.Mission?.ClientReadInitial(inc);
|
||||
|
||||
if (GameMain.GameSession.Submarine.IsFileCorrupted)
|
||||
{
|
||||
@@ -1445,7 +1261,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
||||
{
|
||||
if (Submarine.MainSubs[i] == null) { break; }
|
||||
if (!loadSecondSub && i > 0) { break; }
|
||||
|
||||
var teamID = i == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
|
||||
Submarine.MainSubs[i].TeamID = teamID;
|
||||
@@ -1455,10 +1271,23 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed: " + Level.Loaded.Seed +
|
||||
", sub: " + Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash.ShortHash + ")" +
|
||||
", mirrored: " + Level.Loaded.Mirrored + ").";
|
||||
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + levelSeed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
if (respawnAllowed) { respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null); }
|
||||
|
||||
gameStarted = true;
|
||||
GameMain.GameSession.EventManager.PreloadContent(contentToPreload);
|
||||
|
||||
ServerSettings.ServerDetailsChanged = true;
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
@@ -1606,7 +1435,7 @@ namespace Barotrauma.Networking
|
||||
existingClient.Muted = tc.Muted;
|
||||
existingClient.AllowKicking = tc.AllowKicking;
|
||||
GameMain.NetLobbyScreen.SetPlayerNameAndJobPreference(existingClient);
|
||||
if (Screen.Selected != GameMain.NetLobbyScreen && tc.CharacterID > 0)
|
||||
if (tc.CharacterID > 0)
|
||||
{
|
||||
existingClient.Character = Entity.FindEntityByID(tc.CharacterID) as Character;
|
||||
if (existingClient.Character == null)
|
||||
@@ -2150,7 +1979,8 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!permissions.HasFlag(ClientPermissions.ConsoleCommands)) { return false; }
|
||||
|
||||
if (permittedConsoleCommands.Any(c => c.Equals(commandName, StringComparison.OrdinalIgnoreCase))) { return true; }
|
||||
commandName = commandName.ToLowerInvariant();
|
||||
if (permittedConsoleCommands.Any(c => c.ToLowerInvariant() == commandName)) { return true; }
|
||||
|
||||
//check aliases
|
||||
foreach (DebugConsole.Command command in DebugConsole.Commands)
|
||||
@@ -2668,7 +2498,6 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
var transfer = fileReceiver.ActiveTransfers.First();
|
||||
GameMain.NetLobbyScreen.FileTransferFrame.Visible = true;
|
||||
GameMain.NetLobbyScreen.FileTransferFrame.UserData = transfer;
|
||||
GameMain.NetLobbyScreen.FileTransferTitle.Text =
|
||||
ToolBox.LimitString(
|
||||
TextManager.GetWithVariable("DownloadingFile", "[filename]", transfer.FileName),
|
||||
@@ -2982,8 +2811,8 @@ namespace Barotrauma.Networking
|
||||
errorLines.Add(" " + DebugConsole.Messages[i].Time + " - " + DebugConsole.Messages[i].Text);
|
||||
}
|
||||
|
||||
string filePath = "event_error_log_client_" + Name + "_" + DateTime.UtcNow.ToShortTimeString() + ".log";
|
||||
filePath = Path.Combine(ServerLog.SavePath, ToolBox.RemoveInvalidFileNameChars(filePath));
|
||||
string filePath = "event_error_log_client_" + Name + "_" + ToolBox.RemoveInvalidFileNameChars(DateTime.UtcNow.ToShortTimeString() + ".log");
|
||||
filePath = Path.Combine(ServerLog.SavePath, filePath);
|
||||
|
||||
if (!Directory.Exists(ServerLog.SavePath))
|
||||
{
|
||||
|
||||
@@ -91,7 +91,6 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
netClient.ReadMessages(incomingLidgrenMessages);
|
||||
|
||||
foreach (NetIncomingMessage inc in incomingLidgrenMessages)
|
||||
@@ -108,6 +107,8 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
incomingLidgrenMessages.Clear();
|
||||
}
|
||||
|
||||
private void HandleDataMessage(NetIncomingMessage inc)
|
||||
|
||||
@@ -1314,69 +1314,79 @@ namespace Barotrauma.Steam
|
||||
return upToDate;
|
||||
}
|
||||
|
||||
public static async Task<bool> AutoUpdateWorkshopItems()
|
||||
public static bool AutoUpdateWorkshopItems()
|
||||
{
|
||||
if (!isInitialized) { return false; }
|
||||
|
||||
var query = new Steamworks.Ugc.Query(Steamworks.UgcType.All)
|
||||
.WhereUserSubscribed()
|
||||
.WithLongDescription();
|
||||
|
||||
DateTime startTime = DateTime.Now;
|
||||
DateTime endTime = startTime + new TimeSpan(0, 0, 30);
|
||||
|
||||
int processedResults = 0; int pageIndex = 1;
|
||||
Steamworks.Ugc.ResultPage? resultPage = await query.GetPageAsync(pageIndex);
|
||||
|
||||
while (resultPage.HasValue && resultPage?.ResultCount > 0)
|
||||
//ugcResultPageTasks ??= new List<Task>();
|
||||
//ugcResultPageTasks.Add();
|
||||
CancellationTokenSource cancelTokenSource = new CancellationTokenSource();
|
||||
CancellationToken cancelToken = cancelTokenSource.Token;
|
||||
Task task = Task.Factory.StartNew(async () =>
|
||||
{
|
||||
if (DateTime.Now > endTime)
|
||||
int processedResults = 0; int pageIndex = 1;
|
||||
Steamworks.Ugc.ResultPage? resultPage = await query.GetPageAsync(pageIndex);
|
||||
|
||||
while (resultPage.HasValue && resultPage?.ResultCount > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (var item in resultPage.Value.Entries)
|
||||
{
|
||||
try
|
||||
foreach (var item in resultPage.Value.Entries)
|
||||
{
|
||||
if (!item.IsInstalled || !CheckWorkshopItemEnabled(item) || CheckWorkshopItemUpToDate(item)) { continue; }
|
||||
if (!UpdateWorkshopItem(item, out string errorMsg))
|
||||
if (cancelToken.IsCancellationRequested)
|
||||
{
|
||||
cancelToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
try
|
||||
{
|
||||
if (!item.IsInstalled || !CheckWorkshopItemEnabled(item) || CheckWorkshopItemUpToDate(item)) { continue; }
|
||||
if (!UpdateWorkshopItem(item, out string errorMsg))
|
||||
{
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: potential race condition
|
||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: potential race condition
|
||||
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, e.Message + ", " + e.TargetSite }));
|
||||
GameAnalyticsManager.AddErrorEventOnce(
|
||||
"SteamManager.AutoUpdateWorkshopItems:" + e.Message,
|
||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Failed to autoupdate workshop item \"" + item.Title + "\". " + e.Message + "\n" + e.StackTrace);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("Error"),
|
||||
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, e.Message + ", " + e.TargetSite }));
|
||||
GameAnalyticsManager.AddErrorEventOnce(
|
||||
"SteamManager.AutoUpdateWorkshopItems:" + e.Message,
|
||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||
"Failed to autoupdate workshop item \"" + item.Title + "\". " + e.Message + "\n" + e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
processedResults += resultPage.Value.ResultCount;
|
||||
pageIndex++;
|
||||
if (processedResults < resultPage?.TotalCount)
|
||||
{
|
||||
resultPage = await query.GetPageAsync(pageIndex);
|
||||
processedResults += resultPage.Value.ResultCount;
|
||||
pageIndex++;
|
||||
if (processedResults < resultPage?.TotalCount)
|
||||
{
|
||||
resultPage = await query.GetPageAsync(pageIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPage = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPage = null;
|
||||
}
|
||||
}
|
||||
}, cancelToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
|
||||
|
||||
return true;
|
||||
task.Wait(10000);
|
||||
if (!task.IsCompleted)
|
||||
{
|
||||
cancelTokenSource.Cancel();
|
||||
task.Wait();
|
||||
}
|
||||
|
||||
return task.Status == TaskStatus.RanToCompletion;
|
||||
}
|
||||
|
||||
public static bool UpdateWorkshopItem(Steamworks.Ugc.Item? item, out string errorMsg)
|
||||
@@ -1421,7 +1431,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
private static void CorrectContentFileCopy(ContentPackage package, string src, string dest, bool overwrite)
|
||||
{
|
||||
if (Path.GetExtension(src).Equals(".xml", StringComparison.OrdinalIgnoreCase))
|
||||
if (Path.GetExtension(src).ToLowerInvariant() == ".xml")
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(src);
|
||||
if (doc != null)
|
||||
@@ -1471,7 +1481,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
if (checkIfFileExists)
|
||||
{
|
||||
ContentPackage otherContentPackage = ContentPackage.List.Find(cp => cp.Name.Equals(splitPath[1], StringComparison.OrdinalIgnoreCase));
|
||||
ContentPackage otherContentPackage = ContentPackage.List.Find(cp => cp.Name.ToLowerInvariant() == splitPath[1].ToLowerInvariant());
|
||||
if (otherContentPackage != null)
|
||||
{
|
||||
string otherPackageName = Path.GetDirectoryName(otherContentPackage.Path);
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Barotrauma.Networking
|
||||
if (client.VoipSound == null)
|
||||
{
|
||||
DebugConsole.Log("Recreating voipsound " + queueId);
|
||||
client.VoipSound = new VoipSound(client.Name, GameMain.SoundManager, client.VoipQueue);
|
||||
client.VoipSound = new VoipSound(GameMain.SoundManager, client.VoipQueue);
|
||||
}
|
||||
|
||||
if (client.Character != null && !client.Character.IsDead && !client.Character.Removed && client.Character.SpeechImpediment <= 100.0f)
|
||||
@@ -119,7 +119,7 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen?.SetPlayerSpeaking(client);
|
||||
GameMain.GameSession?.CrewManager?.SetClientSpeaking(client);
|
||||
|
||||
if ((client.VoipSound.CurrentAmplitude * client.VoipSound.Gain * GameMain.SoundManager.GetCategoryGainMultiplier("voip")) > 0.1f) //TODO: might need to tweak
|
||||
if (client.VoipSound.CurrentAmplitude > 0.1f) //TODO: might need to tweak
|
||||
{
|
||||
if (client.Character != null && !client.Character.Removed)
|
||||
{
|
||||
|
||||
@@ -11,18 +11,7 @@ namespace Barotrauma.Particles
|
||||
|
||||
public string OriginalName { get { return Name; } }
|
||||
|
||||
private string _identifier;
|
||||
public string Identifier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_identifier == null)
|
||||
{
|
||||
_identifier = Name.ToLowerInvariant();
|
||||
}
|
||||
return _identifier;
|
||||
}
|
||||
}
|
||||
public string Identifier { get { return Name.ToLowerInvariant(); } }
|
||||
|
||||
public string FilePath { get; private set; }
|
||||
|
||||
@@ -57,7 +46,7 @@ namespace Barotrauma.Particles
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("sprite", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "sprite")
|
||||
{
|
||||
Sprites.Add(new Sprite(subElement));
|
||||
}
|
||||
|
||||
@@ -150,12 +150,6 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
DistanceMin = DistanceMax = element.GetAttributeFloat("distance", 0.0f);
|
||||
}
|
||||
if (DistanceMax < DistanceMin)
|
||||
{
|
||||
var temp = DistanceMin;
|
||||
DistanceMin = DistanceMax;
|
||||
DistanceMax = temp;
|
||||
}
|
||||
|
||||
if (element.Attribute("velocity") == null)
|
||||
{
|
||||
@@ -166,12 +160,6 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
VelocityMin = VelocityMax = element.GetAttributeFloat("velocity", 0.0f);
|
||||
}
|
||||
if (VelocityMax < VelocityMin)
|
||||
{
|
||||
var temp = VelocityMin;
|
||||
VelocityMin = VelocityMax;
|
||||
VelocityMax = temp;
|
||||
}
|
||||
|
||||
EmitInterval = element.GetAttributeFloat("emitinterval", 0.0f);
|
||||
ParticlesPerSecond = element.GetAttributeInt("particlespersecond", 0);
|
||||
|
||||
@@ -3347,7 +3347,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateCloseButton(SerializableEntityEditor editor, Action onButtonClicked, float size = 1)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
int height = 30;
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(height * size * GUI.yScale)), editor.RectTransform, isFixedSize: true), style: null)
|
||||
{
|
||||
@@ -3367,7 +3366,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButtonAtLast(ParamsEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parentFrame = new GUIFrame(new RectTransform(new Point(editor.EditorBox.Rect.Width, (int)(50 * GUI.yScale)), editor.EditorBox.Content.RectTransform), style: null, color: ParamsEditor.Color)
|
||||
{
|
||||
CanBeFocused = false
|
||||
@@ -3385,7 +3383,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
void CreateAddButton(SerializableEntityEditor editor, Action onButtonClicked, string text)
|
||||
{
|
||||
if (editor == null) { return; }
|
||||
var parent = new GUIFrame(new RectTransform(new Point(editor.Rect.Width, (int)(60 * GUI.yScale)), editor.RectTransform), style: null)
|
||||
{
|
||||
CanBeFocused = false
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Barotrauma.CharacterEditor
|
||||
return false;
|
||||
}
|
||||
var path = Path.GetFileName(TexturePath);
|
||||
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
|
||||
if (!path.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("WrongFileType"), GUI.Style.Red);
|
||||
texturePathElement.Flash(GUI.Style.Red);
|
||||
@@ -724,8 +724,8 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
ParseLimbsFromGUIElements();
|
||||
ParseJointsFromGUIElements();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("torso", StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.Equals("head", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
||||
var main = LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "torso").FirstOrDefault() ??
|
||||
LimbXElements.Values.Select(xe => xe.Attribute("type")).Where(a => a.Value.ToLowerInvariant() == "head").FirstOrDefault();
|
||||
if (main == null)
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("MissingTorsoOrHead"), GUI.Style.Red);
|
||||
|
||||
@@ -91,13 +91,7 @@ namespace Barotrauma
|
||||
c.DoVisibilityCheck(cam);
|
||||
if (c.IsVisible != wasVisible)
|
||||
{
|
||||
c.AnimController.Limbs.ForEach(l =>
|
||||
{
|
||||
if (l.LightSource != null)
|
||||
{
|
||||
l.LightSource.Enabled = c.IsVisible;
|
||||
}
|
||||
});
|
||||
c.AnimController.Limbs.ForEach(l => { if (l.LightSource != null) l.LightSource.Enabled = c.IsVisible; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,23 +282,14 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||
foreach (Character c in Character.CharacterList)
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
if (GameMain.DebugDraw && GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
c.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
Level.Loaded.DrawFront(spriteBatch, cam);
|
||||
}
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
MapEntity.mapEntityList.ForEach(me => me.AiTarget?.Draw(spriteBatch));
|
||||
Character.CharacterList.ForEach(c => c.AiTarget?.Draw(spriteBatch));
|
||||
if (GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
GameMain.GameSession.EventManager.DebugDraw(spriteBatch);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
if (GameMain.LightManager.LosEnabled && GameMain.LightManager.LosMode != LosMode.None && Character.Controlled != null)
|
||||
|
||||
@@ -517,21 +517,8 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
XElement levelParamElement = element;
|
||||
if (element.IsOverride())
|
||||
{
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, subElement, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
}
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -552,7 +539,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(levelObjPrefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != levelObjPrefab.Name.ToLowerInvariant()) continue;
|
||||
levelObjPrefab.Save(element);
|
||||
break;
|
||||
}
|
||||
@@ -577,7 +564,7 @@ namespace Barotrauma
|
||||
bool elementFound = false;
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(genParams.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != genParams.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(genParams, element, true);
|
||||
elementFound = true;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ namespace Barotrauma
|
||||
private IEnumerable<object> LoadRound()
|
||||
{
|
||||
GameMain.GameSession.StartRound(campaignUI.SelectedLevel,
|
||||
reloadSub: true,
|
||||
reloadSub: true,
|
||||
loadSecondSub: false,
|
||||
mirrorLevel: GameMain.GameSession.Map.CurrentLocation != GameMain.GameSession.Map.SelectedConnection.Locations[0]);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!(FileTransferFrame.UserData is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
if (!(userdata is FileReceiver.FileTransferIn transfer)) { return false; }
|
||||
GameMain.Client?.CancelFileTransfer(transfer);
|
||||
GameMain.Client.FileReceiver.StopTransfer(transfer);
|
||||
return true;
|
||||
@@ -658,7 +658,7 @@ namespace Barotrauma
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
GameMain.Client.RequestStartRound();
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: false), "WaitForStartRound");
|
||||
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton, allowCancel: true), "WaitForStartRound");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1147,22 +1147,6 @@ namespace Barotrauma
|
||||
clientDisabledElements.AddRange(botSpawnModeButtons);
|
||||
}
|
||||
|
||||
public void StopWaitingForStartRound()
|
||||
{
|
||||
CoroutineManager.StopCoroutines("WaitForStartRound");
|
||||
|
||||
GUIMessageBox.CloseAll();
|
||||
if (StartButton != null)
|
||||
{
|
||||
StartButton.Enabled = true;
|
||||
}
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Enabled = true;
|
||||
}
|
||||
GUI.ClearCursorWait();
|
||||
}
|
||||
|
||||
public IEnumerable<object> WaitForStartRound(GUIButton startButton, bool allowCancel)
|
||||
{
|
||||
GUI.SetCursorWaiting();
|
||||
@@ -1189,8 +1173,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
|
||||
while (Selected == GameMain.NetLobbyScreen &&
|
||||
DateTime.Now < timeOut)
|
||||
while (Selected == GameMain.NetLobbyScreen && DateTime.Now < timeOut)
|
||||
{
|
||||
msgBox.Header.Text = headerText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -1339,8 +1322,6 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null) return;
|
||||
spectateButton.Visible = true;
|
||||
spectateButton.Enabled = true;
|
||||
|
||||
StartButton.Visible = false;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
@@ -1780,7 +1761,7 @@ namespace Barotrauma
|
||||
}
|
||||
GameMain.Client.RequestSelectMode(component.Parent.GetChildIndex(component));
|
||||
HighlightMode(SelectedModeIndex);
|
||||
return !presetName.Equals("multiplayercampaign", StringComparison.OrdinalIgnoreCase);
|
||||
return (presetName.ToLowerInvariant() != "multiplayercampaign");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2260,7 +2241,7 @@ namespace Barotrauma
|
||||
targetMicStyle = "GUIMicrophoneDisabled";
|
||||
}
|
||||
|
||||
if (!targetMicStyle.Equals(currMicStyle, StringComparison.OrdinalIgnoreCase))
|
||||
if (targetMicStyle.ToLowerInvariant() != currMicStyle.ToLowerInvariant())
|
||||
{
|
||||
GUI.Style.Apply(micIcon, targetMicStyle);
|
||||
}
|
||||
@@ -2616,7 +2597,7 @@ namespace Barotrauma
|
||||
GUILayoutGroup row = null;
|
||||
int itemsInRow = 0;
|
||||
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").Equals("head", StringComparison.OrdinalIgnoreCase));
|
||||
XElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e => e.GetAttributeString("type", "").ToLowerInvariant() == "head");
|
||||
XElement headSpriteElement = headElement.Element("sprite");
|
||||
string spritePathWithTags = headSpriteElement.Attribute("texture").Value;
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
if (!element.Name.ToString().Equals(prefab.Name, StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (element.Name.ToString().ToLowerInvariant() != prefab.Name.ToLowerInvariant()) continue;
|
||||
SerializableProperty.SerializeProperties(prefab, element, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ namespace Barotrauma
|
||||
|
||||
child.Visible =
|
||||
serverInfo.OwnerVerified &&
|
||||
serverInfo.ServerName.Contains(searchBox.Text, StringComparison.OrdinalIgnoreCase) &&
|
||||
serverInfo.ServerName.ToLowerInvariant().Contains(searchBox.Text.ToLowerInvariant()) &&
|
||||
(!filterSameVersion.Selected || (remoteVersion != null && NetworkMember.IsCompatible(remoteVersion, GameMain.Version))) &&
|
||||
(!filterPassword.Selected || !serverInfo.HasPassword) &&
|
||||
(!filterIncompatible.Selected || !incompatible) &&
|
||||
@@ -996,7 +996,7 @@ namespace Barotrauma
|
||||
foreach (GUITickBox tickBox in gameModeTickBoxes)
|
||||
{
|
||||
var gameMode = (string)tickBox.UserData;
|
||||
if (!tickBox.Selected && serverInfo.GameMode.Equals(gameMode, StringComparison.OrdinalIgnoreCase))
|
||||
if (!tickBox.Selected && (serverInfo.GameMode == gameMode.ToLowerInvariant() || serverInfo.GameMode == gameMode))
|
||||
{
|
||||
child.Visible = false;
|
||||
break;
|
||||
@@ -1512,7 +1512,7 @@ namespace Barotrauma
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
|
||||
if (masterServerData.Substring(0, 5).Equals("error", StringComparison.OrdinalIgnoreCase))
|
||||
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
||||
{
|
||||
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
|
||||
return;
|
||||
|
||||
@@ -1097,7 +1097,7 @@ namespace Barotrauma
|
||||
var tagBtn = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tagHolder.Content.RectTransform, anchor: Anchor.CenterLeft),
|
||||
tag.CapitaliseFirstInvariant(), style: "GUIButtonRound");
|
||||
tagBtn.TextBlock.AutoScaleHorizontal = true;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.Equals(tag, StringComparison.OrdinalIgnoreCase)) ?? false;
|
||||
tagBtn.Selected = itemEditor?.Tags?.Any(t => t.ToLowerInvariant() == tag) ?? false;
|
||||
|
||||
tagBtn.OnClicked = (btn, userdata) =>
|
||||
{
|
||||
@@ -1108,7 +1108,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
itemEditor?.Tags?.RemoveAll(t => t.Equals(tagBtn.Text, StringComparison.OrdinalIgnoreCase));
|
||||
itemEditor?.Tags?.RemoveAll(t => t.ToLowerInvariant() == tagBtn.Text.ToLowerInvariant());
|
||||
tagBtn.Selected = false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -7,8 +7,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using EventInput;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -90,9 +88,6 @@ namespace Barotrauma
|
||||
private GUITextBlock submarineDescriptionCharacterCount;
|
||||
|
||||
private Mode mode;
|
||||
|
||||
// Prevent the mode from changing
|
||||
private bool lockMode;
|
||||
|
||||
public override Camera Cam
|
||||
{
|
||||
@@ -238,21 +233,15 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
defaultModeTickBox = new GUITickBox(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "EditSubButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("SubEditorEditingMode"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
if (tBox.Selected) { SetMode(Mode.Default); }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -261,12 +250,8 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("CharacterModeButton") + '\n' + TextManager.Get("CharacterModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Character : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -275,17 +260,20 @@ namespace Barotrauma
|
||||
ToolTip = TextManager.Get("WiringModeButton") + '\n' + TextManager.Get("WiringModeToolTip"),
|
||||
OnSelected = (GUITickBox tBox) =>
|
||||
{
|
||||
if (!lockMode)
|
||||
{
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
SetMode(tBox.Selected ? Mode.Wiring : Mode.Default);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = GenerateWaypoints
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.9f), paddedTopPanel.RectTransform), style: "VerticalLine");
|
||||
|
||||
var visibilityButton = new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "SetupVisibilityButton")
|
||||
{
|
||||
@@ -311,42 +299,6 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
spacing = new GUIFrame(new RectTransform(new Vector2(0.02f, 1.0f), paddedTopPanel.RectTransform), style: null);
|
||||
new GUIFrame(new RectTransform(new Vector2(0.1f, 0.9f), spacing.RectTransform, Anchor.Center), style: "VerticalLine");
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.9f, 0.9f), paddedTopPanel.RectTransform, scaleBasis: ScaleBasis.BothHeight), "", style: "GenerateWaypointsButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("GenerateWaypointsButton") + '\n' + TextManager.Get("GenerateWaypointsToolTip"),
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (WayPoint.WayPointList.Any())
|
||||
{
|
||||
var generateWaypointsVerification = new GUIMessageBox("", TextManager.Get("generatewaypointsverification"), new string[] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||
generateWaypointsVerification.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
generateWaypointsVerification.Close();
|
||||
return true;
|
||||
};
|
||||
generateWaypointsVerification.Buttons[1].OnClicked = generateWaypointsVerification.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GenerateWaypoints())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("waypointsgeneratedsuccesfully"), GUI.Style.Green);
|
||||
}
|
||||
WayPoint.ShowWayPoints = true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
@@ -1035,27 +987,18 @@ namespace Barotrauma
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
var result = SaveSubToFile(nameBox.Text);
|
||||
saveFrame = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool SaveSubToFile(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
||||
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), GUI.Style.Red);
|
||||
return false;
|
||||
if (nameBox.Text.Contains(illegalChar))
|
||||
{
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
if (!name.Contains(illegalChar)) continue;
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), GUI.Style.Red);
|
||||
return false;
|
||||
}
|
||||
|
||||
string savePath = name + ".sub";
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
string prevSavePath = null;
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
@@ -1072,8 +1015,8 @@ namespace Barotrauma
|
||||
if (vanilla != null)
|
||||
{
|
||||
var vanillaSubs = vanilla.GetFilesOfType(ContentType.Submarine);
|
||||
string pathToCompare = savePath.Replace(@"\", @"/");
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").Equals(pathToCompare, StringComparison.OrdinalIgnoreCase)))
|
||||
string pathToCompare = savePath.Replace(@"\", @"/").ToLowerInvariant();
|
||||
if (vanillaSubs.Any(sub => sub.Replace(@"\", @"/").ToLowerInvariant() == pathToCompare))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("CannotEditVanillaSubs"), GUI.Style.Red, font: GUI.LargeFont);
|
||||
return false;
|
||||
@@ -1081,7 +1024,7 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
if (previewImage?.Sprite?.Texture != null)
|
||||
if (previewImage.Sprite?.Texture != null)
|
||||
{
|
||||
using (MemoryStream imgStream = new MemoryStream())
|
||||
{
|
||||
@@ -1093,7 +1036,7 @@ namespace Barotrauma
|
||||
{
|
||||
Submarine.SaveCurrent(savePath);
|
||||
}
|
||||
Submarine.MainSub?.CheckForErrors();
|
||||
Submarine.MainSub.CheckForErrors();
|
||||
|
||||
GUI.AddMessage(TextManager.GetWithVariable("SubSavedNotification", "[filepath]", Submarine.MainSub.FilePath), GUI.Style.Green);
|
||||
|
||||
@@ -1111,6 +1054,8 @@ namespace Barotrauma
|
||||
|
||||
subNameLabel.Text = ToolBox.LimitString(Submarine.MainSub.Name, subNameLabel.Font, subNameLabel.Rect.Width);
|
||||
|
||||
saveFrame = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1679,10 +1624,7 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var lightComponent = item.GetComponent<LightComponent>();
|
||||
if (lightComponent != null)
|
||||
{
|
||||
lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
if (lightComponent != null) lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
|
||||
if (selectedSub.GameVersion < new Version("0.8.9.0"))
|
||||
@@ -1812,20 +1754,18 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetMode(Mode newMode)
|
||||
public void SetMode(Mode mode)
|
||||
{
|
||||
if (newMode == mode) { return; }
|
||||
mode = newMode;
|
||||
if (mode == this.mode) { return; }
|
||||
this.mode = mode;
|
||||
|
||||
lockMode = true;
|
||||
defaultModeTickBox.Selected = newMode == Mode.Default;
|
||||
defaultModeTickBox.Selected = mode == Mode.Default;
|
||||
defaultModeTickBox.CanBeFocused = !defaultModeTickBox.Selected;
|
||||
|
||||
characterModeTickBox.Selected = newMode == Mode.Character;
|
||||
wiringModeTickBox.Selected = newMode == Mode.Wiring;
|
||||
lockMode = false;
|
||||
|
||||
switch (newMode)
|
||||
characterModeTickBox.Selected = mode == Mode.Character;
|
||||
wiringModeTickBox.Selected = mode == Mode.Wiring;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case Mode.Character:
|
||||
CreateDummyCharacter();
|
||||
@@ -1850,7 +1790,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.FilteredSelectedList.Clear();
|
||||
}
|
||||
|
||||
private void RemoveDummyCharacter()
|
||||
@@ -2065,10 +2004,12 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GenerateWaypoints()
|
||||
private bool GenerateWaypoints(GUIButton button, object obj)
|
||||
{
|
||||
if (Submarine.MainSub == null) { return false; }
|
||||
return WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
if (Submarine.MainSub == null) return false;
|
||||
|
||||
WayPoint.GenerateSubWaypoints(Submarine.MainSub);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddPreviouslyUsed(MapEntityPrefab mapEntityPrefab)
|
||||
@@ -2465,53 +2406,12 @@ namespace Barotrauma
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
if (PlayerInput.KeyHit(Microsoft.Xna.Framework.Input.Keys.Tab))
|
||||
{
|
||||
// TODO adjust when the new inventory stuff rolls in
|
||||
if (PlayerInput.KeyHit(Keys.Q) && mode == Mode.Default)
|
||||
{
|
||||
toggleEntityMenuButton.OnClicked?.Invoke(toggleEntityMenuButton, toggleEntityMenuButton.UserData);
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Tab))
|
||||
{
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyDown(Keys.LeftControl))
|
||||
{
|
||||
// Save menu
|
||||
if (PlayerInput.KeyHit(Keys.S))
|
||||
{
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift))
|
||||
{
|
||||
// Save the sub without a menu
|
||||
if (subNameLabel != null)
|
||||
{
|
||||
SaveSubToFile(subNameLabel.Text);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save menu
|
||||
if (saveFrame == null)
|
||||
{
|
||||
CreateSaveScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1-3 keys on the keyboard for switching modes
|
||||
if (PlayerInput.KeyHit(Keys.D1)) { SetMode(Mode.Default); }
|
||||
if (PlayerInput.KeyHit(Keys.D2)) { SetMode(Mode.Character); }
|
||||
if (PlayerInput.KeyHit(Keys.D3)) { SetMode(Mode.Wiring); }
|
||||
}
|
||||
else
|
||||
{
|
||||
cam.MoveCamera((float) deltaTime, true);
|
||||
}
|
||||
entityFilterBox.Select();
|
||||
}
|
||||
|
||||
|
||||
cam.MoveCamera((float)deltaTime, true);
|
||||
if (PlayerInput.MidButtonHeld())
|
||||
{
|
||||
Vector2 moveSpeed = PlayerInput.MouseSpeed * (float)deltaTime * 100.0f / cam.Zoom;
|
||||
|
||||
@@ -97,32 +97,6 @@ namespace Barotrauma.Sounds
|
||||
|
||||
if (position != null)
|
||||
{
|
||||
if (float.IsNaN(position.Value.X))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.X is NaN");
|
||||
}
|
||||
if (float.IsNaN(position.Value.Y))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Y is NaN");
|
||||
}
|
||||
if (float.IsNaN(position.Value.Z))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Z is NaN");
|
||||
}
|
||||
|
||||
if (float.IsInfinity(position.Value.X))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.X is Infinity");
|
||||
}
|
||||
if (float.IsInfinity(position.Value.Y))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Y is Infinity");
|
||||
}
|
||||
if (float.IsInfinity(position.Value.Z))
|
||||
{
|
||||
throw new Exception("Failed to set source's position: " + debugName + ", position.Z is Infinity");
|
||||
}
|
||||
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
Al.Sourcei(alSource, Al.SourceRelative, Al.False);
|
||||
int alError = Al.GetError();
|
||||
@@ -404,12 +378,12 @@ namespace Barotrauma.Sounds
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
if (!Al.IsSource(alSource)) return false;
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
bool playing = state == Al.Playing;
|
||||
int alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to determine playing state from source: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
bool playing = state == Al.Playing;
|
||||
return playing;
|
||||
}
|
||||
}
|
||||
@@ -641,7 +615,7 @@ namespace Barotrauma.Sounds
|
||||
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
|
||||
|
||||
int state;
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state);
|
||||
bool playing = state == Al.Playing;
|
||||
int alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
@@ -656,7 +630,7 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
throw new Exception("Failed to determine processed buffers from streamed source: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
|
||||
|
||||
Al.SourceUnqueueBuffers(alSource, unqueuedBufferCount, unqueuedBuffers);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
@@ -753,20 +727,9 @@ namespace Barotrauma.Sounds
|
||||
streamAmplitude = streamBufferAmplitudes[queueStartIndex];
|
||||
|
||||
Al.GetSourcei(alSource, Al.SourceState, out state);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to retrieve stream source state: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
|
||||
if (state != Al.Playing)
|
||||
{
|
||||
Al.SourcePlay(alSource);
|
||||
alError = Al.GetError();
|
||||
if (alError != Al.NoError)
|
||||
{
|
||||
throw new Exception("Failed to start stream playback: " + debugName + ", " + Al.GetErrorString(alError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,10 +738,6 @@ namespace Barotrauma.Sounds
|
||||
streamAmplitude = 0.0f;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError($"An exception was thrown when updating a sound stream ({debugName})", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Exit(mutex);
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Barotrauma
|
||||
string filePathB = b.GetAttributeString("file", "").CleanUpPath();
|
||||
float baseGainB = b.GetAttributeFloat("volume", 1.0f);
|
||||
float rangeB = b.GetAttributeFloat("range", 1000.0f);
|
||||
return a.Name.ToString().Equals(b.Name.ToString(), StringComparison.OrdinalIgnoreCase) &&
|
||||
return a.Name.ToString().ToLowerInvariant() == b.Name.ToString().ToLowerInvariant() &&
|
||||
filePathA == filePathB && MathUtils.NearlyEqual(baseGainA, baseGainB) &&
|
||||
MathUtils.NearlyEqual(rangeA, rangeB);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace Barotrauma
|
||||
|
||||
SoundCount = 1 + soundElements.Count();
|
||||
|
||||
var startUpSoundElement = soundElements.Find(e => e.Name.ToString().Equals("startupsound", StringComparison.OrdinalIgnoreCase));
|
||||
var startUpSoundElement = soundElements.Find(e => e.Name.ToString().ToLowerInvariant() == "startupsound");
|
||||
if (startUpSoundElement != null)
|
||||
{
|
||||
startUpSound = GameMain.SoundManager.LoadSound(startUpSoundElement, false);
|
||||
@@ -182,7 +182,7 @@ namespace Barotrauma
|
||||
musicClips.AddIfNotNull(newMusicClip);
|
||||
if (loadedSoundElements != null)
|
||||
{
|
||||
if (newMusicClip.Type.Equals("menu", StringComparison.OrdinalIgnoreCase))
|
||||
if (newMusicClip.Type.ToLowerInvariant() == "menu")
|
||||
{
|
||||
targetMusic[0] = newMusicClip;
|
||||
}
|
||||
|
||||
@@ -59,10 +59,8 @@ namespace Barotrauma.Sounds
|
||||
get { return soundChannel?.CurrentAmplitude ?? 0.0f; }
|
||||
}
|
||||
|
||||
public VoipSound(string name, SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
||||
public VoipSound(SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
||||
{
|
||||
Filename = $"VoIP ({name})";
|
||||
|
||||
VoipConfig.SetupEncoding();
|
||||
|
||||
ALFormat = Al.FormatMono16;
|
||||
@@ -95,28 +93,9 @@ namespace Barotrauma.Sounds
|
||||
|
||||
public void ApplyFilters(short[] buffer, int readSamples)
|
||||
{
|
||||
for (int i = 0; i < readSamples; i++)
|
||||
{
|
||||
float fVal = ShortToFloat(buffer[i]);
|
||||
if (UseMuffleFilter)
|
||||
{
|
||||
foreach (var filter in muffleFilters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
}
|
||||
if (UseRadioFilter)
|
||||
{
|
||||
foreach (var filter in radioFilters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
}
|
||||
buffer[i] = FloatToShort(fVal);
|
||||
}
|
||||
if (UseMuffleFilter)
|
||||
{
|
||||
ApplyFilters(muffleFilters, buffer, readSamples);
|
||||
ApplyFilters(radioFilters, buffer, readSamples);
|
||||
}
|
||||
|
||||
if (UseRadioFilter)
|
||||
@@ -127,6 +106,15 @@ namespace Barotrauma.Sounds
|
||||
|
||||
private void ApplyFilters(IEnumerable<BiQuad> filters, short[] buffer, int readSamples)
|
||||
{
|
||||
for (int i = 0; i < readSamples; i++)
|
||||
{
|
||||
float fVal = ShortToFloat(buffer[i]);
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
fVal = filter.Process(fVal);
|
||||
}
|
||||
buffer[i] = FloatToShort(fVal);
|
||||
}
|
||||
}
|
||||
|
||||
public override SoundChannel Play(float gain, float range, Vector2 position, bool muffle = false)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
partial void ApplyProjSpecific(float deltaTime, Entity entity, IEnumerable<ISerializableEntity> targets, Hull hull, Vector2 worldPosition)
|
||||
partial void ApplyProjSpecific(float deltaTime, Entity entity, List<ISerializableEntity> targets, Hull hull, Vector2 worldPosition)
|
||||
{
|
||||
if (entity == null) { return; }
|
||||
|
||||
@@ -116,13 +116,13 @@ namespace Barotrauma
|
||||
{
|
||||
if (entity is Item item && item.body != null)
|
||||
{
|
||||
angle = -item.body.Rotation;
|
||||
if (item.body.Dir < 0.0f) { angle += MathHelper.Pi; }
|
||||
angle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
|
||||
}
|
||||
}
|
||||
|
||||
emitter.Emit(deltaTime, worldPosition, hull, angle: angle, particleRotation: angle);
|
||||
}
|
||||
emitter.Emit(deltaTime, worldPosition, hull, angle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static partial void UpdateAllProjSpecific(float deltaTime)
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Barotrauma
|
||||
Identifier = element.GetAttributeString("identifier", "");
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().Equals("icon", StringComparison.OrdinalIgnoreCase))
|
||||
if (subElement.Name.ToString().ToLowerInvariant() == "icon")
|
||||
{
|
||||
Icon = new Sprite(subElement);
|
||||
IconColor = subElement.GetAttributeColor("color", Color.White);
|
||||
|
||||
@@ -240,13 +240,13 @@ namespace Barotrauma
|
||||
name = null; endpoint = null; lobbyId = 0;
|
||||
if (args == null || args.Length < 2) { return; }
|
||||
|
||||
if (args[0].Equals("-connect", StringComparison.OrdinalIgnoreCase))
|
||||
if (args[0].Equals("-connect", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (args.Length < 3) { return; }
|
||||
name = args[1];
|
||||
endpoint = args[2];
|
||||
}
|
||||
else if (args[0].Equals("+connect_lobby", StringComparison.OrdinalIgnoreCase))
|
||||
else if (args[0].Equals("+connect_lobby", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
UInt64.TryParse(args[1], out lobbyId);
|
||||
}
|
||||
|
||||
@@ -1,186 +1,186 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>DEBUG;TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="libfreetype6.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libopenal.so.1">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libSDL2-2.0.so.0">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="webm_mem_playback_x64.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<EmbeddedResource Include="Icon.bmp">
|
||||
<LogicalName>Icon.bmp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>DEBUG;TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="libfreetype6.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libopenal.so.1">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libSDL2-2.0.so.0">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="webm_mem_playback_x64.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<EmbeddedResource Include="Icon.bmp">
|
||||
<LogicalName>Icon.bmp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,188 +1,188 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<ReleaseVersion>0.9.703.0</ReleaseVersion>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType></DebugType>
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType />
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="libopenal.1.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libSDL2-2.0.0.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libwebm_mem_playback_x64.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<EmbeddedResource Include="Icon.bmp">
|
||||
<LogicalName>Icon.bmp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.MacOS.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\libsteam_api64.dylib">
|
||||
<Link>libsteam_api64.dylib</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="libfreetype6.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<ReleaseVersion>0.9.703.0</ReleaseVersion>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType></DebugType>
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType />
|
||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="libopenal.1.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libSDL2-2.0.0.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libwebm_mem_playback_x64.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<EmbeddedResource Include="Icon.bmp">
|
||||
<LogicalName>Icon.bmp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.MacOS.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\libsteam_api64.dylib">
|
||||
<Link>libsteam_api64.dylib</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="libfreetype6.dylib">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,210 +1,209 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>DEBUG;TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="freetype6.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="soft_oal_x64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="webm_mem_playback_x64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\divinghelmetlight.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\light.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\lightcone.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\penumbra.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Map\BackgroundSmoke.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_Daedalic.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_FF.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_UTG.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>DEBUG;TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="freetype6.dll" />
|
||||
<None Remove="soft_oal_x64.dll" />
|
||||
<None Remove="x64\SDL2.dll" />
|
||||
<None Remove="webm_mem_playback_x64.dll" />
|
||||
<None Remove="libfreetype6.so" />
|
||||
<None Remove="libopenal.so.1" />
|
||||
<None Remove="libSDL2-2.0.so.0" />
|
||||
<None Remove="webm_mem_playback_x64.so" />
|
||||
<None Remove="libopenal.1.dylib" />
|
||||
<None Remove="libSDL2-2.0.0.dylib" />
|
||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="freetype6.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="soft_oal_x64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x64\SDL2.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="webm_mem_playback_x64.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="Content\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\GameAnalytics\GA_SDK_NETSTANDARD\GA_SDK_NETSTANDARD.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\divinghelmetlight.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\light.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\lightcone.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Lights\penumbra.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\Map\BackgroundSmoke.psd">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_Daedalic.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_FF.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_UTG.mp4">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
||||
<PropertyGroup>
|
||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- write the hash to the temp file.-->
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
||||
</Exec>
|
||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
||||
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
||||
|
||||
<!-- read the version into the GitVersion itemGroup-->
|
||||
<ReadLinesFromFile File="$(VerFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildHash>@(GitVersion)</BuildHash>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- read the branch into the GitBranch itemGroup-->
|
||||
<ReadLinesFromFile File="$(BranchFile)">
|
||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
||||
</ReadLinesFromFile>
|
||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
||||
<PropertyGroup>
|
||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
||||
<PropertyGroup>
|
||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
||||
</PropertyGroup>
|
||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
||||
</ItemGroup>
|
||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
||||
<ItemGroup>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitRevision</_Parameter1>
|
||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
<AssemblyAttributes Include="AssemblyMetadata">
|
||||
<_Parameter1>GitBranch</_Parameter1>
|
||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
||||
</AssemblyAttributes>
|
||||
</ItemGroup>
|
||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
@@ -333,14 +333,6 @@ namespace Barotrauma
|
||||
attack = dequeuedInput.HasFlag(InputNetFlags.Attack);
|
||||
shoot = dequeuedInput.HasFlag(InputNetFlags.Shoot);
|
||||
}
|
||||
else if (keys != null)
|
||||
{
|
||||
aiming = keys[(int)InputType.Aim].GetHeldQueue;
|
||||
use = keys[(int)InputType.Use].GetHeldQueue;
|
||||
attack = keys[(int)InputType.Attack].GetHeldQueue;
|
||||
shoot = keys[(int)InputType.Shoot].GetHeldQueue;
|
||||
networkUpdateSent = true;
|
||||
}
|
||||
|
||||
tempBuffer.Write(aiming);
|
||||
tempBuffer.Write(shoot);
|
||||
@@ -497,31 +489,6 @@ namespace Barotrauma
|
||||
msg.Write(this is AICharacter);
|
||||
msg.Write(info.SpeciesName);
|
||||
info.ServerWrite(msg);
|
||||
|
||||
// Current order
|
||||
if (info.CurrentOrder != null)
|
||||
{
|
||||
msg.Write(true);
|
||||
msg.Write((byte)Order.PrefabList.IndexOf(info.CurrentOrder.Prefab));
|
||||
msg.Write(info.CurrentOrder.TargetEntity == null ? (UInt16)0 :
|
||||
info.CurrentOrder.TargetEntity.ID);
|
||||
if (info.CurrentOrder.OrderGiver != null)
|
||||
{
|
||||
msg.Write(true);
|
||||
msg.Write(info.CurrentOrder.OrderGiver.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Write(false);
|
||||
}
|
||||
msg.Write((byte)(string.IsNullOrWhiteSpace(info.CurrentOrderOption) ? 0 :
|
||||
Array.IndexOf(info.CurrentOrder.Prefab.Options, info.CurrentOrderOption)));
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Write(false);
|
||||
}
|
||||
|
||||
TryWriteStatus(msg);
|
||||
|
||||
void TryWriteStatus(IWriteMessage msg)
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace Barotrauma
|
||||
|
||||
ShowQuestionPrompt("Rank to grant to \"" + client.Name + "\"?", (rank) =>
|
||||
{
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.ToLowerInvariant() == rank.ToLowerInvariant());
|
||||
if (preset == null)
|
||||
{
|
||||
ThrowError("Rank \"" + rank + "\" not found.");
|
||||
@@ -1165,7 +1165,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
string modeName = string.Join(" ", args);
|
||||
if (modeName.Equals("campaign", StringComparison.OrdinalIgnoreCase))
|
||||
if (modeName.ToLowerInvariant() == "campaign")
|
||||
{
|
||||
MultiPlayerCampaign.StartCampaignSetup();
|
||||
}
|
||||
@@ -1493,7 +1493,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 2) return;
|
||||
|
||||
AfflictionPrefab afflictionPrefab = AfflictionPrefab.List.FirstOrDefault(a => a.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
||||
AfflictionPrefab afflictionPrefab = AfflictionPrefab.List.FirstOrDefault(a => a.Name.ToLowerInvariant() == args[0].ToLowerInvariant());
|
||||
if (afflictionPrefab == null)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Affliction \"" + args[0] + "\" not found.", client);
|
||||
@@ -1718,7 +1718,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
string rank = string.Join("", args.Skip(1));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.ToLowerInvariant() == rank.ToLowerInvariant());
|
||||
if (preset == null)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Rank \"" + rank + "\" not found.", senderClient);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override void AssignTeamIDs(List<Client> clients)
|
||||
public override bool AssignTeamIDs(List<Client> clients)
|
||||
{
|
||||
List<Client> randList = new List<Client>(clients);
|
||||
for (int i = 0; i < randList.Count; i++)
|
||||
@@ -44,6 +44,7 @@ namespace Barotrauma
|
||||
randList[i].TeamID = Character.TeamType.Team2;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Barotrauma
|
||||
if (vanillaContent == null)
|
||||
{
|
||||
// TODO: Dynamic method for defining and finding the vanilla content package.
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).Equals("vanilla 0.9.xml", StringComparison.OrdinalIgnoreCase));
|
||||
vanillaContent = ContentPackage.List.SingleOrDefault(cp => Path.GetFileName(cp.Path).ToLowerInvariant() == "vanilla 0.9.xml");
|
||||
}
|
||||
return vanillaContent;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Barotrauma
|
||||
DebugConsole.NewMessage("********* CAMPAIGN SETUP *********", Color.White);
|
||||
DebugConsole.ShowQuestionPrompt("Do you want to start a new campaign? Y/N", (string arg) =>
|
||||
{
|
||||
if (arg.Equals("y", StringComparison.OrdinalIgnoreCase) || arg.Equals("yes", StringComparison.OrdinalIgnoreCase))
|
||||
if (arg.ToLowerInvariant() == "y" || arg.ToLowerInvariant() == "yes")
|
||||
{
|
||||
DebugConsole.ShowQuestionPrompt("Enter a save name for the campaign:", (string saveName) =>
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
|
||||
{
|
||||
if (c.Character == null) { return; }
|
||||
if (c.Character == null) return;
|
||||
var requestedFixAction = (FixActions)msg.ReadRangedInteger(0, 2);
|
||||
if (requestedFixAction != FixActions.None)
|
||||
{
|
||||
|
||||
@@ -17,10 +17,9 @@ namespace Barotrauma.Items.Components
|
||||
GameServer.Log(c.Character.LogName + " entered \"" + newOutputValue + "\" on " + item.Name,
|
||||
ServerLog.MessageType.ItemInteraction);
|
||||
OutputValue = newOutputValue;
|
||||
item.SendSignal(0, newOutputValue, "signal_out", null);
|
||||
item.CreateServerEvent(this);
|
||||
}
|
||||
|
||||
item.CreateServerEvent(this);
|
||||
}
|
||||
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
|
||||
@@ -8,11 +8,6 @@ namespace Barotrauma
|
||||
{
|
||||
partial class Item : MapEntity, IDamageable, ISerializableEntity, IServerSerializable, IClientSerializable
|
||||
{
|
||||
public override Sprite Sprite
|
||||
{
|
||||
get { return prefab?.sprite; }
|
||||
}
|
||||
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
{
|
||||
string errorMsg = "";
|
||||
|
||||
@@ -627,16 +627,10 @@ namespace Barotrauma.Networking
|
||||
//game already started -> send start message immediately
|
||||
if (gameStarted)
|
||||
{
|
||||
SendStartMessage(roundStartSeed, GameMain.GameSession.Level.Seed, GameMain.GameSession, connectedClient, true);
|
||||
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.GameMode.Preset, connectedClient);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ClientPacketHeader.REQUEST_STARTGAMEFINALIZE:
|
||||
if (gameStarted && connectedClient != null)
|
||||
{
|
||||
SendRoundStartFinalize(connectedClient);
|
||||
}
|
||||
break;
|
||||
case ClientPacketHeader.UPDATE_LOBBY:
|
||||
ClientReadLobby(inc);
|
||||
break;
|
||||
@@ -784,8 +778,8 @@ namespace Barotrauma.Networking
|
||||
Directory.CreateDirectory(ServerLog.SavePath);
|
||||
}
|
||||
|
||||
string filePath = "event_error_log_server_" + client.Name + "_" + DateTime.UtcNow.ToShortTimeString() + ".log";
|
||||
filePath = Path.Combine(ServerLog.SavePath, ToolBox.RemoveInvalidFileNameChars(filePath));
|
||||
string filePath = "event_error_log_server_" + client.Name + "_" + ToolBox.RemoveInvalidFileNameChars(DateTime.UtcNow.ToShortTimeString() + ".log");
|
||||
filePath = Path.Combine(ServerLog.SavePath, filePath);
|
||||
if (File.Exists(filePath)) { return; }
|
||||
|
||||
List<string> errorLines = new List<string>
|
||||
@@ -1078,7 +1072,7 @@ namespace Barotrauma.Networking
|
||||
case ClientPermissions.Kick:
|
||||
string kickedName = inc.ReadString().ToLowerInvariant();
|
||||
string kickReason = inc.ReadString();
|
||||
var kickedClient = connectedClients.Find(cl => cl != sender && cl.Name.Equals(kickedName, StringComparison.OrdinalIgnoreCase) && cl.Connection != OwnerConnection);
|
||||
var kickedClient = connectedClients.Find(cl => cl != sender && cl.Name.ToLowerInvariant() == kickedName && cl.Connection != OwnerConnection);
|
||||
if (kickedClient != null)
|
||||
{
|
||||
Log("Client \"" + sender.Name + "\" kicked \"" + kickedClient.Name + "\".", ServerLog.MessageType.ServerMessage);
|
||||
@@ -1095,7 +1089,7 @@ namespace Barotrauma.Networking
|
||||
bool range = inc.ReadBoolean();
|
||||
double durationSeconds = inc.ReadDouble();
|
||||
|
||||
var bannedClient = connectedClients.Find(cl => cl != sender && cl.Name.Equals(bannedName, StringComparison.OrdinalIgnoreCase) && cl.Connection != OwnerConnection);
|
||||
var bannedClient = connectedClients.Find(cl => cl != sender && cl.Name.ToLowerInvariant() == bannedName && cl.Connection != OwnerConnection);
|
||||
if (bannedClient != null)
|
||||
{
|
||||
Log("Client \"" + sender.Name + "\" banned \"" + bannedClient.Name + "\".", ServerLog.MessageType.ServerMessage);
|
||||
@@ -1154,7 +1148,7 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
case ClientPermissions.SelectMode:
|
||||
UInt16 modeIndex = inc.ReadUInt16();
|
||||
if (GameMain.NetLobbyScreen.GameModes[modeIndex].Identifier.Equals("multiplayercampaign", StringComparison.OrdinalIgnoreCase))
|
||||
if (GameMain.NetLobbyScreen.GameModes[modeIndex].Identifier.ToLowerInvariant() == "multiplayercampaign")
|
||||
{
|
||||
string[] saveFiles = SaveUtil.GetSaveFiles(SaveUtil.SaveType.Multiplayer).ToArray();
|
||||
for (int i = 0; i < saveFiles.Length; i++)
|
||||
@@ -1779,10 +1773,10 @@ namespace Barotrauma.Networking
|
||||
//always allow the server owner to spectate even if it's disallowed in server settings
|
||||
playingClients.RemoveAll(c => c.Connection == OwnerConnection && c.SpectateOnly);
|
||||
|
||||
if (GameMain.GameSession.GameMode.Mission != null)
|
||||
if (GameMain.GameSession.GameMode.Mission != null &&
|
||||
GameMain.GameSession.GameMode.Mission.AssignTeamIDs(playingClients))
|
||||
{
|
||||
GameMain.GameSession.GameMode.Mission.AssignTeamIDs(playingClients);
|
||||
teamCount = GameMain.GameSession.GameMode.Mission.TeamCount;
|
||||
teamCount = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1802,10 +1796,9 @@ namespace Barotrauma.Networking
|
||||
campaign.Map.SelectRandomLocation(preferUndiscovered: true);
|
||||
}
|
||||
|
||||
SendStartMessage(roundStartSeed, campaign.Map.SelectedConnection.Level.Seed, GameMain.GameSession, connectedClients, false);
|
||||
|
||||
GameMain.GameSession.StartRound(campaign.Map.SelectedConnection.Level,
|
||||
reloadSub: true,
|
||||
loadSecondSub: teamCount > 1,
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
|
||||
campaign.AssignClientCharacterInfos(connectedClients);
|
||||
@@ -1815,9 +1808,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
else
|
||||
{
|
||||
SendStartMessage(roundStartSeed, GameMain.NetLobbyScreen.LevelSeed, GameMain.GameSession, connectedClients, false);
|
||||
|
||||
GameMain.GameSession.StartRound(GameMain.NetLobbyScreen.LevelSeed, serverSettings.SelectedLevelDifficulty);
|
||||
GameMain.GameSession.StartRound(GameMain.NetLobbyScreen.LevelSeed, serverSettings.SelectedLevelDifficulty, teamCount > 1);
|
||||
Log("Game mode: " + selectedMode.Name, ServerLog.MessageType.ServerMessage);
|
||||
Log("Submarine: " + selectedSub.Name, ServerLog.MessageType.ServerMessage);
|
||||
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
|
||||
@@ -1955,6 +1946,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
GameAnalyticsManager.AddDesignEvent("Traitors:" + (TraitorManager == null ? "Disabled" : "Enabled"));
|
||||
|
||||
SendStartMessage(roundStartSeed, Submarine.MainSub, GameMain.GameSession.GameMode.Preset, connectedClients);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
@@ -1972,34 +1965,35 @@ namespace Barotrauma.Networking
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
private void SendStartMessage(int seed, string levelSeed, GameSession gameSession, List<Client> clients, bool includesFinalize)
|
||||
private void SendStartMessage(int seed, Submarine selectedSub, GameModePreset selectedMode, List<Client> clients)
|
||||
{
|
||||
foreach (Client client in clients)
|
||||
{
|
||||
SendStartMessage(seed, levelSeed, gameSession, client, includesFinalize);
|
||||
SendStartMessage(seed, selectedSub, selectedMode, client);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendStartMessage(int seed, string levelSeed, GameSession gameSession, Client client, bool includesFinalize)
|
||||
private void SendStartMessage(int seed, Submarine selectedSub, GameModePreset selectedMode, Client client)
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ServerPacketHeader.STARTGAME);
|
||||
|
||||
msg.Write(seed);
|
||||
msg.Write(levelSeed);
|
||||
msg.Write(GameMain.GameSession.Level.Seed);
|
||||
msg.Write(GameMain.GameSession.Level.EqualityCheckVal);
|
||||
msg.Write(serverSettings.SelectedLevelDifficulty);
|
||||
|
||||
msg.Write((byte)GameMain.Config.LosMode);
|
||||
|
||||
msg.Write((byte)GameMain.NetLobbyScreen.MissionType);
|
||||
|
||||
msg.Write(gameSession.Submarine.Name);
|
||||
msg.Write(gameSession.Submarine.MD5Hash.Hash);
|
||||
msg.Write(selectedSub.Name);
|
||||
msg.Write(selectedSub.MD5Hash.Hash);
|
||||
msg.Write(serverSettings.UseRespawnShuttle);
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedShuttle.Name);
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedShuttle.MD5Hash.Hash);
|
||||
|
||||
msg.Write(gameSession.GameMode.Preset.Identifier);
|
||||
msg.Write(selectedMode.Identifier);
|
||||
msg.Write((short)(GameMain.GameSession.GameMode?.Mission == null ?
|
||||
-1 : MissionPrefab.List.IndexOf(GameMain.GameSession.GameMode.Mission.Prefab)));
|
||||
|
||||
@@ -2008,43 +2002,13 @@ namespace Barotrauma.Networking
|
||||
MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
|
||||
bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
|
||||
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
|
||||
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
||||
|
||||
msg.Write(serverSettings.AllowDisguises);
|
||||
msg.Write(serverSettings.AllowRewiring);
|
||||
|
||||
msg.Write(serverSettings.AllowRagdollButton);
|
||||
|
||||
serverSettings.WriteMonsterEnabled(msg);
|
||||
|
||||
msg.Write(includesFinalize); msg.WritePadBits();
|
||||
if (includesFinalize)
|
||||
{
|
||||
WriteRoundStartFinalize(msg, client);
|
||||
}
|
||||
|
||||
serverPeer.Send(msg, client.Connection, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
private void SendRoundStartFinalize(List<Client> clients)
|
||||
{
|
||||
foreach (Client client in clients)
|
||||
{
|
||||
SendRoundStartFinalize(client);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendRoundStartFinalize(Client client)
|
||||
{
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ServerPacketHeader.STARTGAMEFINALIZE);
|
||||
|
||||
WriteRoundStartFinalize(msg, client);
|
||||
|
||||
serverPeer.Send(msg, client.Connection, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
private void WriteRoundStartFinalize(IWriteMessage msg, Client client)
|
||||
{
|
||||
//tell the client what content files they should preload
|
||||
var contentToPreload = GameMain.GameSession.EventManager.GetFilesToPreload();
|
||||
msg.Write((ushort)contentToPreload.Count());
|
||||
@@ -2054,8 +2018,11 @@ namespace Barotrauma.Networking
|
||||
msg.Write(contentFile.Path);
|
||||
}
|
||||
|
||||
msg.Write(GameMain.GameSession.Level.EqualityCheckVal);
|
||||
serverSettings.WriteMonsterEnabled(msg);
|
||||
|
||||
GameMain.GameSession.Mission?.ServerWriteInitial(msg, client);
|
||||
|
||||
serverPeer.Send(msg, client.Connection, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
public void EndGame()
|
||||
@@ -2203,9 +2170,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void KickPlayer(string playerName, string reason)
|
||||
{
|
||||
playerName = playerName.ToLowerInvariant();
|
||||
|
||||
Client client = connectedClients.Find(c =>
|
||||
c.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase) ||
|
||||
(c.Character != null && c.Character.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)));
|
||||
c.Name.ToLowerInvariant() == playerName ||
|
||||
(c.Character != null && c.Character.Name.ToLowerInvariant() == playerName));
|
||||
|
||||
KickClient(client, reason);
|
||||
}
|
||||
@@ -2239,9 +2208,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void BanPlayer(string playerName, string reason, bool range = false, TimeSpan? duration = null)
|
||||
{
|
||||
playerName = playerName.ToLowerInvariant();
|
||||
|
||||
Client client = connectedClients.Find(c =>
|
||||
c.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase) ||
|
||||
(c.Character != null && c.Character.Name.Equals(playerName, StringComparison.OrdinalIgnoreCase)));
|
||||
c.Name.ToLowerInvariant() == playerName ||
|
||||
(c.Character != null && c.Character.Name.ToLowerInvariant() == playerName));
|
||||
|
||||
if (client == null)
|
||||
{
|
||||
|
||||
@@ -258,9 +258,6 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
bool bot = i >= clients.Count;
|
||||
|
||||
characterInfos[i].CurrentOrder = null;
|
||||
characterInfos[i].CurrentOrderOption = null;
|
||||
|
||||
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, characterInfos[i].Name, !bot, bot);
|
||||
character.TeamID = Character.TeamType.Team1;
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ namespace Barotrauma.Networking
|
||||
if (clientElement.Attribute("preset") == null)
|
||||
{
|
||||
string permissionsStr = clientElement.GetAttributeString("permissions", "");
|
||||
if (permissionsStr.Equals("all", StringComparison.OrdinalIgnoreCase))
|
||||
if (permissionsStr.ToLowerInvariant() == "all")
|
||||
{
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
@@ -384,7 +384,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
foreach (XElement commandElement in clientElement.Elements())
|
||||
{
|
||||
if (!commandElement.Name.ToString().Equals("command", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||
if (commandElement.Name.ToString().ToLowerInvariant() != "command") continue;
|
||||
|
||||
string commandName = commandElement.GetAttributeString("name", "");
|
||||
DebugConsole.Command command = DebugConsole.FindCommand(commandName);
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Barotrauma
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (character.SpeciesName.Equals(entities[activeEntityIndex], StringComparison.OrdinalIgnoreCase) && Vector2.Distance(activeEntitySavedPosition, character.WorldPosition) < graceDistance)
|
||||
if (character.SpeciesName.ToLowerInvariant() == entities[activeEntityIndex] && Vector2.Distance(activeEntitySavedPosition, character.WorldPosition) < graceDistance)
|
||||
{
|
||||
activeEntity = character;
|
||||
transformationTime = 0.0;
|
||||
@@ -117,7 +117,7 @@ namespace Barotrauma
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (character.SpeciesName.Equals(entities[activeEntityIndex], StringComparison.OrdinalIgnoreCase))
|
||||
if (character.SpeciesName.ToLowerInvariant() == entities[activeEntityIndex].ToLowerInvariant())
|
||||
{
|
||||
activeEntity = character;
|
||||
break;
|
||||
@@ -131,7 +131,7 @@ namespace Barotrauma
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.prefab.Identifier.Equals(entities[0], StringComparison.OrdinalIgnoreCase))
|
||||
if (item.prefab.Identifier.ToLowerInvariant() == entities[0].ToLowerInvariant())
|
||||
{
|
||||
activeEntity = item;
|
||||
break;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (character.SpeciesName.Equals(speciesId, StringComparison.OrdinalIgnoreCase))
|
||||
if (character.SpeciesName.ToLowerInvariant() == speciesId)
|
||||
{
|
||||
targetCharacter = character;
|
||||
break;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.7.0</Version>
|
||||
<Version>0.9.7.1</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
1
Barotrauma/BarotraumaShared/.gitignore
vendored
Normal file
1
Barotrauma/BarotraumaShared/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Content/*
|
||||
@@ -25,7 +25,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// How long does it take for the ai target to fade out if not kept alive.
|
||||
/// </summary>
|
||||
public float FadeOutTime { get; private set; } = 2;
|
||||
public float FadeOutTime { get; private set; } = 1;
|
||||
|
||||
public bool Static { get; private set; }
|
||||
public bool StaticSound { get; private set; }
|
||||
@@ -92,7 +92,7 @@ namespace Barotrauma
|
||||
public string SonarLabel;
|
||||
public string SonarIconIdentifier;
|
||||
|
||||
public bool Enabled => SoundRange > 0 || SightRange > 0;
|
||||
public bool Enabled = true;
|
||||
|
||||
public float MinSoundRange, MinSightRange;
|
||||
public float MaxSoundRange = 100000, MaxSightRange = 100000;
|
||||
@@ -195,7 +195,7 @@ namespace Barotrauma
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if (Enabled && !Static && FadeOutTime > 0)
|
||||
if (!Static && FadeOutTime > 0)
|
||||
{
|
||||
// The aitarget goes silent/invisible if the components don't keep it active
|
||||
if (!StaticSight)
|
||||
|
||||
@@ -1017,63 +1017,58 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (AttackingLimb != null && AttackingLimb.attack.Retreat)
|
||||
Vector2 offset = Character.SimPosition - steeringLimb.SimPosition;
|
||||
// Offset so that we don't overshoot the movement
|
||||
Vector2 steerPos = attackSimPos + offset;
|
||||
|
||||
if (SteeringManager is IndoorsSteeringManager pathSteering)
|
||||
{
|
||||
UpdateFallBack(attackWorldPos, deltaTime, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 offset = Character.SimPosition - steeringLimb.SimPosition;
|
||||
// Offset so that we don't overshoot the movement
|
||||
Vector2 steerPos = attackSimPos + offset;
|
||||
if (SteeringManager is IndoorsSteeringManager pathSteering)
|
||||
if (pathSteering.CurrentPath != null)
|
||||
{
|
||||
if (pathSteering.CurrentPath != null)
|
||||
// Attack doors
|
||||
if (canAttackSub)
|
||||
{
|
||||
// Attack doors
|
||||
if (canAttackSub)
|
||||
// If the target is in the same hull, there shouldn't be any doors blocking the path
|
||||
if (targetCharacter == null || targetCharacter.CurrentHull != Character.CurrentHull)
|
||||
{
|
||||
// If the target is in the same hull, there shouldn't be any doors blocking the path
|
||||
if (targetCharacter == null || targetCharacter.CurrentHull != Character.CurrentHull)
|
||||
var door = pathSteering.CurrentPath.CurrentNode?.ConnectedDoor ?? pathSteering.CurrentPath.NextNode?.ConnectedDoor;
|
||||
if (door != null && !door.IsOpen)
|
||||
{
|
||||
var door = pathSteering.CurrentPath.CurrentNode?.ConnectedDoor ?? pathSteering.CurrentPath.NextNode?.ConnectedDoor;
|
||||
if (door != null && !door.IsOpen)
|
||||
if (door.Item.AiTarget != null && SelectedAiTarget != door.Item.AiTarget)
|
||||
{
|
||||
if (door.Item.AiTarget != null && SelectedAiTarget != door.Item.AiTarget)
|
||||
{
|
||||
SelectTarget(door.Item.AiTarget, selectedTargetMemory.Priority);
|
||||
return;
|
||||
}
|
||||
SelectTarget(door.Item.AiTarget, selectedTargetMemory.Priority);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Steer towards the target if in the same room and swimming
|
||||
if ((Character.AnimController.InWater || pursue) && targetCharacter != null && VisibleHulls.Contains(targetCharacter.CurrentHull))
|
||||
{
|
||||
SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(attackSimPos - steeringLimb.SimPosition));
|
||||
}
|
||||
else
|
||||
{
|
||||
SteeringManager.SteeringSeek(steerPos, 2);
|
||||
// Switch to Idle when cannot reach the target and if cannot damage the walls
|
||||
if ((!canAttackSub || wallTarget == null) && !pathSteering.IsPathDirty && pathSteering.CurrentPath.Unreachable)
|
||||
{
|
||||
State = AIState.Idle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Steer towards the target if in the same room and swimming
|
||||
if ((Character.AnimController.InWater || pursue) && targetCharacter != null && VisibleHulls.Contains(targetCharacter.CurrentHull))
|
||||
{
|
||||
SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(attackSimPos - steeringLimb.SimPosition));
|
||||
}
|
||||
else
|
||||
{
|
||||
SteeringManager.SteeringSeek(steerPos, 5);
|
||||
SteeringManager.SteeringSeek(steerPos, 2);
|
||||
// Switch to Idle when cannot reach the target and if cannot damage the walls
|
||||
if ((!canAttackSub || wallTarget == null) && !pathSteering.IsPathDirty && pathSteering.CurrentPath.Unreachable)
|
||||
{
|
||||
State = AIState.Idle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SteeringManager.SteeringSeek(steerPos, 10);
|
||||
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: avoidLookAheadDistance, weight: 15);
|
||||
SteeringManager.SteeringSeek(steerPos, 5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SteeringManager.SteeringSeek(steerPos, 10);
|
||||
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: avoidLookAheadDistance, weight: 15);
|
||||
}
|
||||
|
||||
if (canAttack)
|
||||
{
|
||||
if (!UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance, attackTargetLimb))
|
||||
@@ -1277,9 +1272,12 @@ namespace Barotrauma
|
||||
if (attackResult.Damage > 0.0f)
|
||||
{
|
||||
bool canAttack = attacker.Submarine == Character.Submarine && canAttackCharacters || attacker.Submarine != null && canAttackSub;
|
||||
if (Character.Params.AI.AttackWhenProvoked && canAttack)
|
||||
if (Character.Params.AI.AttackWhenProvoked)
|
||||
{
|
||||
ChangeTargetState(attacker, AIState.Attack, 100);
|
||||
if (canAttack)
|
||||
{
|
||||
ChangeTargetState(attacker, AIState.Attack, 100);
|
||||
}
|
||||
}
|
||||
else if (!AIParams.HasTag(attacker.SpeciesName))
|
||||
{
|
||||
@@ -1289,14 +1287,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (!AIParams.HasTag("stronger"))
|
||||
{
|
||||
ChangeTargetState(attacker, canAttack ? AIState.PassiveAggressive : AIState.Escape, 100);
|
||||
ChangeTargetState(attacker, AIState.Escape, 100);
|
||||
}
|
||||
}
|
||||
else if (enemyAI.CombatStrength < CombatStrength)
|
||||
{
|
||||
if (!AIParams.HasTag("weaker"))
|
||||
{
|
||||
ChangeTargetState(attacker, canAttack ? AIState.PassiveAggressive : AIState.Escape, 100);
|
||||
ChangeTargetState(attacker, canAttack ? AIState.Attack : AIState.Escape, 100);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1307,7 +1305,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeTargetState(attacker, canAttack ? AIState.PassiveAggressive : AIState.Escape, 100);
|
||||
ChangeTargetState(attacker, AIState.Escape, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Barotrauma
|
||||
|| ObjectiveManager.IsCurrentObjective<AIObjectiveFindSafety>()
|
||||
|| ObjectiveManager.CurrentObjective.GetSubObjectivesRecursive(true).Any(o => o.KeepDivingGearOn);
|
||||
bool removeDivingSuit = !Character.AnimController.HeadInWater && oxygenLow;
|
||||
AIObjectiveGoTo gotoObjective = ObjectiveManager.GetActiveObjective<AIObjectiveGoTo>();
|
||||
AIObjectiveGoTo gotoObjective = ObjectiveManager.CurrentOrder as AIObjectiveGoTo;
|
||||
if (!removeDivingSuit)
|
||||
{
|
||||
bool targetHasNoSuit = gotoObjective != null && gotoObjective.mimic && !HasDivingSuit(gotoObjective.Target as Character);
|
||||
@@ -536,16 +536,14 @@ namespace Barotrauma
|
||||
Hull targetHull = null;
|
||||
if (Character.CurrentHull != null)
|
||||
{
|
||||
bool isFighting = ObjectiveManager.HasActiveObjective<AIObjectiveCombat>();
|
||||
bool isFleeing = ObjectiveManager.HasActiveObjective<AIObjectiveFindSafety>();
|
||||
foreach (var hull in VisibleHulls)
|
||||
{
|
||||
foreach (Character target in Character.CharacterList)
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
if (target.CurrentHull != hull || !target.Enabled) { continue; }
|
||||
if (AIObjectiveFightIntruders.IsValidTarget(target, Character))
|
||||
if (c.CurrentHull != hull || !c.Enabled) { continue; }
|
||||
if (AIObjectiveFightIntruders.IsValidTarget(c, Character))
|
||||
{
|
||||
if (AddTargets<AIObjectiveFightIntruders, Character>(Character, target) && newOrder == null)
|
||||
if (AddTargets<AIObjectiveFightIntruders, Character>(Character, c) && newOrder == null)
|
||||
{
|
||||
var orderPrefab = Order.GetPrefab("reportintruders");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
@@ -562,48 +560,42 @@ namespace Barotrauma
|
||||
targetHull = hull;
|
||||
}
|
||||
}
|
||||
if (!isFighting)
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
foreach (var gap in hull.ConnectedGaps)
|
||||
if (c.CurrentHull != hull) { continue; }
|
||||
if (AIObjectiveRescueAll.IsValidTarget(c, Character))
|
||||
{
|
||||
if (AIObjectiveFixLeaks.IsValidTarget(gap, Character))
|
||||
if (AddTargets<AIObjectiveRescueAll, Character>(c, Character) && newOrder == null && !ObjectiveManager.HasActiveObjective<AIObjectiveRescue>())
|
||||
{
|
||||
if (AddTargets<AIObjectiveFixLeaks, Gap>(Character, gap) && newOrder == null && !gap.IsRoomToRoom)
|
||||
{
|
||||
var orderPrefab = Order.GetPrefab("reportbreach");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
var orderPrefab = Order.GetPrefab("requestfirstaid");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
}
|
||||
if (!isFleeing)
|
||||
}
|
||||
foreach (var gap in hull.ConnectedGaps)
|
||||
{
|
||||
if (AIObjectiveFixLeaks.IsValidTarget(gap, Character))
|
||||
{
|
||||
foreach (Character target in Character.CharacterList)
|
||||
if (AddTargets<AIObjectiveFixLeaks, Gap>(Character, gap) && newOrder == null && !gap.IsRoomToRoom)
|
||||
{
|
||||
if (target.CurrentHull != hull) { continue; }
|
||||
if (AIObjectiveRescueAll.IsValidTarget(target, Character))
|
||||
{
|
||||
if (AddTargets<AIObjectiveRescueAll, Character>(Character, target) && newOrder == null && !ObjectiveManager.HasActiveObjective<AIObjectiveRescue>())
|
||||
{
|
||||
var orderPrefab = Order.GetPrefab("requestfirstaid");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
}
|
||||
var orderPrefab = Order.GetPrefab("reportbreach");
|
||||
newOrder = new Order(orderPrefab, hull, null, orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
foreach (Item item in Item.ItemList)
|
||||
}
|
||||
}
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (item.CurrentHull != hull) { continue; }
|
||||
if (AIObjectiveRepairItems.IsValidTarget(item, Character))
|
||||
{
|
||||
if (item.Repairables.All(r => item.ConditionPercentage > r.AIRepairThreshold)) { continue; }
|
||||
if (AddTargets<AIObjectiveRepairItems, Item>(Character, item) && newOrder == null && !ObjectiveManager.HasActiveObjective<AIObjectiveRepairItem>())
|
||||
{
|
||||
if (item.CurrentHull != hull) { continue; }
|
||||
if (AIObjectiveRepairItems.IsValidTarget(item, Character))
|
||||
{
|
||||
if (item.Repairables.All(r => item.ConditionPercentage > r.AIRepairThreshold)) { continue; }
|
||||
if (AddTargets<AIObjectiveRepairItems, Item>(Character, item) && newOrder == null && !ObjectiveManager.HasActiveObjective<AIObjectiveRepairItem>())
|
||||
{
|
||||
var orderPrefab = Order.GetPrefab("reportbrokendevices");
|
||||
newOrder = new Order(orderPrefab, hull, item.Repairables?.FirstOrDefault(), orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
}
|
||||
var orderPrefab = Order.GetPrefab("reportbrokendevices");
|
||||
newOrder = new Order(orderPrefab, hull, item.Repairables?.FirstOrDefault(), orderGiver: Character);
|
||||
targetHull = hull;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -658,7 +650,7 @@ namespace Barotrauma
|
||||
// Should not cancel any existing ai objectives (so that if the character attacked you and then helped, we still would want to retaliate).
|
||||
return;
|
||||
}
|
||||
if (!attacker.IsPlayer && attacker.AIController != null && attacker.AIController.Enabled)
|
||||
if (!attacker.IsRemotePlayer && Character.Controlled != attacker && attacker.AIController != null && attacker.AIController.Enabled)
|
||||
{
|
||||
// Don't retaliate on damage done by friendly ai, because we know that it's accidental
|
||||
AddCombatObjective(AIObjectiveCombat.CombatMode.Retreat, Rand.Range(0.5f, 1f, Rand.RandSync.Unsynced));
|
||||
@@ -672,8 +664,9 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
float dmgPercentage = MathUtils.Percentage(damage, Character.CharacterHealth.Vitality);
|
||||
if (dmgPercentage < 10)
|
||||
float currentVitality = Character.CharacterHealth.Vitality;
|
||||
float dmgPercentage = damage / currentVitality * 100;
|
||||
if (dmgPercentage < currentVitality / 10)
|
||||
{
|
||||
// Don't retaliate on minor (accidental) dmg done by characters that are in the same team
|
||||
AddCombatObjective(AIObjectiveCombat.CombatMode.Retreat, Rand.Range(0.5f, 1f, Rand.RandSync.Unsynced));
|
||||
@@ -718,6 +711,7 @@ namespace Barotrauma
|
||||
|
||||
public void SetOrder(Order order, string option, Character orderGiver, bool speak = true)
|
||||
{
|
||||
SetOrderProjSpecific(order, option);
|
||||
CurrentOrderOption = option;
|
||||
CurrentOrder = order;
|
||||
objectiveManager.SetOrder(order, option, orderGiver);
|
||||
@@ -758,6 +752,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
partial void SetOrderProjSpecific(Order order, string option);
|
||||
|
||||
public override void SelectTarget(AITarget target)
|
||||
{
|
||||
SelectedAiTarget = target;
|
||||
@@ -810,11 +806,11 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public static bool HasDivingMask(Character character, float conditionPercentage = 0) => HasItem(character, "divingmask", "oxygensource", conditionPercentage);
|
||||
|
||||
public static bool HasItem(Character character, string tagOrIdentifier, string containedTag = null, float conditionPercentage = 0)
|
||||
public static bool HasItem(Character character, string identifier, string containedTag, float conditionPercentage = 0)
|
||||
{
|
||||
if (character == null) { return false; }
|
||||
if (character.Inventory == null) { return false; }
|
||||
var item = character.Inventory.FindItemByIdentifier(tagOrIdentifier) ?? character.Inventory.FindItemByTag(tagOrIdentifier);
|
||||
var item = character.Inventory.FindItemByIdentifier(identifier) ?? character.Inventory.FindItemByTag(identifier);
|
||||
return item != null &&
|
||||
item.ConditionPercentage > conditionPercentage &&
|
||||
character.HasEquippedItem(item) &&
|
||||
@@ -938,7 +934,7 @@ namespace Barotrauma
|
||||
visibleHulls = VisibleHulls;
|
||||
}
|
||||
// TODO: should we calculate the visible hulls for each hull? -> could be a bit heavy.
|
||||
bool ignoreFire = objectiveManager.HasActiveObjective<AIObjectiveExtinguishFire>();
|
||||
bool ignoreFire = ObjectiveManager.IsCurrentObjective<AIObjectiveExtinguishFires>() || objectiveManager.HasActiveObjective<AIObjectiveExtinguishFire>();
|
||||
bool ignoreWater = HasDivingSuit(character);
|
||||
bool ignoreOxygen = ignoreWater || HasDivingMask(character);
|
||||
bool ignoreEnemies = ObjectiveManager.IsCurrentObjective<AIObjectiveFightIntruders>();
|
||||
@@ -1026,23 +1022,15 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int CountCrew(Character character, Func<HumanAIController, bool> predicate = null, bool onlyActive = true, bool onlyBots = false)
|
||||
public static int CountCrew(Character character, Func<HumanAIController, bool> predicate = null)
|
||||
{
|
||||
if (character == null) { return 0; }
|
||||
int count = 0;
|
||||
foreach (var other in Character.CharacterList)
|
||||
foreach (var c in Character.CharacterList)
|
||||
{
|
||||
if (onlyActive && !IsActive(other))
|
||||
if (FilterCrewMember(character, c))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (onlyBots && other.IsPlayer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (FilterCrewMember(character, other))
|
||||
{
|
||||
if (predicate == null || predicate(other.AIController as HumanAIController))
|
||||
if (predicate == null || predicate(c.AIController as HumanAIController))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@@ -1070,7 +1058,7 @@ namespace Barotrauma
|
||||
public void DoForEachCrewMember(Action<HumanAIController> action) => DoForEachCrewMember(Character, action);
|
||||
public bool IsTrueForAnyCrewMember(Func<HumanAIController, bool> predicate) => IsTrueForAnyCrewMember(Character, predicate);
|
||||
public bool IsTrueForAllCrewMembers(Func<HumanAIController, bool> predicate) => IsTrueForAllCrewMembers(Character, predicate);
|
||||
public int CountCrew(Func<HumanAIController, bool> predicate = null, bool onlyActive = true, bool onlyBots = false) => CountCrew(Character, predicate, onlyActive, onlyBots);
|
||||
public int CountCrew(Func<HumanAIController, bool> predicate = null) => CountCrew(Character, predicate);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// Returns true if any node in the path is in stairs
|
||||
/// </summary>
|
||||
public bool PathHasStairs => currentPath != null && currentPath.Nodes.Any(n => n.Stairs != null);
|
||||
public bool InStairs => currentPath != null && currentPath.Nodes.Any(n => n.Stairs != null);
|
||||
|
||||
public bool IsNextNodeLadder => GetNextLadder() != null;
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Barotrauma
|
||||
|
||||
private Vector2 CalculateSteeringSeek(Vector2 target, float weight, Func<PathNode, bool> startNodeFilter = null, Func<PathNode, bool> endNodeFilter = null, Func<PathNode, bool> nodeFilter = null)
|
||||
{
|
||||
bool needsNewPath = character.Params.PathFinderPriority > 0.5f && (currentPath == null || currentPath.Unreachable || currentPath.Finished || Vector2.DistanceSquared(target, currentTarget) > 1);
|
||||
bool needsNewPath = character.Params.PathFinderPriority > 0.5f && (currentPath == null || currentPath.Unreachable || currentPath.NextNode == null || Vector2.DistanceSquared(target, currentTarget) > 1);
|
||||
//find a new path if one hasn't been found yet or the target is different from the current target
|
||||
if (needsNewPath || findPathTimer < -1.0f)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ namespace Barotrauma
|
||||
currentPath.SkipToNextNode();
|
||||
}
|
||||
}
|
||||
else if (!IsNextLadderSameAsCurrent)
|
||||
else
|
||||
{
|
||||
Vector2 colliderBottom = character.AnimController.GetColliderBottom();
|
||||
Vector2 colliderSize = collider.GetSize();
|
||||
@@ -530,6 +530,7 @@ namespace Barotrauma
|
||||
if (node.Waypoint != null && node.Waypoint.CurrentHull != null)
|
||||
{
|
||||
var hull = node.Waypoint.CurrentHull;
|
||||
|
||||
if (hull.FireSources.Count > 0)
|
||||
{
|
||||
foreach (FireSource fs in hull.FireSources)
|
||||
@@ -537,14 +538,9 @@ namespace Barotrauma
|
||||
penalty += fs.Size.X * 10.0f;
|
||||
}
|
||||
}
|
||||
if (character.NeedsAir && hull.WaterVolume / hull.Rect.Width > 100.0f)
|
||||
{
|
||||
penalty += 500.0f;
|
||||
}
|
||||
if (character.PressureProtection < 10.0f && hull.WaterVolume > hull.Volume)
|
||||
{
|
||||
penalty += 1000.0f;
|
||||
}
|
||||
|
||||
if (character.NeedsAir && hull.WaterVolume / hull.Rect.Width > 100.0f) penalty += 500.0f;
|
||||
if (character.PressureProtection < 10.0f && hull.WaterVolume > hull.Volume) penalty += 1000.0f;
|
||||
}
|
||||
|
||||
return penalty;
|
||||
|
||||
@@ -136,10 +136,9 @@ namespace Barotrauma
|
||||
string allowedJobsStr = element.GetAttributeString("allowedjobs", "");
|
||||
foreach (string allowedJobIdentifier in allowedJobsStr.Split(','))
|
||||
{
|
||||
string key = allowedJobIdentifier.ToLowerInvariant();
|
||||
if (JobPrefab.Prefabs.ContainsKey(key))
|
||||
if (JobPrefab.Prefabs.ContainsKey(allowedJobIdentifier.ToLowerInvariant()))
|
||||
{
|
||||
AllowedJobs.Add(JobPrefab.Prefabs[key]);
|
||||
AllowedJobs.Add(JobPrefab.Prefabs[allowedJobIdentifier.ToLowerInvariant()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,18 +32,6 @@ namespace Barotrauma
|
||||
public virtual bool UnequipItems => false;
|
||||
|
||||
protected readonly List<AIObjective> subObjectives = new List<AIObjective>();
|
||||
private float _cumulatedDevotion;
|
||||
protected float CumulatedDevotion
|
||||
{
|
||||
get { return _cumulatedDevotion; }
|
||||
set { _cumulatedDevotion = MathHelper.Clamp(value, 0, MaxDevotion); }
|
||||
}
|
||||
|
||||
protected virtual float MaxDevotion => 10;
|
||||
|
||||
/// <summary>
|
||||
/// Final priority value after all calculations.
|
||||
/// </summary>
|
||||
public float Priority { get; set; }
|
||||
public float PriorityModifier { get; private set; } = 1;
|
||||
public readonly Character character;
|
||||
@@ -71,7 +59,6 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public virtual bool IsLoop { get; set; }
|
||||
public IEnumerable<AIObjective> SubObjectives => subObjectives;
|
||||
public AIObjective CurrentSubObjective => subObjectives.FirstOrDefault();
|
||||
|
||||
private readonly List<AIObjective> all = new List<AIObjective>();
|
||||
public IEnumerable<AIObjective> GetSubObjectivesRecursive(bool includingSelf = false)
|
||||
@@ -99,7 +86,7 @@ namespace Barotrauma
|
||||
|
||||
public AIObjective GetActiveObjective()
|
||||
{
|
||||
var subObjective = CurrentSubObjective;
|
||||
var subObjective = SubObjectives.FirstOrDefault();
|
||||
return subObjective == null ? this : subObjective.GetActiveObjective();
|
||||
}
|
||||
|
||||
@@ -170,8 +157,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!AllowSubObjectiveSorting) { return; }
|
||||
if (subObjectives.None()) { return; }
|
||||
subObjectives.ForEach(so => so.GetPriority());
|
||||
subObjectives.Sort((x, y) => y.Priority.CompareTo(x.Priority));
|
||||
subObjectives.Sort((x, y) => y.GetPriority().CompareTo(x.GetPriority()));
|
||||
if (ConcurrentObjectives)
|
||||
{
|
||||
subObjectives.ForEach(so => so.SortSubObjectives());
|
||||
@@ -182,23 +168,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this only when the priority needs to be recalculated. Use the cached Priority property when you don't need to recalculate.
|
||||
/// </summary>
|
||||
public virtual float GetPriority()
|
||||
{
|
||||
Priority = CumulatedDevotion * PriorityModifier;
|
||||
return Priority;
|
||||
}
|
||||
|
||||
private void UpdateDevotion(float deltaTime)
|
||||
{
|
||||
var currentObjective = objectiveManager.CurrentObjective;
|
||||
if (currentObjective != null && (currentObjective == this || currentObjective.subObjectives.Any(so => so == this)))
|
||||
{
|
||||
CumulatedDevotion += Devotion * PriorityModifier * deltaTime;
|
||||
}
|
||||
}
|
||||
public virtual float GetPriority() => Priority * PriorityModifier;
|
||||
|
||||
public virtual bool IsDuplicate<T>(T otherObjective) where T : AIObjective => otherObjective.Option == Option;
|
||||
|
||||
@@ -210,7 +180,14 @@ namespace Barotrauma
|
||||
}
|
||||
else if (objectiveManager.WaitTimer <= 0)
|
||||
{
|
||||
UpdateDevotion(deltaTime);
|
||||
if (objectiveManager.CurrentObjective != null)
|
||||
{
|
||||
if (objectiveManager.CurrentObjective == this || objectiveManager.CurrentObjective.subObjectives.Any(so => so == this))
|
||||
{
|
||||
Priority += Devotion * PriorityModifier * deltaTime;
|
||||
}
|
||||
}
|
||||
Priority = MathHelper.Clamp(Priority, 0, 100);
|
||||
}
|
||||
subObjectives.ForEach(so => so.Update(deltaTime));
|
||||
}
|
||||
@@ -287,7 +264,6 @@ namespace Barotrauma
|
||||
|
||||
public virtual void OnDeselected()
|
||||
{
|
||||
CumulatedDevotion = 0;
|
||||
Deselected?.Invoke();
|
||||
}
|
||||
|
||||
@@ -306,7 +282,6 @@ namespace Barotrauma
|
||||
isCompleted = false;
|
||||
hasBeenChecked = false;
|
||||
_abandon = false;
|
||||
CumulatedDevotion = 0;
|
||||
}
|
||||
|
||||
protected abstract void Act(float deltaTime);
|
||||
|
||||
@@ -100,11 +100,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPriority()
|
||||
{
|
||||
Priority = (Enemy != null && (Enemy.Removed || Enemy.IsDead)) ? 0 : Math.Min(100 * PriorityModifier, 100);
|
||||
return Priority;
|
||||
}
|
||||
public override float GetPriority() => (Enemy != null && (Enemy.Removed || Enemy.IsDead)) ? 0 : Math.Min(100 * PriorityModifier, 100);
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
@@ -143,7 +139,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (seekAmmunition == null)
|
||||
{
|
||||
if (Mode != CombatMode.Retreat && TryArm() && Enemy != null && !Enemy.Removed)
|
||||
if (TryArm() && Enemy != null && !Enemy.Removed)
|
||||
{
|
||||
OperateWeapon(deltaTime);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPriority()
|
||||
{
|
||||
if (objectiveManager.CurrentOrder == this)
|
||||
{
|
||||
return AIObjectiveManager.OrderPriority;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
private bool CheckItem(Item i) => itemIdentifiers.Any(id => i.Prefab.Identifier == id || i.HasTag(id)) && i.ConditionPercentage > ConditionLevel;
|
||||
|
||||
protected override void Act(float deltaTime)
|
||||
|
||||
@@ -54,6 +54,15 @@ namespace Barotrauma
|
||||
|
||||
protected override bool Check() => IsCompleted;
|
||||
|
||||
public override float GetPriority()
|
||||
{
|
||||
if (objectiveManager.CurrentOrder == this)
|
||||
{
|
||||
return AIObjectiveManager.OrderPriority;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
protected override void Act(float deltaTime)
|
||||
{
|
||||
Item itemToDecontain = targetItem ?? sourceContainer.Inventory.FindItem(i => itemIdentifiers.Any(id => i.Prefab.Identifier == id || i.HasTag(id)), recursive: false);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Barotrauma.Items.Components;
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -28,44 +29,32 @@ namespace Barotrauma
|
||||
public override float GetPriority()
|
||||
{
|
||||
if (!objectiveManager.IsCurrentOrder<AIObjectiveExtinguishFires>()
|
||||
&& Character.CharacterList.Any(c => c.CurrentHull == targetHull && !HumanAIController.IsFriendly(c) && HumanAIController.IsActive(c)))
|
||||
&& Character.CharacterList.Any(c => c.CurrentHull == targetHull && !HumanAIController.IsFriendly(c) && HumanAIController.IsActive(c))) { return 0; }
|
||||
float yDist = Math.Abs(character.WorldPosition.Y - targetHull.WorldPosition.Y);
|
||||
yDist = yDist > 100 ? yDist * 3 : 0;
|
||||
float dist = Math.Abs(character.WorldPosition.X - targetHull.WorldPosition.X) + yDist;
|
||||
float distanceFactor = MathHelper.Lerp(1, 0.1f, MathUtils.InverseLerp(0, 5000, dist));
|
||||
if (targetHull == character.CurrentHull)
|
||||
{
|
||||
Priority = 0;
|
||||
distanceFactor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
float yDist = Math.Abs(character.WorldPosition.Y - targetHull.WorldPosition.Y);
|
||||
yDist = yDist > 100 ? yDist * 3 : 0;
|
||||
float dist = Math.Abs(character.WorldPosition.X - targetHull.WorldPosition.X) + yDist;
|
||||
float distanceFactor = MathHelper.Lerp(1, 0.1f, MathUtils.InverseLerp(0, 5000, dist));
|
||||
if (targetHull == character.CurrentHull)
|
||||
{
|
||||
distanceFactor = 1;
|
||||
}
|
||||
float severity = AIObjectiveExtinguishFires.GetFireSeverity(targetHull);
|
||||
float severityFactor = MathHelper.Lerp(0, 1, severity / 100);
|
||||
float devotion = CumulatedDevotion / 100;
|
||||
Priority = MathHelper.Lerp(0, 100, MathHelper.Clamp(devotion + (severityFactor * distanceFactor * PriorityModifier), 0, 1));
|
||||
}
|
||||
return Priority;
|
||||
float severity = AIObjectiveExtinguishFires.GetFireSeverity(targetHull);
|
||||
float severityFactor = MathHelper.Lerp(0, 1, severity / 100);
|
||||
float devotion = Math.Min(Priority, 10) / 100;
|
||||
return MathHelper.Lerp(0, 100, MathHelper.Clamp(devotion + severityFactor * distanceFactor, 0, 1));
|
||||
}
|
||||
|
||||
protected override bool Check() => targetHull.FireSources.None();
|
||||
|
||||
private float sinTime;
|
||||
protected override void Act(float deltaTime)
|
||||
{
|
||||
var extinguisherItem = character.Inventory.FindItemByIdentifier("fireextinguisher") ?? character.Inventory.FindItemByTag("fireextinguisher");
|
||||
var extinguisherItem = character.Inventory.FindItemByIdentifier("extinguisher") ?? character.Inventory.FindItemByTag("extinguisher");
|
||||
if (extinguisherItem == null || extinguisherItem.Condition <= 0.0f || !character.HasEquippedItem(extinguisherItem))
|
||||
{
|
||||
TryAddSubObjective(ref getExtinguisherObjective, () =>
|
||||
{
|
||||
character.Speak(TextManager.Get("DialogFindExtinguisher"), null, 2.0f, "findextinguisher", 30.0f);
|
||||
return new AIObjectiveGetItem(character, "fireextinguisher", objectiveManager, equip: true)
|
||||
{
|
||||
// If the item is inside an unsafe hull, decrease the priority
|
||||
GetItemPriority = i => HumanAIController.UnsafeHulls.Contains(i.CurrentHull) ? 0.1f : 1
|
||||
};
|
||||
return new AIObjectiveGetItem(character, "extinguisher", objectiveManager, equip: true);
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -90,12 +79,8 @@ namespace Barotrauma
|
||||
{
|
||||
useExtinquisherTimer = 0.0f;
|
||||
}
|
||||
// Aim
|
||||
character.CursorPosition = fs.Position;
|
||||
Vector2 fromCharacterToFireSource = fs.WorldPosition - character.WorldPosition;
|
||||
float dist = fromCharacterToFireSource.Length();
|
||||
character.CursorPosition += VectorExtensions.Forward(extinguisherItem.body.TransformedRotation + (float)Math.Sin(sinTime) / 2, dist / 2);
|
||||
if (extinguisherItem.RequireAimToUse)
|
||||
if (extinguisher.Item.RequireAimToUse)
|
||||
{
|
||||
bool isOperatingButtons = false;
|
||||
if (SteeringManager == PathSteering)
|
||||
@@ -110,9 +95,8 @@ namespace Barotrauma
|
||||
{
|
||||
character.SetInput(InputType.Aim, false, true);
|
||||
}
|
||||
sinTime += deltaTime * 10;
|
||||
}
|
||||
character.SetInput(extinguisherItem.IsShootable ? InputType.Shoot : InputType.Use, false, true);
|
||||
character.SetInput(extinguisher.Item.IsShootable ? InputType.Shoot : InputType.Use, false, true);
|
||||
extinguisher.Use(deltaTime, character);
|
||||
if (!targetHull.FireSources.Contains(fs))
|
||||
{
|
||||
@@ -126,7 +110,7 @@ namespace Barotrauma
|
||||
if (move)
|
||||
{
|
||||
//go to the first firesource
|
||||
TryAddSubObjective(ref gotoObjective, () => new AIObjectiveGoTo(fs, character, objectiveManager, closeEnough: extinguisher.Range / 2)
|
||||
TryAddSubObjective(ref gotoObjective, () => new AIObjectiveGoTo(fs, character, objectiveManager)
|
||||
{
|
||||
DialogueIdentifier = "dialogcannotreachfire",
|
||||
TargetName = fs.Hull.DisplayName
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Barotrauma
|
||||
{
|
||||
public override string DebugTag => "extinguish fires";
|
||||
public override bool ForceRun => true;
|
||||
public override bool IgnoreUnsafeHulls => true;
|
||||
|
||||
public AIObjectiveExtinguishFires(Character character, AIObjectiveManager objectiveManager, float priorityModifier = 1) : base(character, objectiveManager, priorityModifier) { }
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Barotrauma
|
||||
public override string DebugTag => $"find diving gear ({gearTag})";
|
||||
public override bool ForceRun => true;
|
||||
public override bool KeepDivingGearOn => true;
|
||||
public override bool IgnoreUnsafeHulls => true;
|
||||
|
||||
private readonly string gearTag;
|
||||
private readonly string fallbackTag;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user