Build 0.20.0.0

This commit is contained in:
Markus Isberg
2022-10-27 17:54:57 +03:00
parent 05c7b1f869
commit edaf4b09fe
197 changed files with 4344 additions and 1773 deletions
@@ -167,7 +167,7 @@ namespace Barotrauma
foreach (GUITickBox tickBox in missionTickBoxes)
{
bool disable = hasMaxMissions && !tickBox.Selected;
tickBox.Enabled = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap) && !disable;
tickBox.Enabled = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap) && !disable;
tickBox.Box.DisabledColor = disable ? tickBox.Box.Color * 0.5f : tickBox.Box.Color * 0.8f;
foreach (GUIComponent child in tickBox.Parent.Parent.Children)
{
@@ -315,7 +315,7 @@ namespace Barotrauma
if (GUI.MouseOn == tickBox) { return false; }
if (tickBox != null)
{
if (Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap) && tickBox.Enabled)
if (CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap) && tickBox.Enabled)
{
tickBox.Selected = !tickBox.Selected;
}
@@ -356,10 +356,10 @@ namespace Barotrauma
};
tickBox.RectTransform.MinSize = new Point(tickBox.Rect.Height, 0);
tickBox.RectTransform.IsFixedSize = true;
tickBox.Enabled = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap);
tickBox.Enabled = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap);
tickBox.OnSelected += (GUITickBox tb) =>
{
if (!Campaign.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap)) { return false; }
if (!CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap)) { return false; }
if (tb.Selected)
{
@@ -379,7 +379,7 @@ namespace Barotrauma
UpdateMaxMissions(connection.OtherLocation(currentDisplayLocation));
if ((Campaign is MultiPlayerCampaign multiPlayerCampaign) && !multiPlayerCampaign.SuppressStateSending &&
Campaign.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap))
CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap))
{
GameMain.Client?.SendCampaignState();
}
@@ -472,7 +472,12 @@ namespace Barotrauma
{
TextGetter = () =>
{
return TextManager.AddPunctuation(':', TextManager.Get("Missions"), $"{Campaign.NumberOfMissionsAtLocation(destination)}/{Campaign.Settings.TotalMaxMissionCount}");
int missionCount = 0;
if (GameMain.GameSession != null && Campaign.Map?.CurrentLocation?.SelectedMissions != null)
{
missionCount = Campaign.Map.CurrentLocation.SelectedMissions.Count(m => m.Locations.Contains(location) && !GameMain.GameSession.Missions.Contains(m));
}
return TextManager.AddPunctuation(':', TextManager.Get("Missions"), $"{missionCount}/{Campaign.Settings.TotalMaxMissionCount}");
}
};
@@ -500,7 +505,7 @@ namespace Barotrauma
return true;
},
Enabled = true,
Visible = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap)
Visible = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap)
};
buttonArea.RectTransform.MinSize = new Point(0, StartButton.RectTransform.MinSize.Y);
@@ -351,7 +351,7 @@ namespace Barotrauma.CharacterEditor
{
if (string.IsNullOrEmpty(contentPackageNameElement.Text))
{
contentPackageNameElement.Flash();
contentPackageNameElement.Flash(useRectangleFlash: true);
return false;
}
if (ContentPackageManager.AllPackages.Any(cp => cp.Name.ToLower() == contentPackageNameElement.Text.ToLower()))
@@ -405,7 +405,7 @@ namespace Barotrauma.CharacterEditor
{
if (ContentPackage == null)
{
contentPackageDropDown.Flash();
contentPackageDropDown.Flash(useRectangleFlash: true);
return false;
}
@@ -417,7 +417,7 @@ namespace Barotrauma.CharacterEditor
if (!File.Exists(evaluatedTexturePath))
{
GUI.AddMessage(GetCharacterEditorTranslation("TextureDoesNotExist"), GUIStyle.Red);
texturePathElement.Flash(GUIStyle.Red);
texturePathElement.Flash(useRectangleFlash: true);
return false;
}
}
@@ -425,7 +425,7 @@ namespace Barotrauma.CharacterEditor
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
{
GUI.AddMessage(TextManager.Get("WrongFileType"), GUIStyle.Red);
texturePathElement.Flash(GUIStyle.Red);
texturePathElement.Flash(useRectangleFlash: true);
return false;
}
if (IsCopy)
@@ -486,7 +486,8 @@ namespace Barotrauma.CharacterEditor
{
PlaySoundOnSelect = true,
};
var removeLimbButton = new GUIButton(new RectTransform(new Vector2(0.05f, 1.0f), limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton")
var limbButtonSize = Vector2.One * 0.8f;
var removeLimbButton = new GUIButton(new RectTransform(limbButtonSize, limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton")
{
OnClicked = (b, d) =>
{
@@ -497,7 +498,7 @@ namespace Barotrauma.CharacterEditor
return true;
}
};
var addLimbButton = new GUIButton(new RectTransform(new Vector2(0.05f, 1.0f), limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton")
var addLimbButton = new GUIButton(new RectTransform(limbButtonSize, limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton")
{
OnClicked = (b, d) =>
{
@@ -16,8 +16,8 @@ namespace Barotrauma
GameMain.LightManager.LosEnabled = true;
Hull.EditFire = false;
Hull.EditWater = false;
#endif
HumanAIController.DisableCrewAI = false;
#endif
}
protected virtual void DeselectEditorSpecific() { }
@@ -334,7 +334,7 @@ namespace Barotrauma
OnClicked = (button, userData) =>
{
string url = TextManager.Get("EditorDisclaimerWikiUrl").Fallback("https://barotraumagame.com/wiki").Value;
GameMain.Instance.ShowOpenUrlInWebBrowserPrompt(url, promptExtensionTag: "wikinotice");
GameMain.ShowOpenUrlInWebBrowserPrompt(url, promptExtensionTag: "wikinotice");
return true;
}
};
@@ -1011,7 +1011,7 @@ namespace Barotrauma
GUI.DrawLine(spriteBatch, textPos, textPos - Vector2.UnitX * textSize.X, mouseOn ? Color.White : Color.White * 0.7f);
if (mouseOn && PlayerInput.PrimaryMouseButtonClicked())
{
GameMain.Instance.ShowOpenUrlInWebBrowserPrompt("http://privacypolicy.daedalic.com");
GameMain.ShowOpenUrlInWebBrowserPrompt("http://privacypolicy.daedalic.com");
}
}
textPos.Y -= textSize.Y;
@@ -1817,7 +1817,11 @@ namespace Barotrauma
subList = dropDown.ListBox.Content;
}
var frame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.15f), subList.RectTransform) { MinSize = new Point(0, 25) },
var frame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), subList.RectTransform)
{
//enough space for 2 lines (price and class) + some padding
MinSize = new Point(0, (int)(GUIStyle.SmallFont.LineHeight * 2.3f))
},
style: "ListBoxElement")
{
ToolTip = sub.Description,
@@ -7,6 +7,8 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Xml.Linq;
namespace Barotrauma
@@ -953,8 +955,19 @@ namespace Barotrauma
okButton.Enabled = false;
okButton.OnClicked = (btn, userdata) =>
{
if (!Endpoint.Parse(endpointBox.Text).TryUnwrap(out var endpoint)) { return false; }
JoinServer(endpoint, "");
if (Endpoint.Parse(endpointBox.Text).TryUnwrap(out var endpoint))
{
JoinServer(endpoint, "");
}
else if (LidgrenEndpoint.ParseFromWithHostNameCheck(endpointBox.Text, tryParseHostName: true).TryUnwrap(out var lidgrenEndpoint))
{
JoinServer(lidgrenEndpoint, "");
}
else
{
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("invalidipaddress", "[serverip]:[port]", endpointBox.Text));
endpointBox.Flash();
}
msgBox.Close();
return false;
};
@@ -379,6 +379,9 @@ namespace Barotrauma
void CreateSprite(ContentXElement element)
{
//empty element, probably an item variant?
if (element.Attributes().None()) { return; }
string spriteFolder = "";
ContentPath texturePath = null;
@@ -1920,9 +1920,15 @@ namespace Barotrauma
{
filePath = $"{ContentPath.ModDirStr}/{filePath[packageDir.Length..]}";
}
if (!modProject.Files.Any(f => f.Type == subFileType &&
f.Path == filePath))
if (!modProject.Files.Any(f => f.Type == subFileType && f.Path == filePath))
{
//check if there's a file with the same name but different filename case
var matchingFile = modProject.Files.FirstOrDefault(f => f.Type == subFileType && filePath.CleanUpPath().Equals(f.Path.CleanUpPath(), StringComparison.OrdinalIgnoreCase));
if (matchingFile != null)
{
File.Delete(matchingFile.Path.Replace(ContentPath.ModDirStr, packageDir));
modProject.RemoveFile(matchingFile);
}
var newFile = ModProject.File.FromPath(filePath, subFileType);
modProject.AddFile(newFile);
}
@@ -2479,7 +2485,7 @@ namespace Barotrauma
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), tierGroup.RectTransform), NumberType.Int)
{
IntValue = SubmarineInfo.GetDefaultTier(MainSub.Info.Price),
IntValue = MainSub.Info.Tier,
MinValueInt = 1,
MaxValueInt = 3,
OnValueChanged = (numberInput) =>
@@ -2821,6 +2827,7 @@ namespace Barotrauma
OnClicked = (button, o) =>
{
var requiredPackages = MapEntity.mapEntityList.Select(e => e.Prefab.ContentPackage)
.Where(cp => cp != null)
.Distinct().OfType<ContentPackage>().Select(p => p.Name).ToHashSet();
var tickboxes = requiredContentPackList.Content.Children.OfType<GUITickBox>().ToArray();
tickboxes.ForEach(tb => tb.Selected = requiredPackages.Contains(tb.UserData as string ?? ""));
@@ -2919,7 +2926,7 @@ namespace Barotrauma
subTypeDropdown.SelectItem(MainSub.Info.Type);
if (quickSave) { SaveSub(null); }
if (quickSave) { SaveSub(packageToSaveInList.SelectedData as ContentPackage); }
}
private void CreateSaveAssemblyScreen()
@@ -21,6 +21,7 @@ namespace Barotrauma
public static Character? dummyCharacter;
public static Effect? BlueprintEffect;
public TabMenu? TabMenu;
public TestScreen()
{
@@ -49,9 +50,10 @@ namespace Barotrauma
}
dummyCharacter = Character.Create(CharacterPrefab.HumanSpeciesName, Vector2.Zero, "", id: Entity.DummyID, hasAi: false);
dummyCharacter.Info.Job = new Job(JobPrefab.Prefabs.Where(jp => TalentTree.JobTalentTrees.ContainsKey(jp.Identifier)).GetRandom(Rand.RandSync.Unsynced));
dummyCharacter.Info.Job = new Job(JobPrefab.Prefabs.FirstOrDefault(static jp => jp.Identifier == "assistant"));
dummyCharacter.Info.Name = "Galldren";
dummyCharacter.Inventory.CreateSlots();
dummyCharacter.Info.GiveExperience(999999);
miniMapItem = new Item(ItemPrefab.Find(null, "deconstructor".ToIdentifier()), Vector2.Zero, null, 1337, false);
@@ -61,6 +63,7 @@ namespace Barotrauma
}
Character.Controlled = dummyCharacter;
GameMain.World.ProcessChanges();
TabMenu = new TabMenu();
}
public override void AddToGUIUpdateList()
@@ -68,35 +71,37 @@ namespace Barotrauma
Frame.AddToGUIUpdateList();
CharacterHUD.AddToGUIUpdateList(dummyCharacter);
dummyCharacter?.SelectedItem?.AddToGUIUpdateList();
TabMenu?.AddToGUIUpdateList();
}
public override void Update(double deltaTime)
{
base.Update(deltaTime);
TabMenu?.Update((float)deltaTime);
if (dummyCharacter is { } dummy && miniMapItem is { } item)
{
if (dummy.SelectedItem != item)
{
dummy.SelectedItem = item;
}
dummy.SelectedItem?.UpdateHUD(Cam, dummy, (float)deltaTime);
Vector2 pos = FarseerPhysics.ConvertUnits.ToSimUnits(item.Position);
foreach (Limb limb in dummy.AnimController.Limbs)
{
limb.body.SetTransform(pos, 0.0f);
}
if (dummy.AnimController?.Collider is { } collider)
{
collider.SetTransform(pos, 0);
}
dummy.ControlLocalPlayer((float)deltaTime, Cam, false);
dummy.Control((float)deltaTime, Cam);
}
// if (dummyCharacter is { } dummy && miniMapItem is { } item)
// {
// if (dummy.SelectedConstruction != item)
// {
// dummy.SelectedConstruction = item;
// }
//
// dummy.SelectedConstruction?.UpdateHUD(Cam, dummy, (float)deltaTime);
// Vector2 pos = FarseerPhysics.ConvertUnits.ToSimUnits(item.Position);
//
// foreach (Limb limb in dummy.AnimController.Limbs)
// {
// limb.body.SetTransform(pos, 0.0f);
// }
//
// if (dummy.AnimController?.Collider is { } collider)
// {
// collider.SetTransform(pos, 0);
// }
//
// dummy.ControlLocalPlayer((float)deltaTime, Cam, false);
// dummy.Control((float)deltaTime, Cam);
// }
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)