diff --git a/Barotrauma/BarotraumaClient/Barotrauma b/Barotrauma/BarotraumaClient/Barotrauma
new file mode 100755
index 000000000..2a9280054
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Barotrauma
@@ -0,0 +1,35 @@
+#!/bin/bash
+# MonoKickstart Shell Script
+# Written by Ethan "flibitijibibo" Lee
+
+# Move to script's directory
+cd "`dirname "$0"`"
+
+# Get the system architecture
+UNAME=`uname`
+ARCH=`uname -m`
+
+# MonoKickstart picks the right libfolder, so just execute the right binary.
+if [ "$UNAME" == "Darwin" ]; then
+ # ... Except on OSX.
+ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/
+
+ # El Capitan is a total idiot and wipes this variable out, making the
+ # Steam overlay disappear. This sidesteps "System Integrity Protection"
+ # and resets the variable with Valve's own variable (they provided this
+ # fix by the way, thanks Valve!). Note that you will need to update your
+ # launch configuration to the script location, NOT just the app location
+ # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app).
+ # -flibit
+ if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
+ export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
+ fi
+
+ ./Barotrauma.bin.osx $@
+else
+ if [ "$ARCH" == "x86_64" ]; then
+ ./Barotrauma.bin.x86_64 $@
+ else
+ ./Barotrauma.bin.x86 $@
+ fi
+fi
diff --git a/Barotrauma/BarotraumaClient/Barotrauma.bin.x86 b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86
new file mode 100755
index 000000000..c7c060f04
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86 differ
diff --git a/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64 b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64
new file mode 100755
index 000000000..47535d05b
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64 differ
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index f0fa4331e..f0d80d9ee 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -193,6 +193,60 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
diff --git a/Barotrauma/BarotraumaClient/Mono.Posix.dll b/Barotrauma/BarotraumaClient/Mono.Posix.dll
new file mode 100755
index 000000000..6f4550923
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Mono.Posix.dll differ
diff --git a/Barotrauma/BarotraumaClient/Mono.Security.dll b/Barotrauma/BarotraumaClient/Mono.Security.dll
new file mode 100755
index 000000000..a50cd152c
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Mono.Security.dll differ
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
index 043ecd319..da396dad7 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
@@ -393,7 +393,7 @@ namespace Barotrauma
}
}
- partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true)
+ partial void SeverLimbJointProjSpecific(LimbJoint limbJoint)
{
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
{
@@ -411,11 +411,6 @@ namespace Barotrauma
character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f));
}
}
-
- if (playSound)
- {
- SoundPlayer.PlayDamageSound("Gore", 1.0f, limbJoint.LimbA.body);
- }
}
public virtual void Draw(SpriteBatch spriteBatch, Camera cam)
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
index 2bcb03cb3..777bc7775 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
@@ -96,11 +96,6 @@ namespace Barotrauma
private const float UpdateDisplayedAfflictionsInterval = 0.5f;
private List currentDisplayedAfflictions = new List();
- public bool MouseOnElement
- {
- get { return highlightedLimbIndex > -1 || GUI.MouseOn == dropItemArea; }
- }
-
private static CharacterHealth openHealthWindow;
public static CharacterHealth OpenHealthWindow
{
@@ -177,16 +172,18 @@ namespace Barotrauma
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
- lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight),
- TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.TopRight, font: GUI.SmallFont, wrap: true)
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.08f), paddedInfoFrame.RectTransform), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
+ lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.08f) },
+ TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.Center, font: GUI.SmallFont, wrap: true)
{
Visible = false
};
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }, TextManager.Get("SuitableTreatments"), textAlignment: Alignment.BottomRight);
-
- recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) });
+ recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) })
+ {
+ Spacing = 10
+ };
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
- { RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
+ { RelativeOffset = new Vector2(0.0f, 0.0f) }, style: null)
{
ToolTip = TextManager.Get("HealthItemUseTip")
};
@@ -587,18 +584,9 @@ namespace Barotrauma
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 = GetMathingLimbHealth(affliction);
+ if (limbHealth != null)
{
- var limbHealth = GetMathingLimbHealth(affliction);
- if (limbHealth != null)
- {
- selectedLimbIndex = limbHealths.IndexOf(limbHealth);
- }
- }
- else
- {
- // If no affliction is critical, select the limb which has most damage.
- var limbHealth = limbHealths.OrderByDescending(l => l.TotalDamage).FirstOrDefault();
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
}
}
@@ -940,7 +928,7 @@ namespace Barotrauma
{
afflictionInfoContainer.Content.ClearChildren();
recommendedTreatmentContainer.Content.ClearChildren();
-
+
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical");
//random variance is 200% when the skill is 0
@@ -1035,15 +1023,14 @@ namespace Barotrauma
{
ItemPrefab item = MapEntityPrefab.Find(name: null, identifier: treatment.Key, showErrorMessages: false) as ItemPrefab;
if (item == null) continue;
- int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.5f);
+ int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.8f);
- var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
- style: "InnerGlow")
+ var itemSlot = new GUIButton(new RectTransform(new Point(slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
+ text: "", style: "InventorySlotSmall")
{
- UserData = item,
- CanBeFocused = false
+ UserData = item
};
- itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
+ itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.White, Color.LightGreen);
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
index 63beecb56..0db66467c 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
@@ -292,10 +292,10 @@ namespace Barotrauma
if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound))
{
damageSoundType = damageModifier.DamageSound;
+ SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
break;
}
}
- SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
}
// Always spawn damage particles
diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
index 9fed2075c..ac0dc2bbd 100644
--- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
@@ -555,37 +555,6 @@ namespace Barotrauma
}
}));
- commands.Add(new Command("resetselected", "Reset selected items and structures to prefabs. Only applicable in the subeditor.", args =>
- {
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- foreach (MapEntity entity in MapEntity.SelectedList)
- {
- if (entity is Item item)
- {
- item.Reset();
- }
- else if (entity is Structure structure)
- {
- structure.Reset();
- }
- }
- foreach (MapEntity entity in MapEntity.SelectedList)
- {
- if (entity is Item item)
- {
- item.CreateEditingHUD();
- break;
- }
- else if (entity is Structure structure)
- {
- structure.CreateEditingHUD();
- break;
- }
- }
- }
- }));
-
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
{
if (Screen.Selected == GameMain.SubEditorScreen)
@@ -1082,6 +1051,212 @@ namespace Barotrauma
};
}));
+ commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
+ {
+ string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
+ List lines = new List();
+ foreach (MapEntityPrefab me in MapEntityPrefab.List)
+ {
+ lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
+ lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
+ }
+ File.WriteAllLines(filePath, lines);
+ }));
+#if DEBUG
+ commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
+ {
+ if (args.Length != 1) return;
+ TextManager.CheckForDuplicates(args[0]);
+ }));
+
+ commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
+ {
+ TextManager.WriteToCSV();
+ NPCConversation.WriteToCSV();
+ }));
+
+ commands.Add(new Command("csvtoxml", "csvtoxml [language] -> Converts .csv localization files in Content/NPCConversations & Content/Texts to .xml for use in-game.", (string[] args) =>
+ {
+ if (args.Length == 0) return;
+ LocalizationCSVtoXML.Convert(args[0]);
+ }));
+#endif
+
+ commands.Add(new Command("cleanbuild", "", (string[] args) =>
+ {
+ GameMain.Config.MusicVolume = 0.5f;
+ GameMain.Config.SoundVolume = 0.5f;
+ NewMessage("Music and sound volume set to 0.5", Color.Green);
+
+ commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
+ {
+ float defaultZoom = Screen.Selected.Cam.DefaultZoom;
+ if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
+
+ float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
+ if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
+ float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
+ if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
+
+ float minZoom = Screen.Selected.Cam.MinZoom;
+ if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
+ float maxZoom = Screen.Selected.Cam.MaxZoom;
+ if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
+
+ Screen.Selected.Cam.DefaultZoom = defaultZoom;
+ Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
+ Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
+ Screen.Selected.Cam.MinZoom = minZoom;
+ Screen.Selected.Cam.MaxZoom = maxZoom;
+ }));
+
+ commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
+ {
+ float distortScaleX = 0.5f, distortScaleY = 0.5f;
+ float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
+ float blurAmount = 0.0f;
+ if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
+ if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
+ if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
+ if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
+ if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
+ WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
+ WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
+ WaterRenderer.BlurAmount = blurAmount;
+ }));
+
+
+ commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
+ {
+ //TODO: maybe do this automatically during loading when possible?
+ if (Screen.Selected == GameMain.SubEditorScreen)
+ {
+ if (!MapEntity.SelectedAny)
+ {
+ ThrowError("You have to select item(s) first!");
+ }
+ else
+ {
+ foreach (var mapEntity in MapEntity.SelectedList)
+ {
+ if (mapEntity is Item item)
+ {
+ item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
+ (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
+ (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
+ }
+ else if (mapEntity is Structure structure)
+ {
+ if (!structure.ResizeHorizontal)
+ {
+ structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
+ (int)structure.Prefab.ScaledSize.X,
+ structure.Rect.Height);
+ }
+ if (!structure.ResizeVertical)
+ {
+ structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
+ structure.Rect.Width,
+ (int)structure.Prefab.ScaledSize.Y);
+ }
+ }
+ }
+ }
+ }
+ }, isCheat: false));
+#endif
+
+ GameMain.Config.SaveNewPlayerConfig();
+
+ var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder);
+
+ foreach (string saveFile in saveFiles)
+ {
+ lines.Add(element.ElementInnerText());
+ }
+ File.WriteAllLines(Path.GetFileNameWithoutExtension(filePath) + ".txt", lines);
+ },
+ () =>
+ {
+ var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
+ return new string[][]
+ {
+ TextManager.GetTextFiles().Where(f => Path.GetExtension(f)==".xml").ToArray()
+ };
+ }));
+
+ commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
+ {
+ string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
+ string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
+
+ string[] lines;
+ try
+ {
+ lines = File.ReadAllLines(sourcePath);
+ }
+ catch (Exception e)
+ {
+ ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
+ return;
+ }
+ var doc = XMLExtensions.TryLoadXml(destinationPath);
+ int i = 0;
+ foreach (XElement element in doc.Root.Elements())
+ {
+ if (i >= lines.Length)
+ {
+ ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
+ return;
+ }
+ element.Value = lines[i];
+ i++;
+ }
+ doc.Save(destinationPath);
+ },
+ () =>
+ {
+ var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
+ return new string[][]
+ {
+ files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
+ files.Where(f => Path.GetExtension(f)==".xml").ToArray()
+ };
+ }));
+
+ commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
+ {
+ if (args.Length < 2) return;
+ string sourcePath = args[0];
+ string destinationPath = args[1];
+
+ var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
+ var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
+
+ XElement destinationElement = destinationDoc.Root.Elements().First();
+ foreach (XElement element in sourceDoc.Root.Elements())
+ {
+ if (destinationDoc.Root.Element(element.Name) == null)
+ {
+ element.Value = "!!!!!!!!!!!!!" + element.Value;
+ destinationElement.AddAfterSelf(element);
+ }
+ XNode nextNode = destinationElement.NextNode;
+ while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
+ destinationElement = nextNode as XElement;
+ }
+ destinationDoc.Save(destinationPath);
+ },
+ () =>
+ {
+ var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
+ return new string[][]
+ {
+ files,
+ files
+ };
+ }));
+
commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
{
string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
@@ -1519,7 +1694,7 @@ namespace Barotrauma
character.AnimController.ResetRagdoll();
}, isCheat: true));
- commands.Add(new Command("reloadwearables", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
+ commands.Add(new Command("reloadwearables|reloadlimbs", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
{
var character = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, true);
if (character == null)
@@ -1530,26 +1705,6 @@ namespace Barotrauma
ReloadWearables(character);
}, isCheat: true));
- commands.Add(new Command("loadwearable", "Force select certain variant for the selected character.", args =>
- {
- var character = Character.Controlled;
- if (character == null)
- {
- ThrowError("Not controlling any character.");
- return;
- }
- if (args.Length == 0)
- {
- ThrowError("No arguments provided! Give an index number for the variant starting from 1.");
- return;
- }
- if (int.TryParse(args[0], out int variant))
- {
- ReloadWearables(character, variant);
- }
-
- }, isCheat: true));
-
commands.Add(new Command("reloadsprite|reloadsprites", "Reloads the sprites of the selected item(s)/structure(s) (hovering over or selecting in the subeditor) or the controlled character. Can also reload sprites by entity id or by the name attribute (sprite element). Example 1: reloadsprite id itemid. Example 2: reloadsprite name \"Sprite name\"", args =>
{
if (Screen.Selected is SpriteEditorScreen)
@@ -1697,7 +1852,7 @@ namespace Barotrauma
}, isCheat: true));
}
- private static void ReloadWearables(Character character, int variant = 0)
+ private static void ReloadWearables(Character character)
{
foreach (var limb in character.AnimController.Limbs)
{
@@ -1706,17 +1861,11 @@ namespace Barotrauma
limb.DeformSprite?.Sprite.ReloadTexture();
foreach (var wearable in limb.WearingItems)
{
- if (variant > 0 && wearable.Variant > 0)
- {
- wearable.Variant = variant;
- }
- wearable.RefreshPath();
wearable.Sprite.ReloadXML();
wearable.Sprite.ReloadTexture();
}
foreach (var wearable in limb.OtherWearables)
{
- wearable.RefreshPath();
wearable.Sprite.ReloadXML();
wearable.Sprite.ReloadTexture();
}
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
index 490c0d21a..64fecb33b 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
@@ -26,21 +26,7 @@ namespace Barotrauma
private bool isSinglePlayer;
public bool IsSinglePlayer => isSinglePlayer;
- private bool _toggleOpen = true;
- public bool ToggleOpen
- {
- get { return _toggleOpen; }
- set
- {
- if (_toggleOpen == value) { return; }
- _toggleOpen = GameMain.Config.ChatOpen = value;
- foreach (GUIComponent child in ToggleButton.Children)
- {
- child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
- SpriteEffects.FlipHorizontally : SpriteEffects.None;
- }
- }
- }
+ private bool toggleOpen = true;
private float openState;
private float prevUIScale;
@@ -95,7 +81,12 @@ namespace Barotrauma
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
{
- ToggleOpen = !ToggleOpen;
+ toggleOpen = !toggleOpen;
+ foreach (GUIComponent child in btn.Children)
+ {
+ child.SpriteEffects = toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
+ SpriteEffects.FlipHorizontally : SpriteEffects.None;
+ }
return true;
};
@@ -133,8 +124,6 @@ namespace Barotrauma
}
return true;
};
-
- ToggleOpen = GameMain.Config.ChatOpen;
}
public bool TypingChatMessage(GUITextBox textBox, string text)
@@ -239,7 +228,7 @@ namespace Barotrauma
chatBox.UpdateScrollBarSize();
- if (!ToggleOpen)
+ if (!toggleOpen)
{
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, guiFrame.RectTransform), style: "GUIToolTip")
{
@@ -324,7 +313,9 @@ namespace Barotrauma
prevUIScale = GUI.Scale;
}
- if (ToggleOpen || (inputBox != null && inputBox.Selected))
+
+
+ if (toggleOpen || (inputBox != null && inputBox.Selected))
{
openState += deltaTime * 5.0f;
//delete all popup messages when the chatbox is open
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
index dddd37a0f..53457108e 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
@@ -1568,7 +1568,7 @@ namespace Barotrauma
}
///
- /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages. TODO: Allow to show messages at the middle of the screen (instead of the top center).
+ /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages
///
public static void AddMessage(string message, Color color, float? lifeTime = null, bool playSound = true, ScalableFont font = null)
{
diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs
index 51f3c76fb..10fa40667 100644
--- a/Barotrauma/BarotraumaClient/Source/GameMain.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs
@@ -318,16 +318,8 @@ namespace Barotrauma
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
if (Config.EnableSplashScreen)
{
- try
- {
- (TitleScreen as LoadingScreen).SplashScreen = new Video(base.GraphicsDevice, SoundManager, "Content/splashscreen.mp4", 1280, 720);
- }
- catch (Exception e)
- {
- Config.EnableSplashScreen = false;
- DebugConsole.ThrowError("Playing the splash screen failed.", e);
- }
- }
+ (TitleScreen as LoadingScreen).SplashScreen = new Video(base.GraphicsDevice, SoundManager, "Content/splashscreen.mp4", 1280, 720);
+ }
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
DebugConsole.Init();
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
index cf7bebf10..a4a41d1d0 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
@@ -4,6 +4,7 @@ using Barotrauma.Networking;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -40,10 +41,7 @@ namespace Barotrauma
private bool toggleCrewAreaOpen = true;
private int characterInfoWidth;
- ///
- /// Present only in single player games. In multiplayer. The chatbox is found from GameSession.Client.
- ///
- public ChatBox ChatBox { get; private set; }
+ private ChatBox chatBox;
private float prevUIScale;
@@ -52,15 +50,7 @@ namespace Barotrauma
public bool ToggleCrewAreaOpen
{
get { return toggleCrewAreaOpen; }
- set
- {
- if (toggleCrewAreaOpen == value) { return; }
- toggleCrewAreaOpen = GameMain.Config.CrewMenuOpen = value;
- foreach (GUIComponent child in toggleCrewButton.Children)
- {
- child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
- }
- }
+ set { toggleCrewAreaOpen = value; }
}
#endregion
@@ -103,7 +93,11 @@ namespace Barotrauma
"", style: "UIToggleButton");
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
{
- ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
+ toggleCrewAreaOpen = !toggleCrewAreaOpen;
+ foreach (GUIComponent child in btn.Children)
+ {
+ child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
+ }
return true;
};
@@ -131,7 +125,7 @@ namespace Barotrauma
if (isSinglePlayer)
{
- ChatBox = new ChatBox(guiFrame, isSinglePlayer: true)
+ chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
{
OnEnterMessage = (textbox, text) =>
{
@@ -164,7 +158,7 @@ namespace Barotrauma
}
};
- ChatBox.InputBox.OnTextChanged += ChatBox.TypingChatMessage;
+ chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
}
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
@@ -214,8 +208,6 @@ namespace Barotrauma
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
prevUIScale = GUI.Scale;
-
- ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
}
@@ -279,6 +271,7 @@ namespace Barotrauma
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
return;
}
+ }
characterInfos.Add(characterInfo);
}
@@ -654,7 +647,7 @@ namespace Barotrauma
}
if (string.IsNullOrEmpty(text)) { return; }
- ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
+ chatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
}
private WifiComponent GetHeadset(Character character, bool requireEquipped)
@@ -730,7 +723,7 @@ namespace Barotrauma
if (IsSinglePlayer)
{
orderGiver.Speak(
- order.GetChatMessage("", orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
+ order.GetChatMessage("", orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
}
else
{
@@ -747,7 +740,7 @@ namespace Barotrauma
if (IsSinglePlayer)
{
orderGiver?.Speak(
- order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
+ order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
}
else if (orderGiver != null)
{
@@ -1064,24 +1057,24 @@ namespace Barotrauma
}
if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
- if (ChatBox != null)
+ if (chatBox != null)
{
- ChatBox.Update(deltaTime);
- ChatBox.InputBox.Visible = Character.Controlled != null;
+ chatBox.Update(deltaTime);
+ chatBox.InputBox.Visible = Character.Controlled != null;
- if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible)
+ if (!DebugConsole.IsOpen && chatBox.InputBox.Visible)
{
- if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected)
+ if (PlayerInput.KeyHit(InputType.Chat) && !chatBox.InputBox.Selected)
{
- ChatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
- ChatBox.InputBox.Select();
+ chatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
+ chatBox.InputBox.Select();
}
- if (PlayerInput.KeyHit(InputType.RadioChat) && !ChatBox.InputBox.Selected)
+ if (PlayerInput.KeyHit(InputType.RadioChat) && !chatBox.InputBox.Selected)
{
- ChatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
- ChatBox.InputBox.Select();
- ChatBox.InputBox.Text = "r; ";
+ chatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
+ chatBox.InputBox.Select();
+ chatBox.InputBox.Text = "r; ";
}
}
}
@@ -1151,7 +1144,7 @@ namespace Barotrauma
crewArea.RectTransform.AbsoluteOffset =
Vector2.SmoothStep(new Vector2(-crewArea.Rect.Width, 0), new Vector2(toggleCrewButton.Rect.Width, 0), crewAreaOpenState).ToPoint();
- crewAreaOpenState = ToggleCrewAreaOpen ?
+ crewAreaOpenState = toggleCrewAreaOpen ?
Math.Min(crewAreaOpenState + deltaTime * 2.0f, 1.0f) :
Math.Max(crewAreaOpenState - deltaTime * 2.0f, 0.0f);
@@ -1164,7 +1157,7 @@ namespace Barotrauma
{
Character.Controlled.SelectedConstruction = null;
}
- ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
+ toggleCrewAreaOpen = !toggleCrewAreaOpen;
}
UpdateReports(deltaTime);
@@ -1292,7 +1285,7 @@ namespace Barotrauma
{
reportButtonFrame.Visible = true;
- var reportButtonParent = ChatBox ?? GameMain.Client.ChatBox;
+ var reportButtonParent = chatBox ?? GameMain.Client.ChatBox;
reportButtonFrame.RectTransform.AbsoluteOffset = new Point(
Math.Min(reportButtonParent.GUIFrame.Rect.X, reportButtonParent.ToggleButton.Rect.X) - reportButtonFrame.Rect.Width - (int)(10 * GUI.Scale),
reportButtonParent.GUIFrame.Rect.Y);
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs
index bb18197ea..8ec219fd1 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs
@@ -135,8 +135,6 @@ namespace Barotrauma
msg.Write(map.SelectedLocationIndex == -1 ? UInt16.MaxValue : (UInt16)map.SelectedLocationIndex);
msg.Write(map.SelectedMissionIndex == -1 ? byte.MaxValue : (byte)map.SelectedMissionIndex);
- msg.Write(PurchasedHullRepairs);
- msg.Write(PurchasedItemRepairs);
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
index cf301e67d..710d858e7 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
@@ -81,8 +81,7 @@ namespace Barotrauma
var leftPanel = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), settingsFramePadding.RectTransform, Anchor.TopLeft));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform),
- TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont)
- { ForceUpperCase = true };
+ TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont);
var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft));
@@ -439,17 +438,6 @@ namespace Barotrauma
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
}
- GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("DirectionalVoiceChat"));
- directionalVoiceChat.Selected = UseDirectionalVoiceChat;
- directionalVoiceChat.ToolTip = TextManager.Get("DirectionalVoiceChatToolTip");
- directionalVoiceChat.OnSelected = (tickBox) =>
- {
- UseDirectionalVoiceChat = tickBox.Selected;
- UnsavedSettings = true;
- return true;
- };
-
-
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
#if (!OSX)
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
diff --git a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs
index 532e98df2..6d4cb8ef3 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/CharacterInventory.cs
@@ -19,7 +19,7 @@ namespace Barotrauma
Right,
Center
}
-
+
private enum QuickUseAction
{
None,
@@ -34,8 +34,6 @@ namespace Barotrauma
}
private static Dictionary limbSlotIcons;
-
- const InvSlotType PersonalSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.OuterClothes | InvSlotType.Head;
private Point screenResolution;
@@ -53,42 +51,11 @@ namespace Barotrauma
}
}
public bool Hidden { get; set; }
-
- private bool hidePersonalSlots;
- private float hidePersonalSlotsState;
- private GUIButton hideButton;
- private Rectangle personalSlotArea;
- public bool HidePersonalSlots
- {
- get { return hidePersonalSlots; }
- }
-
- public Rectangle PersonalSlotArea
- {
- get { return personalSlotArea; }
- }
-
partial void InitProjSpecific(XElement element)
{
Hidden = true;
- hideButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), (int)(60 * GUI.Scale)), GUI.Canvas)
- { AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
- "", 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;
- };
-
- hidePersonalSlots = false;
-
if (limbSlotIcons == null)
{
limbSlotIcons = new Dictionary();
@@ -101,11 +68,12 @@ namespace Barotrauma
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
}
+
SlotPositions = new Vector2[SlotTypes.Length];
CurrentLayout = Layout.Default;
SetSlotPositions(layout);
}
-
+
protected override void PutItem(Item item, int i, Character user, bool removeItem = true, bool createNetworkEvent = true)
{
base.PutItem(item, i, user, removeItem, createNetworkEvent);
@@ -191,11 +159,6 @@ namespace Barotrauma
{
if (slots[i].Disabled || (hideEmptySlot[i] && Items[i] == null)) return true;
- if (layout == Layout.Default)
- {
- if (PersonalSlots.HasFlag(SlotTypes[i]) && !personalSlotArea.Contains(slots[i].Rect.Center + slots[i].DrawOffset.ToPoint())) return true;
- }
-
//no need to draw the right hand slot if the item is in both hands
if (Items[i] != null && SlotTypes[i] == InvSlotType.RightHand && IsInLimbSlot(Items[i], InvSlotType.LeftHand))
{
@@ -213,6 +176,7 @@ namespace Barotrauma
return false;
}
+
private void SetSlotPositions(Layout layout)
{
int spacing = (int)(10 * UIScale);
@@ -221,32 +185,27 @@ namespace Barotrauma
if (slots == null) CreateSlots();
- hideButton.Visible = false;
+ var upperSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.Head;
switch (layout)
{
case Layout.Default:
{
- int personalSlotCount = SlotTypes.Count(s => PersonalSlots.HasFlag(s));
- int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
+ int personalSlotCount = SlotTypes.Count(s => upperSlots.HasFlag(s));
+ int normalSlotCount = SlotTypes.Count(s => !upperSlots.HasFlag(s));
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2;
- int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X * 2;
+ int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X;
//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);
- int hideButtonSlotIndex = -1;
for (int i = 0; i < SlotPositions.Length; i++)
{
- if (PersonalSlots.HasFlag(SlotTypes[i]))
+ if (upperSlots.HasFlag(SlotTypes[i]))
{
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset);
upperX -= slotSize.X + spacing;
- personalSlotArea = (hideButtonSlotIndex == -1) ?
- new Rectangle(SlotPositions[i].ToPoint(), slotSize) :
- Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), slotSize));
- hideButtonSlotIndex = i;
}
else
{
@@ -254,29 +213,19 @@ namespace Barotrauma
x += slotSize.X + spacing;
}
}
-
- if (hideButtonSlotIndex > -1)
- {
- hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
- hideButton.RectTransform.NonScaledSize = new Point(slotSize.X / 2, slotSize.Y + slots[hideButtonSlotIndex].EquipButtonRect.Height);
- hideButton.RectTransform.AbsoluteOffset = new Point(
- personalSlotArea.Right + spacing,
- personalSlotArea.Y - slots[hideButtonSlotIndex].EquipButtonRect.Height);
- hideButton.Visible = true;
- }
}
break;
case Layout.Right:
{
int extraOffset = 0;
int x = HUDLayoutSettings.InventoryAreaLower.Right;
- int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - slotSize.X - spacing;
+ int upperX = HUDLayoutSettings.InventoryAreaLower.Right;
for (int i = 0; i < slots.Length; i++)
{
if (HideSlot(i)) continue;
- if (PersonalSlots.HasFlag(SlotTypes[i]))
+ if (upperSlots.HasFlag(SlotTypes[i]))
{
- //upperX -= slotSize.X + spacing;
+ upperX -= slotSize.X + spacing;
}
else
{
@@ -288,10 +237,10 @@ namespace Barotrauma
for (int i = 0; i < SlotPositions.Length; i++)
{
if (HideSlot(i)) continue;
- if (PersonalSlots.HasFlag(SlotTypes[i]))
+ if (upperSlots.HasFlag(SlotTypes[i]))
{
- SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2);
- personalSlotX -= slots[i].Rect.Width + spacing;
+ SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2);
+ upperX += slots[i].Rect.Width + spacing;
}
else
{
@@ -312,14 +261,14 @@ namespace Barotrauma
case Layout.Left:
{
int x = HUDLayoutSettings.InventoryAreaLower.X;
- int personalSlotX = x;
+ int upperX = x;
for (int i = 0; i < SlotPositions.Length; i++)
{
if (HideSlot(i)) continue;
- if (PersonalSlots.HasFlag(SlotTypes[i]))
+ if (upperSlots.HasFlag(SlotTypes[i]))
{
- SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
- personalSlotX += slots[i].Rect.Width + spacing;
+ SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
+ upperX += slots[i].Rect.Width + spacing;
}
else
{
@@ -405,27 +354,6 @@ namespace Barotrauma
((selectedSlot != null && selectedSlot.IsSubSlot) || (draggingItem != null && (draggingSlot == null || !draggingSlot.MouseOn())));
if (CharacterHealth.OpenHealthWindow != null) hoverOnInventory = true;
- if (layout == Layout.Default && hideButton.Visible)
- {
- hideButton.AddToGUIUpdateList();
- hideButton.UpdateManually(deltaTime, alsoChildren: true);
-
- hidePersonalSlotsState = hidePersonalSlots ?
- Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
- Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
-
- for (int i = 0; i < slots.Length; i++)
- {
- if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
- if (HidePersonalSlots)
- {
- if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
- highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
- }
- slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
- }
- }
-
if (hoverOnInventory) HideTimer = 0.5f;
if (HideTimer > 0.0f) HideTimer -= deltaTime;
@@ -438,24 +366,7 @@ namespace Barotrauma
QuickUseItem(Items[i], true, false, true);
}
}
- }
-
- //force personal slots open if an item is running out of battery/fuel/oxygen/etc
- if (hidePersonalSlots)
- {
- for (int i = 0; i < slots.Length; i++)
- {
- if (Items[i]?.OwnInventory != null && Items[i].OwnInventory.Capacity == 1 && PersonalSlots.HasFlag(SlotTypes[i]))
- {
- if (Items[i].OwnInventory.Items[0].Condition > 0.0f &&
- Items[i].OwnInventory.Items[0].Condition / Items[i].OwnInventory.Items[0].MaxCondition < 0.15f)
- {
- hidePersonalSlots = false;
- }
- }
- }
- }
-
+
List hideSubInventories = new List();
foreach (var highlightedSubInventorySlot in highlightedSubInventorySlots)
{
@@ -793,12 +704,7 @@ namespace Barotrauma
}
base.Draw(spriteBatch);
-
- if (hideButton != null && hideButton.Visible)
- {
- hideButton.DrawManually(spriteBatch, alsoChildren: true);
- }
-
+
InventorySlot highlightedQuickUseSlot = null;
for (int i = 0; i < capacity; i++)
{
@@ -812,7 +718,7 @@ namespace Barotrauma
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
{
var icon = limbSlotIcons[SlotTypes[i]];
- icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
+ icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2(), Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
}
continue;
}
@@ -822,12 +728,12 @@ namespace Barotrauma
if (IsInLimbSlot(Items[i], InvSlotType.LeftHand))
{
var icon = limbSlotIcons[InvSlotType.LeftHand];
- icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
+ icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
}
if (IsInLimbSlot(Items[i], InvSlotType.RightHand))
{
var icon = limbSlotIcons[InvSlotType.RightHand];
- icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
+ icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
}
Color color = slots[i].EquipButtonState == GUIComponent.ComponentState.Pressed ? Color.Gray : Color.White * 0.8f;
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs
index d2e5c4a67..1bd8174d6 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemComponent.cs
@@ -377,13 +377,9 @@ namespace Barotrauma.Items.Components
public virtual void UpdateHUD(Character character, float deltaTime, Camera cam) { }
- public virtual void CreateEditingHUD(SerializableEntityEditor editor)
+ public ItemComponent GetLinkUIToComponent()
{
- }
-
- private bool LoadElemProjSpecific(XElement subElement)
- {
- switch (subElement.Name.ToString().ToLowerInvariant())
+ if (string.IsNullOrEmpty(LinkUIToComponent))
{
case "guiframe":
if (subElement.Attribute("rect") != null)
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs
index 10eb66e95..5bdd103f3 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/ItemLabel.cs
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
}
private string text;
- [Serialize("", true, translationTextTag: "Label."), Editable(100)]
+ [Serialize("", true), Editable(100)]
public string Text
{
get { return text; }
@@ -40,10 +40,9 @@ namespace Barotrauma.Items.Components
{
textBlock = null;
}
-
+
text = value;
- DisplayText = TextManager.Get(text, returnNull: true) ?? value;
- TextBlock.Text = DisplayText;
+ TextBlock.Text = value;
SetScrollingText();
}
}
@@ -122,7 +121,7 @@ namespace Barotrauma.Items.Components
{
if (!scrollable) return;
- float totalWidth = textBlock.Font.MeasureString(DisplayText).X;
+ float totalWidth = textBlock.Font.MeasureString(text).X;
float textAreaWidth = Math.Max(textBlock.Rect.Width - textBlock.Padding.X - textBlock.Padding.Z, 0);
if (totalWidth >= textAreaWidth)
{
@@ -130,13 +129,13 @@ namespace Barotrauma.Items.Components
//(so the text can scroll entirely out of view before we reset it back to start)
needsScrolling = true;
float spaceWidth = textBlock.Font.MeasureChar(' ').X;
- scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + DisplayText;
+ scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + text;
}
else
{
//whole text can fit in the textblock, no need to scroll
needsScrolling = false;
- scrollingText = DisplayText;
+ scrollingText = text;
scrollAmount = 0.0f;
scrollIndex = 0;
return;
@@ -152,7 +151,7 @@ namespace Barotrauma.Items.Components
charWidths[i] = charWidth;
}
- scrollIndex = MathHelper.Clamp(scrollIndex, 0, DisplayText.Length);
+ scrollIndex = MathHelper.Clamp(scrollIndex, 0, text.Length);
}
public override void Update(float deltaTime, Camera cam)
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs
index 5967624a1..cd5c74d3e 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/MiniMap.cs
@@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components
{
hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center;
hullInfoFrame.Visible = true;
- hullNameText.Text = hull.DisplayName;
+ hullNameText.Text = hull.RoomName;
foreach (Hull linkedHull in hullData.LinkedHulls)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs
index 6a8ee3d51..9cc203358 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Sonar.cs
@@ -785,32 +785,15 @@ namespace Barotrauma.Items.Components
foreach (Character c in Character.CharacterList)
{
- if (c.AnimController.CurrentHull != null || !c.Enabled) { continue; }
- if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) { continue; }
-
- if (c.AnimController.SimplePhysicsEnabled)
- {
- float pointDist = ((c.WorldPosition - pingSource) * displayScale).LengthSquared();
- if (pointDist > DisplayRadius * DisplayRadius) { continue; }
-
- if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
- {
- var blip = new SonarBlip(
- c.WorldPosition,
- MathHelper.Clamp(c.Mass, 0.1f, pingStrength),
- MathHelper.Clamp(c.Mass * 0.03f, 0.1f, 2.0f));
- if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
- sonarBlips.Add(blip);
- }
- continue;
- }
+ if (c.AnimController.CurrentHull != null || !c.Enabled) continue;
+ if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) continue;
foreach (Limb limb in c.AnimController.Limbs)
{
if (!limb.body.Enabled) { continue; }
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
- if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) { continue; }
+ if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) continue;
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
{
@@ -818,13 +801,13 @@ namespace Barotrauma.Items.Components
limb.WorldPosition + Rand.Vector(limb.Mass / 10.0f),
MathHelper.Clamp(limb.Mass, 0.1f, pingStrength),
MathHelper.Clamp(limb.Mass * 0.1f, 0.1f, 2.0f));
- if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
+ if (!passive && !CheckBlipVisibility(blip, transducerPos)) continue;
sonarBlips.Add(blip);
}
}
}
}
-
+
private void CreateBlipsForLine(Vector2 point1, Vector2 point2, Vector2 pingSource, Vector2 transducerPos, float pingRadius, float prevPingRadius,
float lineStep, float zStep, float range, float pingStrength, bool passive)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs
index fe1fbc065..a74b5d3b8 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Signal/CustomInterface.cs
@@ -3,7 +3,6 @@ using Lidgren.Network;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Linq;
using System.Xml.Linq;
@@ -17,22 +16,16 @@ namespace Barotrauma.Items.Components
{
uiElements.Clear();
- var visibleElements = customInterfaceElementList.Where(ciElement => !string.IsNullOrEmpty(ciElement.Label));
-
GUILayoutGroup paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center),
childAnchor: customInterfaceElementList.Count > 1 ? Anchor.TopCenter : Anchor.Center)
- {
- RelativeSpacing = 0.05f,
- Stretch = visibleElements.Count() > 2
- };
+ { RelativeSpacing = 0.05f };
- float elementSize = Math.Min(1.0f / visibleElements.Count(), 0.5f);
- foreach (CustomInterfaceElement ciElement in visibleElements)
+ float elementSize = Math.Min(1.0f / customInterfaceElementList.Count, 0.5f);
+ foreach (CustomInterfaceElement ciElement in customInterfaceElementList)
{
if (ciElement.ContinuousSignal)
{
- var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform),
- TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label)
+ var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label)
{
UserData = ciElement
};
@@ -52,8 +45,7 @@ namespace Barotrauma.Items.Components
}
else
{
- var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform),
- TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label, style: "GUIButtonLarge")
+ var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label, style: "GUIButtonLarge")
{
UserData = ciElement
};
@@ -74,24 +66,6 @@ namespace Barotrauma.Items.Components
}
}
- public override void CreateEditingHUD(SerializableEntityEditor editor)
- {
- base.CreateEditingHUD(editor);
-
- PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(customInterfaceElementList[0]);
- PropertyDescriptor labelProperty = properties.Find("Label", false);
- PropertyDescriptor signalProperty = properties.Find("Signal", false);
- for (int i = 0; i< customInterfaceElementList.Count; i++)
- {
- editor.CreateStringField(customInterfaceElementList[i],
- new SerializableProperty(labelProperty, customInterfaceElementList[i]),
- customInterfaceElementList[i].Label, "Label #" + (i + 1), "");
- editor.CreateStringField(customInterfaceElementList[i],
- new SerializableProperty(signalProperty, customInterfaceElementList[i]),
- customInterfaceElementList[i].Signal, "Signal #" + (i + 1), "");
- }
- }
-
partial void UpdateLabelsProjSpecific()
{
for (int i = 0; i < labels.Length && i < uiElements.Count; i++)
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
index 30eaf8155..9f6de7fde 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
@@ -154,6 +154,8 @@ namespace Barotrauma
public SlotReference(Inventory parentInventory, InventorySlot slot, int slotIndex, bool isSubSlot, Inventory subInventory = null)
{
+
+
ParentInventory = parentInventory;
Slot = slot;
SlotIndex = slotIndex;
@@ -712,15 +714,12 @@ namespace Barotrauma
float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f);
Vector2 itemPos = PlayerInput.MousePosition;
- bool mouseOnHealthInterface = CharacterHealth.OpenHealthWindow != null && CharacterHealth.OpenHealthWindow.MouseOnElement;
-
- if ((GUI.MouseOn == null || mouseOnHealthInterface) && selectedSlot == null)
+ if (GUI.MouseOn == null && selectedSlot == null)
{
var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0];
- string toolTip = mouseOnHealthInterface ? TextManager.Get("QuickUseAction.UseTreatment") :
- Character.Controlled.FocusedItem != null ?
- TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) :
- TextManager.Get("DropItem");
+ string toolTip = Character.Controlled.FocusedItem != null ?
+ TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) :
+ TextManager.Get("DropItem");
int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X);
int textSpacing = (int)(15 * GUI.Scale);
Point shadowBorders = (new Point(40, 10)).Multiply(GUI.Scale);
@@ -728,7 +727,7 @@ namespace Barotrauma
new Rectangle(itemPos.ToPoint() - new Point(iconSize / 2) - shadowBorders, new Point(iconSize + textWidth + textSpacing, iconSize) + shadowBorders.Multiply(2)), Color.Black * 0.8f);
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y - iconSize / 2), draggingItem.Name, Color.White);
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y), toolTip,
- color: Character.Controlled.FocusedItem == null && !mouseOnHealthInterface ? Color.Red : Color.LightGreen,
+ color: Character.Controlled.FocusedItem == null ? Color.Red : Color.LightGreen,
font: GUI.SmallFont);
}
sprite.Draw(spriteBatch, itemPos + Vector2.One * 2, Color.Black, scale: scale);
@@ -854,7 +853,7 @@ namespace Barotrauma
if (itemContainer.ContainedStateIndicator?.Texture == null)
{
containedIndicatorArea.Inflate(0, -2);
- GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.9f, true);
+ GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.8f, true);
GUI.DrawRectangle(spriteBatch,
new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height),
Color.Lerp(Color.Red, Color.Green, containedState) * 0.8f, true);
@@ -868,11 +867,11 @@ namespace Barotrauma
if (containedState > 0.0f && containedState < 0.25f)
{
- indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.25f;
+ indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.1f;
}
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
- Color.DarkGray * 0.9f,
+ Color.DarkGray * 0.6f,
origin: indicatorSprite.size / 2,
rotate: 0.0f,
scale: indicatorScale);
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Item.cs b/Barotrauma/BarotraumaClient/Source/Items/Item.cs
index c0e0029d7..fe938dafd 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Item.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Item.cs
@@ -41,6 +41,8 @@ namespace Barotrauma
{
get { return activeSprite; }
}
+
+ public float SpriteRotation;
private GUITextBlock itemInUseWarning;
private GUITextBlock ItemInUseWarning
@@ -101,22 +103,9 @@ namespace Barotrauma
return color;
}
- partial void SetActiveSpriteProjSpecific()
+ partial void SetActiveSprite()
{
activeSprite = prefab.sprite;
- Holdable holdable = GetComponent();
- if (holdable != null && holdable.Attached)
- {
- foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
- {
- if (containedSprite.UseWhenAttached)
- {
- activeSprite = containedSprite.Sprite;
- return;
- }
- }
- }
-
if (Container != null)
{
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
@@ -186,7 +175,8 @@ namespace Barotrauma
Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
-
+
+ Sprite activeSprite = prefab.sprite;
BrokenItemSprite fadeInBrokenSprite = null;
float fadeInBrokenSpriteAlpha = 0.0f;
if (condition < Prefab.Health)
@@ -577,13 +567,8 @@ namespace Barotrauma
}
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame);
-
- if (inGame)
- {
- ic.CreateEditingHUD(componentEditor);
- componentEditor.Recalculate();
- continue;
- }
+
+ if (inGame) continue;
foreach (var kvp in ic.requiredItems)
{
@@ -617,10 +602,6 @@ namespace Barotrauma
}
}
- ic.CreateEditingHUD(componentEditor);
- componentEditor.Recalculate();
- }
-
PositionEditingHUD();
SetHUDLayout();
@@ -803,7 +784,7 @@ namespace Barotrauma
{
if (!ic.CanBeSelected) { continue; }
- bool useAlternativeLayout = activeHUDs.Count > 1;
+ bool useAlternativeLayout = ic.Item != this;
bool wasUsingAlternativeLayout = ic.UseAlternativeLayout;
ic.UseAlternativeLayout = useAlternativeLayout;
needsLayoutUpdate |= ic.UseAlternativeLayout != wasUsingAlternativeLayout;
@@ -837,28 +818,14 @@ namespace Barotrauma
case NetEntityEvent.Type.ComponentState:
{
int componentIndex = msg.ReadRangedInteger(0, components.Count - 1);
- if (components[componentIndex] is IServerSerializable serverSerializable)
- {
- serverSerializable.ClientRead(type, msg, sendingTime);
- }
- else
- {
- throw new Exception("Failed to read component state - " + components[componentIndex].GetType() + " is not IServerSerializable.");
- }
+ (components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime);
}
break;
-
+
case NetEntityEvent.Type.InventoryState:
- {
+ {
int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
- if (components[containerIndex] is ItemContainer container)
- {
- container.Inventory.ClientRead(type, msg, sendingTime);
- }
- else
- {
- throw new Exception("Failed to read inventory state - " + components[containerIndex].GetType() + " is not an ItemContainer.");
- }
+ (components[containerIndex] as ItemContainer).Inventory.ClientRead(type, msg, sendingTime);
}
break;
case NetEntityEvent.Type.Status:
diff --git a/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs
index 76a9c235f..53cdf7c63 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/ItemPrefab.cs
@@ -25,14 +25,12 @@ namespace Barotrauma
class ContainedItemSprite
{
public readonly Sprite Sprite;
- public readonly bool UseWhenAttached;
public readonly string[] AllowedContainerIdentifiers;
public readonly string[] AllowedContainerTags;
public ContainedItemSprite(XElement element, string path = "", bool lazyLoad = false)
{
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
- UseWhenAttached = element.GetAttributeBool("usewhenattached", false);
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
}
diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
index 28a1f7b89..f17838929 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
@@ -217,7 +217,7 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Deferred,
BlendState.AlphaBlend,
- SamplerState.LinearClamp, DepthStencilState.DepthRead, null, null,
+ SamplerState.LinearClamp, DepthStencilState.Default, null, null,
cam.Transform);
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawObjects(spriteBatch, cam, drawFront: true);
spriteBatch.End();
diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs
index 5ce895e7b..a1fb2e137 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs
@@ -291,6 +291,11 @@ namespace Barotrauma.Lights
spriteBatch.Draw(HighlightMap, Vector2.Zero, Color.White);
spriteBatch.End();
}
+ GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive);
+ spriteBatch.End();
+
+ //draw a black rectangle on hulls to hide background lights behind subs
+ //---------------------------------------------------------------------------------------------------
//draw characters to obstruct the highlighted items/characters and light sprites
//---------------------------------------------------------------------------------------------------
@@ -495,8 +500,6 @@ namespace Barotrauma.Lights
spriteBatch.Draw(backgroundObstructor, new Rectangle(0, 0,
(int)(GameMain.GraphicsWidth * currLightMapScale), (int)(GameMain.GraphicsHeight * currLightMapScale)), Color.White);
}
- spriteBatch.End();
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
foreach (Character c in Character.CharacterList)
{
if (c.Enabled) { c.Draw(spriteBatch, cam); }
diff --git a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs
index 6bf1f97f8..69c09b594 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/Structure.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/Structure.cs
@@ -215,24 +215,23 @@ namespace Barotrauma
{
if (Prefab.BackgroundSprite != null)
{
+ bool drawDropShadow = Submarine != null && HasBody;
Vector2 dropShadowOffset = Vector2.Zero;
- if (UseDropShadow)
+ if (drawDropShadow)
{
- dropShadowOffset = DropShadowOffset;
- if (dropShadowOffset == Vector2.Zero)
+ dropShadowOffset = Submarine.HiddenSubPosition - Position;
+ if (dropShadowOffset != Vector2.Zero)
{
- if (Submarine == null)
+ if (IsHorizontal)
{
- dropShadowOffset = Vector2.UnitY * 10.0f;
+ dropShadowOffset = new Vector2(0.0f, Math.Sign(dropShadowOffset.Y) * 10.0f);
}
else
{
- dropShadowOffset = IsHorizontal ?
- new Vector2(0.0f, Math.Sign(Submarine.HiddenSubPosition.Y - Position.Y) * 10.0f) :
- new Vector2(Math.Sign(Submarine.HiddenSubPosition.X - Position.X) * 10.0f, 0.0f);
+ dropShadowOffset = new Vector2(Math.Sign(dropShadowOffset.X) * 10.0f, 0.0f);
}
+ dropShadowOffset.Y = -dropShadowOffset.Y;
}
- dropShadowOffset.Y = -dropShadowOffset.Y;
}
if (DrawTiled)
@@ -252,7 +251,7 @@ namespace Barotrauma
textureScale: TextureScale * Scale,
startOffset: backGroundOffset);
- if (UseDropShadow)
+ if (drawDropShadow)
{
Prefab.BackgroundSprite.DrawTiled(
spriteBatch,
@@ -277,7 +276,7 @@ namespace Barotrauma
rotate: 0,
spriteEffect: SpriteEffects);
- if (UseDropShadow)
+ if (drawDropShadow)
{
Prefab.BackgroundSprite.Draw(
spriteBatch,
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs b/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs
index 4a560e126..8b80fc766 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/ChatMessage.cs
@@ -61,7 +61,7 @@ namespace Barotrauma.Networking
{
orderOption = order.Options[optionIndex];
}
- txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption);
+ txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption);
if (order.TargetAllCharacters)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Client.cs b/Barotrauma/BarotraumaClient/Source/Networking/Client.cs
index 55bc409f0..9d69ff7ce 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/Client.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/Client.cs
@@ -39,33 +39,25 @@ namespace Barotrauma.Networking
public void UpdateSoundPosition()
{
- if (VoipSound == null) { return; }
-
- if (!VoipSound.IsPlaying)
+ if (VoipSound != null)
{
- DebugConsole.Log("Destroying voipsound");
- VoipSound.Dispose();
- VoipSound = null;
- return;
- }
+ if (!VoipSound.IsPlaying)
+ {
+ DebugConsole.Log("Destroying voipsound");
+ VoipSound.Dispose();
+ VoipSound = null;
+ return;
+ }
- if (character != null)
- {
- if (GameMain.Config.UseDirectionalVoiceChat)
+ if (character != null)
{
VoipSound.SetPosition(new Vector3(character.WorldPosition.X, character.WorldPosition.Y, 0.0f));
}
else
{
VoipSound.SetPosition(null);
- float dist = Vector3.Distance(new Vector3(character.WorldPosition, 0.0f), GameMain.SoundManager.ListenerPosition);
- VoipSound.Gain = 1.0f - MathUtils.InverseLerp(VoipSound.Near, VoipSound.Far, dist);
}
}
- else
- {
- VoipSound.SetPosition(null);
- }
}
partial void InitProjSpecific()
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
index fa4a2d3b4..81e786f93 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
@@ -1114,9 +1114,7 @@ namespace Barotrauma.Networking
if (campaign == null)
{
- GameMain.GameSession = missionIndex < 0 ?
- new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionType.None) :
- new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionPrefab.List[missionIndex]);
+ GameMain.GameSession = new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, missionIndex < 0 ? null : MissionPrefab.List[missionIndex]);
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
}
else
@@ -1128,18 +1126,6 @@ namespace Barotrauma.Networking
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
}
- for (int i = 0; i < Submarine.MainSubs.Length; i++)
- {
- if (!loadSecondSub && i > 0) { break; }
-
- var teamID = i == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
- Submarine.MainSubs[i].TeamID = teamID;
- foreach (Submarine sub in Submarine.MainSubs[i].DockedTo)
- {
- sub.TeamID = teamID;
- }
- }
-
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 + ").";
@@ -2260,47 +2246,7 @@ namespace Barotrauma.Networking
public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
{
- if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
-
- if (fileReceiver != null && fileReceiver.ActiveTransfers.Count > 0)
- {
- Vector2 downloadBarSize = new Vector2(250, 35) * GUI.Scale;
- Vector2 pos = new Vector2(GameMain.NetLobbyScreen.InfoFrame.Rect.X, GameMain.GraphicsHeight - downloadBarSize.Y - 5);
-
- GUI.DrawRectangle(spriteBatch, new Rectangle(
- (int)pos.X,
- (int)pos.Y,
- (int)(fileReceiver.ActiveTransfers.Count * (downloadBarSize.X + 10)),
- (int)downloadBarSize.Y),
- Color.Black * 0.8f, true);
-
- for (int i = 0; i < fileReceiver.ActiveTransfers.Count; i++)
- {
- var transfer = fileReceiver.ActiveTransfers[i];
-
- GUI.DrawString(spriteBatch,
- pos,
- ToolBox.LimitString(TextManager.Get("DownloadingFile").Replace("[filename]", transfer.FileName), GUI.SmallFont, (int)downloadBarSize.X),
- Color.White, null, 0, GUI.SmallFont);
- GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - downloadBarSize.Y / 2), new Vector2(downloadBarSize.X * 0.7f, downloadBarSize.Y / 2), transfer.Progress, Color.Green);
- GUI.DrawString(spriteBatch, pos + new Vector2(5, downloadBarSize.Y / 2),
- MathUtils.GetBytesReadable((long)transfer.Received) + " / " + MathUtils.GetBytesReadable((long)transfer.FileSize),
- Color.White, null, 0, GUI.SmallFont);
-
- if (GUI.DrawButton(spriteBatch, new Rectangle(
- (int)(pos.X + downloadBarSize.X * 0.7f), (int)(pos.Y + downloadBarSize.Y / 2),
- (int)(downloadBarSize.X * 0.3f), (int)(downloadBarSize.Y / 2)),
- TextManager.Get("Cancel"), new Color(0.47f, 0.13f, 0.15f, 0.08f)))
- {
- CancelFileTransfer(transfer);
- fileReceiver.StopTransfer(transfer);
- }
-
- pos.X += (downloadBarSize.X + 10);
- }
- }
-
- if (!gameStarted || Screen.Selected != GameMain.GameScreen) return;
+ if (!gameStarted || Screen.Selected != GameMain.GameScreen || GUI.DisableHUD || GUI.DisableUpperHUD) return;
inGameHUD.DrawManually(spriteBatch);
@@ -2351,6 +2297,40 @@ namespace Barotrauma.Networking
}
}
+ if (fileReceiver != null && fileReceiver.ActiveTransfers.Count > 0)
+ {
+ Vector2 pos = new Vector2(GameMain.NetLobbyScreen.InfoFrame.Rect.X, GameMain.GraphicsHeight - 35);
+
+ GUI.DrawRectangle(spriteBatch, new Rectangle(
+ (int)pos.X,
+ (int)pos.Y,
+ fileReceiver.ActiveTransfers.Count * 210 + 10,
+ 32),
+ Color.Black * 0.8f, true);
+
+ for (int i = 0; i < fileReceiver.ActiveTransfers.Count; i++)
+ {
+ var transfer = fileReceiver.ActiveTransfers[i];
+
+ GUI.DrawString(spriteBatch,
+ pos,
+ ToolBox.LimitString(TextManager.Get("DownloadingFile").Replace("[filename]", transfer.FileName), GUI.SmallFont, 200),
+ Color.White, null, 0, GUI.SmallFont);
+ GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - 15), new Vector2(135, 15), transfer.Progress, Color.Green);
+ GUI.DrawString(spriteBatch, pos + new Vector2(5, 15),
+ MathUtils.GetBytesReadable((long)transfer.Received) + " / " + MathUtils.GetBytesReadable((long)transfer.FileSize),
+ Color.White, null, 0, GUI.SmallFont);
+
+ if (GUI.DrawButton(spriteBatch, new Rectangle((int)pos.X + 140, (int)pos.Y + 18, 60, 15), TextManager.Get("Cancel"), new Color(0.47f, 0.13f, 0.15f, 0.08f)))
+ {
+ CancelFileTransfer(transfer);
+ fileReceiver.StopTransfer(transfer);
+ }
+
+ pos.X += 210;
+ }
+ }
+
if (!ShowNetStats) return;
netStats.Draw(spriteBatch, new Rectangle(300, 10, 300, 150));
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs
index 034fd96bc..a33a49a0e 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerInfo.cs
@@ -59,32 +59,17 @@ namespace Barotrauma.Networking
return contentPackageHashes.SetEquals(myContentPackageHashes);
}
- public void CreatePreviewWindow(GUIListBox listBox)
+ public void CreatePreviewWindow(GUIMessageBox messageBox)
{
- listBox.ClearChildren();
+ var title = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), messageBox.Content.RectTransform), ServerName, textAlignment: Alignment.Center, font: GUI.LargeFont, wrap: true);
- if (listBox == null) return;
+ var serverMsg = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), messageBox.Content.RectTransform));
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, wrap: true);
- var previewContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), listBox.Content.RectTransform, Anchor.Center))
- {
- Stretch = true
- };
-
- var titleHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.97f, 0.07f), previewContainer.RectTransform))
- {
- IsHorizontal = true,
- Stretch = true
- };
-
- var title = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), titleHolder.RectTransform), ServerName, font: GUI.LargeFont, wrap: true);
-
- new GUITextBlock(new RectTransform(Vector2.One, title.RectTransform),
- TextManager.Get("ServerListVersion") + ": " + (string.IsNullOrEmpty(GameVersion) ? TextManager.Get("Unknown") : GameVersion), textAlignment: Alignment.Right);
-
- var columnContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), previewContainer.RectTransform), isHorizontal: true)
+ var columnContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), messageBox.Content.RectTransform), isHorizontal: true)
{
Stretch = true,
- RelativeSpacing = 0.005f
+ RelativeSpacing = 0.05f
};
var columnLeft = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), columnContainer.RectTransform))
@@ -103,72 +88,12 @@ namespace Barotrauma.Networking
// left column -----------------------------------------------------------------------------
//new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnLeft.RectTransform), IP + ":" + Port);
-
- var serverMsg = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), columnLeft.RectTransform)) { ScrollBarVisible = true };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, wrap: true) { CanBeFocused = false };
-
- // right column -----------------------------------------------------------------------------
-
- /*var playerCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListPlayers"));
- new GUITextBlock(new RectTransform(Vector2.One, playerCount.RectTransform), PlayerCount + "/" + MaxPlayers, textAlignment: Alignment.Right);
-
-
- new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Round running")
- {
- Selected = GameStarted,
- CanBeFocused = false
- };*/
-
- var gameMode = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("GameMode"));
- new GUITextBlock(new RectTransform(Vector2.One, gameMode.RectTransform), TextManager.Get(string.IsNullOrEmpty(GameMode) ? "Unknown" : GameMode), textAlignment: Alignment.Right);
-
- var traitors = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("Traitors"));
- new GUITextBlock(new RectTransform(Vector2.One, traitors.RectTransform), TextManager.Get(!TraitorsEnabled.HasValue ? "Unknown" : TraitorsEnabled.Value.ToString()), textAlignment: Alignment.Right);
-
-
- var subSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListSubSelection"));
- new GUITextBlock(new RectTransform(Vector2.One, subSelection.RectTransform), TextManager.Get(!SubSelectionMode.HasValue ? "Unknown" : SubSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
-
- var modeSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListModeSelection"));
- new GUITextBlock(new RectTransform(Vector2.One, modeSelection.RectTransform), TextManager.Get(!ModeSelectionMode.HasValue ? "Unknown" : ModeSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
-
- var allowSpectating = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListAllowSpectating"))
- {
- CanBeFocused = false
- };
- if (!AllowSpectating.HasValue)
- new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowSpectating.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
- else
- allowSpectating.Selected = AllowSpectating.Value;
-
- var allowRespawn = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerSettingsAllowRespawning"))
- {
- CanBeFocused = false
- };
- if (!AllowRespawn.HasValue)
- new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowRespawn.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
- else
- allowRespawn.Selected = AllowRespawn.Value;
-
- /*new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListHasPassword"))
- {
- Selected = HasPassword,
- CanBeFocused = false
- };*/
-
- var usingWhiteList = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListUsingWhitelist"))
- {
- CanBeFocused = false
- };
- if (!UsingWhiteList.HasValue)
- new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), usingWhiteList.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
- else
- usingWhiteList.Selected = UsingWhiteList.Value;
-
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), columnRight.RectTransform),
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnLeft.RectTransform),
+ TextManager.Get("ServerListVersion") + ": " + (string.IsNullOrEmpty(GameVersion) ? TextManager.Get("Unknown") : GameVersion));
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), columnLeft.RectTransform),
TextManager.Get("ServerListContentPackages"));
- var contentPackageList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.3f), columnRight.RectTransform));
+ var contentPackageList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), columnLeft.RectTransform));
if (ContentPackageNames.Count == 0)
{
new GUITextBlock(new RectTransform(Vector2.One, contentPackageList.Content.RectTransform), TextManager.Get("Unknown"), textAlignment: Alignment.Center)
@@ -218,7 +143,7 @@ namespace Barotrauma.Networking
}
}
}
- if (availableWorkshopUrls.Count > 0)
+ if (availableWorkshopUrls.Count > 0 )
{
var workshopBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.15f), columnLeft.RectTransform), TextManager.Get("ServerListSubscribeMissingPackages"))
{
@@ -234,6 +159,64 @@ namespace Barotrauma.Networking
workshopBtn.TextBlock.AutoScale = true;
}
}
+
+ // right column -----------------------------------------------------------------------------
+
+ var playerCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListPlayers"));
+ new GUITextBlock(new RectTransform(Vector2.One, playerCount.RectTransform), PlayerCount + "/" + MaxPlayers, textAlignment: Alignment.Right);
+
+
+ new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Round running")
+ {
+ Selected = GameStarted,
+ CanBeFocused = false
+ };
+
+ var gameMode = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("GameMode"));
+ new GUITextBlock(new RectTransform(Vector2.One, gameMode.RectTransform), string.IsNullOrEmpty(GameMode) ? "Unknown" : GameMode, textAlignment: Alignment.Right);
+
+ var traitors = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("Traitors"));
+ new GUITextBlock(new RectTransform(Vector2.One, traitors.RectTransform), !TraitorsEnabled.HasValue ? "Unknown" : TraitorsEnabled.Value.ToString(), textAlignment: Alignment.Right);
+
+
+ var subSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListSubSelection"));
+ new GUITextBlock(new RectTransform(Vector2.One, subSelection.RectTransform), !SubSelectionMode.HasValue ? "Unknown" : SubSelectionMode.Value.ToString(), textAlignment: Alignment.Right);
+
+ var modeSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListModeSelection"));
+ new GUITextBlock(new RectTransform(Vector2.One, modeSelection.RectTransform), (!ModeSelectionMode.HasValue ? "Unknown" : ModeSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
+
+ var allowSpectating = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListAllowSpectating"))
+ {
+ CanBeFocused = false
+ };
+ if (!AllowSpectating.HasValue)
+ new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowSpectating.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
+ else
+ allowSpectating.Selected = AllowSpectating.Value;
+
+ var allowRespawn = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Allow respawn")
+ {
+ CanBeFocused = false
+ };
+ if (!AllowRespawn.HasValue)
+ new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowRespawn.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
+ else
+ allowRespawn.Selected = AllowRespawn.Value;
+
+ new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListHasPassword"))
+ {
+ Selected = HasPassword,
+ CanBeFocused = false
+ };
+
+ var usingWhiteList = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListUsingWhitelist"))
+ {
+ CanBeFocused = false
+ };
+ if (!UsingWhiteList.HasValue)
+ new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), usingWhiteList.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
+ else
+ usingWhiteList.Selected = UsingWhiteList.Value;
// -----------------------------------------------------------------------------
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
index bcc5d714e..3d76093fb 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
@@ -107,56 +107,6 @@ namespace Barotrauma.Steam
return true;
}
- public static bool GetFavouriteServers(Action onServerFound, Action onServerRulesReceived, Action onFinished)
- {
- if (instance == null || !instance.isInitialized)
- {
- return false;
- }
-
- var filter = new ServerList.Filter
- {
- { "appid", AppID.ToString() },
- { "gamedir", "Barotrauma" },
- { "secure", "1" }
- };
-
- //include unresponsive servers in the server list
-
- //the response is queried using the server's query port, not the game port,
- //so it may be possible to play on the server even if it doesn't respond to server list queries
- var query = instance.client.ServerList.Favourites(filter);
- query.OnUpdate += () => { UpdateServerQuery(query, onServerFound, onServerRulesReceived, includeUnresponsive: true); };
- query.OnFinished = onFinished;
-
- return true;
- }
-
- public static bool GetServersFromHistory(Action onServerFound, Action onServerRulesReceived, Action onFinished)
- {
- if (instance == null || !instance.isInitialized)
- {
- return false;
- }
-
- var filter = new ServerList.Filter
- {
- { "appid", AppID.ToString() },
- { "gamedir", "Barotrauma" },
- { "secure", "1" }
- };
-
- //include unresponsive servers in the server list
-
- //the response is queried using the server's query port, not the game port,
- //so it may be possible to play on the server even if it doesn't respond to server list queries
- var query = instance.client.ServerList.History(filter);
- query.OnUpdate += () => { UpdateServerQuery(query, onServerFound, onServerRulesReceived, includeUnresponsive: true); };
- query.OnFinished = onFinished;
-
- return true;
- }
-
private static void UpdateServerQuery(ServerList.Request query, Action onServerFound, Action onServerRulesReceived, bool includeUnresponsive)
{
IEnumerable servers = includeUnresponsive ?
@@ -598,8 +548,6 @@ namespace Barotrauma.Steam
if (!allowFileOverwrite)
{
- // TODO: If you create a new mod via the workshop interface and enable it, it will show the error msg, but still allows you to enable the content.
-
if (File.Exists(newContentPackagePath))
{
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
index 655c6fb9d..3c322d12d 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
@@ -9,9 +9,12 @@ namespace Barotrauma
{
class CampaignUI
{
- public enum Tab { Map, Crew, Store, Repair }
+ public enum Tab { Map, Crew, Store }
private Tab selectedTab;
private GUIFrame[] tabs;
+
+ private GUIButton startButton;
+
private GUIFrame topPanel;
private GUIListBox characterList;
@@ -23,8 +26,6 @@ namespace Barotrauma
private GUIComponent selectedLocationInfo;
private GUIListBox selectedMissionInfo;
- private GUIButton repairHullsButton, repairItemsButton;
-
private GUIFrame characterPreviewFrame;
private List tabButtons = new List();
@@ -38,7 +39,10 @@ namespace Barotrauma
public GUIComponent MapContainer { get; private set; }
- public GUIButton StartButton { get; private set; }
+ public GUIButton StartButton
+ {
+ get { return startButton; }
+ }
public CampaignMode Campaign { get; }
@@ -108,7 +112,7 @@ namespace Barotrauma
tabs[(int)Tab.Crew] = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.7f), container.RectTransform, Anchor.TopLeft)
{
RelativeOffset = new Vector2(0.0f, topPanel.RectTransform.RelativeSize.Y)
- }, color: Color.Black * 0.9f);
+ }, color: Color.Black * 0.7f);
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Crew].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
{
CanBeFocused = false
@@ -153,7 +157,7 @@ namespace Barotrauma
tabs[(int)Tab.Store] = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.7f), container.RectTransform, Anchor.TopLeft)
{
RelativeOffset = new Vector2(0.1f, topPanel.RectTransform.RelativeSize.Y)
- }, color: Color.Black * 0.9f);
+ }, color: Color.Black * 0.7f);
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Store].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
{
CanBeFocused = false
@@ -214,97 +218,6 @@ namespace Barotrauma
}
SelectItemCategory(MapEntityCategory.Equipment);
- // repair tab -------------------------------------------------------------------------
-
- tabs[(int)Tab.Repair] = new GUIFrame(new RectTransform(new Vector2(0.35f, 0.5f), container.RectTransform, Anchor.TopLeft)
- {
- RelativeOffset = new Vector2(0.02f, topPanel.RectTransform.RelativeSize.Y)
- }, color: Color.Black * 0.9f);
- new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
- {
- CanBeFocused = false
- };
-
- var repairContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center))
- {
- RelativeSpacing = 0.05f,
- Stretch = true
- };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), crewContent.RectTransform), "", font: GUI.LargeFont)
- {
- TextGetter = GetMoney
- };
-
- var repairHullsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
- {
- RelativeSpacing = 0.05f,
- Stretch = true
- };
- new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairHullsHolder.RectTransform, Anchor.CenterLeft), "RepairHullButton")
- {
- IgnoreLayoutGroups = true,
- CanBeFocused = false
- };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("RepairAllWalls"), textAlignment: Alignment.Right, font: GUI.LargeFont)
- {
- ForceUpperCase = true
- };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
- repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
- {
- OnClicked = (btn, userdata) =>
- {
- if (campaign.Money >= CampaignMode.HullRepairCost)
- {
- campaign.Money -= CampaignMode.HullRepairCost;
- campaign.PurchasedHullRepairs = true;
- GameMain.Client?.SendCampaignState();
- btn.GetChild().Selected = true;
- }
- btn.Enabled = false;
- return true;
- }
- };
- new GUITickBox(new RectTransform(new Vector2(0.65f), repairHullsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "")
- {
- CanBeFocused = false
- };
-
- var repairItemsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
- {
- RelativeSpacing = 0.05f,
- Stretch = true
- };
- new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairItemsHolder.RectTransform, Anchor.CenterLeft), "RepairItemsButton")
- {
- IgnoreLayoutGroups = true,
- CanBeFocused = false
- };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("RepairAllItems"), textAlignment: Alignment.Right, font: GUI.LargeFont)
- {
- ForceUpperCase = true
- };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
- repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
- {
- OnClicked = (btn, userdata) =>
- {
- if (campaign.Money >= CampaignMode.ItemRepairCost)
- {
- campaign.Money -= CampaignMode.ItemRepairCost;
- campaign.PurchasedItemRepairs = true;
- GameMain.Client?.SendCampaignState();
- btn.GetChild().Selected = true;
- }
- btn.Enabled = false;
- return true;
- }
- };
- new GUITickBox(new RectTransform(new Vector2(0.65f), repairItemsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "")
- {
- CanBeFocused = false
- };
-
// mission info -------------------------------------------------------------------------
missionPanel = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.5f), container.RectTransform, Anchor.TopRight)
@@ -417,7 +330,8 @@ namespace Barotrauma
bool purchaseableItemsFound = false;
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
{
- if (!(mapEntityPrefab is ItemPrefab itemPrefab)) { continue; }
+ var itemPrefab = mapEntityPrefab as ItemPrefab;
+ if (itemPrefab == null) { continue; }
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
if (priceInfo != null) { purchaseableItemsFound = true; break; }
@@ -435,7 +349,8 @@ namespace Barotrauma
{
//refresh store view
SelectItemCategory(MapEntityCategory.Equipment);
- }
+ }
+
}
private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer)
@@ -537,7 +452,7 @@ namespace Barotrauma
RefreshMissionTab(selectedMission);
- StartButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight),
+ startButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight),
TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
{
IgnoreLayoutGroups = true,
@@ -546,7 +461,7 @@ namespace Barotrauma
};
if (GameMain.Client != null)
{
- StartButton.Visible = !GameMain.Client.GameStarted &&
+ startButton.Visible = !GameMain.Client.GameStarted &&
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
}
@@ -593,10 +508,10 @@ namespace Barotrauma
CanBeFocused = false
};
- if (StartButton != null)
+ if (startButton != null)
{
- StartButton.Enabled = true;
- StartButton.Visible = GameMain.Client == null ||
+ startButton.Enabled = true;
+ startButton.Visible = GameMain.Client == null ||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign);
}
@@ -682,7 +597,8 @@ namespace Barotrauma
private bool BuyItem(GUIComponent component, object obj)
{
- if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false;
+ PurchasedItem pi = obj as PurchasedItem;
+ if (pi == null || pi.ItemPrefab == null) return false;
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
{
@@ -700,7 +616,8 @@ namespace Barotrauma
private bool SellItem(GUIComponent component, object obj)
{
- if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false;
+ PurchasedItem pi = obj as PurchasedItem;
+ if (pi == null || pi.ItemPrefab == null) return false;
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
{
@@ -742,20 +659,6 @@ namespace Barotrauma
{
button.Selected = (Tab)button.UserData == tab;
}
-
- switch (selectedTab)
- {
- case Tab.Repair:
- repairHullsButton.Enabled =
- !Campaign.PurchasedHullRepairs && Campaign.Money >= CampaignMode.HullRepairCost &&
- (GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
- repairHullsButton.GetChild().Selected = Campaign.PurchasedHullRepairs;
- repairItemsButton.Enabled =
- !Campaign.PurchasedItemRepairs && Campaign.Money >= CampaignMode.ItemRepairCost &&
- (GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
- repairItemsButton.GetChild().Selected = Campaign.PurchasedItemRepairs;
- break;
- }
}
private bool SelectItemCategory(MapEntityCategory category)
@@ -765,7 +668,8 @@ namespace Barotrauma
int width = storeItemList.Rect.Width;
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
{
- if (!(mapEntityPrefab is ItemPrefab itemPrefab) || !itemPrefab.Category.HasFlag(category)) continue;
+ var itemPrefab = mapEntityPrefab as ItemPrefab;
+ if (itemPrefab == null || !itemPrefab.Category.HasFlag(category)) continue;
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
if (priceInfo == null) continue;
@@ -803,8 +707,9 @@ namespace Barotrauma
}
if (prevInfoFrame != null) { tabs[(int)selectedTab].RemoveChild(prevInfoFrame); }
-
- if (!(selection is CharacterInfo characterInfo)) { return false; }
+
+ CharacterInfo characterInfo = selection as CharacterInfo;
+ if (characterInfo == null) { return false; }
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) { return false; }
if (characterPreviewFrame == null || characterPreviewFrame.UserData != characterInfo)
@@ -856,9 +761,11 @@ namespace Barotrauma
private bool HireCharacter(GUIButton button, object selection)
{
- if (!(selection is CharacterInfo characterInfo)) { return false; }
+ CharacterInfo characterInfo = selection as CharacterInfo;
+ if (characterInfo == null) { return false; }
- if (!(Campaign is SinglePlayerCampaign spCampaign))
+ SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign;
+ if (spCampaign == null)
{
DebugConsole.ThrowError("Characters can only be hired in the single player campaign.\n" + Environment.StackTrace);
return false;
@@ -877,9 +784,11 @@ namespace Barotrauma
private bool FireCharacter(GUIButton button, object selection)
{
- if (!(selection is CharacterInfo characterInfo)) return false;
+ CharacterInfo characterInfo = selection as CharacterInfo;
+ if (characterInfo == null) return false;
- if (!(Campaign is SinglePlayerCampaign spCampaign))
+ SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign;
+ if (spCampaign == null)
{
DebugConsole.ThrowError("Characters can only be fired in the single player campaign.\n" + Environment.StackTrace);
return false;
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs
index bb865ab01..8dfbbdd0b 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs
@@ -42,16 +42,16 @@ namespace Barotrauma
private bool showParamsEditor;
private bool showSpritesheet;
private bool isFreezed;
- private bool autoFreeze;
- private bool limbPairEditing;
- private bool uniformScaling;
- private bool lockSpriteOrigin;
+ private bool autoFreeze = true;
+ private bool limbPairEditing = true;
+ private bool uniformScaling = true;
+ private bool lockSpriteOrigin = true;
private bool lockSpritePosition;
private bool lockSpriteSize;
private bool recalculateCollider;
private bool copyJointSettings;
private bool displayColliders;
- private bool displayWearables;
+ private bool displayWearables = true;
private bool displayBackgroundColor;
private bool ragdollResetRequiresForceLoading;
private bool animationResetRequiresForceLoading;
@@ -89,17 +89,10 @@ namespace Barotrauma
public override void Select()
{
base.Select();
-
- SoundPlayer.OverrideMusicType = "none";
- SoundPlayer.OverrideMusicDuration = null;
- GameMain.SoundManager.SetCategoryGainMultiplier("default", 0.0f);
- GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", 0.0f);
-
GUI.ForceMouseOn(null);
CalculateSpritesheetPosition();
if (Submarine.MainSub == null)
{
- ResetVariables();
Submarine.MainSub = new Submarine("Content/AnimEditor.sub");
Submarine.MainSub.Load(unloadPrevious: false, showWarningMessages: false);
originalWall = new WallGroup(new List(Structure.WallList));
@@ -108,10 +101,6 @@ namespace Barotrauma
isEndlessRunner = true;
GameMain.LightManager.LightingEnabled = false;
}
- else if (instance == null)
- {
- ResetVariables();
- }
Submarine.MainSub.GodMode = true;
if (Character.Controlled == null)
{
@@ -129,65 +118,31 @@ namespace Barotrauma
instance = this;
}
- private void ResetVariables()
- {
- editAnimations = false;
- editLimbs = false;
- editJoints = false;
- editIK = false;
- showRagdoll = false;
- showParamsEditor = false;
- showSpritesheet = false;
- isFreezed = false;
- autoFreeze = true;
- limbPairEditing = true;
- uniformScaling = true;
- lockSpriteOrigin = false;
- lockSpritePosition = false;
- lockSpriteSize = false;
- recalculateCollider = false;
- copyJointSettings = false;
- displayColliders = false;
- displayWearables = true;
- displayBackgroundColor = false;
- ragdollResetRequiresForceLoading = false;
- animationResetRequiresForceLoading = false;
- isExtrudingJoint = false;
- isDrawingJoint = false;
- Wizard.instance = null;
- }
-
private void Reset()
{
- ResetVariables();
- if (character != null)
+ AnimParams.ForEach(a => a.Reset(true));
+ RagdollParams.Reset(true);
+ RagdollParams.ClearHistory();
+ CurrentAnimation.ClearHistory();
+ if (!character.Removed)
{
- AnimParams.ForEach(a => a.Reset(true));
- RagdollParams.Reset(true);
- RagdollParams.ClearHistory();
- CurrentAnimation.ClearHistory();
- if (!character.Removed)
- {
- character.Remove();
- }
- character = null;
+ character.Remove();
}
+ character = null;
}
public override void Deselect()
{
base.Deselect();
-
- SoundPlayer.OverrideMusicType = null;
- GameMain.SoundManager.SetCategoryGainMultiplier("default", GameMain.Config.SoundVolume);
- GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", GameMain.Config.SoundVolume);
-
GUI.ForceMouseOn(null);
if (isEndlessRunner)
{
Submarine.MainSub.Remove();
isEndlessRunner = false;
- Reset();
+ if (character != null)
+ {
+ Reset();
+ }
GameMain.World.ProcessChanges();
}
else
@@ -220,7 +175,7 @@ namespace Barotrauma
{
//base.AddToGUIUpdateList();
rightPanel.AddToGUIUpdateList();
- Wizard.instance?.AddToGUIUpdateList();
+ Wizard.Instance.AddToGUIUpdateList();
if (displayBackgroundColor)
{
backgroundColorPanel.AddToGUIUpdateList();
@@ -252,7 +207,7 @@ namespace Barotrauma
base.Update(deltaTime);
spriteSheetRect = CalculateSpritesheetRectangle();
// Handle shortcut keys
- if (GUI.KeyboardDispatcher.Subscriber == null && Wizard.instance == null)
+ if (GUI.KeyboardDispatcher.Subscriber == null)
{
if (PlayerInput.KeyDown(Keys.LeftControl))
{
@@ -441,7 +396,7 @@ namespace Barotrauma
}
}
}
- if (!isFreezed && Wizard.instance == null)
+ if (!isFreezed)
{
if (character.AnimController.Invalid)
{
@@ -1176,22 +1131,7 @@ namespace Barotrauma
character = Character.Create(configFile, spawnPosition, ToolBox.RandomSeed(8), hasAi: false, ragdoll: ragdoll);
selectedJob = null;
}
- if (character != null)
- {
- character.dontFollowCursor = dontFollowCursor;
- }
- if (character == null)
- {
- if (currentCharacterConfig == configFile)
- {
- return null;
- }
- else
- {
- // Respawn the current character;
- SpawnCharacter(currentCharacterConfig);
- }
- }
+ character.dontFollowCursor = dontFollowCursor;
OnPostSpawn();
return character;
}
@@ -1307,33 +1247,27 @@ namespace Barotrauma
string speciesName = name;
// Config file
string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/");
- if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).Any(path => path.Contains(speciesName)))
+ if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).None(path => path.Contains(speciesName)))
{
- GUI.AddMessage(GetCharacterEditorTranslation("ExistingCharacterFound"), Color.Red, font: GUI.LargeFont);
- // TODO: add a prompt: "Do you want to replace it?" + functionality
- return false;
+ // Create the config file
+ XElement mainElement = new XElement("Character",
+ new XAttribute("name", speciesName),
+ new XAttribute("humanoid", isHumanoid),
+ new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
+ new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
+ new XElement("health"),
+ new XElement("ai"));
+ XDocument doc = new XDocument(mainElement);
+ if (!Directory.Exists(mainFolder))
+ {
+ Directory.CreateDirectory(mainFolder);
+ }
+ doc.Save(configFilePath);
+ // Add to the selected content package
+ contentPackage.AddFile(configFilePath, ContentType.Character);
+ contentPackage.Save(contentPackage.Path);
+ DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
}
-
- // Create the config file
- XElement mainElement = new XElement("Character",
- new XAttribute("name", speciesName),
- new XAttribute("humanoid", isHumanoid),
- new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
- new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
- new XElement("health"),
- new XElement("ai"));
-
- XDocument doc = new XDocument(mainElement);
- if (!Directory.Exists(mainFolder))
- {
- Directory.CreateDirectory(mainFolder);
- }
- doc.Save(configFilePath);
- // Add to the selected content package
- contentPackage.AddFile(configFilePath, ContentType.Character);
- contentPackage.Save(contentPackage.Path);
- DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
-
// Ragdoll
string ragdollFolder = RagdollParams.GetFolder(speciesName);
string ragdollPath = RagdollParams.GetDefaultFile(speciesName);
@@ -1344,20 +1278,12 @@ namespace Barotrauma
string animFolder = AnimationParams.GetFolder(speciesName);
foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType)))
{
- switch (animType)
+ if (animType != AnimationType.NotDefined)
{
- case AnimationType.Walk:
- case AnimationType.Run:
- if (!ragdollParams.CanEnterSubmarine) { continue; }
- break;
- case AnimationType.SwimSlow:
- case AnimationType.SwimFast:
- break;
- default: continue;
+ Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid);
+ string fullPath = AnimationParams.GetDefaultFile(speciesName, animType);
+ AnimationParams.Create(fullPath, speciesName, animType, type);
}
- Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid);
- string fullPath = AnimationParams.GetDefaultFile(speciesName, animType);
- AnimationParams.Create(fullPath, speciesName, animType, type);
}
if (!AllFiles.Contains(configFilePath))
{
@@ -3838,7 +3764,7 @@ namespace Barotrauma
void RecalculateCollider(Limb l)
{
// We want the collider to be slightly smaller than the source rect, because the source rect is usually a bit bigger than the graphic.
- float multiplier = 0.85f;
+ float multiplier = 0.75f;
l.body.SetSize(new Vector2(ConvertUnits.ToSimUnits(width), ConvertUnits.ToSimUnits(height)) * RagdollParams.LimbScale * RagdollParams.TextureScale * multiplier);
TryUpdateLimbParam(l, "radius", ConvertUnits.ToDisplayUnits(l.body.radius / RagdollParams.LimbScale / RagdollParams.TextureScale));
TryUpdateLimbParam(l, "width", ConvertUnits.ToDisplayUnits(l.body.width / RagdollParams.LimbScale / RagdollParams.TextureScale));
@@ -4357,7 +4283,7 @@ namespace Barotrauma
private List jointXElements = new List();
private List jointGUIElements = new List();
- public static Wizard instance;
+ private static Wizard instance;
public static Wizard Instance
{
get
@@ -4388,6 +4314,7 @@ namespace Barotrauma
break;
case Tab.None:
default:
+ //activeView = null;
instance = null;
break;
}
@@ -4416,7 +4343,7 @@ namespace Barotrauma
GUITextBox xmlPathElement = null;
void UpdatePaths()
{
- string pathBase = $"Mods/Characters/{Name}/{Name}";
+ string pathBase = $"Content/Characters/{Name}/{Name}";
XMLPath = $"{pathBase}.xml";
TexturePath = $"{pathBase}.png";
texturePathElement.Text = TexturePath;
@@ -4495,7 +4422,7 @@ namespace Barotrauma
// Cancel
box.Buttons[0].OnClicked += (b, d) =>
{
- Wizard.Instance.SelectTab(Tab.None);
+ Instance.SelectTab(Tab.None);
return true;
};
// Next
@@ -4507,7 +4434,7 @@ namespace Barotrauma
texturePathElement.Flash(Color.Red);
return false;
}
- Wizard.Instance.SelectTab(Tab.Ragdoll);
+ Instance.SelectTab(Tab.Ragdoll);
return true;
};
return box;
@@ -4648,7 +4575,7 @@ namespace Barotrauma
// Previous
box.Buttons[0].OnClicked += (b, d) =>
{
- Wizard.Instance.SelectTab(Tab.Character);
+ Instance.SelectTab(Tab.Character);
return true;
};
// Parse and create
@@ -4739,7 +4666,7 @@ namespace Barotrauma
{
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
}
- Wizard.Instance.SelectTab(Tab.None);
+ Instance.SelectTab(Tab.None);
return true;
};
return box;
@@ -4919,27 +4846,23 @@ namespace Barotrauma
int width = rectInputs[2].IntValue;
int height = rectInputs[3].IntValue;
var colliderAttributes = new List();
- // Capsules/Circles
- //if (width == height)
- //{
- // colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f)));
- //}
- //else
- //{
- // if (height > width)
- // {
- // colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f)));
- // colliderAttributes.Add(new XAttribute("height",(int) (height - width * 0.85f)));
- // }
- // else
- // {
- // colliderAttributes.Add(new XAttribute("radius", (int)(height / 2 * 0.85f)));
- // colliderAttributes.Add(new XAttribute("width", (int)(width - height * 0.85f)));
- // }
- //}
- // Rectangles
- colliderAttributes.Add(new XAttribute("height", (int)(height * 0.85f)));
- colliderAttributes.Add(new XAttribute("width", (int)(width * 0.85f)));
+ if (width == height)
+ {
+ colliderAttributes.Add(new XAttribute("radius", width / 2));
+ }
+ else
+ {
+ if (height > width)
+ {
+ colliderAttributes.Add(new XAttribute("radius", width / 2));
+ colliderAttributes.Add(new XAttribute("height", height - width));
+ }
+ else
+ {
+ colliderAttributes.Add(new XAttribute("radius", height / 2));
+ colliderAttributes.Add(new XAttribute("width", width - height));
+ }
+ }
idToCodeName.TryGetValue(id, out string notes);
LimbXElements.Add(id.ToString(), new XElement("limb",
new XAttribute("id", id),
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
index 3a99c392e..795287b90 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
@@ -626,21 +626,21 @@ namespace Barotrauma
" -ownerkey " + ownerKey.ToString();
string filename = "DedicatedServer.exe";
-#if LINUX || OSX
+#if LINUX
+ filename = "./DedicatedServer";
+#elif OSX
filename = "mono";
arguments = "./DedicatedServer.exe " + arguments;
#endif
-
var processInfo = new ProcessStartInfo
{
FileName = filename,
- Arguments = arguments,
+ Arguments = arguments
#if !DEBUG
WindowStyle = ProcessWindowStyle.Hidden
#endif
};
GameMain.ServerChildProcess = Process.Start(processInfo);
-
Thread.Sleep(1000); //wait until the server is ready before connecting
GameMain.Client = new GameClient(name, "127.0.0.1:" + port.ToString(),ownerKey);
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
index 3a7b00d0b..a1c7438b6 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
@@ -261,7 +261,7 @@ namespace Barotrauma
public NetLobbyScreen()
{
- defaultModeContainer = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), Frame.RectTransform, Anchor.Center) { MaxSize = new Point(int.MaxValue, GameMain.GraphicsHeight - 100) }, style: null);
+ defaultModeContainer = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), Frame.RectTransform, Anchor.Center), style: null);
campaignContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.75f), Frame.RectTransform, Anchor.TopCenter), style: null)
{
Visible = false
@@ -737,15 +737,11 @@ namespace Barotrauma
spectateButton.Visible = GameMain.Client.GameStarted;
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
ReadyToStartBox.Selected = false;
- if (campaignUI != null)
+ if (campaignUI?.StartButton != null)
{
- //SelectTab(Tab.Map);
- if (campaignUI.StartButton != null)
- {
- campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
- (GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
- GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
- }
+ campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
+ (GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
+ GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
}
GameMain.Client.SetReadyToStart(ReadyToStartBox);
}
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs
index f4212dc18..672ffcef6 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/ServerListScreen.cs
@@ -57,20 +57,32 @@ namespace Barotrauma
var leftColumn = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), paddedFrame.RectTransform, Anchor.CenterLeft)) { Stretch = true, RelativeSpacing = 0.5f };
- var infoHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
+ menu = new GUIFrame(new RectTransform(new Point(width, height), GUI.Canvas, Anchor.Center));
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), infoHolder.RectTransform, Anchor.Center), TextManager.Get("JoinServer"), font: GUI.LargeFont)
- { ForceUpperCase = true };
+ new GUITextBlock(new RectTransform(new Vector2(0.95f, 0.133f), menu.RectTransform, Anchor.TopCenter),
+ TextManager.Get("JoinServer"), textAlignment: Alignment.Left, font: GUI.LargeFont) { ForceUpperCase = true };
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("YourName"));
- clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "")
+ var paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), menu.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.03f) }, style: null);
+
+ //-------------------------------------------------------------------------------------
+ //left column
+ //-------------------------------------------------------------------------------------
+
+ var leftColumn = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 0.92f), paddedFrame.RectTransform, Anchor.TopLeft));
+
+ //spacing
+ new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), leftColumn.RectTransform), style: null);
+
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("YourName"));
+ clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.045f), leftColumn.RectTransform), "")
{
Text = GameMain.Config.DefaultPlayerName
};
clientNameBox.OnTextChanged += RefreshJoinButtonState;
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("ServerIP"));
- ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "");
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("ServerIP"));
+ // TODO: Show IP on server info window
+ ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.045f), leftColumn.RectTransform), "");
ipBox.OnTextChanged += RefreshJoinButtonState;
ipBox.OnSelected += (sender, key) =>
{
@@ -80,53 +92,43 @@ namespace Barotrauma
sender.UserData = null;
}
};
+
+ //spacing
+ new GUIFrame(new RectTransform(new Vector2(1.0f, 0.45f), leftColumn.RectTransform), style: null);
- var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterServers"));
+ searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), "");
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers"));
- searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), filterHolder.RectTransform), "");
-
- var tickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), filterHolder.RectTransform));
+ //spacing
+ new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), leftColumn.RectTransform), style: null);
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
- filterPassword = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterPassword"));
+ filterPassword = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterPassword"));
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
- filterIncompatible = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterIncompatibleServers"));
+ filterIncompatible = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterIncompatibleServers"));
filterIncompatible.OnSelected += (tickBox) => { FilterServers(); return true; };
- filterFull = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterFullServers"));
+ filterFull = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterFullServers"));
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
- filterEmpty = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterEmptyServers"));
+ filterEmpty = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterEmptyServers"));
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
//-------------------------------------------------------------------------------------
//right column
//-------------------------------------------------------------------------------------
- var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 1.0f),
- paddedFrame.RectTransform, Anchor.CenterRight))
+ var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 0.97f),
+ paddedFrame.RectTransform, Anchor.TopRight))
{
RelativeSpacing = 0.02f,
Stretch = true
};
- var serverListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), rightColumn.RectTransform)) { Stretch = true, RelativeSpacing = 0.02f };
-
- serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center))
+ serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.85f), rightColumn.RectTransform, Anchor.Center))
{
- OnSelected = (btn, obj) => {
- ServerInfo serverInfo = (ServerInfo)obj;
-
- serverInfo.CreatePreviewWindow(serverPreview);
-
- return true;
- }
+ OnSelected = SelectServer
};
- serverList.OnSelected += SelectServer;
-
- serverPreview = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center));
-
columnRelativeWidth = new float[] { 0.04f, 0.02f, 0.044f, 0.77f, 0.02f, 0.075f, 0.06f };
var buttonContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.075f), rightColumn.RectTransform), style: null);
@@ -358,7 +360,7 @@ namespace Barotrauma
private void AddToServerList(ServerInfo serverInfo)
{
- var serverFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.06f), serverList.Content.RectTransform) { MinSize = new Point(0, 35) },
+ var serverFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.06f), serverList.Content.RectTransform) { MinSize = new Point(0, 20) },
style: "InnerFrame", color: Color.White * 0.5f)
{
UserData = serverInfo
@@ -396,6 +398,19 @@ namespace Barotrauma
UserData = "password"
};
+ new GUIButton(new RectTransform(new Vector2(columnRelativeWidth[2], 0.8f), serverContent.RectTransform, Anchor.Center), style: "GUIButtonServerListInfo") {
+ ToolTip = TextManager.Get("ServerListInfo"),
+ OnClicked = (btn, obj) => {
+ SelectServer(null, serverInfo);
+ var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel"), TextManager.Get("ServerListJoin") }, 550, 400);
+ msgBox.Buttons[0].OnClicked += msgBox.Close;
+ msgBox.Buttons[1].OnClicked += JoinServer;
+ msgBox.Buttons[1].OnClicked += msgBox.Close;
+ serverInfo.CreatePreviewWindow(msgBox);
+ return true;
+ }
+ };
+
var serverName = new GUITextBlock(new RectTransform(new Vector2(columnRelativeWidth[3], 1.0f), serverContent.RectTransform), serverInfo.ServerName, style: "GUIServerListTextBox");
var gameStartedBox = new GUITickBox(new RectTransform(new Vector2(columnRelativeWidth[4], 0.4f), serverContent.RectTransform, Anchor.Center),
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
index a9918309b..89cbf2ef2 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
@@ -43,7 +43,6 @@ namespace Barotrauma
private ContentPackage itemContentPackage;
private Facepunch.Steamworks.Workshop.Editor itemEditor;
- //private Facepunch.Steamworks.Overlay overlay;
public SteamWorkshopScreen()
{
@@ -638,12 +637,6 @@ namespace Barotrauma
OutlineColor = new Color(72, 124, 77, 255),
OnClicked = (btn, userdata) =>
{
- // Failed attempt, might have to be activated before accessing because as of now it just throws a null for overlay
- /*if (overlay.Enabled)
- {
- overlay.OpenUrl("steam://url/CommunityFilePage/" + item.Id);
- }*/
-
System.Diagnostics.Process.Start("steam://url/CommunityFilePage/" + item.Id);
return true;
}
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
index 8d45d1ae0..52ac33d4a 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
@@ -310,12 +310,6 @@ namespace Barotrauma
RelativeSpacing = 0.01f,
Stretch = true
};
-
- new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
- {
- OnClicked = (btn, userdata) => { ClearFilter(); return true; }
- };
-
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
entityCategoryButtons.Add(new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform),
@@ -1017,7 +1011,7 @@ namespace Barotrauma
var previewImageButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), isHorizontal: true) { Stretch = true, RelativeSpacing = 0.05f };
- new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageCreate"))
+ new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageGenerate"))
{
OnClicked = (btn, userdata) =>
{
diff --git a/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs b/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs
index cb0e9cd57..0d756b322 100644
--- a/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs
+++ b/Barotrauma/BarotraumaClient/Source/Serialization/SerializableEntityEditor.cs
@@ -277,17 +277,13 @@ namespace Barotrauma
{
component.RectTransform.Parent = layoutGroup.RectTransform;
component.RectTransform.RepositionChildInHierarchy(childIndex);
- Recalculate();
- }
- public void Recalculate()
- {
int contentHeight = ContentHeight;
RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.X, contentHeight);
layoutGroup.RectTransform.NonScaledSize = new Point(layoutGroup.RectTransform.NonScaledSize.X, contentHeight);
}
- public GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity)
+ private GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity)
{
object value = property.GetValue(entity);
if (property.PropertyType == typeof(string) && value == null)
@@ -355,7 +351,7 @@ namespace Barotrauma
return propertyField;
}
- public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip)
+ private GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip)
{
GUITickBox propertyTickBox = new GUITickBox(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), displayName)
{
@@ -371,11 +367,11 @@ namespace Barotrauma
return true;
}
};
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyTickBox }); }
+ Fields.Add(property.Name, new GUIComponent[] { propertyTickBox });
return propertyTickBox;
}
- public GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip)
+ private GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -399,11 +395,11 @@ namespace Barotrauma
TrySendNetworkUpdate(entity, property);
}
};
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); }
+ Fields.Add(property.Name, new GUIComponent[] { numberInput });
return frame;
}
- public GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip)
+ private GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -429,11 +425,11 @@ namespace Barotrauma
TrySendNetworkUpdate(entity, property);
}
};
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); }
+ Fields.Add(property.Name, new GUIComponent[] { numberInput });
return frame;
}
- public GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
+ private GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -458,11 +454,11 @@ namespace Barotrauma
return true;
};
enumDropDown.SelectItem(value);
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
+ Fields.Add(property.Name, new GUIComponent[] { enumDropDown });
return frame;
}
- public GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
+ private GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -491,21 +487,18 @@ namespace Barotrauma
return true;
};
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
+ Fields.Add(property.Name, new GUIComponent[] { enumDropDown });
return frame;
}
- public GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip)
+ private GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip)
{
- var frame = new GUILayoutGroup(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), isHorizontal: true)
- {
- Stretch = true
- };
+ var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont, textAlignment: Alignment.Left)
{
ToolTip = toolTip
};
- GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform))
+ GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform, Anchor.TopRight))
{
ToolTip = toolTip,
Font = GUI.SmallFont,
@@ -521,36 +514,11 @@ namespace Barotrauma
return true;
}
};
- string translationTextTag = property.GetAttribute()?.translationTextTag;
- if (translationTextTag != null)
- {
- new GUIButton(new RectTransform(new Vector2(0.1f, 1), frame.RectTransform, Anchor.TopRight), "...")
- {
- OnClicked = (bt, userData) => { CreateTextPicker(translationTextTag, entity, property, propertyBox); return true; }
- };
- propertyBox.OnTextChanged += (tb, text) =>
- {
- string translatedText = TextManager.Get(text, returnNull: true);
- if (translatedText == null)
- {
- propertyBox.TextColor = Color.Gray;
- propertyBox.ToolTip = TextManager.Get("StringPropertyCannotTranslate").Replace("[tag]", text ?? "");
- }
- else
- {
- propertyBox.TextColor = Color.LightGreen;
- propertyBox.ToolTip = TextManager.Get("StringPropertyTranslate").Replace("[translation]", translatedText);
- }
- return true;
- };
- propertyBox.Text = value;
- }
-
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyBox }); }
+ Fields.Add(property.Name, new GUIComponent[] { propertyBox });
return frame;
}
- public GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip)
+ private GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -598,11 +566,11 @@ namespace Barotrauma
};
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
- public GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip)
+ private GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -652,11 +620,11 @@ namespace Barotrauma
};
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
- public GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip)
+ private GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -710,11 +678,11 @@ namespace Barotrauma
};
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
- public GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip)
+ private GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -772,14 +740,14 @@ namespace Barotrauma
};
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
- public GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip)
+ private GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
- var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26) }, displayName, font: GUI.SmallFont)
+ var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26)}, displayName, font: GUI.SmallFont)
{
ToolTip = toolTip
};
@@ -839,11 +807,11 @@ namespace Barotrauma
colorBox.Color = (Color)property.GetValue(entity);
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
- public GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip)
+ private GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip)
{
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
@@ -899,43 +867,9 @@ namespace Barotrauma
};
fields[i] = numberInput;
}
- if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
+ Fields.Add(property.Name, fields);
return frame;
}
-
- public void CreateTextPicker(string textTag, ISerializableEntity entity, SerializableProperty property, GUITextBox textBox)
- {
- var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel") }, width: 300, height: 400);
- msgBox.Buttons[0].OnClicked = msgBox.Close;
-
- var textList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.8f), msgBox.Content.RectTransform, Anchor.TopCenter))
- {
- OnSelected = (component, userData) =>
- {
- string text = userData as string ?? "";
-
- if (property.TrySetValue(entity, text))
- {
- TrySendNetworkUpdate(entity, property);
- textBox.Text = (string)property.GetValue(entity);
- textBox.Deselect();
- }
- return true;
- }
- };
-
- textTag = textTag.ToLowerInvariant();
- var tagTextPairs = TextManager.GetAllTagTextPairs();
- foreach (KeyValuePair tagTextPair in tagTextPairs)
- {
- if (!tagTextPair.Key.StartsWith(textTag)) { continue; }
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), textList.Content.RectTransform) { MinSize = new Point(0, 20) },
- ToolBox.LimitString(tagTextPair.Value, GUI.Font, textList.Content.Rect.Width))
- {
- UserData = tagTextPair.Key
- };
- }
- }
private void TrySendNetworkUpdate(ISerializableEntity entity, SerializableProperty property)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs
index 0a1abe7ea..f89a52305 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundPlayer.cs
@@ -372,6 +372,167 @@ namespace Barotrauma
}
}
+ private static void UpdateFireSounds(float deltaTime)
+ {
+ for (int i = 0; i < fireVolumeLeft.Length; i++)
+ {
+ fireVolumeLeft[i] = 0.0f;
+ fireVolumeRight[i] = 0.0f;
+ }
+
+ Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y);
+ foreach (Hull hull in Hull.hullList)
+ {
+ foreach (FireSource fs in hull.FireSources)
+ {
+ Vector2 diff = fs.WorldPosition + fs.Size / 2 - listenerPos;
+ if (Math.Abs(diff.X) < FireSoundRange && Math.Abs(diff.Y) < FireSoundRange)
+ {
+ Vector2 diffLeft = (fs.WorldPosition + new Vector2(fs.Size.X, fs.Size.Y / 2)) - listenerPos;
+ if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f;
+ if (diffLeft.X <= 0)
+ {
+ float distFallOffLeft = diffLeft.Length() / FireSoundRange;
+ if (distFallOffLeft < 0.99f)
+ {
+ fireVolumeLeft[0] += (1.0f - distFallOffLeft) * (fs.Size.X / FireSoundLargeLimit);
+ if (fs.Size.X > FireSoundLargeLimit) fireVolumeLeft[1] += (1.0f - distFallOffLeft) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit);
+ }
+ }
+
+ Vector2 diffRight = (fs.WorldPosition + new Vector2(0.0f, fs.Size.Y / 2)) - listenerPos;
+ if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f;
+ if (diffRight.X >= 0)
+ {
+ float distFallOffRight = diffRight.Length() / FireSoundRange;
+ if (distFallOffRight < 0.99f)
+ {
+ fireVolumeRight[0] += 1.0f - distFallOffRight;
+ if (fs.Size.X > FireSoundLargeLimit) fireVolumeRight[1] += (1.0f - distFallOffRight) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit);
+ }
+ }
+ }
+ }
+ }
+
+ for (int i = 0; i < fireVolumeLeft.Length; i++)
+ {
+ if (fireVolumeLeft[i] < 0.05f && fireVolumeRight[i] < 0.05f)
+ {
+ if (fireSoundChannels[i] != null)
+ {
+ fireSoundChannels[i].FadeOutAndDispose();
+ fireSoundChannels[i] = null;
+ }
+ }
+ else
+ {
+ Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (fireVolumeRight[i] - fireVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y);
+ if (fireSoundChannels[i] == null || !fireSoundChannels[i].IsPlaying)
+ {
+ fireSoundChannels[i] = GetSound(i == 0 ? "fire" : "firelarge").Play(1.0f, FlowSoundRange, soundPos);
+ fireSoundChannels[i].Looping = true;
+ }
+ fireSoundChannels[i].Gain = Math.Max(fireVolumeRight[i], fireVolumeLeft[i]);
+ fireSoundChannels[i].Position = new Vector3(soundPos, 0.0f);
+ }
+ }
+ }
+
+ if (waterAmbiences.Count > 1)
+ {
+ if (waterAmbienceChannels[0] == null || !waterAmbienceChannels[0].IsPlaying)
+ {
+ waterAmbienceChannels[0] = waterAmbiences[0].Play(ambienceVolume * (1.0f - movementSoundVolume),"waterambience");
+ //waterAmbiences[0].Loop(waterAmbienceIndexes[0], ambienceVolume * (1.0f - movementSoundVolume));
+ waterAmbienceChannels[0].Looping = true;
+ }
+ else
+ {
+ waterAmbienceChannels[0].Gain = ambienceVolume * (1.0f - movementSoundVolume);
+ }
+
+ if (waterAmbienceChannels[1] == null || !waterAmbienceChannels[1].IsPlaying)
+ {
+ waterAmbienceChannels[1] = waterAmbiences[1].Play(ambienceVolume * movementSoundVolume, "waterambience");
+ //waterAmbienceIndexes[1] = waterAmbiences[1].Loop(waterAmbienceIndexes[1], ambienceVolume * movementSoundVolume);
+ waterAmbienceChannels[1].Looping = true;
+ }
+ else
+ {
+ waterAmbienceChannels[1].Gain = ambienceVolume * movementSoundVolume;
+ }
+ }
+ }
+
+ private static void UpdateWaterFlowSounds(float deltaTime)
+ {
+ if (FlowSounds.Count == 0) { return; }
+
+ float[] targetFlowLeft = new float[FlowSounds.Count];
+ float[] targetFlowRight = new float[FlowSounds.Count];
+
+ Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y);
+ foreach (Gap gap in Gap.GapList)
+ {
+ if (gap.Open < 0.01f) continue;
+ float gapFlow = Math.Abs(gap.LerpedFlowForce.X) + Math.Abs(gap.LerpedFlowForce.Y) * 2.5f;
+
+ if (gapFlow < 10.0f) continue;
+
+ int flowSoundIndex = (int)Math.Floor(MathHelper.Clamp(gapFlow / MaxFlowStrength, 0, FlowSounds.Count));
+ flowSoundIndex = Math.Min(flowSoundIndex, FlowSounds.Count - 1);
+
+ Vector2 diff = gap.WorldPosition - listenerPos;
+ if (Math.Abs(diff.X) < FlowSoundRange && Math.Abs(diff.Y) < FlowSoundRange)
+ {
+ float dist = diff.Length();
+ float distFallOff = dist / FlowSoundRange;
+ if (distFallOff >= 0.99f) continue;
+
+ //flow at the left side
+ if (diff.X < 0)
+ {
+ targetFlowLeft[flowSoundIndex] = 1.0f - distFallOff;
+ }
+ else
+ {
+ targetFlowRight[flowSoundIndex] = 1.0f - distFallOff;
+ }
+ }
+ }
+
+ for (int i = 0; i < FlowSounds.Count; i++)
+ {
+ flowVolumeLeft[i] = (targetFlowLeft[i] < flowVolumeLeft[i]) ?
+ Math.Max(targetFlowLeft[i], flowVolumeLeft[i] - deltaTime) :
+ Math.Min(targetFlowLeft[i], flowVolumeLeft[i] + deltaTime);
+ flowVolumeRight[i] = (targetFlowRight[i] < flowVolumeRight[i]) ?
+ Math.Max(targetFlowRight[i], flowVolumeRight[i] - deltaTime) :
+ Math.Min(targetFlowRight[i], flowVolumeRight[i] + deltaTime);
+
+ if (flowVolumeLeft[i] < 0.05f && flowVolumeRight[i] < 0.05f)
+ {
+ if (flowSoundChannels[i] != null)
+ {
+ flowSoundChannels[i].Dispose();
+ flowSoundChannels[i] = null;
+ }
+ }
+ else
+ {
+ Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (flowVolumeRight[i] - flowVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y);
+ if (flowSoundChannels[i] == null || !flowSoundChannels[i].IsPlaying)
+ {
+ flowSoundChannels[i] = FlowSounds[i].Play(1.0f, FlowSoundRange, soundPos);
+ flowSoundChannels[i].Looping = true;
+ }
+ flowSoundChannels[i].Gain = Math.Max(flowVolumeRight[i], flowVolumeLeft[i]);
+ flowSoundChannels[i].Position = new Vector3(soundPos, 0.0f);
+ }
+ }
+ }
+
private static void UpdateFireSounds(float deltaTime)
{
for (int i = 0; i < fireVolumeLeft.Length; i++)
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
index 18126a8ba..3e86fcc2c 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
@@ -32,9 +32,6 @@ namespace Barotrauma.Sounds
public bool UseRadioFilter;
public bool UseMuffleFilter;
- public float Near { get; private set; }
- public float Far { get; private set; }
-
private static BiQuad[] muffleFilters = new BiQuad[]
{
new LowpassFilter(VoipConfig.FREQUENCY, 800)
@@ -44,16 +41,6 @@ namespace Barotrauma.Sounds
new BandpassFilter(VoipConfig.FREQUENCY, 2000)
};
- public float Gain
- {
- get { return soundChannel == null ? 0.0f : soundChannel.Gain; }
- set
- {
- if (soundChannel == null) { return; }
- soundChannel.Gain = value;
- }
- }
-
public VoipSound(SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
{
VoipConfig.SetupEncoding();
@@ -77,8 +64,8 @@ namespace Barotrauma.Sounds
public void SetRange(float near, float far)
{
- soundChannel.Near = Near = near;
- soundChannel.Far = Far = far;
+ soundChannel.Near = near;
+ soundChannel.Far = far;
}
public void ApplyFilters(short[] buffer, int readSamples)
diff --git a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
index a9ad8e446..67e912b03 100644
--- a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
+++ b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
@@ -151,7 +151,6 @@ namespace Barotrauma
for (int i = traitStart + NPCPersonalityTrait.List.Count; i < csvContent.Length; i++) // Conversations
{
- string[] presplit = csvContent[i].Split(','); // Handling speaker index fetching, somehow doesn't work with the regex
string[] split = SplitCSV(csvContent[i]);
int emptyFields = 0;
@@ -173,20 +172,20 @@ namespace Barotrauma
continue;
}
- string speaker = presplit[1];
- int depthIndex = int.Parse(presplit[2]);
+ string speaker = split[1];
+ int depthIndex = int.Parse(split[2]);
// 3 = original line
string line = split[4].Replace("\"", "");
string flags = split[5].Replace("\"", "");
string allowedJobs = split[6].Replace("\"", "");
string speakerTags = split[7].Replace("\"", "");
- string minIntensity = split[8].Replace("\"", "").Replace(",", ".");
- string maxIntensity = split[9].Replace("\"", "").Replace(",", ".");
+ string minIntensity = split[8].Replace("\"", "");
+ string maxIntensity = split[9].Replace("\"", "");
string element =
$"{GetIndenting(depthIndex)}" +
$"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Barotrauma/BarotraumaClient/monomachineconfig b/Barotrauma/BarotraumaClient/monomachineconfig
new file mode 100644
index 000000000..455709536
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/monomachineconfig
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Barotrauma/BarotraumaClient/mscorlib.dll b/Barotrauma/BarotraumaClient/mscorlib.dll
new file mode 100755
index 000000000..3f61223f1
Binary files /dev/null and b/Barotrauma/BarotraumaClient/mscorlib.dll differ
diff --git a/Barotrauma/BarotraumaServer/DedicatedServer b/Barotrauma/BarotraumaServer/DedicatedServer
new file mode 100755
index 000000000..330b12e4c
--- /dev/null
+++ b/Barotrauma/BarotraumaServer/DedicatedServer
@@ -0,0 +1,35 @@
+#!/bin/bash
+# MonoKickstart Shell Script
+# Written by Ethan "flibitijibibo" Lee
+
+# Move to script's directory
+cd "`dirname "$0"`"
+
+# Get the system architecture
+UNAME=`uname`
+ARCH=`uname -m`
+
+# MonoKickstart picks the right libfolder, so just execute the right binary.
+if [ "$UNAME" == "Darwin" ]; then
+ # ... Except on OSX.
+ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/
+
+ # El Capitan is a total idiot and wipes this variable out, making the
+ # Steam overlay disappear. This sidesteps "System Integrity Protection"
+ # and resets the variable with Valve's own variable (they provided this
+ # fix by the way, thanks Valve!). Note that you will need to update your
+ # launch configuration to the script location, NOT just the app location
+ # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app).
+ # -flibit
+ if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
+ export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
+ fi
+
+ ./DedicatedServer.bin.osx $@
+else
+ if [ "$ARCH" == "x86_64" ]; then
+ ./DedicatedServer.bin.x86_64 $@
+ else
+ ./DedicatedServer.bin.x86 $@
+ fi
+fi
diff --git a/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86 b/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86
new file mode 100755
index 000000000..c7c060f04
Binary files /dev/null and b/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86 differ
diff --git a/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86_64 b/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86_64
new file mode 100755
index 000000000..47535d05b
Binary files /dev/null and b/Barotrauma/BarotraumaServer/DedicatedServer.bin.x86_64 differ
diff --git a/Barotrauma/BarotraumaServer/Server.csproj b/Barotrauma/BarotraumaServer/Server.csproj
index 1d344c8fe..3cab79257 100644
--- a/Barotrauma/BarotraumaServer/Server.csproj
+++ b/Barotrauma/BarotraumaServer/Server.csproj
@@ -216,13 +216,22 @@
-
+
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
-
\ No newline at end of file
+
diff --git a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs
index 5f0639ff0..3b8d62294 100644
--- a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs
+++ b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs
@@ -360,7 +360,7 @@ namespace Barotrauma
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
}
- tempBuffer.Write(IsRagdolled || IsUnconscious || Stun > 0.0f || IsDead);
+ tempBuffer.Write(IsRagdolled);
tempBuffer.Write(AnimController.Dir > 0.0f);
}
diff --git a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
index 1dd05bae8..a7d06ffa1 100644
--- a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
@@ -193,7 +193,7 @@ namespace Barotrauma
Console.CursorLeft = 0;
Console.CursorTop -= cursorLine;
Console.Write(input);
- Console.CursorLeft = input.Length % Console.WindowWidth;
+ Console.CursorLeft = input.Length % consoleWidth;
}
private static void AssignOnClientRequestExecute(string names, Action onClientRequestExecute)
diff --git a/Barotrauma/BarotraumaServer/Source/GameMain.cs b/Barotrauma/BarotraumaServer/Source/GameMain.cs
index 53e3623d6..6d44fd936 100644
--- a/Barotrauma/BarotraumaServer/Source/GameMain.cs
+++ b/Barotrauma/BarotraumaServer/Source/GameMain.cs
@@ -83,7 +83,6 @@ namespace Barotrauma
LevelGenerationParams.LoadPresets();
ScriptedEventSet.LoadPrefabs();
- AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure));
ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item));
JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs));
@@ -91,6 +90,7 @@ namespace Barotrauma
NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations));
ItemAssemblyPrefab.LoadAll();
LevelObjectPrefab.LoadAll();
+ AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
GameModePreset.Init();
LocationType.Init();
diff --git a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs
index 7cacaa130..0e1667db4 100644
--- a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs
+++ b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs
@@ -168,8 +168,6 @@ namespace Barotrauma
msg.Write(isRunning && endWatchman != null ? endWatchman.ID : (UInt16)0);
msg.Write(Money);
- msg.Write(PurchasedHullRepairs);
- msg.Write(PurchasedItemRepairs);
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
@@ -194,8 +192,6 @@ namespace Barotrauma
{
UInt16 selectedLocIndex = msg.ReadUInt16();
byte selectedMissionIndex = msg.ReadByte();
- bool purchasedHullRepairs = msg.ReadBoolean();
- bool purchasedItemRepairs = msg.ReadBoolean();
UInt16 purchasedItemCount = msg.ReadUInt16();
List purchasedItems = new List();
@@ -212,17 +208,6 @@ namespace Barotrauma
return;
}
- if (purchasedHullRepairs && !this.PurchasedHullRepairs && Money >= HullRepairCost)
- {
- this.PurchasedHullRepairs = true;
- Money -= HullRepairCost;
- }
- if (purchasedItemRepairs && !this.PurchasedItemRepairs && Money >= ItemRepairCost)
- {
- this.PurchasedItemRepairs = true;
- Money -= ItemRepairCost;
- }
-
Map.SelectLocation(selectedLocIndex == UInt16.MaxValue ? -1 : selectedLocIndex);
if (Map.SelectedConnection != null)
{
diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
index d9137afc7..d4c20614b 100644
--- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
+++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
@@ -1754,10 +1754,11 @@ namespace Barotrauma.Networking
Log("Game mode: " + selectedMode.Name, ServerLog.MessageType.ServerMessage);
Log("Submarine: " + selectedSub.Name, ServerLog.MessageType.ServerMessage);
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
- }
+ }
- MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
- bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
+ bool missionAllowRespawn = campaign == null &&
+ (!(GameMain.GameSession.GameMode is MissionMode) ||
+ ((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
@@ -1766,12 +1767,6 @@ namespace Barotrauma.Networking
{
var teamID = n == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
- Submarine.MainSubs[n].TeamID = teamID;
- foreach (Submarine sub in Submarine.MainSubs[n].DockedTo)
- {
- sub.TeamID = teamID;
- }
-
//find the clients in this team
List teamClients = teamCount == 1 ?
new List(connectedClients) :
@@ -1940,8 +1935,10 @@ namespace Barotrauma.Networking
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
- MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
- bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
+ bool missionAllowRespawn = campaign == null &&
+ (!(GameMain.GameSession.GameMode is MissionMode) ||
+ ((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
+
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
diff --git a/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs
index d1d613a94..326df08c3 100644
--- a/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs
+++ b/Barotrauma/BarotraumaServer/Source/Networking/NetEntityEvent/ServerEntityEventManager.cs
@@ -10,7 +10,9 @@ namespace Barotrauma.Networking
class ServerEntityEvent : NetEntityEvent
{
private IServerSerializable serializable;
-
+
+ public bool Sent;
+
#if DEBUG
public string StackTrace;
#endif
diff --git a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
index 5d1bf37a2..529a93864 100644
--- a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
+++ b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
@@ -5,14 +5,11 @@
-
-
-
-
-
-
-
+
+
+
+
diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems
index 87350b127..7fae3d1c5 100644
--- a/Barotrauma/BarotraumaShared/SharedContent.projitems
+++ b/Barotrauma/BarotraumaShared/SharedContent.projitems
@@ -24,10 +24,6 @@
-
-
-
-
@@ -361,81 +357,6 @@
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
PreserveNewest
@@ -670,94 +591,94 @@
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
@@ -1380,7 +1301,7 @@
PreserveNewest
-
+
PreserveNewest
@@ -1647,7 +1568,7 @@
PreserveNewest
-
+
PreserveNewest
@@ -1659,7 +1580,10 @@
PreserveNewest
-
+
+ PreserveNewest
+
+
PreserveNewest
@@ -1668,10 +1592,10 @@
PreserveNewest
-
+
PreserveNewest
-
+
PreserveNewest
@@ -2004,27 +1928,6 @@
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
PreserveNewest
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs
index 965a0d4d8..88d29d8c9 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs
@@ -12,8 +12,6 @@ namespace Barotrauma
{
partial class EnemyAIController : AIController
{
- public static bool DisableEnemyAI;
-
class WallTarget
{
public Vector2 Position;
@@ -251,7 +249,7 @@ namespace Barotrauma
}
}
- private TargetingPriority GetTargetingPriority(string targetTag)
+ public TargetingPriority GetTargetingPriority(string targetTag)
{
if (targetingPriorities.TryGetValue(targetTag, out TargetingPriority priority))
{
@@ -487,7 +485,7 @@ namespace Barotrauma
}
else
{
- if (!IsProperlyLatchedOnSub)
+ if (!IsProperlyLatched)
{
UpdateWallTarget();
}
@@ -1003,7 +1001,7 @@ namespace Barotrauma
private void UpdateEating(float deltaTime)
{
- if (SelectedAiTarget == null) //SelectedAiTarget.Entity is Character c && !c.IsDead
+ if (SelectedAiTarget == null)
{
State = AIState.Idle;
return;
@@ -1040,14 +1038,14 @@ namespace Barotrauma
#region Targeting
- private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
+ private bool IsProperlyLatched => LatchOntoAI != null && LatchOntoAI.IsAttached && SelectedAiTarget?.Entity == wallTarget?.Structure;
//goes through all the AItargets, evaluates how preferable it is to attack the target,
//whether the Character can see/hear the target and chooses the most preferable target within
//sight/hearing range
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
{
- if (IsProperlyLatchedOnSub)
+ if (IsProperlyLatched)
{
// If attached to a valid target, just keep the target.
// Priority not used in this case.
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs
index 41b183cec..f41af8814 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/HumanAIController.cs
@@ -267,7 +267,7 @@ namespace Barotrauma
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
{
Character.Speak(
- newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
+ newOrder.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order);
}
}
}
@@ -286,7 +286,7 @@ namespace Barotrauma
if (Character.PressureTimer > 50.0f && Character.CurrentHull != null)
{
- Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.DisplayName), null, 0, "pressure", 30.0f);
+ Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.RoomName), null, 0, "pressure", 30.0f);
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs
index e1109f83f..b2ece3f38 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs
@@ -388,18 +388,6 @@ namespace Barotrauma
buttonPressCooldown = ButtonPressInterval;
break;
}
- else
- {
- if (!door.HasRequiredItems(character, false) && shouldBeOpen)
- {
- currentPath.Unreachable = true;
- return;
- }
-
- door.Item.TryInteract(character, false, true, true);
- buttonPressCooldown = ButtonPressInterval;
- break;
- }
}
}
}
@@ -426,12 +414,20 @@ namespace Barotrauma
if (!nextNode.Waypoint.ConnectedDoor.HasRequiredItems(character, false)) { return null; }
}
+ if (!canBreakDoors)
+ {
+ //door closed and the character can't open doors -> node can't be traversed
+ if (!canOpenDoors || character.LockHands) return null;
+
+ var doorButtons = nextNode.Waypoint.ConnectedDoor.Item.GetConnectedComponents();
+ if (!doorButtons.Any()) return null;
+
foreach (Controller button in doorButtons)
{
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
- Math.Sign(node.Position.X - nextNode.Position.X)) { continue; }
+ Math.Sign(node.Position.X - nextNode.Position.X)) continue;
- if (!button.HasRequiredItems(character, false)) { return null; }
+ if (!button.HasRequiredItems(character, false)) return null;
}
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs
index c85b2caa7..fe5304a4c 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/LatchOntoAI.cs
@@ -54,8 +54,6 @@ namespace Barotrauma
get { return attachJoints.Count > 0; }
}
- public bool IsAttachedToSub => IsAttached && attachTargetBody?.UserData is Entity entity && (entity is Submarine sub || entity?.Submarine != null);
-
public LatchOntoAI(XElement element, EnemyAIController enemyAI)
{
attachToWalls = element.GetAttributeBool("attachtowalls", false);
@@ -209,10 +207,10 @@ namespace Barotrauma
break;
}
- if (IsAttached && attachTargetBody != null && deattachTimer < 0.0f)
+ if (attachTargetBody != null && deattachTimer < 0.0f)
{
Entity entity = attachTargetBody.UserData as Entity;
- Submarine attachedSub = entity is Submarine sub ? sub : entity?.Submarine;
+ Submarine attachedSub = entity is Submarine ? (Submarine)entity : entity?.Submarine;
if (attachedSub != null)
{
float velocity = attachedSub.Velocity == Vector2.Zero ? 0.0f : attachedSub.Velocity.Length();
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs
index 9acf4bc99..6b7dda849 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveCombat.cs
@@ -44,7 +44,6 @@ namespace Barotrauma
private AIObjectiveContainItem reloadWeaponObjective;
private Hull retreatTarget;
private AIObjectiveGoTo retreatObjective;
- private AIObjectiveFindSafety findSafety;
private float coolDownTimer;
@@ -61,9 +60,7 @@ namespace Barotrauma
{
Enemy = enemy;
coolDownTimer = CoolDown;
- findSafety = HumanAIController.ObjectiveManager.GetObjective();
- findSafety.Priority = 0;
- findSafety.unreachable.Clear();
+ HumanAIController.ObjectiveManager.GetObjective().Priority = 0;
Mode = mode;
if (Enemy == null)
{
@@ -178,7 +175,7 @@ namespace Barotrauma
{
if (retreatTarget == null || (retreatObjective != null && !retreatObjective.CanBeCompleted))
{
- retreatTarget = findSafety.FindBestHull(new List() { character.CurrentHull });
+ retreatTarget = HumanAIController.ObjectiveManager.GetObjective().FindBestHull(new List() { character.CurrentHull });
}
if (retreatTarget != null)
{
@@ -238,7 +235,6 @@ namespace Barotrauma
{
if (Vector2.DistanceSquared(character.Position, Enemy.Position) <= meleeWeapon.Range * meleeWeapon.Range)
{
- character.SetInput(InputType.Shoot, false, true);
Weapon.Use(deltaTime, character);
}
}
@@ -268,7 +264,6 @@ namespace Barotrauma
}
if (target != null && target == Enemy)
{
- character.SetInput(InputType.Shoot, false, true);
Weapon.Use(deltaTime, character);
}
}
@@ -280,6 +275,7 @@ namespace Barotrauma
{
abandon = true;
SteeringManager.Reset();
+ //HumanAIController.ObjectiveManager.GetObjective().Priority = 100;
}
public override bool IsCompleted()
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
index 77e9c5901..2ac3ef0ce 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs
@@ -18,7 +18,7 @@ namespace Barotrauma
const float SearchHullInterval = 3.0f;
const float clearUnreachableInterval = 30;
- public readonly List unreachable = new List();
+ private List unreachable = new List();
private float currenthullSafety;
private float unreachableClearTimer;
@@ -60,16 +60,11 @@ namespace Barotrauma
else
{
divingGearObjective = null;
- // Reduce the timer so that we get a safe hull target faster.
- searchHullTimer = Math.Min(1, searchHullTimer);
+ // Reset the timer so that we get a safe hull target.
+ searchHullTimer = 0;
}
}
- if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD)
- {
- searchHullTimer = Math.Min(1, searchHullTimer);
- }
-
if (unreachableClearTimer > 0)
{
unreachableClearTimer -= deltaTime;
@@ -84,7 +79,7 @@ namespace Barotrauma
{
searchHullTimer -= deltaTime;
}
- else
+ else if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD)
{
var bestHull = FindBestHull();
if (bestHull != null && bestHull != currentHull)
@@ -193,17 +188,10 @@ namespace Barotrauma
float dist = Math.Abs(character.WorldPosition.X - hull.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - hull.WorldPosition.Y) * 2.0f;
float distanceFactor = MathHelper.Lerp(1, 0.9f, MathUtils.InverseLerp(0, 10000, dist));
hullSafety *= distanceFactor;
- //skip the hull if the safety is already less than the best hull
- //(no need to do the expensive pathfinding if we already know we're not going to choose this hull)
- if (hullSafety < bestValue) { continue; }
// Each unsafe node reduces the hull safety value.
// Ignore current hull, because otherwise the would block all paths from the current hull to the target hull.
var path = PathSteering.PathFinder.FindPath(character.SimPosition, hull.SimPosition);
- if (path.Unreachable)
- {
- unreachable.Add(hull);
- continue;
- }
+ if (path.Unreachable) { continue; }
int unsafeNodes = path.Nodes.Count(n => n.CurrentHull != character.CurrentHull && HumanAIController.UnsafeHulls.Contains(n.CurrentHull));
hullSafety /= 1 + unsafeNodes;
// If the target is not inside a friendly submarine, considerably reduce the hull safety.
@@ -231,6 +219,7 @@ namespace Barotrauma
}
}
}
+
// Huge preference for closer targets
float distance = Vector2.DistanceSquared(character.WorldPosition, hull.WorldPosition);
float distanceFactor = MathHelper.Lerp(1, 0.2f, MathUtils.InverseLerp(0, MathUtils.Pow(100000, 2), distance));
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs
index c03fbef43..865f18203 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveIdle.cs
@@ -26,9 +26,6 @@ namespace Barotrauma
private float standStillTimer;
private float walkDuration;
- private readonly List targetHulls = new List(20);
- private readonly List hullWeights = new List(20);
-
public AIObjectiveIdle(Character character) : base(character, "")
{
standStillTimer = Rand.Range(-10.0f, 10.0f);
@@ -109,7 +106,7 @@ namespace Barotrauma
if (isCurrentHullOK)
{
// Check that there is no unsafe or forbidden hulls on the way to the target
- // Only do this when the current hull is ok, because otherwise would block all paths from the current hull to the target hull.
+ // Only do this when the current hull is ok, because otherwise the would block all paths from the current hull to the target hull.
var path = PathSteering.PathFinder.FindPath(character.SimPosition, randomHull.SimPosition);
if (path.Unreachable ||
path.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull) || IsForbidden(n.CurrentHull)))
@@ -131,8 +128,8 @@ namespace Barotrauma
character.AIController.SelectTarget(currentTarget.AiTarget);
string errorMsg = null;
#if DEBUG
- bool isRoomNameFound = currentTarget.DisplayName != null;
- errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.DisplayName : currentTarget.ToString()) + ")";
+ bool isRoomNameFound = currentTarget.RoomName != null;
+ errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.RoomName : currentTarget.ToString()) + ")";
#endif
var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg);
PathSteering.SetPath(path);
@@ -233,9 +230,13 @@ namespace Barotrauma
}
}
+ private readonly List targetHulls = new List(20);
+ private readonly List hullWeights = new List(20);
+
private void FindTargetHulls()
{
bool isCurrentHullOK = !HumanAIController.UnsafeHulls.Contains(character.CurrentHull) && !IsForbidden(character.CurrentHull);
+
targetHulls.Clear();
hullWeights.Clear();
foreach (var hull in Hull.hullList)
@@ -265,6 +266,7 @@ namespace Barotrauma
hullWeights.Add(weight);
}
}
+
}
private bool IsForbidden(Hull hull)
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs
index 72004ee14..943d7110d 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/Objectives/AIObjectiveRescue.cs
@@ -83,7 +83,7 @@ namespace Barotrauma
if (character.SelectedCharacter == null)
{
character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget")
- .Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.DisplayName),
+ .Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.RoomName),
null, 1.0f,
"foundunconscioustarget" + targetCharacter.Name, 60.0f);
}
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs
index 418c8e68e..f1e3c96d7 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/HumanoidAnimController.cs
@@ -527,12 +527,7 @@ namespace Barotrauma
Limb leftLeg = GetLimb(LimbType.LeftLeg);
Limb rightLeg = GetLimb(LimbType.RightLeg);
-
- float limpAmount =
- character.CharacterHealth.GetAfflictionStrength("damage", leftFoot, true) +
- character.CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
- limpAmount = MathHelper.Clamp(limpAmount / 100.0f, 0.0f, 1.0f);
-
+
float walkCycleMultiplier = 1.0f;
if (Stairs != null)
{
@@ -561,17 +556,13 @@ namespace Barotrauma
float walkPosX = (float)Math.Cos(WalkPos);
float walkPosY = (float)Math.Sin(WalkPos);
-
+
+
Vector2 stepSize = StepSize.Value;
stepSize.X *= walkPosX;
- stepSize.Y *= walkPosY;
+ stepSize.Y *= walkPosY;
- float footMid = colliderPos.X;
- if (limpAmount > 0.0f)
- {
- //make the footpos oscillate when limping
- footMid += ((float)Math.Max(Math.Abs(walkPosX) * limpAmount, 0.0f) * 0.3f);
- }
+ float footMid = colliderPos.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
movement = overrideTargetMovement == Vector2.Zero ?
MathUtils.SmoothStep(movement, TargetMovement, movementLerp) :
@@ -585,7 +576,7 @@ namespace Barotrauma
movement.Y = 0.0f;
if (torso == null) { return; }
-
+
bool isNotRemote = true;
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer;
@@ -689,7 +680,7 @@ namespace Barotrauma
//make the character limp if the feet are damaged
float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true);
- footPos.X *= MathHelper.Lerp(1.0f, 0.75f, MathHelper.Clamp(footAfflictionStrength / 50.0f, 0.0f, 1.0f));
+ footPos *= MathHelper.Lerp(1.0f, 0.5f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
if (onSlope && Stairs == null)
{
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs
index 81677d50f..3f32ca43d 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Params/Ragdoll/RagdollParams.cs
@@ -84,7 +84,6 @@ namespace Barotrauma
var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default")
{
- //DebugConsole.NewMessage("[RagollParams] Using the default folder.");
folder = GetDefaultFolder(speciesName);
}
return folder;
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs
index 8eaca9be2..a1c3bc6a6 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs
@@ -692,7 +692,7 @@ namespace Barotrauma
ImpactProjSpecific(impact, f1.Body);
}
- public void SeverLimbJoint(LimbJoint limbJoint, bool playSound = true)
+ public void SeverLimbJoint(LimbJoint limbJoint)
{
if (!limbJoint.CanBeSevered || limbJoint.IsSevered)
{
@@ -721,7 +721,7 @@ namespace Barotrauma
}
}
- partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true);
+ partial void SeverLimbJointProjSpecific(LimbJoint limbJoint);
private void GetConnectedLimbs(List connectedLimbs, List checkedJoints, Limb limb)
{
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
index 9032c5e8c..1f500d2ac 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
@@ -1103,14 +1103,14 @@ namespace Barotrauma
if (leftFoot != null)
{
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true);
- speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
+ speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
}
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
if (rightFoot != null)
{
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
- speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
+ speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
}
return speed;
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs
index c492667e0..9a25fcd52 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Health/CharacterHealth.cs
@@ -231,8 +231,7 @@ namespace Barotrauma
: afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter)));
}
- private LimbHealth GetMatchingLimbHealth(Limb limb) => limbHealths[limb.HealthIndex];
- private LimbHealth GetMathingLimbHealth(Affliction affliction) => GetMatchingLimbHealth(Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb));
+ private LimbHealth GetMathingLimbHealth(Affliction affliction) => limbHealths[Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb).HealthIndex];
///
/// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb.
diff --git a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
index d52d022ce..3cdabed81 100644
--- a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
@@ -255,10 +255,8 @@ namespace Barotrauma
commands.Add(new Command("disablecrewai", "disablecrewai: Disable the AI of the NPCs in the crew.", (string[] args) =>
{
- HumanAIController.DisableCrewAI = true;
- NewMessage("Crew AI disabled", Color.Red);
- // This is probably not where it should be?
- //ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma.");
+ ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma.");
+ return;
/*if (GameMain.Server == null) return;
GameMain.Server.KarmaEnabled = !GameMain.Server.KarmaEnabled;*/
}));
@@ -266,19 +264,7 @@ namespace Barotrauma
commands.Add(new Command("enablecrewai", "enablecrewai: Enable the AI of the NPCs in the crew.", (string[] args) =>
{
HumanAIController.DisableCrewAI = false;
- NewMessage("Crew AI enabled", Color.Green);
- }, isCheat: true));
-
- commands.Add(new Command("disableenemyai", "disableenemyai: Disable the AI of the Enemy characters (monsters).", (string[] args) =>
- {
- EnemyAIController.DisableEnemyAI = true;
- NewMessage("Enemy AI disabled", Color.Red);
- }, isCheat: true));
-
- commands.Add(new Command("enableenemyai", "enableenemyai: Enable the AI of the Enemy characters (monsters).", (string[] args) =>
- {
- EnemyAIController.DisableEnemyAI = false;
- NewMessage("Enemy AI enabled", Color.Green);
+ NewMessage("Crew AI enabled", Color.White);
}, isCheat: true));
commands.Add(new Command("botcount", "botcount [x]: Set the number of bots in the crew in multiplayer.", null));
diff --git a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs
index c5db6fa09..e8b6d528a 100644
--- a/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs
+++ b/Barotrauma/BarotraumaShared/Source/Events/MonsterEvent.cs
@@ -209,7 +209,6 @@ namespace Barotrauma
//isActive = false;
- bool spawnReady = false;
if (spawnPending)
{
//wait until there are no submarines at the spawnpos
@@ -220,30 +219,24 @@ namespace Barotrauma
if (Vector2.DistanceSquared(submarine.WorldPosition, spawnPos) < minDist * minDist) return;
}
- spawnPending = false;
-
//+1 because Range returns an integer less than the max value
int amount = Rand.Range(minAmount, maxAmount + 1, Rand.RandSync.Server);
- monsters = new List();
- float offsetAmount = spawnPosType == Level.PositionType.MainPath ? 1000 : 100;
- for (int i = 0; i < amount; i++)
- {
- CoroutineManager.InvokeAfter(() =>
- {
- bool isClient = false;
-#if CLIENT
- isClient = GameMain.Client != null;
-#endif
- monsters.Add(Character.Create(characterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true));
- if (monsters.Count == amount)
- {
- spawnReady = true;
- }
- }, Rand.Range(0f, amount / 2, Rand.RandSync.Server));
- }
- }
+ monsters = new Character[amount];
- if (!spawnReady) { return; }
+ for (int i = 0; i < amount; i++)
+ {
+ bool isClient = false;
+#if CLIENT
+ isClient = GameMain.Client != null;
+#endif
+
+ monsters[i] = Character.Create(
+ characterFile, spawnPos + Rand.Vector(100.0f, Rand.RandSync.Server),
+ i.ToString(), null, isClient, true, true);
+ }
+
+ spawnPending = false;
+ }
Entity targetEntity = Submarine.FindClosest(GameMain.GameScreen.Cam.WorldViewCenter);
#if CLIENT
diff --git a/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs b/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs
index 9aa6cdada..541879e2d 100644
--- a/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs
+++ b/Barotrauma/BarotraumaShared/Source/Extensions/StringFormatter.cs
@@ -8,22 +8,6 @@ namespace Barotrauma
{
public static class StringFormatter
{
- public static string Replace(this string s, string replacement, Func predicate)
- {
- var newString = new string[s.Length];
- for (int i = 0; i < s.Length; i++)
- {
- char letter = s[i];
- string newLetter = letter.ToString();
- if (predicate(letter))
- {
- newLetter = replacement;
- }
- newString[i] = newLetter;
- }
- return new string(newString.SelectMany(str => str.ToCharArray()).ToArray());
- }
-
public static string Remove(this string s, Func predicate)
{
return new string(s.ToCharArray().Where(c => !predicate(c)).ToArray());
diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs
index 271dd6dc1..aa0aa8fda 100644
--- a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs
@@ -108,7 +108,7 @@ namespace Barotrauma
}
#if CLIENT
- new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.DisplayName));
+ new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.RoomName));
#endif
Dictionary availableContainers = new Dictionary();
diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs
index f081d1c0e..220e756cd 100644
--- a/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs
+++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs
@@ -13,7 +13,6 @@ namespace Barotrauma
public bool CheatsEnabled;
const int InitialMoney = 4700;
- public const int HullRepairCost = 500, ItemRepairCost = 500;
protected bool watchmenSpawned;
protected Character startWatchman, endWatchman;
@@ -21,8 +20,6 @@ namespace Barotrauma
//key = dialog flag, double = Timing.TotalTime when the line was last said
private Dictionary dialogLastSpoken = new Dictionary();
- public bool PurchasedHullRepairs, PurchasedItemRepairs;
-
protected Map map;
public Map Map
{
@@ -73,37 +70,6 @@ namespace Barotrauma
watchmenSpawned = false;
startWatchman = null;
endWatchman = null;
-
- if (PurchasedHullRepairs)
- {
- foreach (Structure wall in Structure.WallList)
- {
- if (wall.Submarine == null || wall.Submarine.IsOutpost) { continue; }
- if (wall.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(wall.Submarine))
- {
- for (int i = 0; i < wall.SectionCount; i++)
- {
- wall.AddDamage(i, -100000.0f);
- }
- }
- }
- PurchasedHullRepairs = false;
- }
- if (PurchasedItemRepairs)
- {
- foreach (Item item in Item.ItemList)
- {
- if (item.Submarine == null || item.Submarine.IsOutpost) { continue; }
- if (item.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(item.Submarine))
- {
- if (item.GetComponent() != null)
- {
- item.Condition = item.Health;
- }
- }
- }
- PurchasedItemRepairs = false;
- }
}
public override void Update(float deltaTime)
diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs
index c555982f3..53d1d1ead 100644
--- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs
+++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs
@@ -44,7 +44,6 @@ namespace Barotrauma
public bool ChromaticAberrationEnabled { get; set; }
public bool MuteOnFocusLost { get; set; }
- public bool UseDirectionalVoiceChat { get; set; }
public enum VoiceMode
{
@@ -150,9 +149,6 @@ namespace Barotrauma
public bool EnableMouseLook { get; set; } = true;
- public bool CrewMenuOpen { get; set; } = true;
- public bool ChatOpen { get; set; } = true;
-
private bool unsavedSettings;
public bool UnsavedSettings
{
@@ -830,8 +826,6 @@ namespace Barotrauma
SoundVolume = audioSettings.GetAttributeFloat("soundvolume", SoundVolume);
MusicVolume = audioSettings.GetAttributeFloat("musicvolume", MusicVolume);
VoiceChatVolume = audioSettings.GetAttributeFloat("voicechatvolume", VoiceChatVolume);
- MuteOnFocusLost = audioSettings.GetAttributeBool("muteonfocuslost", false);
- UseDirectionalVoiceChat = audioSettings.GetAttributeBool("usedirectionalvoicechat", true);
string voiceSettingStr = audioSettings.GetAttributeString("voicesetting", "Disabled");
VoiceCaptureDevice = audioSettings.GetAttributeString("voicecapturedevice", "");
NoiseGateThreshold = audioSettings.GetAttributeFloat("noisegatethreshold", -45);
@@ -850,9 +844,6 @@ namespace Barotrauma
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
- CrewMenuOpen = doc.Root.GetAttributeBool("crewmenuopen", CrewMenuOpen);
- ChatOpen = doc.Root.GetAttributeBool("chatopen", ChatOpen);
-
foreach (XElement subElement in doc.Root.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
@@ -1028,9 +1019,7 @@ namespace Barotrauma
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
new XAttribute("aimassistamount", aimAssistAmount),
- new XAttribute("enablemouselook", EnableMouseLook),
- new XAttribute("chatopen", ChatOpen),
- new XAttribute("crewmenuopen", CrewMenuOpen));
+ new XAttribute("enablemouselook", EnableMouseLook));
if (!ShowUserStatisticsPrompt)
{
@@ -1066,8 +1055,6 @@ namespace Barotrauma
audio.ReplaceAttributes(
new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume),
- new XAttribute("muteonfocuslost", MuteOnFocusLost),
- new XAttribute("usedirectionalvoicechat", UseDirectionalVoiceChat),
new XAttribute("voicesetting", VoiceSetting),
new XAttribute("voicecapturedevice", VoiceCaptureDevice ?? ""),
new XAttribute("noisegatethreshold", NoiseGateThreshold));
diff --git a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs
index 4b8d00255..c3800f565 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/CharacterInventory.cs
@@ -56,7 +56,7 @@ namespace Barotrauma
switch (SlotTypes[i])
{
//case InvSlotType.Head:
- //case InvSlotType.OuterClothes:
+ case InvSlotType.OuterClothes:
case InvSlotType.LeftHand:
case InvSlotType.RightHand:
hideEmptySlot[i] = true;
@@ -176,9 +176,6 @@ namespace Barotrauma
{
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
{
-#if CLIENT
- if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
-#endif
if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List { InvSlotType.Any }, true))
{
free = false;
@@ -198,9 +195,6 @@ namespace Barotrauma
{
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null)
{
-#if CLIENT
- if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
-#endif
bool removeFromOtherSlots = item.ParentInventory != this;
if (placedInSlot == -1 && inWrongSlot)
{
@@ -254,9 +248,7 @@ namespace Barotrauma
GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return false;
}
-#if CLIENT
- if (PersonalSlots.HasFlag(SlotTypes[index])) { hidePersonalSlots = false; }
-#endif
+
//there's already an item in the slot
if (Items[index] != null)
{
@@ -281,9 +273,7 @@ namespace Barotrauma
foreach (InvSlotType allowedSlot in allowedSlots)
{
if (!allowedSlot.HasFlag(SlotTypes[index])) continue;
-#if CLIENT
- if (PersonalSlots.HasFlag(allowedSlot)) { hidePersonalSlots = false; }
-#endif
+
for (int i = 0; i < capacity; i++)
{
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
index 973b7e655..f26db9c0c 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
@@ -221,64 +221,29 @@ namespace Barotrauma.Items.Components
{
if (item.Condition <= RepairThreshold) return true; //For repairing
- var idCard = character.Inventory.FindItemByIdentifier("idcard");
- hasValidIdCard = requiredItems.Any(ri => ri.Value.Any(r => r.MatchesItem(idCard)));
- Msg = requiredItems.None() || hasValidIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar";
- ParseMsg();
- if (addMessage)
- {
- msg = msg ?? (HasIntegratedButtons ? accessDeniedTxt : cannotOpenText);
- }
-
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked;
}
public override bool Pick(Character picker)
{
- if (item.Condition <= RepairThreshold) { return true; }
- if (requiredItems.None()) { return false; }
- if (HasRequiredItems(picker, false) && hasValidIdCard) { return false; }
- return base.Pick(picker);
+ return item.Condition <= RepairThreshold ? true : base.Pick(picker);
}
public override bool OnPicked(Character picker)
{
if (item.Condition <= RepairThreshold) return true; //repairs
- if (requiredItems.Any() && !hasValidIdCard)
- {
- ForceOpen(ActionType.OnPicked);
- }
- return false;
- }
- private void ForceOpen(ActionType actionType)
- {
SetState(PredictedState == null ? !isOpen : !PredictedState.Value, false, true); //crowbar function
#if CLIENT
- PlaySound(actionType, item.WorldPosition, picker);
+ PlaySound(ActionType.OnPicked, item.WorldPosition, picker);
#endif
}
public override bool Select(Character character)
{
//can only be selected if the item is broken
- if (item.Condition <= RepairThreshold) return true; //repairs
- bool hasRequiredItems = HasRequiredItems(character, false);
- if (requiredItems.None() || hasRequiredItems && hasValidIdCard)
- {
- float originalPickingTime = PickingTime;
- PickingTime = 0;
- ForceOpen(ActionType.OnUse);
- PickingTime = originalPickingTime;
- }
- else if (hasRequiredItems)
- {
-#if CLIENT
- GUI.AddMessage(accessDeniedTxt, Color.Red);
-#endif
- }
- return false;
+ return item.Condition <= RepairThreshold;
}
public override void Update(float deltaTime, Camera cam)
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ElectricalDischarger.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ElectricalDischarger.cs
index 001155e91..501491c11 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/ElectricalDischarger.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ElectricalDischarger.cs
@@ -34,20 +34,6 @@ namespace Barotrauma.Items.Components
}
}
- public override bool IsActive
- {
- get { return base.IsActive; }
- set
- {
- base.IsActive = value;
- if (!value)
- {
- nodes.Clear();
- charactersInRange.Clear();
- }
- }
- }
-
[Serialize(100.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 5000.0f)]
public float Range
{
@@ -140,19 +126,14 @@ namespace Barotrauma.Items.Components
}
else
{
+ nodes.Clear();
+ charactersInRange.Clear();
IsActive = false;
}
voltage = 0.0f;
}
- public override void UpdateBroken(float deltaTime, Camera cam)
- {
- base.UpdateBroken(deltaTime, cam);
- nodes.Clear();
- charactersInRange.Clear();
- }
-
private void Discharge()
{
ApplyStatusEffects(ActionType.OnUse, 1.0f);
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs
index ffb107200..2b38622e6 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs
@@ -58,6 +58,13 @@ namespace Barotrauma.Items.Components
set;
}
+ [Serialize(true, true)]
+ public bool Aimable
+ {
+ get;
+ set;
+ }
+
[Serialize(false, false)]
public bool ControlPose
{
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/LevelResource.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/LevelResource.cs
index d557dd19d..90a7a0665 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/LevelResource.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/LevelResource.cs
@@ -11,12 +11,6 @@ namespace Barotrauma.Items.Components
{
private float lastSentDeattachTimer;
- private PhysicsBody trigger;
-
- private Holdable holdable;
-
- private float deattachTimer;
-
[Serialize(1.0f, false)]
public float DeattachDuration
{
@@ -55,7 +49,13 @@ namespace Barotrauma.Items.Components
#endif
}
}
-
+
+ private PhysicsBody trigger;
+
+ private Holdable holdable;
+
+ private float deattachTimer;
+
public LevelResource(Item item, XElement element) : base(item, element)
{
IsActive = true;
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs
index 69aa69502..48f55e7df 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Pickable.cs
@@ -142,6 +142,8 @@ namespace Barotrauma.Items.Components
pickTimer / requiredTime,
Color.Red, Color.Green);
#endif
+
+ picker.AnimController.UpdateUseItem(true, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((pickTimer / 10.0f) % 0.1f));
picker.AnimController.UpdateUseItem(true, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((pickTimer / 10.0f) % 0.1f));
pickTimer += CoroutineManager.DeltaTime;
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs
index 38953e28a..08cef0492 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RepairTool.cs
@@ -322,7 +322,6 @@ namespace Barotrauma.Items.Components
// If the character is climbing, ignore the check, because we cannot aim while climbing.
if (VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak) < MathHelper.PiOver4)
{
- character.SetInput(InputType.Shoot, false, true);
Use(deltaTime, character);
}
else
@@ -338,11 +337,11 @@ namespace Barotrauma.Items.Components
sinTime = 0;
if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f))
{
- character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leaksfixed", 10.0f);
+ character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leaksfixed", 10.0f);
}
else
{
- character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leakfixed", 10.0f);
+ character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leakfixed", 10.0f);
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
index 50d9d7ce1..af7073f5c 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/ItemComponent.cs
@@ -190,7 +190,7 @@ namespace Barotrauma.Items.Components
get { return name; }
}
- [Editable, Serialize("", true, translationTextTag: "ItemMsg")]
+ [Editable, Serialize("", true)]
public string Msg
{
get;
@@ -538,6 +538,7 @@ namespace Barotrauma.Items.Components
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return 0.0f;
}
+ float average = skillSuccessSum / requiredSkills.Count;
float skillSuccessSum = 0.0f;
for (int i = 0; i < requiredSkills.Count; i++)
@@ -554,7 +555,7 @@ namespace Barotrauma.Items.Components
public virtual void FlipY(bool relativeToSub) { }
- public bool HasRequiredContainedItems(bool addMessage, string msg = null)
+ public bool HasRequiredContainedItems(bool addMessage)
{
if (!requiredItems.ContainsKey(RelatedItem.RelationType.Contained)) return true;
if (item.OwnInventory == null) return false;
@@ -581,52 +582,33 @@ namespace Barotrauma.Items.Components
{
if (!requiredItems.Any()) return true;
if (character.Inventory == null) return false;
- bool hasRequiredItems = false;
- bool canContinue = true;
+
if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped))
{
foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Equipped])
{
- canContinue = CheckItems(ri, character.SelectedItems);
- if (!canContinue) { break; }
- }
- }
- if (canContinue)
- {
- if (requiredItems.ContainsKey(RelatedItem.RelationType.Picked))
- {
- foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Picked])
+ if (character.SelectedItems.FirstOrDefault(it => it != null && it.Condition > 0.0f && ri.MatchesItem(it)) == null)
{
- if (!CheckItems(ri, character.Inventory.Items)) { break; }
+#if CLIENT
+ if (addMessage && !string.IsNullOrEmpty(ri.Msg)) GUI.AddMessage(ri.Msg, Color.Red);
+#endif
+ return false;
}
}
}
-
+ if (requiredItems.ContainsKey(RelatedItem.RelationType.Picked))
+ {
+ foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Picked])
+ {
+ if (character.Inventory.Items.FirstOrDefault(it => it != null && it.Condition > 0.0f && ri.MatchesItem(it)) == null)
+ {
#if CLIENT
if (!hasRequiredItems && addMessage && !string.IsNullOrEmpty(msg))
{
GUI.AddMessage(msg, Color.Red);
}
#endif
- return hasRequiredItems;
-
- bool CheckItems(RelatedItem relatedItem, IEnumerable- itemList)
- {
- bool Predicate(Item it) => it != null && it.Condition > 0.0f && relatedItem.MatchesItem(it);
- bool shouldBreak = false;
- if (relatedItem.IsOptional)
- {
- if (!hasRequiredItems)
- {
- hasRequiredItems = itemList.Any(Predicate);
- }
- }
- else
- {
- hasRequiredItems = itemList.Any(Predicate);
- if (!hasRequiredItems)
- {
- shouldBreak = true;
+ return false;
}
}
if (!hasRequiredItems)
@@ -638,6 +620,8 @@ namespace Barotrauma.Items.Components
}
return !shouldBreak;
}
+
+ return true;
}
public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null, Limb targetLimb = null, Character user = null)
@@ -782,7 +766,6 @@ namespace Barotrauma.Items.Components
{
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
newRequiredItem.Msg = prevRequiredItem.Msg;
- newRequiredItem.IsOptional = prevRequiredItem.IsOptional;
}
if (!requiredItems.ContainsKey(newRequiredItem.Type))
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
index 69a209f97..9c022b67b 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Machines/Controller.cs
@@ -343,7 +343,5 @@ namespace Barotrauma.Items.Components
limbPositions[i] = new LimbPos(limbPositions[i].limbType, flippedPos);
}
}
-
- partial void HideHUDs(bool value);
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs
index 48b98b710..1fd9ca9e6 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/CustomInterface.cs
@@ -8,19 +8,11 @@ namespace Barotrauma.Items.Components
{
partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable
{
- class CustomInterfaceElement : ISerializableEntity
+ class CustomInterfaceElement
{
public bool ContinuousSignal;
public bool State;
- public string Connection;
- [Serialize("", false, translationTextTag = "Label.")]
- public string Label { get; set; }
- [Serialize("1", false)]
- public string Signal { get; set; }
-
- public string Name => "CustomInterfaceElement";
-
- public Dictionary SerializableProperties { get; set; }
+ public string Label, Connection, Signal;
public List StatusEffects = new List();
@@ -41,7 +33,7 @@ namespace Barotrauma.Items.Components
}
private string[] labels;
- [Serialize("", true)]
+ [Serialize("", true), Editable()]
public string Labels
{
get { return string.Join(",", labels); }
@@ -56,7 +48,7 @@ namespace Barotrauma.Items.Components
}
}
private string[] signals;
- [Serialize("", true)]
+ [Serialize("", true), Editable()]
public string Signals
{
//use semicolon as a separator because comma may be needed in the signals (for color or vector values for example)
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs
index 1befb10a5..4bee0e644 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Wearable.cs
@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.Items.Components;
-using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -67,8 +66,6 @@ namespace Barotrauma
public LightComponent LightComponent { get; set; }
- public int Variant { get; set; }
-
private Gender _gender;
///
/// None = Any/Not Defined -> no effect.
@@ -115,65 +112,30 @@ namespace Barotrauma
///
/// Note: this constructor cannot initialize automatically, because the gender is unknown at this point. We only know it when the item is equipped.
///
- public WearableSprite(XElement subElement, Wearable wearable, int variant = 0)
+ public WearableSprite(XElement subElement, Wearable wearable)
{
Type = WearableType.Item;
WearableComponent = wearable;
- Variant = Math.Max(variant, 0);
SpritePath = ParseSpritePath(subElement.GetAttributeString("texture", string.Empty));
SourceElement = subElement;
}
private string ParseSpritePath(string texturePath) => texturePath.Contains("/") ? texturePath : $"{Path.GetDirectoryName(WearableComponent.Item.Prefab.ConfigFile)}/{texturePath}";
- public void RefreshPath()
- {
- if (Variant > 0)
- {
- // Restore the tag so that we can parse it again.
- ReplaceNumbersWith("[VARIANT]");
- }
- ParsePath(true);
- }
-
- private void ReplaceNumbersWith(string replacement)
- {
- var fileName = Path.GetFileName(SpritePath);
- var path = Path.GetDirectoryName(SpritePath);
- fileName = fileName.Replace(replacement, c => char.IsNumber(c));
- SpritePath = Path.Combine(path, fileName);
- }
-
- private void ParsePath(bool parseSpritePath)
- {
- if (_gender != Gender.None)
- {
- SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male");
- }
- SpritePath = SpritePath.Replace("[VARIANT]", Variant.ToString());
- if (!File.Exists(SpritePath))
- {
- // If the variant does not exist, parse the path so that it uses first variant.
- Variant = 1;
- ReplaceNumbersWith(Variant.ToString());
- }
- if (parseSpritePath)
- {
- Sprite.ParseTexturePath(file: SpritePath);
- }
- }
-
public bool IsInitialized { get; private set; }
public void Init(Gender gender = Gender.None)
{
if (IsInitialized) { return; }
_gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None;
- ParsePath(false);
+ if (_gender != Gender.None)
+ {
+ SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male");
+ }
if (Sprite != null)
{
Sprite.Remove();
}
- Sprite = new Sprite(SourceElement, file: SpritePath);
+ Sprite = new Sprite(SourceElement, "", SpritePath);
Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
HideLimb = SourceElement.GetAttributeBool("hidelimb", false);
HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false);
@@ -208,7 +170,7 @@ namespace Barotrauma.Items.Components
get { return damageModifiers; }
}
- public Wearable(Item item, XElement element) : base(item, element)
+ public Wearable (Item item, XElement element) : base(item, element)
{
this.item = item;
@@ -235,7 +197,7 @@ namespace Barotrauma.Items.Components
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
subElement.GetAttributeString("limb", "Head"), true);
- wearableSprites[i] = new WearableSprite(subElement, this, variant);
+ wearableSprites[i] = new WearableSprite(subElement, this);
foreach (XElement lightElement in subElement.Elements())
{
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
index 2a1b62490..b8e7c8019 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
@@ -801,12 +801,7 @@ namespace Barotrauma
if (findNewHull) FindHull();
}
- public void SetActiveSprite()
- {
- SetActiveSpriteProjSpecific();
- }
-
- partial void SetActiveSpriteProjSpecific();
+ partial void SetActiveSprite();
public override void Move(Vector2 amount)
{
@@ -1437,13 +1432,13 @@ namespace Barotrauma
selectHit = picker.IsKeyHit(ic.SelectKey);
#if CLIENT
- //if the cursor is on a UI component, disable interaction with the left mouse button
- //to prevent accidentally selecting items when clicking UI elements
- if (picker == Character.Controlled && GUI.MouseOn != null)
- {
- if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
- if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
- }
+ //if the cursor is on a UI component, disable interaction with the left mouse button
+ //to prevent accidentally selecting items when clicking UI elements
+ if (picker == Character.Controlled && GUI.MouseOn != null)
+ {
+ if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
+ if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
+ }
#endif
}
}
@@ -1613,7 +1608,6 @@ namespace Barotrauma
if (remove) { Spawner?.AddToRemoveQueue(this); }
}
- List texts = new List();
public List GetHUDTexts(Character character)
{
texts.Clear();
@@ -1623,13 +1617,6 @@ namespace Barotrauma
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
- Color color = Color.Gray;
- bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
- if (hasRequiredSkillsAndItems)
- {
- color = Color.Cyan;
- }
-
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
}
@@ -2067,8 +2054,6 @@ namespace Barotrauma
public virtual void Reset()
{
SerializableProperties = SerializableProperty.DeserializeProperties(this, Prefab.ConfigElement);
- Sprite.ReloadXML();
- SpriteDepth = Sprite.Depth;
components.ForEach(c => c.Reset());
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs
index 09bb91532..8109974be 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/ItemPrefab.cs
@@ -456,6 +456,12 @@ namespace Barotrauma
Tags = element.GetAttributeStringArray("Tags", new string[0], convertToLowerInvariant: true).ToHashSet();
}
+ Tags = new HashSet(element.GetAttributeStringArray("tags", new string[0], convertToLowerInvariant: true));
+ if (Tags.None())
+ {
+ Tags = new HashSet(element.GetAttributeStringArray("Tags", new string[0], convertToLowerInvariant: true));
+ }
+
if (element.Attribute("cargocontainername") != null)
{
DebugConsole.ThrowError("Error in item prefab \"" + name + "\" - cargo container should be configured using the item's identifier, not the name.");
@@ -615,25 +621,10 @@ namespace Barotrauma
string treatmentIdentifier = subElement.GetAttributeString("identifier", "").ToLowerInvariant();
- List matchingAfflictions = AfflictionPrefab.List.FindAll(a => a.Identifier == treatmentIdentifier || a.AfflictionType == treatmentIdentifier);
- if (matchingAfflictions.Count == 0)
+ var matchingAffliction = AfflictionPrefab.List.Find(a => a.Identifier == treatmentIdentifier);
+ if (matchingAffliction != null)
{
- DebugConsole.ThrowError("Error in item prefab \"" + Name + "\" - couldn't define as a treatment, no treatments with the identifier or type \"" + treatmentIdentifier + "\" were found.");
- continue;
- }
-
- float suitability = subElement.GetAttributeFloat("suitability", 0.0f);
- foreach (AfflictionPrefab matchingAffliction in matchingAfflictions)
- {
- if (matchingAffliction.TreatmentSuitability.ContainsKey(identifier))
- {
- matchingAffliction.TreatmentSuitability[identifier] =
- Math.Max(matchingAffliction.TreatmentSuitability[identifier], suitability);
- }
- else
- {
- matchingAffliction.TreatmentSuitability.Add(identifier, suitability);
- }
+ matchingAffliction.TreatmentSuitability.Add(identifier, subElement.GetAttributeFloat("suitability", 0.0f));
}
break;
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
index bbbfc6705..c2f13f46d 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
@@ -16,8 +16,6 @@ namespace Barotrauma
Container
}
- public bool IsOptional { get; set; }
-
private string[] identifiers;
private string[] excludedIdentifiers;
@@ -140,8 +138,7 @@ namespace Barotrauma
{
element.Add(
new XAttribute("identifiers", JoinedIdentifiers),
- new XAttribute("type", type.ToString()),
- new XAttribute("optional", IsOptional));
+ new XAttribute("type", type.ToString()));
if (excludedIdentifiers.Length > 0)
{
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs
index 4c3b594d6..798b322b6 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs
@@ -63,6 +63,13 @@ namespace Barotrauma
return "Hull";
}
}
+
+ [Editable, Serialize("", true)]
+ public string RoomName
+ {
+ get;
+ set;
+ }
public string DisplayName
{
@@ -810,17 +817,17 @@ namespace Barotrauma
}
if (roomItems.Contains("reactor"))
- return "RoomName.ReactorRoom";
+ return TextManager.Get("ReactorRoom");
else if (roomItems.Contains("engine"))
- return "RoomName.EngineRoom";
+ return TextManager.Get("EngineRoom");
else if (roomItems.Contains("steering") && roomItems.Contains("sonar"))
- return "RoomName.CommandRoom";
+ return TextManager.Get("CommandRoom");
else if (roomItems.Contains("ballast"))
- return "RoomName.Ballast";
+ return TextManager.Get("Ballast");
if (ConnectedGaps.Any(g => !g.IsRoomToRoom && g.ConnectedDoor != null))
{
- return "RoomName.Airlock";
+ return TextManager.Get("Airlock");
}
Rectangle subRect = Submarine.CalculateDimensions();
@@ -840,7 +847,7 @@ namespace Barotrauma
else
roomPos |= Alignment.Right;
- return "RoomName.Sub" + roomPos.ToString();
+ return TextManager.Get("Sub" + roomPos.ToString());
}
public static Hull Load(XElement element, Submarine submarine)
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
index 3f0889562..4ae545ab1 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
@@ -144,20 +144,6 @@ namespace Barotrauma
get { return spriteColor; }
set { spriteColor = value; }
}
-
- [Editable, Serialize(false, true)]
- public bool UseDropShadow
- {
- get;
- private set;
- }
-
- [Serialize("0,0", true), Editable(ToolTip = "The position of the drop shadow relative to the structure. If set to zero, the shadow is positioned automatically so that it points towards the sub's center of mass.")]
- public Vector2 DropShadowOffset
- {
- get;
- private set;
- }
public override Rectangle Rect
{
@@ -313,8 +299,8 @@ namespace Barotrauma
}
}
- // Only add ai targets automatically to submarine/outpost walls
- if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null)
+ // Only add ai targets automatically to walls
+ if (aiTarget == null && HasBody && Tags.Contains("wall"))
{
aiTarget = new AITarget(this);
}
@@ -1153,13 +1139,6 @@ namespace Barotrauma
if (element.GetAttributeBool("flippedx", false)) s.FlipX(false);
if (element.GetAttributeBool("flippedy", false)) s.FlipY(false);
SerializableProperty.DeserializeProperties(s, element);
-
- //structures with a body drop a shadow by default
- if (element.Attribute("usedropshadow") == null)
- {
- s.UseDropShadow = prefab.Body;
- }
-
return s;
}
diff --git a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs
index eb101d98b..06d9576f9 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/StructurePrefab.cs
@@ -194,14 +194,7 @@ namespace Barotrauma
break;
case "backgroundsprite":
sp.BackgroundSprite = new Sprite(subElement, lazyLoad: true);
- if (subElement.Attribute("sourcerect") == null && sp.sprite != null)
- {
- sp.BackgroundSprite.SourceRect = sp.sprite.SourceRect;
- sp.BackgroundSprite.size = sp.sprite.size;
- sp.BackgroundSprite.size.X *= sp.sprite.SourceRect.Width;
- sp.BackgroundSprite.size.Y *= sp.sprite.SourceRect.Height;
- sp.BackgroundSprite.RelativeOrigin = subElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
- }
+
if (subElement.GetAttributeBool("fliphorizontal", false))
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
if (subElement.GetAttributeBool("flipvertical", false))
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
index a0fd7465d..ee3c527fc 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
@@ -417,10 +417,7 @@ namespace Barotrauma
if (me.Submarine != this) { continue; }
if (me is Item item)
{
- if (item.GetComponent() != null)
- {
- item.Indestructible = true;
- }
+ item.Indestructible = true;
foreach (ItemComponent ic in item.Components)
{
if (ic is ConnectionPanel connectionPanel)
diff --git a/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs b/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs
index 85523d2fa..0f8f53bd7 100644
--- a/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs
+++ b/Barotrauma/BarotraumaShared/Source/Networking/OrderChatMessage.cs
@@ -20,7 +20,7 @@ namespace Barotrauma.Networking
public OrderChatMessage(Order order, string orderOption, Entity targetEntity, Character targetCharacter, Character sender)
: this(order, orderOption,
- order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption),
+ order.GetChatMessage(targetCharacter?.Name, sender?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == sender, orderOption: orderOption),
targetEntity, targetCharacter, sender)
{
}
diff --git a/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs b/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs
index e7a5815ad..72bec4a5e 100644
--- a/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs
+++ b/Barotrauma/BarotraumaShared/Source/Screens/GameScreen.cs
@@ -44,7 +44,6 @@ namespace Barotrauma
base.Deselect();
#if CLIENT
- GameMain.Config.SaveNewPlayerConfig();
GameMain.SoundManager.SetCategoryMuffle("default", false);
GUI.ClearMessages();
#endif
diff --git a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
index 064b5d1e2..0921bd91d 100644
--- a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
+++ b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
@@ -87,6 +87,7 @@ namespace Barotrauma
public string FullPath { get; private set; }
+
public override string ToString()
{
return FilePath + ": " + sourceRect;
@@ -106,7 +107,25 @@ namespace Barotrauma
{
this.lazyLoad = lazyLoad;
SourceElement = element;
- if (!ParseTexturePath(path, file)) { return; }
+ if (file == "")
+ {
+ file = SourceElement.GetAttributeString("texture", "");
+ }
+ if (file == "")
+ {
+ DebugConsole.ThrowError("Sprite " + SourceElement + " doesn't have a texture specified!");
+ return;
+ }
+ if (!string.IsNullOrEmpty(path))
+ {
+ LoadTexture(ref sourceVector, ref shouldReturn, preMultipliedAlpha);
+ }
+ FilePath = path + file;
+ if (!string.IsNullOrEmpty(FilePath))
+ {
+ FullPath = Path.GetFullPath(FilePath);
+ }
+
Name = SourceElement.GetAttributeString("name", null);
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true);
@@ -250,29 +269,6 @@ namespace Barotrauma
ID = GetID(SourceElement);
}
}
-
- public bool ParseTexturePath(string path = "", string file = "")
- {
- if (file == "")
- {
- file = SourceElement.GetAttributeString("texture", "");
- }
- if (file == "")
- {
- DebugConsole.ThrowError("Sprite " + SourceElement + " doesn't have a texture specified!");
- return false;
- }
- if (!string.IsNullOrEmpty(path))
- {
- if (!path.EndsWith("/")) path += "/";
- }
- FilePath = path + file;
- if (!string.IsNullOrEmpty(FilePath))
- {
- FullPath = Path.GetFullPath(FilePath);
- }
- return true;
- }
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/TextManager.cs b/Barotrauma/BarotraumaShared/Source/TextManager.cs
index 52df9ac7b..1d5d074c8 100644
--- a/Barotrauma/BarotraumaShared/Source/TextManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/TextManager.cs
@@ -252,28 +252,6 @@ namespace Barotrauma
return null;
}
- public static List> GetAllTagTextPairs()
- {
- if (!textPacks.ContainsKey(Language))
- {
- DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English...");
- Language = "English";
- if (!textPacks.ContainsKey(Language))
- {
- throw new Exception("No text packs available in English!");
- }
- }
-
- List> allText = new List>();
-
- foreach (TextPack textPack in textPacks[Language])
- {
- allText.AddRange(textPack.GetAllTagTextPairs());
- }
-
- return allText;
- }
-
public static string ReplaceGenderPronouns(string text, Gender gender)
{
if (gender == Gender.Male)
diff --git a/Barotrauma/BarotraumaShared/Source/TextPack.cs b/Barotrauma/BarotraumaShared/Source/TextPack.cs
index f1c2c3a76..91366d043 100644
--- a/Barotrauma/BarotraumaShared/Source/TextPack.cs
+++ b/Barotrauma/BarotraumaShared/Source/TextPack.cs
@@ -37,7 +37,6 @@ namespace Barotrauma
text = text.Replace("&", "&");
text = text.Replace("<", "<");
text = text.Replace(">", ">");
- text = text.Replace(""", "\"");
infoList.Add(text);
}
}
@@ -63,20 +62,6 @@ namespace Barotrauma
return textList;
}
- public List> GetAllTagTextPairs()
- {
- var pairs = new List>();
- foreach (KeyValuePair> kvp in texts)
- {
- foreach (string line in kvp.Value)
- {
- pairs.Add(new KeyValuePair(kvp.Key, line));
- }
- }
-
- return pairs;
- }
-
#if DEBUG
public void CheckForDuplicates(int index)
{
diff --git a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub
index 3d7eb5493..94e47fc22 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub and b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub
index a0fb19aae..ee8d2d85a 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub and b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub
index 6b354c42d..511746b0c 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub and b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub
index c57bc40b9..8b43c675f 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub and b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Orca.sub b/Barotrauma/BarotraumaShared/Submarines/Orca.sub
index 4d734b45c..c20881e5c 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Orca.sub and b/Barotrauma/BarotraumaShared/Submarines/Orca.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Remora.sub b/Barotrauma/BarotraumaShared/Submarines/Remora.sub
index 0e552098c..2383ef1a9 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Remora.sub and b/Barotrauma/BarotraumaShared/Submarines/Remora.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub
index f546031bf..16b9dd843 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub and b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub
index 72e8f6ace..23c9548e5 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub and b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub
index 14f516834..1113c5152 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub and b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Venture.sub b/Barotrauma/BarotraumaShared/Submarines/Venture.sub
index e6df2ee70..d72b72043 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Venture.sub and b/Barotrauma/BarotraumaShared/Submarines/Venture.sub differ