diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs index 3133e2f32..a13119ae9 100644 --- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs +++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs @@ -1107,6 +1107,195 @@ namespace Barotrauma })); + 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(); + + 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"; + List lines = new List(); + foreach (MapEntityPrefab me in MapEntityPrefab.List) + { + lines.Add("" + me.Name + ""); + lines.Add("" + me.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? diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs index cd8a792c0..0f7e20c57 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs @@ -69,6 +69,9 @@ namespace Barotrauma public static ScalableFont Font => Style?.Font; public static ScalableFont SmallFont => Style?.SmallFont; public static ScalableFont LargeFont => Style?.LargeFont; + public static ScalableFont VideoTitleFont => Style?.VideoTitleFont; + public static ScalableFont ObjectiveTitleFont => Style?.ObjectiveTitleFont; + public static ScalableFont ObjectiveNameFont => Style?.ObjectiveNameFont; public static UISprite UIGlow => Style.UIGlow; diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs index c7f947b4e..2b3317682 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs @@ -12,6 +12,9 @@ namespace Barotrauma public ScalableFont Font { get; private set; } public ScalableFont SmallFont { get; private set; } public ScalableFont LargeFont { get; private set; } + public ScalableFont VideoTitleFont { get; private set; } + public ScalableFont ObjectiveTitleFont { get; private set; } + public ScalableFont ObjectiveNameFont { get; private set; } public Sprite CursorSprite { get; private set; } @@ -48,6 +51,15 @@ namespace Barotrauma case "largefont": LargeFont = new ScalableFont(subElement, graphicsDevice); break; + case "objectivetitle": + ObjectiveTitleFont = new ScalableFont(subElement, graphicsDevice); + break; + case "objectivename": + ObjectiveNameFont = new ScalableFont(subElement, graphicsDevice); + break; + case "videotitle": + VideoTitleFont = new ScalableFont(subElement, graphicsDevice); + break; case "cursor": CursorSprite = new Sprite(subElement); break; diff --git a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs index 4fd431367..524f5bf75 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/VideoPlayer.cs @@ -14,8 +14,7 @@ namespace Barotrauma private List preloadedVideos; private GUIFrame background, videoFrame, textFrame; - private GUITextBlock title; - private GUITextBlock infoText; + private GUITextBlock title, textContent, objectiveTitle, objectiveText; private GUICustomComponent videoView; private Color backgroundColor = new Color(0f, 0f, 0f, 1f); @@ -26,12 +25,14 @@ namespace Barotrauma public bool IsPlaying() { return isPlaying; - /*if (currentVideo == null) return false; - return currentVideo.IsPlaying;*/ } private readonly Point defaultResolution = new Point(520, 300); private readonly int borderSize = 20; + private readonly Point buttonSize = new Point(160, 50); + private readonly int titleHeight = 30; + private readonly int objectiveFrameHeight = 60; + private readonly int textHeight = 25; private class PreloadedContent { @@ -87,8 +88,13 @@ namespace Barotrauma videoView = new GUICustomComponent(new RectTransform(new Point(width, height), videoFrame.RectTransform, Anchor.Center), (spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); }); - title = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.LargeFont, textAlignment: Alignment.Center); - infoText = new GUITextBlock(new RectTransform(new Vector2(1f, .8f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.LargeFont, textAlignment: Alignment.Center); + title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopLeft) { AbsoluteOffset = new Point(-225, 10) }, string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left); + + textContent = new GUITextBlock(new RectTransform(new Vector2(1f, .8f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, borderSize / 2 + titleHeight) }, string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft); + + objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight, textColor: Color.White); + objectiveTitle.Text = TextManager.Get("NewObjective"); + objectiveText = new GUITextBlock(new RectTransform(new Point(textFrame.Rect.Width, textHeight), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight); preloadedVideos = new List(); } @@ -157,12 +163,7 @@ namespace Barotrauma background.AddToGUIUpdateList(); } - public void LoadTutorialContent(string contentPath, VideoSettings videoSettings, TextSettings textSettings, string contentId, bool startPlayback, bool hasButton, Action callback = null) - { - LoadContent(contentPath, videoSettings, textSettings, contentId, startPlayback, hasButton, callback); - } - - public void LoadContent(string contentPath, VideoSettings videoSettings, TextSettings textSettings, string contentId, bool startPlayback, bool hasButton, Action callback = null) + public void LoadContentWithObjective(string contentPath, VideoSettings videoSettings, TextSettings textSettings, string contentId, bool startPlayback, string objective, Action callback = null) { callbackOnStop = callback; @@ -173,6 +174,8 @@ namespace Barotrauma return; } + ResetFrameSizes(); + if (currentVideo != null) { currentVideo.Dispose(); @@ -205,34 +208,120 @@ namespace Barotrauma currentVideo = CreateVideo(contentPath, resolution); } - videoFrame.RectTransform.NonScaledSize = resolution + new Point(borderSize, borderSize); - videoView.RectTransform.NonScaledSize = resolution; + videoFrame.RectTransform.NonScaledSize += resolution + new Point(borderSize, borderSize); + videoView.RectTransform.NonScaledSize += resolution; title.Text = TextManager.Get(contentId); - title.RectTransform.NonScaledSize = new Point(resolution.X, 30); + title.RectTransform.NonScaledSize += new Point(textSettings.Width, titleHeight); if (textSettings.Text != string.Empty) { - textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.LargeFont); - int height = textSettings.Text.Split('\n').Length * 25; - textFrame.RectTransform.NonScaledSize = new Point(textSettings.Width + borderSize, height + borderSize); - infoText.RectTransform.NonScaledSize = new Point(textSettings.Width, height); + textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.Font); + int wrappedHeight = textSettings.Text.Split('\n').Length * textHeight; + textFrame.RectTransform.NonScaledSize += new Point(textSettings.Width + borderSize, wrappedHeight + borderSize + buttonSize.Y + titleHeight); + textContent.RectTransform.NonScaledSize = new Point(textSettings.Width, wrappedHeight); } - infoText.Text = textSettings.Text; + textContent.Text = textSettings.Text; - if (hasButton) + objectiveTitle.RectTransform.AbsoluteOffset = new Point(0, textContent.RectTransform.Rect.Height + (int)(textHeight * 1.5f)); + objectiveText.RectTransform.AbsoluteOffset = new Point(0, textContent.RectTransform.Rect.Height + objectiveTitle.Rect.Height + textHeight * 2); + + textFrame.RectTransform.NonScaledSize += new Point(0, objectiveFrameHeight); + objectiveText.RectTransform.NonScaledSize += new Point(textFrame.Rect.Width, textHeight); + objectiveText.Text = objective; + + var okButton = new GUIButton(new RectTransform(buttonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(20, 20) }, + TextManager.Get("OK")) { - var okButton = new GUIButton(new RectTransform(new Point(160, 50), textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(20, 20) }, - TextManager.Get("OK")) - { - OnClicked = DisposeVideo - }; - } + OnClicked = DisposeVideo + }; if (startPlayback) Play(); } + public void LoadContent(string contentPath, VideoSettings videoSettings, TextSettings textSettings, string contentId, bool startPlayback, Action callback = null) + { + callbackOnStop = callback; + + if (!File.Exists(contentPath)) + { + DebugConsole.ThrowError("No video found at: " + contentPath); + DisposeVideo(null, null); + return; + } + + ResetFrameSizes(); + + if (currentVideo != null) + { + currentVideo.Dispose(); + currentVideo = null; + } + + PreloadedContent preloaded = null; + Point resolution = new Point(0, 0); + + if (preloadedVideos != null && preloadedVideos.Count > 0) + { + preloaded = preloadedVideos.Find(s => s.ContentName == contentId); + + if (preloaded != null) + { + currentVideo = preloaded.Video; + resolution = preloaded.Resolution; + } + } + + if (currentVideo == null) // No preloaded video found + { + resolution = new Point(videoSettings.Width, videoSettings.Height); + + if (resolution.X == 0 || resolution.Y == 0) + { + resolution = defaultResolution; + } + + currentVideo = CreateVideo(contentPath, resolution); + } + + videoFrame.RectTransform.NonScaledSize += resolution + new Point(borderSize, borderSize); + videoView.RectTransform.NonScaledSize += resolution; + + title.Text = TextManager.Get(contentId); + title.RectTransform.NonScaledSize += new Point(textSettings.Width, titleHeight); + + if (textSettings.Text != string.Empty) + { + textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.Font); + int wrappedHeight = textSettings.Text.Split('\n').Length * textHeight; + textFrame.RectTransform.NonScaledSize += new Point(textSettings.Width + borderSize, wrappedHeight + borderSize + buttonSize.Y + titleHeight); + textContent.RectTransform.NonScaledSize = new Point(textSettings.Width, wrappedHeight); + } + + textContent.Text = textSettings.Text; + + var okButton = new GUIButton(new RectTransform(buttonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(20, 20) }, + TextManager.Get("OK")) + { + OnClicked = DisposeVideo + }; + + if (startPlayback) Play(); + } + + private void ResetFrameSizes() + { + videoFrame.RectTransform.NonScaledSize = Point.Zero; + videoView.RectTransform.NonScaledSize = Point.Zero; + + title.RectTransform.NonScaledSize = Point.Zero; + textFrame.RectTransform.NonScaledSize = Point.Zero; + textContent.RectTransform.NonScaledSize = Point.Zero; + + objectiveText.RectTransform.NonScaledSize = Point.Zero; + } + private Video CreateVideo(string contentPath, Point resolution) { Video video = null; diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs index 1e9749ca7..73244bfff 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/Tutorials/ContextualTutorial.cs @@ -49,7 +49,7 @@ namespace Barotrauma.Tutorials public TutorialSegment(XElement config) { Id = config.GetAttributeString("id", "Missing ID"); - Objective = config.GetAttributeString("objective", string.Empty); + Objective = TextManager.Get(config.GetAttributeString("objective", string.Empty), true); Enum.TryParse(config.GetAttributeString("contenttype", "None"), true, out ContentType); IsTriggered = config.GetAttributeBool("istriggered", false); @@ -480,7 +480,7 @@ namespace Barotrauma.Tutorials string fileName = activeSegment.VideoContent.GetAttributeString("file", ""); if (fileName != "") { - videoPlayer.LoadTutorialContent(playableContentPath + fileName, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.TextContent, args), activeSegment.Id, true, true, CurrentSegmentStopCallback); + videoPlayer.LoadContentWithObjective(playableContentPath + fileName, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.TextContent, args), activeSegment.Id, true, activeSegment.Objective, CurrentSegmentStopCallback); } else { diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs index e68b6dc0b..50beedef1 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs @@ -1380,6 +1380,9 @@ namespace Barotrauma.Networking case ServerNetObject.CLIENT_LIST: ReadClientList(inc); break; + case ServerNetObject.CLIENT_LIST: + ReadClientList(inc); + break; case ServerNetObject.CHAT_MESSAGE: ChatMessage.ClientRead(inc); break; diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems index e8ccac6d1..64848e14f 100644 --- a/Barotrauma/BarotraumaShared/SharedContent.projitems +++ b/Barotrauma/BarotraumaShared/SharedContent.projitems @@ -342,6 +342,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs index d42a50b1f..db83c6407 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/EnemyAIController.cs @@ -1210,6 +1210,19 @@ namespace Barotrauma return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize); } + #endregion + + protected override void OnStateChanged(AIState from, AIState to) + { + latchOntoAI?.DeattachFromBody(); + Character.AnimController.ReleaseStuckLimbs(); + } + + private int GetMinimumPassableHoleCount() + { + return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize); + } + private bool CanPassThroughHole(Structure wall, int sectionIndex) { int requiredHoleCount = GetMinimumPassableHoleCount(); diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs index 78b507ef2..04ec45762 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Animation/Ragdoll.cs @@ -1045,6 +1045,8 @@ namespace Barotrauma CheckValidity(); + CheckValidity(); + UpdateNetPlayerPosition(deltaTime); CheckDistFromCollider(); UpdateCollisionCategories(); @@ -1359,16 +1361,6 @@ namespace Barotrauma UpdateProjSpecific(deltaTime); } - private void CheckValidity() - { - CheckValidity(Collider); - foreach (Limb limb in limbs) - { - if (limb.body == null || !limb.body.Enabled) { continue; } - CheckValidity(limb.body); - } - } - partial void UpdateProjSpecific(float deltaTime); partial void Splash(Limb limb, Hull limbHull); diff --git a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs index f09f7d374..14afb813e 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Explosion.cs @@ -198,6 +198,9 @@ namespace Barotrauma Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false); bool underWater = hull == null || explosionPos.Y < hull.Surface; + Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false); + bool underWater = hull == null || explosionPos.Y < hull.Surface; + explosionPos = ConvertUnits.ToSimUnits(explosionPos); Dictionary distFactors = new Dictionary(); diff --git a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs index 65aeac3f0..ea2a08faf 100644 --- a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs @@ -96,6 +96,18 @@ namespace Barotrauma private set; } + public Vector2 LinearVelocity + { + get; + private set; + } + + public float AngularVelocity + { + get; + private set; + } + public readonly float Timestamp; public readonly UInt16 ID;