Build 0.18.2.0
This commit is contained in:
@@ -6,7 +6,7 @@ using System;
|
|||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
public class Camera
|
public class Camera : IDisposable
|
||||||
{
|
{
|
||||||
public static bool FollowSub = true;
|
public static bool FollowSub = true;
|
||||||
|
|
||||||
@@ -147,15 +147,19 @@ namespace Barotrauma
|
|||||||
position = Vector2.Zero;
|
position = Vector2.Zero;
|
||||||
|
|
||||||
CreateMatrices();
|
CreateMatrices();
|
||||||
// TODO: Needs to unregister if ever destroy cameras.
|
// TODO: this has the potential to cause a resource leak
|
||||||
|
// by sneakily creating a reference to cameras that we might
|
||||||
|
// fail to release.
|
||||||
GameMain.Instance.ResolutionChanged += CreateMatrices;
|
GameMain.Instance.ResolutionChanged += CreateMatrices;
|
||||||
|
|
||||||
UpdateTransform(false);
|
UpdateTransform(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Camera()
|
private bool disposed = false;
|
||||||
|
public void Dispose()
|
||||||
{
|
{
|
||||||
GameMain.Instance.ResolutionChanged -= CreateMatrices;
|
if (!disposed) { GameMain.Instance.ResolutionChanged -= CreateMatrices; }
|
||||||
|
disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 TargetPos { get; set; }
|
public Vector2 TargetPos { get; set; }
|
||||||
|
|||||||
@@ -988,11 +988,6 @@ namespace Barotrauma
|
|||||||
HeadSelectionList = null;
|
HeadSelectionList = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~AppearanceCustomizationMenu()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ namespace Barotrauma
|
|||||||
AlwaysOverrideCursor = true
|
AlwaysOverrideCursor = true
|
||||||
};
|
};
|
||||||
|
|
||||||
LocalizedString translatedText = TextManager.Get(text);
|
LocalizedString translatedText = TextManager.Get(text).Fallback(text);
|
||||||
|
|
||||||
if (speaker?.Info != null && drawChathead)
|
if (speaker?.Info != null && drawChathead)
|
||||||
{
|
{
|
||||||
@@ -335,7 +335,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
foreach (string option in options)
|
foreach (string option in options)
|
||||||
{
|
{
|
||||||
var btn = new GUIButton(new RectTransform(new Vector2(0.9f, 0.01f), textContent.RectTransform), TextManager.Get(option), style: "ListBoxElement");
|
var btn = new GUIButton(new RectTransform(new Vector2(0.9f, 0.01f), textContent.RectTransform), TextManager.Get(option).Fallback(option), style: "ListBoxElement");
|
||||||
btn.TextBlock.TextAlignment = Alignment.CenterLeft;
|
btn.TextBlock.TextAlignment = Alignment.CenterLeft;
|
||||||
btn.TextColor = btn.HoverTextColor = GUIStyle.Green;
|
btn.TextColor = btn.HoverTextColor = GUIStyle.Green;
|
||||||
btn.TextBlock.Wrap = true;
|
btn.TextBlock.Wrap = true;
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
float startY = 10.0f;
|
float startY = 10.0f;
|
||||||
|
float yStep = AdjustForTextScale(18) * yScale;
|
||||||
if (GameMain.ShowFPS || GameMain.DebugDraw || GameMain.ShowPerf)
|
if (GameMain.ShowFPS || GameMain.DebugDraw || GameMain.ShowPerf)
|
||||||
{
|
{
|
||||||
float y = startY;
|
float y = startY;
|
||||||
@@ -309,11 +310,38 @@ namespace Barotrauma
|
|||||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
if (GameMain.GameSession != null && Timing.TotalTime > GameMain.GameSession.RoundStartTime + 1.0)
|
if (GameMain.GameSession != null && Timing.TotalTime > GameMain.GameSession.RoundStartTime + 1.0)
|
||||||
{
|
{
|
||||||
y += AdjustForTextScale(15) * yScale;
|
y += yStep;
|
||||||
DrawString(spriteBatch, new Vector2(10, y),
|
DrawString(spriteBatch, new Vector2(10, y),
|
||||||
$"Physics: {GameMain.CurrentUpdateRate}",
|
$"Physics: {GameMain.CurrentUpdateRate}",
|
||||||
(GameMain.CurrentUpdateRate < Timing.FixedUpdateRate) ? Color.Red : Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
(GameMain.CurrentUpdateRate < Timing.FixedUpdateRate) ? Color.Red : Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
}
|
}
|
||||||
|
if (GameMain.DebugDraw || GameMain.ShowPerf)
|
||||||
|
{
|
||||||
|
y += yStep;
|
||||||
|
DrawString(spriteBatch, new Vector2(10, y),
|
||||||
|
"Active lights: " + Lights.LightManager.ActiveLightCount,
|
||||||
|
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
|
y += yStep;
|
||||||
|
DrawString(spriteBatch, new Vector2(10, y),
|
||||||
|
"Physics: " + GameMain.World.UpdateTime.TotalMilliseconds + " ms",
|
||||||
|
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
|
y += yStep;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning("Exception while rendering debug info. Physics bodies may have been created or removed while rendering.");
|
||||||
|
}
|
||||||
|
y += yStep;
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.ShowPerf)
|
if (GameMain.ShowPerf)
|
||||||
@@ -324,67 +352,59 @@ namespace Barotrauma
|
|||||||
"Draw - Avg: " + GameMain.PerformanceCounter.DrawTimeGraph.Average().ToString("0.00") + " ms" +
|
"Draw - Avg: " + GameMain.PerformanceCounter.DrawTimeGraph.Average().ToString("0.00") + " ms" +
|
||||||
" Max: " + GameMain.PerformanceCounter.DrawTimeGraph.LargestValue().ToString("0.00") + " ms",
|
" Max: " + GameMain.PerformanceCounter.DrawTimeGraph.LargestValue().ToString("0.00") + " ms",
|
||||||
GUIStyle.Green, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
GUIStyle.Green, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
GameMain.PerformanceCounter.DrawTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: GUIStyle.Green);
|
GameMain.PerformanceCounter.DrawTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: GUIStyle.Green);
|
||||||
y += 50 * yScale;
|
y += yStep * 3;
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(x, y),
|
DrawString(spriteBatch, new Vector2(x, y),
|
||||||
"Update - Avg: " + GameMain.PerformanceCounter.UpdateTimeGraph.Average().ToString("0.00") + " ms" +
|
"Update - Avg: " + GameMain.PerformanceCounter.UpdateTimeGraph.Average().ToString("0.00") + " ms" +
|
||||||
" Max: " + GameMain.PerformanceCounter.UpdateTimeGraph.LargestValue().ToString("0.00") + " ms",
|
" Max: " + GameMain.PerformanceCounter.UpdateTimeGraph.LargestValue().ToString("0.00") + " ms",
|
||||||
Color.LightBlue, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
Color.LightBlue, Color.Black * 0.8f, font: GUIStyle.SmallFont);
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
GameMain.PerformanceCounter.UpdateTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: Color.LightBlue);
|
GameMain.PerformanceCounter.UpdateTimeGraph.Draw(spriteBatch, new Rectangle((int)x, (int)y, 170, 50), color: Color.LightBlue);
|
||||||
y += 50 * yScale;
|
y += yStep * 3;
|
||||||
foreach (string key in GameMain.PerformanceCounter.GetSavedIdentifiers)
|
foreach (string key in GameMain.PerformanceCounter.GetSavedIdentifiers)
|
||||||
{
|
{
|
||||||
float elapsedMillisecs = GameMain.PerformanceCounter.GetAverageElapsedMillisecs(key);
|
float elapsedMillisecs = GameMain.PerformanceCounter.GetAverageElapsedMillisecs(key);
|
||||||
DrawString(spriteBatch, new Vector2(x, y),
|
DrawString(spriteBatch, new Vector2(x, y),
|
||||||
key + ": " + elapsedMillisecs.ToString("0.00"),
|
key + ": " + elapsedMillisecs.ToString("0.00"),
|
||||||
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
foreach (string childKey in GameMain.PerformanceCounter.GetSavedPartialIdentifiers(key))
|
foreach (string childKey in GameMain.PerformanceCounter.GetSavedPartialIdentifiers(key))
|
||||||
{
|
{
|
||||||
elapsedMillisecs = GameMain.PerformanceCounter.GetPartialAverageElapsedMillisecs(key, childKey);
|
elapsedMillisecs = GameMain.PerformanceCounter.GetPartialAverageElapsedMillisecs(key, childKey);
|
||||||
DrawString(spriteBatch, new Vector2(x + 15, y),
|
DrawString(spriteBatch, new Vector2(x + 15, y),
|
||||||
childKey + ": " + elapsedMillisecs.ToString("0.00"),
|
childKey + ": " + elapsedMillisecs.ToString("0.00"),
|
||||||
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Powered.Grids != null)
|
if (Powered.Grids != null)
|
||||||
{
|
{
|
||||||
DrawString(spriteBatch, new Vector2(x, y), "Grids: " + Powered.Grids.Count, Color.LightGreen, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
DrawString(spriteBatch, new Vector2(x, y), "Grids: " + Powered.Grids.Count, Color.LightGreen, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.EnableDiagnostics)
|
if (Settings.EnableDiagnostics)
|
||||||
{
|
{
|
||||||
x += 20 * xScale;
|
x += yStep * 2;
|
||||||
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), "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 * 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 + yStep), "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 + yStep * 2), "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 + yStep * 3), "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 + yStep * 4), "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);
|
DrawString(spriteBatch, new Vector2(x, y + yStep * 5), "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))
|
if (GameMain.DebugDraw && !Submarine.Unloading && !(Screen.Selected is RoundSummaryScreen))
|
||||||
{
|
{
|
||||||
float y = startY + 15 * yScale;
|
float y = startY + yStep * 6;
|
||||||
DrawString(spriteBatch, new Vector2(10, y),
|
|
||||||
"Physics: " + GameMain.World.UpdateTime,
|
|
||||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
|
||||||
|
|
||||||
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)
|
if (Screen.Selected.Cam != null)
|
||||||
{
|
{
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
DrawString(spriteBatch, new Vector2(10, y),
|
DrawString(spriteBatch, new Vector2(10, y),
|
||||||
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint() + ", zoom: " + Screen.Selected.Cam.Zoom,
|
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint() + ", zoom: " + Screen.Selected.Cam.Zoom,
|
||||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
@@ -392,23 +412,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Submarine.MainSub != null)
|
if (Submarine.MainSub != null)
|
||||||
{
|
{
|
||||||
y += 15 * yScale;
|
y += yStep;
|
||||||
DrawString(spriteBatch, new Vector2(10, y),
|
DrawString(spriteBatch, new Vector2(10, y),
|
||||||
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
|
||||||
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (loadedSpritesText == null || DateTime.Now > loadedSpritesUpdateTime)
|
if (loadedSpritesText == null || DateTime.Now > loadedSpritesUpdateTime)
|
||||||
{
|
{
|
||||||
loadedSpritesText = "Loaded sprites: " + Sprite.LoadedSprites.Count() + "\n(" + Sprite.LoadedSprites.Select(s => s.FilePath).Distinct().Count() + " unique textures)";
|
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);
|
loadedSpritesUpdateTime = DateTime.Now + new TimeSpan(0, 0, seconds: 5);
|
||||||
}
|
}
|
||||||
y += 25 * yScale;
|
y += yStep * 2;
|
||||||
DrawString(spriteBatch, new Vector2(10, y), loadedSpritesText, Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
DrawString(spriteBatch, new Vector2(10, y), loadedSpritesText, Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
|
|
||||||
if (debugDrawSounds)
|
if (debugDrawSounds)
|
||||||
@@ -416,21 +431,21 @@ namespace Barotrauma
|
|||||||
float soundTextY = 0;
|
float soundTextY = 0;
|
||||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||||
"Sounds (Ctrl+S to hide): ", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
"Sounds (Ctrl+S to hide): ", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
soundTextY += 15 * yScale;
|
soundTextY += yStep;
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||||
"Current playback amplitude: " + GameMain.SoundManager.PlaybackAmplitude.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
"Current playback amplitude: " + GameMain.SoundManager.PlaybackAmplitude.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
|
|
||||||
soundTextY += 15 * yScale;
|
soundTextY += yStep;
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||||
"Compressed dynamic range gain: " + GameMain.SoundManager.CompressionDynamicRangeGain.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
"Compressed dynamic range gain: " + GameMain.SoundManager.CompressionDynamicRangeGain.ToString(), Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
|
|
||||||
soundTextY += 15 * yScale;
|
soundTextY += yStep;
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
DrawString(spriteBatch, new Vector2(500, soundTextY),
|
||||||
"Loaded sounds: " + GameMain.SoundManager.LoadedSoundCount + " (" + GameMain.SoundManager.UniqueLoadedSoundCount + " unique)", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
"Loaded sounds: " + GameMain.SoundManager.LoadedSoundCount + " (" + GameMain.SoundManager.UniqueLoadedSoundCount + " unique)", Color.White, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
soundTextY += 15 * yScale;
|
soundTextY += yStep;
|
||||||
|
|
||||||
for (int i = 0; i < SoundManager.SOURCE_COUNT; i++)
|
for (int i = 0; i < SoundManager.SOURCE_COUNT; i++)
|
||||||
{
|
{
|
||||||
@@ -479,7 +494,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawString(spriteBatch, new Vector2(500, soundTextY), soundStr, clr, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
DrawString(spriteBatch, new Vector2(500, soundTextY), soundStr, clr, Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||||
soundTextY += 15 * yScale;
|
soundTextY += yStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1981,7 +1996,7 @@ namespace Barotrauma
|
|||||||
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), RectComponentLabels[i], font: font, textAlignment: Alignment.CenterLeft);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), RectComponentLabels[i], font: font, textAlignment: Alignment.CenterLeft);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int)
|
NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = font
|
Font = font
|
||||||
};
|
};
|
||||||
@@ -2025,7 +2040,7 @@ namespace Barotrauma
|
|||||||
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), VectorComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), VectorComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int)
|
NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -2055,7 +2070,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
var element = new GUIFrame(new RectTransform(new Vector2(0.45f, 1), inputArea.RectTransform), style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), VectorComponentLabels[i], font: font, textAlignment: Alignment.CenterLeft);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), VectorComponentLabels[i], font: font, textAlignment: Alignment.CenterLeft);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), GUINumberInput.NumberType.Float) { Font = font };
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), NumberType.Float) { Font = font };
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -2425,8 +2440,7 @@ namespace Barotrauma
|
|||||||
verificationTextTag: GameMain.GameSession == null ? "PauseMenuQuitVerificationEditor" : "PauseMenuQuitVerification",
|
verificationTextTag: GameMain.GameSession == null ? "PauseMenuQuitVerificationEditor" : "PauseMenuQuitVerification",
|
||||||
action: () =>
|
action: () =>
|
||||||
{
|
{
|
||||||
// In the first campaign round we need to save the start items.
|
GameMain.QuitToMainMenu(save: false);
|
||||||
GameMain.QuitToMainMenu(save: GameMain.GameSession.GameMode is SinglePlayerCampaign campaign && campaign.IsFirstRound);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class GUINumberInput : GUIComponent
|
class GUINumberInput : GUIComponent
|
||||||
{
|
{
|
||||||
public enum NumberType
|
|
||||||
{
|
|
||||||
Int, Float
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void OnValueEnteredHandler(GUINumberInput numberInput);
|
public delegate void OnValueEnteredHandler(GUINumberInput numberInput);
|
||||||
public OnValueEnteredHandler OnValueEntered;
|
public OnValueEnteredHandler OnValueEntered;
|
||||||
|
|
||||||
|
|||||||
@@ -1546,7 +1546,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
amountInput = new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), shoppingCrateAmountGroup.RectTransform), GUINumberInput.NumberType.Int)
|
amountInput = new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), shoppingCrateAmountGroup.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = GetMaxAvailable(pi.ItemPrefab, containingTab),
|
MaxValueInt = GetMaxAvailable(pi.ItemPrefab, containingTab),
|
||||||
|
|||||||
@@ -1064,7 +1064,7 @@ namespace Barotrauma
|
|||||||
GUIButton centerButton = new GUIButton(new RectTransform(new Vector2(1f), centerLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight, anchor: Anchor.Center), style: "GUIButtonTransferArrow");
|
GUIButton centerButton = new GUIButton(new RectTransform(new Vector2(1f), centerLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight, anchor: Anchor.Center), style: "GUIButtonTransferArrow");
|
||||||
|
|
||||||
GUILayoutGroup inputLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.25f), paddedTransferMenuLayout.RectTransform), childAnchor: Anchor.Center);
|
GUILayoutGroup inputLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.25f), paddedTransferMenuLayout.RectTransform), childAnchor: Anchor.Center);
|
||||||
GUINumberInput transferAmountInput = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), inputLayout.RectTransform), GUINumberInput.NumberType.Int, hidePlusMinusButtons: true)
|
GUINumberInput transferAmountInput = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), inputLayout.RectTransform), NumberType.Int, hidePlusMinusButtons: true)
|
||||||
{
|
{
|
||||||
MinValueInt = 0
|
MinValueInt = 0
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1037,6 +1037,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GUI.SetSavingIndicatorState(true);
|
GUI.SetSavingIndicatorState(true);
|
||||||
|
|
||||||
|
if (GameSession.Submarine != null && !GameSession.Submarine.Removed)
|
||||||
|
{
|
||||||
|
GameSession.SubmarineInfo = new SubmarineInfo(GameSession.Submarine);
|
||||||
|
}
|
||||||
|
|
||||||
// Update store stock when saving and quitting in an outpost (normally updated when CampaignMode.End() is called)
|
// Update store stock when saving and quitting in an outpost (normally updated when CampaignMode.End() is called)
|
||||||
if (GameSession?.Campaign is SinglePlayerCampaign spCampaign && Level.IsLoadedOutpost && spCampaign.Map?.CurrentLocation != null && spCampaign.CargoManager != null)
|
if (GameSession?.Campaign is SinglePlayerCampaign spCampaign && Level.IsLoadedOutpost && spCampaign.Map?.CurrentLocation != null && spCampaign.CargoManager != null)
|
||||||
{
|
{
|
||||||
@@ -1163,7 +1168,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), linkHolder.RectTransform), TextManager.Get("bugreportgithubform"), style: "MainMenuGUIButton", textAlignment: Alignment.Left)
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), linkHolder.RectTransform), TextManager.Get("bugreportgithubform"), style: "MainMenuGUIButton", textAlignment: Alignment.Left)
|
||||||
{
|
{
|
||||||
UserData = "https://github.com/Regalis11/Barotrauma/issues/new?template=bug_report.md",
|
UserData = "https://github.com/Regalis11/Barotrauma/issues/new/choose",
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
ShowOpenUrlInWebBrowserPrompt(userdata as string);
|
ShowOpenUrlInWebBrowserPrompt(userdata as string);
|
||||||
|
|||||||
+2
-1
@@ -92,7 +92,7 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
case "crew":
|
case "crew":
|
||||||
GameMain.GameSession.CrewManager = new CrewManager(subElement, true);
|
GameMain.GameSession.CrewManager = new CrewManager(subElement, true);
|
||||||
ActiveOrdersElement = element.GetChildElement("activeorders");
|
ActiveOrdersElement = subElement.GetChildElement("activeorders");
|
||||||
break;
|
break;
|
||||||
case "map":
|
case "map":
|
||||||
map = Map.Load(this, subElement, Settings);
|
map = Map.Load(this, subElement, Settings);
|
||||||
@@ -461,6 +461,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(GameMain.GameSession.Submarine);
|
||||||
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.08f), parent), isHorizontal: true);
|
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.08f), parent), isHorizontal: true);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), label);
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), label);
|
||||||
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), GUINumberInput.NumberType.Int) { IntValue = defaultValue };
|
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), NumberType.Int) { IntValue = defaultValue };
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.08f), parent), isHorizontal: true);
|
GUILayoutGroup layout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.08f), parent), isHorizontal: true);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), label);
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), label);
|
||||||
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), GUINumberInput.NumberType.Float) { FloatValue = defaultValue, DecimalsToDisplay = 2 };
|
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), layout.RectTransform), NumberType.Float) { FloatValue = defaultValue, DecimalsToDisplay = 2 };
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ namespace Barotrauma.Items.Components
|
|||||||
for (var i = 0; i < values.Length; i++)
|
for (var i = 0; i < values.Length; i++)
|
||||||
{
|
{
|
||||||
float value = values[i];
|
float value = values[i];
|
||||||
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f / values.Length, 1f), layout.RectTransform), GUINumberInput.NumberType.Float)
|
GUINumberInput input = new GUINumberInput(new RectTransform(new Vector2(0.5f / values.Length, 1f), layout.RectTransform), NumberType.Float)
|
||||||
{
|
{
|
||||||
FloatValue = value, DecimalsToDisplay = 2,
|
FloatValue = value, DecimalsToDisplay = 2,
|
||||||
MinValueFloat = min,
|
MinValueFloat = min,
|
||||||
|
|||||||
@@ -280,9 +280,9 @@ namespace Barotrauma.Items.Components
|
|||||||
transformedItemPos += new Vector2(item.Rect.X, item.Rect.Y);
|
transformedItemPos += new Vector2(item.Rect.X, item.Rect.Y);
|
||||||
if (item.Submarine != null) { transformedItemPos += item.Submarine.DrawPosition; }
|
if (item.Submarine != null) { transformedItemPos += item.Submarine.DrawPosition; }
|
||||||
|
|
||||||
if (Math.Abs(item.Rotation) > 0.01f)
|
if (Math.Abs(item.RotationRad) > 0.01f)
|
||||||
{
|
{
|
||||||
Matrix transform = Matrix.CreateRotationZ(MathHelper.ToRadians(-item.Rotation));
|
Matrix transform = Matrix.CreateRotationZ(-item.RotationRad);
|
||||||
transformedItemPos = Vector2.Transform(transformedItemPos - item.DrawPosition, transform) + item.DrawPosition;
|
transformedItemPos = Vector2.Transform(transformedItemPos - item.DrawPosition, transform) + item.DrawPosition;
|
||||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||||
transformedItemIntervalHorizontal = Vector2.Transform(transformedItemIntervalHorizontal, transform);
|
transformedItemIntervalHorizontal = Vector2.Transform(transformedItemIntervalHorizontal, transform);
|
||||||
|
|||||||
@@ -56,9 +56,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Vector2 pos = item.DrawPosition;
|
Light.Position = item.Position;
|
||||||
if (item.Submarine != null) { pos -= item.Submarine.DrawPosition; }
|
|
||||||
Light.Position = pos;
|
|
||||||
}
|
}
|
||||||
PhysicsBody body = Light.ParentBody;
|
PhysicsBody body = Light.ParentBody;
|
||||||
if (body != null)
|
if (body != null)
|
||||||
@@ -68,7 +66,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Light.Rotation = -Rotation - MathHelper.ToRadians(item.Rotation);
|
Light.Rotation = -Rotation - item.RotationRad;
|
||||||
Light.LightSpriteEffect = item.SpriteEffects;
|
Light.LightSpriteEffect = item.SpriteEffects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace Barotrauma.Items.Components
|
|||||||
private bool OnActivateButtonClicked(GUIButton button, object obj)
|
private bool OnActivateButtonClicked(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
var disallowedItem = inputContainer.Inventory.FindItem(i => !i.AllowDeconstruct, recursive: false);
|
var disallowedItem = inputContainer.Inventory.FindItem(i => !i.AllowDeconstruct, recursive: false);
|
||||||
if (disallowedItem != null)
|
if (disallowedItem != null && !DeconstructItemsSimultaneously)
|
||||||
{
|
{
|
||||||
int index = inputContainer.Inventory.FindIndex(disallowedItem);
|
int index = inputContainer.Inventory.FindIndex(disallowedItem);
|
||||||
if (index >= 0 && index < inputContainer.Inventory.visualSlots.Length)
|
if (index >= 0 && index < inputContainer.Inventory.visualSlots.Length)
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (hullData.Distort)
|
if (hullData.Distort)
|
||||||
{
|
{
|
||||||
hullData.ReceivedOxygenAmount = Rand.Range(0.0f, 100.0f);
|
hullData.ReceivedOxygenAmount = Rand.Range(0.0f, 100.0f);
|
||||||
hullData.ReceivedWaterAmount = Rand.Range(0.0f, 1.0f);
|
hullData.ReceivedWaterAmount = Rand.Range(0.0f, 100.0f);
|
||||||
}
|
}
|
||||||
hullData.DistortionTimer = Rand.Range(1.0f, 10.0f);
|
hullData.DistortionTimer = Rand.Range(1.0f, 10.0f);
|
||||||
}
|
}
|
||||||
@@ -681,7 +681,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
var sprite = GUIStyle.UIGlowSolidCircular.Value?.Sprite;
|
var sprite = GUIStyle.UIGlowSolidCircular.Value?.Sprite;
|
||||||
float alpha = (MathF.Sin(blipState / maxBlipState * MathHelper.TwoPi) + 1.5f) * 0.5f;
|
float alpha = (MathF.Sin(blipState / maxBlipState * MathHelper.TwoPi) + 1.5f) * 0.5f;
|
||||||
if (sprite != null)
|
if (sprite != null && ShowHullIntegrity)
|
||||||
{
|
{
|
||||||
Vector2 spriteSize = sprite.size;
|
Vector2 spriteSize = sprite.size;
|
||||||
Rectangle worldBorders = item.Submarine.GetDockedBorders();
|
Rectangle worldBorders = item.Submarine.GetDockedBorders();
|
||||||
@@ -1014,13 +1014,13 @@ namespace Barotrauma.Items.Components
|
|||||||
hullData.HullWaterAmount = 0.0f;
|
hullData.HullWaterAmount = 0.0f;
|
||||||
foreach (Hull linkedHull in hullData.LinkedHulls)
|
foreach (Hull linkedHull in hullData.LinkedHulls)
|
||||||
{
|
{
|
||||||
hullData.HullWaterAmount += Math.Min(linkedHull.WaterVolume / linkedHull.Volume, 1.0f);
|
hullData.HullWaterAmount += WaterDetector.GetWaterPercentage(linkedHull);
|
||||||
}
|
}
|
||||||
hullData.HullWaterAmount /= hullData.LinkedHulls.Count;
|
hullData.HullWaterAmount /= hullData.LinkedHulls.Count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hullData.HullWaterAmount = Math.Min(hull.WaterVolume / hull.Volume, 1.0f);
|
hullData.HullWaterAmount = WaterDetector.GetWaterPercentage(hull);
|
||||||
}
|
}
|
||||||
|
|
||||||
float gapOpenSum = 0.0f;
|
float gapOpenSum = 0.0f;
|
||||||
@@ -1052,8 +1052,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
LocalizedString line3 = waterAmount == null ?
|
LocalizedString line3 = waterAmount == null ?
|
||||||
TextManager.Get("MiniMapWaterLevelUnavailable") :
|
TextManager.Get("MiniMapWaterLevelUnavailable") :
|
||||||
TextManager.AddPunctuation(':', TextManager.Get("MiniMapWaterLevel"), (int)Math.Round(waterAmount.Value * 100.0f) + "%");
|
TextManager.AddPunctuation(':', TextManager.Get("MiniMapWaterLevel"), (int)Math.Round(waterAmount.Value) + "%");
|
||||||
Color line3Color = waterAmount == null ? GUIStyle.Red : Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)waterAmount);
|
Color line3Color = waterAmount == null ? GUIStyle.Red : Color.Lerp(Color.LightGreen, GUIStyle.Red, (float)waterAmount / 100.0f);
|
||||||
|
|
||||||
SetTooltip(borderComponent.Rect.Center, header, line1, line2, line3, line1Color, line2Color, line3Color);
|
SetTooltip(borderComponent.Rect.Center, header, line1, line2, line3, line1Color, line2Color, line3Color);
|
||||||
}
|
}
|
||||||
@@ -1188,7 +1188,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (hullsVisible && hullData.HullWaterAmount is { } waterAmount)
|
if (hullsVisible && hullData.HullWaterAmount is { } waterAmount)
|
||||||
{
|
{
|
||||||
if (!RequireWaterDetectors) { waterAmount = hull.WaterPercentage / 100.0f; }
|
if (!RequireWaterDetectors) { waterAmount = WaterDetector.GetWaterPercentage(hull); }
|
||||||
|
waterAmount /= 100.0f;
|
||||||
if (hullFrame.Rect.Height * waterAmount > 1.0f)
|
if (hullFrame.Rect.Height * waterAmount > 1.0f)
|
||||||
{
|
{
|
||||||
RectangleF waterRect = new RectangleF(hullFrame.Rect.X, hullFrame.Rect.Y + hullFrame.Rect.Height * (1.0f - waterAmount), hullFrame.Rect.Width, hullFrame.Rect.Height * waterAmount);
|
RectangleF waterRect = new RectangleF(hullFrame.Rect.X, hullFrame.Rect.Y + hullFrame.Rect.Height * (1.0f - waterAmount), hullFrame.Rect.Width, hullFrame.Rect.Height * waterAmount);
|
||||||
@@ -1327,7 +1328,7 @@ namespace Barotrauma.Items.Components
|
|||||||
pos.X += inflate;
|
pos.X += inflate;
|
||||||
pos.Y += inflate;
|
pos.Y += inflate;
|
||||||
|
|
||||||
sprite.Draw(spriteBatch, pos, item.SpriteColor, sprite.Origin, MathHelper.ToRadians(item.Rotation), spriteScale, item.SpriteEffects);
|
sprite.Draw(spriteBatch, pos, item.SpriteColor, sprite.Origin, item.RotationRad, spriteScale, item.SpriteEffects);
|
||||||
|
|
||||||
void DrawAdditionalSprite(Vector2 basePos, Sprite addSprite, float rotation)
|
void DrawAdditionalSprite(Vector2 basePos, Sprite addSprite, float rotation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
partial void UpdateProjSpecific(float deltaTime)
|
partial void UpdateProjSpecific(float deltaTime)
|
||||||
{
|
{
|
||||||
float rotationRad = MathHelper.ToRadians(item.Rotation);
|
|
||||||
if (FlowPercentage < 0.0f)
|
if (FlowPercentage < 0.0f)
|
||||||
{
|
{
|
||||||
foreach (var (position, emitter) in pumpOutEmitters)
|
foreach (var (position, emitter) in pumpOutEmitters)
|
||||||
@@ -142,8 +141,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
//only emit "pump out" particles when underwater
|
//only emit "pump out" particles when underwater
|
||||||
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
||||||
relativeParticlePos = MathUtils.RotatePoint(relativeParticlePos, item.FlippedX ? rotationRad : -rotationRad);
|
relativeParticlePos = MathUtils.RotatePoint(relativeParticlePos, item.FlippedX ? item.RotationRad : -item.RotationRad);
|
||||||
float angle = -rotationRad;
|
float angle = -item.RotationRad;
|
||||||
if (item.FlippedX)
|
if (item.FlippedX)
|
||||||
{
|
{
|
||||||
relativeParticlePos.X = -relativeParticlePos.X;
|
relativeParticlePos.X = -relativeParticlePos.X;
|
||||||
@@ -163,8 +162,8 @@ namespace Barotrauma.Items.Components
|
|||||||
foreach (var (position, emitter) in pumpInEmitters)
|
foreach (var (position, emitter) in pumpInEmitters)
|
||||||
{
|
{
|
||||||
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
Vector2 relativeParticlePos = (item.WorldRect.Location.ToVector2() + position * item.Scale) - item.WorldPosition;
|
||||||
relativeParticlePos = MathUtils.RotatePoint(relativeParticlePos, item.FlippedX ? rotationRad : -rotationRad);
|
relativeParticlePos = MathUtils.RotatePoint(relativeParticlePos, item.FlippedX ? item.RotationRad : -item.RotationRad);
|
||||||
float angle = -rotationRad;
|
float angle = -item.RotationRad;
|
||||||
if (item.FlippedX)
|
if (item.FlippedX)
|
||||||
{
|
{
|
||||||
relativeParticlePos.X = -relativeParticlePos.X;
|
relativeParticlePos.X = -relativeParticlePos.X;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using System;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma.Networking;
|
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using Barotrauma.Sounds;
|
using Barotrauma.Sounds;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (target == null || target.Removed) { return; }
|
if (target == null || target.Removed) { return; }
|
||||||
if (target.ParentInventory != null) { return; }
|
if (target.ParentInventory != null) { return; }
|
||||||
|
if (source is Limb limb && limb.Removed) { return; }
|
||||||
|
if (source is Entity e && e.Removed) { return; }
|
||||||
|
|
||||||
Vector2 startPos = GetSourcePos();
|
Vector2 startPos = GetSourcePos();
|
||||||
startPos.Y = -startPos.Y;
|
startPos.Y = -startPos.Y;
|
||||||
|
|||||||
+95
-34
@@ -45,7 +45,7 @@ namespace Barotrauma.Items.Components
|
|||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform),
|
||||||
TextManager.Get(ciElement.Label).Fallback(ciElement.Label));
|
TextManager.Get(ciElement.Label).Fallback(ciElement.Label));
|
||||||
if (!ciElement.IsIntegerInput)
|
if (!ciElement.IsNumberInput)
|
||||||
{
|
{
|
||||||
var textBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform), ciElement.Signal, style: "GUITextBoxNoIcon")
|
var textBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform), ciElement.Signal, style: "GUITextBoxNoIcon")
|
||||||
{
|
{
|
||||||
@@ -77,29 +77,71 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int.TryParse(ciElement.Signal, out int signal);
|
GUINumberInput numberInput = null;
|
||||||
var numberInput = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform), GUINumberInput.NumberType.Int)
|
if (ciElement.NumberType == NumberType.Float)
|
||||||
{
|
{
|
||||||
UserData = ciElement,
|
TryParseFloatInvariantCulture(ciElement.Signal, out float floatSignal);
|
||||||
MinValueInt = ciElement.NumberInputMin,
|
TryParseFloatInvariantCulture(ciElement.NumberInputMin, out float numberInputMin);
|
||||||
MaxValueInt = ciElement.NumberInputMax,
|
TryParseFloatInvariantCulture(ciElement.NumberInputMax, out float numberInputMax);
|
||||||
IntValue = Math.Clamp(signal, ciElement.NumberInputMin, ciElement.NumberInputMax)
|
TryParseFloatInvariantCulture(ciElement.NumberInputStep, out float numberInputStep);
|
||||||
};
|
numberInput = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform), NumberType.Float)
|
||||||
//reset size restrictions set by the Style to make sure the elements can fit the interface
|
{
|
||||||
numberInput.RectTransform.MinSize = numberInput.LayoutGroup.RectTransform.MinSize = new Point(0, 0);
|
UserData = ciElement,
|
||||||
numberInput.RectTransform.MaxSize = numberInput.LayoutGroup.RectTransform.MaxSize = new Point(int.MaxValue, int.MaxValue);
|
MinValueFloat = numberInputMin,
|
||||||
numberInput.OnValueChanged += (ni) =>
|
MaxValueFloat = numberInputMax,
|
||||||
|
FloatValue = Math.Clamp(floatSignal, numberInputMin, numberInputMax),
|
||||||
|
DecimalsToDisplay = ciElement.NumberInputDecimalPlaces,
|
||||||
|
valueStep = numberInputStep,
|
||||||
|
OnValueChanged = (ni) =>
|
||||||
|
{
|
||||||
|
if (GameMain.Client == null)
|
||||||
|
{
|
||||||
|
ValueChanged(ni.UserData as CustomInterfaceElement, ni.FloatValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.CreateClientEvent(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if (ciElement.NumberType == NumberType.Int)
|
||||||
{
|
{
|
||||||
if (GameMain.Client == null)
|
int.TryParse(ciElement.Signal, out int intSignal);
|
||||||
|
int.TryParse(ciElement.NumberInputMin, out int numberInputMin);
|
||||||
|
int.TryParse(ciElement.NumberInputMax, out int numberInputMax);
|
||||||
|
TryParseFloatInvariantCulture(ciElement.NumberInputStep, out float numberInputStep);
|
||||||
|
numberInput = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1.0f), layoutGroup.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
ValueChanged(ni.UserData as CustomInterfaceElement, ni.IntValue);
|
UserData = ciElement,
|
||||||
}
|
MinValueInt = numberInputMin,
|
||||||
else
|
MaxValueInt = numberInputMax,
|
||||||
{
|
IntValue = Math.Clamp(intSignal, numberInputMin, numberInputMax),
|
||||||
item.CreateClientEvent(this);
|
valueStep = numberInputStep,
|
||||||
}
|
OnValueChanged = (ni) =>
|
||||||
};
|
{
|
||||||
uiElements.Add(numberInput);
|
if (GameMain.Client == null)
|
||||||
|
{
|
||||||
|
ValueChanged(ni.UserData as CustomInterfaceElement, ni.IntValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.CreateClientEvent(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugConsole.ShowError($"Error creating a CustomInterface component: unexpected NumberType \"{(ciElement.NumberType.HasValue ? ciElement.NumberType.Value.ToString() : "none")}\"");
|
||||||
|
}
|
||||||
|
if (numberInput != null)
|
||||||
|
{
|
||||||
|
//reset size restrictions set by the Style to make sure the elements can fit the interface
|
||||||
|
numberInput.RectTransform.MinSize = numberInput.LayoutGroup.RectTransform.MinSize = new Point(0, 0);
|
||||||
|
numberInput.RectTransform.MaxSize = numberInput.LayoutGroup.RectTransform.MaxSize = new Point(int.MaxValue, int.MaxValue);
|
||||||
|
uiElements.Add(numberInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ciElement.ContinuousSignal)
|
else if (ciElement.ContinuousSignal)
|
||||||
@@ -293,7 +335,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else if (uiElements[i] is GUINumberInput ni)
|
else if (uiElements[i] is GUINumberInput ni)
|
||||||
{
|
{
|
||||||
if (ni.InputType == GUINumberInput.NumberType.Int)
|
if (ni.InputType == NumberType.Int)
|
||||||
{
|
{
|
||||||
int.TryParse(customInterfaceElementList[i].Signal, out int value);
|
int.TryParse(customInterfaceElementList[i].Signal, out int value);
|
||||||
ni.IntValue = value;
|
ni.IntValue = value;
|
||||||
@@ -307,18 +349,28 @@ namespace Barotrauma.Items.Components
|
|||||||
//extradata contains an array of buttons clicked by the player (or nothing if the player didn't click anything)
|
//extradata contains an array of buttons clicked by the player (or nothing if the player didn't click anything)
|
||||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||||
{
|
{
|
||||||
if (customInterfaceElementList[i].HasPropertyName)
|
var element = customInterfaceElementList[i];
|
||||||
|
if (element.HasPropertyName)
|
||||||
{
|
{
|
||||||
if (!customInterfaceElementList[i].IsIntegerInput)
|
if (!element.IsNumberInput)
|
||||||
{
|
{
|
||||||
msg.Write(((GUITextBox)uiElements[i]).Text);
|
msg.Write(((GUITextBox)uiElements[i]).Text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Write(((GUINumberInput)uiElements[i]).IntValue.ToString());
|
switch (element.NumberType)
|
||||||
|
{
|
||||||
|
case NumberType.Float:
|
||||||
|
msg.Write(((GUINumberInput)uiElements[i]).FloatValue.ToString());
|
||||||
|
break;
|
||||||
|
case NumberType.Int:
|
||||||
|
default:
|
||||||
|
msg.Write(((GUINumberInput)uiElements[i]).IntValue.ToString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (customInterfaceElementList[i].ContinuousSignal)
|
else if (element.ContinuousSignal)
|
||||||
{
|
{
|
||||||
msg.Write(((GUITickBox)uiElements[i]).Selected);
|
msg.Write(((GUITickBox)uiElements[i]).Selected);
|
||||||
}
|
}
|
||||||
@@ -333,29 +385,38 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||||
{
|
{
|
||||||
if (customInterfaceElementList[i].HasPropertyName)
|
var element = customInterfaceElementList[i];
|
||||||
|
if (element.HasPropertyName)
|
||||||
{
|
{
|
||||||
if (!customInterfaceElementList[i].IsIntegerInput)
|
string newValue = msg.ReadString();
|
||||||
|
if (!element.IsNumberInput)
|
||||||
{
|
{
|
||||||
TextChanged(customInterfaceElementList[i], msg.ReadString());
|
TextChanged(element, newValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int.TryParse(msg.ReadString(), out int value);
|
switch (element.NumberType)
|
||||||
ValueChanged(customInterfaceElementList[i], value);
|
{
|
||||||
|
case NumberType.Int when int.TryParse(newValue, out int value):
|
||||||
|
ValueChanged(element, value);
|
||||||
|
break;
|
||||||
|
case NumberType.Float when TryParseFloatInvariantCulture(newValue, out float value):
|
||||||
|
ValueChanged(element, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool elementState = msg.ReadBoolean();
|
bool elementState = msg.ReadBoolean();
|
||||||
if (customInterfaceElementList[i].ContinuousSignal)
|
if (element.ContinuousSignal)
|
||||||
{
|
{
|
||||||
((GUITickBox)uiElements[i]).Selected = elementState;
|
((GUITickBox)uiElements[i]).Selected = elementState;
|
||||||
TickBoxToggled(customInterfaceElementList[i], elementState);
|
TickBoxToggled(element, elementState);
|
||||||
}
|
}
|
||||||
else if (elementState)
|
else if (elementState)
|
||||||
{
|
{
|
||||||
ButtonClicked(customInterfaceElementList[i]);
|
ButtonClicked(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ namespace Barotrauma
|
|||||||
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
||||||
{
|
{
|
||||||
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
||||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, flippedX && Prefab.CanSpriteFlipX ? rotationRad : -rotationRad) * Scale;
|
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, flippedX && Prefab.CanSpriteFlipX ? RotationRad : -RotationRad) * Scale;
|
||||||
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
||||||
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
||||||
decorativeSprite.Sprite.DrawTiled(spriteBatch,
|
decorativeSprite.Sprite.DrawTiled(spriteBatch,
|
||||||
@@ -376,17 +376,17 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (color.A > 0)
|
if (color.A > 0)
|
||||||
{
|
{
|
||||||
activeSprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, origin, rotationRad, Scale, activeSprite.effects, depth);
|
activeSprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, origin, RotationRad, Scale, activeSprite.effects, depth);
|
||||||
if (fadeInBrokenSprite != null)
|
if (fadeInBrokenSprite != null)
|
||||||
{
|
{
|
||||||
float d = Math.Min(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.999f);
|
float d = Math.Min(depth + (fadeInBrokenSprite.Sprite.Depth - activeSprite.Depth - 0.000001f), 0.999f);
|
||||||
fadeInBrokenSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + fadeInBrokenSprite.Offset.ToVector2() * Scale, color * fadeInBrokenSpriteAlpha, origin, rotationRad, Scale, activeSprite.effects, d);
|
fadeInBrokenSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + fadeInBrokenSprite.Offset.ToVector2() * Scale, color * fadeInBrokenSpriteAlpha, origin, RotationRad, Scale, activeSprite.effects, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Infector != null && (Infector.ParentBallastFlora.HasBrokenThrough || BallastFloraBehavior.AlwaysShowBallastFloraSprite))
|
if (Infector != null && (Infector.ParentBallastFlora.HasBrokenThrough || BallastFloraBehavior.AlwaysShowBallastFloraSprite))
|
||||||
{
|
{
|
||||||
Prefab.InfectedSprite?.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, Prefab.InfectedSprite.Origin, rotationRad, Scale, activeSprite.effects, depth - 0.001f);
|
Prefab.InfectedSprite?.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, Prefab.InfectedSprite.Origin, RotationRad, Scale, activeSprite.effects, depth - 0.001f);
|
||||||
Prefab.DamagedInfectedSprite?.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, Infector.HealthColor, Prefab.DamagedInfectedSprite.Origin, rotationRad, Scale, activeSprite.effects, depth - 0.002f);
|
Prefab.DamagedInfectedSprite?.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, Infector.HealthColor, Prefab.DamagedInfectedSprite.Origin, RotationRad, Scale, activeSprite.effects, depth - 0.002f);
|
||||||
}
|
}
|
||||||
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
||||||
{
|
{
|
||||||
@@ -394,11 +394,11 @@ namespace Barotrauma
|
|||||||
float rot = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
float rot = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
||||||
bool flipX = flippedX && Prefab.CanSpriteFlipX;
|
bool flipX = flippedX && Prefab.CanSpriteFlipX;
|
||||||
bool flipY = flippedY && Prefab.CanSpriteFlipY;
|
bool flipY = flippedY && Prefab.CanSpriteFlipY;
|
||||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, flipX ^ flipY ? rotationRad : -rotationRad) * Scale;
|
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, flipX ^ flipY ? RotationRad : -RotationRad) * Scale;
|
||||||
if (flipX) { offset.X = -offset.X; }
|
if (flipX) { offset.X = -offset.X; }
|
||||||
if (flipY) { offset.Y = -offset.Y; }
|
if (flipY) { offset.Y = -offset.Y; }
|
||||||
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
||||||
rotationRad + rot, decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale, activeSprite.effects,
|
RotationRad + rot, decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale, activeSprite.effects,
|
||||||
depth: Math.Min(depth + (decorativeSprite.Sprite.Depth - activeSprite.Depth), 0.999f));
|
depth: Math.Min(depth + (decorativeSprite.Sprite.Depth - activeSprite.Depth), 0.999f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
||||||
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
||||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, -rotationRad) * Scale;
|
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, -RotationRad) * Scale;
|
||||||
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
||||||
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
||||||
var ca = (float)Math.Cos(-body.Rotation);
|
var ca = (float)Math.Cos(-body.Rotation);
|
||||||
@@ -466,7 +466,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
||||||
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
||||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, -rotationRad) * Scale;
|
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier, -RotationRad) * Scale;
|
||||||
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
if (flippedX && Prefab.CanSpriteFlipX) { offset.X = -offset.X; }
|
||||||
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
if (flippedY && Prefab.CanSpriteFlipY) { offset.Y = -offset.Y; }
|
||||||
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
||||||
|
|||||||
@@ -60,12 +60,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
{
|
||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
WallEdgeBuffer?.Dispose();
|
WallEdgeBuffer?.Dispose();
|
||||||
@@ -482,12 +476,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
{
|
||||||
foreach (var vertexBuffer in vertexBuffers)
|
foreach (var vertexBuffer in vertexBuffers)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -230,14 +230,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (!disposing) return;
|
|
||||||
|
|
||||||
if (WaterEffect != null)
|
if (WaterEffect != null)
|
||||||
{
|
{
|
||||||
WaterEffect.Dispose();
|
WaterEffect.Dispose();
|
||||||
@@ -250,6 +242,5 @@ namespace Barotrauma
|
|||||||
basicEffect = null;
|
basicEffect = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,18 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
class LightManager
|
class LightManager
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// How many light sources are allowed to recalculate their light volumes per frame.
|
||||||
|
/// Pending calculations will be done on subsequent frames, starting from the light sources that have been waiting for a recalculation the longest.
|
||||||
|
/// </summary>
|
||||||
|
const int MaxLightVolumeRecalculationsPerFrame = 5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If zoomed further out than this, characters no longer obstruct lights behind them.
|
||||||
|
/// Improves performance, and isn't very noticeable if we do it after zoomed far out enough.
|
||||||
|
/// </summary>
|
||||||
|
const float ObstructLightsBehindCharactersZoomThreshold = 0.5f;
|
||||||
|
|
||||||
public static Entity ViewTarget { get; set; }
|
public static Entity ViewTarget { get; set; }
|
||||||
|
|
||||||
private float currLightMapScale;
|
private float currLightMapScale;
|
||||||
@@ -59,6 +71,8 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
private Vector2 losOffset;
|
private Vector2 losOffset;
|
||||||
|
|
||||||
|
private int recalculationCount;
|
||||||
|
|
||||||
public IEnumerable<LightSource> Lights
|
public IEnumerable<LightSource> Lights
|
||||||
{
|
{
|
||||||
get { return lights; }
|
get { return lights; }
|
||||||
@@ -151,6 +165,9 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<LightSource> activeLights = new List<LightSource>(capacity: 100);
|
private readonly List<LightSource> activeLights = new List<LightSource>(capacity: 100);
|
||||||
|
private readonly List<LightSource> activeLightsWithLightVolume = new List<LightSource>(capacity: 100);
|
||||||
|
|
||||||
|
public static int ActiveLightCount { get; private set; }
|
||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
@@ -180,11 +197,13 @@ namespace Barotrauma.Lights
|
|||||||
Rectangle viewRect = cam.WorldView;
|
Rectangle viewRect = cam.WorldView;
|
||||||
viewRect.Y -= cam.WorldView.Height;
|
viewRect.Y -= cam.WorldView.Height;
|
||||||
//check which lights need to be drawn
|
//check which lights need to be drawn
|
||||||
|
recalculationCount = 0;
|
||||||
activeLights.Clear();
|
activeLights.Clear();
|
||||||
foreach (LightSource light in lights)
|
foreach (LightSource light in lights)
|
||||||
{
|
{
|
||||||
if (!light.Enabled) { continue; }
|
if (!light.Enabled) { continue; }
|
||||||
if ((light.Color.A < 1 || light.Range < 1.0f) && !light.LightSourceParams.OverrideLightSpriteAlpha.HasValue) { continue; }
|
if ((light.Color.A < 1 || light.Range < 1.0f) && !light.LightSourceParams.OverrideLightSpriteAlpha.HasValue) { continue; }
|
||||||
|
|
||||||
if (light.ParentBody != null)
|
if (light.ParentBody != null)
|
||||||
{
|
{
|
||||||
light.ParentBody.UpdateDrawPosition();
|
light.ParentBody.UpdateDrawPosition();
|
||||||
@@ -205,8 +224,44 @@ namespace Barotrauma.Lights
|
|||||||
range = Math.Max(Math.Max(spriteRange, targetSize), range);
|
range = Math.Max(Math.Max(spriteRange, targetSize), range);
|
||||||
}
|
}
|
||||||
if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, range, viewRect)) { continue; }
|
if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, range, viewRect)) { continue; }
|
||||||
activeLights.Add(light);
|
|
||||||
|
light.Priority = lightPriority(range, light);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < activeLights.Count && light.Priority < activeLights[i].Priority)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
activeLights.Insert(i, light);
|
||||||
}
|
}
|
||||||
|
ActiveLightCount = activeLights.Count;
|
||||||
|
|
||||||
|
float lightPriority(float range, LightSource light)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
range *
|
||||||
|
((Character.Controlled?.Submarine != null && light.ParentSub == Character.Controlled?.Submarine) ? 2.0f : 1.0f) *
|
||||||
|
(light.CastShadows ? 10.0f : 1.0f) *
|
||||||
|
(light.LightSourceParams.OverrideLightSpriteAlpha ?? (light.Color.A / 255.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
//find the lights with an active light volume
|
||||||
|
activeLightsWithLightVolume.Clear();
|
||||||
|
foreach (var activeLight in activeLights)
|
||||||
|
{
|
||||||
|
if (activeLight.Range < 1.0f || activeLight.Color.A < 1 || activeLight.CurrentBrightness <= 0.0f) { continue; }
|
||||||
|
activeLightsWithLightVolume.Add(activeLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove some lights with a light volume if there's too many of them
|
||||||
|
if (activeLightsWithLightVolume.Count > GameSettings.CurrentConfig.Graphics.VisibleLightLimit)
|
||||||
|
{
|
||||||
|
for (int i = GameSettings.CurrentConfig.Graphics.VisibleLightLimit; i < activeLightsWithLightVolume.Count; i++)
|
||||||
|
{
|
||||||
|
activeLights.Remove(activeLightsWithLightVolume[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeLights.Sort((l1, l2) => l1.LastRecalculationTime.CompareTo(l2.LastRecalculationTime));
|
||||||
|
|
||||||
//draw light sprites attached to characters
|
//draw light sprites attached to characters
|
||||||
//render into a separate rendertarget using alpha blending (instead of on top of everything else with alpha blending)
|
//render into a separate rendertarget using alpha blending (instead of on top of everything else with alpha blending)
|
||||||
@@ -235,7 +290,7 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
if (!light.IsBackground || light.CurrentBrightness <= 0.0f) { continue; }
|
if (!light.IsBackground || light.CurrentBrightness <= 0.0f) { continue; }
|
||||||
light.DrawSprite(spriteBatch, cam);
|
light.DrawSprite(spriteBatch, cam);
|
||||||
light.DrawLightVolume(spriteBatch, lightEffect, transform);
|
light.DrawLightVolume(spriteBatch, lightEffect, transform, recalculationCount < MaxLightVolumeRecalculationsPerFrame, ref recalculationCount);
|
||||||
}
|
}
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive);
|
GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
@@ -243,14 +298,6 @@ namespace Barotrauma.Lights
|
|||||||
//draw a black rectangle on hulls to hide background lights behind subs
|
//draw a black rectangle on hulls to hide background lights behind subs
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/*if (backgroundObstructor != null)
|
|
||||||
{
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
|
|
||||||
spriteBatch.Draw(backgroundObstructor, new Rectangle(0, 0,
|
|
||||||
(int)(GameMain.GraphicsWidth * currLightMapScale), (int)(GameMain.GraphicsHeight * currLightMapScale)), Color.Black);
|
|
||||||
spriteBatch.End();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, transformMatrix: spriteBatchTransform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, transformMatrix: spriteBatchTransform);
|
||||||
Dictionary<Hull, Rectangle> visibleHulls = GetVisibleHulls(cam);
|
Dictionary<Hull, Rectangle> visibleHulls = GetVisibleHulls(cam);
|
||||||
foreach (KeyValuePair<Hull, Rectangle> hull in visibleHulls)
|
foreach (KeyValuePair<Hull, Rectangle> hull in visibleHulls)
|
||||||
@@ -292,41 +339,44 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
//draw characters to obstruct the highlighted items/characters and light sprites
|
//draw characters to obstruct the highlighted items/characters and light sprites
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
|
if (cam.Zoom > ObstructLightsBehindCharactersZoomThreshold)
|
||||||
SolidColorEffect.CurrentTechnique = SolidColorEffect.Techniques["SolidVertexColor"];
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
|
|
||||||
foreach (Character character in Character.CharacterList)
|
|
||||||
{
|
{
|
||||||
if (character.CurrentHull == null || !character.Enabled || !character.IsVisible) { continue; }
|
SolidColorEffect.CurrentTechnique = SolidColorEffect.Techniques["SolidVertexColor"];
|
||||||
if (Character.Controlled?.FocusedCharacter == character) { continue; }
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
|
||||||
Color lightColor = character.CurrentHull.AmbientLight == Color.TransparentBlack ?
|
foreach (Character character in Character.CharacterList)
|
||||||
Color.Black :
|
|
||||||
character.CurrentHull.AmbientLight.Multiply(character.CurrentHull.AmbientLight.A / 255.0f).Opaque();
|
|
||||||
foreach (Limb limb in character.AnimController.Limbs)
|
|
||||||
{
|
{
|
||||||
if (limb.DeformSprite != null) { continue; }
|
if (character.CurrentHull == null || !character.Enabled || !character.IsVisible) { continue; }
|
||||||
limb.Draw(spriteBatch, cam, lightColor);
|
if (Character.Controlled?.FocusedCharacter == character) { continue; }
|
||||||
|
Color lightColor = character.CurrentHull.AmbientLight == Color.TransparentBlack ?
|
||||||
|
Color.Black :
|
||||||
|
character.CurrentHull.AmbientLight.Multiply(character.CurrentHull.AmbientLight.A / 255.0f).Opaque();
|
||||||
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
|
{
|
||||||
|
if (limb.DeformSprite != null) { continue; }
|
||||||
|
limb.Draw(spriteBatch, cam, lightColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
spriteBatch.End();
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShaderSolidVertexColor"];
|
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShaderSolidVertexColor"];
|
||||||
DeformableSprite.Effect.CurrentTechnique.Passes[0].Apply();
|
DeformableSprite.Effect.CurrentTechnique.Passes[0].Apply();
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, transformMatrix: spriteBatchTransform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, transformMatrix: spriteBatchTransform);
|
||||||
foreach (Character character in Character.CharacterList)
|
foreach (Character character in Character.CharacterList)
|
||||||
{
|
|
||||||
if (character.CurrentHull == null || !character.Enabled || !character.IsVisible) { continue; }
|
|
||||||
if (Character.Controlled?.FocusedCharacter == character) { continue; }
|
|
||||||
Color lightColor = character.CurrentHull.AmbientLight == Color.TransparentBlack ?
|
|
||||||
Color.Black :
|
|
||||||
character.CurrentHull.AmbientLight.Multiply(character.CurrentHull.AmbientLight.A / 255.0f).Opaque();
|
|
||||||
foreach (Limb limb in character.AnimController.Limbs)
|
|
||||||
{
|
{
|
||||||
if (limb.DeformSprite == null) { continue; }
|
if (character.CurrentHull == null || !character.Enabled || !character.IsVisible) { continue; }
|
||||||
limb.Draw(spriteBatch, cam, lightColor);
|
if (Character.Controlled?.FocusedCharacter == character) { continue; }
|
||||||
|
Color lightColor = character.CurrentHull.AmbientLight == Color.TransparentBlack ?
|
||||||
|
Color.Black :
|
||||||
|
character.CurrentHull.AmbientLight.Multiply(character.CurrentHull.AmbientLight.A / 255.0f).Opaque();
|
||||||
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
|
{
|
||||||
|
if (limb.DeformSprite == null) { continue; }
|
||||||
|
limb.Draw(spriteBatch, cam, lightColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
spriteBatch.End();
|
|
||||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShader"];
|
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShader"];
|
||||||
graphics.BlendState = BlendState.Additive;
|
graphics.BlendState = BlendState.Additive;
|
||||||
|
|
||||||
@@ -344,7 +394,7 @@ namespace Barotrauma.Lights
|
|||||||
foreach (LightSource light in activeLights)
|
foreach (LightSource light in activeLights)
|
||||||
{
|
{
|
||||||
if (light.IsBackground || light.CurrentBrightness <= 0.0f) { continue; }
|
if (light.IsBackground || light.CurrentBrightness <= 0.0f) { continue; }
|
||||||
light.DrawLightVolume(spriteBatch, lightEffect, transform);
|
light.DrawLightVolume(spriteBatch, lightEffect, transform, recalculationCount < MaxLightVolumeRecalculationsPerFrame, ref recalculationCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
lightEffect.World = transform;
|
lightEffect.World = transform;
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ namespace Barotrauma.Lights
|
|||||||
private VertexPositionColorTexture[] vertices;
|
private VertexPositionColorTexture[] vertices;
|
||||||
private short[] indices;
|
private short[] indices;
|
||||||
|
|
||||||
private List<ConvexHullList> hullsInRange;
|
private readonly List<ConvexHullList> hullsInRange;
|
||||||
|
|
||||||
public Texture2D texture;
|
public Texture2D texture;
|
||||||
|
|
||||||
@@ -246,9 +246,9 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
//when were the vertices of the light volume last calculated
|
//when were the vertices of the light volume last calculated
|
||||||
private float lastRecalculationTime;
|
public float LastRecalculationTime { get; private set; }
|
||||||
|
|
||||||
private Dictionary<Submarine, Vector2> diffToSub;
|
private readonly Dictionary<Submarine, Vector2> diffToSub;
|
||||||
|
|
||||||
private DynamicVertexBuffer lightVolumeBuffer;
|
private DynamicVertexBuffer lightVolumeBuffer;
|
||||||
private DynamicIndexBuffer lightVolumeIndexBuffer;
|
private DynamicIndexBuffer lightVolumeIndexBuffer;
|
||||||
@@ -376,6 +376,8 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float Priority;
|
||||||
|
|
||||||
private Vector2 lightTextureTargetSize;
|
private Vector2 lightTextureTargetSize;
|
||||||
|
|
||||||
public Vector2 LightTextureTargetSize
|
public Vector2 LightTextureTargetSize
|
||||||
@@ -423,7 +425,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
public bool Enabled = true;
|
public bool Enabled = true;
|
||||||
|
|
||||||
private ISerializableEntity conditionalTarget;
|
private readonly ISerializableEntity conditionalTarget;
|
||||||
private readonly PropertyConditional.Comparison comparison;
|
private readonly PropertyConditional.Comparison comparison;
|
||||||
private readonly List<PropertyConditional> conditionals = new List<PropertyConditional>();
|
private readonly List<PropertyConditional> conditionals = new List<PropertyConditional>();
|
||||||
|
|
||||||
@@ -561,7 +563,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
foreach (var ch in chList.List)
|
foreach (var ch in chList.List)
|
||||||
{
|
{
|
||||||
if (ch.LastVertexChangeTime > lastRecalculationTime && !chList.IsHidden.Contains(ch))
|
if (ch.LastVertexChangeTime > LastRecalculationTime && !chList.IsHidden.Contains(ch))
|
||||||
{
|
{
|
||||||
NeedsRecalculation = true;
|
NeedsRecalculation = true;
|
||||||
break;
|
break;
|
||||||
@@ -1289,7 +1291,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
//visualize light recalculations
|
//visualize light recalculations
|
||||||
float timeSinceRecalculation = (float)Timing.TotalTime - lastRecalculationTime;
|
float timeSinceRecalculation = (float)Timing.TotalTime - LastRecalculationTime;
|
||||||
if (timeSinceRecalculation < 0.1f)
|
if (timeSinceRecalculation < 0.1f)
|
||||||
{
|
{
|
||||||
GUI.DrawRectangle(spriteBatch, drawPos - Vector2.One * 10, Vector2.One * 20, GUIStyle.Red * (1.0f - timeSinceRecalculation * 10.0f), isFilled: true);
|
GUI.DrawRectangle(spriteBatch, drawPos - Vector2.One * 10, Vector2.One * 20, GUIStyle.Red * (1.0f - timeSinceRecalculation * 10.0f), isFilled: true);
|
||||||
@@ -1313,7 +1315,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawLightVolume(SpriteBatch spriteBatch, BasicEffect lightEffect, Matrix transform)
|
public void DrawLightVolume(SpriteBatch spriteBatch, BasicEffect lightEffect, Matrix transform, bool allowRecalculation, ref int recalculationCount)
|
||||||
{
|
{
|
||||||
if (Range < 1.0f || Color.A < 1 || CurrentBrightness <= 0.0f) { return; }
|
if (Range < 1.0f || Color.A < 1 || CurrentBrightness <= 0.0f) { return; }
|
||||||
|
|
||||||
@@ -1338,8 +1340,9 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
CheckHullsInRange();
|
CheckHullsInRange();
|
||||||
|
|
||||||
if (NeedsRecalculation)
|
if (NeedsRecalculation && allowRecalculation)
|
||||||
{
|
{
|
||||||
|
recalculationCount++;
|
||||||
var verts = FindRaycastHits();
|
var verts = FindRaycastHits();
|
||||||
if (verts == null)
|
if (verts == null)
|
||||||
{
|
{
|
||||||
@@ -1352,7 +1355,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
CalculateLightVertices(verts);
|
CalculateLightVertices(verts);
|
||||||
|
|
||||||
lastRecalculationTime = (float)Timing.TotalTime;
|
LastRecalculationTime = (float)Timing.TotalTime;
|
||||||
NeedsRecalculation = false;
|
NeedsRecalculation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -977,7 +977,7 @@ namespace Barotrauma
|
|||||||
Vector2 center = rectCenter + (connection.CenterPos + viewOffset) * zoom;
|
Vector2 center = rectCenter + (connection.CenterPos + viewOffset) * zoom;
|
||||||
if (viewArea.Contains(center) && connection.Biome != null)
|
if (viewArea.Contains(center) && connection.Biome != null)
|
||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch, center, connection.Biome.Identifier + " (" + connection.Difficulty + ")", Color.White);
|
GUI.DrawString(spriteBatch, center, (connection.LevelData?.GenerationParams?.Identifier ?? connection.Biome.Identifier) + " (" + (int)connection.Difficulty + ")", Color.White);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Barotrauma
|
|||||||
class SubmarinePreview : IDisposable
|
class SubmarinePreview : IDisposable
|
||||||
{
|
{
|
||||||
private SpriteRecorder spriteRecorder;
|
private SpriteRecorder spriteRecorder;
|
||||||
private SubmarineInfo submarineInfo;
|
private readonly SubmarineInfo submarineInfo;
|
||||||
private Camera camera;
|
private Camera camera;
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
private volatile bool isDisposed;
|
private volatile bool isDisposed;
|
||||||
@@ -66,7 +66,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static void Close()
|
public static void Close()
|
||||||
{
|
{
|
||||||
instance?.Dispose();
|
instance?.Dispose(); instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SubmarinePreview(SubmarineInfo subInfo)
|
private SubmarinePreview(SubmarineInfo subInfo)
|
||||||
@@ -655,7 +655,8 @@ namespace Barotrauma
|
|||||||
previewFrame.RectTransform.Parent = null;
|
previewFrame.RectTransform.Parent = null;
|
||||||
previewFrame = null;
|
previewFrame = null;
|
||||||
}
|
}
|
||||||
spriteRecorder?.Dispose();
|
spriteRecorder?.Dispose(); spriteRecorder = null;
|
||||||
|
camera?.Dispose(); camera = null;
|
||||||
isDisposed = true;
|
isDisposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,26 +146,19 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposed) return;
|
|
||||||
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
if (WriteStream != null)
|
|
||||||
{
|
|
||||||
WriteStream.Flush();
|
|
||||||
WriteStream.Close();
|
|
||||||
WriteStream.Dispose();
|
|
||||||
WriteStream = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
disposed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
if (disposed) { return; }
|
||||||
|
|
||||||
|
if (WriteStream != null)
|
||||||
|
{
|
||||||
|
WriteStream.Flush();
|
||||||
|
WriteStream.Close();
|
||||||
|
WriteStream.Dispose();
|
||||||
|
WriteStream = null;
|
||||||
|
}
|
||||||
|
disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3571,13 +3571,13 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
durationInputDays = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), GUINumberInput.NumberType.Int)
|
durationInputDays = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueFloat = 1000
|
MaxValueFloat = 1000
|
||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), TextManager.Get("Days"));
|
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), TextManager.Get("Days"));
|
||||||
durationInputHours = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), GUINumberInput.NumberType.Int)
|
durationInputHours = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), durationContainer.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueFloat = 24
|
MaxValueFloat = 24
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace Barotrauma
|
|||||||
ToolTip = TextManager.Get("Karma." + propertyName + "ToolTip")
|
ToolTip = TextManager.Get("Karma." + propertyName + "ToolTip")
|
||||||
};
|
};
|
||||||
|
|
||||||
var numInput = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), container.RectTransform), GUINumberInput.NumberType.Int)
|
var numInput = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), container.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = min,
|
MinValueInt = min,
|
||||||
MaxValueInt = max
|
MaxValueInt = max
|
||||||
|
|||||||
-6
@@ -373,12 +373,6 @@ namespace Barotrauma.Networking
|
|||||||
OnDisconnect?.Invoke(disableReconnect);
|
OnDisconnect?.Invoke(disableReconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SteamP2PClientPeer()
|
|
||||||
{
|
|
||||||
OnDisconnect = null;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SendMsgInternal(DeliveryMethod deliveryMethod, IWriteMessage msg)
|
protected override void SendMsgInternal(DeliveryMethod deliveryMethod, IWriteMessage msg)
|
||||||
{
|
{
|
||||||
Steamworks.P2PSend sendType;
|
Steamworks.P2PSend sendType;
|
||||||
|
|||||||
-6
@@ -447,12 +447,6 @@ namespace Barotrauma.Networking
|
|||||||
ChildServerRelay.Write(bufToSend);
|
ChildServerRelay.Write(bufToSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SteamP2POwnerPeer()
|
|
||||||
{
|
|
||||||
OnDisconnect = null;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SendMsgInternal(DeliveryMethod deliveryMethod, IWriteMessage msg)
|
protected override void SendMsgInternal(DeliveryMethod deliveryMethod, IWriteMessage msg)
|
||||||
{
|
{
|
||||||
//not currently used by SteamP2POwnerPeer
|
//not currently used by SteamP2POwnerPeer
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Barotrauma.Networking
|
|||||||
else if (GUIComponent is GUIDropDown dropdown) return dropdown.SelectedData;
|
else if (GUIComponent is GUIDropDown dropdown) return dropdown.SelectedData;
|
||||||
else if (GUIComponent is GUINumberInput numInput)
|
else if (GUIComponent is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Int) { return numInput.IntValue; } else { return numInput.FloatValue; }
|
if (numInput.InputType == NumberType.Int) { return numInput.IntValue; } else { return numInput.FloatValue; }
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace Barotrauma.Networking
|
|||||||
else if (GUIComponent is GUIDropDown dropdown) dropdown.SelectItem(value);
|
else if (GUIComponent is GUIDropDown dropdown) dropdown.SelectItem(value);
|
||||||
else if (GUIComponent is GUINumberInput numInput)
|
else if (GUIComponent is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Int)
|
if (numInput.InputType == NumberType.Int)
|
||||||
{
|
{
|
||||||
numInput.IntValue = (int)value;
|
numInput.IntValue = (int)value;
|
||||||
}
|
}
|
||||||
@@ -480,15 +480,12 @@ namespace Barotrauma.Networking
|
|||||||
// game settings
|
// game settings
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
var roundsTab = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), settingsTabs[(int)SettingsTab.Rounds].RectTransform, Anchor.Center))
|
var roundsTab = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), settingsTabs[(int)SettingsTab.Rounds].RectTransform, Anchor.Center)) { };
|
||||||
{
|
|
||||||
Stretch = true,
|
|
||||||
RelativeSpacing = 0.02f
|
|
||||||
};
|
|
||||||
|
|
||||||
|
GUILayoutGroup playStyleLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.2f), roundsTab.RectTransform));
|
||||||
// Play Style Selection
|
// Play Style Selection
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform), TextManager.Get("ServerSettingsPlayStyle"), font: GUIStyle.SubHeadingFont);
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), playStyleLayout.RectTransform), TextManager.Get("ServerSettingsPlayStyle"), font: GUIStyle.SubHeadingFont);
|
||||||
var playstyleList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.16f), roundsTab.RectTransform))
|
var playstyleList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), playStyleLayout.RectTransform))
|
||||||
{
|
{
|
||||||
AutoHideScrollBar = true,
|
AutoHideScrollBar = true,
|
||||||
UseGridLayout = true
|
UseGridLayout = true
|
||||||
@@ -510,11 +507,16 @@ namespace Barotrauma.Networking
|
|||||||
GUITextBlock.AutoScaleAndNormalize(playStyleTickBoxes.Select(t => t.TextBlock));
|
GUITextBlock.AutoScaleAndNormalize(playStyleTickBoxes.Select(t => t.TextBlock));
|
||||||
playstyleList.RectTransform.MinSize = new Point(0, (int)(playstyleList.Content.Children.First().Rect.Height * 2.0f + playstyleList.Padding.Y + playstyleList.Padding.W));
|
playstyleList.RectTransform.MinSize = new Point(0, (int)(playstyleList.Content.Children.First().Rect.Height * 2.0f + playstyleList.Padding.Y + playstyleList.Padding.W));
|
||||||
|
|
||||||
var endVoteBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform),
|
GUILayoutGroup sliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.35f), roundsTab.RectTransform))
|
||||||
|
{
|
||||||
|
Stretch = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var endVoteBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), sliderLayout.RectTransform),
|
||||||
TextManager.Get("ServerSettingsEndRoundVoting"));
|
TextManager.Get("ServerSettingsEndRoundVoting"));
|
||||||
GetPropertyData(nameof(AllowEndVoting)).AssignGUIComponent(endVoteBox);
|
GetPropertyData(nameof(AllowEndVoting)).AssignGUIComponent(endVoteBox);
|
||||||
|
|
||||||
CreateLabeledSlider(roundsTab, "ServerSettingsEndRoundVotesRequired", out slider, out sliderLabel);
|
CreateLabeledSlider(sliderLayout, "ServerSettingsEndRoundVotesRequired", out slider, out sliderLabel);
|
||||||
|
|
||||||
LocalizedString endRoundLabel = sliderLabel.Text;
|
LocalizedString endRoundLabel = sliderLabel.Text;
|
||||||
slider.Step = 0.2f;
|
slider.Step = 0.2f;
|
||||||
@@ -527,11 +529,11 @@ namespace Barotrauma.Networking
|
|||||||
};
|
};
|
||||||
slider.OnMoved(slider, slider.BarScroll);
|
slider.OnMoved(slider, slider.BarScroll);
|
||||||
|
|
||||||
var respawnBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform),
|
var respawnBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), sliderLayout.RectTransform),
|
||||||
TextManager.Get("ServerSettingsAllowRespawning"));
|
TextManager.Get("ServerSettingsAllowRespawning"));
|
||||||
GetPropertyData(nameof(AllowRespawn)).AssignGUIComponent(respawnBox);
|
GetPropertyData(nameof(AllowRespawn)).AssignGUIComponent(respawnBox);
|
||||||
|
|
||||||
CreateLabeledSlider(roundsTab, "ServerSettingsRespawnInterval", out slider, out sliderLabel);
|
CreateLabeledSlider(sliderLayout, "ServerSettingsRespawnInterval", out slider, out sliderLabel);
|
||||||
LocalizedString intervalLabel = sliderLabel.Text;
|
LocalizedString intervalLabel = sliderLabel.Text;
|
||||||
slider.Range = new Vector2(10.0f, 600.0f);
|
slider.Range = new Vector2(10.0f, 600.0f);
|
||||||
slider.StepValue = 10.0f;
|
slider.StepValue = 10.0f;
|
||||||
@@ -544,7 +546,7 @@ namespace Barotrauma.Networking
|
|||||||
};
|
};
|
||||||
slider.OnMoved(slider, slider.BarScroll);
|
slider.OnMoved(slider, slider.BarScroll);
|
||||||
|
|
||||||
var respawnLayout = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), roundsTab.RectTransform),
|
var respawnLayout = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), sliderLayout.RectTransform),
|
||||||
isHorizontal: true);
|
isHorizontal: true);
|
||||||
|
|
||||||
var minRespawnLayout
|
var minRespawnLayout
|
||||||
@@ -611,12 +613,13 @@ namespace Barotrauma.Networking
|
|||||||
};
|
};
|
||||||
slider.OnMoved(slider, slider.BarScroll);
|
slider.OnMoved(slider, slider.BarScroll);
|
||||||
|
|
||||||
|
GUILayoutGroup losModeLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.14f), roundsTab.RectTransform));
|
||||||
|
|
||||||
var losModeLabel = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform),
|
var losModeLabel = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), losModeLayout.RectTransform),
|
||||||
TextManager.Get("LosEffect"));
|
TextManager.Get("LosEffect"));
|
||||||
|
|
||||||
var losModeRadioButtonLayout
|
var losModeRadioButtonLayout
|
||||||
= new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), roundsTab.RectTransform),
|
= new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.6f), losModeLayout.RectTransform),
|
||||||
isHorizontal: true)
|
isHorizontal: true)
|
||||||
{
|
{
|
||||||
Stretch = true
|
Stretch = true
|
||||||
@@ -631,24 +634,29 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
GetPropertyData(nameof(LosMode)).AssignGUIComponent(losModeRadioButtonGroup);
|
GetPropertyData(nameof(LosMode)).AssignGUIComponent(losModeRadioButtonGroup);
|
||||||
|
|
||||||
var traitorsMinPlayerCount = CreateLabeledNumberInput(roundsTab, "ServerSettingsTraitorsMinPlayerCount", 1, 16, "ServerSettingsTraitorsMinPlayerCountToolTip");
|
GUILayoutGroup numberLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.3f), roundsTab.RectTransform))
|
||||||
|
{
|
||||||
|
Stretch = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var traitorsMinPlayerCount = CreateLabeledNumberInput(numberLayout, "ServerSettingsTraitorsMinPlayerCount", 1, 16, "ServerSettingsTraitorsMinPlayerCountToolTip");
|
||||||
GetPropertyData(nameof(TraitorsMinPlayerCount)).AssignGUIComponent(traitorsMinPlayerCount);
|
GetPropertyData(nameof(TraitorsMinPlayerCount)).AssignGUIComponent(traitorsMinPlayerCount);
|
||||||
|
|
||||||
var maximumTransferAmount = CreateLabeledNumberInput(roundsTab, "serversettingsmaximumtransferrequest", 0, CampaignMode.MaxMoney, "serversettingsmaximumtransferrequesttooltip");
|
var maximumTransferAmount = CreateLabeledNumberInput(numberLayout, "serversettingsmaximumtransferrequest", 0, CampaignMode.MaxMoney, "serversettingsmaximumtransferrequesttooltip");
|
||||||
GetPropertyData(nameof(MaximumMoneyTransferRequest)).AssignGUIComponent(maximumTransferAmount);
|
GetPropertyData(nameof(MaximumMoneyTransferRequest)).AssignGUIComponent(maximumTransferAmount);
|
||||||
|
|
||||||
var lootedMoneyDestination = CreateLabeledDropdown(roundsTab, "serversettingslootedmoneydestination", numElements: 2, "serversettingslootedmoneydestinationtooltip");
|
var lootedMoneyDestination = CreateLabeledDropdown(numberLayout, "serversettingslootedmoneydestination", numElements: 2, "serversettingslootedmoneydestinationtooltip");
|
||||||
lootedMoneyDestination.AddItem(TextManager.Get("lootedmoneydestination.bank"), LootedMoneyDestination.Bank);
|
lootedMoneyDestination.AddItem(TextManager.Get("lootedmoneydestination.bank"), LootedMoneyDestination.Bank);
|
||||||
lootedMoneyDestination.AddItem(TextManager.Get("lootedmoneydestination.wallet"), LootedMoneyDestination.Wallet);
|
lootedMoneyDestination.AddItem(TextManager.Get("lootedmoneydestination.wallet"), LootedMoneyDestination.Wallet);
|
||||||
GetPropertyData(nameof(LootedMoneyDestination)).AssignGUIComponent(lootedMoneyDestination);
|
GetPropertyData(nameof(LootedMoneyDestination)).AssignGUIComponent(lootedMoneyDestination);
|
||||||
|
|
||||||
var ragdollButtonBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform), TextManager.Get("ServerSettingsAllowRagdollButton"));
|
var ragdollButtonBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), numberLayout.RectTransform), TextManager.Get("ServerSettingsAllowRagdollButton"));
|
||||||
GetPropertyData(nameof(AllowRagdollButton)).AssignGUIComponent(ragdollButtonBox);
|
GetPropertyData(nameof(AllowRagdollButton)).AssignGUIComponent(ragdollButtonBox);
|
||||||
|
|
||||||
var disableBotConversationsBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), roundsTab.RectTransform), TextManager.Get("ServerSettingsDisableBotConversations"));
|
var disableBotConversationsBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), numberLayout.RectTransform), TextManager.Get("ServerSettingsDisableBotConversations"));
|
||||||
GetPropertyData(nameof(DisableBotConversations)).AssignGUIComponent(disableBotConversationsBox);
|
GetPropertyData(nameof(DisableBotConversations)).AssignGUIComponent(disableBotConversationsBox);
|
||||||
|
|
||||||
var buttonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), roundsTab.RectTransform), isHorizontal: true)
|
GUILayoutGroup buttonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), roundsTab.RectTransform), isHorizontal: true)
|
||||||
{
|
{
|
||||||
Stretch = true,
|
Stretch = true,
|
||||||
RelativeSpacing = 0.05f
|
RelativeSpacing = 0.05f
|
||||||
@@ -755,7 +763,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
ExtraCargo.TryGetValue(ip, out int cargoVal);
|
ExtraCargo.TryGetValue(ip, out int cargoVal);
|
||||||
var amountInput = new GUINumberInput(new RectTransform(new Vector2(0.35f, 1.0f), itemFrame.RectTransform),
|
var amountInput = new GUINumberInput(new RectTransform(new Vector2(0.35f, 1.0f), itemFrame.RectTransform),
|
||||||
GUINumberInput.NumberType.Int, textAlignment: Alignment.CenterLeft)
|
NumberType.Int, textAlignment: Alignment.CenterLeft)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = MaxExtraCargoItemsOfType,
|
MaxValueInt = MaxExtraCargoItemsOfType,
|
||||||
@@ -987,7 +995,7 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
label.ToolTip = TextManager.Get(toolTipTag);
|
label.ToolTip = TextManager.Get(toolTipTag);
|
||||||
}
|
}
|
||||||
var input = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), container.RectTransform), GUINumberInput.NumberType.Int)
|
var input = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), container.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = min,
|
MinValueInt = min,
|
||||||
MaxValueInt = max
|
MaxValueInt = max
|
||||||
|
|||||||
+1
-1
@@ -2280,7 +2280,7 @@ namespace Barotrauma.CharacterEditor
|
|||||||
var colorLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), colorComponentLabels[i],
|
var colorLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), colorComponentLabels[i],
|
||||||
font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ namespace Barotrauma.CharacterEditor
|
|||||||
{
|
{
|
||||||
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.RectComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.RectComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), GUINumberInput.NumberType.Int)
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -863,7 +863,7 @@ namespace Barotrauma.CharacterEditor
|
|||||||
var limbTypeField = GUI.CreateEnumField(limbType, elementSize, GetCharacterEditorTranslation("LimbType"), group.RectTransform, font: GUIStyle.Font);
|
var limbTypeField = GUI.CreateEnumField(limbType, elementSize, GetCharacterEditorTranslation("LimbType"), group.RectTransform, font: GUIStyle.Font);
|
||||||
var sourceRectField = GUI.CreateRectangleField(sourceRect ?? new Rectangle(0, 100 * LimbGUIElements.Count, 100, 100), elementSize, GetCharacterEditorTranslation("SourceRectangle"), group.RectTransform, font: GUIStyle.Font);
|
var sourceRectField = GUI.CreateRectangleField(sourceRect ?? new Rectangle(0, 100 * LimbGUIElements.Count, 100, 100), elementSize, GetCharacterEditorTranslation("SourceRectangle"), group.RectTransform, font: GUIStyle.Font);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), idField.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("ID"));
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), idField.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("ID"));
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), idField.RectTransform, Anchor.TopRight), GUINumberInput.NumberType.Int)
|
new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), idField.RectTransform, Anchor.TopRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = byte.MaxValue,
|
MaxValueInt = byte.MaxValue,
|
||||||
@@ -912,7 +912,7 @@ namespace Barotrauma.CharacterEditor
|
|||||||
};
|
};
|
||||||
var limb1Field = new GUIFrame(new RectTransform(new Point(group.Rect.Width, elementSize), group.RectTransform), style: null);
|
var limb1Field = new GUIFrame(new RectTransform(new Point(group.Rect.Width, elementSize), group.RectTransform), style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), limb1Field.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("LimbWithIndex").Replace("[index]", "1"));
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), limb1Field.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("LimbWithIndex").Replace("[index]", "1"));
|
||||||
var limb1InputField = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), limb1Field.RectTransform, Anchor.TopRight), GUINumberInput.NumberType.Int)
|
var limb1InputField = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), limb1Field.RectTransform, Anchor.TopRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = byte.MaxValue,
|
MaxValueInt = byte.MaxValue,
|
||||||
@@ -920,7 +920,7 @@ namespace Barotrauma.CharacterEditor
|
|||||||
};
|
};
|
||||||
var limb2Field = new GUIFrame(new RectTransform(new Point(group.Rect.Width, elementSize), group.RectTransform), style: null);
|
var limb2Field = new GUIFrame(new RectTransform(new Point(group.Rect.Width, elementSize), group.RectTransform), style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), limb2Field.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("LimbWithIndex").Replace("[index]", "2"));
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1), limb2Field.RectTransform, Anchor.TopLeft), GetCharacterEditorTranslation("LimbWithIndex").Replace("[index]", "2"));
|
||||||
var limb2InputField = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), limb2Field.RectTransform, Anchor.TopRight), GUINumberInput.NumberType.Int)
|
var limb2InputField = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1), limb2Field.RectTransform, Anchor.TopRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = byte.MaxValue,
|
MaxValueInt = byte.MaxValue,
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attach number inputs to our generated parent elements
|
// attach number inputs to our generated parent elements
|
||||||
var rInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[0].RectTransform), GUINumberInput.NumberType.Int) { IntValue = BackgroundColor.R };
|
var rInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[0].RectTransform), NumberType.Int) { IntValue = BackgroundColor.R };
|
||||||
var gInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[1].RectTransform), GUINumberInput.NumberType.Int) { IntValue = BackgroundColor.G };
|
var gInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[1].RectTransform), NumberType.Int) { IntValue = BackgroundColor.G };
|
||||||
var bInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[2].RectTransform), GUINumberInput.NumberType.Int) { IntValue = BackgroundColor.B };
|
var bInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1f), layoutParents[2].RectTransform), NumberType.Int) { IntValue = BackgroundColor.B };
|
||||||
|
|
||||||
rInput.MinValueInt = gInput.MinValueInt = bInput.MinValueInt = 0;
|
rInput.MinValueInt = gInput.MinValueInt = bInput.MinValueInt = 0;
|
||||||
rInput.MaxValueInt = gInput.MaxValueInt = bInput.MaxValueInt = 255;
|
rInput.MaxValueInt = gInput.MaxValueInt = bInput.MaxValueInt = 255;
|
||||||
|
|||||||
@@ -818,7 +818,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else if (type == typeof(float) || type == typeof(int))
|
else if (type == typeof(float) || type == typeof(int))
|
||||||
{
|
{
|
||||||
GUINumberInput valueInput = new GUINumberInput(new RectTransform(Vector2.One, layout.RectTransform), GUINumberInput.NumberType.Float) { FloatValue = (float) (newValue ?? 0.0f) };
|
GUINumberInput valueInput = new GUINumberInput(new RectTransform(Vector2.One, layout.RectTransform), NumberType.Float) { FloatValue = (float) (newValue ?? 0.0f) };
|
||||||
valueInput.OnValueChanged += component => { newValue = component.FloatValue; };
|
valueInput.OnValueChanged += component => { newValue = component.FloatValue; };
|
||||||
}
|
}
|
||||||
else if (type == typeof(bool))
|
else if (type == typeof(bool))
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private readonly Color[] tunnelDebugColors = new Color[] { Color.White, Color.Cyan, Color.LightGreen, Color.Red, Color.LightYellow, Color.LightSeaGreen };
|
private readonly Color[] tunnelDebugColors = new Color[] { Color.White, Color.Cyan, Color.LightGreen, Color.Red, Color.LightYellow, Color.LightSeaGreen };
|
||||||
|
|
||||||
|
private LevelData currentLevelData;
|
||||||
|
|
||||||
public LevelEditorScreen()
|
public LevelEditorScreen()
|
||||||
{
|
{
|
||||||
Cam = new Camera()
|
Cam = new Camera()
|
||||||
@@ -59,8 +61,9 @@ namespace Barotrauma
|
|||||||
paramsList.OnSelected += (GUIComponent component, object obj) =>
|
paramsList.OnSelected += (GUIComponent component, object obj) =>
|
||||||
{
|
{
|
||||||
selectedParams = obj as LevelGenerationParams;
|
selectedParams = obj as LevelGenerationParams;
|
||||||
|
currentLevelData = LevelData.CreateRandom(seedBox.Text, generationParams: selectedParams);
|
||||||
editorContainer.ClearChildren();
|
editorContainer.ClearChildren();
|
||||||
SortLevelObjectsList(selectedParams);
|
SortLevelObjectsList(currentLevelData);
|
||||||
new SerializableEntityEditor(editorContainer.Content.RectTransform, selectedParams, false, true, elementHeight: 20);
|
new SerializableEntityEditor(editorContainer.Content.RectTransform, selectedParams, false, true, elementHeight: 20);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -149,7 +152,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
OnClicked = (button, userData) =>
|
OnClicked = (button, userData) =>
|
||||||
{
|
{
|
||||||
if(seedBox == null) { return false; }
|
if (seedBox == null) { return false; }
|
||||||
seedBox.Text = GetLevelSeed();
|
seedBox.Text = GetLevelSeed();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -184,10 +187,10 @@ namespace Barotrauma
|
|||||||
bool wasLevelLoaded = Level.Loaded != null;
|
bool wasLevelLoaded = Level.Loaded != null;
|
||||||
Submarine.Unload();
|
Submarine.Unload();
|
||||||
GameMain.LightManager.ClearLights();
|
GameMain.LightManager.ClearLights();
|
||||||
LevelData levelData = LevelData.CreateRandom(seedBox.Text, generationParams: selectedParams);
|
currentLevelData = LevelData.CreateRandom(seedBox.Text, generationParams: selectedParams);
|
||||||
levelData.ForceOutpostGenerationParams = outpostParamsList.SelectedData as OutpostGenerationParams;
|
currentLevelData.ForceOutpostGenerationParams = outpostParamsList.SelectedData as OutpostGenerationParams;
|
||||||
levelData.AllowInvalidOutpost = allowInvalidOutpost.Selected;
|
currentLevelData.AllowInvalidOutpost = allowInvalidOutpost.Selected;
|
||||||
Level.Generate(levelData, mirror: mirrorLevel.Selected);
|
Level.Generate(currentLevelData, mirror: mirrorLevel.Selected);
|
||||||
GameMain.LightManager.AddLight(pointerLightSource);
|
GameMain.LightManager.AddLight(pointerLightSource);
|
||||||
if (!wasLevelLoaded || Cam.Position.X < 0 || Cam.Position.Y < 0 || Cam.Position.Y > Level.Loaded.Size.X || Cam.Position.Y > Level.Loaded.Size.Y)
|
if (!wasLevelLoaded || Cam.Position.X < 0 || Cam.Position.Y < 0 || Cam.Position.Y > Level.Loaded.Size.X || Cam.Position.Y > Level.Loaded.Size.Y)
|
||||||
{
|
{
|
||||||
@@ -417,11 +420,11 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
|
||||||
TextManager.GetWithVariable("leveleditor.levelobjcommonness", "[leveltype]", selectedParams.Identifier.Value), textAlignment: Alignment.Center);
|
TextManager.GetWithVariable("leveleditor.levelobjcommonness", "[leveltype]", selectedParams.Identifier.Value), textAlignment: Alignment.Center);
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), GUINumberInput.NumberType.Float)
|
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), NumberType.Float)
|
||||||
{
|
{
|
||||||
MinValueFloat = 0,
|
MinValueFloat = 0,
|
||||||
MaxValueFloat = 100,
|
MaxValueFloat = 100,
|
||||||
FloatValue = caveGenerationParams.GetCommonness(selectedParams, abyss: false),
|
FloatValue = caveGenerationParams.GetCommonness(currentLevelData, abyss: false),
|
||||||
OnValueChanged = (numberInput) =>
|
OnValueChanged = (numberInput) =>
|
||||||
{
|
{
|
||||||
caveGenerationParams.OverrideCommonness[selectedParams.Identifier] = numberInput.FloatValue;
|
caveGenerationParams.OverrideCommonness[selectedParams.Identifier] = numberInput.FloatValue;
|
||||||
@@ -482,7 +485,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var moduleCountGroup = new GUILayoutGroup(new RectTransform(new Point(editorContainer.Content.Rect.Width, (int)(25 * GUI.Scale))), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
var moduleCountGroup = new GUILayoutGroup(new RectTransform(new Point(editorContainer.Content.Rect.Width, (int)(25 * GUI.Scale))), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), moduleCountGroup.RectTransform), TextManager.Capitalize(moduleCount.Key.Value), textAlignment: Alignment.CenterLeft);
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), moduleCountGroup.RectTransform), TextManager.Capitalize(moduleCount.Key.Value), textAlignment: Alignment.CenterLeft);
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), moduleCountGroup.RectTransform), GUINumberInput.NumberType.Int)
|
new GUINumberInput(new RectTransform(new Vector2(0.5f, 1f), moduleCountGroup.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = 100,
|
MaxValueInt = 100,
|
||||||
@@ -542,7 +545,7 @@ namespace Barotrauma
|
|||||||
if (selectedParams != null) { availableIdentifiers.Add(selectedParams.Identifier); }
|
if (selectedParams != null) { availableIdentifiers.Add(selectedParams.Identifier); }
|
||||||
foreach (var caveParam in CaveGenerationParams.CaveParams)
|
foreach (var caveParam in CaveGenerationParams.CaveParams)
|
||||||
{
|
{
|
||||||
if (selectedParams != null && caveParam.GetCommonness(selectedParams, abyss: false) <= 0.0f) { continue; }
|
if (selectedParams != null && caveParam.GetCommonness(currentLevelData, abyss: false) <= 0.0f) { continue; }
|
||||||
availableIdentifiers.Add(caveParam.Identifier);
|
availableIdentifiers.Add(caveParam.Identifier);
|
||||||
}
|
}
|
||||||
availableIdentifiers.Reverse();
|
availableIdentifiers.Reverse();
|
||||||
@@ -557,11 +560,11 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
|
||||||
TextManager.GetWithVariable("leveleditor.levelobjcommonness", "[leveltype]", paramsId.Value), textAlignment: Alignment.Center);
|
TextManager.GetWithVariable("leveleditor.levelobjcommonness", "[leveltype]", paramsId.Value), textAlignment: Alignment.Center);
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), GUINumberInput.NumberType.Float)
|
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), NumberType.Float)
|
||||||
{
|
{
|
||||||
MinValueFloat = 0,
|
MinValueFloat = 0,
|
||||||
MaxValueFloat = 100,
|
MaxValueFloat = 100,
|
||||||
FloatValue = selectedParams.Identifier == paramsId ? levelObjectPrefab.GetCommonness(selectedParams) : levelObjectPrefab.GetCommonness(CaveGenerationParams.CaveParams.Find(p => p.Identifier == paramsId)),
|
FloatValue = selectedParams.Identifier == paramsId ? levelObjectPrefab.GetCommonness(currentLevelData) : levelObjectPrefab.GetCommonness(CaveGenerationParams.CaveParams.Find(p => p.Identifier == paramsId)),
|
||||||
OnValueChanged = (numberInput) =>
|
OnValueChanged = (numberInput) =>
|
||||||
{
|
{
|
||||||
levelObjectPrefab.OverrideCommonness[paramsId] = numberInput.FloatValue;
|
levelObjectPrefab.OverrideCommonness[paramsId] = numberInput.FloatValue;
|
||||||
@@ -620,7 +623,7 @@ namespace Barotrauma
|
|||||||
childObj.AllowedNames = dropdown.SelectedDataMultiple.Select(d => ((LevelObjectPrefab)d).Name).ToList();
|
childObj.AllowedNames = dropdown.SelectedDataMultiple.Select(d => ((LevelObjectPrefab)d).Name).ToList();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), GUINumberInput.NumberType.Int)
|
new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = 10,
|
MaxValueInt = 10,
|
||||||
@@ -630,7 +633,7 @@ namespace Barotrauma
|
|||||||
selectedChildObj.MaxCount = Math.Max(selectedChildObj.MaxCount, selectedChildObj.MinCount);
|
selectedChildObj.MaxCount = Math.Max(selectedChildObj.MaxCount, selectedChildObj.MinCount);
|
||||||
}
|
}
|
||||||
}.IntValue = childObj.MinCount;
|
}.IntValue = childObj.MinCount;
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), GUINumberInput.NumberType.Int)
|
new GUINumberInput(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
MinValueInt = 0,
|
MinValueInt = 0,
|
||||||
MaxValueInt = 10,
|
MaxValueInt = 10,
|
||||||
@@ -689,13 +692,13 @@ namespace Barotrauma
|
|||||||
buttonContainer.RectTransform.MinSize = buttonContainer.RectTransform.Children.First().MinSize;
|
buttonContainer.RectTransform.MinSize = buttonContainer.RectTransform.Children.First().MinSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SortLevelObjectsList(LevelGenerationParams selectedParams)
|
private void SortLevelObjectsList(LevelData levelData)
|
||||||
{
|
{
|
||||||
//fade out levelobjects that don't spawn in this type of level
|
//fade out levelobjects that don't spawn in this type of level
|
||||||
foreach (GUIComponent levelObjFrame in levelObjectList.Content.Children)
|
foreach (GUIComponent levelObjFrame in levelObjectList.Content.Children)
|
||||||
{
|
{
|
||||||
var levelObj = levelObjFrame.UserData as LevelObjectPrefab;
|
var levelObj = levelObjFrame.UserData as LevelObjectPrefab;
|
||||||
float commonness = levelObj.GetCommonness(selectedParams);
|
float commonness = levelObj.GetCommonness(levelData);
|
||||||
levelObjFrame.Color = commonness > 0.0f ? GUIStyle.Green * 0.4f : Color.Transparent;
|
levelObjFrame.Color = commonness > 0.0f ? GUIStyle.Green * 0.4f : Color.Transparent;
|
||||||
levelObjFrame.SelectedColor = commonness > 0.0f ? GUIStyle.Green * 0.6f : Color.White * 0.5f;
|
levelObjFrame.SelectedColor = commonness > 0.0f ? GUIStyle.Green * 0.6f : Color.White * 0.5f;
|
||||||
levelObjFrame.HoverColor = commonness > 0.0f ? GUIStyle.Green * 0.7f : Color.White * 0.6f;
|
levelObjFrame.HoverColor = commonness > 0.0f ? GUIStyle.Green * 0.7f : Color.White * 0.6f;
|
||||||
@@ -712,7 +715,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var levelObj1 = c1.GUIComponent.UserData as LevelObjectPrefab;
|
var levelObj1 = c1.GUIComponent.UserData as LevelObjectPrefab;
|
||||||
var levelObj2 = c2.GUIComponent.UserData as LevelObjectPrefab;
|
var levelObj2 = c2.GUIComponent.UserData as LevelObjectPrefab;
|
||||||
return Math.Sign(levelObj2.GetCommonness(selectedParams) - levelObj1.GetCommonness(selectedParams));
|
return Math.Sign(levelObj2.GetCommonness(levelData) - levelObj1.GetCommonness(levelData));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2902,6 +2902,7 @@ namespace Barotrauma
|
|||||||
appearanceFrame.ClearChildren();
|
appearanceFrame.ClearChildren();
|
||||||
|
|
||||||
var info = GameMain.Client.CharacterInfo ?? Character.Controlled?.Info;
|
var info = GameMain.Client.CharacterInfo ?? Character.Controlled?.Info;
|
||||||
|
CharacterAppearanceCustomizationMenu?.Dispose();
|
||||||
CharacterAppearanceCustomizationMenu = new CharacterInfo.AppearanceCustomizationMenu(info, appearanceFrame)
|
CharacterAppearanceCustomizationMenu = new CharacterInfo.AppearanceCustomizationMenu(info, appearanceFrame)
|
||||||
{
|
{
|
||||||
OnHeadSwitch = menu =>
|
OnHeadSwitch = menu =>
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ namespace Barotrauma
|
|||||||
}, style: null, color: Color.Black * 0.6f);
|
}, style: null, color: Color.Black * 0.6f);
|
||||||
var colorLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), colorComponentLabels[i],
|
var colorLabel = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), colorComponentLabels[i],
|
||||||
font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
font: GUIStyle.SmallFont, textAlignment: Alignment.CenterLeft);
|
||||||
var numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), GUINumberInput.NumberType.Int)
|
var numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2256,7 +2256,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("OutPostModuleMaxCountToolTip")
|
ToolTip = TextManager.Get("OutPostModuleMaxCountToolTip")
|
||||||
};
|
};
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), maxModuleCountGroup.RectTransform), GUINumberInput.NumberType.Int)
|
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), maxModuleCountGroup.RectTransform), NumberType.Int)
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("OutPostModuleMaxCountToolTip"),
|
ToolTip = TextManager.Get("OutPostModuleMaxCountToolTip"),
|
||||||
IntValue = MainSub?.Info?.OutpostModuleInfo?.MaxCount ?? 1000,
|
IntValue = MainSub?.Info?.OutpostModuleInfo?.MaxCount ?? 1000,
|
||||||
@@ -2274,7 +2274,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), commonnessGroup.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), commonnessGroup.RectTransform),
|
||||||
TextManager.Get("subeditor.outpostcommonness"), textAlignment: Alignment.CenterLeft, wrap: true);
|
TextManager.Get("subeditor.outpostcommonness"), textAlignment: Alignment.CenterLeft, wrap: true);
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), commonnessGroup.RectTransform), GUINumberInput.NumberType.Float)
|
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), commonnessGroup.RectTransform), NumberType.Float)
|
||||||
{
|
{
|
||||||
FloatValue = MainSub?.Info?.OutpostModuleInfo?.Commonness ?? 10,
|
FloatValue = MainSub?.Info?.OutpostModuleInfo?.Commonness ?? 10,
|
||||||
MinValueFloat = 0,
|
MinValueFloat = 0,
|
||||||
@@ -2304,8 +2304,9 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), priceGroup.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), priceGroup.RectTransform),
|
||||||
TextManager.Get("subeditor.price"), textAlignment: Alignment.CenterLeft, wrap: true);
|
TextManager.Get("subeditor.price"), textAlignment: Alignment.CenterLeft, wrap: true);
|
||||||
|
|
||||||
|
|
||||||
int basePrice = (GameMain.DebugDraw ? 0 : MainSub?.CalculateBasePrice()) ?? 1000;
|
int basePrice = (GameMain.DebugDraw ? 0 : MainSub?.CalculateBasePrice()) ?? 1000;
|
||||||
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), priceGroup.RectTransform), GUINumberInput.NumberType.Int, hidePlusMinusButtons: true)
|
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), priceGroup.RectTransform), NumberType.Int, hidePlusMinusButtons: true)
|
||||||
{
|
{
|
||||||
IntValue = Math.Max(MainSub?.Info?.Price ?? basePrice, basePrice),
|
IntValue = Math.Max(MainSub?.Info?.Price ?? basePrice, basePrice),
|
||||||
MinValueInt = basePrice,
|
MinValueInt = basePrice,
|
||||||
@@ -2350,13 +2351,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), crewSizeArea.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), crewSizeArea.RectTransform),
|
||||||
TextManager.Get("RecommendedCrewSize"), textAlignment: Alignment.CenterLeft, wrap: true, font: GUIStyle.SmallFont);
|
TextManager.Get("RecommendedCrewSize"), textAlignment: Alignment.CenterLeft, wrap: true, font: GUIStyle.SmallFont);
|
||||||
var crewSizeMin = new GUINumberInput(new RectTransform(new Vector2(0.17f, 1.0f), crewSizeArea.RectTransform), GUINumberInput.NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
var crewSizeMin = new GUINumberInput(new RectTransform(new Vector2(0.17f, 1.0f), crewSizeArea.RectTransform), NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
||||||
{
|
{
|
||||||
MinValueInt = 1,
|
MinValueInt = 1,
|
||||||
MaxValueInt = 128
|
MaxValueInt = 128
|
||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.06f, 1.0f), crewSizeArea.RectTransform), "-", textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.06f, 1.0f), crewSizeArea.RectTransform), "-", textAlignment: Alignment.Center);
|
||||||
var crewSizeMax = new GUINumberInput(new RectTransform(new Vector2(0.17f, 1.0f), crewSizeArea.RectTransform), GUINumberInput.NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
var crewSizeMax = new GUINumberInput(new RectTransform(new Vector2(0.17f, 1.0f), crewSizeArea.RectTransform), NumberType.Int, relativeButtonAreaWidth: 0.25f)
|
||||||
{
|
{
|
||||||
MinValueInt = 1,
|
MinValueInt = 1,
|
||||||
MaxValueInt = 128
|
MaxValueInt = 128
|
||||||
@@ -2947,11 +2948,22 @@ namespace Barotrauma
|
|||||||
prevSub = sub;
|
prevSub = sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string pathWithoutUserName = Path.GetFullPath(sub.FilePath);
|
||||||
|
string saveFolder = Path.GetFullPath(SaveUtil.SaveFolder);
|
||||||
|
if (pathWithoutUserName.StartsWith(saveFolder))
|
||||||
|
{
|
||||||
|
pathWithoutUserName = "..." + pathWithoutUserName[saveFolder.Length..];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pathWithoutUserName = sub.FilePath;
|
||||||
|
}
|
||||||
|
|
||||||
GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), subList.Content.RectTransform) { MinSize = new Point(0, 30) },
|
GUITextBlock textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), subList.Content.RectTransform) { MinSize = new Point(0, 30) },
|
||||||
ToolBox.LimitString(sub.Name, GUIStyle.Font, subList.Rect.Width - 80))
|
ToolBox.LimitString(sub.Name, GUIStyle.Font, subList.Rect.Width - 80))
|
||||||
{
|
{
|
||||||
UserData = sub,
|
UserData = sub,
|
||||||
ToolTip = sub.FilePath
|
ToolTip = pathWithoutUserName
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(ContentPackageManager.VanillaCorePackage?.Files.Any(f => f.Path == sub.FilePath) ?? false))
|
if (!(ContentPackageManager.VanillaCorePackage?.Files.Any(f => f.Path == sub.FilePath) ?? false))
|
||||||
@@ -3667,17 +3679,17 @@ namespace Barotrauma
|
|||||||
GUILayoutGroup hueSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.25f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
GUILayoutGroup hueSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.25f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), hueSliderLayout.RectTransform), text: "H:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Hue" };
|
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), hueSliderLayout.RectTransform), text: "H:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Hue" };
|
||||||
GUIScrollBar hueScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), hueSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = currentHue };
|
GUIScrollBar hueScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), hueSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = currentHue };
|
||||||
GUINumberInput hueTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), hueSliderLayout.RectTransform), inputType: GUINumberInput.NumberType.Float) { FloatValue = currentHue, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
GUINumberInput hueTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), hueSliderLayout.RectTransform), inputType: NumberType.Float) { FloatValue = currentHue, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
||||||
|
|
||||||
GUILayoutGroup satSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.2f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
GUILayoutGroup satSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.2f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), satSliderLayout.RectTransform), text: "S:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Saturation"};
|
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), satSliderLayout.RectTransform), text: "S:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Saturation"};
|
||||||
GUIScrollBar satScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), satSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = colorPicker.SelectedSaturation };
|
GUIScrollBar satScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), satSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = colorPicker.SelectedSaturation };
|
||||||
GUINumberInput satTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), satSliderLayout.RectTransform), inputType: GUINumberInput.NumberType.Float) { FloatValue = colorPicker.SelectedSaturation, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
GUINumberInput satTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), satSliderLayout.RectTransform), inputType: NumberType.Float) { FloatValue = colorPicker.SelectedSaturation, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
||||||
|
|
||||||
GUILayoutGroup valueSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.2f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
GUILayoutGroup valueSliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.2f), sliderLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), valueSliderLayout.RectTransform), text: "V:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Value"};
|
new GUITextBlock(new RectTransform(new Vector2(0.1f, 0.2f), valueSliderLayout.RectTransform), text: "V:", font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero, ToolTip = "Value"};
|
||||||
GUIScrollBar valueScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), valueSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = colorPicker.SelectedValue };
|
GUIScrollBar valueScrollBar = new GUIScrollBar(new RectTransform(new Vector2(0.7f, 1f), valueSliderLayout.RectTransform), style: "GUISlider", barSize: 0.05f) { BarScroll = colorPicker.SelectedValue };
|
||||||
GUINumberInput valueTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), valueSliderLayout.RectTransform), inputType: GUINumberInput.NumberType.Float) { FloatValue = colorPicker.SelectedValue, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
GUINumberInput valueTextBox = new GUINumberInput(new RectTransform(new Vector2(0.2f, 1f), valueSliderLayout.RectTransform), inputType: NumberType.Float) { FloatValue = colorPicker.SelectedValue, MaxValueFloat = 1f, MinValueFloat = 0f, DecimalsToDisplay = 2 };
|
||||||
|
|
||||||
GUILayoutGroup colorInfoLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.3f), sliderLayout.RectTransform), childAnchor: Anchor.CenterLeft, isHorizontal: true) { RelativeSpacing = 0.15f };
|
GUILayoutGroup colorInfoLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.3f), sliderLayout.RectTransform), childAnchor: Anchor.CenterLeft, isHorizontal: true) { RelativeSpacing = 0.15f };
|
||||||
|
|
||||||
@@ -4439,8 +4451,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Rectangle hullRect = rect;
|
Rectangle hullRect = rect;
|
||||||
hullRect.Y = -hullRect.Y;
|
hullRect.Y = -hullRect.Y;
|
||||||
Hull newHull = new Hull(MapEntityPrefab.FindByIdentifier("hull".ToIdentifier()),
|
Hull newHull = new Hull(hullRect,
|
||||||
hullRect,
|
|
||||||
MainSub);
|
MainSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4452,7 +4463,7 @@ namespace Barotrauma
|
|||||||
Rectangle gapRect = e.WorldRect;
|
Rectangle gapRect = e.WorldRect;
|
||||||
gapRect.Y -= 8;
|
gapRect.Y -= 8;
|
||||||
gapRect.Height = 16;
|
gapRect.Height = 16;
|
||||||
Gap newGap = new Gap(MapEntityPrefab.FindByIdentifier("gap".ToIdentifier()), gapRect);
|
new Gap(gapRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -59,7 +59,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Float)
|
if (numInput.InputType == NumberType.Float)
|
||||||
{
|
{
|
||||||
numInput.FloatValue = f;
|
numInput.FloatValue = f;
|
||||||
if (flash)
|
if (flash)
|
||||||
@@ -76,7 +76,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Int)
|
if (numInput.InputType == NumberType.Int)
|
||||||
{
|
{
|
||||||
numInput.IntValue = integer;
|
numInput.IntValue = integer;
|
||||||
if (flash)
|
if (flash)
|
||||||
@@ -127,7 +127,7 @@ namespace Barotrauma
|
|||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Float)
|
if (numInput.InputType == NumberType.Float)
|
||||||
{
|
{
|
||||||
numInput.FloatValue = i == 0 ? v2.X : v2.Y;
|
numInput.FloatValue = i == 0 ? v2.X : v2.Y;
|
||||||
if (flash)
|
if (flash)
|
||||||
@@ -145,7 +145,7 @@ namespace Barotrauma
|
|||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Float)
|
if (numInput.InputType == NumberType.Float)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
@@ -174,7 +174,7 @@ namespace Barotrauma
|
|||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Float)
|
if (numInput.InputType == NumberType.Float)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
@@ -206,7 +206,7 @@ namespace Barotrauma
|
|||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Int)
|
if (numInput.InputType == NumberType.Int)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
@@ -246,7 +246,7 @@ namespace Barotrauma
|
|||||||
var field = fields[i];
|
var field = fields[i];
|
||||||
if (field is GUINumberInput numInput)
|
if (field is GUINumberInput numInput)
|
||||||
{
|
{
|
||||||
if (numInput.InputType == GUINumberInput.NumberType.Int)
|
if (numInput.InputType == NumberType.Int)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
@@ -517,7 +517,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var numberInput = new GUINumberInput(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform, Anchor.TopRight), GUINumberInput.NumberType.Int)
|
var numberInput = new GUINumberInput(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform, Anchor.TopRight), NumberType.Int)
|
||||||
{
|
{
|
||||||
ToolTip = toolTip,
|
ToolTip = toolTip,
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
@@ -554,7 +554,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
|
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform,
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(inputFieldWidth, 1), frame.RectTransform,
|
||||||
Anchor.TopRight), GUINumberInput.NumberType.Float)
|
Anchor.TopRight), NumberType.Float)
|
||||||
{
|
{
|
||||||
ToolTip = toolTip,
|
ToolTip = toolTip,
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
@@ -770,7 +770,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int)
|
NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -838,7 +838,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Float)
|
NumberType.Float)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -909,7 +909,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Float)
|
NumberType.Float)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -985,7 +985,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), componentLabel, font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Float)
|
NumberType.Float)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -1078,7 +1078,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), element.RectTransform, Anchor.CenterLeft) { MinSize = new Point(15, 0) }, GUI.ColorComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), element.RectTransform, Anchor.CenterLeft) { MinSize = new Point(15, 0) }, GUI.ColorComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int)
|
NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
@@ -1153,7 +1153,7 @@ namespace Barotrauma
|
|||||||
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
var element = new GUIFrame(new RectTransform(new Vector2(0.22f, 1), inputArea.RectTransform) { MinSize = new Point(50, 0), MaxSize = new Point(150, 50) }, style: null);
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.RectComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), element.RectTransform, Anchor.CenterLeft), GUI.RectComponentLabels[i], font: GUIStyle.SmallFont, textAlignment: Alignment.Center);
|
||||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
GUINumberInput numberInput = new GUINumberInput(new RectTransform(new Vector2(0.7f, 1), element.RectTransform, Anchor.CenterRight),
|
||||||
GUINumberInput.NumberType.Int)
|
NumberType.Int)
|
||||||
{
|
{
|
||||||
Font = GUIStyle.SmallFont
|
Font = GUIStyle.SmallFont
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Barotrauma
|
|||||||
private void Slider(GUILayoutGroup parent, Vector2 range, int steps, Func<float, string> labelFunc, float currentValue, Action<float> setter, LocalizedString? tooltip = null)
|
private void Slider(GUILayoutGroup parent, Vector2 range, int steps, Func<float, string> labelFunc, float currentValue, Action<float> setter, LocalizedString? tooltip = null)
|
||||||
{
|
{
|
||||||
var layout = new GUILayoutGroup(NewItemRectT(parent), isHorizontal: true);
|
var layout = new GUILayoutGroup(NewItemRectT(parent), isHorizontal: true);
|
||||||
var slider = new GUIScrollBar(new RectTransform((0.82f, 1.0f), layout.RectTransform), style: "GUISlider")
|
var slider = new GUIScrollBar(new RectTransform((0.72f, 1.0f), layout.RectTransform), style: "GUISlider")
|
||||||
{
|
{
|
||||||
Range = range,
|
Range = range,
|
||||||
BarScrollValue = currentValue,
|
BarScrollValue = currentValue,
|
||||||
@@ -193,7 +193,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
slider.ToolTip = tooltip;
|
slider.ToolTip = tooltip;
|
||||||
}
|
}
|
||||||
var label = new GUITextBlock(new RectTransform((0.18f, 1.0f), layout.RectTransform),
|
var label = new GUITextBlock(new RectTransform((0.28f, 1.0f), layout.RectTransform),
|
||||||
labelFunc(currentValue), wrap: false, textAlignment: Alignment.Center);
|
labelFunc(currentValue), wrap: false, textAlignment: Alignment.Center);
|
||||||
slider.OnMoved = (sb, val) =>
|
slider.OnMoved = (sb, val) =>
|
||||||
{
|
{
|
||||||
@@ -217,9 +217,6 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ScaleResolution(float scale) =>
|
|
||||||
$"{Round(unsavedConfig.Graphics.Width * scale)}\nx\n{Round(unsavedConfig.Graphics.Height * scale)}";
|
|
||||||
|
|
||||||
private string Percentage(float v) => $"{Round(v * 100)}%";
|
private string Percentage(float v) => $"{Round(v * 100)}%";
|
||||||
|
|
||||||
private int Round(float v) => (int)MathF.Round(v);
|
private int Round(float v) => (int)MathF.Round(v);
|
||||||
@@ -259,20 +256,25 @@ namespace Barotrauma
|
|||||||
Tickbox(left, TextManager.Get("EnableVSync"), TextManager.Get("EnableVSyncTooltip"), unsavedConfig.Graphics.VSync, (v) => unsavedConfig.Graphics.VSync = v);
|
Tickbox(left, TextManager.Get("EnableVSync"), TextManager.Get("EnableVSyncTooltip"), unsavedConfig.Graphics.VSync, (v) => unsavedConfig.Graphics.VSync = v);
|
||||||
Tickbox(left, TextManager.Get("EnableTextureCompression"), TextManager.Get("EnableTextureCompressionTooltip"), unsavedConfig.Graphics.CompressTextures, (v) => unsavedConfig.Graphics.CompressTextures = v);
|
Tickbox(left, TextManager.Get("EnableTextureCompression"), TextManager.Get("EnableTextureCompressionTooltip"), unsavedConfig.Graphics.CompressTextures, (v) => unsavedConfig.Graphics.CompressTextures = v);
|
||||||
|
|
||||||
Label(right, TextManager.Get("ParticleLimit"), GUIStyle.SubHeadingFont);
|
|
||||||
Slider(right, (100, 1500), 15, (v) => Round(v).ToString(), unsavedConfig.Graphics.ParticleLimit, (v) => unsavedConfig.Graphics.ParticleLimit = Round(v));
|
|
||||||
Spacer(right);
|
|
||||||
|
|
||||||
Label(right, TextManager.Get("LOSEffect"), GUIStyle.SubHeadingFont);
|
Label(right, TextManager.Get("LOSEffect"), GUIStyle.SubHeadingFont);
|
||||||
DropdownEnum(right, (m) => TextManager.Get($"LosMode{m}"), null, unsavedConfig.Graphics.LosMode, (v) => unsavedConfig.Graphics.LosMode = v);
|
DropdownEnum(right, (m) => TextManager.Get($"LosMode{m}"), null, unsavedConfig.Graphics.LosMode, (v) => unsavedConfig.Graphics.LosMode = v);
|
||||||
Spacer(right);
|
Spacer(right);
|
||||||
|
|
||||||
Label(right, TextManager.Get("LightMapScale"), GUIStyle.SubHeadingFont);
|
Label(right, TextManager.Get("LightMapScale"), GUIStyle.SubHeadingFont);
|
||||||
Slider(right, (0.5f, 1.0f), 10, ScaleResolution, unsavedConfig.Graphics.LightMapScale, (v) => unsavedConfig.Graphics.LightMapScale = v, TextManager.Get("LightMapScaleTooltip"));
|
Slider(right, (0.5f, 1.0f), 11, (v) => TextManager.GetWithVariable("percentageformat", "[value]", Round(v * 100).ToString()).Value, unsavedConfig.Graphics.LightMapScale, (v) => unsavedConfig.Graphics.LightMapScale = v, TextManager.Get("LightMapScaleTooltip"));
|
||||||
|
Spacer(right);
|
||||||
|
|
||||||
|
Label(right, TextManager.Get("VisibleLightLimit"), GUIStyle.SubHeadingFont);
|
||||||
|
Slider(right, (10, 210), 21, (v) => v > 200 ? TextManager.Get("unlimited").Value : Round(v).ToString(), unsavedConfig.Graphics.VisibleLightLimit,
|
||||||
|
(v) => unsavedConfig.Graphics.VisibleLightLimit = v > 200 ? int.MaxValue : Round(v), TextManager.Get("VisibleLightLimitTooltip"));
|
||||||
Spacer(right);
|
Spacer(right);
|
||||||
|
|
||||||
Tickbox(right, TextManager.Get("RadialDistortion"), TextManager.Get("RadialDistortionTooltip"), unsavedConfig.Graphics.RadialDistortion, (v) => unsavedConfig.Graphics.RadialDistortion = v);
|
Tickbox(right, TextManager.Get("RadialDistortion"), TextManager.Get("RadialDistortionTooltip"), unsavedConfig.Graphics.RadialDistortion, (v) => unsavedConfig.Graphics.RadialDistortion = v);
|
||||||
Tickbox(right, TextManager.Get("ChromaticAberration"), TextManager.Get("ChromaticAberrationTooltip"), unsavedConfig.Graphics.ChromaticAberration, (v) => unsavedConfig.Graphics.ChromaticAberration = v);
|
Tickbox(right, TextManager.Get("ChromaticAberration"), TextManager.Get("ChromaticAberrationTooltip"), unsavedConfig.Graphics.ChromaticAberration, (v) => unsavedConfig.Graphics.ChromaticAberration = v);
|
||||||
|
|
||||||
|
Label(right, TextManager.Get("ParticleLimit"), GUIStyle.SubHeadingFont);
|
||||||
|
Slider(right, (100, 1500), 15, (v) => Round(v).ToString(), unsavedConfig.Graphics.ParticleLimit, (v) => unsavedConfig.Graphics.ParticleLimit = Round(v));
|
||||||
|
Spacer(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string TrimAudioDeviceName(string name)
|
private static string TrimAudioDeviceName(string name)
|
||||||
|
|||||||
@@ -202,11 +202,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Sound?.Dispose(); Sound = null;
|
Sound?.Dispose(); Sound = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
~SoundPrefab()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TagNames("damagesound")]
|
[TagNames("damagesound")]
|
||||||
|
|||||||
@@ -91,11 +91,6 @@ namespace Barotrauma.Steam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~ItemThumbnail()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (ItemId == 0) { return; }
|
if (ItemId == 0) { return; }
|
||||||
|
|||||||
@@ -45,11 +45,6 @@ namespace Barotrauma.Steam
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
~LocalThumbnail()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Barotrauma
|
|||||||
float zoom = (float)texWidth / (float)boundingBox.Width;
|
float zoom = (float)texWidth / (float)boundingBox.Width;
|
||||||
int texHeight = (int)(zoom * boundingBox.Height);
|
int texHeight = (int)(zoom * boundingBox.Height);
|
||||||
|
|
||||||
Camera cam = new Camera();
|
using Camera cam = new Camera();
|
||||||
cam.SetResolution(new Point(texWidth, texHeight));
|
cam.SetResolution(new Point(texWidth, texHeight));
|
||||||
cam.MaxZoom = zoom;
|
cam.MaxZoom = zoom;
|
||||||
cam.MinZoom = zoom * 0.5f;
|
cam.MinZoom = zoom * 0.5f;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
@@ -64,11 +64,18 @@
|
|||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||||
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,208 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
DebugLinux is configured to use .NET 6.0 so I can use Hot Reload while working on the game.
|
|
||||||
If you are running Linux and and have issues compiling in debug configurations remove the
|
|
||||||
<TargetFramework>net6.0</TargetFramework> and <LangVersion>8</LangVersion> elements under <PropertyGroup>.
|
|
||||||
- Markus
|
|
||||||
-->
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>DEBUG;TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<LangVersion>8</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<LangVersion>8</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;LINUX;USE_STEAM;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;LINUX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="freetype6.dll" />
|
|
||||||
<None Remove="soft_oal_x64.dll" />
|
|
||||||
<None Remove="x64\SDL2.dll" />
|
|
||||||
<None Remove="webm_mem_playback_x64.dll" />
|
|
||||||
<None Remove="libfreetype6.so" />
|
|
||||||
<None Remove="libopenal.so.1" />
|
|
||||||
<None Remove="libSDL2-2.0.so.0" />
|
|
||||||
<None Remove="webm_mem_playback_x64.so" />
|
|
||||||
<None Remove="libopenal.1.dylib" />
|
|
||||||
<None Remove="libSDL2-2.0.0.dylib" />
|
|
||||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="libfreetype6.so">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="libopenal.so.1">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="libSDL2-2.0.so.0">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="webm_mem_playback_x64.so">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
|
|
||||||
<Content Include="Content\**\*">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
|
|
||||||
<EmbeddedResource Include="Icon.bmp">
|
|
||||||
<LogicalName>Icon.bmp</LogicalName>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Linux.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<GARuntime>linux-x64</GARuntime>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
@@ -55,19 +55,20 @@
|
|||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||||
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Prefabs\PrefabSelector.cs">
|
|
||||||
<Link>SharedSource\Prefabs\PrefabSelector.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Prefabs\PrefabCollectionSubset.cs">
|
|
||||||
<Link>SharedSource\Prefabs\PrefabCollectionSubset.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,214 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<DebugType></DebugType>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<DebugType />
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;OSX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Prefabs\PrefabSelector.cs">
|
|
||||||
<Link>SharedSource\Prefabs\PrefabSelector.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Prefabs\PrefabCollectionSubset.cs">
|
|
||||||
<Link>SharedSource\Prefabs\PrefabCollectionSubset.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="freetype6.dll" />
|
|
||||||
<None Remove="soft_oal_x64.dll" />
|
|
||||||
<None Remove="x64\SDL2.dll" />
|
|
||||||
<None Remove="webm_mem_playback_x64.dll" />
|
|
||||||
<None Remove="libfreetype6.so" />
|
|
||||||
<None Remove="libopenal.so.1" />
|
|
||||||
<None Remove="libSDL2-2.0.so.0" />
|
|
||||||
<None Remove="webm_mem_playback_x64.so" />
|
|
||||||
<None Remove="libopenal.1.dylib" />
|
|
||||||
<None Remove="libSDL2-2.0.0.dylib" />
|
|
||||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="libopenal.1.dylib">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="libSDL2-2.0.0.dylib">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="libwebm_mem_playback_x64.dylib">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Content\**\*">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
|
|
||||||
<EmbeddedResource Include="Icon.bmp">
|
|
||||||
<LogicalName>Icon.bmp</LogicalName>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.MacOS.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.MacOS.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\BarotraumaShared\libsteam_api64.dylib">
|
|
||||||
<Link>libsteam_api64.dylib</Link>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="libfreetype6.dylib">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<GARuntime>osx-x64</GARuntime>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
@@ -61,17 +61,18 @@
|
|||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
||||||
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Steam\AuthTicket.cs">
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
<Link>SharedSource\Steam\AuthTicket.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Utils\Result.cs">
|
|
||||||
<Link>SharedSource\Utils\Result.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,237 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>DEBUG;TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;CLIENT;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Steam\AuthTicket.cs">
|
|
||||||
<Link>SharedSource\Steam\AuthTicket.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="..\BarotraumaShared\SharedSource\Utils\Result.cs">
|
|
||||||
<Link>SharedSource\Utils\Result.cs</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="freetype6.dll" />
|
|
||||||
<None Remove="soft_oal_x64.dll" />
|
|
||||||
<None Remove="x64\SDL2.dll" />
|
|
||||||
<None Remove="webm_mem_playback_x64.dll" />
|
|
||||||
<None Remove="libfreetype6.so" />
|
|
||||||
<None Remove="libopenal.so.1" />
|
|
||||||
<None Remove="libSDL2-2.0.so.0" />
|
|
||||||
<None Remove="webm_mem_playback_x64.so" />
|
|
||||||
<None Remove="libopenal.1.dylib" />
|
|
||||||
<None Remove="libSDL2-2.0.0.dylib" />
|
|
||||||
<None Remove="libwebm_mem_playback_x64.dylib" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="freetype6.dll">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="soft_oal_x64.dll">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="x64\SDL2.dll">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="webm_mem_playback_x64.dll">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
|
|
||||||
<Content Include="Content\**\*">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\MonoGame.Framework\Src\MonoGame.Framework\MonoGame.Framework.Windows.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\SharpFont\Source\SharpFont\SharpFont.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="..\BarotraumaShared\SharedSource\Utils\Result">
|
|
||||||
<Link>SharedSource\Utils\Result</Link>
|
|
||||||
</Folder>
|
|
||||||
<Folder Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\Lights\divinghelmetlight.psd">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\Lights\light.psd">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\Lights\lightcone.psd">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\Lights\penumbra.psd">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\Map\BackgroundSmoke.psd">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_Daedalic.mp4">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_FF.mp4">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Update="..\BarotraumaShared\Content\SplashScreens\Original\Splash_UTG.mp4">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<GARuntime>win-x64</GARuntime>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
@@ -65,10 +65,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
<Content Include="DedicatedServer.exe" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="DedicatedServer.exe" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,156 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
DebugLinux is configured to use .NET 6.0 so I can use Hot Reload while working on the game.
|
|
||||||
If you are running Linux and and have issues compiling in debug configurations remove the
|
|
||||||
<TargetFramework>net6.0</TargetFramework> elements under <PropertyGroup>:s.
|
|
||||||
- Markus
|
|
||||||
-->
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>DEBUG;TRACE;SERVER;LINUX;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<LangVersion>8</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;SERVER;LINUX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<LangVersion>8</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;LINUX;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;LINUX;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;LINUX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;LINUX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Linux\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Include="DedicatedServer.exe" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
@@ -58,10 +58,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
||||||
<Content Remove="DedicatedServer.exe" />
|
<Content Remove="DedicatedServer.exe" />
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;OSX;USE_STEAM;DEBUG;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\DebugMac</OutputPath>
|
|
||||||
<ConsolePause>true</ConsolePause>
|
|
||||||
<CheckForOverflowUnderflow></CheckForOverflowUnderflow>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;SERVER;OSX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<DebugType></DebugType>
|
|
||||||
<OutputPath>..\bin\ReleaseMac</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;OSX;USE_STEAM;RELEASE;NETCOREAPP;NETCOREAPP3_0;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<DebugType />
|
|
||||||
<OutputPath>..\bin\ReleaseMac</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;OSX;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;OSX;X64;USE_STEAM;UNSTABLE</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Mac\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.dylib" />
|
|
||||||
<Content Remove="..\BarotraumaShared\libsteam_api64.so" />
|
|
||||||
<Content Remove="DedicatedServer.exe" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\BarotraumaShared\libsteam_api64.dylib">
|
|
||||||
<Link>libsteam_api64.dylib</Link>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
+22
-13
@@ -26,26 +26,34 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||||
{
|
{
|
||||||
if (customInterfaceElementList[i].HasPropertyName)
|
var element = customInterfaceElementList[i];
|
||||||
|
if (element.HasPropertyName)
|
||||||
{
|
{
|
||||||
if (!customInterfaceElementList[i].IsIntegerInput)
|
if (!element.IsNumberInput)
|
||||||
{
|
{
|
||||||
TextChanged(customInterfaceElementList[i], elementValues[i]);
|
TextChanged(element, elementValues[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int.TryParse(elementValues[i], out int value);
|
switch (element.NumberType)
|
||||||
ValueChanged(customInterfaceElementList[i], value);
|
{
|
||||||
|
case NumberType.Int when int.TryParse(elementValues[i], out int value):
|
||||||
|
ValueChanged(element, value);
|
||||||
|
break;
|
||||||
|
case NumberType.Float when TryParseFloatInvariantCulture(elementValues[i], out float value):
|
||||||
|
ValueChanged(element, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (customInterfaceElementList[i].ContinuousSignal)
|
else if (element.ContinuousSignal)
|
||||||
{
|
{
|
||||||
TickBoxToggled(customInterfaceElementList[i], elementStates[i]);
|
TickBoxToggled(element, elementStates[i]);
|
||||||
}
|
}
|
||||||
else if (elementStates[i])
|
else if (elementStates[i])
|
||||||
{
|
{
|
||||||
clickedButton = customInterfaceElementList[i];
|
clickedButton = element;
|
||||||
ButtonClicked(customInterfaceElementList[i]);
|
ButtonClicked(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,13 +69,14 @@ namespace Barotrauma.Items.Components
|
|||||||
//extradata contains an array of buttons clicked by a client (or nothing if nothing was clicked)
|
//extradata contains an array of buttons clicked by a client (or nothing if nothing was clicked)
|
||||||
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
for (int i = 0; i < customInterfaceElementList.Count; i++)
|
||||||
{
|
{
|
||||||
if (customInterfaceElementList[i].HasPropertyName)
|
var element = customInterfaceElementList[i];
|
||||||
|
if (element.HasPropertyName)
|
||||||
{
|
{
|
||||||
msg.Write(customInterfaceElementList[i].Signal);
|
msg.Write(element.Signal);
|
||||||
}
|
}
|
||||||
else if(customInterfaceElementList[i].ContinuousSignal)
|
else if(element.ContinuousSignal)
|
||||||
{
|
{
|
||||||
msg.Write(customInterfaceElementList[i].State);
|
msg.Write(element.State);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -208,7 +208,8 @@ namespace Barotrauma
|
|||||||
// Do not take unanswered into account for total
|
// Do not take unanswered into account for total
|
||||||
int yes = GameMain.Server.ConnectedClients.Count(c => c.InGame && c.GetVote<int>(ActiveVote.VoteType) == 2);
|
int yes = GameMain.Server.ConnectedClients.Count(c => c.InGame && c.GetVote<int>(ActiveVote.VoteType) == 2);
|
||||||
int no = GameMain.Server.ConnectedClients.Count(c => c.InGame && c.GetVote<int>(ActiveVote.VoteType) == 1);
|
int no = GameMain.Server.ConnectedClients.Count(c => c.InGame && c.GetVote<int>(ActiveVote.VoteType) == 1);
|
||||||
ActiveVote.Finish(this, passed: yes / (float)(yes + no) >= GameMain.NetworkMember.ServerSettings.VoteRequiredRatio);
|
int total = Math.Max(yes + no, 1);
|
||||||
|
ActiveVote.Finish(this, passed: yes / (float)(total) >= GameMain.NetworkMember.ServerSettings.VoteRequiredRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>0.18.1.0</Version>
|
<Version>0.18.2.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
@@ -60,10 +60,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" Exclude="..\BarotraumaShared\Data\Saves\*.save" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
<Content Remove="..\BarotraumaShared\**\*.props" />
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
||||||
|
<Compile Remove="..\BarotraumaShared\Content\**\*.cs" />
|
||||||
<Content Remove="DedicatedServer.exe" />
|
<Content Remove="DedicatedServer.exe" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
|
||||||
<Version>0.18.0.0</Version>
|
|
||||||
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
|
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
|
||||||
<Configurations>Debug;Release;Unstable</Configurations>
|
|
||||||
<WarningsAsErrors>;NU1605;CS0114;CS0108CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<DefineConstants>DEBUG;TRACE;SERVER;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<DefineConstants>TRACE;DEBUG;SERVER;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|AnyCPU'">
|
|
||||||
<DefineConstants>TRACE;SERVER;WINDOWS;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unstable|x64'">
|
|
||||||
<DefineConstants>TRACE;SERVER;WINDOWS;X64;USE_STEAM</DefineConstants>
|
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
|
||||||
<OutputPath>..\bin\$(Configuration)Windows\</OutputPath>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="..\BarotraumaShared\**\*" CopyToOutputDirectory="PreserveNewest" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="..\BarotraumaShared\**\*.props" />
|
|
||||||
<Compile Include="..\BarotraumaShared\**\*.cs" />
|
|
||||||
<Content Remove="DedicatedServer.exe" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Release" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Debug'">
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
<ProjectReference Include="..\..\Libraries\Lidgren.Network\Lidgren.NetStandard.csproj" AdditionalProperties="Configuration=Debug" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- Sourced from https://stackoverflow.com/a/45248069 -->
|
|
||||||
<Target Name="GetGitRevision" BeforeTargets="WriteGitRevision" Condition="'$(BuildHash)' == ''">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- temp file for the git version (lives in "obj" folder)-->
|
|
||||||
<VerFile>$(IntermediateOutputPath)gitver</VerFile>
|
|
||||||
<BranchFile>$(IntermediateOutputPath)gitbranch</BranchFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- write the hash to the temp file.-->
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD > $(VerFile)" ContinueOnError="true">
|
|
||||||
<Output TaskParameter="exitcode" ItemName="exitcodes" />
|
|
||||||
</Exec>
|
|
||||||
<Exec Command="git -C $(ProjectDir) rev-parse --short HEAD --symbolic-full-name --abbrev-ref=strict > $(BranchFile)" ContinueOnError="true" />
|
|
||||||
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(VerFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
<Exec Command="echo GIT_UNAVAILABLE > $(BranchFile)" Condition="'%(exitcodes.identity)'>0" />
|
|
||||||
|
|
||||||
<!-- read the version into the GitVersion itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(VerFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitVersion" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildHash>@(GitVersion)</BuildHash>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<!-- read the branch into the GitBranch itemGroup-->
|
|
||||||
<ReadLinesFromFile File="$(BranchFile)">
|
|
||||||
<Output TaskParameter="Lines" ItemName="GitBranch" />
|
|
||||||
</ReadLinesFromFile>
|
|
||||||
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
|
|
||||||
<PropertyGroup>
|
|
||||||
<BuildBranch>@(GitBranch)</BuildBranch>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="WriteGitRevision" BeforeTargets="CoreCompile">
|
|
||||||
<!-- names the obj/.../CustomAssemblyInfo.cs file -->
|
|
||||||
<PropertyGroup>
|
|
||||||
<CustomAssemblyInfoFile>$(IntermediateOutputPath)CustomAssemblyInfo.cs</CustomAssemblyInfoFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- includes the CustomAssemblyInfo for compilation into your project -->
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="$(CustomAssemblyInfoFile)" />
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- defines the AssemblyMetadata attribute that will be written -->
|
|
||||||
<ItemGroup>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitRevision</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildHash)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>GitBranch</_Parameter1>
|
|
||||||
<_Parameter2>$(BuildBranch)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
<AssemblyAttributes Include="AssemblyMetadata">
|
|
||||||
<_Parameter1>ProjectDir</_Parameter1>
|
|
||||||
<_Parameter2>$(ProjectDir)</_Parameter2>
|
|
||||||
</AssemblyAttributes>
|
|
||||||
</ItemGroup>
|
|
||||||
<!-- writes the attribute to the customAssemblyInfo file -->
|
|
||||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -275,7 +275,11 @@ namespace Barotrauma
|
|||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "chooserandom":
|
case "chooserandom":
|
||||||
LoadSubElement(subElement.Elements().ToArray().GetRandom(random));
|
var subElements = subElement.Elements();
|
||||||
|
if (subElements.Any())
|
||||||
|
{
|
||||||
|
LoadSubElement(subElements.ToArray().GetRandom(random));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LoadSubElement(subElement);
|
LoadSubElement(subElement);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public readonly Identifier[] ForbiddenAmmunition;
|
public readonly Identifier[] ForbiddenAmmunition;
|
||||||
|
|
||||||
public static WreckAIConfig GetRandom() => Prefabs.GetRandom(Rand.RandSync.ServerAndClient);
|
public static WreckAIConfig GetRandom() => Prefabs.OrderBy(p => p.UintIdentifier).GetRandom(Rand.RandSync.ServerAndClient);
|
||||||
|
|
||||||
protected override Identifier DetermineIdentifier(XElement element)
|
protected override Identifier DetermineIdentifier(XElement element)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -94,11 +94,67 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Vector2 SheetIndex => Preset.SheetIndex;
|
public Vector2 SheetIndex => Preset.SheetIndex;
|
||||||
|
|
||||||
public ContentXElement HairElement => CharacterInfo.Hairs?.ElementAtOrDefault(HairIndex);
|
public ContentXElement HairElement
|
||||||
public ContentXElement HairWithHatElement => CharacterInfo.Hairs?.ElementAtOrDefault(HairWithHatIndex);
|
{
|
||||||
public ContentXElement BeardElement => CharacterInfo.Beards?.ElementAtOrDefault(BeardIndex);
|
get
|
||||||
public ContentXElement MoustacheElement => CharacterInfo.Moustaches?.ElementAtOrDefault(MoustacheIndex);
|
{
|
||||||
public ContentXElement FaceAttachment => CharacterInfo.FaceAttachments?.ElementAtOrDefault(FaceAttachmentIndex);
|
if (CharacterInfo.Hairs == null) { return null; }
|
||||||
|
if (hairIndex >= CharacterInfo.Hairs.Count)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning($"Hair index out of range (character: {CharacterInfo?.Name ?? "null"}, index: {hairIndex})");
|
||||||
|
}
|
||||||
|
return CharacterInfo.Hairs.ElementAtOrDefault(hairIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ContentXElement HairWithHatElement
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CharacterInfo.Hairs == null) { return null; }
|
||||||
|
if (HairWithHatIndex >= CharacterInfo.Hairs.Count)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning($"Hair with hat index out of range (character: {CharacterInfo?.Name ?? "null"}, index: {HairWithHatIndex})");
|
||||||
|
}
|
||||||
|
return CharacterInfo.Hairs.ElementAtOrDefault(HairWithHatIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentXElement BeardElement
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CharacterInfo.Beards == null) { return null; }
|
||||||
|
if (BeardIndex >= CharacterInfo.Beards.Count)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning($"Beard index out of range (character: {CharacterInfo?.Name ?? "null"}, index: {BeardIndex})");
|
||||||
|
}
|
||||||
|
return CharacterInfo.Beards.ElementAtOrDefault(BeardIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ContentXElement MoustacheElement
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CharacterInfo.Moustaches == null) { return null; }
|
||||||
|
if (MoustacheIndex >= CharacterInfo.Moustaches.Count)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning($"Moustache index out of range (character: {CharacterInfo?.Name ?? "null"}, index: {MoustacheIndex})");
|
||||||
|
}
|
||||||
|
return CharacterInfo.Moustaches.ElementAtOrDefault(MoustacheIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ContentXElement FaceAttachment
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CharacterInfo.FaceAttachments == null) { return null; }
|
||||||
|
if (FaceAttachmentIndex >= CharacterInfo.FaceAttachments.Count)
|
||||||
|
{
|
||||||
|
DebugConsole.AddWarning($"Face attachment index out of range (character: {CharacterInfo?.Name ?? "null"}, index: {FaceAttachmentIndex})");
|
||||||
|
}
|
||||||
|
return CharacterInfo.FaceAttachments.ElementAtOrDefault(FaceAttachmentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public HeadInfo(CharacterInfo characterInfo, HeadPreset headPreset, int hairIndex = 0, int beardIndex = 0, int moustacheIndex = 0, int faceAttachmentIndex = 0)
|
public HeadInfo(CharacterInfo characterInfo, HeadPreset headPreset, int hairIndex = 0, int beardIndex = 0, int moustacheIndex = 0, int faceAttachmentIndex = 0)
|
||||||
{
|
{
|
||||||
@@ -130,6 +186,10 @@ namespace Barotrauma
|
|||||||
head = value;
|
head = value;
|
||||||
HeadSprite = null;
|
HeadSprite = null;
|
||||||
AttachmentSprites = null;
|
AttachmentSprites = null;
|
||||||
|
hairs = null;
|
||||||
|
beards = null;
|
||||||
|
moustaches = null;
|
||||||
|
faceAttachments = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -843,7 +903,14 @@ namespace Barotrauma
|
|||||||
public void RecreateHead(ImmutableHashSet<Identifier> tags, int hairIndex, int beardIndex, int moustacheIndex, int faceAttachmentIndex)
|
public void RecreateHead(ImmutableHashSet<Identifier> tags, int hairIndex, int beardIndex, int moustacheIndex, int faceAttachmentIndex)
|
||||||
{
|
{
|
||||||
HeadPreset headPreset = Prefab.Heads.FirstOrDefault(h => h.TagSet.SetEquals(tags));
|
HeadPreset headPreset = Prefab.Heads.FirstOrDefault(h => h.TagSet.SetEquals(tags));
|
||||||
if (headPreset == null) { headPreset = Prefab.Heads.GetRandomUnsynced(); }
|
if (headPreset == null)
|
||||||
|
{
|
||||||
|
if (tags.Count == 1)
|
||||||
|
{
|
||||||
|
headPreset = Prefab.Heads.FirstOrDefault(h => h.TagSet.Contains(tags.First()));
|
||||||
|
}
|
||||||
|
headPreset ??= Prefab.Heads.GetRandomUnsynced();
|
||||||
|
}
|
||||||
head = new HeadInfo(this, headPreset, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex);
|
head = new HeadInfo(this, headPreset, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex);
|
||||||
ReloadHeadAttachments();
|
ReloadHeadAttachments();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Vector2 Position
|
public Vector2 Position
|
||||||
{
|
{
|
||||||
get { return ConvertUnits.ToDisplayUnits(body.SimPosition); }
|
get { return ConvertUnits.ToDisplayUnits(body?.SimPosition ?? Vector2.Zero); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 SimPosition
|
public Vector2 SimPosition
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ namespace Barotrauma
|
|||||||
public float AggressionGreed { get; private set; }
|
public float AggressionGreed { get; private set; }
|
||||||
|
|
||||||
[Serialize(0f, IsPropertySaveable.Yes, description: "If the health drops below this threshold, the character flees. In percentages."), Editable(minValue: 0f, maxValue: 100f)]
|
[Serialize(0f, IsPropertySaveable.Yes, description: "If the health drops below this threshold, the character flees. In percentages."), Editable(minValue: 0f, maxValue: 100f)]
|
||||||
public float FleeHealthThreshold { get; private set; }
|
public float FleeHealthThreshold { get; set; }
|
||||||
|
|
||||||
[Serialize(false, IsPropertySaveable.Yes, description: "Does the character attack when provoked? When enabled, overrides the predefined targeting state with Attack and increases the priority of it."), Editable()]
|
[Serialize(false, IsPropertySaveable.Yes, description: "Does the character attack when provoked? When enabled, overrides the predefined targeting state with Attack and increases the priority of it."), Editable()]
|
||||||
public bool AttackWhenProvoked { get; private set; }
|
public bool AttackWhenProvoked { get; private set; }
|
||||||
|
|||||||
@@ -1122,7 +1122,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var gamesession = new GameSession(
|
var gamesession = new GameSession(
|
||||||
SubmarineInfo.SavedSubmarines.GetRandomUnsynced(s => s.Type == SubmarineType.Player && !s.HasTag(SubmarineTag.HideInMenus)),
|
SubmarineInfo.SavedSubmarines.GetRandomUnsynced(s => s.Type == SubmarineType.Player && !s.HasTag(SubmarineTag.HideInMenus)),
|
||||||
GameModePreset.DevSandbox);
|
GameModePreset.DevSandbox ?? GameModePreset.Sandbox);
|
||||||
string seed = ToolBox.RandomSeed(16);
|
string seed = ToolBox.RandomSeed(16);
|
||||||
gamesession.StartRound(seed);
|
gamesession.StartRound(seed);
|
||||||
|
|
||||||
|
|||||||
@@ -155,4 +155,10 @@ namespace Barotrauma
|
|||||||
Player = 0b10,
|
Player = 0b10,
|
||||||
Both = Bot | Player
|
Both = Bot | Player
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum NumberType
|
||||||
|
{
|
||||||
|
Int,
|
||||||
|
Float
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -313,10 +313,14 @@ namespace Barotrauma
|
|||||||
bool isValid = e is Character character && !character.Removed && !character.IsDead && !character.IsIncapacitated &&
|
bool isValid = e is Character character && !character.Removed && !character.IsDead && !character.IsIncapacitated &&
|
||||||
(e == Character.Controlled || character.IsRemotePlayer);
|
(e == Character.Controlled || character.IsRemotePlayer);
|
||||||
#if SERVER
|
#if SERVER
|
||||||
UpdateIgnoredClients();
|
if (!dialogOpened)
|
||||||
isValid &= !ignoredClients.Keys.Any(c => c.Character == e);
|
{
|
||||||
|
UpdateIgnoredClients();
|
||||||
|
isValid &= !ignoredClients.Keys.Any(c => c.Character == e);
|
||||||
|
}
|
||||||
#elif CLIENT
|
#elif CLIENT
|
||||||
isValid &= (e != Character.Controlled || !GUI.InputBlockingMenuOpen);
|
bool block = GUI.InputBlockingMenuOpen && !dialogOpened;
|
||||||
|
isValid &= (e != Character.Controlled || !block);
|
||||||
#endif
|
#endif
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,8 +135,10 @@ namespace Barotrauma
|
|||||||
monster.Enabled = false;
|
monster.Enabled = false;
|
||||||
if (monster.Params.AI != null && monster.Params.AI.EnforceAggressiveBehaviorForMissions)
|
if (monster.Params.AI != null && monster.Params.AI.EnforceAggressiveBehaviorForMissions)
|
||||||
{
|
{
|
||||||
|
monster.Params.AI.FleeHealthThreshold = 0;
|
||||||
foreach (var targetParam in monster.Params.AI.Targets)
|
foreach (var targetParam in monster.Params.AI.Targets)
|
||||||
{
|
{
|
||||||
|
if (targetParam.Tag.Equals("engine", StringComparison.OrdinalIgnoreCase)) { continue; }
|
||||||
switch (targetParam.State)
|
switch (targetParam.State)
|
||||||
{
|
{
|
||||||
case AIState.Avoid:
|
case AIState.Avoid:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Barotrauma
|
|||||||
private readonly Dictionary<Identifier, List<Entity>> cachedTargets = new Dictionary<Identifier, List<Entity>>();
|
private readonly Dictionary<Identifier, List<Entity>> cachedTargets = new Dictionary<Identifier, List<Entity>>();
|
||||||
private int prevEntityCount;
|
private int prevEntityCount;
|
||||||
private int prevPlayerCount, prevBotCount;
|
private int prevPlayerCount, prevBotCount;
|
||||||
|
private Character prevControlled;
|
||||||
|
|
||||||
private readonly string[] requiredDestinationTypes;
|
private readonly string[] requiredDestinationTypes;
|
||||||
public readonly bool RequireBeaconStation;
|
public readonly bool RequireBeaconStation;
|
||||||
@@ -163,12 +164,13 @@ namespace Barotrauma
|
|||||||
botCount++;
|
botCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Entity.EntityCount != prevEntityCount || botCount != prevBotCount || playerCount != prevPlayerCount)
|
if (Entity.EntityCount != prevEntityCount || botCount != prevBotCount || playerCount != prevPlayerCount || prevControlled != Character.Controlled)
|
||||||
{
|
{
|
||||||
cachedTargets.Clear();
|
cachedTargets.Clear();
|
||||||
prevEntityCount = Entity.EntityCount;
|
prevEntityCount = Entity.EntityCount;
|
||||||
prevBotCount = botCount;
|
prevBotCount = botCount;
|
||||||
prevPlayerCount = playerCount;
|
prevPlayerCount = playerCount;
|
||||||
|
prevControlled = Character.Controlled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Actions.Any())
|
if (!Actions.Any())
|
||||||
|
|||||||
@@ -339,11 +339,6 @@ namespace Barotrauma
|
|||||||
loadContext = null;
|
loadContext = null;
|
||||||
assembly = null;
|
assembly = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Implementation()
|
|
||||||
{
|
|
||||||
OnQuit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private static Implementation? loadedImplementation;
|
private static Implementation? loadedImplementation;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Extensions;
|
||||||
|
using Barotrauma.Items.Components;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Barotrauma.Extensions;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -15,29 +14,29 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.NetworkMember != null && !GameMain.NetworkMember.IsServer) { return; }
|
if (GameMain.NetworkMember != null && !GameMain.NetworkMember.IsServer) { return; }
|
||||||
|
|
||||||
bool skipMainSubs = GameMain.GameSession.GameMode is CampaignMode { IsFirstRound: false };
|
//player has more than one sub = we must have given the start items already
|
||||||
if (!skipMainSubs)
|
bool startItemsGiven = GameMain.GameSession?.OwnedSubmarines != null && GameMain.GameSession.OwnedSubmarines.Count > 1;
|
||||||
|
if (!startItemsGiven)
|
||||||
{
|
{
|
||||||
if (Submarine.MainSub is Submarine mainSub && mainSub.Info.IsPlayer)
|
|
||||||
{
|
|
||||||
SpawnStartItems(mainSub);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
||||||
{
|
{
|
||||||
var sub = Submarine.MainSubs[i];
|
var sub = Submarine.MainSubs[i];
|
||||||
if (sub == null || sub.Info.InitialSuppliesSpawned) { continue; }
|
if (sub == null || sub.Info.InitialSuppliesSpawned || !sub.Info.IsPlayer) { continue; }
|
||||||
|
//1st pass: items defined in the start item set, only spawned in the main sub (not drones/shuttles or other linked subs)
|
||||||
|
SpawnStartItems(sub);
|
||||||
|
//2nd pass: items defined using preferred containers, spawned in the main sub and all the linked subs (drones, shuttles etc)
|
||||||
var subs = sub.GetConnectedSubs().Where(s => s.TeamID == sub.TeamID);
|
var subs = sub.GetConnectedSubs().Where(s => s.TeamID == sub.TeamID);
|
||||||
CreateAndPlace(subs);
|
CreateAndPlace(subs);
|
||||||
subs.ForEach(s => s.Info.InitialSuppliesSpawned = true);
|
subs.ForEach(s => s.Info.InitialSuppliesSpawned = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//spawn items in wrecks, beacon stations and pirate subs
|
||||||
foreach (var sub in Submarine.Loaded)
|
foreach (var sub in Submarine.Loaded)
|
||||||
{
|
{
|
||||||
if (sub.Info.Type == SubmarineType.Player ||
|
if (sub.Info.Type == SubmarineType.Player ||
|
||||||
sub.Info.Type == SubmarineType.Outpost ||
|
sub.Info.Type == SubmarineType.Outpost ||
|
||||||
sub.Info.Type == SubmarineType.OutpostModule ||
|
sub.Info.Type == SubmarineType.OutpostModule)
|
||||||
sub.Info.Type == SubmarineType.EnemySubmarine)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -64,6 +63,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Identifier StartItemSet = new Identifier("normal");
|
public static Identifier StartItemSet = new Identifier("normal");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spawns the items defined in the start item set in the specified sub.
|
||||||
|
/// </summary>
|
||||||
private static void SpawnStartItems(Submarine sub)
|
private static void SpawnStartItems(Submarine sub)
|
||||||
{
|
{
|
||||||
if (!Barotrauma.StartItemSet.Sets.TryGet(StartItemSet, out StartItemSet itemSet))
|
if (!Barotrauma.StartItemSet.Sets.TryGet(StartItemSet, out StartItemSet itemSet))
|
||||||
|
|||||||
@@ -1081,15 +1081,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
bool hasNewPendingSub = Campaign.PendingSubmarineSwitch != null &&
|
bool hasNewPendingSub = Campaign.PendingSubmarineSwitch != null &&
|
||||||
Campaign.PendingSubmarineSwitch.MD5Hash.StringRepresentation != Submarine.Info.MD5Hash.StringRepresentation;
|
Campaign.PendingSubmarineSwitch.MD5Hash.StringRepresentation != Submarine.Info.MD5Hash.StringRepresentation;
|
||||||
|
|
||||||
if (hasNewPendingSub)
|
if (hasNewPendingSub)
|
||||||
{
|
{
|
||||||
Campaign.SwitchSubs();
|
Campaign.SwitchSubs();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
SubmarineInfo = new SubmarineInfo(Submarine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rootElement.Add(new XAttribute("submarine", SubmarineInfo == null ? "" : SubmarineInfo.Name));
|
rootElement.Add(new XAttribute("submarine", SubmarineInfo == null ? "" : SubmarineInfo.Name));
|
||||||
if (OwnedSubmarines != null)
|
if (OwnedSubmarines != null)
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ namespace Barotrauma.Items.Components
|
|||||||
hullRects[i].X -= expand;
|
hullRects[i].X -= expand;
|
||||||
hullRects[i].Width += expand * 2;
|
hullRects[i].Width += expand * 2;
|
||||||
hullRects[i].Location -= MathUtils.ToPoint(subs[i].WorldPosition - subs[i].HiddenSubPosition);
|
hullRects[i].Location -= MathUtils.ToPoint(subs[i].WorldPosition - subs[i].HiddenSubPosition);
|
||||||
hulls[i] = new Hull(MapEntityPrefab.Find(null, "hull"), hullRects[i], subs[i]);
|
hulls[i] = new Hull(hullRects[i], subs[i]);
|
||||||
hulls[i].RoomName = IsHorizontal ? "entityname.dockingport" : "entityname.dockinghatch";
|
hulls[i].RoomName = IsHorizontal ? "entityname.dockingport" : "entityname.dockinghatch";
|
||||||
hulls[i].AddToGrid(subs[i]);
|
hulls[i].AddToGrid(subs[i]);
|
||||||
hulls[i].FreeID();
|
hulls[i].FreeID();
|
||||||
@@ -744,7 +744,7 @@ namespace Barotrauma.Items.Components
|
|||||||
hullRects[i].Y += expand;
|
hullRects[i].Y += expand;
|
||||||
hullRects[i].Height += expand * 2;
|
hullRects[i].Height += expand * 2;
|
||||||
hullRects[i].Location -= MathUtils.ToPoint(subs[i].WorldPosition - subs[i].HiddenSubPosition);
|
hullRects[i].Location -= MathUtils.ToPoint(subs[i].WorldPosition - subs[i].HiddenSubPosition);
|
||||||
hulls[i] = new Hull(MapEntityPrefab.Find(null, "hull"), hullRects[i], subs[i]);
|
hulls[i] = new Hull(hullRects[i], subs[i]);
|
||||||
hulls[i].RoomName = IsHorizontal ? "entityname.dockingport" : "entityname.dockinghatch";
|
hulls[i].RoomName = IsHorizontal ? "entityname.dockingport" : "entityname.dockinghatch";
|
||||||
hulls[i].AddToGrid(subs[i]);
|
hulls[i].AddToGrid(subs[i]);
|
||||||
hulls[i].FreeID();
|
hulls[i].FreeID();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using FarseerPhysics;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Matrix bodyTransform = Matrix.CreateRotationZ(item.body == null ? MathHelper.ToRadians(item.Rotation) : item.body.Rotation);
|
Matrix bodyTransform = Matrix.CreateRotationZ(item.body == null ? item.RotationRad : item.body.Rotation);
|
||||||
Vector2 flippedPos = barrelPos;
|
Vector2 flippedPos = barrelPos;
|
||||||
if (item.body != null && item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
|
if (item.body != null && item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
|
||||||
return Vector2.Transform(flippedPos, bodyTransform) * item.Scale;
|
return Vector2.Transform(flippedPos, bodyTransform) * item.Scale;
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ namespace Barotrauma.Items.Components
|
|||||||
public readonly Item Item;
|
public readonly Item Item;
|
||||||
public readonly StatusEffect StatusEffect;
|
public readonly StatusEffect StatusEffect;
|
||||||
public readonly bool ExcludeBroken;
|
public readonly bool ExcludeBroken;
|
||||||
public ActiveContainedItem(Item item, StatusEffect statusEffect, bool excludeBroken)
|
public readonly bool ExcludeFullCondition;
|
||||||
|
public ActiveContainedItem(Item item, StatusEffect statusEffect, bool excludeBroken, bool excludeFullCondition)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
StatusEffect = statusEffect;
|
StatusEffect = statusEffect;
|
||||||
ExcludeBroken = excludeBroken;
|
ExcludeBroken = excludeBroken;
|
||||||
|
ExcludeFullCondition = excludeFullCondition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +302,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (!containableItem.MatchesItem(containedItem)) { continue; }
|
if (!containableItem.MatchesItem(containedItem)) { continue; }
|
||||||
foreach (StatusEffect effect in containableItem.statusEffects)
|
foreach (StatusEffect effect in containableItem.statusEffects)
|
||||||
{
|
{
|
||||||
activeContainedItems.Add(new ActiveContainedItem(containedItem, effect, containableItem.ExcludeBroken));
|
activeContainedItems.Add(new ActiveContainedItem(containedItem, effect, containableItem.ExcludeBroken, containableItem.ExcludeFullCondition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -408,6 +410,7 @@ namespace Barotrauma.Items.Components
|
|||||||
Item contained = activeContainedItem.Item;
|
Item contained = activeContainedItem.Item;
|
||||||
|
|
||||||
if (activeContainedItem.ExcludeBroken && contained.Condition <= 0.0f) { continue; }
|
if (activeContainedItem.ExcludeBroken && contained.Condition <= 0.0f) { continue; }
|
||||||
|
if (activeContainedItem.ExcludeFullCondition && contained.IsFullCondition) { continue; }
|
||||||
StatusEffect effect = activeContainedItem.StatusEffect;
|
StatusEffect effect = activeContainedItem.StatusEffect;
|
||||||
|
|
||||||
if (effect.HasTargetType(StatusEffect.TargetType.This))
|
if (effect.HasTargetType(StatusEffect.TargetType.This))
|
||||||
@@ -569,7 +572,7 @@ namespace Barotrauma.Items.Components
|
|||||||
transformedItemPos += new Vector2(item.Rect.X, item.Rect.Y);
|
transformedItemPos += new Vector2(item.Rect.X, item.Rect.Y);
|
||||||
if (Math.Abs(item.Rotation) > 0.01f)
|
if (Math.Abs(item.Rotation) > 0.01f)
|
||||||
{
|
{
|
||||||
Matrix transform = Matrix.CreateRotationZ(MathHelper.ToRadians(-item.Rotation));
|
Matrix transform = Matrix.CreateRotationZ(-item.RotationRad);
|
||||||
transformedItemPos = Vector2.Transform(transformedItemPos - item.Position, transform) + item.Position;
|
transformedItemPos = Vector2.Transform(transformedItemPos - item.Position, transform) + item.Position;
|
||||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||||
transformedItemIntervalHorizontal = Vector2.Transform(transformedItemIntervalHorizontal, transform);
|
transformedItemIntervalHorizontal = Vector2.Transform(transformedItemIntervalHorizontal, transform);
|
||||||
@@ -600,7 +603,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentRotation += MathHelper.ToRadians(-item.Rotation);
|
currentRotation += -item.RotationRad;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components
|
|||||||
hullData.ReceivedWaterAmount = null;
|
hullData.ReceivedWaterAmount = null;
|
||||||
if (fromWaterDetector)
|
if (fromWaterDetector)
|
||||||
{
|
{
|
||||||
hullData.ReceivedWaterAmount = Math.Min(sourceHull.WaterVolume / sourceHull.Volume, 1.0f);
|
hullData.ReceivedWaterAmount = WaterDetector.GetWaterPercentage(sourceHull);
|
||||||
}
|
}
|
||||||
foreach (var linked in sourceHull.linkedTo)
|
foreach (var linked in sourceHull.linkedTo)
|
||||||
{
|
{
|
||||||
@@ -174,7 +174,7 @@ namespace Barotrauma.Items.Components
|
|||||||
linkedHullData.ReceivedWaterAmount = null;
|
linkedHullData.ReceivedWaterAmount = null;
|
||||||
if (fromWaterDetector)
|
if (fromWaterDetector)
|
||||||
{
|
{
|
||||||
linkedHullData.ReceivedWaterAmount = Math.Min(linkedHull.WaterVolume / linkedHull.Volume, 1.0f);
|
linkedHullData.ReceivedWaterAmount = WaterDetector.GetWaterPercentage(linkedHull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ namespace Barotrauma.Items.Components
|
|||||||
private const float ConnectedSubUpdateInterval = 1.0f;
|
private const float ConnectedSubUpdateInterval = 1.0f;
|
||||||
float connectedSubUpdateTimer;
|
float connectedSubUpdateTimer;
|
||||||
|
|
||||||
|
private double lastReceivedSteeringSignalTime;
|
||||||
|
|
||||||
public bool AutoPilot
|
public bool AutoPilot
|
||||||
{
|
{
|
||||||
get { return autoPilot; }
|
get { return autoPilot; }
|
||||||
@@ -312,16 +314,20 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else if (AutoPilot)
|
else if (AutoPilot)
|
||||||
{
|
{
|
||||||
UpdateAutoPilot(deltaTime);
|
//signals override autopilot for a duration of one second
|
||||||
float throttle = 1.0f;
|
if (lastReceivedSteeringSignalTime < Timing.TotalTime - 1)
|
||||||
if (controlledSub != null)
|
|
||||||
{
|
{
|
||||||
//if the sub is heading in the correct direction, throttle the speed according to the user's skill
|
UpdateAutoPilot(deltaTime);
|
||||||
//if it's e.g. sinking due to extra water, don't throttle, but allow emptying up the ballast completely
|
float throttle = 1.0f;
|
||||||
throttle = MathHelper.Clamp(Vector2.Dot(controlledSub.Velocity, TargetVelocity) / 100.0f, 0.0f, 1.0f);
|
if (controlledSub != null)
|
||||||
|
{
|
||||||
|
//if the sub is heading in the correct direction, throttle the speed according to the user's skill
|
||||||
|
//if it's e.g. sinking due to extra water, don't throttle, but allow emptying up the ballast completely
|
||||||
|
throttle = MathHelper.Clamp(Vector2.Dot(controlledSub.Velocity, TargetVelocity) / 100.0f, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
float maxSpeed = MathHelper.Lerp(AutoPilotMaxSpeed, AIPilotMaxSpeed, userSkill) * 100.0f;
|
||||||
|
TargetVelocity = TargetVelocity.ClampLength(MathHelper.Lerp(100.0f, maxSpeed, throttle));
|
||||||
}
|
}
|
||||||
float maxSpeed = MathHelper.Lerp(AutoPilotMaxSpeed, AIPilotMaxSpeed, userSkill) * 100.0f;
|
|
||||||
TargetVelocity = TargetVelocity.ClampLength(MathHelper.Lerp(100.0f, maxSpeed, throttle));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -821,6 +827,7 @@ namespace Barotrauma.Items.Components
|
|||||||
steeringInput.X = MathHelper.Clamp(steeringInput.X, -100.0f, 100.0f);
|
steeringInput.X = MathHelper.Clamp(steeringInput.X, -100.0f, 100.0f);
|
||||||
steeringInput.Y = MathHelper.Clamp(-steeringInput.Y, -100.0f, 100.0f);
|
steeringInput.Y = MathHelper.Clamp(-steeringInput.Y, -100.0f, 100.0f);
|
||||||
TargetVelocity = steeringInput;
|
TargetVelocity = steeringInput;
|
||||||
|
lastReceivedSteeringSignalTime = Timing.TotalTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (powerOut?.Grid != null) { return powerOut.Grid.Voltage; }
|
if (powerOut?.Grid != null) { return powerOut.Grid.Voltage; }
|
||||||
}
|
}
|
||||||
return currPowerConsumption <= 0.0f ? 1.0f : voltage;
|
return PowerConsumption <= 0.0f ? 1.0f : voltage;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -158,21 +158,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PoweredByTinkering
|
public bool PoweredByTinkering { get; set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (this is PowerContainer) { return false; }
|
|
||||||
foreach (Repairable repairable in Item.Repairables)
|
|
||||||
{
|
|
||||||
if (repairable.IsTinkering && repairable.TinkeringPowersDevices)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Editable, Serialize(true, IsPropertySaveable.Yes, description: "Can the item be damaged by electomagnetic pulses.")]
|
[Editable, Serialize(true, IsPropertySaveable.Yes, description: "Can the item be damaged by electomagnetic pulses.")]
|
||||||
public bool VulnerableToEMP
|
public bool VulnerableToEMP
|
||||||
|
|||||||
@@ -965,7 +965,8 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
item.body.LinearVelocity *= deflectedSpeedMultiplier;
|
item.body.LinearVelocity *= deflectedSpeedMultiplier;
|
||||||
}
|
}
|
||||||
else if ( stickJoint == null && StickTarget == null &&
|
else if ( remainingHits <= 0 &&
|
||||||
|
stickJoint == null && StickTarget == null &&
|
||||||
StickToStructures && target.Body.UserData is Structure ||
|
StickToStructures && target.Body.UserData is Structure ||
|
||||||
((StickToLightTargets || target.Body.Mass > item.body.Mass * 0.5f) &&
|
((StickToLightTargets || target.Body.Mass > item.body.Mass * 0.5f) &&
|
||||||
(DoesStick ||
|
(DoesStick ||
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
bool wasInFullCondition = item.IsFullCondition;
|
bool wasInFullCondition = item.IsFullCondition;
|
||||||
qualityLevel = MathHelper.Clamp(value, 0, MaxQuality);
|
qualityLevel = MathHelper.Clamp(value, 0, MaxQuality);
|
||||||
|
item.RecalculateConditionValues();
|
||||||
//set the condition to the new max condition
|
//set the condition to the new max condition
|
||||||
if (wasInFullCondition && statValues.ContainsKey(StatType.Condition))
|
if (wasInFullCondition && statValues.ContainsKey(StatType.Condition))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,7 +106,25 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsTinkering { get; private set; } = false;
|
private bool isTinkering;
|
||||||
|
public bool IsTinkering
|
||||||
|
{
|
||||||
|
get { return isTinkering; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
if (isTinkering == value) { return; }
|
||||||
|
isTinkering = value;
|
||||||
|
|
||||||
|
if (tinkeringPowersDevices)
|
||||||
|
{
|
||||||
|
foreach (Powered powered in item.GetComponents<Powered>())
|
||||||
|
{
|
||||||
|
if (powered is PowerContainer) { continue; }
|
||||||
|
powered.PoweredByTinkering = isTinkering;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Character CurrentFixer { get; private set; }
|
public Character CurrentFixer { get; private set; }
|
||||||
private Item currentRepairItem;
|
private Item currentRepairItem;
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ namespace Barotrauma.Items.Components
|
|||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
if (source == null || target == null || target.Removed ||
|
if (source == null || target == null || target.Removed ||
|
||||||
(source is Entity sourceEntity && sourceEntity.Removed))
|
(source is Entity sourceEntity && sourceEntity.Removed) ||
|
||||||
|
(source is Limb limb && limb.Removed))
|
||||||
{
|
{
|
||||||
ResetSource();
|
ResetSource();
|
||||||
target = null;
|
target = null;
|
||||||
|
|||||||
+60
-8
@@ -3,6 +3,7 @@ using Barotrauma.Networking;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
@@ -34,13 +35,17 @@ namespace Barotrauma.Items.Components
|
|||||||
public Identifier PropertyName { get; }
|
public Identifier PropertyName { get; }
|
||||||
public bool TargetOnlyParentProperty { get; }
|
public bool TargetOnlyParentProperty { get; }
|
||||||
|
|
||||||
public int NumberInputMin { get; }
|
public string NumberInputMin { get; }
|
||||||
public int NumberInputMax { get; }
|
public string NumberInputMax { get; }
|
||||||
|
public string NumberInputStep { get; }
|
||||||
|
public int NumberInputDecimalPlaces { get; }
|
||||||
|
|
||||||
public int MaxTextLength { get; }
|
public int MaxTextLength { get; }
|
||||||
|
|
||||||
public const int DefaultNumberInputMin = 0, DefaultNumberInputMax = 99;
|
public const string DefaultNumberInputMin = "0", DefaultNumberInputMax = "99", DefaultNumberInputStep = "1";
|
||||||
public bool IsIntegerInput { get; }
|
public const int DefaultNumberInputDecimalPlaces = 0;
|
||||||
|
public bool IsNumberInput { get; }
|
||||||
|
public NumberType? NumberType { get; }
|
||||||
public bool HasPropertyName { get; }
|
public bool HasPropertyName { get; }
|
||||||
public bool ShouldSetProperty { get; set; }
|
public bool ShouldSetProperty { get; set; }
|
||||||
|
|
||||||
@@ -60,11 +65,34 @@ namespace Barotrauma.Items.Components
|
|||||||
ConnectionName = element.GetAttributeString("connection", "");
|
ConnectionName = element.GetAttributeString("connection", "");
|
||||||
PropertyName = element.GetAttributeIdentifier("propertyname", "");
|
PropertyName = element.GetAttributeIdentifier("propertyname", "");
|
||||||
TargetOnlyParentProperty = element.GetAttributeBool("targetonlyparentproperty", false);
|
TargetOnlyParentProperty = element.GetAttributeBool("targetonlyparentproperty", false);
|
||||||
NumberInputMin = element.GetAttributeInt("min", DefaultNumberInputMin);
|
NumberInputMin = element.GetAttributeString("min", DefaultNumberInputMin);
|
||||||
NumberInputMax = element.GetAttributeInt("max", DefaultNumberInputMax);
|
NumberInputMax = element.GetAttributeString("max", DefaultNumberInputMax);
|
||||||
|
NumberInputStep = element.GetAttributeString("step", DefaultNumberInputStep);
|
||||||
|
NumberInputDecimalPlaces = element.GetAttributeInt("decimalplaces", DefaultNumberInputDecimalPlaces);
|
||||||
MaxTextLength = element.GetAttributeInt("maxtextlength", int.MaxValue);
|
MaxTextLength = element.GetAttributeInt("maxtextlength", int.MaxValue);
|
||||||
|
|
||||||
HasPropertyName = !PropertyName.IsEmpty;
|
HasPropertyName = !PropertyName.IsEmpty;
|
||||||
IsIntegerInput = HasPropertyName && element.Name.ToString().ToLowerInvariant() == "integerinput";
|
if (HasPropertyName)
|
||||||
|
{
|
||||||
|
string elementName = element.Name.ToString().ToLowerInvariant();
|
||||||
|
IsNumberInput = elementName == "numberinput" || elementName == "integerinput"; // backwards compatibility
|
||||||
|
if (IsNumberInput)
|
||||||
|
{
|
||||||
|
string numberType = element.GetAttributeString("numbertype", string.Empty);
|
||||||
|
switch (numberType)
|
||||||
|
{
|
||||||
|
case "f":
|
||||||
|
case "float":
|
||||||
|
NumberType = Barotrauma.NumberType.Float;
|
||||||
|
break;
|
||||||
|
case "int":
|
||||||
|
case "integer":
|
||||||
|
default: // backwards compatibility
|
||||||
|
NumberType = Barotrauma.NumberType.Int;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (element.GetAttribute("signal") is XAttribute attribute)
|
if (element.GetAttribute("signal") is XAttribute attribute)
|
||||||
{
|
{
|
||||||
@@ -152,7 +180,8 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
case "button":
|
case "button":
|
||||||
case "textbox":
|
case "textbox":
|
||||||
case "integerinput":
|
case "integerinput": // backwards compatibility
|
||||||
|
case "numberinput":
|
||||||
var button = new CustomInterfaceElement(item, subElement, this)
|
var button = new CustomInterfaceElement(item, subElement, this)
|
||||||
{
|
{
|
||||||
ContinuousSignal = false
|
ContinuousSignal = false
|
||||||
@@ -317,6 +346,24 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ValueChanged(CustomInterfaceElement numberInputElement, float value)
|
||||||
|
{
|
||||||
|
if (numberInputElement == null) { return; }
|
||||||
|
numberInputElement.Signal = value.ToString();
|
||||||
|
if (!numberInputElement.TargetOnlyParentProperty)
|
||||||
|
{
|
||||||
|
foreach (ISerializableEntity e in item.AllPropertyObjects)
|
||||||
|
{
|
||||||
|
if (!e.SerializableProperties.ContainsKey(numberInputElement.PropertyName)) { continue; }
|
||||||
|
e.SerializableProperties[numberInputElement.PropertyName].TrySetValue(e, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (SerializableProperties.ContainsKey(numberInputElement.PropertyName))
|
||||||
|
{
|
||||||
|
SerializableProperties[numberInputElement.PropertyName].TrySetValue(this, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
foreach (CustomInterfaceElement ciElement in customInterfaceElementList)
|
foreach (CustomInterfaceElement ciElement in customInterfaceElementList)
|
||||||
@@ -341,5 +388,10 @@ namespace Barotrauma.Items.Components
|
|||||||
signals = customInterfaceElementList.Select(ci => ci.Signal).ToArray();
|
signals = customInterfaceElementList.Select(ci => ci.Signal).ToArray();
|
||||||
return base.Save(parentElement);
|
return base.Save(parentElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool TryParseFloatInvariantCulture(string s, out float f)
|
||||||
|
{
|
||||||
|
return float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ namespace Barotrauma.Items.Components
|
|||||||
IsActive = true;
|
IsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetWaterPercentage(Hull hull)
|
||||||
|
{
|
||||||
|
return hull.WaterVolume > 1.0f ? MathHelper.Clamp((int)Math.Ceiling(hull.WaterPercentage), 0, 100) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
if (stateSwitchDelay > 0.0f)
|
if (stateSwitchDelay > 0.0f)
|
||||||
@@ -103,12 +108,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (item.CurrentHull != null)
|
if (item.CurrentHull != null)
|
||||||
{
|
{
|
||||||
int waterPercentage = 0;
|
int waterPercentage = GetWaterPercentage(item.CurrentHull);
|
||||||
//ignore minuscule amounts of water
|
|
||||||
if (item.CurrentHull.WaterVolume > 1.0f)
|
|
||||||
{
|
|
||||||
waterPercentage = MathHelper.Clamp((int)Math.Ceiling(item.CurrentHull.WaterPercentage), 0, 100);
|
|
||||||
}
|
|
||||||
if (prevSentWaterPercentageValue != waterPercentage || waterPercentageSignal == null)
|
if (prevSentWaterPercentageValue != waterPercentage || waterPercentageSignal == null)
|
||||||
{
|
{
|
||||||
prevSentWaterPercentageValue = waterPercentage;
|
prevSentWaterPercentageValue = waterPercentage;
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (lightComponent != null)
|
if (lightComponent != null)
|
||||||
{
|
{
|
||||||
lightComponent.Parent = null;
|
lightComponent.Parent = null;
|
||||||
lightComponent.Rotation = Rotation - MathHelper.ToRadians(item.Rotation);
|
lightComponent.Rotation = Rotation - item.RotationRad;
|
||||||
lightComponent.Light.Rotation = -rotation;
|
lightComponent.Light.Rotation = -rotation;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -516,7 +516,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (lightComponent != null)
|
if (lightComponent != null)
|
||||||
{
|
{
|
||||||
lightComponent.Rotation = Rotation - MathHelper.ToRadians(item.Rotation);
|
lightComponent.Rotation = Rotation - item.RotationRad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,19 +262,19 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float rotationRad;
|
public float RotationRad { get; private set; }
|
||||||
|
|
||||||
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowRotating, MinValueFloat = 0.0f, MaxValueFloat = 360.0f, DecimalCount = 1, ValueStep = 1f), Serialize(0.0f, IsPropertySaveable.Yes)]
|
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowRotating, MinValueFloat = 0.0f, MaxValueFloat = 360.0f, DecimalCount = 1, ValueStep = 1f), Serialize(0.0f, IsPropertySaveable.Yes)]
|
||||||
public float Rotation
|
public float Rotation
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return MathHelper.ToDegrees(rotationRad);
|
return MathHelper.ToDegrees(RotationRad);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!Prefab.AllowRotatingInEditor) { return; }
|
if (!Prefab.AllowRotatingInEditor) { return; }
|
||||||
rotationRad = MathHelper.ToRadians(value);
|
RotationRad = MathHelper.ToRadians(value);
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
{
|
{
|
||||||
@@ -472,9 +472,9 @@ namespace Barotrauma
|
|||||||
get { return spriteColor; }
|
get { return spriteColor; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFullCondition => MathUtils.NearlyEqual(Condition, MaxCondition);
|
public bool IsFullCondition { get; private set; }
|
||||||
public float MaxCondition => Prefab.Health * healthMultiplier * maxRepairConditionMultiplier * (1.0f + GetQualityModifier(Items.Components.Quality.StatType.Condition));
|
public float MaxCondition { get; private set; }
|
||||||
public float ConditionPercentage => MathUtils.Percentage(Condition, MaxCondition);
|
public float ConditionPercentage { get; private set; }
|
||||||
|
|
||||||
private float offsetOnSelectedMultiplier = 1.0f;
|
private float offsetOnSelectedMultiplier = 1.0f;
|
||||||
|
|
||||||
@@ -495,7 +495,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
float prevConditionPercentage = ConditionPercentage;
|
float prevConditionPercentage = ConditionPercentage;
|
||||||
healthMultiplier = MathHelper.Clamp(value, 0.0f, float.PositiveInfinity);
|
healthMultiplier = MathHelper.Clamp(value, 0.0f, float.PositiveInfinity);
|
||||||
Condition = MaxCondition * prevConditionPercentage / 100.0f;
|
condition = MaxCondition * prevConditionPercentage / 100.0f;
|
||||||
|
RecalculateConditionValues();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +506,11 @@ namespace Barotrauma
|
|||||||
public float MaxRepairConditionMultiplier
|
public float MaxRepairConditionMultiplier
|
||||||
{
|
{
|
||||||
get => maxRepairConditionMultiplier;
|
get => maxRepairConditionMultiplier;
|
||||||
set { maxRepairConditionMultiplier = MathHelper.Clamp(value, 0.0f, float.PositiveInfinity); }
|
set
|
||||||
|
{
|
||||||
|
maxRepairConditionMultiplier = MathHelper.Clamp(value, 0.0f, float.PositiveInfinity);
|
||||||
|
RecalculateConditionValues();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//the default value should be Prefab.Health, but because we can't use it in the attribute,
|
//the default value should be Prefab.Health, but because we can't use it in the attribute,
|
||||||
@@ -806,7 +811,9 @@ namespace Barotrauma
|
|||||||
defaultRect = newRect;
|
defaultRect = newRect;
|
||||||
rect = newRect;
|
rect = newRect;
|
||||||
|
|
||||||
condition = MaxCondition;
|
condition = MaxCondition = Prefab.Health;
|
||||||
|
ConditionPercentage = 100.0f;
|
||||||
|
|
||||||
lastSentCondition = condition;
|
lastSentCondition = condition;
|
||||||
|
|
||||||
AllowDeconstruct = itemPrefab.AllowDeconstruct;
|
AllowDeconstruct = itemPrefab.AllowDeconstruct;
|
||||||
@@ -1002,6 +1009,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ApplyStatusEffects(ActionType.OnSpawn, 1.0f);
|
ApplyStatusEffects(ActionType.OnSpawn, 1.0f);
|
||||||
Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f));
|
Components.ForEach(c => c.ApplyStatusEffects(ActionType.OnSpawn, 1.0f));
|
||||||
|
RecalculateConditionValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void InitProjSpecific();
|
partial void InitProjSpecific();
|
||||||
@@ -1184,7 +1192,6 @@ namespace Barotrauma
|
|||||||
public void RemoveContained(Item contained)
|
public void RemoveContained(Item contained)
|
||||||
{
|
{
|
||||||
ownInventory?.RemoveItem(contained);
|
ownInventory?.RemoveItem(contained);
|
||||||
|
|
||||||
contained.Container = null;
|
contained.Container = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,6 +1618,10 @@ namespace Barotrauma
|
|||||||
bool wasInFullCondition = IsFullCondition;
|
bool wasInFullCondition = IsFullCondition;
|
||||||
|
|
||||||
condition = MathHelper.Clamp(value, 0.0f, MaxCondition);
|
condition = MathHelper.Clamp(value, 0.0f, MaxCondition);
|
||||||
|
if (MathUtils.NearlyEqual(prev, condition, epsilon: 0.000001f)) { return; }
|
||||||
|
|
||||||
|
RecalculateConditionValues();
|
||||||
|
|
||||||
if (condition == 0.0f && prev > 0.0f)
|
if (condition == 0.0f && prev > 0.0f)
|
||||||
{
|
{
|
||||||
//Flag connections to be updated as device is broken
|
//Flag connections to be updated as device is broken
|
||||||
@@ -1672,6 +1683,17 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Recalculates the item's maximum condition, condition percentage and whether it's in full condition.
|
||||||
|
/// You generally never need to call this manually - done automatically when any of the factors that affect the values change.
|
||||||
|
/// </summary>
|
||||||
|
public void RecalculateConditionValues()
|
||||||
|
{
|
||||||
|
MaxCondition = Prefab.Health * healthMultiplier * maxRepairConditionMultiplier * (1.0f + GetQualityModifier(Items.Components.Quality.StatType.Condition));
|
||||||
|
IsFullCondition = MathUtils.NearlyEqual(Condition, MaxCondition);
|
||||||
|
ConditionPercentage = MathUtils.Percentage(Condition, MaxCondition);
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsInWater()
|
private bool IsInWater()
|
||||||
{
|
{
|
||||||
if (CurrentHull == null) { return true; }
|
if (CurrentHull == null) { return true; }
|
||||||
@@ -1999,7 +2021,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Prefab.AllowRotatingInEditor)
|
if (Prefab.AllowRotatingInEditor)
|
||||||
{
|
{
|
||||||
rotationRad = MathUtils.WrapAngleTwoPi(-rotationRad);
|
RotationRad = MathUtils.WrapAngleTwoPi(-RotationRad);
|
||||||
}
|
}
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (Prefab.CanSpriteFlipX)
|
if (Prefab.CanSpriteFlipX)
|
||||||
@@ -3153,12 +3175,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Vector2 oldRelativeOrigin = (oldPrefab.SwappableItem.SwapOrigin - oldPrefab.Size / 2) * element.GetAttributeFloat(item.scale, "scale", "Scale");
|
Vector2 oldRelativeOrigin = (oldPrefab.SwappableItem.SwapOrigin - oldPrefab.Size / 2) * element.GetAttributeFloat(item.scale, "scale", "Scale");
|
||||||
oldRelativeOrigin.Y = -oldRelativeOrigin.Y;
|
oldRelativeOrigin.Y = -oldRelativeOrigin.Y;
|
||||||
oldRelativeOrigin = MathUtils.RotatePoint(oldRelativeOrigin, -item.rotationRad);
|
oldRelativeOrigin = MathUtils.RotatePoint(oldRelativeOrigin, -item.RotationRad);
|
||||||
Vector2 oldOrigin = centerPos + oldRelativeOrigin;
|
Vector2 oldOrigin = centerPos + oldRelativeOrigin;
|
||||||
|
|
||||||
Vector2 relativeOrigin = (prefab.SwappableItem.SwapOrigin - prefab.Size / 2) * item.Scale;
|
Vector2 relativeOrigin = (prefab.SwappableItem.SwapOrigin - prefab.Size / 2) * item.Scale;
|
||||||
relativeOrigin.Y = -relativeOrigin.Y;
|
relativeOrigin.Y = -relativeOrigin.Y;
|
||||||
relativeOrigin = MathUtils.RotatePoint(relativeOrigin, -item.rotationRad);
|
relativeOrigin = MathUtils.RotatePoint(relativeOrigin, -item.RotationRad);
|
||||||
Vector2 origin = new Vector2(rect.X + rect.Width / 2, rect.Y - rect.Height / 2) + relativeOrigin;
|
Vector2 origin = new Vector2(rect.X + rect.Width / 2, rect.Y - rect.Height / 2) + relativeOrigin;
|
||||||
|
|
||||||
item.rect.Location -= (origin - oldOrigin).ToPoint();
|
item.rect.Location -= (origin - oldOrigin).ToPoint();
|
||||||
@@ -3194,6 +3216,7 @@ namespace Barotrauma
|
|||||||
item.condition = MathHelper.Clamp(condition, 0, item.MaxCondition);
|
item.condition = MathHelper.Clamp(condition, 0, item.MaxCondition);
|
||||||
item.lastSentCondition = item.condition;
|
item.lastSentCondition = item.condition;
|
||||||
|
|
||||||
|
item.RecalculateConditionValues();
|
||||||
item.SetActiveSprite();
|
item.SetActiveSprite();
|
||||||
|
|
||||||
if (submarine?.Info.GameVersion != null)
|
if (submarine?.Info.GameVersion != null)
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ExcludeBroken { get; private set; }
|
public bool ExcludeBroken { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should full condition (100%) items be excluded
|
||||||
|
/// </summary>
|
||||||
|
public bool ExcludeFullCondition { get; private set; }
|
||||||
|
|
||||||
public bool AllowVariants { get; private set; } = true;
|
public bool AllowVariants { get; private set; } = true;
|
||||||
|
|
||||||
public RelationType Type
|
public RelationType Type
|
||||||
@@ -102,14 +107,14 @@ namespace Barotrauma
|
|||||||
return CheckContained(parentItem);
|
return CheckContained(parentItem);
|
||||||
case RelationType.Container:
|
case RelationType.Container:
|
||||||
if (parentItem == null || parentItem.Container == null) { return MatchOnEmpty; }
|
if (parentItem == null || parentItem.Container == null) { return MatchOnEmpty; }
|
||||||
return (!ExcludeBroken || parentItem.Container.Condition > 0.0f) && MatchesItem(parentItem.Container);
|
return (!ExcludeBroken || parentItem.Container.Condition > 0.0f) && (!ExcludeFullCondition || !parentItem.Container.IsFullCondition) && MatchesItem(parentItem.Container);
|
||||||
case RelationType.Equipped:
|
case RelationType.Equipped:
|
||||||
if (character == null) { return false; }
|
if (character == null) { return false; }
|
||||||
if (MatchOnEmpty && !character.HeldItems.Any()) { return true; }
|
if (MatchOnEmpty && !character.HeldItems.Any()) { return true; }
|
||||||
foreach (Item equippedItem in character.HeldItems)
|
foreach (Item equippedItem in character.HeldItems)
|
||||||
{
|
{
|
||||||
if (equippedItem == null) { continue; }
|
if (equippedItem == null) { continue; }
|
||||||
if ((!ExcludeBroken || equippedItem.Condition > 0.0f) && MatchesItem(equippedItem)) { return true; }
|
if ((!ExcludeBroken || equippedItem.Condition > 0.0f) && (!ExcludeFullCondition || !equippedItem.IsFullCondition) && MatchesItem(equippedItem)) { return true; }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RelationType.Picked:
|
case RelationType.Picked:
|
||||||
@@ -138,8 +143,7 @@ namespace Barotrauma
|
|||||||
foreach (Item contained in parentItem.ContainedItems)
|
foreach (Item contained in parentItem.ContainedItems)
|
||||||
{
|
{
|
||||||
if (TargetSlot > -1 && parentItem.OwnInventory.FindIndex(contained) != TargetSlot) { continue; }
|
if (TargetSlot > -1 && parentItem.OwnInventory.FindIndex(contained) != TargetSlot) { continue; }
|
||||||
if ((!ExcludeBroken || contained.Condition > 0.0f) && MatchesItem(contained)) { return true; }
|
if ((!ExcludeBroken || contained.Condition > 0.0f) && (!ExcludeFullCondition || !contained.IsFullCondition) && MatchesItem(contained)) { return true; }
|
||||||
|
|
||||||
if (CheckContained(contained)) { return true; }
|
if (CheckContained(contained)) { return true; }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -153,6 +157,7 @@ namespace Barotrauma
|
|||||||
new XAttribute("optional", IsOptional),
|
new XAttribute("optional", IsOptional),
|
||||||
new XAttribute("ignoreineditor", IgnoreInEditor),
|
new XAttribute("ignoreineditor", IgnoreInEditor),
|
||||||
new XAttribute("excludebroken", ExcludeBroken),
|
new XAttribute("excludebroken", ExcludeBroken),
|
||||||
|
new XAttribute("excludefullcondition", ExcludeFullCondition),
|
||||||
new XAttribute("targetslot", TargetSlot),
|
new XAttribute("targetslot", TargetSlot),
|
||||||
new XAttribute("allowvariants", AllowVariants));
|
new XAttribute("allowvariants", AllowVariants));
|
||||||
|
|
||||||
@@ -212,12 +217,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (identifiers.Length == 0 && excludedIdentifiers.Length == 0 && !returnEmpty) { return null; }
|
if (identifiers.Length == 0 && excludedIdentifiers.Length == 0 && !returnEmpty) { return null; }
|
||||||
|
|
||||||
RelatedItem ri = new RelatedItem(identifiers, excludedIdentifiers)
|
RelatedItem ri = new RelatedItem(identifiers, excludedIdentifiers)
|
||||||
{
|
{
|
||||||
ExcludeBroken = element.GetAttributeBool("excludebroken", true),
|
ExcludeBroken = element.GetAttributeBool("excludebroken", true),
|
||||||
|
ExcludeFullCondition = element.GetAttributeBool("excludefullcondition", false),
|
||||||
AllowVariants = element.GetAttributeBool("allowvariants", true)
|
AllowVariants = element.GetAttributeBool("allowvariants", true)
|
||||||
};
|
};
|
||||||
string typeStr = element.GetAttributeString("type", "");
|
string typeStr = element.GetAttributeString("type", "");
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace Barotrauma
|
||||||
|
{
|
||||||
|
internal class StartItem
|
||||||
|
{
|
||||||
|
public Identifier Item;
|
||||||
|
public int Amount;
|
||||||
|
|
||||||
|
public StartItem(XElement element)
|
||||||
|
{
|
||||||
|
Item = element.GetAttributeIdentifier("identifier", Identifier.Empty);
|
||||||
|
Amount = element.GetAttributeInt("amount", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Additive sets of items spawned only at the start of the game.
|
||||||
|
/// </summary>
|
||||||
|
internal class StartItemSet : PrefabWithUintIdentifier
|
||||||
|
{
|
||||||
|
public readonly static PrefabCollection<StartItemSet> Sets = new PrefabCollection<StartItemSet>();
|
||||||
|
|
||||||
|
public readonly ImmutableArray<StartItem> Items;
|
||||||
|
|
||||||
|
public StartItemSet(ContentXElement element, StartItemsFile file) : base(file, element.GetAttributeIdentifier("identifier", Identifier.Empty))
|
||||||
|
{
|
||||||
|
Items = element.Elements().Select(e => new StartItem(e!)).ToImmutableArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ namespace Barotrauma
|
|||||||
IEnumerable<string> aliases = null)
|
IEnumerable<string> aliases = null)
|
||||||
: base(identifier)
|
: base(identifier)
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Debug.Assert(constructor != null);
|
||||||
this.constructor = constructor;
|
this.constructor = constructor;
|
||||||
this.Name = TextManager.Get($"EntityName.{identifier}");
|
this.Name = TextManager.Get($"EntityName.{identifier}");
|
||||||
this.Description = TextManager.Get($"EntityDescription.{identifier}");
|
this.Description = TextManager.Get($"EntityDescription.{identifier}");
|
||||||
@@ -35,40 +36,52 @@ namespace Barotrauma
|
|||||||
this.Aliases = (aliases ?? Enumerable.Empty<string>()).Concat(identifier.Value.ToEnumerable()).ToImmutableHashSet();
|
this.Aliases = (aliases ?? Enumerable.Empty<string>()).Concat(identifier.Value.ToEnumerable()).ToImmutableHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CoreEntityPrefab HullPrefab { get; private set; }
|
||||||
|
public static CoreEntityPrefab GapPrefab { get; private set; }
|
||||||
|
public static CoreEntityPrefab WayPointPrefab { get; private set; }
|
||||||
|
public static CoreEntityPrefab SpawnPointPrefab { get; private set; }
|
||||||
|
|
||||||
public static void InitCorePrefabs()
|
public static void InitCorePrefabs()
|
||||||
{
|
{
|
||||||
CoreEntityPrefab ep = new CoreEntityPrefab(
|
HullPrefab = new CoreEntityPrefab(
|
||||||
"hull".ToIdentifier(),
|
"hull".ToIdentifier(),
|
||||||
typeof(Hull).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }),
|
typeof(Hull).GetConstructor(new Type[] { typeof(Rectangle) }),
|
||||||
resizeHorizontal: true,
|
resizeHorizontal: true,
|
||||||
resizeVertical: true,
|
resizeVertical: true,
|
||||||
linkable: true,
|
linkable: true,
|
||||||
allowedLinks: new Identifier[] { "hull".ToIdentifier() });
|
allowedLinks: new Identifier[] { "hull".ToIdentifier() });
|
||||||
Prefabs.Add(ep, false);
|
Prefabs.Add(HullPrefab, false);
|
||||||
|
|
||||||
ep = new CoreEntityPrefab(
|
GapPrefab = new CoreEntityPrefab(
|
||||||
"gap".ToIdentifier(),
|
"gap".ToIdentifier(),
|
||||||
typeof(Gap).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }),
|
typeof(Gap).GetConstructor(new Type[] { typeof(Rectangle) }),
|
||||||
resizeHorizontal: true,
|
resizeHorizontal: true,
|
||||||
resizeVertical: true);
|
resizeVertical: true);
|
||||||
Prefabs.Add(ep, false);
|
Prefabs.Add(GapPrefab, false);
|
||||||
|
|
||||||
ep = new CoreEntityPrefab(
|
WayPointPrefab = new CoreEntityPrefab(
|
||||||
"waypoint".ToIdentifier(),
|
"waypoint".ToIdentifier(),
|
||||||
typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }));
|
typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }));
|
||||||
Prefabs.Add(ep, false);
|
Prefabs.Add(WayPointPrefab, false);
|
||||||
|
|
||||||
ep = new CoreEntityPrefab(
|
SpawnPointPrefab = new CoreEntityPrefab(
|
||||||
"spawnpoint".ToIdentifier(),
|
"spawnpoint".ToIdentifier(),
|
||||||
typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }));
|
typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) }));
|
||||||
Prefabs.Add(ep, false);
|
Prefabs.Add(SpawnPointPrefab, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateInstance(Rectangle rect)
|
protected override void CreateInstance(Rectangle rect)
|
||||||
{
|
{
|
||||||
if (constructor == null) return;
|
if (this == WayPointPrefab || this == SpawnPointPrefab)
|
||||||
object[] lobject = new object[] { this, rect };
|
{
|
||||||
constructor.Invoke(lobject);
|
object[] lobject = new object[] { this, rect };
|
||||||
|
constructor.Invoke(lobject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
object[] lobject = new object[] { rect };
|
||||||
|
constructor.Invoke(lobject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gap(MapEntityPrefab prefab, Rectangle rectangle)
|
public Gap(Rectangle rectangle)
|
||||||
: this(rectangle, Submarine.MainSub)
|
: this(rectangle, Submarine.MainSub)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
@@ -136,7 +136,7 @@ namespace Barotrauma
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
public Gap(Rectangle rect, bool isHorizontal, Submarine submarine, ushort id = Entity.NullEntityID)
|
public Gap(Rectangle rect, bool isHorizontal, Submarine submarine, ushort id = Entity.NullEntityID)
|
||||||
: base(MapEntityPrefab.FindByIdentifier("gap".ToIdentifier()), submarine, id)
|
: base(CoreEntityPrefab.GapPrefab, submarine, id)
|
||||||
{
|
{
|
||||||
this.rect = rect;
|
this.rect = rect;
|
||||||
flowForce = Vector2.Zero;
|
flowForce = Vector2.Zero;
|
||||||
|
|||||||
@@ -410,8 +410,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public BallastFloraBehavior BallastFlora { get; set; }
|
public BallastFloraBehavior BallastFlora { get; set; }
|
||||||
|
|
||||||
public Hull(MapEntityPrefab prefab, Rectangle rectangle)
|
public Hull(Rectangle rectangle)
|
||||||
: this (prefab, rectangle, Submarine.MainSub)
|
: this (rectangle, Submarine.MainSub)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (SubEditorScreen.IsSubEditor())
|
if (SubEditorScreen.IsSubEditor())
|
||||||
@@ -421,8 +421,8 @@ namespace Barotrauma
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hull(MapEntityPrefab prefab, Rectangle rectangle, Submarine submarine, ushort id = Entity.NullEntityID)
|
public Hull(Rectangle rectangle, Submarine submarine, ushort id = Entity.NullEntityID)
|
||||||
: base (prefab, submarine, id)
|
: base (CoreEntityPrefab.HullPrefab, submarine, id)
|
||||||
{
|
{
|
||||||
rect = rectangle;
|
rect = rectangle;
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override MapEntity Clone()
|
public override MapEntity Clone()
|
||||||
{
|
{
|
||||||
var clone = new Hull(MapEntityPrefab.FindByIdentifier("hull".ToIdentifier()), rect, Submarine);
|
var clone = new Hull(rect, Submarine);
|
||||||
foreach (KeyValuePair<Identifier, SerializableProperty> property in SerializableProperties)
|
foreach (KeyValuePair<Identifier, SerializableProperty> property in SerializableProperties)
|
||||||
{
|
{
|
||||||
if (!property.Value.Attributes.OfType<Editable>().Any()) { continue; }
|
if (!property.Value.Attributes.OfType<Editable>().Any()) { continue; }
|
||||||
@@ -1543,7 +1543,7 @@ namespace Barotrauma
|
|||||||
int.Parse(element.GetAttribute("height").Value));
|
int.Parse(element.GetAttribute("height").Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
var hull = new Hull(MapEntityPrefab.Find(null, "hull"), rect, submarine, idRemap.GetOffsetId(element))
|
var hull = new Hull(rect, submarine, idRemap.GetOffsetId(element))
|
||||||
{
|
{
|
||||||
WaterVolume = element.GetAttributeFloat("pressure", 0.0f)
|
WaterVolume = element.GetAttributeFloat("pressure", 0.0f)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -14,6 +11,8 @@ namespace Barotrauma
|
|||||||
public readonly LocalizedString Description;
|
public readonly LocalizedString Description;
|
||||||
|
|
||||||
public readonly bool IsEndBiome;
|
public readonly bool IsEndBiome;
|
||||||
|
public readonly float MinDifficulty;
|
||||||
|
public readonly float MaxDifficulty;
|
||||||
|
|
||||||
public readonly ImmutableHashSet<int> AllowedZones;
|
public readonly ImmutableHashSet<int> AllowedZones;
|
||||||
|
|
||||||
@@ -30,8 +29,9 @@ namespace Barotrauma
|
|||||||
element.GetAttributeString("description", ""));
|
element.GetAttributeString("description", ""));
|
||||||
|
|
||||||
IsEndBiome = element.GetAttributeBool("endbiome", false);
|
IsEndBiome = element.GetAttributeBool("endbiome", false);
|
||||||
|
|
||||||
AllowedZones = element.GetAttributeIntArray("AllowedZones", new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }).ToImmutableHashSet();
|
AllowedZones = element.GetAttributeIntArray("AllowedZones", new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }).ToImmutableHashSet();
|
||||||
|
MinDifficulty = element.GetAttributeFloat("MinDifficulty", 0);
|
||||||
|
MaxDifficulty = element.GetAttributeFloat("MaxDifficulty", 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Identifier ParseIdentifier(ContentXElement element)
|
public static Identifier ParseIdentifier(ContentXElement element)
|
||||||
|
|||||||
@@ -96,24 +96,31 @@ namespace Barotrauma
|
|||||||
public readonly Sprite WallSprite;
|
public readonly Sprite WallSprite;
|
||||||
public readonly Sprite WallEdgeSprite;
|
public readonly Sprite WallEdgeSprite;
|
||||||
|
|
||||||
public static CaveGenerationParams GetRandom(LevelGenerationParams generationParams, bool abyss, Rand.RandSync rand)
|
public static CaveGenerationParams GetRandom(Level level, bool abyss, Rand.RandSync rand)
|
||||||
{
|
{
|
||||||
var caveParams = CaveParams.OrderBy(p => p.UintIdentifier).ToList();
|
var caveParams = CaveParams.OrderBy(p => p.UintIdentifier).ToList();
|
||||||
if (caveParams.All(p => p.GetCommonness(generationParams, abyss) <= 0.0f))
|
if (caveParams.All(p => p.GetCommonness(level.LevelData, abyss) <= 0.0f))
|
||||||
{
|
{
|
||||||
return caveParams.First();
|
return caveParams.First();
|
||||||
}
|
}
|
||||||
return ToolBox.SelectWeightedRandom(caveParams.ToList(), caveParams.Select(p => p.GetCommonness(generationParams, abyss)).ToList(), rand);
|
return ToolBox.SelectWeightedRandom(caveParams.ToList(), caveParams.Select(p => p.GetCommonness(level.LevelData, abyss)).ToList(), rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetCommonness(LevelGenerationParams generationParams, bool abyss)
|
public float GetCommonness(LevelData levelData, bool abyss)
|
||||||
{
|
{
|
||||||
if (generationParams != null &&
|
if (levelData.GenerationParams != null && levelData.GenerationParams.Identifier != Identifier.Empty &&
|
||||||
generationParams.Identifier != Identifier.Empty &&
|
OverrideCommonness.TryGetValue(abyss ? "abyss".ToIdentifier() : levelData.GenerationParams.Identifier, out float commonness))
|
||||||
OverrideCommonness.TryGetValue(abyss ? "abyss".ToIdentifier() : generationParams.Identifier, out float commonness))
|
|
||||||
{
|
{
|
||||||
return commonness;
|
return commonness;
|
||||||
}
|
}
|
||||||
|
if (levelData?.Biome != null)
|
||||||
|
{
|
||||||
|
if (OverrideCommonness.TryGetValue(levelData.Biome.Identifier, out float biomeCommonness))
|
||||||
|
{
|
||||||
|
return biomeCommonness;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Commonness;
|
return Commonness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -442,6 +442,11 @@ namespace Barotrauma
|
|||||||
Loaded?.Remove();
|
Loaded?.Remove();
|
||||||
Loaded = this;
|
Loaded = this;
|
||||||
Generating = true;
|
Generating = true;
|
||||||
|
#if CLIENT
|
||||||
|
Debug.Assert(GenerationParams.Identifier != "coldcavernstutorial" || GameMain.GameSession?.GameMode == null || GameMain.GameSession.GameMode is TutorialMode);
|
||||||
|
#endif
|
||||||
|
Debug.Assert(GenerationParams.AnyBiomeAllowed || GenerationParams.AllowedBiomeIdentifiers.Contains(LevelData.Biome.Identifier));
|
||||||
|
DebugConsole.NewMessage("Level identifier: " + GenerationParams.Identifier);
|
||||||
|
|
||||||
ClearEqualityCheckValues();
|
ClearEqualityCheckValues();
|
||||||
EntitiesBeforeGenerate = GetEntities().ToList();
|
EntitiesBeforeGenerate = GetEntities().ToList();
|
||||||
@@ -1711,7 +1716,8 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//if the bottom of the abyss area is below crush depth, try to move it up to keep (most) of the abyss content above crush depth
|
//if the bottom of the abyss area is below crush depth, try to move it up to keep (most) of the abyss content above crush depth
|
||||||
if (abyssEndY + CrushDepth < 0)
|
//but only if start of the abyss is above crush depth (no point in doing this if all of it is below crush depth)
|
||||||
|
if (abyssEndY + CrushDepth < 0 && abyssStartY > -CrushDepth)
|
||||||
{
|
{
|
||||||
abyssEndY += Math.Min(-(abyssEndY + (int)CrushDepth), abyssHeight / 2);
|
abyssEndY += Math.Min(-(abyssEndY + (int)CrushDepth), abyssHeight / 2);
|
||||||
}
|
}
|
||||||
@@ -1820,7 +1826,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var caveParams = CaveGenerationParams.GetRandom(GenerationParams, abyss: true, rand: Rand.RandSync.ServerAndClient);
|
var caveParams = CaveGenerationParams.GetRandom(this, abyss: true, rand: Rand.RandSync.ServerAndClient);
|
||||||
|
|
||||||
float caveScaleRelativeToIsland = 0.7f;
|
float caveScaleRelativeToIsland = 0.7f;
|
||||||
GenerateCave(
|
GenerateCave(
|
||||||
@@ -1889,7 +1895,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < GenerationParams.CaveCount; i++)
|
for (int i = 0; i < GenerationParams.CaveCount; i++)
|
||||||
{
|
{
|
||||||
var caveParams = CaveGenerationParams.GetRandom(GenerationParams, abyss: false, rand: Rand.RandSync.ServerAndClient);
|
var caveParams = CaveGenerationParams.GetRandom(this, abyss: false, rand: Rand.RandSync.ServerAndClient);
|
||||||
Point caveSize = new Point(
|
Point caveSize = new Point(
|
||||||
Rand.Range(caveParams.MinWidth, caveParams.MaxWidth, Rand.RandSync.ServerAndClient),
|
Rand.Range(caveParams.MinWidth, caveParams.MaxWidth, Rand.RandSync.ServerAndClient),
|
||||||
Rand.Range(caveParams.MinHeight, caveParams.MaxHeight, Rand.RandSync.ServerAndClient));
|
Rand.Range(caveParams.MinHeight, caveParams.MaxHeight, Rand.RandSync.ServerAndClient));
|
||||||
@@ -2479,6 +2485,7 @@ namespace Barotrauma
|
|||||||
foreach (ItemPrefab itemPrefab in ItemPrefab.Prefabs.OrderBy(p => p.UintIdentifier))
|
foreach (ItemPrefab itemPrefab in ItemPrefab.Prefabs.OrderBy(p => p.UintIdentifier))
|
||||||
{
|
{
|
||||||
if (itemPrefab.LevelCommonness.TryGetValue(levelName, out float commonness) ||
|
if (itemPrefab.LevelCommonness.TryGetValue(levelName, out float commonness) ||
|
||||||
|
itemPrefab.LevelCommonness.TryGetValue(LevelData.Biome.Identifier, out commonness) ||
|
||||||
itemPrefab.LevelCommonness.TryGetValue(Identifier.Empty, out commonness))
|
itemPrefab.LevelCommonness.TryGetValue(Identifier.Empty, out commonness))
|
||||||
{
|
{
|
||||||
if (commonness <= 0.0f) { continue; }
|
if (commonness <= 0.0f) { continue; }
|
||||||
@@ -3237,7 +3244,8 @@ namespace Barotrauma
|
|||||||
if (index < 0 || index >= bottomPositions.Count - 1) { return new Vector2(xPosition, BottomPos); }
|
if (index < 0 || index >= bottomPositions.Count - 1) { return new Vector2(xPosition, BottomPos); }
|
||||||
|
|
||||||
float t = (xPosition - bottomPositions[index].X) / (bottomPositions[index + 1].X - bottomPositions[index].X);
|
float t = (xPosition - bottomPositions[index].X) / (bottomPositions[index + 1].X - bottomPositions[index].X);
|
||||||
Debug.Assert(t <= 1.0f);
|
//t can go slightly outside the 0-1 due to rounding, safe to ignore
|
||||||
|
Debug.Assert(t <= 1.001f && t >= -0.001f);
|
||||||
t = MathHelper.Clamp(t, 0.0f, 1.0f);
|
t = MathHelper.Clamp(t, 0.0f, 1.0f);
|
||||||
|
|
||||||
float yPos = MathHelper.Lerp(bottomPositions[index].Y, bottomPositions[index + 1].Y, t);
|
float yPos = MathHelper.Lerp(bottomPositions[index].Y, bottomPositions[index + 1].Y, t);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public readonly string Seed;
|
public readonly string Seed;
|
||||||
|
|
||||||
public readonly float Difficulty;
|
public float Difficulty;
|
||||||
|
|
||||||
public readonly Biome Biome;
|
public readonly Biome Biome;
|
||||||
|
|
||||||
@@ -90,10 +90,10 @@ namespace Barotrauma
|
|||||||
(int)MathUtils.Round(generationParams.Height, Level.GridCellSize));
|
(int)MathUtils.Round(generationParams.Height, Level.GridCellSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LevelData(XElement element)
|
public LevelData(XElement element, float? forceDifficulty = null)
|
||||||
{
|
{
|
||||||
Seed = element.GetAttributeString("seed", "");
|
Seed = element.GetAttributeString("seed", "");
|
||||||
Difficulty = element.GetAttributeFloat("difficulty", 0.0f);
|
Difficulty = forceDifficulty ?? element.GetAttributeFloat("difficulty", 0.0f);
|
||||||
Size = element.GetAttributePoint("size", new Point(1000));
|
Size = element.GetAttributePoint("size", new Point(1000));
|
||||||
Enum.TryParse(element.GetAttributeString("type", "LocationConnection"), out Type);
|
Enum.TryParse(element.GetAttributeString("type", "LocationConnection"), out Type);
|
||||||
|
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ namespace Barotrauma
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serialize(50, IsPropertySaveable.Yes, description: "Maximum number of resource clusters in the abyss (the actual number is picked between min and max according to the level difficulty)"), Editable(MinValueInt = 0, MaxValueInt = 1000)]
|
[Serialize(40, IsPropertySaveable.Yes, description: "Maximum number of resource clusters in the abyss (the actual number is picked between min and max according to the level difficulty)"), Editable(MinValueInt = 0, MaxValueInt = 1000)]
|
||||||
public int AbyssResourceClustersMax
|
public int AbyssResourceClustersMax
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
+4
-4
@@ -170,7 +170,7 @@ namespace Barotrauma
|
|||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
//get a random prefab and find a place to spawn it
|
//get a random prefab and find a place to spawn it
|
||||||
LevelObjectPrefab prefab = GetRandomPrefab(level.GenerationParams, availablePrefabs);
|
LevelObjectPrefab prefab = GetRandomPrefab(level, availablePrefabs);
|
||||||
if (prefab == null) { continue; }
|
if (prefab == null) { continue; }
|
||||||
if (!suitableSpawnPositions.ContainsKey(prefab))
|
if (!suitableSpawnPositions.ContainsKey(prefab))
|
||||||
{
|
{
|
||||||
@@ -595,12 +595,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LevelObjectPrefab GetRandomPrefab(LevelGenerationParams generationParams, IList<LevelObjectPrefab> availablePrefabs)
|
private LevelObjectPrefab GetRandomPrefab(Level level, IList<LevelObjectPrefab> availablePrefabs)
|
||||||
{
|
{
|
||||||
if (availablePrefabs.Sum(p => p.GetCommonness(generationParams)) <= 0.0f) { return null; }
|
if (availablePrefabs.Sum(p => p.GetCommonness(level.LevelData)) <= 0.0f) { return null; }
|
||||||
return ToolBox.SelectWeightedRandom(
|
return ToolBox.SelectWeightedRandom(
|
||||||
availablePrefabs,
|
availablePrefabs,
|
||||||
availablePrefabs.Select(p => p.GetCommonness(generationParams)).ToList(), Rand.RandSync.ServerAndClient);
|
availablePrefabs.Select(p => p.GetCommonness(level.LevelData)).ToList(), Rand.RandSync.ServerAndClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LevelObjectPrefab GetRandomPrefab(CaveGenerationParams caveParams, IList<LevelObjectPrefab> availablePrefabs, bool requireCaveSpecificOverride)
|
private LevelObjectPrefab GetRandomPrefab(CaveGenerationParams caveParams, IList<LevelObjectPrefab> availablePrefabs, bool requireCaveSpecificOverride)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user