diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj
index 3c62a2cf8..82c7835d0 100644
--- a/Barotrauma/BarotraumaClient/MacClient.csproj
+++ b/Barotrauma/BarotraumaClient/MacClient.csproj
@@ -181,9 +181,6 @@
PreserveNewest
-
- PreserveNewest
-
PreserveNewest
diff --git a/Barotrauma/BarotraumaClient/SharpFont.dll.config b/Barotrauma/BarotraumaClient/SharpFont.dll.config
index 33ae1b00a..8129b80cb 100755
--- a/Barotrauma/BarotraumaClient/SharpFont.dll.config
+++ b/Barotrauma/BarotraumaClient/SharpFont.dll.config
@@ -1,6 +1,6 @@
-
+
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
index b281ff3bb..633916804 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
@@ -442,8 +442,7 @@ namespace Barotrauma
if (draggingItemToWorld)
{
if (item.OwnInventory == null ||
- !item.OwnInventory.CanBePut(CharacterInventory.draggingItem) ||
- !CanAccessInventory(item.OwnInventory))
+ !item.OwnInventory.CanBePut(CharacterInventory.draggingItem))
{
continue;
}
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
index 91ea2bcf8..aaf8d1e3b 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
@@ -139,7 +139,7 @@ namespace Barotrauma
foreach (Item item in Item.ItemList)
{
if (!item.Repairables.Any(r => item.Condition < r.ShowRepairUIThreshold)) { continue; }
- if (Submarine.VisibleEntities != null && !Submarine.VisibleEntities.Contains(item)) { continue; }
+ if (!Submarine.VisibleEntities.Contains(item)) { continue; }
Vector2 diff = item.WorldPosition - character.WorldPosition;
if (Submarine.CheckVisibility(character.SimPosition, character.SimPosition + ConvertUnits.ToSimUnits(diff)) == null)
@@ -216,7 +216,7 @@ namespace Barotrauma
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
textPos.Y += offset.Y;
}
- if (character.FocusedCharacter.CharacterHealth.UseHealthWindow && character.CanInteractWith(character.FocusedCharacter, 160f, false))
+ if (character.FocusedCharacter.CharacterHealth.UseHealthWindow)
{
GUI.DrawString(spriteBatch, textPos, GetCachedHudText("HealHint", GameMain.Config.KeyBind(InputType.Health).ToString()),
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
index 846e82d39..a3d57f795 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
@@ -449,11 +449,12 @@ namespace Barotrauma
{
float depth = ActiveSprite.Depth - 0.0000015f;
- DamagedSprite.Draw(spriteBatch,
- new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
- color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin,
- -body.DrawRotation,
- 1.0f, spriteEffect, depth);
+ // TODO: enable when the damage overlay textures have been remade.
+ //DamagedSprite.Draw(spriteBatch,
+ // new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
+ // color * Math.Min(damageOverlayStrength, 1.0f), ActiveSprite.Origin,
+ // -body.DrawRotation,
+ // 1.0f, spriteEffect, depth);
}
if (GameMain.DebugDraw)
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs
index c2f8351bc..6cdba8652 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs
@@ -148,14 +148,7 @@ namespace Barotrauma
//find the parent GUIListBox highest in the hierarchy
for (int i = parentHierarchy.Count - 1; i >= 0; i--)
{
- if (parentHierarchy[i].GUIComponent is GUIListBox)
- {
- if (parentHierarchy[i].Parent != null && parentHierarchy[i].Parent.GUIComponent != null)
- {
- return parentHierarchy[i].Parent;
- }
- return parentHierarchy[i];
- }
+ if (parentHierarchy[i].GUIComponent is GUIListBox) return parentHierarchy[i];
}
//or just go with the direct parent if there are no listboxes in the hierarchy
parentHierarchy.Clear();
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
index 26fe1031b..780264181 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
@@ -40,9 +40,6 @@ namespace Barotrauma
{
ToolBox.IsProperFilenameCase(file);
doc = XDocument.Load(file, LoadOptions.SetBaseUri);
- if (doc == null) { throw new Exception("doc is null"); }
- if (doc.Root == null) { throw new Exception("doc.Root is null"); }
- if (doc.Root.Elements() == null) { throw new Exception("doc.Root.Elements() is null"); }
}
catch (Exception e)
{
@@ -116,34 +113,26 @@ namespace Barotrauma
private void RescaleFonts()
{
- if (configElement == null) { return; }
- if (configElement.Elements() == null) { return; }
foreach (XElement subElement in configElement.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
{
case "font":
- if (Font == null) { continue; }
Font.Size = GetFontSize(subElement);
break;
case "smallfont":
- if (SmallFont == null) { continue; }
SmallFont.Size = GetFontSize(subElement);
break;
case "largefont":
- if (LargeFont == null) { continue; }
LargeFont.Size = GetFontSize(subElement);
break;
case "objectivetitle":
- if (ObjectiveTitleFont == null) { continue; }
ObjectiveTitleFont.Size = GetFontSize(subElement);
break;
case "objectivename":
- if (ObjectiveNameFont == null) { continue; }
ObjectiveNameFont.Size = GetFontSize(subElement);
break;
case "videotitle":
- if (VideoTitleFont == null) { continue; }
VideoTitleFont.Size = GetFontSize(subElement);
break;
}
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
index a95140454..69b2aa985 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
@@ -20,8 +20,8 @@ namespace Barotrauma
///
const float CharacterWaitOnSwitch = 10.0f;
- private readonly List characterInfos = new List();
- private readonly List characters = new List();
+ private List characterInfos = new List();
+ private List characters = new List();
private Point screenResolution;
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs
index ad998bd39..0bb370465 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/SinglePlayerCampaign.cs
@@ -256,18 +256,6 @@ namespace Barotrauma
{
if (c.Info == null || c.Inventory == null) { continue; }
var inventoryElement = new XElement("inventory");
-
- // Recharge headset batteries
- var headset = c.Inventory.FindItemByIdentifier("headset");
- if (headset != null)
- {
- var battery = headset.OwnInventory.FindItemByTag("loadable");
- if (battery != null)
- {
- battery.Condition = battery.MaxCondition;
- }
- }
-
c.SaveInventory(c.Inventory, inventoryElement);
c.Info.InventoryData = inventoryElement;
c.Inventory?.DeleteAllItems();
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
index 2ebb44dc4..8c3597b8d 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Inventory.cs
@@ -620,7 +620,6 @@ namespace Barotrauma
{
if (DraggingItemToWorld &&
Character.Controlled.FocusedItem?.OwnInventory != null &&
- Character.Controlled.FocusedItem.OwnInventory.CanBePut(draggingItem) &&
Character.Controlled.FocusedItem.OwnInventory.TryPutItem(draggingItem, Character.Controlled))
{
GUI.PlayUISound(GUISoundType.PickItem);
diff --git a/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs b/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs
index 0fcff3a6d..00eb633c9 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/ItemAssemblyPrefab.cs
@@ -82,7 +82,7 @@ namespace Barotrauma
center.Y -= center.Y % Submarine.GridSize.Y;
MapEntity.SelectedList.Clear();
- assemblyEntities.ForEach(e => MapEntity.AddSelection(e));
+ MapEntity.SelectedList.AddRange(assemblyEntities);
foreach (MapEntity mapEntity in assemblyEntities)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
index fe1140184..28a1f7b89 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/Levels/LevelRenderer.cs
@@ -142,27 +142,24 @@ namespace Barotrauma
backgroundPos.Y = -backgroundPos.Y;
backgroundPos *= 0.05f;
- if (level.GenerationParams.BackgroundTopSprite != null)
+
+ if (backgroundPos.Y < 1024)
{
- int backgroundSize = (int)level.GenerationParams.BackgroundTopSprite.size.Y;
- if (backgroundPos.Y < backgroundSize)
+ if (backgroundPos.Y < 0 && level.GenerationParams.BackgroundTopSprite != null)
{
- if (backgroundPos.Y < 0)
- {
- var backgroundTop = level.GenerationParams.BackgroundTopSprite;
- backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, backgroundSize, (int)Math.Min(-backgroundPos.Y, backgroundSize));
- backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
- color: level.BackgroundTextureColor);
- }
- if (-backgroundPos.Y < GameMain.GraphicsHeight && level.GenerationParams.BackgroundSprite != null)
- {
- var background = level.GenerationParams.BackgroundSprite;
- background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), backgroundSize, backgroundSize);
- background.DrawTiled(spriteBatch,
- (backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero,
- new Vector2(GameMain.GraphicsWidth, (int)Math.Min(Math.Ceiling(backgroundSize - backgroundPos.Y), backgroundSize)),
- color: level.BackgroundTextureColor);
- }
+ var backgroundTop = level.GenerationParams.BackgroundTopSprite;
+ backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024));
+ backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
+ color: level.BackgroundTextureColor);
+ }
+ if (backgroundPos.Y > -1024 && level.GenerationParams.BackgroundSprite != null)
+ {
+ var background = level.GenerationParams.BackgroundSprite;
+ background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), 1024, 1024);
+ background.DrawTiled(spriteBatch,
+ (backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero,
+ new Vector2(GameMain.GraphicsWidth, (int)Math.Ceiling(1024 - backgroundPos.Y)),
+ color: level.BackgroundTextureColor);
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs
index 215e2db4d..b30101b37 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs
@@ -478,60 +478,6 @@ namespace Barotrauma
return true;
};
}
-
- public static void AddSelection(MapEntity entity)
- {
- if (selectedList.Contains(entity)) { return; }
- selectedList.Add(entity);
- HandleDoorGapLinks(entity,
- onGapFound: (door, gap) =>
- {
- door.RefreshLinkedGap();
- if (!selectedList.Contains(gap))
- {
- selectedList.Add(gap);
- }
- },
- onDoorFound: (door, gap) =>
- {
- if (!selectedList.Contains(door.Item))
- {
- selectedList.Add(door.Item);
- }
- });
- }
-
- private static void HandleDoorGapLinks(MapEntity entity, Action onGapFound, Action onDoorFound)
- {
- if (entity is Item i)
- {
- var door = i.GetComponent();
- if (door != null)
- {
- var gap = door.LinkedGap;
- if (gap != null)
- {
- onGapFound(door, gap);
- }
- }
- }
- else if (entity is Gap gap)
- {
- var door = gap.ConnectedDoor;
- if (door != null)
- {
- onDoorFound(door, gap);
- }
- }
- }
-
- public static void RemoveSelection(MapEntity entity)
- {
- selectedList.Remove(entity);
- HandleDoorGapLinks(entity,
- onGapFound: (door, gap) => selectedList.Remove(gap),
- onDoorFound: (door, gap) => selectedList.Remove(door.Item));
- }
static partial void UpdateAllProjSpecific(float deltaTime)
{
@@ -604,7 +550,24 @@ namespace Barotrauma
if (editingHUD != null)
{
- if (FilteredSelectedList.Count == 0 || editingHUD.UserData != FilteredSelectedList[0])
+ if (selectedList.Count == 0 || editingHUD.UserData != selectedList[0])
+ {
+ foreach (GUIComponent component in editingHUD.Children)
+ {
+ var textBox = component as GUITextBox;
+ if (textBox == null) continue;
+ textBox.Deselect();
+ }
+ editingHUD = null;
+ }
+ }
+
+ if (selectedList.Count == 0) return;
+
+ if (editingHUD != null)
+ {
+ selectedList[0].UpdateEditing(cam);
+ if (selectedList[0].ResizeHorizontal || selectedList[0].ResizeVertical)
{
foreach (GUIComponent component in editingHUD.Children)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs b/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs
index 27c059ccf..d1f937d7f 100644
--- a/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs
+++ b/Barotrauma/BarotraumaClient/Source/Map/WayPoint.cs
@@ -51,10 +51,6 @@ namespace Barotrauma
{
iconSize = (int)(iconSize * 1.5f);
}
- if (Stairs != null)
- {
- iconSize = (int)(iconSize * 1.5f);
- }
spriteBatch.Draw(iconTexture,
new Rectangle((int)(drawPos.X - iconSize / 2), (int)(drawPos.Y - iconSize / 2), iconSize, iconSize),
@@ -97,7 +93,7 @@ namespace Barotrauma
editingHUD = CreateEditingHUD();
}
- if (IsSelected && PlayerInput.LeftButtonClicked())
+ if (PlayerInput.LeftButtonClicked())
{
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
@@ -153,23 +149,6 @@ namespace Barotrauma
}
}
- private void UpdateLinkedEntity(Vector2 worldPos, IEnumerable list, Action match, Action noMatch, int inflate = 0) where T : MapEntity
- {
- foreach (var entity in list)
- {
- var rect = entity.WorldRect;
- rect.Inflate(inflate, inflate);
- if (Submarine.RectContains(rect, worldPos))
- {
- match(entity);
- }
- else
- {
- noMatch(entity);
- }
- }
- }
-
private bool ChangeSpawnType(GUIButton button, object obj)
{
GUITextBlock spawnTypeText = button.Parent.GetChildByUserData("spawntypetext") as GUITextBlock;
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
index bcf031886..4b910e119 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/GameClient.cs
@@ -2047,15 +2047,13 @@ namespace Barotrauma.Networking
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
}
- public void SetupNewCampaign(Submarine sub, string saveName, string mapSeed)
+ public void SetupNewCampaign(Submarine sub, string savePath, string mapSeed)
{
- saveName = Path.GetFileNameWithoutExtension(saveName);
-
NetOutgoingMessage msg = client.CreateMessage();
msg.Write((byte)ClientPacketHeader.CAMPAIGN_SETUP_INFO);
msg.Write(true); msg.WritePadBits();
- msg.Write(saveName);
+ msg.Write(savePath);
msg.Write(mapSeed);
msg.Write(sub.Name);
msg.Write(sub.MD5Hash.Hash);
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
index 224623330..4b27e024c 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/SteamManager.cs
@@ -590,19 +590,12 @@ namespace Barotrauma.Steam
}
else
{
- DebugConsole.NewMessage("Publishing workshop item " + item.Title + " failed. " + item.Error, Microsoft.Xna.Framework.Color.Red);
+ DebugConsole.ThrowError("Publishing workshop item " + item.Title + " failed. " + item.Error);
}
SaveUtil.ClearFolder(WorkshopItemStagingFolder);
+ Directory.Delete(WorkshopItemStagingFolder);
File.Delete(PreviewImageName);
- try
- {
- Directory.Delete(WorkshopItemStagingFolder);
- }
- catch (Exception e)
- {
- DebugConsole.ThrowError("Failed to delete Workshop item staging folder.", e);
- }
yield return CoroutineStatus.Success;
}
@@ -934,50 +927,28 @@ namespace Barotrauma.Steam
{
if (instance == null || !instance.isInitialized) { return false; }
- bool? itemsUpdated = null;
- bool timedOut = false;
- var query = instance.client.Workshop.CreateQuery();
- query.FileId = new List(instance.client.Workshop.GetSubscribedItemIds());
- query.UploaderAppId = AppID;
- query.Run();
- query.OnResult = (Workshop.Query q) =>
+ bool itemsUpdated = false;
+ foreach (ulong subscribedItemId in instance.client.Workshop.GetSubscribedItemIds())
{
- if (timedOut) { return; }
- itemsUpdated = false;
- foreach (var item in q.Items)
+ //TODO: fix this, GetItem doesn't query item.Modified
+ var item = instance.client.Workshop.GetItem(subscribedItemId);
+ if (item.Installed && CheckWorkshopItemEnabled(item) && !CheckWorkshopItemUpToDate(item))
{
- if (item.Installed && CheckWorkshopItemEnabled(item) && !CheckWorkshopItemUpToDate(item))
+ if (!UpdateWorkshopItem(item, out string errorMsg))
{
- if (!UpdateWorkshopItem(item, out string errorMsg))
- {
- DebugConsole.ThrowError(errorMsg);
- new GUIMessageBox(
- TextManager.Get("Error"),
- TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
- }
- else
- {
- new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
- itemsUpdated = true;
- }
+ DebugConsole.ThrowError(errorMsg);
+ new GUIMessageBox(
+ TextManager.Get("Error"),
+ TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
+ }
+ else
+ {
+ new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
+ itemsUpdated = true;
}
}
- };
-
- DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 10);
- while (!itemsUpdated.HasValue)
- {
- if (DateTime.Now > timeOut)
- {
- itemsUpdated = false;
- timedOut = true;
- break;
- }
- instance.client.Update();
- System.Threading.Thread.Sleep(10);
}
-
- return itemsUpdated.Value;
+ return itemsUpdated;
}
public static bool UpdateWorkshopItem(Workshop.Item item, out string errorMsg)
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs b/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs
index 58427e1e1..120fdf0bd 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/WhiteList.cs
@@ -61,7 +61,6 @@ namespace Barotrauma.Networking
localEnabled = box.Selected;
-
return true;
}
};
@@ -146,12 +145,16 @@ namespace Barotrauma.Networking
{
if (obj is WhiteListedPlayer)
{
- if (!(obj is WhiteListedPlayer wlp)) return false;
+ WhiteListedPlayer wlp = obj as WhiteListedPlayer;
+ if (wlp == null) return false;
+
if (!localRemoved.Contains(wlp.UniqueIdentifier)) localRemoved.Add(wlp.UniqueIdentifier);
}
else if (obj is LocalAdded)
{
- if (!(obj is LocalAdded lad)) return false;
+ LocalAdded lad = obj as LocalAdded;
+ if (lad == null) return false;
+
if (localAdded.Contains(lad)) localAdded.Remove(lad);
}
@@ -207,6 +210,7 @@ namespace Barotrauma.Networking
{
ip = "IP concealed by host";
}
+ DebugConsole.NewMessage("nerd: " + name, Color.Lime);
whitelistedPlayers.Add(new WhiteListedPlayer(name, uniqueIdentifier, ip));
}
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
index ee84ed139..4f96e0cdc 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/CampaignUI.cs
@@ -441,43 +441,36 @@ namespace Barotrauma
characterPreviewFrame = null;
}
- if (characterList != null)
+ if (Campaign is SinglePlayerCampaign)
{
- if (Campaign is SinglePlayerCampaign)
+ var hireableCharacters = location.GetHireableCharacters();
+ foreach (GUIComponent child in characterList.Content.Children.ToList())
{
- var hireableCharacters = location.GetHireableCharacters();
- foreach (GUIComponent child in characterList.Content.Children.ToList())
+ if (child.UserData is CharacterInfo character)
{
- if (child.UserData is CharacterInfo character)
- {
- if (GameMain.GameSession.CrewManager != null)
- {
- if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; }
- }
- }
- else if (child.UserData as string == "mycrew" || child.UserData as string == "hire")
- {
- continue;
- }
- characterList.RemoveChild(child);
+ if (GameMain.GameSession.CrewManager.GetCharacterInfos().Contains(character)) { continue; }
}
- if (!hireableCharacters.Any())
+ else if (child.UserData as string == "mycrew" || child.UserData as string == "hire")
{
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center)
- {
- CanBeFocused = false
- };
+ continue;
}
- else
+ characterList.RemoveChild(child);
+ }
+ if (!hireableCharacters.Any())
+ {
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), characterList.Content.RectTransform), TextManager.Get("HireUnavailable"), textAlignment: Alignment.Center)
{
- foreach (CharacterInfo c in hireableCharacters)
- {
- var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c);
- new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight);
- }
+ CanBeFocused = false
+ };
+ }
+ else
+ {
+ foreach (CharacterInfo c in hireableCharacters)
+ {
+ var frame = c.CreateCharacterFrame(characterList.Content, c.Name + " (" + c.Job.Name + ")", c);
+ new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.TopRight), c.Salary.ToString(), textAlignment: Alignment.CenterRight);
}
}
- characterList.UpdateScrollBarSize();
}
characterList.UpdateScrollBarSize();
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
index a55342ca6..d8ab767b4 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
@@ -14,7 +14,7 @@ namespace Barotrauma
{
class MainMenuScreen : Screen
{
- public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11, Empty = 12 }
+ public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11 }
private GUIComponent buttonsParent;
@@ -37,11 +37,7 @@ namespace Barotrauma
private GUIComponent titleText;
private CreditsPlayer creditsPlayer;
-
- #if OSX
- private bool firstLoadOnMac = true;
- #endif
-
+
#region Creation
public MainMenuScreen(GameMain game)
{
@@ -364,9 +360,9 @@ namespace Barotrauma
OnClicked = SelectTab
};
}
- #endregion
+#endregion
- #region Selection
+#region Selection
public override void Select()
{
base.Select();
@@ -382,25 +378,6 @@ namespace Barotrauma
ResetButtonStates(null);
GameAnalyticsManager.SetCustomDimension01("");
-
- #if OSX
- // Hack for adjusting the viewport properly after splash screens on older Macs
- if (firstLoadOnMac)
- {
- firstLoadOnMac = false;
-
- menuTabs[(int)Tab.Empty] = new GUIFrame(new RectTransform(new Vector2(1f, 1f), GUI.Canvas), "", Color.Transparent)
- {
- CanBeFocused = false
- };
- var emptyList = new GUIListBox(new RectTransform(new Vector2(0.0f, 0.0f), menuTabs[(int)Tab.Empty].RectTransform))
- {
- CanBeFocused = false
- };
-
- SelectTab(null, Tab.Empty);
- }
- #endif
}
public override void Deselect()
@@ -948,11 +925,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUI.LargeFont) { ForceUpperCase = true };
var label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerName"), textAlignment: textAlignment);
- serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
- {
- MaxTextLength = NetConfig.ServerNameMaxLength,
- OverflowClip = true
- };
+ serverNameBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment);
label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("ServerPort"), textAlignment: textAlignment);
portBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
index d392f2bfa..d050187db 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs
@@ -335,12 +335,8 @@ namespace Barotrauma
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), rightInfoColumn.RectTransform), style: null);
//server info ------------------------------------------------------------------
-
- ServerName = new GUITextBox(new RectTransform(new Vector2(infoColumnContainer.RectTransform.RelativeSize.X, 0.05f), infoFrameContent.RectTransform))
- {
- MaxTextLength = NetConfig.ServerNameMaxLength,
- OverflowClip = true
- };
+
+ ServerName = new GUITextBox(new RectTransform(new Vector2(0.3f, 0.05f), infoFrameContent.RectTransform));
ServerName.OnDeselected += (textBox, key) =>
{
GameMain.Client.ServerSettings.ClientAdminWrite(ServerSettings.NetFlags.Name);
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
index 1a62ec6db..ce5b54c2d 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SteamWorkshopScreen.cs
@@ -49,7 +49,7 @@ namespace Barotrauma
{
tabs = new GUIFrame[Enum.GetValues(typeof(Tab)).Length];
- menu = new GUIFrame(new RectTransform(new Vector2(0.85f, 0.8f), GUI.Canvas, Anchor.Center) { MinSize = new Point(GameMain.GraphicsHeight, 0) });
+ menu = new GUIFrame(new RectTransform(new Vector2(0.6f, 0.8f), GUI.Canvas, Anchor.Center) { MinSize = new Point(GameMain.GraphicsHeight, 0) });
var container = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.85f), menu.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) }) { Stretch = true };
@@ -394,7 +394,6 @@ namespace Barotrauma
{
IsHorizontal = true,
Stretch = true,
- RelativeSpacing = 0.05f,
CanBeFocused = false
};
@@ -406,6 +405,32 @@ namespace Barotrauma
if (item.Installed)
{
+ if (listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
+ {
+ new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: "Update")
+ {
+ UserData = "updatebutton",
+ IgnoreLayoutGroups = true,
+ OnClicked = (btn, userdata) =>
+ {
+ if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
+ {
+ new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
+ }
+ else
+ {
+ DebugConsole.ThrowError(errorMsg);
+ new GUIMessageBox(
+ TextManager.Get("Error"),
+ TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
+ }
+ btn.Enabled = false;
+ btn.Visible = false;
+ return true;
+ }
+ };
+ }
+
GUITickBox enabledTickBox = null;
try
{
@@ -451,33 +476,6 @@ namespace Barotrauma
};
}
}
-
- if (listBox != publishedItemList && SteamManager.CheckWorkshopItemEnabled(item) && !SteamManager.CheckWorkshopItemUpToDate(item))
- {
- new GUIButton(new RectTransform(new Vector2(0.4f, 0.5f), rightColumn.RectTransform, Anchor.BottomLeft), text: TextManager.Get("WorkshopItemUpdate"))
- {
- UserData = "updatebutton",
- Font = GUI.SmallFont,
- OnClicked = (btn, userdata) =>
- {
- if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
- {
- new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
- }
- else
- {
- DebugConsole.ThrowError(errorMsg);
- new GUIMessageBox(
- TextManager.Get("Error"),
- TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
- }
- btn.Enabled = false;
- btn.Visible = false;
- return true;
- }
- };
- }
-
}
else if (item.Downloading)
{
@@ -748,7 +746,7 @@ namespace Barotrauma
for (int i = 0; i < item.Tags.Length && i < 5; i++)
{
if (string.IsNullOrEmpty(item.Tags[i])) { continue; }
- string tag = TextManager.Get("Workshop.ContentTag." + item.Tags[i].Replace(" ", ""), true);
+ string tag = TextManager.Get("Workshop.ContentTag." + item.Tags[i], true);
if (string.IsNullOrEmpty(tag)) { tag = item.Tags[i].CapitaliseFirstInvariant(); }
tags.Add(tag);
}
@@ -902,7 +900,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), topRightColumn.RectTransform), TextManager.Get("WorkshopItemDescription"));
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.4f), topRightColumn.RectTransform));
- var descriptionBox = new GUITextBox(new RectTransform(Vector2.One, descriptionContainer.Content.RectTransform), itemEditor.Description, textAlignment: Alignment.TopLeft, font: GUI.SmallFont, wrap: true);
+ var descriptionBox = new GUITextBox(new RectTransform(Vector2.One, descriptionContainer.Content.RectTransform), itemEditor.Description, textAlignment: Alignment.TopLeft, wrap: true);
descriptionBox.OnTextChanged += (textBox, text) =>
{
Vector2 textSize = textBox.Font.MeasureString(descriptionBox.WrappedText);
@@ -1083,7 +1081,6 @@ namespace Barotrauma
{
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
Title = TextManager.Get("workshopitemaddfiles"),
- Multiselect = true
};
if (ofd.ShowDialog() == DialogResult.OK)
{
@@ -1231,7 +1228,7 @@ namespace Barotrauma
private void OnAddFilesSelected(string[] fileNames)
{
if (fileNames == null) { return; }
- for (int i = 0; i < fileNames.Length; i++)
+ for(int i = 0; i < fileNames.Length; i++)
{
string file = fileNames[i];
if (string.IsNullOrEmpty(file)) { continue; }
@@ -1261,7 +1258,6 @@ namespace Barotrauma
itemContentPackage.AddFile(filePathRelativeToStagingFolder, ContentType.None);
}
}
- itemContentPackage.Save(itemContentPackage.Path);
RefreshCreateItemFileList();
}
@@ -1335,7 +1331,6 @@ namespace Barotrauma
OnClicked = (btn, userdata) =>
{
itemContentPackage.RemoveFile(contentFile);
- itemContentPackage.Save(itemContentPackage.Path);
RefreshCreateItemFileList();
return true;
}
@@ -1351,7 +1346,7 @@ namespace Barotrauma
{
if (itemContentPackage == null || itemEditor == null) return;
- SteamManager.StartPublishItem(itemContentPackage, itemEditor);
+ SteamManager.StartPublishItem(itemContentPackage, itemEditor);
CoroutineManager.StartCoroutine(WaitForPublish(itemEditor), "WaitForPublish");
}
@@ -1386,20 +1381,9 @@ namespace Barotrauma
}
else
{
- string errorMsg = item.ErrorCode.HasValue ?
- TextManager.Get("WorkshopPublishError." + item.ErrorCode.Value.ToString(), returnNull: true) :
- null;
-
- if (errorMsg == null)
- {
- new GUIMessageBox(
- TextManager.Get("Error"),
- TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
- }
- else
- {
- new GUIMessageBox(TextManager.Get("Error"), errorMsg);
- }
+ new GUIMessageBox(
+ TextManager.Get("Error"),
+ TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
}
createItemFrame.ClearChildren();
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
index e69d4a663..a45f872e6 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
@@ -2109,7 +2109,10 @@ namespace Barotrauma
public override void AddToGUIUpdateList()
{
- MapEntity.FilteredSelectedList.FirstOrDefault()?.AddToGUIUpdateList();
+ if (MapEntity.SelectedList.Count == 1)
+ {
+ MapEntity.SelectedList[0].AddToGUIUpdateList();
+ }
if (MapEntity.HighlightedListBox != null)
{
MapEntity.HighlightedListBox.AddToGUIUpdateList();
@@ -2290,9 +2293,9 @@ namespace Barotrauma
dummyCharacter.SelectedConstruction = null;
}*/
}
- else if (MapEntity.FilteredSelectedList.Count == 1)
+ else if (MapEntity.SelectedList.Count == 1)
{
- (MapEntity.FilteredSelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
+ (MapEntity.SelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
}
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
diff --git a/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs b/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs
index 54257c19a..b7e5dba5c 100644
--- a/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs
+++ b/Barotrauma/BarotraumaClient/Source/Utils/OpenFileDialog.cs
@@ -18,33 +18,34 @@ namespace Barotrauma
public string FileName { get; private set; }
public string[] FileNames { get; private set; }
- public OpenFileDialog() { }
+ public OpenFileDialog()
+ {
+ ofd = new System.Windows.Forms.OpenFileDialog();
+ }
public System.Windows.Forms.DialogResult ShowDialog()
{
- ofd = new System.Windows.Forms.OpenFileDialog();
ofd.Multiselect = Multiselect;
ofd.InitialDirectory = InitialDirectory;
ofd.Filter = Filter;
ofd.Title = Title;
- System.Windows.Forms.DialogResult result;
-#if LINUX || OSX
+#if LINUX
var wrapperForm = new WrapperForm(ofd);
System.Windows.Forms.Application.Run(wrapperForm);
+ System.Windows.Forms.Application.Exit();
FileName = wrapperForm.FileName;
FileNames = wrapperForm.FileNames;
- result = wrapperForm.Result;
+ return wrapperForm.Result;
#else
- result = ofd.ShowDialog();
+ var result = ofd.ShowDialog();
FileName = ofd.FileName;
FileNames = ofd.FileNames;
-#endif
- ofd = null;
return result;
+#endif
}
-#if LINUX || OSX
+#if LINUX
private class WrapperForm : System.Windows.Forms.Form
{
private System.Windows.Forms.OpenFileDialog ofd;
@@ -65,7 +66,7 @@ namespace Barotrauma
FileName = ofd.FileName;
FileNames = ofd.FileNames;
System.Threading.Thread.Sleep(100);
- System.Windows.Forms.Application.Exit();
+ this.Close();
}
}
#endif
diff --git a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
index f097ff73b..c06a6807b 100644
--- a/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaServer/Source/DebugConsole.cs
@@ -90,16 +90,7 @@ namespace Barotrauma
while (queuedMessages.Count > 0)
{
ColoredText msg = queuedMessages.Dequeue();
- if (GameSettings.SaveDebugConsoleLogs)
- {
- unsavedMessages.Add(msg);
- if (unsavedMessages.Count >= messagesPerFile)
- {
- SaveLogs();
- unsavedMessages.Clear();
- }
- }
-
+
string msgTxt = msg.Text;
if (msg.IsCommand) commandMemory.Add(msgTxt);
@@ -176,8 +167,7 @@ namespace Barotrauma
RewriteInputToCommandLine(input);
}
- //TODO: be more clever about it
- Thread.Sleep(10); //sleep for 10ms to not pin the CPU super hard
+ Thread.Yield();
}
}
catch (ThreadAbortException)
diff --git a/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs b/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs
index 58a1aa5b5..f8b1c148d 100644
--- a/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs
+++ b/Barotrauma/BarotraumaServer/Source/Networking/BanList.cs
@@ -184,8 +184,7 @@ namespace Barotrauma.Networking
public void UnbanPlayer(string name)
{
- name = name.ToLower();
- var player = bannedPlayers.Find(bp => bp.Name.ToLower() == name);
+ var player = bannedPlayers.Find(bp => bp.Name == name);
if (player == null)
{
DebugConsole.Log("Could not unban player \"" + name + "\". Matching player not found.");
diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
index c48bb85f6..291ca50dc 100644
--- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
+++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs
@@ -93,10 +93,6 @@ namespace Barotrauma.Networking
{
name = name.Replace(":", "");
name = name.Replace(";", "");
- if (name.Length > NetConfig.ServerNameMaxLength)
- {
- name = name.Substring(0, NetConfig.ServerNameMaxLength);
- }
this.name = name;
@@ -728,7 +724,7 @@ namespace Barotrauma.Networking
bool isNew = inc.ReadBoolean(); inc.ReadPadBits();
if (isNew)
{
- string saveName = inc.ReadString();
+ string savePath = inc.ReadString();
string seed = inc.ReadString();
string subName = inc.ReadString();
string subHash = inc.ReadString();
@@ -743,11 +739,7 @@ namespace Barotrauma.Networking
}
else
{
- string localSavePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer, saveName);
- if (connectedClient.HasPermission(ClientPermissions.SelectMode))
- {
- MultiPlayerCampaign.StartNewCampaign(localSavePath, matchingSub.FilePath, seed);
- }
+ if (connectedClient.HasPermission(ClientPermissions.SelectMode)) MultiPlayerCampaign.StartNewCampaign(savePath, matchingSub.FilePath, seed);
}
}
else
@@ -2190,6 +2182,7 @@ namespace Barotrauma.Networking
public override void UnbanPlayer(string playerName, string playerIP)
{
+ playerName = playerName.ToLowerInvariant();
if (!string.IsNullOrEmpty(playerIP))
{
serverSettings.BanList.UnbanIP(playerIP);
diff --git a/Barotrauma/BarotraumaServer/Source/Networking/WhiteList.cs b/Barotrauma/BarotraumaServer/Source/Networking/WhiteList.cs
index c5e27a867..2efdb46fa 100644
--- a/Barotrauma/BarotraumaServer/Source/Networking/WhiteList.cs
+++ b/Barotrauma/BarotraumaServer/Source/Networking/WhiteList.cs
@@ -25,45 +25,47 @@ namespace Barotrauma.Networking
{
partial void InitProjSpecific()
{
- if (!File.Exists(SavePath)) { return; }
-
- string[] lines;
- try
+ if (File.Exists(SavePath))
{
- lines = File.ReadAllLines(SavePath);
- }
- catch (Exception e)
- {
- DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e);
- return;
- }
-
- foreach (string line in lines)
- {
- if (line[0] == '#')
+ string[] lines;
+ try
{
- string lineval = line.Substring(1, line.Length - 1);
- Int32.TryParse(lineval, out int intVal);
- if (lineval.ToLower() == "true" || intVal != 0)
+ lines = File.ReadAllLines(SavePath);
+ }
+ catch (Exception e)
+ {
+ DebugConsole.ThrowError("Failed to open whitelist in " + SavePath, e);
+ return;
+ }
+
+ foreach (string line in lines)
+ {
+ if (line[0] == '#')
{
- Enabled = true;
+ string lineval = line.Substring(1, line.Length - 1);
+ int intVal = 0;
+ Int32.TryParse(lineval, out intVal);
+ if (lineval.ToLower() == "true" || intVal != 0)
+ {
+ Enabled = true;
+ }
+ else
+ {
+ Enabled = false;
+ }
}
else
{
- Enabled = false;
+ string[] separatedLine = line.Split(',');
+ if (separatedLine.Length < 2) continue;
+
+ string name = String.Join(",", separatedLine.Take(separatedLine.Length - 1));
+ string ip = separatedLine.Last();
+
+ whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
}
}
- else
- {
- string[] separatedLine = line.Split(',');
- if (separatedLine.Length < 2) continue;
-
- string name = string.Join(",", separatedLine.Take(separatedLine.Length - 1));
- string ip = separatedLine.Last();
-
- whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
- }
- }
+ }
}
public void Save()
@@ -117,7 +119,9 @@ namespace Barotrauma.Networking
private void RemoveFromWhiteList(WhiteListedPlayer wlp)
{
GameServer.Log("Removing " + wlp.Name + " from whitelist", ServerLog.MessageType.ServerMessage);
+
whitelistedPlayers.Remove(wlp);
+ Save();
}
private void AddToWhiteList(string name, string ip)
@@ -125,6 +129,7 @@ namespace Barotrauma.Networking
if (string.IsNullOrWhiteSpace(name)) return;
if (whitelistedPlayers.Any(x => x.Name.ToLower() == name.ToLower() && x.IP == ip)) return;
whitelistedPlayers.Add(new WhiteListedPlayer(name, ip));
+ Save();
}
public void ServerAdminWrite(NetBuffer outMsg, Client c)
@@ -196,10 +201,8 @@ namespace Barotrauma.Networking
GameServer.Log(c.Name + " added " + name + " to whitelist (" + ip + ")", ServerLog.MessageType.ConsoleUsage);
AddToWhiteList(name, ip);
}
-
- bool changed = removeCount > 0 || addCount > 0 || prevEnabled != enabled;
- if (changed) { Save(); }
- return changed;
+
+ return removeCount > 0 || addCount > 0 || prevEnabled!=enabled;
}
}
}
diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems
index 4780726aa..8987fe9ea 100644
--- a/Barotrauma/BarotraumaShared/SharedContent.projitems
+++ b/Barotrauma/BarotraumaShared/SharedContent.projitems
@@ -1295,6 +1295,15 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
@@ -2304,7 +2313,7 @@
PreserveNewest
- PreserveNewest
+ Never
diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
index ef811f51e..4758d3c28 100644
--- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs
@@ -840,15 +840,7 @@ namespace Barotrauma
{
if (string.IsNullOrEmpty(humanConfigFile))
{
- humanConfigFile = GameMain.Instance.GetFilesOfType(ContentType.Character)?
- .FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == "human.xml");
-
- if (humanConfigFile == null)
- {
- DebugConsole.ThrowError($"Couldn't find a human config file from the selected content packages!");
- DebugConsole.ThrowError($"(The config file must end with \"human.xml\")");
- return string.Empty;
- }
+ humanConfigFile = GetConfigFile("Human");
}
return humanConfigFile;
}
@@ -894,6 +886,42 @@ namespace Barotrauma
return configFile;
}
+ private static IEnumerable characterConfigFiles;
+ private static IEnumerable CharacterConfigFiles
+ {
+ get
+ {
+ if (characterConfigFiles == null)
+ {
+ characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
+ }
+ return characterConfigFiles;
+ }
+ }
+
+ public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
+ {
+ string configFile = null;
+ if (contentPackage == null)
+ {
+ configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
+ .FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
+ }
+ else
+ {
+ configFile = contentPackage.GetFilesOfType(ContentType.Character)?
+ .FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
+ }
+
+ if (configFile == null)
+ {
+ DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
+ DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
+ return string.Empty;
+ }
+ return configFile;
+ }
+
public bool IsKeyHit(InputType inputType)
{
#if SERVER
@@ -2355,7 +2383,7 @@ namespace Barotrauma
{
SelectCharacter(focusedCharacter);
}
- else if (focusedCharacter != null && IsKeyHit(InputType.Health) && focusedCharacter.CharacterHealth.UseHealthWindow && CanInteractWith(focusedCharacter, 160f, false))
+ else if (focusedCharacter != null && IsKeyHit(InputType.Health) && focusedCharacter.CharacterHealth.UseHealthWindow)
{
if (focusedCharacter == SelectedCharacter)
{
diff --git a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
index 9b84bcb61..572c7ae1d 100644
--- a/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaShared/Source/DebugConsole.cs
@@ -380,7 +380,7 @@ namespace Barotrauma
};
}));
- commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server. You can see the IDs of the clients using the command \"clientlist\".", (string[] args) =>
+ commands.Add(new Command("banid", "banid [id]: Kick and ban the player with the specified client ID from the server.", (string[] args) =>
{
if (GameMain.NetworkMember == null || args.Length == 0) return;
@@ -648,20 +648,6 @@ namespace Barotrauma
},null));
#if DEBUG
- commands.Add(new Command("teleportsub", "teleportsub [start/end]: Teleport the submarine to the start or end of the level. WARNING: does not take outposts into account, so often leads to physics glitches. Only use for debugging.", (string[] args) =>
- {
- if (Submarine.MainSub == null || Level.Loaded == null) return;
-
- if (args.Length > 0 && args[0].ToLowerInvariant() == "start")
- {
- Submarine.MainSub.SetPosition(Level.Loaded.StartPosition);
- }
- else
- {
- Submarine.MainSub.SetPosition(Level.Loaded.EndPosition);
- }
- }, isCheat: true));
-
commands.Add(new Command("waterphysicsparams", "waterphysicsparams [stiffness] [spread] [damping]: defaults 0.02, 0.05, 0.05", (string[] args) =>
{
Vector2 explosionPos = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
index 7ac15962c..50de362ac 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs
@@ -22,6 +22,7 @@ namespace Barotrauma.Items.Components
private float openState;
private Sprite doorSprite, weldedSprite, brokenSprite;
private bool scaleBrokenSprite, fadeBrokenSprite;
+ private bool createdNewGap;
private bool autoOrientGap;
private bool isStuck;
@@ -88,7 +89,12 @@ namespace Barotrauma.Items.Components
{
if (linkedGap == null)
{
- GetLinkedGap();
+ linkedGap = e as Gap;
+ if (linkedGap != null)
+ {
+ linkedGap.PassAmbientLight = Window != Rectangle.Empty;
+ return linkedGap;
+ }
}
return linkedGap;
}
@@ -110,11 +116,16 @@ namespace Barotrauma.Items.Components
rect.X -= 5;
rect.Width += 10;
}
+
linkedGap = new Gap(rect, !IsHorizontal, Item.Submarine)
{
- Submarine = item.Submarine
+ Submarine = item.Submarine,
+ PassAmbientLight = Window != Rectangle.Empty,
+ Open = openState
};
item.linkedTo.Add(linkedGap);
+ createdNewGap = true;
+ return linkedGap;
}
RefreshLinkedGap();
}
@@ -375,8 +386,7 @@ namespace Barotrauma.Items.Components
LinkedGap.AutoOrient();
}
LinkedGap.Open = openState;
- LinkedGap.PassAmbientLight = Window != Rectangle.Empty;
- }
+ if (createdNewGap && autoOrientGap) linkedGap.AutoOrient();
public override void OnMapLoaded()
{
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs
index 552e5d13e..de0f31eb8 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/RangedWeapon.cs
@@ -170,7 +170,6 @@ namespace Barotrauma.Items.Components
projectile.Item.SetTransform(projectilePos, rotation);
projectile.Use(deltaTime);
- if (projectile.Item.Removed) { return true; }
projectile.User = character;
projectile.Item.body.ApplyTorque(projectile.Item.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f));
diff --git a/Barotrauma/BarotraumaShared/Source/Items/Item.cs b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
index 49fa9b7dd..8a8725e0b 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/Item.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/Item.cs
@@ -285,7 +285,7 @@ namespace Barotrauma
get { return spriteColor; }
}
- public bool IsFullCondition => MathUtils.NearlyEqual(Condition, MaxCondition);
+ public bool IsFullCondition => Condition >= MaxCondition;
public float MaxCondition => Prefab.Health;
public float ConditionPercentage => MathUtils.Percentage(Condition, MaxCondition);
@@ -304,7 +304,6 @@ namespace Barotrauma
if (Indestructible) return;
float prev = condition;
-
condition = MathHelper.Clamp(value, 0.0f, Prefab.Health);
if (condition == 0.0f && prev > 0.0f)
{
@@ -1555,7 +1554,7 @@ namespace Barotrauma
public void Use(float deltaTime, Character character = null, Limb targetLimb = null)
{
- if (RequireAimToUse && (character == null || !character.IsKeyDown(InputType.Aim)))
+ if (RequireAimToUse && !character.IsKeyDown(InputType.Aim))
{
return;
}
diff --git a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
index 7c907cd87..5317f2df1 100644
--- a/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
+++ b/Barotrauma/BarotraumaShared/Source/Items/RelatedItem.cs
@@ -17,8 +17,7 @@ namespace Barotrauma
}
public bool IsOptional { get; set; }
- public bool MatchOnEmpty { get; set; }
-
+
public bool IgnoreInEditor { get; set; }
private string[] excludedIdentifiers;
@@ -228,7 +227,6 @@ namespace Barotrauma
ri.IsOptional = element.GetAttributeBool("optional", false);
ri.IgnoreInEditor = element.GetAttributeBool("ignoreineditor", false);
- ri.MatchOnEmpty = element.GetAttributeBool("matchonempty", false);
return ri;
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Entity.cs b/Barotrauma/BarotraumaShared/Source/Map/Entity.cs
index 60ff02152..54d21b2ee 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Entity.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Entity.cs
@@ -9,7 +9,6 @@ namespace Barotrauma
class Entity : ISpatialEntity
{
public const ushort NullEntityID = 0;
- public const ushort EntitySpawnerID = ushort.MaxValue;
private static Dictionary dictionary = new Dictionary();
public static List GetEntityList()
@@ -44,19 +43,12 @@ namespace Barotrauma
}
set
{
- if (this is EntitySpawner) { return; }
if (value == NullEntityID)
{
DebugConsole.ThrowError("Cannot set the ID of an entity to " + NullEntityID +
"! The value is reserved for entity events referring to a non-existent (e.g. removed) entity.\n" + Environment.StackTrace);
return;
}
- if (value == EntitySpawnerID)
- {
- DebugConsole.ThrowError("Cannot set the ID of an entity to " + EntitySpawnerID +
- "! The value is reserved for EntitySpawner.\n" + Environment.StackTrace);
- return;
- }
if (dictionary.TryGetValue(id, out Entity thisEntity) && thisEntity == this)
{
@@ -115,17 +107,15 @@ namespace Barotrauma
this.Submarine = submarine;
//give a unique ID
- id = this is EntitySpawner ?
- EntitySpawnerID :
- FindFreeID(submarine == null ? (ushort)1 : submarine.IdOffset);
-
+ id = FindFreeID(submarine == null ? (ushort)1 : submarine.IdOffset);
+
dictionary.Add(id, this);
}
public static ushort FindFreeID(ushort idOffset = 0)
{
- //ushort.MaxValue - 2 because 0 and ushort.MaxValue are reserved values
- if (dictionary.Count >= ushort.MaxValue - 2)
+ //ushort.MaxValue - 1 because 0 is a reserved value
+ if (dictionary.Count >= ushort.MaxValue - 1)
{
throw new Exception("Maximum amount of entities (" + (ushort.MaxValue - 1) + ") reached!");
}
diff --git a/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs
index 3e1024dfa..736acb775 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs
@@ -107,7 +107,7 @@ namespace Barotrauma
if (Screen.Selected == GameMain.SubEditorScreen)
{
MapEntity.SelectedList.Clear();
- entities.ForEach(e => MapEntity.AddSelection(e));
+ MapEntity.SelectedList.AddRange(entities);
}
#endif
return entities;
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs
index 6b469c300..41b29c95a 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Level.cs
@@ -1274,8 +1274,6 @@ namespace Barotrauma
}
}
- DebugConsole.Log("Generating level resources...");
-
for (int i = 0; i < generationParams.ItemCount; i++)
{
var selectedPrefab = ToolBox.SelectWeightedRandom(
@@ -1288,7 +1286,6 @@ namespace Barotrauma
var selectedEdge = selectedCell.Edges.GetRandom(e => e.IsSolid && !e.OutsideLevel, Rand.RandSync.Server);
if (selectedEdge == null) continue;
-
float edgePos = Rand.Range(0.0f, 1.0f, Rand.RandSync.Server);
Vector2 selectedPos = Vector2.Lerp(selectedEdge.Point1, selectedEdge.Point2, edgePos);
Vector2 edgeNormal = selectedEdge.GetNormal(selectedCell);
@@ -1309,8 +1306,6 @@ namespace Barotrauma
#endif
}
}
-
- DebugConsole.Log("Level resources generated");
}
public Vector2 GetRandomItemPos(PositionType spawnPosType, float randomSpread, float minDistFromSubs, float offsetFromWall = 10.0f)
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs
index 70813cd69..86a73d3c2 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Levels/Ruins/RuinGenerator.cs
@@ -1022,12 +1022,12 @@ namespace Barotrauma.RuinGeneration
{
targetEntity = ruinEntities.GetRandom(e =>
e.Room == targetRoom &&
- e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier, Rand.RandSync.Server)?.Entity;
+ e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier)?.Entity;
}
}
else
{
- targetEntity = ruinEntities.GetRandom(e => e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier, Rand.RandSync.Server)?.Entity;
+ targetEntity = ruinEntities.GetRandom(e => e.Entity.prefab?.Identifier == connection.TargetEntityIdentifier)?.Entity;
}
if (targetEntity == null) continue;
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
index 7cf65a8bf..c36ab9215 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Structure.cs
@@ -366,6 +366,13 @@ namespace Barotrauma
return Name;
}
+ partial void InitProjSpecific();
+
+ public override string ToString()
+ {
+ return Name;
+ }
+
public override MapEntity Clone()
{
var clone = new Structure(rect, Prefab, Submarine)
diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
index eb3714650..1a31b77c7 100644
--- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
+++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs
@@ -1404,6 +1404,7 @@ namespace Barotrauma
}
+
ID = (ushort)(ushort.MaxValue - 1 - Submarine.loaded.IndexOf(this));
}
diff --git a/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs b/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs
index 937048f9c..f72c8354b 100644
--- a/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/Networking/SteamManager.cs
@@ -21,11 +21,7 @@ namespace Barotrauma.Steam
{ "monster", 8 },
{ "art", 8 },
{ "mission", 8 },
- { "event set", 8 },
- { "total conversion", 5 },
- { "environment", 5 },
- { "item assembly", 5 },
- { "language", 5 }
+ { "environment", 5 }
};
private List popularTags = new List();
diff --git a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs
index 5484e3ffe..17d762f18 100644
--- a/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs
+++ b/Barotrauma/BarotraumaShared/Source/Physics/PhysicsBody.cs
@@ -375,7 +375,7 @@ namespace Barotrauma
//Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
body.BodyType = BodyType.Dynamic;
body.CollisionCategories = Physics.CollisionItem;
- body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionPlatform;
+ body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel;
body.Friction = element.GetAttributeFloat("friction", 0.3f);
body.Restitution = element.GetAttributeFloat("restitution", 0.05f);
body.UserData = this;
diff --git a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs
index 550d7c11f..dfe562c88 100644
--- a/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs
+++ b/Barotrauma/BarotraumaShared/Source/StatusEffects/StatusEffect.cs
@@ -424,7 +424,6 @@ namespace Barotrauma
public virtual bool HasRequiredConditions(List targets)
{
if (!propertyConditionals.Any()) return true;
- if (requiredItems.All(ri => ri.MatchOnEmpty) && targets.Count == 0) return true;
switch (conditionalComparison)
{
case PropertyConditional.Comparison.Or:
@@ -641,14 +640,14 @@ namespace Barotrauma
character.LastDamageSource = entity;
foreach (Limb limb in character.AnimController.Limbs)
{
- limb.character.DamageLimb(entity.WorldPosition, limb, new List() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
+ limb.character.DamageLimb(entity.WorldPosition, limb, new List() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f);
//only apply non-limb-specific afflictions to the first limb
if (!affliction.Prefab.LimbSpecific) { break; }
}
}
else if (target is Limb limb)
{
- limb.character.DamageLimb(entity.WorldPosition, limb, new List() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
+ limb.character.DamageLimb(entity.WorldPosition, limb, new List() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f);
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs b/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs
index bdc2a394c..cd5989c75 100644
--- a/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/SteamAchievementManager.cs
@@ -311,9 +311,11 @@ namespace Barotrauma
{
if (gameSession.Mission is CombatMission combatMission)
{
+#if CLIENT
//all characters that are alive and in the winning team get an achievement
UnlockAchievement(gameSession.Mission.Prefab.AchievementIdentifier + (int)GameMain.GameSession.WinningTeam, true,
c => c != null && !c.IsDead && !c.IsUnconscious && combatMission.IsInWinningTeam(c));
+#endif
}
else if (gameSession.Mission.Completed)
{
diff --git a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs
index 23c9465fa..acbe640cb 100644
--- a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs
+++ b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs
@@ -378,6 +378,8 @@ namespace Barotrauma
Thread.Sleep(250);
}
}
+
+
return true;
}
@@ -468,20 +470,7 @@ namespace Barotrauma
foreach (DirectoryInfo di in dir.GetDirectories())
{
ClearFolder(di.FullName, ignoredFileNames);
- int maxRetries = 4;
- for (int i = 0; i <= maxRetries; i++)
- {
- try
- {
- di.Delete();
- break;
- }
- catch (IOException)
- {
- if (i >= maxRetries) { throw; }
- Thread.Sleep(250);
- }
- }
+ di.Delete();
}
}
}
diff --git a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub
index 7d10e0914..b8903bf84 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Berilia.sub and b/Barotrauma/BarotraumaShared/Submarines/Berilia.sub differ
diff --git a/Barotrauma_Solution.sln b/Barotrauma_Solution.sln
index bea6b8805..88ed780fe 100644
--- a/Barotrauma_Solution.sln
+++ b/Barotrauma_Solution.sln
@@ -338,7 +338,6 @@ Global
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.ActiveCfg = ReleaseWindows|x86
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseWindows|x86.Build.0 = ReleaseWindows|x86
{85232B20-074D-4723-B0C6-91495391E448}.ReleaseMac|Any CPU.Build.0 = ReleaseMac|x64
- {85232B20-074D-4723-B0C6-91495391E448}.DebugMac|Any CPU.Build.0 = DebugMac|x64
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4610E4C-DD34-428B-BABB-779CA0B5993A}.Debug|x64.ActiveCfg = Debug|Any CPU
diff --git a/Libraries/Facepunch.Steamworks/Interfaces/Workshop.Editor.cs b/Libraries/Facepunch.Steamworks/Interfaces/Workshop.Editor.cs
index 771768dbd..36bcb330d 100644
--- a/Libraries/Facepunch.Steamworks/Interfaces/Workshop.Editor.cs
+++ b/Libraries/Facepunch.Steamworks/Interfaces/Workshop.Editor.cs
@@ -24,7 +24,6 @@ namespace Facepunch.Steamworks
public bool Publishing { get; internal set; }
public ItemType? Type { get; set; }
public string Error { get; internal set; } = null;
- public SteamNative.Result? ErrorCode { get; internal set; } = null;
public string ChangeNote { get; set; } = "";
public uint WorkshopUploadAppId { get; set; }
public string MetaData { get; set; } = null;
@@ -100,7 +99,6 @@ namespace Facepunch.Steamworks
Publishing = true;
Error = null;
- ErrorCode = null;
if ( Id == 0 )
{
@@ -131,14 +129,12 @@ namespace Facepunch.Steamworks
if ( obj.Result == SteamNative.Result.OK && !Failed )
{
Error = null;
- ErrorCode = null;
Id = obj.PublishedFileId;
PublishChanges();
return;
}
Error = $"Error creating new file: {obj.Result} ({obj.PublishedFileId})";
- ErrorCode = obj.Result;
Publishing = false;
OnChangesSubmitted?.Invoke( (Result) obj.Result );
@@ -225,7 +221,6 @@ namespace Facepunch.Steamworks
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
Publishing = false;
- ErrorCode = obj.Result;
Error = obj.Result != SteamNative.Result.OK
? $"Error publishing changes: {obj.Result} ({NeedToAgreeToWorkshopLegal})"
: null;
diff --git a/Libraries/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs b/Libraries/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs
index 5729eca44..f57eb4066 100644
--- a/Libraries/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs
+++ b/Libraries/Facepunch.Steamworks/SteamNative/SteamNative.Enums.cs
@@ -20,7 +20,7 @@ namespace SteamNative
//
// EResult
//
- public enum Result : int
+ internal enum Result : int
{
OK = 1,
Fail = 2,