v1.4.4.1 (Blood in the Water Update)

This commit is contained in:
Regalis11
2024-04-24 18:09:05 +03:00
parent 89b91d1c3e
commit ff1b8951a7
397 changed files with 15250 additions and 6479 deletions
@@ -1,8 +1,10 @@
using Barotrauma.Tutorials;
using Segment = Barotrauma.ObjectiveManager.Segment;
namespace Barotrauma;
/// <summary>
/// Checks the state of an Objective created using <see cref="EventObjectiveAction"/>.
/// </summary>
partial class CheckObjectiveAction : BinaryOptionAction
{
public enum CheckType
@@ -12,10 +14,10 @@ partial class CheckObjectiveAction : BinaryOptionAction
Incomplete
}
[Serialize(CheckType.Completed, IsPropertySaveable.Yes)]
[Serialize(CheckType.Completed, IsPropertySaveable.Yes, description: "The objective must be in this state for the check to succeed.")]
public CheckType Type { get; set; }
[Serialize("", IsPropertySaveable.Yes)]
[Serialize("", IsPropertySaveable.Yes, description: "The identifier of the objective to check.")]
public Identifier Identifier { get; set; }
partial void DetermineSuccessProjSpecific(ref bool success)
@@ -1,4 +1,3 @@
using Barotrauma.Tutorials;
using System;
using System.Linq;
@@ -12,7 +12,7 @@ namespace Barotrauma
{
LocalizedString rewardText = GetRewardAmountText(sub);
LocalizedString retVal;
if (rewardPerCrate.HasValue)
if (rewardPerCrate.HasValue) // If every crate has the same value
{
LocalizedString rewardPerCrateText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", rewardPerCrate.Value));
retVal = TextManager.GetWithVariables("missionrewardcargopercrate",
@@ -21,7 +21,7 @@ namespace Barotrauma
("[maxitemcount]", maxItemCount.ToString()),
("[totalreward]", $"‖color:gui.orange‖{rewardText}‖end‖"));
}
else
else // Crates have differing values, so only show the total value
{
retVal = TextManager.GetWithVariables("missionrewardcargo",
("[totalreward]", $"‖color:gui.orange‖{rewardText}‖end‖"),
@@ -151,10 +151,10 @@ namespace Barotrauma
message = ModifyMessage(message);
}
CoroutineManager.StartCoroutine(ShowMessageBoxAfterRoundSummary(header, message));
CoroutineManager.StartCoroutine(ShowMessageBoxWhenRoundSummaryIsNotActive(header, message));
}
private IEnumerable<CoroutineStatus> ShowMessageBoxAfterRoundSummary(LocalizedString header, LocalizedString message)
private IEnumerable<CoroutineStatus> ShowMessageBoxWhenRoundSummaryIsNotActive(LocalizedString header, LocalizedString message)
{
while (GUIMessageBox.VisibleBox?.UserData is RoundSummary)
{
@@ -8,6 +8,22 @@ namespace Barotrauma
public override bool DisplayAsCompleted => false;
public override bool DisplayAsFailed => false;
private void TryShowRetrievedMessage()
{
if (DetermineCompleted())
{
if (!allRetrievedMessage.IsNullOrEmpty()) { CreateMessageBox(string.Empty, allRetrievedMessage); }
//no need to show this again, clear it
allRetrievedMessage = string.Empty;
}
else
{
if (!partiallyRetrievedMessage.IsNullOrEmpty()) { CreateMessageBox(string.Empty, partiallyRetrievedMessage); }
//no need to show this again, clear it
partiallyRetrievedMessage = string.Empty;
}
}
public override void ClientReadInitial(IReadMessage msg)
{
base.ClientReadInitial(msg);
@@ -30,6 +46,15 @@ namespace Barotrauma
else
{
target.Item = Item.ReadSpawnData(msg);
target.Item.HighlightColor = GUIStyle.Orange;
target.Item.ExternalHighlight = true;
ushort parentTargetId = msg.ReadUInt16();
if (parentTargetId != Entity.NullEntityID)
{
target.OriginalContainer = Entity.FindEntityByID(parentTargetId) as Item;
}
if (target.Item == null)
{
throw new System.Exception("Error in SalvageMission.ClientReadInitial: spawned item was null (mission: " + Prefab.Identifier + ")");
@@ -45,7 +70,7 @@ namespace Barotrauma
target.Item.ApplyStatusEffect(selectedEffect, selectedEffect.type, deltaTime: 1.0f, worldPosition: target.Item.Position);
}
if (target.Item.body != null)
if (target.Item.body != null && target.Item.CurrentHull == null)
{
target.Item.body.FarseerBody.BodyType = BodyType.Kinematic;
}
@@ -55,15 +80,25 @@ namespace Barotrauma
public override void ClientRead(IReadMessage msg)
{
base.ClientRead(msg);
bool atLeastOneTargetWasRetrieved = false;
int targetCount = msg.ReadByte();
for (int i = 0; i < targetCount; i++)
{
var state = (Target.RetrievalState)msg.ReadByte();
if (i < targets.Count)
{
bool wasRetrieved = targets[i].Retrieved;
targets[i].State = state;
if (!wasRetrieved && targets[i].Retrieved)
{
atLeastOneTargetWasRetrieved = true;
}
}
}
if (atLeastOneTargetWasRetrieved)
{
TryShowRetrievedMessage();
}
}
}
}