Unstable 0.17.2.0

This commit is contained in:
Markus Isberg
2022-03-18 04:20:02 +09:00
parent 6d410cc1b7
commit cefac171f5
33 changed files with 214 additions and 135 deletions
@@ -842,7 +842,7 @@ namespace Barotrauma
ContentXElement headElement = info.Ragdoll.MainElement.Elements().FirstOrDefault(e =>
e.GetAttributeString("type", "").Equals("head", StringComparison.OrdinalIgnoreCase));
ContentXElement headSpriteElement = headElement.GetChildElement("sprite");
string spritePathWithTags = headSpriteElement.Attribute("texture").Value;
ContentPath spritePathWithTags = headSpriteElement.GetAttributeContentPath("texture");
var characterConfigElement = info.CharacterConfigElement;
@@ -853,7 +853,7 @@ namespace Barotrauma
itemsInRow = 0;
foreach (var head in heads.Where(h => h.TagSet.Contains(selectedCategory)))
{
string spritePath = info.Prefab.ReplaceVars(spritePathWithTags, head);
string spritePath = info.Prefab.ReplaceVars(spritePathWithTags.Value, head);
if (!File.Exists(spritePath)) { continue; }
@@ -521,7 +521,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(Vector2.One, healthLayout.RectTransform), string.Empty, textAlignment: Alignment.Center, font: GUIStyle.SubHeadingFont)
{
TextGetter = () => $"{(int)(info.Character?.HealthPercentage ?? 100f)}%",
TextGetter = () => TextManager.GetWithVariable("percentageformat", "[value]", $"{(int)(info.Character?.HealthPercentage ?? 100f)}"),
TextColor = GUIStyle.Green
};
@@ -850,7 +850,7 @@ namespace Barotrauma
GUILayoutGroup middleLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.66f), walletLayout.RectTransform));
GUILayoutGroup salaryTextLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.5f), middleLayout.RectTransform), isHorizontal: true);
GUITextBlock salaryTitle = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), salaryTextLayout.RectTransform), TextManager.Get("crewwallet.salary"), font: GUIStyle.SubHeadingFont, textAlignment: Alignment.BottomLeft);
GUITextBlock rewardBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), salaryTextLayout.RectTransform), $"{Mission.GetRewardShare(targetWallet.RewardDistribution, salaryCrew, Option<int>.None()).Percentage}%", textAlignment: Alignment.BottomRight);
GUITextBlock rewardBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1f), salaryTextLayout.RectTransform), TextManager.GetWithVariable("percentageformat", "[value]", GetSharePercentage()), textAlignment: Alignment.BottomRight);
GUILayoutGroup sliderLayout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.5f), middleLayout.RectTransform), isHorizontal: true, childAnchor: Anchor.Center);
GUIScrollBar salarySlider = new GUIScrollBar(new RectTransform(new Vector2(0.9f, 1f), sliderLayout.RectTransform), style: "GUISlider", barSize: 0.03f)
{
@@ -860,7 +860,7 @@ namespace Barotrauma
BarSize = 0.1f,
OnMoved = (bar, scroll) =>
{
rewardBlock.Text = $"{Mission.GetRewardShare((int)(scroll * 100f), salaryCrew, Option<int>.None()).Percentage}%";
rewardBlock.Text = TextManager.GetWithVariable("percentageformat", "[value]", GetSharePercentage());
return true;
},
OnReleased = (bar, scroll) =>
@@ -1090,10 +1090,7 @@ namespace Barotrauma
GameMain.Client?.ClientPeer?.Send(msg, DeliveryMethod.Reliable);
}
static int GetRewardDistributionPercentage(int distribution, ImmutableArray<Character> crew)
{
return Mission.GetRewardShare(distribution, crew, Option<int>.None()).Percentage;
}
string GetSharePercentage() => Mission.GetRewardShare(targetWallet.RewardDistribution, salaryCrew, Option<int>.None()).Percentage.ToString();
}
private GUIComponent CreateClientInfoFrame(GUIFrame frame, Client client, Sprite permissionIcon = null)
@@ -184,7 +184,7 @@ namespace Barotrauma
}
// Exchange money
Location.StoreCurrentBalance -= itemValue;
campaign.Wallet.TryDeduct(itemValue);
campaign.Bank.Give(itemValue);
GameAnalyticsManager.AddMoneyGainedEvent(itemValue, GameAnalyticsManager.MoneySource.Store, item.ItemPrefab.Identifier.Value);
// Remove from the sell crate
@@ -125,6 +125,7 @@ namespace Barotrauma
InitUI();
//backwards compatibility for saves made prior to the addition of personal wallets
int oldMoney = element.GetAttributeInt("money", 0);
if (oldMoney > 0)
{
@@ -315,9 +315,8 @@ namespace Barotrauma
int reward = displayedMission.GetReward(Submarine.MainSub);
if (selectedMissions.Contains(displayedMission) && displayedMission.Completed && reward > 0)
{
LocalizedString rewardText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", reward));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform), RichString.Rich(displayedMission.GetMissionRewardText(Submarine.MainSub)));
if (Character.Controlled is { } controlled)
if (GameMain.IsMultiplayer && Character.Controlled is { } controlled)
{
var (share, percentage) = Mission.GetRewardShare(controlled.Wallet.RewardDistribution, Mission.GetSalaryEligibleCrew(), Option<int>.Some(reward));
if (share > 0)
@@ -677,7 +677,7 @@ namespace Barotrauma
if (item.ParentInventory == null) { continue; }
disabledItemLightCount += item.GetComponents<Items.Components.LightComponent>().Count();
}
return GameMain.LightManager.Lights.Count(l => l.CastShadows) - disabledItemLightCount;
return GameMain.LightManager.Lights.Count(l => l.CastShadows && !l.IsBackground) - disabledItemLightCount;
}
public void ClientReadPosition(IReadMessage msg, float sendingTime)
@@ -666,8 +666,11 @@ namespace Barotrauma.Networking
if (ChildServerRelay.Process?.HasExited ?? true)
{
Disconnect();
var msgBox = new GUIMessageBox(TextManager.Get("ConnectionLost"), ChildServerRelay.CrashMessage);
msgBox.Buttons[0].OnClicked += ReturnToPreviousMenu;
if (!GUIMessageBox.MessageBoxes.Any(mb => (mb as GUIMessageBox).Text.Text == ChildServerRelay.CrashMessage))
{
var msgBox = new GUIMessageBox(TextManager.Get("ConnectionLost"), ChildServerRelay.CrashMessage);
msgBox.Buttons[0].OnClicked += ReturnToPreviousMenu;
}
}
}
}
@@ -243,9 +243,8 @@ namespace Barotrauma.CharacterEditor
character.AnimController.ForceSelectAnimationType = AnimationType.NotDefined;
}
public override void Deselect()
protected override void DeselectEditorSpecific()
{
base.Deselect();
SoundPlayer.OverrideMusicType = Identifier.Empty;
GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", GameSettings.CurrentConfig.Audio.SoundVolume, 0);
GUI.ForceMouseOn(null);
@@ -7,6 +7,18 @@ namespace Barotrauma
public static Color BackgroundColor = GameSettings.CurrentConfig.SubEditorBackground;
public override bool IsEditor => true;
public override sealed void Deselect()
{
DeselectEditorSpecific();
//reset cheats the player might have used in the editor
GameMain.LightManager.LightingEnabled = true;
GameMain.LightManager.LosEnabled = true;
Hull.EditFire = false;
Hull.EditWater = false;
}
protected virtual void DeselectEditorSpecific() { }
public void CreateBackgroundColorPicker()
{
var msgBox = new GUIMessageBox(TextManager.Get("CharacterEditor.EditBackgroundColor"), "", new[] { TextManager.Get("Reset"), TextManager.Get("OK")}, new Vector2(0.2f, 0.175f), minSize: new Point(300, 175));
@@ -519,11 +519,6 @@ namespace Barotrauma
base.Select();
}
public override void Deselect()
{
base.Deselect();
}
public override void AddToGUIUpdateList()
{
GuiFrame.AddToGUIUpdateList();
@@ -289,9 +289,8 @@ namespace Barotrauma
UpdateLevelObjectsList();
}
public override void Deselect()
protected override void DeselectEditorSpecific()
{
base.Deselect();
pointerLightSource?.Remove();
pointerLightSource = null;
}
@@ -153,9 +153,8 @@ namespace Barotrauma
RefreshPrefabList();
}
public override void Deselect()
protected override void DeselectEditorSpecific()
{
base.Deselect();
GameMain.ParticleManager.Camera = GameMain.GameScreen.Cam;
filterBox.Text = "";
}
@@ -850,9 +850,8 @@ namespace Barotrauma
spriteList.Select(0, autoScroll: false);
}
public override void Deselect()
protected override void DeselectEditorSpecific()
{
base.Deselect();
loadedSprites.ForEach(s => s.Remove());
loadedSprites.Clear();
ResetWidgets();
@@ -22,7 +22,7 @@ namespace Barotrauma
public const int MaxStructures = 2000;
public const int MaxWalls = 500;
public const int MaxItems = 5000;
public const int MaxLights = 300;
public const int MaxLights = 600;
public const int MaxShadowCastingLights = 60;
private static Submarine MainSub
@@ -852,7 +852,7 @@ namespace Barotrauma
lightCount += item.GetComponents<LightComponent>().Count();
}
lightCountText.TextColor = lightCount > MaxLights ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, lightCount / (float)MaxLights);
return lightCount.ToString();
return lightCount.ToString() + "/" + MaxLights;
};
var shadowCastingLightCountLabel = new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.0f), paddedEntityCountPanel.RectTransform), TextManager.Get("SubEditorShadowCastingLights"),
textAlignment: Alignment.CenterLeft, font: GUIStyle.SmallFont, wrap: true);
@@ -863,10 +863,10 @@ namespace Barotrauma
foreach (Item item in Item.ItemList)
{
if (item.ParentInventory != null) { continue; }
lightCount += item.GetComponents<LightComponent>().Count(l => l.CastShadows);
lightCount += item.GetComponents<LightComponent>().Count(l => l.CastShadows && !l.DrawBehindSubs);
}
shadowCastingLightCountText.TextColor = lightCount > MaxShadowCastingLights ? GUIStyle.Red : Color.Lerp(GUIStyle.Green, GUIStyle.Orange, lightCount / (float)MaxShadowCastingLights);
return lightCount.ToString();
return lightCount.ToString() + "/" + MaxShadowCastingLights;
};
entityCountPanel.RectTransform.NonScaledSize =
new Point(
@@ -1508,10 +1508,8 @@ namespace Barotrauma
yield return CoroutineStatus.Success;
}
public override void Deselect()
protected override void DeselectEditorSpecific()
{
base.Deselect();
CloseItem();
autoSaveLabel?.Parent?.RemoveChild(autoSaveLabel);