(2e0e45e1f) Updated: Localization

This commit is contained in:
Joonas Rikkonen
2019-05-20 20:41:52 +03:00
parent 5e77ed6507
commit b71adc7589
48 changed files with 389 additions and 587 deletions
+1 -58
View File
@@ -274,63 +274,6 @@
<None Include="System.Xml.Linq.dll"> <None Include="System.Xml.Linq.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="libvlc.so.5">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\access\libfilesystem_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\audio_filter\libaudio_format_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\audio_filter\libugly_resampler_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\audio_output\libamem_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\codec\libavcodec_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\codec\libva.so.1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\demux\libmp4_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\packetizer\libpacketizer_mpeg4audio_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\packetizer\libpacketizer_mpeg4video_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\packetizer\libpacketizer_mpegvideo_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\video_chroma\librv32_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\video_chroma\libswscale_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vlc\plugins\video_output\libvmem_plugin.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="libvlc.so.5.6.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="libvlccore.la">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="libvlccore.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="libvlccore.so.9">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="libvlccore.so.9.0.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<ItemGroup> <ItemGroup>
@@ -361,6 +304,6 @@
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" /> <Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity> </GetAssemblyIdentity>
<Exec Command="echo v%(CurrentAssembly.Version) &gt; $(TargetDir)Version.txt"></Exec> <Exec Command="echo v%(CurrentAssembly.Version) > $(TargetDir)Version.txt"></Exec>
</Target> </Target>
</Project> </Project>
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.2")] [assembly: AssemblyVersion("0.9.0.1")]
[assembly: AssemblyFileVersion("0.9.0.2")] [assembly: AssemblyFileVersion("0.9.0.1")]
@@ -504,7 +504,7 @@ namespace Barotrauma
foreach (Character c in CharacterList) foreach (Character c in CharacterList)
{ {
if (!CanInteractWith(c, checkVisibility: false)) continue; if (!CanInteractWith(c)) continue;
float dist = Vector2.DistanceSquared(mouseSimPos, c.SimPosition); float dist = Vector2.DistanceSquared(mouseSimPos, c.SimPosition);
if (dist < maxDist * maxDist && (closestCharacter == null || dist < closestDist)) if (dist < maxDist * maxDist && (closestCharacter == null || dist < closestDist))
@@ -121,8 +121,8 @@ namespace Barotrauma
if (value == null && if (value == null &&
Character.Controlled?.SelectedCharacter?.CharacterHealth != null && Character.Controlled?.SelectedCharacter?.CharacterHealth != null &&
Character.Controlled.SelectedCharacter.CharacterHealth == prevOpenHealthWindow/* && Character.Controlled.SelectedCharacter.CharacterHealth == prevOpenHealthWindow &&
!Character.Controlled.SelectedCharacter.CanInventoryBeAccessed*/) !Character.Controlled.SelectedCharacter.CanInventoryBeAccessed)
{ {
Character.Controlled.DeselectCharacter(); Character.Controlled.DeselectCharacter();
} }
@@ -188,9 +188,14 @@ namespace Barotrauma
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft)); afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight); 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)
{
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.47f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) }); recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) });
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight) 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.02f, 0.0f) }, style: null)
{ {
@@ -198,17 +203,6 @@ namespace Barotrauma
}; };
dropItemArea.RectTransform.NonScaledSize = new Point(dropItemArea.Rect.Width); dropItemArea.RectTransform.NonScaledSize = new Point(dropItemArea.Rect.Width);
lowSkillIndicator = new GUIImage(new RectTransform(new Vector2(0.5f, 0.22f), paddedInfoFrame.RectTransform, Anchor.TopRight, Pivot.Center) { RelativeOffset = new Vector2(0.16f, 0.12f) },
style: "GUINotificationButton")
{
ToolTip = TextManager.Get("lowmedicalskillwarning"),
Color = Color.OrangeRed,
HoverColor = Color.Orange,
PressedColor = Color.Orange,
Visible = false
};
lowSkillIndicator.RectTransform.MaxSize = new Point(lowSkillIndicator.Rect.Height);
string[] healthCircleStyles = new string[] { "HealthCircleInner", "HealthCircleMid", "HealthCircleOuter" }; string[] healthCircleStyles = new string[] { "HealthCircleInner", "HealthCircleMid", "HealthCircleOuter" };
foreach (string healthCircleStyle in healthCircleStyles) foreach (string healthCircleStyle in healthCircleStyles)
{ {
@@ -663,8 +657,7 @@ namespace Barotrauma
openHealthWindow = null; openHealthWindow = null;
} }
lowSkillIndicator.Visible = Character.Controlled != null && Character.Controlled.GetSkillLevel("medical") < 50.0f; lowSkillIndicator.Visible = Timing.TotalTime % 1.0f < 0.8f && Character.Controlled != null && Character.Controlled.GetSkillLevel("medical") < 50.0f;
lowSkillIndicator.Color = new Color(lowSkillIndicator.Color, MathHelper.Lerp(0.1f, 1.0f, (float)(Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 2.0f));
float rotationSpeed = 0.25f; float rotationSpeed = 0.25f;
int i = 0; int i = 0;
@@ -1060,10 +1053,10 @@ namespace Barotrauma
var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter), var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
style: "InnerGlow") style: "InnerGlow")
{ {
UserData = item UserData = item,
CanBeFocused = false
}; };
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen); itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
itemSlot.SelectedColor = itemSlot.HoverColor = itemSlot.Color;
Sprite itemSprite = item.InventoryIcon ?? item.sprite; Sprite itemSprite = item.InventoryIcon ?? item.sprite;
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor; Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
@@ -1075,7 +1068,7 @@ namespace Barotrauma
HoverColor = itemColor, HoverColor = itemColor,
SelectedColor = itemColor SelectedColor = itemColor
}; };
itemSlot.ToolTip = item.Name; itemSlot.ToolTip = item.Name + "\n" + item.Description;
} }
afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) => afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
@@ -1439,22 +1439,23 @@ namespace Barotrauma
{ {
PauseMenu = new GUIFrame(new RectTransform(Vector2.One, Canvas), style: null, color: Color.Black * 0.5f); PauseMenu = new GUIFrame(new RectTransform(Vector2.One, Canvas), style: null, color: Color.Black * 0.5f);
var pauseMenuInner = new GUIFrame(new RectTransform(new Vector2(0.13f, 0.35f), PauseMenu.RectTransform, Anchor.Center) { MinSize = new Point(200, 300) }); var pauseMenuInner = new GUIFrame(new RectTransform(new Vector2(0.13f, 0.3f), PauseMenu.RectTransform, Anchor.Center) { MinSize = new Point(200, 300) });
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.85f, 0.8f), pauseMenuInner.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) }) var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.85f, 0.85f), pauseMenuInner.RectTransform, Anchor.Center))
{ {
Stretch = true, Stretch = true,
RelativeSpacing = 0.05f RelativeSpacing = 0.05f
}; };
var button = new GUIButton(new RectTransform(new Vector2(0.12f, 0.12f), buttonContainer.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(-0.05f, -0.13f) }, var button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("bugreportbutton"), style: "GUIButtonLarge")
"", style: "GUIBugButton")
{ {
IgnoreLayoutGroups = true, Color = Color.Red,
ToolTip = TextManager.Get("bugreportbutton"), HoverColor = Color.DarkRed,
PressedColor = Color.White,
OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; } OnClicked = (btn, userdata) => { GameMain.Instance.ShowBugReporter(); return true; }
}; };
button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge") button = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), buttonContainer.RectTransform), TextManager.Get("PauseMenuResume"), style: "GUIButtonLarge")
{ {
OnClicked = TogglePauseMenu OnClicked = TogglePauseMenu
@@ -16,7 +16,7 @@ namespace Barotrauma
private RenderTarget2D renderTarget; private RenderTarget2D renderTarget;
private Sprite languageSelectionCursor; private Sprite languageSelectionCursor;
private ScalableFont languageSelectionFont, languageSelectionFontCJK; private ScalableFont languageSelectionFont;
private Video currSplashScreen; private Video currSplashScreen;
private DateTime videoStartTime; private DateTime videoStartTime;
@@ -220,13 +220,7 @@ namespace Barotrauma
{ {
if (languageSelectionFont == null) if (languageSelectionFont == null)
{ {
languageSelectionFont = new ScalableFont("Content/Fonts/NotoSans/NotoSans-Bold.ttf", languageSelectionFont = new ScalableFont("Content/Fonts/BebasNeue-Regular.otf", (uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice);
(uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice);
}
if (languageSelectionFontCJK == null)
{
languageSelectionFontCJK = new ScalableFont("Content/Fonts/NotoSans/NotoSansCJKsc-Bold.otf",
(uint)(30 * (GameMain.GraphicsHeight / 1080.0f)), graphicsDevice, dynamicLoading: true);
} }
if (languageSelectionCursor == null) if (languageSelectionCursor == null)
{ {
@@ -237,15 +231,13 @@ namespace Barotrauma
Vector2 textSpacing = new Vector2(0.0f, (GameMain.GraphicsHeight * 0.5f) / TextManager.AvailableLanguages.Count()); Vector2 textSpacing = new Vector2(0.0f, (GameMain.GraphicsHeight * 0.5f) / TextManager.AvailableLanguages.Count());
foreach (string language in TextManager.AvailableLanguages) foreach (string language in TextManager.AvailableLanguages)
{ {
string localizedLanguageName = TextManager.GetTranslatedLanguageName(language); Vector2 textSize = languageSelectionFont.MeasureString(language);
var font = TextManager.IsCJK(localizedLanguageName) ? languageSelectionFontCJK : languageSelectionFont;
Vector2 textSize = font.MeasureString(localizedLanguageName);
bool hover = bool hover =
Math.Abs(PlayerInput.MousePosition.X - textPos.X) < textSize.X / 2 && Math.Abs(PlayerInput.MousePosition.X - textPos.X) < textSize.X / 2 &&
Math.Abs(PlayerInput.MousePosition.Y - textPos.Y) < textSpacing.Y / 2; Math.Abs(PlayerInput.MousePosition.Y - textPos.Y) < textSpacing.Y / 2;
font.DrawString(spriteBatch, localizedLanguageName, textPos - textSize / 2, //TODO: display the name of the language in the target language?
languageSelectionFont.DrawString(spriteBatch, language, textPos - textSize / 2,
hover ? Color.White : Color.White * 0.6f); hover ? Color.White : Color.White * 0.6f);
if (hover && PlayerInput.LeftButtonClicked()) if (hover && PlayerInput.LeftButtonClicked())
{ {
@@ -255,15 +247,12 @@ namespace Barotrauma
GameMain.Config.SetDefaultBindings(legacy: false); GameMain.Config.SetDefaultBindings(legacy: false);
GameMain.Config.CheckBindings(useDefaults: true); GameMain.Config.CheckBindings(useDefaults: true);
WaitForLanguageSelection = false; WaitForLanguageSelection = false;
languageSelectionFont?.Dispose(); languageSelectionFont = null;
languageSelectionFontCJK?.Dispose(); languageSelectionFontCJK = null;
break;
} }
textPos += textSpacing; textPos += textSpacing;
} }
languageSelectionCursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, scale: 0.5f); languageSelectionCursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
} }
private void DrawSplashScreen(SpriteBatch spriteBatch, GraphicsDevice graphics) private void DrawSplashScreen(SpriteBatch spriteBatch, GraphicsDevice graphics)
+20 -4
View File
@@ -287,7 +287,13 @@ namespace Barotrauma
{ {
if (GameSettings.ShowUserStatisticsPrompt) if (GameSettings.ShowUserStatisticsPrompt)
{ {
if (TextManager.ContainsTag("statisticspromptheader") && TextManager.ContainsTag("statisticsprompttext")) //TODO: translate
var userStatsPrompt = new GUIMessageBox(
"Do you want to help us make Barotrauma better?",
"Do you allow Barotrauma to send usage statistics and error reports to the developers? The data is anonymous, " +
"does not contain any personal information and is only used to help us diagnose issues and improve Barotrauma.",
new string[] { "Yes", "No" });
userStatsPrompt.Buttons[0].OnClicked += (btn, userdata) =>
{ {
var userStatsPrompt = new GUIMessageBox( var userStatsPrompt = new GUIMessageBox(
TextManager.Get("statisticspromptheader"), TextManager.Get("statisticspromptheader"),
@@ -318,7 +324,17 @@ namespace Barotrauma
GameSettings.SendUserStatistics = true; GameSettings.SendUserStatistics = true;
GameAnalyticsManager.Init(); GameAnalyticsManager.Init();
Config.SaveNewPlayerConfig(); Config.SaveNewPlayerConfig();
} return true;
};
userStatsPrompt.Buttons[0].OnClicked += userStatsPrompt.Close;
userStatsPrompt.Buttons[1].OnClicked += (btn, userdata) =>
{
GameSettings.ShowUserStatisticsPrompt = false;
GameSettings.SendUserStatistics = false;
Config.SaveNewPlayerConfig();
return true;
};
userStatsPrompt.Buttons[1].OnClicked += userStatsPrompt.Close;
} }
else if (GameSettings.SendUserStatistics) else if (GameSettings.SendUserStatistics)
{ {
@@ -383,10 +399,10 @@ namespace Barotrauma
DebugConsole.Log("Selected content packages: " + string.Join(", ", SelectedPackages.Select(cp => cp.Name))); DebugConsole.Log("Selected content packages: " + string.Join(", ", SelectedPackages.Select(cp => cp.Name)));
} }
/*#if DEBUG #if DEBUG
GameSettings.ShowUserStatisticsPrompt = false; GameSettings.ShowUserStatisticsPrompt = false;
GameSettings.SendUserStatistics = false; GameSettings.SendUserStatistics = false;
#endif*/ #endif
InitUserStats(); InitUserStats();
@@ -132,7 +132,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
} }
// Room 2 // Room 2
@@ -142,7 +142,7 @@ namespace Barotrauma.Tutorials
// Room 3 // Room 3
do { yield return null; } while (!captain_medicObjectiveSensor.MotionDetected); do { yield return null; } while (!captain_medicObjectiveSensor.MotionDetected);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(captain_medic.Info.DisplayName, TextManager.Get("Captain.Radio.Medic"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(captain_medic.Info.DisplayName, TextManager.Get("Captain.Radio.Medic"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true; GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true;
GameMain.GameSession.CrewManager.AddCharacter(captain_medic); GameMain.GameSession.CrewManager.AddCharacter(captain_medic);
TriggerTutorialSegment(0); TriggerTutorialSegment(0);
@@ -157,7 +157,7 @@ namespace Barotrauma.Tutorials
// Submarine // Submarine
do { yield return null; } while (!captain_enteredSubmarineSensor.MotionDetected); do { yield return null; } while (!captain_enteredSubmarineSensor.MotionDetected);
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f);
captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = true; captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = true;
TriggerTutorialSegment(1); TriggerTutorialSegment(1);
GameMain.GameSession.CrewManager.AddCharacter(captain_mechanic); GameMain.GameSession.CrewManager.AddCharacter(captain_mechanic);
@@ -169,7 +169,7 @@ namespace Barotrauma.Tutorials
} }
while (!HasOrder(captain_mechanic, "repairsystems", "jobspecific")); while (!HasOrder(captain_mechanic, "repairsystems", "jobspecific"));
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
TriggerTutorialSegment(2); TriggerTutorialSegment(2);
GameMain.GameSession.CrewManager.AddCharacter(captain_security); GameMain.GameSession.CrewManager.AddCharacter(captain_security);
do do
@@ -180,7 +180,7 @@ namespace Barotrauma.Tutorials
} }
while (!HasOrder(captain_security, "operateweapons", "fireatwill")); while (!HasOrder(captain_security, "operateweapons", "fireatwill"));
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
yield return new WaitForSeconds(4f, false); yield return new WaitForSeconds(4f);
TriggerTutorialSegment(3); TriggerTutorialSegment(3);
GameMain.GameSession.CrewManager.AddCharacter(captain_engineer); GameMain.GameSession.CrewManager.AddCharacter(captain_engineer);
do do
@@ -202,10 +202,10 @@ namespace Barotrauma.Tutorials
do do
{ {
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f); //captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} while (Submarine.MainSub.DockedTo.Count > 0); } while (Submarine.MainSub.DockedTo.Count > 0);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
TriggerTutorialSegment(5); // Navigate to destination TriggerTutorialSegment(5); // Navigate to destination
do do
{ {
@@ -221,15 +221,15 @@ namespace Barotrauma.Tutorials
} while (!captain_sonar.IsActive); } while (!captain_sonar.IsActive);
do { yield return null; } while (Vector2.Distance(Submarine.MainSub.WorldPosition, Level.Loaded.EndPosition) > 4000f); do { yield return null; } while (Vector2.Distance(Submarine.MainSub.WorldPosition, Level.Loaded.EndPosition) > 4000f);
RemoveCompletedObjective(segments[5]); RemoveCompletedObjective(segments[5]);
yield return new WaitForSeconds(4f, false); yield return new WaitForSeconds(4f);
TriggerTutorialSegment(6); // Docking TriggerTutorialSegment(6); // Docking
do do
{ {
//captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f); //captain_navConsoleCustomInterface.HighlightElement(0, uiHighlightColor, duration: 1.0f, pulsateAmount: 0.0f);
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0); } while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0);
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Captain.Radio.Complete").Replace("[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Captain.Radio.Complete").Replace("[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null);
SetHighlight(captain_navConsole.Item, false); SetHighlight(captain_navConsole.Item, false);
SetHighlight(captain_sonar.Item, false); SetHighlight(captain_sonar.Item, false);
@@ -21,7 +21,7 @@ namespace Barotrauma.Tutorials
private ItemContainer doctor_suppliesCabinet; private ItemContainer doctor_suppliesCabinet;
private ItemContainer doctor_medBayCabinet; private ItemContainer doctor_medBayCabinet;
private Character patient1, patient2; private Character patient1, patient2;
private List<Character> subPatients; private List<Character> subPatients = new List<Character>();
private Hull startRoom; private Hull startRoom;
private Hull medBay; private Hull medBay;
@@ -38,8 +38,7 @@ namespace Barotrauma.Tutorials
private LightComponent tutorial_submarineDoorLight; private LightComponent tutorial_submarineDoorLight;
// Variables // Variables
private Sprite doctor_firstAidIcon; private Color doctor_iconColor = new Color(178, 118, 139);
private Color doctor_firstAidIconColor;
public DoctorTutorial(XElement element) : base(element) public DoctorTutorial(XElement element) : base(element)
{ {
@@ -48,11 +47,6 @@ namespace Barotrauma.Tutorials
{ {
base.Start(); base.Start();
var firstAidOrder = Order.PrefabList.Find(order => order.AITag == "requestfirstaid");
doctor_firstAidIcon = firstAidOrder.SymbolSprite;
doctor_firstAidIconColor = firstAidOrder.Color;
subPatients = new List<Character>();
radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker"); radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker");
doctor = Character.Controlled; doctor = Character.Controlled;
@@ -125,7 +119,7 @@ namespace Barotrauma.Tutorials
// explosions and radio messages ------------------------------------------------------ // explosions and radio messages ------------------------------------------------------
yield return new WaitForSeconds(3.0f, false); yield return new WaitForSeconds(3.0f);
//SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition); //SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition);
//// Room 1 //// Room 1
@@ -147,7 +141,7 @@ namespace Barotrauma.Tutorials
explosion.Explode(Character.Controlled.WorldPosition - Vector2.UnitX * 25, null); explosion.Explode(Character.Controlled.WorldPosition - Vector2.UnitX * 25, null);
SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition - Vector2.UnitX * 25); SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition - Vector2.UnitX * 25);
yield return new WaitForSeconds(0.5f, false); yield return new WaitForSeconds(0.5f);
doctor.DamageLimb( doctor.DamageLimb(
Character.Controlled.WorldPosition, Character.Controlled.WorldPosition,
@@ -160,15 +154,15 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
} }
yield return new WaitForSeconds(3.0f, false); yield return new WaitForSeconds(3.0f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.KnockedDown"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.KnockedDown"), ChatMessageType.Radio, null);
// first tutorial segment, get medical supplies ------------------------------------------------------ // first tutorial segment, get medical supplies ------------------------------------------------------
yield return new WaitForSeconds(1.5f, false); yield return new WaitForSeconds(1.5f);
SetHighlight(doctor_suppliesCabinet.Item, true); SetHighlight(doctor_suppliesCabinet.Item, true);
/*while (doctor.CurrentHull != doctor_suppliesCabinet.Item.CurrentHull) /*while (doctor.CurrentHull != doctor_suppliesCabinet.Item.CurrentHull)
@@ -196,24 +190,22 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (doctor.Inventory.FindItemByIdentifier("antidama1") == null); // Wait until looted } while (doctor.Inventory.FindItemByIdentifier("antidama1") == null); // Wait until looted
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
SetHighlight(doctor_suppliesCabinet.Item, false); SetHighlight(doctor_suppliesCabinet.Item, false);
RemoveCompletedObjective(segments[0]); RemoveCompletedObjective(segments[0]);
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
// 2nd tutorial segment, treat self ------------------------------------------------------------------------- // 2nd tutorial segment, treat self -------------------------------------------------------------------------
TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Health)); // Open health interface TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Health)); // Open health interface
while (CharacterHealth.OpenHealthWindow == null) while (CharacterHealth.OpenHealthWindow == null)
{ {
doctor.CharacterHealth.HealthBarPulsateTimer = 1.0f; yield return new WaitForSeconds(1.0f);
yield return null;
} }
yield return null;
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
yield return new WaitForSeconds(1.0f, false);
TriggerTutorialSegment(2); //Treat self TriggerTutorialSegment(2); //Treat self
while (doctor.CharacterHealth.GetAfflictionStrength("damage") > 0.01f) while (doctor.CharacterHealth.GetAfflictionStrength("damage") > 0.01f)
{ {
@@ -234,22 +226,23 @@ namespace Barotrauma.Tutorials
while (CharacterHealth.OpenHealthWindow != null) while (CharacterHealth.OpenHealthWindow != null)
{ {
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} }
// treat patient -------------------------------------------------------------------------------------------- // treat patient --------------------------------------------------------------------------------------------
//patient 1 requests first aid //patient 1 requests first aid
patient1.CanSpeak = true;
var newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient1.CurrentHull, null, orderGiver: patient1); var newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient1.CurrentHull, null, orderGiver: patient1);
doctor.AddActiveObjectiveEntity(patient1, doctor_firstAidIcon, doctor_firstAidIconColor); GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
//GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime); patient1.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(patient1.Name, newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order, null); patient1.AIController.Enabled = true;
while (doctor.CurrentHull != patient1.CurrentHull) while (doctor.CurrentHull != patient1.CurrentHull)
{ {
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} }
yield return new WaitForSeconds(0.0f, false); yield return new WaitForSeconds(0.0f);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurns"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurns"), ChatMessageType.Radio, null);
GameMain.GameSession.CrewManager.AllowCharacterSwitch = false; GameMain.GameSession.CrewManager.AllowCharacterSwitch = false;
@@ -257,9 +250,7 @@ namespace Barotrauma.Tutorials
GameMain.GameSession.CrewManager.AddCharacter(patient1); GameMain.GameSession.CrewManager.AddCharacter(patient1);
GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true; GameMain.GameSession.CrewManager.ToggleCrewAreaOpen = true;
yield return new WaitForSeconds(3.0f, false); yield return new WaitForSeconds(3.0f);
patient1.AIController.Enabled = true;
doctor.RemoveActiveObjectiveEntity(patient1);
TriggerTutorialSegment(3); // Get the patient to medbay TriggerTutorialSegment(3); // Get the patient to medbay
while (patient1.CurrentOrder == null || patient1.CurrentOrder.AITag != "follow") while (patient1.CurrentOrder == null || patient1.CurrentOrder.AITag != "follow")
@@ -272,13 +263,13 @@ namespace Barotrauma.Tutorials
while (patient1.CurrentHull != medBay) while (patient1.CurrentHull != medBay)
{ {
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} }
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
SetHighlight(doctor_medBayCabinet.Item, true); SetHighlight(doctor_medBayCabinet.Item, true);
SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, true); SetDoorAccess(doctor_thirdDoor, doctor_thirdDoorLight, true);
yield return new WaitForSeconds(2.0f, false); yield return new WaitForSeconds(2.0f);
TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Health)); // treat burns TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Health)); // treat burns
@@ -318,19 +309,17 @@ namespace Barotrauma.Tutorials
} }
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
SetHighlight(patient1, false); SetHighlight(patient1, false);
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurnsHealed"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.AssistantBurnsHealed"), ChatMessageType.Radio, null);
// treat unconscious patient ------------------------------------------------------ // treat unconscious patient ------------------------------------------------------
//patient calls for help //patient calls for help
//patient2.CanSpeak = true; patient2.CanSpeak = true;
yield return new WaitForSeconds(2.0f, false);
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient2.CurrentHull, null, orderGiver: patient2); newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), patient2.CurrentHull, null, orderGiver: patient2);
doctor.AddActiveObjectiveEntity(patient2, doctor_firstAidIcon, doctor_firstAidIconColor); GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
//GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime); patient2.Speak(newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(patient2.Name, newOrder.GetChatMessage("", patient1.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order, null);
patient2.AIController.Enabled = true; patient2.AIController.Enabled = true;
patient2.Oxygen = -50; patient2.Oxygen = -50;
CoroutineManager.StartCoroutine(KeepPatientAlive(patient2), "KeepPatient2Alive"); CoroutineManager.StartCoroutine(KeepPatientAlive(patient2), "KeepPatient2Alive");
@@ -340,7 +329,7 @@ namespace Barotrauma.Tutorials
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f);
}*/ }*/
do { yield return null; } while (!tutorial_upperFinalDoor.IsOpen); do { yield return null; } while (!tutorial_upperFinalDoor.IsOpen);
yield return new WaitForSeconds(2.0f, false); yield return new WaitForSeconds(2.0f);
TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Health)); // perform CPR TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Health)); // perform CPR
SetHighlight(patient2, true); SetHighlight(patient2, true);
@@ -355,24 +344,23 @@ namespace Barotrauma.Tutorials
} }
RemoveCompletedObjective(segments[5]); RemoveCompletedObjective(segments[5]);
SetHighlight(patient2, false); SetHighlight(patient2, false);
doctor.RemoveActiveObjectiveEntity(patient2);
CoroutineManager.StopCoroutines("KeepPatient2Alive"); CoroutineManager.StopCoroutines("KeepPatient2Alive");
SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true); SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true);
while (doctor.Submarine != Submarine.MainSub) while (doctor.Submarine != Submarine.MainSub)
{ {
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} }
yield return new WaitForSeconds(5.0f, false); yield return new WaitForSeconds(5.0f);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.EnteredSub"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Doctor.Radio.EnteredSub"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(3.0f, false); yield return new WaitForSeconds(3.0f);
TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Health)); // give treatment to anyone in need TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Health)); // give treatment to anyone in need
foreach (var patient in subPatients) foreach (var patient in subPatients)
{ {
//patient.CanSpeak = true; patient.CanSpeak = true;
patient.AIController.Enabled = true; patient.AIController.Enabled = true;
SetHighlight(patient, true); SetHighlight(patient, true);
} }
@@ -381,8 +369,7 @@ namespace Barotrauma.Tutorials
double subEnterTime = Timing.TotalTime; double subEnterTime = Timing.TotalTime;
bool[] patientCalledHelp = new bool[] { false, false, false }; bool[] patientCalledHelp = new bool[] { false, false, false, false, false, false };
while (subPatients.Any(p => p.Vitality < p.MaxVitality * 0.9f && !p.IsDead)) while (subPatients.Any(p => p.Vitality < p.MaxVitality * 0.9f && !p.IsDead))
{ {
for (int i = 0; i < subPatients.Count; i++) for (int i = 0; i < subPatients.Count; i++)
@@ -391,26 +378,32 @@ namespace Barotrauma.Tutorials
//(within 1 minute intervals of entering the sub) //(within 1 minute intervals of entering the sub)
if (!patientCalledHelp[i] && Timing.TotalTime > subEnterTime + 60 * (i + 1)) if (!patientCalledHelp[i] && Timing.TotalTime > subEnterTime + 60 * (i + 1))
{ {
doctor.AddActiveObjectiveEntity(subPatients[i], doctor_firstAidIcon, doctor_firstAidIconColor);
newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), subPatients[i].CurrentHull, null, orderGiver: subPatients[i]); newOrder = new Order(Order.PrefabList.Find(o => o.AITag == "requestfirstaid"), subPatients[i].CurrentHull, null, orderGiver: subPatients[i]);
GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime);
string message = newOrder.GetChatMessage("", subPatients[i].CurrentHull?.DisplayName, givingOrderToSelf: false); string message = newOrder.GetChatMessage("", subPatients[i].CurrentHull?.DisplayName, givingOrderToSelf: false);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(subPatients[i].Name, message, ChatMessageType.Order, null); if (subPatients[i].CanSpeak)
{
subPatients[i].Speak(message, ChatMessageType.Order);
}
else
{
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, message, ChatMessageType.Radio, null);
}
patientCalledHelp[i] = true; patientCalledHelp[i] = true;
} }
if (subPatients[i].ExternalHighlight && subPatients[i].Vitality >= subPatients[i].MaxVitality * 0.9f) if (subPatients[i].ExternalHighlight && subPatients[i].Vitality >= subPatients[i].MaxVitality * 0.9f)
{ {
doctor.RemoveActiveObjectiveEntity(subPatients[i]);
SetHighlight(subPatients[i], false); SetHighlight(subPatients[i], false);
} }
} }
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
} }
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
foreach (var patient in subPatients) foreach (var patient in subPatients)
{ {
SetHighlight(patient, false); SetHighlight(patient, false);
doctor.RemoveActiveObjectiveEntity(patient);
} }
// END TUTORIAL // END TUTORIAL
@@ -213,7 +213,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
} }
//// Remove //// Remove
@@ -231,7 +231,7 @@ namespace Barotrauma.Tutorials
// Room 2 // Room 2
do { yield return null; } while (!engineer_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!engineer_equipmentObjectiveSensor.MotionDetected);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Equipment"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(0.5f, false); yield return new WaitForSeconds(0.5f);
TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment
bool firstSlotRemoved = false; bool firstSlotRemoved = false;
bool secondSlotRemoved = false; bool secondSlotRemoved = false;
@@ -280,7 +280,7 @@ namespace Barotrauma.Tutorials
// Room 3 // Room 3
do { yield return null; } while (!IsSelectedItem(engineer_reactor.Item)); do { yield return null; } while (!IsSelectedItem(engineer_reactor.Item));
yield return new WaitForSeconds(0.5f, false); yield return new WaitForSeconds(0.5f);
TriggerTutorialSegment(1); TriggerTutorialSegment(1);
do do
{ {
@@ -326,7 +326,7 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (!reactorOperatedProperly); } while (!reactorOperatedProperly);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.ReactorStable"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.ReactorStable"), ChatMessageType.Radio, null);
do do
{ {
@@ -343,7 +343,7 @@ namespace Barotrauma.Tutorials
float wait = 1.5f; float wait = 1.5f;
do do
{ {
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
wait -= 0.1f; wait -= 0.1f;
engineer_reactor.AutoTempSlider.BarScrollValue = 0.0f; engineer_reactor.AutoTempSlider.BarScrollValue = 0.0f;
} while (wait > 0.0f); } while (wait > 0.0f);
@@ -356,24 +356,9 @@ namespace Barotrauma.Tutorials
// Room 4 // Room 4
do { yield return null; } while (!engineer_secondDoor.IsOpen); do { yield return null; } while (!engineer_secondDoor.IsOpen);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
Repairable repairableJunctionBoxComponent = engineer_brokenJunctionBox.GetComponent<Repairable>();
TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Select)); // Repair the junction box TriggerTutorialSegment(2, GameMain.Config.KeyBind(InputType.Select)); // Repair the junction box
do do { yield return null; } while (!engineer_brokenJunctionBox.IsFullCondition); // Wait until repaired
{
if (!engineer.HasEquippedItem("screwdriver"))
{
HighlightInventorySlot(engineer.Inventory, "screwdriver", highlightColor, .5f, .5f, 0f);
}
else if (IsSelectedItem(engineer_brokenJunctionBox) && repairableJunctionBoxComponent.CurrentFixer == null)
{
if (repairableJunctionBoxComponent.RepairButton.Frame.FlashTimer <= 0)
{
repairableJunctionBoxComponent.RepairButton.Frame.Flash();
}
}
yield return null;
} while (!engineer_brokenJunctionBox.IsFullCondition); // Wait until repaired
SetHighlight(engineer_brokenJunctionBox, false); SetHighlight(engineer_brokenJunctionBox, false);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, true); SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, true);
@@ -385,7 +370,7 @@ namespace Barotrauma.Tutorials
// Room 5 // Room 5
do { yield return null; } while (!engineer_thirdDoor.IsOpen); do { yield return null; } while (!engineer_thirdDoor.IsOpen);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.FaultyWiring"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.FaultyWiring"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Use), GameMain.Config.KeyBind(InputType.Deselect)); // Connect the junction boxes TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Use), GameMain.Config.KeyBind(InputType.Deselect)); // Connect the junction boxes
do { CheckGhostWires(); HandleJunctionBoxWiringHighlights(); yield return null; } while (engineer_workingPump.Voltage < engineer_workingPump.MinVoltage); // Wait until connected all the way to the pump do { CheckGhostWires(); HandleJunctionBoxWiringHighlights(); yield return null; } while (engineer_workingPump.Voltage < engineer_workingPump.MinVoltage); // Wait until connected all the way to the pump
CheckGhostWires(); CheckGhostWires();
@@ -402,7 +387,7 @@ namespace Barotrauma.Tutorials
// Submarine // Submarine
do { yield return null; } while (!tutorial_enteredSubmarineSensor.MotionDetected); do { yield return null; } while (!tutorial_enteredSubmarineSensor.MotionDetected);
GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Submarine"), ChatMessageType.Radio, null); GameMain.GameSession.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Engineer.Radio.Submarine"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
TriggerTutorialSegment(4); // Repair junction box TriggerTutorialSegment(4); // Repair junction box
while (ContentRunning) yield return null; while (ContentRunning) yield return null;
SetHighlight(engineer_submarineJunctionBox_1, true); SetHighlight(engineer_submarineJunctionBox_1, true);
@@ -458,7 +443,7 @@ namespace Barotrauma.Tutorials
tutorial_oxygenGenerator.PowerConsumption = reactorLoads[i]; tutorial_oxygenGenerator.PowerConsumption = reactorLoads[i];
while (timer > 0) while (timer > 0)
{ {
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
if (IsReactorPoweredUp(engineer_reactor)) if (IsReactorPoweredUp(engineer_reactor))
{ {
timer -= 0.1f; timer -= 0.1f;
@@ -230,25 +230,25 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
} }
yield return new WaitForSeconds(2.5f, false); yield return new WaitForSeconds(2.5f);
mechanic_fabricator.RemoveFabricationRecipes(new List<string>() { "extinguisher", "wrench", "weldingtool", "weldingfuel", "divingmask", "railgunshell", "nuclearshell", "uex", "harpoongun" }); mechanic_fabricator.RemoveFabricationRecipes(new List<string>() { "extinguisher", "wrench", "weldingtool", "weldingfuel", "divingmask", "railgunshell", "nuclearshell", "uex", "harpoongun" });
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.WakeUp"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.WakeUp"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(2.5f, false); yield return new WaitForSeconds(2.5f);
TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Left), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Right), GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Select)); // Open door objective TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Left), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Right), GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Select)); // Open door objective
yield return new WaitForSeconds(0.0f, false); yield return new WaitForSeconds(0.0f);
SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, true); SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, true);
SetHighlight(mechanic_firstDoor.Item, true); SetHighlight(mechanic_firstDoor.Item, true);
do { yield return null; } while (!mechanic_firstDoor.IsOpen); do { yield return null; } while (!mechanic_firstDoor.IsOpen);
SetHighlight(mechanic_firstDoor.Item, false); SetHighlight(mechanic_firstDoor.Item, false);
yield return new WaitForSeconds(1.5f, false); yield return new WaitForSeconds(1.5f);
RemoveCompletedObjective(segments[0]); RemoveCompletedObjective(segments[0]);
// Room 2 // Room 2
yield return new WaitForSeconds(0.0f, false); yield return new WaitForSeconds(0.0f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Equipment"), ChatMessageType.Radio, null);
do { yield return null; } while (!mechanic_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!mechanic_equipmentObjectiveSensor.MotionDetected);
TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Equipment & inventory objective TriggerTutorialSegment(1, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Equipment & inventory objective
@@ -287,7 +287,7 @@ namespace Barotrauma.Tutorials
yield return null; yield return null;
} while (mechanic.Inventory.FindItemByIdentifier("divingmask") == null || mechanic.Inventory.FindItemByIdentifier("weldingtool") == null || mechanic.Inventory.FindItemByIdentifier("wrench") == null); // Wait until looted } while (mechanic.Inventory.FindItemByIdentifier("divingmask") == null || mechanic.Inventory.FindItemByIdentifier("weldingtool") == null || mechanic.Inventory.FindItemByIdentifier("wrench") == null); // Wait until looted
SetHighlight(mechanic_equipmentCabinet.Item, false); SetHighlight(mechanic_equipmentCabinet.Item, false);
yield return new WaitForSeconds(1.5f, false); yield return new WaitForSeconds(1.5f);
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Breach"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Breach"), ChatMessageType.Radio, null);
@@ -312,13 +312,13 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (WallHasDamagedSections(mechanic_brokenWall_1)); // Highlight until repaired do { yield return null; } while (WallHasDamagedSections(mechanic_brokenWall_1)); // Highlight until repaired
mechanic.RemoveActiveObjectiveEntity(mechanic_brokenWall_1); mechanic.RemoveActiveObjectiveEntity(mechanic_brokenWall_1);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Select)); // Pump objective TriggerTutorialSegment(3, GameMain.Config.KeyBind(InputType.Select)); // Pump objective
SetHighlight(mechanic_workingPump.Item, true); SetHighlight(mechanic_workingPump.Item, true);
do do
{ {
yield return null; yield return null;
if (IsSelectedItem(mechanic_workingPump.Item)) if (IsSelectedItem(mechanic_brokenPump.Item))
{ {
if (mechanic_workingPump.IsActiveSlider.FlashTimer <= 0) if (mechanic_workingPump.IsActiveSlider.FlashTimer <= 0)
{ {
@@ -330,17 +330,17 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (mechanic_brokenhull_1.WaterPercentage > waterVolumeBeforeOpening); // Unlock door once drained do { yield return null; } while (mechanic_brokenhull_1.WaterPercentage > waterVolumeBeforeOpening); // Unlock door once drained
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, true); SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, true);
yield return new WaitForSeconds(1.5f, false); yield return new WaitForSeconds(1.5f);
//TriggerTutorialSegment(11, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Select)); // Ladder objective //TriggerTutorialSegment(11, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Up), GameMain.Config.KeyBind(InputType.Down), GameMain.Config.KeyBind(InputType.Select)); // Ladder objective
//do { yield return null; } while (!mechanic_ladderSensor.MotionDetected); //do { yield return null; } while (!mechanic_ladderSensor.MotionDetected);
//RemoveCompletedObjective(segments[11]); //RemoveCompletedObjective(segments[11]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.News"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.News"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Fire"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Mechanic.Radio.Fire"), ChatMessageType.Radio, null);
// Room 4 // Room 4
do { yield return null; } while (!mechanic_thirdDoor.IsOpen); do { yield return null; } while (!mechanic_thirdDoor.IsOpen);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
mechanic_fire = new DummyFireSource(new Vector2(20f, 2f), Item.ItemList.Find(i => i.HasTag("mechanic_fire")).WorldPosition); mechanic_fire = new DummyFireSource(new Vector2(20f, 2f), Item.ItemList.Find(i => i.HasTag("mechanic_fire")).WorldPosition);
//do { yield return null; } while (!mechanic_craftingObjectiveSensor.MotionDetected); //do { yield return null; } while (!mechanic_craftingObjectiveSensor.MotionDetected);
TriggerTutorialSegment(4); // Deconstruct TriggerTutorialSegment(4); // Deconstruct
@@ -364,7 +364,7 @@ namespace Barotrauma.Tutorials
} }
yield return null; yield return null;
} while (mechanic.Inventory.FindItemByIdentifier("oxygentank") == null || mechanic.Inventory.FindItemByIdentifier("sodium") == null); // Wait until looted } while (mechanic.Inventory.FindItemByIdentifier("oxygentank") == null || mechanic.Inventory.FindItemByIdentifier("sodium") == null); // Wait until looted
yield return new WaitForSeconds(1.0f, false); yield return new WaitForSeconds(1.0f);
SetHighlight(mechanic_craftingCabinet.Item, false); SetHighlight(mechanic_craftingCabinet.Item, false);
SetHighlight(mechanic_deconstructor.Item, true); SetHighlight(mechanic_deconstructor.Item, true);
@@ -409,7 +409,7 @@ namespace Barotrauma.Tutorials
SetHighlight(mechanic_deconstructor.Item, false); SetHighlight(mechanic_deconstructor.Item, false);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
TriggerTutorialSegment(5); // Fabricate TriggerTutorialSegment(5); // Fabricate
SetHighlight(mechanic_fabricator.Item, true); SetHighlight(mechanic_fabricator.Item, true);
do do
@@ -465,7 +465,7 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (!mechanic_fireSensor.MotionDetected); do { yield return null; } while (!mechanic_fireSensor.MotionDetected);
TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Using the extinguisher TriggerTutorialSegment(6, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Using the extinguisher
do { yield return null; } while (!mechanic_fire.Removed); // Wait until extinguished do { yield return null; } while (!mechanic_fire.Removed); // Wait until extinguished
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f);
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
if (mechanic.HasEquippedItem("extinguisher")) // do not trigger if dropped already if (mechanic.HasEquippedItem("extinguisher")) // do not trigger if dropped already
@@ -527,16 +527,6 @@ namespace Barotrauma.Tutorials
} }
} }
} }
else
{
if (IsSelectedItem(mechanic_brokenPump.Item))
{
if (mechanic_brokenPump.IsActiveSlider.FlashTimer <= 0)
{
mechanic_brokenPump.IsActiveSlider.Flash(uiHighlightColor, 1.5f, true);
}
}
}
} while (!mechanic_brokenPump.Item.IsFullCondition || mechanic_brokenPump.FlowPercentage >= 0 || !mechanic_brokenPump.IsActive); } while (!mechanic_brokenPump.Item.IsFullCondition || mechanic_brokenPump.FlowPercentage >= 0 || !mechanic_brokenPump.IsActive);
RemoveCompletedObjective(segments[9]); RemoveCompletedObjective(segments[9]);
SetHighlight(mechanic_brokenPump.Item, false); SetHighlight(mechanic_brokenPump.Item, false);
@@ -197,7 +197,7 @@ namespace Barotrauma.Tutorials
{ {
shakeTimer -= 0.1f; shakeTimer -= 0.1f;
GameMain.GameScreen.Cam.Shake = shakeAmount; GameMain.GameScreen.Cam.Shake = shakeAmount;
yield return new WaitForSeconds(0.1f, false); yield return new WaitForSeconds(0.1f);
} }
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.WakeUp"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.WakeUp"), ChatMessageType.Radio, null);
@@ -205,7 +205,7 @@ namespace Barotrauma.Tutorials
// Room 2 // Room 2
do { yield return null; } while (!officer_equipmentObjectiveSensor.MotionDetected); do { yield return null; } while (!officer_equipmentObjectiveSensor.MotionDetected);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Equipment"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Equipment"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f);
//TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment //TriggerTutorialSegment(0, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Deselect)); // Retrieve equipment
SetHighlight(officer_equipmentCabinet.Item, true); SetHighlight(officer_equipmentCabinet.Item, true);
bool firstSlotRemoved = false; bool firstSlotRemoved = false;
@@ -259,7 +259,7 @@ namespace Barotrauma.Tutorials
{ {
HighlightInventorySlot(officer.Inventory, "ballistichelmet", highlightColor, .5f, .5f, 0f); HighlightInventorySlot(officer.Inventory, "ballistichelmet", highlightColor, .5f, .5f, 0f);
} }
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
} while (!officer.HasEquippedItem("stunbaton") || !officer.HasEquippedItem("bodyarmor") || !officer.HasEquippedItem("ballistichelmet")); } while (!officer.HasEquippedItem("stunbaton") || !officer.HasEquippedItem("bodyarmor") || !officer.HasEquippedItem("ballistichelmet"));
RemoveCompletedObjective(segments[1]); RemoveCompletedObjective(segments[1]);
SetDoorAccess(officer_firstDoor, officer_firstDoorLight, true); SetDoorAccess(officer_firstDoor, officer_firstDoorLight, true);
@@ -271,7 +271,7 @@ namespace Barotrauma.Tutorials
do { yield return null; } while (!officer_crawler.IsDead); do { yield return null; } while (!officer_crawler.IsDead);
RemoveCompletedObjective(segments[2]); RemoveCompletedObjective(segments[2]);
Heal(officer); Heal(officer);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.CrawlerDead"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.CrawlerDead"), ChatMessageType.Radio, null);
SetDoorAccess(officer_secondDoor, officer_secondDoorLight, true); SetDoorAccess(officer_secondDoor, officer_secondDoorLight, true);
@@ -296,7 +296,7 @@ namespace Barotrauma.Tutorials
SetHighlight(officer_ammoShelf_1.Item, false); SetHighlight(officer_ammoShelf_1.Item, false);
SetHighlight(officer_ammoShelf_2.Item, false); SetHighlight(officer_ammoShelf_2.Item, false);
RemoveCompletedObjective(segments[3]); RemoveCompletedObjective(segments[3]);
yield return new WaitForSeconds(2f, false); yield return new WaitForSeconds(2f);
TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Shoot), GameMain.Config.KeyBind(InputType.Deselect)); // Kill hammerhead TriggerTutorialSegment(4, GameMain.Config.KeyBind(InputType.Select), GameMain.Config.KeyBind(InputType.Shoot), GameMain.Config.KeyBind(InputType.Deselect)); // Kill hammerhead
officer_hammerhead = SpawnMonster(hammerheadCharacterFile, officer_hammerheadSpawnPos); officer_hammerhead = SpawnMonster(hammerheadCharacterFile, officer_hammerheadSpawnPos);
officer_hammerhead.AIController.SelectTarget(officer.AiTarget); officer_hammerhead.AIController.SelectTarget(officer.AiTarget);
@@ -316,14 +316,14 @@ namespace Barotrauma.Tutorials
Heal(officer); Heal(officer);
SetHighlight(officer_coilgunPeriscope, false); SetHighlight(officer_coilgunPeriscope, false);
RemoveCompletedObjective(segments[4]); RemoveCompletedObjective(segments[4]);
yield return new WaitForSeconds(1f, false); yield return new WaitForSeconds(1f);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.HammerheadDead"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.HammerheadDead"), ChatMessageType.Radio, null);
SetDoorAccess(officer_thirdDoor, officer_thirdDoorLight, true); SetDoorAccess(officer_thirdDoor, officer_thirdDoorLight, true);
// Room 5 // Room 5
//do { yield return null; } while (!officer_rangedWeaponSensor.MotionDetected); //do { yield return null; } while (!officer_rangedWeaponSensor.MotionDetected);
do { yield return null; } while (!officer_thirdDoor.IsOpen); do { yield return null; } while (!officer_thirdDoor.IsOpen);
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f);
TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Ranged weapons TriggerTutorialSegment(5, GameMain.Config.KeyBind(InputType.Aim), GameMain.Config.KeyBind(InputType.Shoot)); // Ranged weapons
SetHighlight(officer_rangedWeaponHolder.Item, true); SetHighlight(officer_rangedWeaponHolder.Item, true);
do { yield return null; } while (!officer_rangedWeaponHolder.Inventory.IsEmpty()); // Wait until looted do { yield return null; } while (!officer_rangedWeaponHolder.Inventory.IsEmpty()); // Wait until looted
@@ -387,9 +387,8 @@ namespace Barotrauma.Tutorials
officer.AddActiveObjectiveEntity(officer_subAmmoBox_1, officer_gunIcon, officer_gunIconColor); officer.AddActiveObjectiveEntity(officer_subAmmoBox_1, officer_gunIcon, officer_gunIconColor);
officer.AddActiveObjectiveEntity(officer_subAmmoBox_2, officer_gunIcon, officer_gunIconColor); officer.AddActiveObjectiveEntity(officer_subAmmoBox_2, officer_gunIcon, officer_gunIconColor);
officer.AddActiveObjectiveEntity(officer_subSuperCapacitor_1.Item, officer_gunIcon, officer_gunIconColor); officer.AddActiveObjectiveEntity(officer_subSuperCapacitor_1.Item, officer_gunIcon, officer_gunIconColor);
officer.AddActiveObjectiveEntity(officer_subSuperCapacitor_1.Item, officer_gunIcon, officer_gunIconColor);
officer.AddActiveObjectiveEntity(officer_subSuperCapacitor_2.Item, officer_gunIcon, officer_gunIconColor); officer.AddActiveObjectiveEntity(officer_subSuperCapacitor_2.Item, officer_gunIcon, officer_gunIconColor);
SetHighlight(officer_subSuperCapacitor_1.Item, true);
SetHighlight(officer_subSuperCapacitor_2.Item, true);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Submarine"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Submarine"), ChatMessageType.Radio, null);
do do
{ {
@@ -410,8 +409,8 @@ namespace Barotrauma.Tutorials
officer.RemoveActiveObjectiveEntity(officer_subSuperCapacitor_2.Item); officer.RemoveActiveObjectiveEntity(officer_subSuperCapacitor_2.Item);
} }
SetHighlight(officer_subAmmoBox_1, officer_subAmmoBox_1.ParentInventory != officer_subLoader_1.Inventory && officer_subAmmoBox_1.ParentInventory != officer_subLoader_2.Inventory); SetHighlight(officer_subAmmoBox_1, officer_subLoader_1.Item.ExternalHighlight || officer_subLoader_2.Item.ExternalHighlight);
SetHighlight(officer_subAmmoBox_2, officer_subAmmoBox_2.ParentInventory != officer_subLoader_1.Inventory && officer_subAmmoBox_2.ParentInventory != officer_subLoader_2.Inventory); SetHighlight(officer_subAmmoBox_2, officer_subLoader_1.Item.ExternalHighlight || officer_subLoader_2.Item.ExternalHighlight);
SetHighlight(officer_subAmmoShelf.Item, officer_subLoader_1.Item.ExternalHighlight || officer_subLoader_2.Item.ExternalHighlight); SetHighlight(officer_subAmmoShelf.Item, officer_subLoader_1.Item.ExternalHighlight || officer_subLoader_2.Item.ExternalHighlight);
if (officer_subAmmoBox_1.ParentInventory == officer_subLoader_1.Inventory || officer_subAmmoBox_1.ParentInventory == officer_subLoader_2.Inventory) officer.RemoveActiveObjectiveEntity(officer_subAmmoBox_1); if (officer_subAmmoBox_1.ParentInventory == officer_subLoader_1.Inventory || officer_subAmmoBox_1.ParentInventory == officer_subLoader_2.Inventory) officer.RemoveActiveObjectiveEntity(officer_subAmmoBox_1);
if (officer_subAmmoBox_2.ParentInventory == officer_subLoader_1.Inventory || officer_subAmmoBox_2.ParentInventory == officer_subLoader_2.Inventory) officer.RemoveActiveObjectiveEntity(officer_subAmmoBox_2); if (officer_subAmmoBox_2.ParentInventory == officer_subLoader_1.Inventory || officer_subAmmoBox_2.ParentInventory == officer_subLoader_2.Inventory) officer.RemoveActiveObjectiveEntity(officer_subAmmoBox_2);
@@ -431,7 +430,7 @@ namespace Barotrauma.Tutorials
RemoveCompletedObjective(segments[7]); RemoveCompletedObjective(segments[7]);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Complete"), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Officer.Radio.Complete"), ChatMessageType.Radio, null);
yield return new WaitForSeconds(4f, false); yield return new WaitForSeconds(4f);
CoroutineManager.StartCoroutine(TutorialCompleted()); CoroutineManager.StartCoroutine(TutorialCompleted());
} }
@@ -477,7 +477,7 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0]; if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
#if (!OSX) #if (!OSX)
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.EnsureUTF8(VoiceCaptureDevice), deviceNames.Count); var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
foreach (string name in deviceNames) foreach (string name in deviceNames)
{ {
deviceList.AddItem(TextManager.EnsureUTF8(name), name); deviceList.AddItem(TextManager.EnsureUTF8(name), name);
@@ -492,7 +492,7 @@ namespace Barotrauma
}; };
#else #else
var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform),
TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice))) TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice))
{ {
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"), ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
TextAlignment = Alignment.CenterX TextAlignment = Alignment.CenterX
@@ -507,7 +507,7 @@ namespace Barotrauma
if (VoiceCaptureDevice == deviceNames[0]) return true; if (VoiceCaptureDevice == deviceNames[0]) return true;
VoipCapture.ChangeCaptureDevice(deviceNames[0]); VoipCapture.ChangeCaptureDevice(deviceNames[0]);
suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice)); suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice);
suavemente.Flash(Color.Blue); suavemente.Flash(Color.Blue);
return true; return true;
@@ -624,22 +624,10 @@ namespace Barotrauma
if (mouseOn && PlayerInput.LeftButtonClicked() && !messageBoxOpen) if (mouseOn && PlayerInput.LeftButtonClicked() && !messageBoxOpen)
{ {
if (TextManager.ContainsTag("centerarealockedheader") && TextManager.ContainsTag("centerarealockedtext") ) //TODO: translate or replace
{ var messageBox = new GUIMessageBox("Mysteries lie ahead...", "This area is unreachable in this version of Barotrauma. Please wait for future updates!");
var messageBox = new GUIMessageBox( messageBoxOpen = true;
TextManager.Get("centerarealockedheader"), CoroutineManager.StartCoroutine(WaitForMessageBoxClosed(messageBox));
TextManager.Get("centerarealockedtext"));
messageBoxOpen = true;
CoroutineManager.StartCoroutine(WaitForMessageBoxClosed(messageBox));
}
else
{
//if the message cannot be shown in the selected language,
//show the campaign roadmap (which mentions the center location not being reachable)
var messageBox = new GUIMessageBox(TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("CampaignRoadMapText"));
messageBoxOpen = true;
CoroutineManager.StartCoroutine(WaitForMessageBoxClosed(messageBox));
}
} }
} }
@@ -435,8 +435,6 @@ namespace Barotrauma
saveTime = time.ToString(); saveTime = time.ToString();
} }
string mapseed = doc.Root.GetAttributeString("mapseed", "unknown");
var saveFileFrame = new GUIFrame(new RectTransform(new Vector2(0.45f, 0.6f), loadGameContainer.RectTransform, Anchor.TopRight) var saveFileFrame = new GUIFrame(new RectTransform(new Vector2(0.45f, 0.6f), loadGameContainer.RectTransform, Anchor.TopRight)
{ {
RelativeOffset = new Vector2(0.0f, 0.1f) RelativeOffset = new Vector2(0.0f, 0.1f)
@@ -74,14 +74,15 @@ namespace Barotrauma
outpostBtn.TextBlock.Font = GUI.LargeFont; outpostBtn.TextBlock.Font = GUI.LargeFont;
outpostBtn.TextBlock.AutoScale = true; outpostBtn.TextBlock.AutoScale = true;
var tabButtonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.4f, 0.4f), topPanelContent.RectTransform, Anchor.BottomLeft), isHorizontal: true); var tabButtonContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.4f, 0.3f), topPanelContent.RectTransform, Anchor.BottomLeft), isHorizontal: true);
int i = 0; int i = 0;
var tabValues = Enum.GetValues(typeof(Tab)); var tabValues = Enum.GetValues(typeof(Tab));
foreach (Tab tab in tabValues) foreach (Tab tab in tabValues)
{ {
var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform), var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform),
"", TextManager.Get(tab.ToString()),
textAlignment: Alignment.Center,
style: i == 0 ? "GUISlopedTabButtonLeft" : (i == tabValues.Length - 1 ? "GUISlopedTabButtonRight" : "GUISlopedTabButtonMid")) style: i == 0 ? "GUISlopedTabButtonLeft" : (i == tabValues.Length - 1 ? "GUISlopedTabButtonRight" : "GUISlopedTabButtonMid"))
{ {
UserData = tab, UserData = tab,
@@ -92,32 +93,11 @@ namespace Barotrauma
tabButton.RectTransform.MaxSize = new Point( tabButton.RectTransform.MaxSize = new Point(
(int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue); (int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue);
//the text needs to be positioned differently in the buttons at the edges due to the "slopes" in the button
if (i == 0 || i == tabValues.Length - 1)
{
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.9f), tabButton.RectTransform, i == 0 ? Anchor.CenterLeft : Anchor.CenterRight) { RelativeOffset = new Vector2(0.05f, 0.0f) },
TextManager.Get(tab.ToString()), textColor: tabButton.TextColor, font: GUI.LargeFont, textAlignment: Alignment.Center, style: null)
{
UserData = "buttontext"
};
}
else
{
new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.9f), tabButton.RectTransform, Anchor.Center),
TextManager.Get(tab.ToString()), textColor: tabButton.TextColor, font: GUI.LargeFont, textAlignment: Alignment.Center, style: null)
{
UserData = "buttontext"
};
}
tabButtons.Add(tabButton); tabButtons.Add(tabButton);
tabButton.Font = GUI.LargeFont;
i++; i++;
} }
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.GetChildByUserData("buttontext") as GUITextBlock)); GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.TextBlock));
tabButtons.FirstOrDefault().RectTransform.SizeChanged += () =>
{
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.GetChildByUserData("buttontext") as GUITextBlock));
};
// crew tab ------------------------------------------------------------------------- // crew tab -------------------------------------------------------------------------
@@ -111,7 +111,7 @@ namespace Barotrauma
string currWord = ""; string currWord = "";
for (int i = 0; i < text.Length; i++) for (int i = 0; i < text.Length; i++)
{ {
if (TextManager.IsCJK(text[i].ToString())) if (isCJK.IsMatch(text[i].ToString()))
{ {
if (currWord.Length > 0) if (currWord.Length > 0)
{ {
@@ -200,7 +200,7 @@ namespace Barotrauma
linePos = size.X + spaceSize.X; linePos = size.X + spaceSize.X;
} }
if (i < words.Count - 1 && !TextManager.IsCJK(words[i]) && !TextManager.IsCJK(words[i + 1])) if (i < words.Count - 1 && !isCJK.IsMatch(words[i]) && !isCJK.IsMatch(words[i + 1]))
{ {
wrappedText.Append(" "); wrappedText.Append(" ");
} }
@@ -208,5 +208,16 @@ namespace Barotrauma
return wrappedText.ToString().Replace(" \n ", "\n"); return wrappedText.ToString().Replace(" \n ", "\n");
} }
static Regex isCJK = new Regex(
@"\p{IsHangulJamo}|" +
@"\p{IsCJKRadicalsSupplement}|" +
@"\p{IsCJKSymbolsandPunctuation}|" +
@"\p{IsEnclosedCJKLettersandMonths}|" +
@"\p{IsCJKCompatibility}|" +
@"\p{IsCJKUnifiedIdeographsExtensionA}|" +
@"\p{IsCJKUnifiedIdeographs}|" +
@"\p{IsHangulSyllables}|" +
@"\p{IsCJKCompatibilityForms}");
} }
} }
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.2")] [assembly: AssemblyVersion("0.9.0.1")]
[assembly: AssemblyFileVersion("0.9.0.2")] [assembly: AssemblyFileVersion("0.9.0.1")]
@@ -68,7 +68,6 @@ namespace Barotrauma
sb.AppendLine("Game version " + GameMain.Version + " (debug build)"); sb.AppendLine("Game version " + GameMain.Version + " (debug build)");
#else #else
sb.AppendLine("Game version " + GameMain.Version); sb.AppendLine("Game version " + GameMain.Version);
#endif
sb.AppendLine("Selected content packages: " + (!GameMain.SelectedPackages.Any() ? "None" : string.Join(", ", GameMain.SelectedPackages.Select(c => c.Name)))); sb.AppendLine("Selected content packages: " + (!GameMain.SelectedPackages.Any() ? "None" : string.Join(", ", GameMain.SelectedPackages.Select(c => c.Name))));
sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed)); sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed));
sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")")); sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")"));
@@ -83,9 +83,7 @@ namespace Barotrauma
{ {
if (DisableCrewAI || Character.IsUnconscious) return; if (DisableCrewAI || Character.IsUnconscious) return;
float maxDistanceToSub = 3000; if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null)
if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null &&
Vector2.DistanceSquared(Character.WorldPosition, SelectedAiTarget.Entity.Submarine.WorldPosition) < maxDistanceToSub * maxDistanceToSub)
{ {
if (steeringManager != insideSteering) if (steeringManager != insideSteering)
{ {
@@ -485,11 +483,7 @@ namespace Barotrauma
} }
else if (ObjectiveManager.CurrentOrder is AIObjectiveRescueAll rescueAll && rescueAll.Targets.None()) else if (ObjectiveManager.CurrentOrder is AIObjectiveRescueAll rescueAll && rescueAll.Targets.None())
{ {
//TODO: re-enable on all languages after DialogNoRescueTargets has been translated Character.Speak(TextManager.Get("DialogNoRescueTargets"), null, 3.0f, "norescuetargets");
if (TextManager.Language == "English")
{
Character.Speak(TextManager.Get("DialogNoRescueTargets"), null, 3.0f, "norescuetargets");
}
} }
else if (ObjectiveManager.CurrentOrder is AIObjectivePumpWater pumpWater && pumpWater.Targets.None()) else if (ObjectiveManager.CurrentOrder is AIObjectivePumpWater pumpWater && pumpWater.Targets.None())
{ {
@@ -540,8 +534,6 @@ namespace Barotrauma
public static bool HasItem(Character character, string tag, string containedTag, float conditionPercentage = 0) public static bool HasItem(Character character, string tag, string containedTag, float conditionPercentage = 0)
{ {
if (character == null) { return false; }
if (character.Inventory == null) { return false; }
var item = character.Inventory.FindItemByTag(tag); var item = character.Inventory.FindItemByTag(tag);
return item != null && return item != null &&
item.ConditionPercentage > conditionPercentage && item.ConditionPercentage > conditionPercentage &&
@@ -164,15 +164,7 @@ namespace Barotrauma
} }
var newPath = pathFinder.FindPath(pos, target, "(Character: " + character.Name + ")"); var newPath = pathFinder.FindPath(pos, target, "(Character: " + character.Name + ")");
bool useNewPath = currentPath == null || needsNewPath; if (currentPath == null || needsNewPath || !newPath.Unreachable && newPath.Cost < currentPath.Cost)
if (!useNewPath && currentPath != null && currentPath.CurrentNode != null && newPath.Nodes.Any() && !newPath.Unreachable)
{
// It's possible that the current path was calculated from a start point that is no longer valid.
// Therefore, let's accept also paths with a greater cost than the current, if the current node is much farther than the new start node.
useNewPath = newPath.Cost < currentPath.Cost ||
Vector2.DistanceSquared(character.WorldPosition, currentPath.CurrentNode.WorldPosition) > Math.Pow(Vector2.Distance(character.WorldPosition, newPath.Nodes.First().WorldPosition) * 2, 2);
}
if (useNewPath)
{ {
currentPath = newPath; currentPath = newPath;
} }
@@ -414,7 +406,7 @@ namespace Barotrauma
{ {
if (door.HasIntegratedButtons) if (door.HasIntegratedButtons)
{ {
door.Item.TryInteract(character, false, true); door.Item.TryInteract(character, false, true, true);
buttonPressCooldown = ButtonPressInterval; buttonPressCooldown = ButtonPressInterval;
break; break;
} }
@@ -422,7 +414,7 @@ namespace Barotrauma
{ {
if (Vector2.DistanceSquared(closestButton.Item.WorldPosition, character.WorldPosition) < MathUtils.Pow(closestButton.Item.InteractDistance * 2, 2)) if (Vector2.DistanceSquared(closestButton.Item.WorldPosition, character.WorldPosition) < MathUtils.Pow(closestButton.Item.InteractDistance * 2, 2))
{ {
closestButton.Item.TryInteract(character, false, true); closestButton.Item.TryInteract(character, false, true, false);
buttonPressCooldown = ButtonPressInterval; buttonPressCooldown = ButtonPressInterval;
break; break;
} }
@@ -128,7 +128,7 @@ namespace Barotrauma
if (seekAmmunition == null || !subObjectives.Contains(seekAmmunition)) if (seekAmmunition == null || !subObjectives.Contains(seekAmmunition))
{ {
Move(); Move();
if (WeaponComponent != null) if (Weapon != null)
{ {
OperateWeapon(deltaTime); OperateWeapon(deltaTime);
} }
@@ -279,6 +279,24 @@ namespace Barotrauma
Weapon.Drop(character); Weapon.Drop(character);
} }
} }
//if (!character.SelectedItems.Contains(Weapon))
if (!character.HasEquippedItem(Weapon))
{
Weapon.TryInteract(character, forceSelectKey: true);
var slots = Weapon.AllowedSlots.FindAll(s => s == InvSlotType.LeftHand || s == InvSlotType.RightHand || s == (InvSlotType.LeftHand | InvSlotType.RightHand));
if (character.Inventory.TryPutItem(Weapon, character, slots))
{
Weapon.Equip(character);
aimTimer = Rand.Range(0.5f, 1f);
}
else
{
Weapon = null;
Mode = CombatMode.Retreat;
return false;
}
}
return true;
} }
private bool Equip() private bool Equip()
@@ -320,10 +338,7 @@ namespace Barotrauma
{ {
retreatTarget = findSafety.FindBestHull(HumanAIController.VisibleHulls); retreatTarget = findSafety.FindBestHull(HumanAIController.VisibleHulls);
} }
if (character.CurrentHull != retreatTarget) TryAddSubObjective(ref retreatObjective, () => new AIObjectiveGoTo(retreatTarget, character, objectiveManager, false, true));
{
TryAddSubObjective(ref retreatObjective, () => new AIObjectiveGoTo(retreatTarget, character, objectiveManager, false, true));
}
} }
private void Engage() private void Engage()
@@ -339,7 +354,8 @@ namespace Barotrauma
constructor: () => new AIObjectiveGoTo(Enemy, character, objectiveManager, repeat: true, getDivingGearIfNeeded: true) constructor: () => new AIObjectiveGoTo(Enemy, character, objectiveManager, repeat: true, getDivingGearIfNeeded: true)
{ {
AllowGoingOutside = true, AllowGoingOutside = true,
IgnoreIfTargetDead = true IgnoreIfTargetDead = true,
CheckVisibility = true
}, },
onAbandon: () => onAbandon: () =>
{ {
@@ -349,7 +365,7 @@ namespace Barotrauma
if (followTargetObjective != null && subObjectives.Contains(followTargetObjective)) if (followTargetObjective != null && subObjectives.Contains(followTargetObjective))
{ {
followTargetObjective.CloseEnough = followTargetObjective.CloseEnough =
WeaponComponent is RangedWeapon ? 300 : WeaponComponent is RangedWeapon ? 3 :
WeaponComponent is MeleeWeapon mw ? mw.Range : WeaponComponent is MeleeWeapon mw ? mw.Range :
WeaponComponent is RepairTool rt ? rt.Range : 50; WeaponComponent is RepairTool rt ? rt.Range : 50;
} }
@@ -439,7 +455,7 @@ namespace Barotrauma
float squaredDistance = Vector2.DistanceSquared(character.Position, Enemy.Position); float squaredDistance = Vector2.DistanceSquared(character.Position, Enemy.Position);
character.CursorPosition = Enemy.Position; character.CursorPosition = Enemy.Position;
float engageDistance = 500; float engageDistance = 500;
if (character.CurrentHull != Enemy.CurrentHull && squaredDistance > engageDistance * engageDistance) { return; } if (squaredDistance > engageDistance * engageDistance) { return; }
if (!character.CanSeeCharacter(Enemy)) { return; } if (!character.CanSeeCharacter(Enemy)) { return; }
if (Weapon.RequireAimToUse) if (Weapon.RequireAimToUse)
{ {
@@ -452,7 +468,7 @@ namespace Barotrauma
isOperatingButtons = door.HasIntegratedButtons || door.Item.GetConnectedComponents<Controller>(true).Any(); isOperatingButtons = door.HasIntegratedButtons || door.Item.GetConnectedComponents<Controller>(true).Any();
} }
} }
if (!isOperatingButtons) if (!isOperatingButtons && character.SelectedConstruction == null)
{ {
character.SetInput(InputType.Aim, false, true); character.SetInput(InputType.Aim, false, true);
} }
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework; using FarseerPhysics;
using Microsoft.Xna.Framework;
using System; using System;
using Barotrauma.Extensions; using System.Linq;
namespace Barotrauma namespace Barotrauma
{ {
@@ -16,21 +17,17 @@ namespace Barotrauma
public Func<bool> customCondition; public Func<bool> customCondition;
public bool followControlledCharacter;
public bool mimic;
/// <summary> /// <summary>
/// Display units /// Display units
/// </summary> /// </summary>
public float CloseEnough { get; set; } = 50; public float CloseEnough { get; set; } = 50;
public bool IgnoreIfTargetDead { get; set; } public bool IgnoreIfTargetDead { get; set; }
public bool AllowGoingOutside { get; set; } public bool AllowGoingOutside { get; set; }
public bool CheckVisibility { get; set; }
public ISpatialEntity Target { get; private set; }
public override float GetPriority() public override float GetPriority()
{ {
if (followControlledCharacter && Character.Controlled == null) { return 0.0f; } if (FollowControlledCharacter && Character.Controlled == null) { return 0.0f; }
if (Target is Entity e && e.Removed) { return 0.0f; } if (Target is Entity e && e.Removed) { return 0.0f; }
if (IgnoreIfTargetDead && Target is Character character && character.IsDead) { return 0.0f; } if (IgnoreIfTargetDead && Target is Character character && character.IsDead) { return 0.0f; }
if (objectiveManager.CurrentOrder == this) if (objectiveManager.CurrentOrder == this)
@@ -40,19 +37,23 @@ namespace Barotrauma
return 1.0f; return 1.0f;
} }
public ISpatialEntity Target { get; private set; }
public bool FollowControlledCharacter;
public AIObjectiveGoTo(ISpatialEntity target, Character character, AIObjectiveManager objectiveManager, bool repeat = false, bool getDivingGearIfNeeded = true, float priorityModifier = 1) public AIObjectiveGoTo(ISpatialEntity target, Character character, AIObjectiveManager objectiveManager, bool repeat = false, bool getDivingGearIfNeeded = true, float priorityModifier = 1)
: base (character, objectiveManager, priorityModifier) : base (character, objectiveManager, priorityModifier)
{ {
this.Target = target; this.Target = target;
this.repeat = repeat; this.repeat = repeat;
waitUntilPathUnreachable = 3.0f; waitUntilPathUnreachable = 2.0f;
this.getDivingGearIfNeeded = getDivingGearIfNeeded; this.getDivingGearIfNeeded = getDivingGearIfNeeded;
CalculateCloseEnough(); CalculateCloseEnough();
} }
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
{ {
if (followControlledCharacter) if (FollowControlledCharacter)
{ {
if (Character.Controlled == null) if (Character.Controlled == null)
{ {
@@ -91,18 +92,11 @@ namespace Barotrauma
{ {
abandon = true; abandon = true;
} }
else if (waitUntilPathUnreachable < 0) else if (!repeat && waitUntilPathUnreachable < 0)
{ {
if (SteeringManager == PathSteering && PathSteering.CurrentPath != null && PathSteering.CurrentPath.Unreachable) if (SteeringManager == PathSteering && PathSteering.CurrentPath != null)
{ {
if (repeat) abandon = PathSteering.CurrentPath.Unreachable;
{
SteeringManager.Reset();
}
else
{
abandon = true;
}
} }
} }
if (abandon) if (abandon)
@@ -121,9 +115,9 @@ namespace Barotrauma
Vector2 currTargetSimPos = Vector2.Zero; Vector2 currTargetSimPos = Vector2.Zero;
currTargetSimPos = Target.SimPosition; currTargetSimPos = Target.SimPosition;
// Take the sub position into account in the sim pos // Take the sub position into account in the sim pos
if (SteeringManager != PathSteering && character.Submarine == null && Target.Submarine != null) if (character.Submarine == null && Target.Submarine != null)
{ {
currTargetSimPos += Target.Submarine.SimPosition; //currTargetSimPos += Target.Submarine.SimPosition;
} }
else if (character.Submarine != null && Target.Submarine == null) else if (character.Submarine != null && Target.Submarine == null)
{ {
@@ -138,15 +132,10 @@ namespace Barotrauma
} }
} }
character.AIController.SteeringManager.SteeringSeek(currTargetSimPos); character.AIController.SteeringManager.SteeringSeek(currTargetSimPos);
if (SteeringManager != PathSteering)
{
SteeringManager.SteeringAvoid(deltaTime, lookAheadDistance: 5, weight: 1, heading: VectorExtensions.Forward(character.AnimController.Collider.Rotation));
}
if (getDivingGearIfNeeded) if (getDivingGearIfNeeded)
{ {
Character followTarget = Target as Character; bool needsDivingGear = HumanAIController.NeedsDivingGear(targetHull);
bool needsDivingGear = HumanAIController.NeedsDivingGear(targetHull) || mimic && HumanAIController.HasDivingMask(followTarget); bool needsDivingSuit = needsDivingGear && (targetHull == null || targetIsOutside || targetHull.WaterPercentage > 90);
bool needsDivingSuit = needsDivingGear && (targetHull == null || targetIsOutside || targetHull.WaterPercentage > 90) || mimic && HumanAIController.HasDivingSuit(followTarget);
bool needsEquipment = false; bool needsEquipment = false;
if (needsDivingSuit) if (needsDivingSuit)
{ {
@@ -239,8 +239,7 @@ namespace Barotrauma
CloseEnough = 150, CloseEnough = 150,
AllowGoingOutside = true, AllowGoingOutside = true,
IgnoreIfTargetDead = true, IgnoreIfTargetDead = true,
followControlledCharacter = orderGiver == character, FollowControlledCharacter = orderGiver == character
mimic = true
}; };
break; break;
case "wait": case "wait":
@@ -259,7 +258,7 @@ namespace Barotrauma
newObjective = new AIObjectiveRescueAll(character, this, priorityModifier); newObjective = new AIObjectiveRescueAll(character, this, priorityModifier);
break; break;
case "repairsystems": case "repairsystems":
newObjective = new AIObjectiveRepairItems(character, this, priorityModifier) { RequireAdequateSkills = option == "jobspecific" }; newObjective = new AIObjectiveRepairItems(character, this, priorityModifier) { RequireAdequateSkills = option != "all" };
break; break;
case "pumpwater": case "pumpwater":
newObjective = new AIObjectivePumpWater(character, this, option, priorityModifier: priorityModifier); newObjective = new AIObjectivePumpWater(character, this, option, priorityModifier: priorityModifier);
@@ -68,12 +68,6 @@ namespace Barotrauma
{ {
if (character.CanInteractWith(target.Item, out _, checkLinked: false)) if (character.CanInteractWith(target.Item, out _, checkLinked: false))
{ {
// Don't allow to operate an item that someone already operates, unless this objective is an order
if (objectiveManager.CurrentOrder != this && Character.CharacterList.Any(c => c.SelectedConstruction == target.Item && c != character && HumanAIController.IsFriendly(c)))
{
abandon = true;
return;
}
if (character.SelectedConstruction != target.Item) if (character.SelectedConstruction != target.Item)
{ {
target.Item.TryInteract(character, false, true); target.Item.TryInteract(character, false, true);
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
namespace Barotrauma namespace Barotrauma
@@ -16,22 +17,13 @@ namespace Barotrauma
private readonly Character targetCharacter; private readonly Character targetCharacter;
private AIObjectiveGoTo goToObjective; private AIObjectiveGoTo goToObjective;
private float treatmentTimer; private float treatmentTimer;
private Hull safeHull;
public AIObjectiveRescue(Character character, Character targetCharacter, AIObjectiveManager objectiveManager, float priorityModifier = 1) public AIObjectiveRescue(Character character, Character targetCharacter, AIObjectiveManager objectiveManager, float priorityModifier = 1)
: base(character, objectiveManager, priorityModifier) : base(character, objectiveManager, priorityModifier)
{ {
if (targetCharacter == null) if (targetCharacter != character)
{
string errorMsg = "Attempted to create a Rescue objective with no target!\n" + Environment.StackTrace;
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("AIObjectiveRescue:ctor:targetnull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
abandon = true;
return;
}
if (targetCharacter == character)
{ {
// TODO: enable healing self too // TODO: enable healing self too
abandon = true; abandon = true;
@@ -48,11 +40,6 @@ namespace Barotrauma
protected override void Act(float deltaTime) protected override void Act(float deltaTime)
{ {
if (targetCharacter == null || targetCharacter.Removed)
{
return;
}
// Unconcious target is not in a safe place -> Move to a safe place first // Unconcious target is not in a safe place -> Move to a safe place first
if (targetCharacter.IsUnconscious && HumanAIController.GetHullSafety(targetCharacter.CurrentHull, targetCharacter) < HumanAIController.HULL_SAFETY_THRESHOLD) if (targetCharacter.IsUnconscious && HumanAIController.GetHullSafety(targetCharacter.CurrentHull, targetCharacter) < HumanAIController.HULL_SAFETY_THRESHOLD)
{ {
@@ -84,22 +71,15 @@ namespace Barotrauma
{ {
goToObjective = null; goToObjective = null;
} }
if (safeHull == null) var findSafety = objectiveManager.GetObjective<AIObjectiveFindSafety>();
if (findSafety == null)
{ {
var findSafety = objectiveManager.GetObjective<AIObjectiveFindSafety>(); // Ensure that we have the find safety objective (should always be the case)
if (findSafety == null) objectiveManager.AddObjective(new AIObjectiveFindSafety(character, objectiveManager));
{
// Ensure that we have the find safety objective (should always be the case)
findSafety = new AIObjectiveFindSafety(character, objectiveManager);
objectiveManager.AddObjective(findSafety);
}
safeHull = findSafety.FindBestHull(HumanAIController.VisibleHulls);
}
if (character.CurrentHull != safeHull)
{
TryAddSubObjective(ref goToObjective, () => new AIObjectiveGoTo(safeHull, character, objectiveManager));
} }
TryAddSubObjective(ref goToObjective, () => new AIObjectiveGoTo(findSafety.FindBestHull(HumanAIController.VisibleHulls), character, objectiveManager));
} }
return;
} }
if (subObjectives.Any()) { return; } if (subObjectives.Any()) { return; }
@@ -227,19 +207,13 @@ namespace Barotrauma
public override bool IsCompleted() public override bool IsCompleted()
{ {
if (targetCharacter == null || targetCharacter.Removed)
{
abandon = true;
return true;
}
bool isCompleted = targetCharacter.Bleeding <= 0 && targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager); bool isCompleted = targetCharacter.Bleeding <= 0 && targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager);
if (isCompleted) if (isCompleted)
{ {
character.Speak(TextManager.Get("DialogTargetHealed").Replace("[targetname]", targetCharacter.Name), character.Speak(TextManager.Get("DialogTargetHealed").Replace("[targetname]", targetCharacter.Name),
null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f); null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
} }
return isCompleted || targetCharacter.IsDead; return isCompleted || targetCharacter.Removed || targetCharacter.IsDead;
} }
public override float GetPriority() public override float GetPriority()
@@ -45,9 +45,9 @@ namespace Barotrauma
steering += DoSteeringWander(weight); steering += DoSteeringWander(weight);
} }
public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1, Vector2? heading = null) public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1)
{ {
steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight, heading); steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight);
} }
public void SteeringManual(float deltaTime, Vector2 velocity) public void SteeringManual(float deltaTime, Vector2 velocity)
@@ -129,12 +129,10 @@ namespace Barotrauma
return newSteering; return newSteering;
} }
protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight, Vector2? heading = null) protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight)
{ {
if (steering == Vector2.Zero || host.Steering == Vector2.Zero) if (steering == Vector2.Zero || host.Steering == Vector2.Zero) return Vector2.Zero;
{
return Vector2.Zero;
}
float maxDistance = lookAheadDistance; float maxDistance = lookAheadDistance;
if (rayCastTimer <= 0.0f) if (rayCastTimer <= 0.0f)
{ {
@@ -160,11 +158,19 @@ namespace Barotrauma
{ {
obstaclePosition.X = closestStructure.SimPosition.X; obstaclePosition.X = closestStructure.SimPosition.X;
} }
avoidObstaclePos = obstaclePosition; avoidObstaclePos = obstaclePosition;
//avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - obstaclePosition);
} }
/*else if (closestBody.UserData is Item)
{
avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - item.SimPosition);
}*/
else else
{ {
avoidObstaclePos = Submarine.LastPickedPosition; avoidObstaclePos = Submarine.LastPickedPosition;
//avoidSteering = Vector2.Normalize(host.SimPosition - Submarine.LastPickedPosition);
} }
} }
} }
@@ -179,26 +185,14 @@ namespace Barotrauma
Vector2 diff = avoidObstaclePos.Value - host.SimPosition; Vector2 diff = avoidObstaclePos.Value - host.SimPosition;
float dist = diff.Length(); float dist = diff.Length();
if (dist > maxDistance) if (!avoidObstaclePos.HasValue) return Vector2.Zero;
{
return Vector2.Zero; Vector2 diff = avoidObstaclePos.Value - host.SimPosition;
} float dist = diff.Length();
if (heading.HasValue)
{ if (dist > maxDistance) return Vector2.Zero;
var f = heading ?? host.Steering;
// Avoid to left or right depending on the current heading return -diff * (1.0f - dist / maxDistance) * weight;
Vector2 relativeVector = Vector2.Normalize(diff) - Vector2.Normalize(f);
var dir = relativeVector.X > 0 ? diff.Right() : diff.Left();
float factor = 1.0f - Math.Min(dist / maxDistance, 1);
return dir * factor * weight;
}
else
{
// Doesn't work right because it effectively just slows down or reverses the movement, where as we'd like to go right or left to avoid the target.
// There's also another issue, which also affects going right or left: the raycast doesn't hit anything if we turn too much -> avoiding doesn't work well.
// Could probably "remember" the avoidance a bit longer so that the avoid steering is not immedieately disgarded, but kept for a while and reduced gradually?
return -diff * (1.0f - dist / maxDistance) * weight;
}
} }
} }
} }
@@ -240,11 +240,6 @@ namespace Barotrauma
errorMessages = new List<string>(); errorMessages = new List<string>();
foreach (ContentFile file in Files) foreach (ContentFile file in Files)
{ {
#if SERVER
//dedicated server doesn't care if the client executable is present or not
if (file.Type == ContentType.Executable) { continue; }
#endif
if (!File.Exists(file.Path)) if (!File.Exists(file.Path))
{ {
errorMessages.Add("File \"" + file.Path + "\" not found."); errorMessages.Add("File \"" + file.Path + "\" not found.");
@@ -204,7 +204,6 @@ namespace Barotrauma
{ {
timer = time; timer = time;
TotalTime = time; TotalTime = time;
this.ignorePause = ignorePause;
} }
public bool CheckFinished(float deltaTime) public bool CheckFinished(float deltaTime)
@@ -83,15 +83,11 @@ namespace Barotrauma
Commonness = element.GetAttributeInt("commonness", 1); Commonness = element.GetAttributeInt("commonness", 1);
SuccessMessage = TextManager.Get("MissionSuccess." + Identifier, true) ?? element.GetAttributeString("successmessage", "Mission completed successfully"); SuccessMessage = TextManager.Get("MissionSuccess." + Identifier, true) ?? element.GetAttributeString("successmessage", "Mission completed successfully");
FailureMessage = TextManager.Get("MissionFailure." + Identifier, true) ?? ""; FailureMessage =
if (string.IsNullOrEmpty(FailureMessage) && TextManager.ContainsTag("missionfailed")) TextManager.Get("MissionFailure." + Identifier, true) ??
{ element.GetAttributeString("failuremessage", null) ??
FailureMessage = TextManager.Get("missionfailed", returnNull: true) ?? ""; TextManager.Get("missionfailed", returnNull: true) ??
} "";
if (string.IsNullOrEmpty(FailureMessage) && GameMain.Config.Language == "English")
{
FailureMessage = element.GetAttributeString("failuremessage", "");
}
SonarLabel = TextManager.Get("MissionSonarLabel." + Identifier, true) ?? element.GetAttributeString("sonarlabel", ""); SonarLabel = TextManager.Get("MissionSonarLabel." + Identifier, true) ?? element.GetAttributeString("sonarlabel", "");
@@ -69,7 +69,6 @@ namespace Barotrauma.Extensions
/// </summary> /// </summary>
public static Vector2 TransformVector(this Vector2 v, Vector2 up) public static Vector2 TransformVector(this Vector2 v, Vector2 up)
{ {
up = Vector2.Normalize(up);
return (up * v.Y) + (up.Right() * v.X); return (up * v.Y) + (up.Right() * v.X);
} }
@@ -750,7 +750,6 @@ namespace Barotrauma
if (!fileFound) if (!fileFound)
{ {
ShowLanguageSelectionPrompt = true; ShowLanguageSelectionPrompt = true;
ShowUserStatisticsPrompt = true;
SaveNewPlayerConfig(); SaveNewPlayerConfig();
} }
} }
@@ -821,6 +820,58 @@ namespace Barotrauma
{ {
VoiceSetting = voiceSetting; VoiceSetting = voiceSetting;
} }
foreach (ContentFile file in contentPackage.Files)
{
ToolBox.IsProperFilenameCase(file.Path);
}
}
if (!SelectedContentPackages.Any())
{
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
if (availablePackage != null)
{
SelectedContentPackages.Add(availablePackage);
}
}
//save to get rid of the invalid selected packages in the config file
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
}
#endregion
#region Save DefaultConfig
private void SaveNewDefaultConfig()
{
XDocument doc = new XDocument();
if (doc.Root == null)
{
doc.Add(new XElement("config"));
}
doc.Root.Add(
new XAttribute("language", TextManager.Language),
new XAttribute("masterserverurl", MasterServerUrl),
new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume),
new XAttribute("voicechatvolume", voiceChatVolume),
new XAttribute("verboselogging", VerboseLogging),
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
new XAttribute("enablesplashscreen", EnableSplashScreen),
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
new XAttribute("quickstartsub", QuickStartSubmarineName),
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
new XAttribute("aimassistamount", aimAssistAmount));
if (!ShowUserStatisticsPrompt)
{
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
}
if (WasGameUpdated)
{
doc.Root.Add(new XAttribute("wasgameupdated", true));
} }
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking); useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
@@ -79,10 +79,14 @@ namespace Barotrauma.Items.Components
wires = new Wire[MaxLinked]; wires = new Wire[MaxLinked];
IsOutput = element.Name.ToString() == "output"; if (string.IsNullOrEmpty(DisplayName))
Name = element.GetAttributeString("name", IsOutput ? "output" : "input"); {
#if DEBUG
DebugConsole.ThrowError("Missing display name in connection " + item.Name + ": " + Name);
#endif
DisplayName = Name;
}
string displayNameTag = "", fallbackTag = "";
//if displayname is not present, attempt to find it from the prefab //if displayname is not present, attempt to find it from the prefab
if (element.Attribute("displayname") == null) if (element.Attribute("displayname") == null)
{ {
@@ -94,44 +98,26 @@ namespace Barotrauma.Items.Components
{ {
if (connectionElement.Name.ToString() != element.Name.ToString()) { continue; } if (connectionElement.Name.ToString() != element.Name.ToString()) { continue; }
string prefabConnectionName = element.GetAttributeString("name", IsOutput ? "output" : "input"); string prefabConnectionName = element.GetAttributeString("name", (IsOutput) ? "output" : "input");
if (prefabConnectionName == Name) if (prefabConnectionName == Name)
{ {
displayNameTag = connectionElement.GetAttributeString("displayname", ""); DisplayName = TextManager.GetServerMessage(connectionElement.GetAttributeString("displayname", Name));
fallbackTag = connectionElement.GetAttributeString("fallbackdisplayname", "");
} }
} }
} }
#if DEBUG
if (string.IsNullOrEmpty(DisplayName))
{
DebugConsole.ThrowError("Missing display name in connection " + item.Name + ": " + Name);
}
#endif
} }
else else
{ {
displayNameTag = element.GetAttributeString("displayname", ""); DisplayName = TextManager.GetServerMessage(element.GetAttributeString("displayname", Name));
fallbackTag = element.GetAttributeString("fallbackdisplayname", null);
} }
if (!string.IsNullOrEmpty(displayNameTag))
{
//extract the tag parts in case the tags contains variables
string tagWithoutVariables = displayNameTag?.Split('~')?.FirstOrDefault();
string fallbackTagWithoutVariables = fallbackTag?.Split('~')?.FirstOrDefault();
//use displayNameTag if found, otherwise fallBack
if (TextManager.ContainsTag(tagWithoutVariables))
{
DisplayName = TextManager.GetServerMessage(displayNameTag);
}
else if (TextManager.ContainsTag(fallbackTagWithoutVariables))
{
DisplayName = TextManager.GetServerMessage(fallbackTag);
}
}
if (string.IsNullOrEmpty(DisplayName))
{
#if DEBUG
DebugConsole.ThrowError("Missing display name in connection " + item.Name + ": " + Name);
#endif
DisplayName = Name;
}
IsPower = Name == "power_in" || Name == "power" || Name == "power_out"; IsPower = Name == "power_in" || Name == "power" || Name == "power_out";
@@ -1641,7 +1641,7 @@ namespace Barotrauma
{ {
if (!ic.HasRequiredContainedItems(user == Character.Controlled)) continue; if (!ic.HasRequiredContainedItems(user == Character.Controlled)) continue;
bool success = Rand.Range(0.0f, 0.5f) < ic.DegreeOfSuccess(user); bool success = Rand.Range(0.0f, 1.0f) < ic.DegreeOfSuccess(user);
ActionType actionType = success ? ActionType.OnUse : ActionType.OnFailure; ActionType actionType = success ? ActionType.OnUse : ActionType.OnFailure;
#if CLIENT #if CLIENT
@@ -119,39 +119,22 @@ namespace Barotrauma
} }
} }
if (GameMain.GameSession != null) if (GameMain.GameSession != null && Character.Controlled != null)
{ {
#if CLIENT if (Character.Controlled.HasEquippedItem("clownmask") &&
if (Character.Controlled != null) { CheckMidRoundAchievements(Character.Controlled); } Character.Controlled.HasEquippedItem("clowncostume"))
#else
foreach (Client client in GameMain.Server.ConnectedClients)
{ {
if (client.Character != null) UnlockAchievement(Character.Controlled, "clowncostume");
{
CheckMidRoundAchievements(client.Character);
}
} }
#endif
}
}
private static void CheckMidRoundAchievements(Character c) if (Submarine.MainSub != null && Character.Controlled.Submarine == null)
{
if (c == null || c.Removed) { return; }
if (c.HasEquippedItem("clownmask") &&
c.HasEquippedItem("clowncostume"))
{
UnlockAchievement(c, "clowncostume");
}
if (Submarine.MainSub != null && c.Submarine == null)
{
float dist = 500 / Physics.DisplayToRealWorldRatio;
if (Vector2.DistanceSquared(c.WorldPosition, Submarine.MainSub.WorldPosition) >
dist * dist)
{ {
UnlockAchievement(c, "crewaway"); float dist = 500 / Physics.DisplayToRealWorldRatio;
if (Vector2.DistanceSquared(Character.Controlled.WorldPosition, Submarine.MainSub.WorldPosition) >
dist * dist)
{
UnlockAchievement(Character.Controlled, "crewaway");
}
} }
} }
} }
@@ -231,8 +214,7 @@ namespace Barotrauma
} }
if (character.HasEquippedItem("clownmask") && if (character.HasEquippedItem("clownmask") &&
character.HasEquippedItem("clowncostume") && character.HasEquippedItem("clowncostume"))
causeOfDeath.Killer != character)
{ {
UnlockAchievement(causeOfDeath.Killer, "killclown"); UnlockAchievement(causeOfDeath.Killer, "killclown");
} }
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace Barotrauma namespace Barotrauma
{ {
@@ -44,26 +43,6 @@ namespace Barotrauma
} }
} }
/// <summary>
/// Returns the name of the language in the respective language
/// </summary>
public static string GetTranslatedLanguageName(string language)
{
if (!textPacks.ContainsKey(language))
{
return language;
}
foreach (var textPack in textPacks[language])
{
if (textPack.Language == language)
{
return textPack.TranslatedName;
}
}
return language;
}
public static void LoadTextPacks(IEnumerable<ContentPackage> selectedContentPackages) public static void LoadTextPacks(IEnumerable<ContentPackage> selectedContentPackages)
{ {
availableLanguages.Clear(); availableLanguages.Clear();
@@ -101,26 +80,6 @@ namespace Barotrauma
} }
} }
public static bool ContainsTag(string textTag)
{
if (string.IsNullOrEmpty(textTag)) { return false; }
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!");
}
}
foreach (TextPack textPack in textPacks[Language])
{
if (textPack.Get(textTag) != null) { return true; }
}
return false;
}
public static string Get(string textTag, bool returnNull = false, string fallBackTag = null) public static string Get(string textTag, bool returnNull = false, string fallBackTag = null)
{ {
if (!textPacks.ContainsKey(Language)) if (!textPacks.ContainsKey(Language))
@@ -132,6 +91,8 @@ namespace Barotrauma
throw new Exception("No text packs available in English!"); throw new Exception("No text packs available in English!");
} }
} }
return false;
}
foreach (TextPack textPack in textPacks[Language]) foreach (TextPack textPack in textPacks[Language])
{ {
@@ -155,13 +116,7 @@ namespace Barotrauma
foreach (TextPack textPack in textPacks["English"]) foreach (TextPack textPack in textPacks["English"])
{ {
string text = textPack.Get(textTag); string text = textPack.Get(textTag);
if (text != null) if (text != null) return text;
{
#if DEBUG
DebugConsole.NewMessage("Text \"" + textTag + "\" not found for the language \"" + Language + "\". Using the English text \"" + text + "\" instead.");
#endif
return text;
}
} }
} }
@@ -412,6 +367,42 @@ namespace Barotrauma
return isCJK.IsMatch(text); return isCJK.IsMatch(text);
} }
#if DEBUG
public static void CheckForDuplicates(string lang)
{
if (!textPacks.ContainsKey(lang))
{
DebugConsole.ThrowError("No text packs available for the selected language (" + lang + ")!");
return;
}
int packIndex = 0;
foreach (TextPack textPack in textPacks[lang])
{
textPack.CheckForDuplicates(packIndex);
packIndex++;
}
}
public static void WriteToCSV()
{
string lang = "English";
if (!textPacks.ContainsKey(lang))
{
DebugConsole.ThrowError("No text packs available for the selected language (" + lang + ")!");
return;
}
int packIndex = 0;
foreach (TextPack textPack in textPacks[lang])
{
textPack.WriteToCSV(packIndex);
packIndex++;
}
}
#endif
#if DEBUG #if DEBUG
public static void CheckForDuplicates(string lang) public static void CheckForDuplicates(string lang)
{ {
@@ -10,11 +10,6 @@ namespace Barotrauma
{ {
public readonly string Language; public readonly string Language;
/// <summary>
/// The name of the language in the language this pack is written in
/// </summary>
public readonly string TranslatedName;
private Dictionary<string, List<string>> texts; private Dictionary<string, List<string>> texts;
private readonly string filePath; private readonly string filePath;
@@ -28,7 +23,6 @@ namespace Barotrauma
if (doc == null || doc.Root == null) return; if (doc == null || doc.Root == null) return;
Language = doc.Root.GetAttributeString("language", "Unknown"); Language = doc.Root.GetAttributeString("language", "Unknown");
TranslatedName = doc.Root.GetAttributeString("translatedname", Language);
foreach (XElement subElement in doc.Root.Elements()) foreach (XElement subElement in doc.Root.Elements())
{ {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6 -32
View File
@@ -2,42 +2,16 @@
v0.9.0.2 v0.9.0.2
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
- Automatically set the keybinds to AZERTY when French is selected as the display language. - Fixed a bug that caused frequent desync kicks when playing a multiplayer monster mission.
- Fixed an index out of range error in DoctorTutorial if proceeding too fast to the submarine.
- Fixes to missing translations and UI layout problems when using languages other than English.
- More readable font and a fix to some texts appearing slightly "clipped". - More readable font and a fix to some texts appearing slightly "clipped".
- Additions to the credits. - Additions to the credits.
- Minor tweaks to subs and shuttles.
- Added propeller damage to the shuttle engine.
- Increased maximum voice chat volume.
- Directional voice chat is enabled by default.
- Display the language names in the respective languages in the initial language selection screen.
- Playing the splash screens or tutorial videos doesn't require libvlc and libvlccore to be installed
on the user's system in the Linux version anymore.
Bugfixes:
- Fixed a bug that caused frequent desync kicks when playing a multiplayer monster mission.
- Fixed private servers showing up in the server list.
- Fixed an index out of range error in DoctorTutorial if proceeding too fast to the submarine.
- Fixed report messages not going through to some clients when there are multiple clients on the server.
- Fixed players not seeing reports made by bots in multiplayer.
- Fixes to missing translations and UI layout problems when using languages other than English.
- Miscellaneous crew AI fixes and improvements.
- Fixed find safety AI objective not working properly.
- Fixed bots loading only half of the target items in the contain item objective. - Fixed bots loading only half of the target items in the contain item objective.
- Fixed directional sonar indicators not being displayed on the sonar monitor. - Minor tweaks to subs and shuttles.
- Fixed floating ice chunks occasionally spawning too close to the start of a level, causing them to clip - Fixed find safety AI objective not working properly.
through the submarin and/or the outpost. - Miscellaneous crew AI fixes and improvements.
- Fixed incorrect reward amount in the "Chemical shipment" description. - Fixed incorrect reward amount in the "Chemical shipment" description.
- Fixed inability to use the underwater scooters with LMB.
- Fixes to UI layouts on 4K resolution.
- Fixed unnecessary silence at the end of the "Objective Complete" music track.
- Fixed ruin walls being almost impossible to cut from inside the ruins.
- Fixed the "report leaks" button being highlighted inside ruins.
- Fixes to wall colliders.
- Fixed "Pause on focus lost" setting being always treated as if being enabled.
- Fixed dedicated server overwriting existing crash reports.
- Fixed save time being displayed in UNIX time in the right-hand panel in the campaign setup UI.
- Fixed "Praise the Honkmother" and "Extravehicular activity" achievements not unlocking in multiplayer.
- Fixed "No fun allowed" achievement being possible to unlock by committing suicide while wearing a clown costume.
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.9.0.1 v0.9.0.1
+3 -3
View File
@@ -9,13 +9,13 @@
savedebugconsolelogs="false" savedebugconsolelogs="false"
enablesplashscreen="true" enablesplashscreen="true"
usesteammatchmaking="true" usesteammatchmaking="true"
quickstartsub="Humpback" quickstartsub = "Humpback"
requiresteamauthentication="true"> requiresteamauthentication="true">
<graphicsmode displaymode="BorderlessWindowed" vsync="true" /> <graphicsmode displaymode="BorderlessWindowed" vsync="true" />
<graphicssettings <graphicssettings
particlelimit="1500" particlelimit="1500"
lightmapscale="1.0" lightmapscale="0.5"
specularity="false" specularity="true"
chromaticaberration="true" chromaticaberration="true"
losmode="Transparent" losmode="Transparent"
hudscale="1" hudscale="1"
+4 -4
View File
@@ -43,12 +43,12 @@ namespace Facepunch.Steamworks
// //
//kind of a hack: //kind of a hack:
//use an invalid version number to hide private servers from the server list. //use an outdated version number to hide private servers from the server list.
//couldn't find a way to do it otherwise - using 1 as the eServerMode doesn't //couldn't find a way to do it otherwise - using 1 as the eServerMode doesn't
//seem to work, the server info is still returned by the API calls //seem to work, the server info is still returned by the API calls
string versionString = isPublic ? init.VersionString : "-1"; string versionString = isPublic ? init.VersionString : "0.0.0.0";
if ( !native.InitServer( this, ipaddress, init.SteamPort, init.GamePort, init.QueryPort, isPublic ? (init.Secure ? 3 : 2) : 1, if ( !native.InitServer( this, ipaddress, init.SteamPort, init.GamePort, init.QueryPort, init.Secure ? 3 : 2,
versionString) ) isPublic ? init.VersionString : "0.0.0.0" ) )
{ {
native.Dispose(); native.Dispose();
native = null; native = null;