Build 0.18.9.0
This commit is contained in:
@@ -20,14 +20,12 @@ namespace Barotrauma
|
||||
if (targetId == Entity.NullEntityID) { continue; }
|
||||
Entity target = Entity.FindEntityByID(targetId);
|
||||
if (target == null) { continue; }
|
||||
existingTargets.Add(target);
|
||||
allTargets.Add(target);
|
||||
}
|
||||
ushort spawnedTargetsCount = msg.ReadUInt16();
|
||||
for (int i = 0; i < spawnedTargetsCount; i++)
|
||||
{
|
||||
var enemy = Character.ReadSpawnData(msg);
|
||||
existingTargets.Add(enemy);
|
||||
allTargets.Add(enemy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Barotrauma
|
||||
{
|
||||
public class GUICanvas : RectTransform
|
||||
{
|
||||
private static readonly object mutex = new object();
|
||||
|
||||
protected GUICanvas() : base(size, parent: null) { }
|
||||
|
||||
private static GUICanvas _instance;
|
||||
@@ -39,22 +41,25 @@ namespace Barotrauma
|
||||
|
||||
private static void OnChildrenChanged(RectTransform _)
|
||||
{
|
||||
//add weak reference if we don't have one yet
|
||||
foreach (var child in _instance.Children)
|
||||
lock (mutex)
|
||||
{
|
||||
if (!_instance.childrenWeakRef.Any(c => c.TryGetTarget(out var existingChild) && existingChild == child))
|
||||
//add weak reference if we don't have one yet
|
||||
foreach (var child in _instance.Children)
|
||||
{
|
||||
_instance.childrenWeakRef.Add(new WeakReference<RectTransform>(child));
|
||||
if (!_instance.childrenWeakRef.Any(c => c.TryGetTarget(out var existingChild) && existingChild == child))
|
||||
{
|
||||
_instance.childrenWeakRef.Add(new WeakReference<RectTransform>(child));
|
||||
}
|
||||
}
|
||||
}
|
||||
//get rid of strong references
|
||||
_instance.children.Clear();
|
||||
//remove dead children
|
||||
for (int i = _instance.childrenWeakRef.Count - 2; i >= 0; i--)
|
||||
{
|
||||
if (!_instance.childrenWeakRef[i].TryGetTarget(out var child) || child.Parent != _instance)
|
||||
//get rid of strong references
|
||||
_instance.children.Clear();
|
||||
//remove dead children
|
||||
for (int i = _instance.childrenWeakRef.Count - 2; i >= 0; i--)
|
||||
{
|
||||
_instance.childrenWeakRef.RemoveAt(i);
|
||||
if (!_instance.childrenWeakRef[i].TryGetTarget(out var child) || child.Parent != _instance)
|
||||
{
|
||||
_instance.childrenWeakRef.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,5 +207,21 @@ namespace Barotrauma
|
||||
return ItemQualityColorNormal;
|
||||
}
|
||||
}
|
||||
|
||||
public static void RecalculateFonts()
|
||||
{
|
||||
foreach (var font in Fonts.Values)
|
||||
{
|
||||
font.Prefabs.ForEach(p => p.LoadFont());
|
||||
}
|
||||
}
|
||||
|
||||
public static void RecalculateSizeRestrictions()
|
||||
{
|
||||
foreach (var componentStyle in ComponentStyles)
|
||||
{
|
||||
componentStyle.RefreshSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,9 +282,9 @@ namespace Barotrauma
|
||||
screen.OnFileDropped(filePath, extension);
|
||||
}
|
||||
|
||||
public void ApplyGraphicsSettings()
|
||||
public void ApplyGraphicsSettings(bool recalculateFontsAndStyles = false)
|
||||
{
|
||||
void updateConfig()
|
||||
static void updateConfig()
|
||||
{
|
||||
var config = GameSettings.CurrentConfig;
|
||||
config.Graphics.Width = GraphicsWidth;
|
||||
@@ -323,6 +323,12 @@ namespace Barotrauma
|
||||
|
||||
defaultViewport = GraphicsDevice.Viewport;
|
||||
|
||||
if (recalculateFontsAndStyles)
|
||||
{
|
||||
GUIStyle.RecalculateFonts();
|
||||
GUIStyle.RecalculateSizeRestrictions();
|
||||
}
|
||||
|
||||
ResolutionChanged?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -745,7 +745,8 @@ namespace Barotrauma
|
||||
purchasedItemSwaps.Add(new PurchasedItemSwap(itemToRemove, itemToInstall));
|
||||
}
|
||||
|
||||
if (ShouldApply(NetFlags.UpgradeManager, id, requireUpToDateSave: true))
|
||||
if (!Submarine.Unloading && !(Submarine.MainSub is { Loading: true }) &&
|
||||
ShouldApply(NetFlags.UpgradeManager, id, requireUpToDateSave: true))
|
||||
{
|
||||
UpgradeStore.WaitForServerUpdate = false;
|
||||
campaign.UpgradeManager.SetPendingUpgrades(pendingUpgrades);
|
||||
@@ -761,7 +762,7 @@ namespace Barotrauma
|
||||
campaign.UpgradeManager.PurchaseItemSwap(purchasedItemSwap.ItemToRemove, purchasedItemSwap.ItemToInstall, force: true);
|
||||
}
|
||||
}
|
||||
foreach (Item item in Item.ItemList)
|
||||
foreach (Item item in Item.ItemList.ToList())
|
||||
{
|
||||
if (item.PendingItemSwap != null && !purchasedItemSwaps.Any(it => it.ItemToRemove == item))
|
||||
{
|
||||
|
||||
+2
-3
@@ -1,10 +1,7 @@
|
||||
using Barotrauma.Items.Components;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Tutorials
|
||||
{
|
||||
@@ -228,6 +225,8 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
CoroutineManager.StopCoroutines(tutorialCoroutine);
|
||||
}
|
||||
GUI.PreventPauseMenuToggle = false;
|
||||
ContentRunning = false;
|
||||
infoBox = null;
|
||||
}
|
||||
else if (Character.Controlled.IsDead)
|
||||
|
||||
@@ -183,8 +183,21 @@ namespace Barotrauma.MapCreatures.Behavior
|
||||
|
||||
Color branchColor = (branch.IsRoot || branch.IsRootGrowth) ? RootColor : Color.White;
|
||||
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
if (branch.DisconnectedFromRoot && branch.ParentBranch == null)
|
||||
{
|
||||
branchColor = Color.Yellow;
|
||||
}
|
||||
else if (branch.DisconnectedFromRoot)
|
||||
{
|
||||
branchColor = Color.Cyan;
|
||||
}
|
||||
else if (branch.ParentBranch == null)
|
||||
{
|
||||
branchColor = Color.Magenta;
|
||||
}
|
||||
#if DEBUG
|
||||
Vector2 basePos = Parent.WorldPosition;
|
||||
foreach (var (from, to) in debugSearchLines)
|
||||
|
||||
@@ -1696,6 +1696,13 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
if (clientPeer == null)
|
||||
{
|
||||
DebugConsole.ThrowError("There was an error initializing the round (disconnected during the StartGame coroutine.)");
|
||||
roundInitStatus = RoundInitStatus.Error;
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
roundInitStatus = RoundInitStatus.WaitingForStartGameFinalize;
|
||||
|
||||
DateTime? timeOut = null;
|
||||
|
||||
@@ -526,7 +526,7 @@ namespace Barotrauma
|
||||
tickBox.OnSelected += (GUITickBox tb) =>
|
||||
{
|
||||
if (!Campaign.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap)) { return false; }
|
||||
|
||||
|
||||
if (tb.Selected)
|
||||
{
|
||||
Campaign.Map.CurrentLocation.SelectMission(mission);
|
||||
@@ -549,7 +549,7 @@ namespace Barotrauma
|
||||
{
|
||||
GameMain.Client?.SendCampaignState();
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
};
|
||||
missionTickBoxes.Add(tickBox);
|
||||
|
||||
@@ -731,6 +731,14 @@ namespace Barotrauma
|
||||
if (submarineSelection == null) submarineSelection = new SubmarineSelection(false, () => Campaign.ShowCampaignUI = false, tabs[(int)CampaignMode.InteractionType.PurchaseSub].RectTransform);
|
||||
submarineSelection.RefreshSubmarineDisplay(true, setTransferOptionToTrue: true);
|
||||
break;
|
||||
case CampaignMode.InteractionType.Map:
|
||||
//refresh mission rewards (may have been changed by e.g. a pending submarine switch)
|
||||
foreach (GUITextBlock rewardText in missionRewardTexts)
|
||||
{
|
||||
Mission mission = (Mission)rewardText.UserData;
|
||||
rewardText.Text = mission.GetMissionRewardText(Submarine.MainSub);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Barotrauma
|
||||
{
|
||||
CreateHostServerFields();
|
||||
CreateCampaignSetupUI();
|
||||
SettingsMenu.Create(menuTabs[Tab.Settings].RectTransform);
|
||||
if (remoteContentDoc?.Root != null)
|
||||
{
|
||||
remoteContentContainer.ClearChildren();
|
||||
|
||||
@@ -1549,10 +1549,7 @@ namespace Barotrauma
|
||||
MapEntity.DeselectAll();
|
||||
ClearUndoBuffer();
|
||||
|
||||
GameMain.DebugDraw = false;
|
||||
GameMain.LightManager.LightingEnabled = true;
|
||||
Hull.EditWater = false;
|
||||
Hull.EditFire = false;
|
||||
DebugConsole.DeactivateCheats();
|
||||
|
||||
SetMode(Mode.Default);
|
||||
|
||||
|
||||
@@ -119,9 +119,11 @@ namespace Barotrauma.Steam
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
msgBox.Close();
|
||||
ContentPackageManager.WorkshopPackages.Refresh();
|
||||
ContentPackageManager.EnabledPackages.RefreshUpdatedMods();
|
||||
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu)
|
||||
{
|
||||
mutableWorkshopMenu.PopulateInstalledModLists();
|
||||
mutableWorkshopMenu.PopulateInstalledModLists(forceRefreshEnabled: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace Barotrauma.Steam
|
||||
isEnabled: true,
|
||||
onSelected: () =>
|
||||
{
|
||||
TaskPool.Add($"UnsubFromSelected", Task.WhenAll(selectedMods.Select(m => SteamManager.Workshop.GetItem(m.SteamWorkshopId))),
|
||||
TaskPool.AddIfNotFound($"UnsubFromSelected", Task.WhenAll(selectedMods.Select(m => SteamManager.Workshop.GetItem(m.SteamWorkshopId))),
|
||||
t =>
|
||||
{
|
||||
if (!t.TryGetResult(out Steamworks.Ugc.Item?[] items)) { return; }
|
||||
@@ -668,7 +668,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
infoButton.Enabled = false;
|
||||
}
|
||||
TaskPool.Add(
|
||||
TaskPool.AddIfNotFound(
|
||||
$"DetermineUpdateRequired{mod.SteamWorkshopId}",
|
||||
mod.IsUpToDate(),
|
||||
t =>
|
||||
@@ -709,7 +709,7 @@ namespace Barotrauma.Steam
|
||||
addRegularModsToList(enabledMods, enabledRegularModsList);
|
||||
if (refreshDisabled) { addRegularModsToList(disabledMods, disabledRegularModsList); }
|
||||
|
||||
TaskPool.Add(
|
||||
TaskPool.AddIfNotFound(
|
||||
$"DetermineWorkshopModIcons",
|
||||
SteamManager.Workshop.GetPublishedItems(),
|
||||
t =>
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace Barotrauma.Steam
|
||||
itemListBox.ClearChildren();
|
||||
itemListBox.Deselect();
|
||||
itemListBox.ScrollBar.BarScroll = 0.0f;
|
||||
TaskPool.Add("PopulateTabWithItemList", items,
|
||||
TaskPool.AddIfNotFound("PopulateTabWithItemList", items,
|
||||
(t) =>
|
||||
{
|
||||
taskCancelSrc = taskCancelSrc.IsCancellationRequested ? new CancellationTokenSource() : taskCancelSrc;
|
||||
@@ -591,16 +591,16 @@ namespace Barotrauma.Steam
|
||||
|
||||
bool reinstallAction(GUIButton button, object o)
|
||||
{
|
||||
TaskPool.Add($"Reinstall{workshopItem.Id}", SteamManager.Workshop.Reinstall(workshopItem), t =>
|
||||
int prevIndex = ContentPackageManager.EnabledPackages.Regular.IndexOf(contentPackage);
|
||||
TaskPool.AddIfNotFound($"Reinstall{workshopItem.Id}",
|
||||
SteamManager.Workshop.Reinstall(workshopItem), t =>
|
||||
{
|
||||
ContentPackageManager.WorkshopPackages.Refresh();
|
||||
ContentPackageManager.EnabledPackages.RefreshUpdatedMods();
|
||||
var package = ContentPackageManager.WorkshopPackages.FirstOrDefault(p => p.SteamWorkshopId == workshopItem.Id);
|
||||
if (package is RegularPackage regular)
|
||||
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu)
|
||||
{
|
||||
ContentPackageManager.EnabledPackages.EnableRegular(regular);
|
||||
mutableWorkshopMenu.PopulateInstalledModLists(forceRefreshEnabled: true);
|
||||
}
|
||||
PopulateInstalledModLists(forceRefreshEnabled: true);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@@ -615,7 +615,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
if (contentPackage != null)
|
||||
{
|
||||
TaskPool.Add(
|
||||
TaskPool.AddIfNotFound(
|
||||
$"DetermineUpdateRequired{contentPackage.SteamWorkshopId}",
|
||||
contentPackage.IsUpToDate(),
|
||||
t =>
|
||||
|
||||
Reference in New Issue
Block a user