Unstable 0.17.10.0
This commit is contained in:
@@ -551,8 +551,8 @@ namespace Barotrauma
|
||||
{
|
||||
bool hasOwner = inc.ReadBoolean();
|
||||
int ownerId = hasOwner ? inc.ReadByte() : -1;
|
||||
int balance = hasOwner ? inc.ReadInt32() : -1;
|
||||
int rewardDistribution = hasOwner ? inc.ReadRangedInteger(0, 100) : -1;
|
||||
int balance = inc.ReadInt32();
|
||||
int rewardDistribution = inc.ReadRangedInteger(0, 100);
|
||||
byte teamID = inc.ReadByte();
|
||||
bool hasAi = inc.ReadBoolean();
|
||||
Identifier infoSpeciesName = inc.ReadIdentifier();
|
||||
|
||||
+18
-7
@@ -197,6 +197,14 @@ namespace Barotrauma.Transition
|
||||
DebugConsole.ThrowError("There was an error transferring mods", t2.Exception.GetInnermost());
|
||||
}
|
||||
ContentPackageManager.LocalPackages.Refresh();
|
||||
if (t2.TryGetResult(out string[] modsToEnable))
|
||||
{
|
||||
var newRegular = ContentPackageManager.EnabledPackages.Regular.ToList();
|
||||
newRegular.AddRange(ContentPackageManager.LocalPackages.Regular
|
||||
.Where(r => modsToEnable.Contains(r.Dir.CleanUpPathCrossPlatform(correctFilenameCase: false))));
|
||||
newRegular = newRegular.Distinct().ToList();
|
||||
ContentPackageManager.EnabledPackages.SetRegular(newRegular);
|
||||
}
|
||||
createSubMsgBox(TextManager.Get("Ugc.TransferComplete"), closable: true);
|
||||
});
|
||||
msgBox.Close();
|
||||
@@ -287,19 +295,20 @@ namespace Barotrauma.Transition
|
||||
&& !File.Exists(Path.Combine(folderName, readmeName));
|
||||
}
|
||||
|
||||
private static async Task TransferMods(Dictionary<string, GUITickBox> pathTickboxMap)
|
||||
private static async Task<string[]> TransferMods(Dictionary<string, GUITickBox> pathTickboxMap)
|
||||
{
|
||||
//WriteReadme(oldSubsPath); //can't do this because the old submarine discovery code is borked
|
||||
WriteReadme(oldModsPath);
|
||||
await Task.WhenAll(pathTickboxMap.Select(TransferMod));
|
||||
var modsToEnable = (await Task.WhenAll(pathTickboxMap.Select(TransferMod))).OfType<string>().ToArray();
|
||||
return modsToEnable;
|
||||
}
|
||||
|
||||
private static Task TransferMod(KeyValuePair<string, GUITickBox> kvp)
|
||||
private static Task<string?> TransferMod(KeyValuePair<string, GUITickBox> kvp)
|
||||
=> TransferMod(kvp.Key, kvp.Value);
|
||||
|
||||
private static async Task TransferMod(string path, GUITickBox tickbox)
|
||||
private static async Task<string?> TransferMod(string path, GUITickBox tickbox)
|
||||
{
|
||||
if (!tickbox.Selected) { return; }
|
||||
if (!tickbox.Selected) { return null; }
|
||||
string dirName = Path.GetFileNameWithoutExtension(path);
|
||||
string destPath = Path.Combine(ContentPackage.LocalModsDir, dirName);
|
||||
|
||||
@@ -344,13 +353,15 @@ namespace Barotrauma.Transition
|
||||
Directory.CreateDirectory(destPath);
|
||||
File.Copy(path, Path.Combine(destPath, $"{dirName}.{(isSub ? "sub" : "xml")}"));
|
||||
modProject.Save(Path.Combine(destPath, ContentPackage.FileListFileName));
|
||||
|
||||
await Task.Yield();
|
||||
|
||||
return destPath.CleanUpPathCrossPlatform(correctFilenameCase: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//copying a mod: we have a neat method for that!
|
||||
await SteamManager.Workshop.CopyDirectory(path, Path.GetFileName(path), path, destPath);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void DebugDrawHUD(SpriteBatch spriteBatch, int y)
|
||||
public void DebugDrawHUD(SpriteBatch spriteBatch, float y)
|
||||
{
|
||||
foreach (ScriptedEvent scriptedEvent in activeEvents.Where(ev => !ev.IsFinished && ev is ScriptedEvent).Cast<ScriptedEvent>())
|
||||
{
|
||||
@@ -50,20 +50,26 @@ namespace Barotrauma
|
||||
float relativeMaxMonsterStrength = theoreticalMaxMonsterStrength * (GameMain.GameSession?.LevelData?.Difficulty ?? 0f) / 100;
|
||||
float absoluteMonsterStrength = monsterStrength / theoreticalMaxMonsterStrength;
|
||||
float relativeMonsterStrength = monsterStrength / relativeMaxMonsterStrength;
|
||||
GUI.DrawString(spriteBatch, new Vector2(10, y), "EventManager", Color.White, Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 20), "Event cooldown: " + (int)Math.Max(eventCoolDown, 0), Color.White, Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 35), "Current intensity: " + (int)Math.Round(currentIntensity * 100), Color.Lerp(Color.White, GUIStyle.Red, currentIntensity), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 50), "Target intensity: " + (int)Math.Round(targetIntensity * 100), Color.Lerp(Color.White, GUIStyle.Red, targetIntensity), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 65), "Crew health: " + (int)Math.Round(avgCrewHealth * 100), Color.Lerp(GUIStyle.Red, GUIStyle.Green, avgCrewHealth), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 80), "Hull integrity: " + (int)Math.Round(avgHullIntegrity * 100), Color.Lerp(GUIStyle.Red, GUIStyle.Green, avgHullIntegrity), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 95), "Flooding amount: " + (int)Math.Round(floodingAmount * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, floodingAmount), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 110), "Fire amount: " + (int)Math.Round(fireAmount * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, fireAmount), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 125), "Enemy danger: " + (int)Math.Round(enemyDanger * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, enemyDanger), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 140), "Current monster strength (total): " + (int)Math.Round(monsterStrength), Color.Lerp(GUIStyle.Green, GUIStyle.Red, relativeMonsterStrength), Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 155), "Main events: " + (int)Math.Round(CumulativeMonsterStrengthMain), Color.White, Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 170), "Ruin events: " + (int)Math.Round(CumulativeMonsterStrengthRuins), Color.White, Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y + 185), "Wreck events: " + (int)Math.Round(CumulativeMonsterStrengthWrecks), Color.White, Color.Black * 0.6f, 0, GUIStyle.SmallFont);
|
||||
GUI.DrawString(spriteBatch, new Vector2(10, y), "EventManager", Color.White, backgroundColor: Color.Black * 0.6f, font: GUIStyle.SmallFont);
|
||||
DrawString("Event cooldown", Math.Max(eventCoolDown, 0), Color.White, spacing: 20);
|
||||
DrawString("Current intensity", Math.Round(currentIntensity * 100), Color.Lerp(Color.White, GUIStyle.Red, currentIntensity));
|
||||
DrawString("Target intensity", Math.Round(targetIntensity * 100), Color.Lerp(Color.White, GUIStyle.Red, targetIntensity));
|
||||
DrawString("Crew health", Math.Round(avgCrewHealth * 100), Color.Lerp(GUIStyle.Red, GUIStyle.Green, avgCrewHealth));
|
||||
DrawString("Hull integrity", Math.Round(avgHullIntegrity * 100), Color.Lerp(GUIStyle.Red, GUIStyle.Green, avgHullIntegrity));
|
||||
DrawString("Flooding amount", Math.Round(floodingAmount * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, floodingAmount));
|
||||
DrawString("Fire amount", Math.Round(fireAmount * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, fireAmount));
|
||||
DrawString("Enemy danger", Math.Round(enemyDanger * 100), Color.Lerp(GUIStyle.Green, GUIStyle.Red, enemyDanger));
|
||||
DrawString("Current monster strength (total)", Math.Round(monsterStrength), Color.Lerp(GUIStyle.Green, GUIStyle.Red, relativeMonsterStrength));
|
||||
DrawString("Main events", Math.Round(CumulativeMonsterStrengthMain), Color.White);
|
||||
DrawString("Ruin events", Math.Round(CumulativeMonsterStrengthRuins), Color.White);
|
||||
DrawString("Wreck events", Math.Round(CumulativeMonsterStrengthWrecks), Color.White);
|
||||
|
||||
void DrawString(string text, double value, Color textColor, int spacing = 15)
|
||||
{
|
||||
y += GUI.AdjustForTextScale(spacing);
|
||||
GUI.DrawString(spriteBatch, new Vector2(15, y), $"{text}: {(int)value}", textColor, backgroundColor: Color.Black * 0.6f, font: GUIStyle.SmallFont);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (PlayerInput.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) &&
|
||||
@@ -89,7 +95,7 @@ namespace Barotrauma
|
||||
lastIntensityUpdate = (float)Timing.TotalTime;
|
||||
}
|
||||
|
||||
Rectangle graphRect = new Rectangle(15, y + 240, (int)(200 * GUI.xScale), (int)(100 * GUI.yScale));
|
||||
Rectangle graphRect = new Rectangle(15, (int)(y + GUI.AdjustForTextScale(55)), (int)(200 * GUI.xScale), (int)(100 * GUI.yScale));
|
||||
bool isGraphHovered = graphRect.Contains(PlayerInput.MousePosition);
|
||||
bool leftMousePressed = PlayerInput.PrimaryMouseButtonDown() || PlayerInput.PrimaryMouseButtonHeld();
|
||||
bool rightMousePressed = PlayerInput.SecondaryMouseButtonHeld() || PlayerInput.SecondaryMouseButtonDown();
|
||||
@@ -104,7 +110,9 @@ namespace Barotrauma
|
||||
Color intensityColor = Color.Lerp(Color.White, GUIStyle.Red, currentIntensity);
|
||||
if (isGraphHovered || isGraphSelected)
|
||||
{
|
||||
graphRect.Size = new Point(GameMain.GraphicsWidth - 30, (int)(GameMain.GraphicsHeight * 0.35f));
|
||||
int padding = 15;
|
||||
int graphHeight = Math.Min((int)(GameMain.GraphicsHeight * 0.35f), GameMain.GraphicsHeight - (graphRect.Top + 3 * padding));
|
||||
graphRect.Size = new Point(GameMain.GraphicsWidth - 2 * padding, graphHeight);
|
||||
intensityColor = Color.Red;
|
||||
GUI.DrawRectangle(spriteBatch, graphRect, Color.Black * 0.95f, isFilled: true);
|
||||
}
|
||||
@@ -173,56 +181,58 @@ namespace Barotrauma
|
||||
y += yStep;
|
||||
}
|
||||
int x = graphRect.X;
|
||||
float adjustedYStep = GUI.AdjustForTextScale(15);
|
||||
if (isCrewAway && crewAwayDuration < settings.FreezeDurationWhenCrewAway)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), "Events frozen (crew away from sub): " + ToolBox.SecondsToReadableTime(settings.FreezeDurationWhenCrewAway - crewAwayDuration), Color.LightGreen * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
else if (crewAwayResetTimer > 0.0f)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), "Events frozen (crew just returned to the sub): " + ToolBox.SecondsToReadableTime(crewAwayResetTimer), Color.LightGreen * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
else if (eventCoolDown > 0.0f)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), "Event cooldown active: " + ToolBox.SecondsToReadableTime(eventCoolDown), Color.LightGreen * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
else if (currentIntensity > eventThreshold)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y),
|
||||
"Intensity too high for new events: " + (int)(currentIntensity * 100) + "%/" + (int)(eventThreshold * 100) + "%", Color.LightGreen * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
|
||||
adjustedYStep = GUI.AdjustForTextScale(12);
|
||||
foreach (EventSet eventSet in pendingEventSets)
|
||||
{
|
||||
if (Submarine.MainSub == null) { break; }
|
||||
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), "New event (ID " + eventSet.Identifier + ") after: ", Color.Orange * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
|
||||
if (eventSet.PerCave)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), " submarine near cave", Color.Orange * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
if (eventSet.PerWreck)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), " submarine near the wreck", Color.Orange * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
if (eventSet.PerRuin)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), " submarine near the ruins", Color.Orange * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
if (roundDuration < eventSet.MinMissionTime)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y),
|
||||
" " + (int) (eventSet.MinDistanceTraveled * 100.0f) + "% travelled (current: " + (int) (distanceTraveled * 100.0f) + " %)",
|
||||
((Submarine.MainSub == null || distanceTraveled < eventSet.MinDistanceTraveled) ? Color.Lerp(GUIStyle.Yellow, GUIStyle.Red, eventSet.MinDistanceTraveled - distanceTraveled) : GUIStyle.Green) * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
|
||||
if (CurrentIntensity < eventSet.MinIntensity || CurrentIntensity > eventSet.MaxIntensity)
|
||||
@@ -230,7 +240,7 @@ namespace Barotrauma
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y),
|
||||
" intensity between " + eventSet.MinIntensity.FormatDoubleDecimal() + " and " + eventSet.MaxIntensity.FormatDoubleDecimal(),
|
||||
Color.Orange * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
y += 12;
|
||||
y += adjustedYStep;
|
||||
}
|
||||
|
||||
if (roundDuration < eventSet.MinMissionTime)
|
||||
@@ -240,7 +250,7 @@ namespace Barotrauma
|
||||
Color.Lerp(GUIStyle.Yellow, GUIStyle.Red, (eventSet.MinMissionTime - roundDuration)), null, 0, GUIStyle.SmallFont);
|
||||
}
|
||||
|
||||
y += 15;
|
||||
y += GUI.AdjustForTextScale(15);
|
||||
|
||||
if (y > GameMain.GraphicsHeight * 0.9f)
|
||||
{
|
||||
@@ -252,11 +262,12 @@ namespace Barotrauma
|
||||
GUI.DrawString(spriteBatch, new Vector2(x, y), "Current events: ", Color.White * 0.9f, null, 0, GUIStyle.SmallFont);
|
||||
y += yStep;
|
||||
|
||||
adjustedYStep = GUI.AdjustForTextScale(18);
|
||||
foreach (Event ev in activeEvents.Where(ev => !ev.IsFinished || PlayerInput.IsShiftDown()))
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(x + 5, y), ev.ToString(), (!ev.IsFinished ? Color.White : Color.Red) * 0.8f, null, 0, GUIStyle.SmallFont);
|
||||
|
||||
Rectangle rect = new Rectangle(new Point(x + 5, y), GUIStyle.SmallFont.MeasureString(ev.ToString()).ToPoint());
|
||||
Rectangle rect = new Rectangle(new Point(x + 5, (int)y), GUIStyle.SmallFont.MeasureString(ev.ToString()).ToPoint());
|
||||
|
||||
Rectangle outlineRect = new Rectangle(rect.Location, rect.Size);
|
||||
outlineRect.Inflate(4, 4);
|
||||
@@ -281,7 +292,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
y += 18;
|
||||
y += adjustedYStep;
|
||||
if (y > GameMain.GraphicsHeight * 0.9f)
|
||||
{
|
||||
y = graphRect.Bottom + yStep * 2;
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace Barotrauma
|
||||
public static int IntScale(float f) => (int)(f * Scale);
|
||||
public static int IntScaleFloor(float f) => (int)Math.Floor(f * Scale);
|
||||
public static int IntScaleCeiling(float f) => (int)Math.Ceiling(f * Scale);
|
||||
public static float AdjustForTextScale(float f) => f * GameSettings.CurrentConfig.Graphics.TextScale;
|
||||
public static float HorizontalAspectRatio => GameMain.GraphicsWidth / (float)GameMain.GraphicsHeight;
|
||||
public static float VerticalAspectRatio => GameMain.GraphicsHeight / (float)GameMain.GraphicsWidth;
|
||||
public static float RelativeHorizontalAspectRatio => HorizontalAspectRatio / (ReferenceResolution.X / ReferenceResolution.Y);
|
||||
@@ -299,15 +300,16 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
float startY = 10.0f;
|
||||
if (GameMain.ShowFPS || GameMain.DebugDraw || GameMain.ShowPerf)
|
||||
{
|
||||
float y = 10.0f;
|
||||
float y = startY;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"FPS: " + Math.Round(GameMain.PerformanceCounter.AverageFramesPerSecond),
|
||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
if (GameMain.GameSession != null && Timing.TotalTime > GameMain.GameSession.RoundStartTime + 1.0)
|
||||
{
|
||||
y += GameSettings.CurrentConfig.Graphics.TextScale * 15.0f;
|
||||
y += AdjustForTextScale(15) * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
$"Physics: {GameMain.CurrentUpdateRate}",
|
||||
(GameMain.CurrentUpdateRate < Timing.FixedUpdateRate) ? Color.Red : Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
@@ -316,83 +318,88 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.ShowPerf)
|
||||
{
|
||||
int x = 400;
|
||||
int y = 10;
|
||||
float x = 400;
|
||||
float y = startY;
|
||||
DrawString(spriteBatch, new Vector2(x, y),
|
||||
"Draw - Avg: " + GameMain.PerformanceCounter.DrawTimeGraph.Average().ToString("0.00") + " ms" +
|
||||
" Max: " + GameMain.PerformanceCounter.DrawTimeGraph.LargestValue().ToString("0.00") + " ms",
|
||||
GUIStyle.Green, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
GameMain.PerformanceCounter.DrawTimeGraph.Draw(spriteBatch, new Rectangle(x, y, 170, 50), color: GUIStyle.Green);
|
||||
y += 50;
|
||||
y += 15 * yScale;
|
||||
GameMain.PerformanceCounter.DrawTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: GUIStyle.Green);
|
||||
y += 50 * yScale;
|
||||
|
||||
DrawString(spriteBatch, new Vector2(x, y),
|
||||
"Update - Avg: " + GameMain.PerformanceCounter.UpdateTimeGraph.Average().ToString("0.00") + " ms" +
|
||||
" Max: " + GameMain.PerformanceCounter.UpdateTimeGraph.LargestValue().ToString("0.00") + " ms",
|
||||
Color.LightBlue, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
GameMain.PerformanceCounter.UpdateTimeGraph.Draw(spriteBatch, new Rectangle(x, y, 170, 50), color: Color.LightBlue);
|
||||
y += 50;
|
||||
y += 15 * yScale;
|
||||
GameMain.PerformanceCounter.UpdateTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: Color.LightBlue);
|
||||
y += 50 * yScale;
|
||||
foreach (string key in GameMain.PerformanceCounter.GetSavedIdentifiers)
|
||||
{
|
||||
float elapsedMillisecs = GameMain.PerformanceCounter.GetAverageElapsedMillisecs(key);
|
||||
DrawString(spriteBatch, new Vector2(x, y),
|
||||
key + ": " + elapsedMillisecs.ToString("0.00"),
|
||||
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += 15 * yScale;
|
||||
foreach (string childKey in GameMain.PerformanceCounter.GetSavedPartialIdentifiers(key))
|
||||
{
|
||||
elapsedMillisecs = GameMain.PerformanceCounter.GetPartialAverageElapsedMillisecs(key, childKey);
|
||||
DrawString(spriteBatch, new Vector2(x + 15, y),
|
||||
childKey + ": " + elapsedMillisecs.ToString("0.00"),
|
||||
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += 15 * yScale;
|
||||
}
|
||||
}
|
||||
|
||||
if (Powered.Grids != null)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(x, y), "Grids: " + Powered.Grids.Count, Color.LightGreen, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
y += 15 * yScale;
|
||||
}
|
||||
|
||||
if (Settings.EnableDiagnostics)
|
||||
{
|
||||
x += 20;
|
||||
x += 20 * xScale;
|
||||
DrawString(spriteBatch, new Vector2(x, y), "ContinuousPhysicsTime: " + GameMain.World.ContinuousPhysicsTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.ContinuousPhysicsTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 15), "ControllersUpdateTime: " + GameMain.World.ControllersUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.ControllersUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 30), "AddRemoveTime: " + GameMain.World.AddRemoveTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.AddRemoveTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 45), "NewContactsTime: " + GameMain.World.NewContactsTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.NewContactsTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 60), "ContactsUpdateTime: " + GameMain.World.ContactsUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.ContactsUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 75), "SolveUpdateTime: " + GameMain.World.SolveUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.SolveUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 15 * yScale), "ControllersUpdateTime: " + GameMain.World.ControllersUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.ControllersUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 30 * yScale), "AddRemoveTime: " + GameMain.World.AddRemoveTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.AddRemoveTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 45 * yScale), "NewContactsTime: " + GameMain.World.NewContactsTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.NewContactsTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 60 * yScale), "ContactsUpdateTime: " + GameMain.World.ContactsUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.ContactsUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
DrawString(spriteBatch, new Vector2(x, y + 75 * yScale), "SolveUpdateTime: " + GameMain.World.SolveUpdateTime.TotalMilliseconds, Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)GameMain.World.SolveUpdateTime.TotalMilliseconds / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
}
|
||||
}
|
||||
|
||||
if (GameMain.DebugDraw && !Submarine.Unloading && !(Screen.Selected is RoundSummaryScreen))
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 25),
|
||||
float y = startY + 15 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Physics: " + GameMain.World.UpdateTime,
|
||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
DrawString(spriteBatch, new Vector2(10, 40),
|
||||
y += 15 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
$"Bodies: {GameMain.World.BodyList.Count} ({GameMain.World.BodyList.Count(b => b != null && b.Awake && b.Enabled)} awake, {GameMain.World.BodyList.Count(b => b != null && b.Awake && b.BodyType == BodyType.Dynamic && b.Enabled)} dynamic)",
|
||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
if (Screen.Selected.Cam != null)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 55),
|
||||
y += 15 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint() + ", zoom: " + Screen.Selected.Cam.Zoom,
|
||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
}
|
||||
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 70),
|
||||
y += 15 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
}
|
||||
|
||||
DrawString(spriteBatch, new Vector2(10, 90),
|
||||
y += 20 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Particle count: " + GameMain.ParticleManager.ParticleCount + "/" + GameMain.ParticleManager.MaxParticles,
|
||||
Color.Lerp(GUIStyle.Green, GUIStyle.Red, (GameMain.ParticleManager.ParticleCount / (float)GameMain.ParticleManager.MaxParticles)), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
@@ -401,28 +408,29 @@ namespace Barotrauma
|
||||
loadedSpritesText = "Loaded sprites: " + Sprite.LoadedSprites.Count() + "\n(" + Sprite.LoadedSprites.Select(s => s.FilePath).Distinct().Count() + " unique textures)";
|
||||
loadedSpritesUpdateTime = DateTime.Now + new TimeSpan(0, 0, seconds: 5);
|
||||
}
|
||||
DrawString(spriteBatch, new Vector2(10, 115), loadedSpritesText, Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 25 * yScale;
|
||||
DrawString(spriteBatch, new Vector2(10, y), loadedSpritesText, Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
if (debugDrawSounds)
|
||||
{
|
||||
int y = 0;
|
||||
DrawString(spriteBatch, new Vector2(500, y),
|
||||
float soundTextY = 0;
|
||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||
"Sounds (Ctrl+S to hide): ", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
soundTextY += 15 * yScale;
|
||||
|
||||
DrawString(spriteBatch, new Vector2(500, y),
|
||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||
"Current playback amplitude: " + GameMain.SoundManager.PlaybackAmplitude.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
y += 15;
|
||||
soundTextY += 15 * yScale;
|
||||
|
||||
DrawString(spriteBatch, new Vector2(500, y),
|
||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||
"Compressed dynamic range gain: " + GameMain.SoundManager.CompressionDynamicRangeGain.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
|
||||
y += 15;
|
||||
soundTextY += 15 * yScale;
|
||||
|
||||
DrawString(spriteBatch, new Vector2(500, y),
|
||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||
"Loaded sounds: " + GameMain.SoundManager.LoadedSoundCount + " (" + GameMain.SoundManager.UniqueLoadedSoundCount + " unique)", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
soundTextY += 15 * yScale;
|
||||
|
||||
for (int i = 0; i < SoundManager.SOURCE_COUNT; i++)
|
||||
{
|
||||
@@ -441,7 +449,7 @@ namespace Barotrauma
|
||||
#if DEBUG
|
||||
if (PlayerInput.GetKeyboardState.IsKeyDown(Keys.G))
|
||||
{
|
||||
if (PlayerInput.MousePosition.Y >= y && PlayerInput.MousePosition.Y <= y + 12)
|
||||
if (PlayerInput.MousePosition.Y >= soundTextY && PlayerInput.MousePosition.Y <= soundTextY + 12)
|
||||
{
|
||||
GameMain.SoundManager.DebugSource(i);
|
||||
}
|
||||
@@ -470,8 +478,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
DrawString(spriteBatch, new Vector2(500, y), soundStr, clr, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
DrawString(spriteBatch, new Vector2(500, soundTextY), soundStr, clr, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
soundTextY += 15 * yScale;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -481,20 +489,22 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
|
||||
y += 185 * yScale;
|
||||
if (debugDrawEvents)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 300),
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Ctrl+E to hide EventManager debug info", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
GameMain.GameSession?.EventManager?.DebugDrawHUD(spriteBatch, 315);
|
||||
GameMain.GameSession?.EventManager?.DebugDrawHUD(spriteBatch, y + 15 * yScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 300),
|
||||
DrawString(spriteBatch, new Vector2(10, y),
|
||||
"Ctrl+E to show EventManager debug info", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
}
|
||||
|
||||
if (GameMain.GameSession?.GameMode is CampaignMode campaignMode)
|
||||
{
|
||||
// TODO: TEST THIS
|
||||
if (debugDrawMetadata)
|
||||
{
|
||||
string text = "Ctrl+M to hide campaign metadata debug info\n\n" +
|
||||
@@ -502,10 +512,10 @@ namespace Barotrauma
|
||||
$"Ctrl+2 to {(string.IsNullOrWhiteSpace(ignoredMetadataInfo[1]) ? "hide" : "show")} faction reputations, \n" +
|
||||
$"Ctrl+3 to {(string.IsNullOrWhiteSpace(ignoredMetadataInfo[2]) ? "hide" : "show")} upgrade levels, \n" +
|
||||
$"Ctrl+4 to {(string.IsNullOrWhiteSpace(ignoredMetadataInfo[3]) ? "hide" : "show")} upgrade prices";
|
||||
var (x, y) = GUIStyle.SmallFont.MeasureString(text);
|
||||
Vector2 pos = new Vector2(GameMain.GraphicsWidth - (x + 10), 300);
|
||||
Vector2 textSize = GUIStyle.SmallFont.MeasureString(text);
|
||||
Vector2 pos = new Vector2(GameMain.GraphicsWidth - (textSize.X + 10), 300);
|
||||
DrawString(spriteBatch, pos, text, Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
pos.Y += y + 8;
|
||||
pos.Y += textSize.Y + 8;
|
||||
campaignMode.CampaignMetadata?.DebugDraw(spriteBatch, pos, debugDrawMetadataOffset, ignoredMetadataInfo);
|
||||
}
|
||||
else
|
||||
|
||||
+22
-19
@@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Tutorials
|
||||
{
|
||||
@@ -14,8 +13,6 @@ namespace Barotrauma.Tutorials
|
||||
private float shakeAmount = 20f;
|
||||
|
||||
// Room 2
|
||||
private MotionSensor captain_equipmentObjectiveSensor;
|
||||
private ItemContainer captain_equipmentCabinet;
|
||||
private Door captain_firstDoor;
|
||||
private LightComponent captain_firstDoorLight;
|
||||
|
||||
@@ -29,7 +26,6 @@ namespace Barotrauma.Tutorials
|
||||
// Submarine
|
||||
private MotionSensor captain_enteredSubmarineSensor;
|
||||
private Steering captain_navConsole;
|
||||
private CustomInterface captain_navConsoleCustomInterface;
|
||||
private Sonar captain_sonar;
|
||||
private Item captain_statusMonitor;
|
||||
private Character captain_security;
|
||||
@@ -136,8 +132,6 @@ namespace Barotrauma.Tutorials
|
||||
captain_steerIconColor = steerOrder.Color;
|
||||
|
||||
// Room 2
|
||||
captain_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_equipmentobjectivesensor")).GetComponent<MotionSensor>();
|
||||
captain_equipmentCabinet = Item.ItemList.Find(i => i.HasTag("captain_equipmentcabinet")).GetComponent<ItemContainer>();
|
||||
captain_firstDoor = Item.ItemList.Find(i => i.HasTag("captain_firstdoor")).GetComponent<Door>();
|
||||
captain_firstDoorLight = Item.ItemList.Find(i => i.HasTag("captain_firstdoorlight")).GetComponent<LightComponent>();
|
||||
|
||||
@@ -148,9 +142,11 @@ namespace Barotrauma.Tutorials
|
||||
captain_medicSpawnPos = Item.ItemList.Find(i => i.HasTag("captain_medicspawnpos")).WorldPosition;
|
||||
tutorial_submarineDoor = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent<Door>();
|
||||
tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent<LightComponent>();
|
||||
var medicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("medicaldoctor"));
|
||||
var medicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("medicaldoctor"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
captain_medic = Character.Create(medicInfo, captain_medicSpawnPos, "medicaldoctor");
|
||||
captain_medic.TeamID = CharacterTeamType.Team1;
|
||||
captain_medic.GiveJobItems(null);
|
||||
captain_medic.CanSpeak = captain_medic.AIController.Enabled = false;
|
||||
SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false);
|
||||
@@ -159,7 +155,6 @@ namespace Barotrauma.Tutorials
|
||||
captain_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("captain_enteredsubmarinesensor")).GetComponent<MotionSensor>();
|
||||
tutorial_submarineReactor = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent<Reactor>();
|
||||
captain_navConsole = Item.ItemList.Find(i => i.HasTag("command")).GetComponent<Steering>();
|
||||
captain_navConsoleCustomInterface = Item.ItemList.Find(i => i.HasTag("command")).GetComponent<CustomInterface>();
|
||||
captain_sonar = captain_navConsole.Item.GetComponent<Sonar>();
|
||||
captain_statusMonitor = Item.ItemList.Find(i => i.HasTag("captain_statusmonitor"));
|
||||
|
||||
@@ -171,19 +166,25 @@ namespace Barotrauma.Tutorials
|
||||
SetDoorAccess(tutorial_lockedDoor_1, null, false);
|
||||
SetDoorAccess(tutorial_lockedDoor_2, null, false);
|
||||
|
||||
var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("mechanic"));
|
||||
var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("mechanic"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
captain_mechanic = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job?.Prefab, Submarine.MainSub).WorldPosition, "mechanic");
|
||||
captain_mechanic.TeamID = CharacterTeamType.Team1;
|
||||
captain_mechanic.GiveJobItems();
|
||||
|
||||
var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("securityofficer"));
|
||||
var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("securityofficer"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
captain_security = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job?.Prefab, Submarine.MainSub).WorldPosition, "securityofficer");
|
||||
captain_security.TeamID = CharacterTeamType.Team1;
|
||||
captain_security.GiveJobItems();
|
||||
|
||||
var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"));
|
||||
var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
captain_engineer = Character.Create(engineerInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job?.Prefab, Submarine.MainSub).WorldPosition, "engineer");
|
||||
captain_engineer.TeamID = CharacterTeamType.Team1;
|
||||
captain_engineer.GiveJobItems();
|
||||
|
||||
captain_mechanic.CanSpeak = captain_security.CanSpeak = captain_engineer.CanSpeak = false;
|
||||
@@ -252,6 +253,9 @@ namespace Barotrauma.Tutorials
|
||||
yield return new WaitForSeconds(4f, false);
|
||||
TriggerTutorialSegment(3, GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Command));
|
||||
GameMain.GameSession.CrewManager.AddCharacter(captain_engineer);
|
||||
tutorial_submarineReactor.CanBeSelected = true;
|
||||
//recreate autonomous objectives to make sure the engineer didn't abandon the operate reactor objective because it was not selectable
|
||||
(captain_engineer.AIController as HumanAIController).ObjectiveManager.CreateAutonomousObjectives();
|
||||
do
|
||||
{
|
||||
yield return null;
|
||||
@@ -261,7 +265,6 @@ namespace Barotrauma.Tutorials
|
||||
}
|
||||
while (!HasOrder(captain_engineer, "operatereactor", "powerup"));
|
||||
RemoveCompletedObjective(3);
|
||||
tutorial_submarineReactor.CanBeSelected = true;
|
||||
do { yield return null; } while (!tutorial_submarineReactor.IsActive); // Wait until reactor on
|
||||
TriggerTutorialSegment(4);
|
||||
while (ContentRunning) yield return null;
|
||||
|
||||
+19
-10
@@ -4,8 +4,6 @@ using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Tutorials
|
||||
{
|
||||
@@ -130,24 +128,32 @@ namespace Barotrauma.Tutorials
|
||||
var patientHull2 = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "airlock").CurrentHull;
|
||||
medBay = WayPoint.WayPointList.Find(wp => wp.IdCardDesc == "medbay").CurrentHull;
|
||||
|
||||
var assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("assistant"));
|
||||
var assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("assistant"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
patient1 = Character.Create(assistantInfo, patientHull1.WorldPosition, "1");
|
||||
patient1.TeamID = CharacterTeamType.Team1;
|
||||
patient1.GiveJobItems(null);
|
||||
patient1.CanSpeak = false;
|
||||
patient1.Params.Health.BurnReduction = 0;
|
||||
patient1.AddDamage(patient1.WorldPosition, new List<Affliction>() { new Affliction(AfflictionPrefab.Burn, 15.0f) }, stun: 0, playSound: false);
|
||||
patient1.AIController.Enabled = false;
|
||||
|
||||
assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("assistant"));
|
||||
assistantInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("assistant"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
patient2 = Character.Create(assistantInfo, patientHull2.WorldPosition, "2");
|
||||
patient2.TeamID = CharacterTeamType.Team1;
|
||||
patient2.GiveJobItems(null);
|
||||
patient2.CanSpeak = false;
|
||||
patient2.AIController.Enabled = false;
|
||||
|
||||
var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"));
|
||||
var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
var subPatient1 = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job?.Prefab, Submarine.MainSub).WorldPosition, "3");
|
||||
subPatient1.TeamID = CharacterTeamType.Team1;
|
||||
subPatient1.Params.Health.BurnReduction = 0;
|
||||
subPatient1.AddDamage(patient1.WorldPosition, new List<Affliction>() { new Affliction(AfflictionPrefab.Burn, 40.0f) }, stun: 0, playSound: false);
|
||||
subPatients.Add(subPatient1);
|
||||
|
||||
@@ -157,9 +163,12 @@ namespace Barotrauma.Tutorials
|
||||
subPatient2.AddDamage(patient1.WorldPosition, new List<Affliction>() { new Affliction(AfflictionPrefab.InternalDamage, 40.0f) }, stun: 0, playSound: false);
|
||||
subPatients.Add(subPatient2);
|
||||
|
||||
var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"));
|
||||
var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: JobPrefab.Get("engineer"))
|
||||
{
|
||||
TeamID = CharacterTeamType.Team1
|
||||
};
|
||||
var subPatient3 = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job?.Prefab, Submarine.MainSub).WorldPosition, "3");
|
||||
subPatient3.TeamID = CharacterTeamType.Team1;
|
||||
subPatient3.Params.Health.BurnReduction = 0;
|
||||
subPatient3.AddDamage(patient1.WorldPosition, new List<Affliction>() { new Affliction(AfflictionPrefab.Burn, 20.0f) }, stun: 0, playSound: false);
|
||||
subPatients.Add(subPatient3);
|
||||
|
||||
|
||||
+4
-11
@@ -25,20 +25,17 @@ namespace Barotrauma.Tutorials
|
||||
private LightComponent engineer_firstDoorLight;
|
||||
|
||||
// Room 3
|
||||
private MotionSensor engineer_reactorObjectiveSensor;
|
||||
private Powered tutorial_oxygenGenerator;
|
||||
private Reactor engineer_reactor;
|
||||
private Door engineer_secondDoor;
|
||||
private LightComponent engineer_secondDoorLight;
|
||||
|
||||
// Room 4
|
||||
private MotionSensor engineer_repairJunctionBoxObjectiveSensor;
|
||||
private Item engineer_brokenJunctionBox;
|
||||
private Door engineer_thirdDoor;
|
||||
private LightComponent engineer_thirdDoorLight;
|
||||
|
||||
// Room 5
|
||||
private MotionSensor engineer_disconnectedJunctionBoxObjectiveSensor;
|
||||
private PowerTransfer[] engineer_disconnectedJunctionBoxes;
|
||||
private ConnectionPanel[] engineer_disconnectedConnectionPanels;
|
||||
private Item engineer_wire_1;
|
||||
@@ -169,7 +166,6 @@ namespace Barotrauma.Tutorials
|
||||
SetDoorAccess(engineer_firstDoor, engineer_firstDoorLight, false);
|
||||
|
||||
// Room 3
|
||||
engineer_reactorObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_reactorobjectivesensor")).GetComponent<MotionSensor>();
|
||||
tutorial_oxygenGenerator = Item.ItemList.Find(i => i.HasTag("tutorial_oxygengenerator")).GetComponent<OxygenGenerator>();
|
||||
engineer_reactor = Item.ItemList.Find(i => i.HasTag("engineer_reactor")).GetComponent<Reactor>();
|
||||
engineer_reactor.FireDelay = engineer_reactor.MeltdownDelay = float.PositiveInfinity;
|
||||
@@ -183,7 +179,6 @@ namespace Barotrauma.Tutorials
|
||||
SetDoorAccess(engineer_secondDoor, engineer_secondDoorLight, false);
|
||||
|
||||
// Room 4
|
||||
engineer_repairJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_repairjunctionboxobjectivesensor")).GetComponent<MotionSensor>();
|
||||
engineer_brokenJunctionBox = Item.ItemList.Find(i => i.HasTag("engineer_brokenjunctionbox"));
|
||||
engineer_thirdDoor = Item.ItemList.Find(i => i.HasTag("engineer_thirddoor")).GetComponent<Door>();
|
||||
engineer_thirdDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_thirddoorlight")).GetComponent<LightComponent>();
|
||||
@@ -194,8 +189,6 @@ namespace Barotrauma.Tutorials
|
||||
SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, false);
|
||||
|
||||
// Room 5
|
||||
engineer_disconnectedJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_disconnectedjunctionboxobjectivesensor")).GetComponent<MotionSensor>();
|
||||
|
||||
engineer_disconnectedJunctionBoxes = new PowerTransfer[4];
|
||||
engineer_disconnectedConnectionPanels = new ConnectionPanel[4];
|
||||
|
||||
@@ -255,7 +248,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
public override IEnumerable<CoroutineStatus> UpdateState()
|
||||
{
|
||||
while (GameMain.Instance.LoadingScreenOpen) yield return null;
|
||||
while (GameMain.Instance.LoadingScreenOpen) { yield return null; }
|
||||
|
||||
// Room 1
|
||||
SoundPlayer.PlayDamageSound("StructureBlunt", 10, Character.Controlled.WorldPosition);
|
||||
@@ -519,10 +512,10 @@ namespace Barotrauma.Tutorials
|
||||
tutorial_oxygenGenerator.PowerConsumption = reactorLoads[i];
|
||||
while (timer > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f, false);
|
||||
if (IsReactorPoweredUp(engineer_reactor))
|
||||
yield return CoroutineStatus.Running;
|
||||
if (CoroutineManager.DeltaTime > 0.0f && IsReactorPoweredUp(engineer_reactor))
|
||||
{
|
||||
timer -= 0.1f;
|
||||
timer -= CoroutineManager.DeltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,12 @@ namespace Barotrauma
|
||||
foreach (GUIComponent child in reputationList.Content.Children)
|
||||
{
|
||||
var descriptionElement = child.FindChild("description", recursive: true) as GUITextBlock;
|
||||
maxDescriptionHeight = Math.Max(maxDescriptionHeight, descriptionElement.TextSize.Y * 1.1f);
|
||||
float descriptionHeight = descriptionElement.TextSize.Y * 1.1f;
|
||||
if (child.FindChild("unlockinfo") is GUIComponent unlockInfoComponent)
|
||||
{
|
||||
descriptionHeight += 1.25f * unlockInfoComponent.Rect.Height;
|
||||
}
|
||||
maxDescriptionHeight = Math.Max(maxDescriptionHeight, descriptionHeight);
|
||||
}
|
||||
foreach (GUIComponent child in reputationList.Content.Children)
|
||||
{
|
||||
@@ -488,6 +493,7 @@ namespace Barotrauma
|
||||
var unlockInfoPanel = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.0f), reputationFrame.RectTransform, Anchor.BottomCenter) { MinSize = new Point(0, GUI.IntScale(30)), AbsoluteOffset = new Point(0, GUI.IntScale(3)) },
|
||||
unlockText, style: "GUIButtonRound", textAlignment: Alignment.Center, textColor: GUIStyle.TextColorNormal);
|
||||
unlockInfoPanel.Color = Color.Lerp(unlockInfoPanel.Color, Color.Black, 0.8f);
|
||||
unlockInfoPanel.UserData = "unlockinfo";
|
||||
if (unlockInfoPanel.TextSize.X > unlockInfoPanel.Rect.Width * 0.7f)
|
||||
{
|
||||
unlockInfoPanel.Font = GUIStyle.SmallFont;
|
||||
|
||||
@@ -667,7 +667,7 @@ namespace Barotrauma.Networking
|
||||
if (ChildServerRelay.Process?.HasExited ?? true)
|
||||
{
|
||||
Disconnect();
|
||||
if (!GUIMessageBox.MessageBoxes.Any(mb => (mb as GUIMessageBox).Text.Text == ChildServerRelay.CrashMessage))
|
||||
if (!GUIMessageBox.MessageBoxes.Any(mb => (mb as GUIMessageBox)?.Text.Text == ChildServerRelay.CrashMessage))
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ConnectionLost"), ChildServerRelay.CrashMessage);
|
||||
msgBox.Buttons[0].OnClicked += ReturnToPreviousMenu;
|
||||
@@ -2484,12 +2484,20 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void RequestFile(FileTransferType fileType, string file, string fileHash)
|
||||
{
|
||||
DebugConsole.Log(
|
||||
fileType == FileTransferType.CampaignSave ?
|
||||
$"Sending a campaign file request to the server." :
|
||||
$"Sending a file request to the server (type: {fileType}, path: {file ?? "null"}");
|
||||
|
||||
IWriteMessage msg = new WriteOnlyMessage();
|
||||
msg.Write((byte)ClientPacketHeader.FILE_REQUEST);
|
||||
msg.Write((byte)FileTransferMessageType.Initiate);
|
||||
msg.Write((byte)fileType);
|
||||
msg.Write(file ?? throw new ArgumentNullException(nameof(file)));
|
||||
msg.Write(fileHash ?? throw new ArgumentNullException(nameof(fileHash)));
|
||||
if (fileType != FileTransferType.CampaignSave)
|
||||
{
|
||||
msg.Write(file ?? throw new ArgumentNullException(nameof(file)));
|
||||
msg.Write(fileHash ?? throw new ArgumentNullException(nameof(fileHash)));
|
||||
}
|
||||
clientPeer.Send(msg, DeliveryMethod.Reliable);
|
||||
}
|
||||
|
||||
|
||||
@@ -262,11 +262,32 @@ namespace Barotrauma.CharacterEditor
|
||||
FileSelection.OnFileSelected = (file) =>
|
||||
{
|
||||
string relativePath = Path.GetRelativePath(Environment.CurrentDirectory, Path.GetFullPath(file));
|
||||
|
||||
if (relativePath.StartsWith(ContentPackage.LocalModsDir))
|
||||
{
|
||||
string[] pathSplit = relativePath.Split('/', '\\');
|
||||
string modDirName = $"{ContentPackage.LocalModsDir}/{pathSplit[1]}";
|
||||
string selectedModDir
|
||||
= (contentPackageDropDown.ListBox.SelectedData as ContentPackage)?.Dir.CleanUpPathCrossPlatform(correctFilenameCase: false)
|
||||
?? "";
|
||||
if (modDirName == selectedModDir)
|
||||
{
|
||||
relativePath = ContentPath.ModDirStr + "/" +
|
||||
string.Join("/", pathSplit[2..]);
|
||||
}
|
||||
else
|
||||
{
|
||||
relativePath = string.Format(ContentPath.OtherModDirFmt,
|
||||
pathSplit[1]) + "/" +
|
||||
string.Join("/", pathSplit[2..]);
|
||||
}
|
||||
}
|
||||
|
||||
string destinationPath = relativePath;
|
||||
|
||||
//copy file to XML path if it's not located relative to the game's files
|
||||
if (relativePath.StartsWith("..") ||
|
||||
Path.GetPathRoot(Environment.CurrentDirectory) != Path.GetPathRoot(file))
|
||||
//copy file to XML path if it's not located relative to the game's files
|
||||
if (relativePath.StartsWith("..") ||
|
||||
Path.GetPathRoot(Environment.CurrentDirectory) != Path.GetPathRoot(file))
|
||||
{
|
||||
destinationPath = Path.Combine(Path.GetDirectoryName(XMLPath), Path.GetFileName(file));
|
||||
|
||||
@@ -387,16 +408,20 @@ namespace Barotrauma.CharacterEditor
|
||||
contentPackageDropDown.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
string evaluatedTexturePath = ContentPath.FromRaw(
|
||||
contentPackageDropDown.SelectedData as ContentPackage,
|
||||
TexturePath).Value;
|
||||
if (SourceCharacter?.SpeciesName != CharacterPrefab.HumanSpeciesName)
|
||||
{
|
||||
if (!File.Exists(TexturePath))
|
||||
if (!File.Exists(evaluatedTexturePath))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("TextureDoesNotExist"), GUIStyle.Red);
|
||||
texturePathElement.Flash(GUIStyle.Red);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var path = Path.GetFileName(TexturePath);
|
||||
var path = Path.GetFileName(evaluatedTexturePath);
|
||||
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("WrongFileType"), GUIStyle.Red);
|
||||
@@ -405,7 +430,7 @@ namespace Barotrauma.CharacterEditor
|
||||
}
|
||||
if (IsCopy)
|
||||
{
|
||||
SourceRagdoll.Texture = TexturePath;
|
||||
SourceRagdoll.Texture = evaluatedTexturePath;
|
||||
SourceRagdoll.CanEnterSubmarine = CanEnterSubmarine;
|
||||
SourceRagdoll.CanWalk = CanWalk;
|
||||
SourceRagdoll.Serialize();
|
||||
|
||||
@@ -748,7 +748,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (GUITextBlock tutorialText in tutorialList.Content.Children)
|
||||
{
|
||||
if (((Tutorial)tutorialText.UserData).Completed)
|
||||
if (CompletedTutorials.Instance.Contains(((Tutorial)tutorialText.UserData).Identifier))
|
||||
{
|
||||
completedTutorials++;
|
||||
}
|
||||
|
||||
@@ -2561,27 +2561,30 @@ namespace Barotrauma
|
||||
|
||||
if (MainSub != null)
|
||||
{
|
||||
List<string> contentPacks = MainSub.Info.RequiredContentPackages.ToList();
|
||||
List<string> allContentPacks = MainSub.Info.RequiredContentPackages.ToList();
|
||||
foreach (ContentPackage contentPack in ContentPackageManager.AllPackages)
|
||||
{
|
||||
//don't show content packages that only define submarine files
|
||||
//(it doesn't make sense to require another sub to be installed to install this one)
|
||||
if (contentPack.Files.All(f => f is SubmarineFile)) { continue; }
|
||||
if (contentPack.Files.All(f => f is SubmarineFile || f is ItemAssemblyFile)) { continue; }
|
||||
|
||||
if (!contentPacks.Contains(contentPack.Name))
|
||||
if (!allContentPacks.Contains(contentPack.Name))
|
||||
{
|
||||
string altName = contentPack.AltNames.FirstOrDefault(n => contentPacks.Contains(n));
|
||||
string altName = contentPack.AltNames.FirstOrDefault(n => allContentPacks.Contains(n));
|
||||
if (!string.IsNullOrEmpty(altName))
|
||||
{
|
||||
MainSub.Info.RequiredContentPackages.Remove(altName);
|
||||
MainSub.Info.RequiredContentPackages.Add(contentPack.Name);
|
||||
contentPacks.Remove(altName);
|
||||
if (MainSub.Info.RequiredContentPackages.Contains(altName))
|
||||
{
|
||||
MainSub.Info.RequiredContentPackages.Remove(altName);
|
||||
MainSub.Info.RequiredContentPackages.Add(contentPack.Name);
|
||||
}
|
||||
allContentPacks.Remove(altName);
|
||||
}
|
||||
contentPacks.Add(contentPack.Name);
|
||||
allContentPacks.Add(contentPack.Name);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string contentPackageName in contentPacks)
|
||||
foreach (string contentPackageName in allContentPacks)
|
||||
{
|
||||
var cpTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), contentPackList.Content.RectTransform), contentPackageName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -31,7 +27,10 @@ namespace Barotrauma
|
||||
|
||||
public void SaveTo(XElement element)
|
||||
{
|
||||
identifiers.ForEach(id => new XElement("Tutorial", new XAttribute("name", id.Value)));
|
||||
foreach (var id in identifiers)
|
||||
{
|
||||
element.Add(new XElement("Tutorial", new XAttribute("name", id.Value)));
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(Identifier identifier) => identifiers.Contains(identifier);
|
||||
|
||||
@@ -34,9 +34,11 @@ namespace Barotrauma
|
||||
public bool Contains(Identifier identifier) => identifiers.Contains(identifier);
|
||||
|
||||
public void Add(Identifier identifier) => identifiers.Add(identifier);
|
||||
|
||||
|
||||
public void Remove(Identifier identifier) => identifiers.Remove(identifier);
|
||||
|
||||
public void Clear() => identifiers.Clear();
|
||||
|
||||
public static IgnoredHints Instance { get; private set; } = new IgnoredHints();
|
||||
}
|
||||
}
|
||||
@@ -655,7 +655,20 @@ namespace Barotrauma
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), layout.RectTransform),
|
||||
TextManager.Get("ResetInGameHints"), style: "GUIButtonSmall")
|
||||
{
|
||||
ToolTip = TextManager.Get("ResetInGameHintsTooltip")
|
||||
OnClicked = (button, o) =>
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ResetInGameHints"),
|
||||
TextManager.Get("ResetInGameHintsTooltip"),
|
||||
buttons: new[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
msgBox.Buttons[0].OnClicked = (guiButton, o1) =>
|
||||
{
|
||||
IgnoredHints.Instance.Clear();
|
||||
msgBox.Close();
|
||||
return false;
|
||||
};
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Spacer(layout);
|
||||
|
||||
|
||||
@@ -100,15 +100,17 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
Color = GUIStyle.Green
|
||||
};
|
||||
itemDownloadProgress.ProgressGetter = () =>
|
||||
{
|
||||
float progress = 0.0f;
|
||||
if (item.IsDownloading) { progress = item.DownloadAmount; }
|
||||
else if (itemDownloadProgress.BarSize > 0.0f) { progress = 1.0f; }
|
||||
var itemDownloadProgressUpdater = new GUICustomComponent(
|
||||
new RectTransform(Vector2.Zero, msgBox.Content.RectTransform),
|
||||
onUpdate: (f, component) =>
|
||||
{
|
||||
float progress = 0.0f;
|
||||
if (item.IsDownloading) { progress = item.DownloadAmount; }
|
||||
else if (itemDownloadProgress.BarSize > 0.0f) { progress = 1.0f; }
|
||||
|
||||
return Math.Max(itemDownloadProgress.BarSize,
|
||||
MathHelper.Lerp(itemDownloadProgress.BarSize, progress, 0.05f));
|
||||
};
|
||||
itemDownloadProgress.BarSize = Math.Max(itemDownloadProgress.BarSize,
|
||||
MathHelper.Lerp(itemDownloadProgress.BarSize, progress, 0.1f));
|
||||
});
|
||||
}
|
||||
TaskPool.Add("DownloadItems", DownloadItems(itemsToDownload, msgBox), _ =>
|
||||
{
|
||||
|
||||
+12
-2
@@ -614,8 +614,18 @@ namespace Barotrauma.Steam
|
||||
if (!SteamManager.IsInitialized)
|
||||
{
|
||||
tabContents[Tab.PopularMods].Button.Enabled = false;
|
||||
}
|
||||
CreateWorkshopItemList(content, out _, out popularModsList, onSelected: PopulateFrameWithItemInfo);
|
||||
}
|
||||
GUIFrame listFrame = new GUIFrame(new RectTransform((1.0f, 0.95f), content.RectTransform), style: null);
|
||||
CreateWorkshopItemList(listFrame, out _, out popularModsList, onSelected: PopulateFrameWithItemInfo);
|
||||
new GUIButton(new RectTransform((1.0f, 0.05f), content.RectTransform, Anchor.BottomLeft),
|
||||
style: "GUIButtonSmall", text: TextManager.Get("FindModsButton"))
|
||||
{
|
||||
OnClicked = (button, o) =>
|
||||
{
|
||||
SteamManager.OverlayCustomURL($"https://steamcommunity.com/app/{SteamManager.AppID}/workshop/");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void CreatePublishTab(out GUIListBox selfModsList)
|
||||
|
||||
Reference in New Issue
Block a user