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
@@ -34,10 +34,16 @@ namespace Barotrauma.Items.Components
get { return outputContainer; }
}
/// <summary>
/// Should the output items left in the deconstructor be automatically moved to the main sub at the end of the round
/// if the deconstructor is not in the main sub?
/// </summary>
public bool RelocateOutputToMainSub;
[Serialize(false, IsPropertySaveable.Yes)]
public bool DeconstructItemsSimultaneously { get; set; }
[Editable, Serialize(1.0f, IsPropertySaveable.Yes)]
[Editable(MinValueFloat = 0.1f, MaxValueFloat = 1000), Serialize(1.0f, IsPropertySaveable.Yes)]
public float DeconstructionSpeed { get; set; }
public Deconstructor(Item item, ContentXElement element)
@@ -290,6 +296,10 @@ namespace Barotrauma.Items.Components
spawnedItem.AllowStealing = targetItem.AllowStealing;
spawnedItem.OriginalOutpost = targetItem.OriginalOutpost;
spawnedItem.SpawnedInCurrentOutpost = targetItem.SpawnedInCurrentOutpost;
if (RelocateOutputToMainSub && user is { AIController: HumanAIController humanAi })
{
humanAi.HandleRelocation(spawnedItem);
}
for (int i = 0; i < outputContainer.Capacity; i++)
{
var containedItem = outputContainer.Inventory.GetItemAt(i);
@@ -318,7 +328,12 @@ namespace Barotrauma.Items.Components
}
}
GameAnalyticsManager.AddDesignEvent("ItemDeconstructed:" + (GameMain.GameSession?.GameMode?.Preset.Identifier.Value ?? "none") + ":" + targetItem.Prefab.Identifier);
if (targetItem.Prefab.ContentPackage == ContentPackageManager.VanillaCorePackage &&
/* we don't need info of every item, we can get a good sample size just by logging 5% */
Rand.Range(0.0f, 1.0f) < 0.05f)
{
GameAnalyticsManager.AddDesignEvent("ItemDeconstructed:" + (GameMain.GameSession?.GameMode?.Preset.Identifier.Value ?? "none") + ":" + targetItem.Prefab.Identifier);
}
if (targetItem.AllowDeconstruct && allowRemove)
{
@@ -329,6 +344,10 @@ namespace Barotrauma.Items.Components
foreach (Item outputItem in ic.Inventory.AllItemsMod)
{
tryPutInOutputSlots(outputItem);
if (RelocateOutputToMainSub && user != null && user.AIController is HumanAIController humanAi)
{
humanAi.HandleRelocation(outputItem);
}
}
}
inputContainer.Inventory.RemoveItem(targetItem);
@@ -436,11 +455,12 @@ namespace Barotrauma.Items.Components
}
}
private void SetActive(bool active, Character user = null)
public void SetActive(bool active, Character user = null, bool createNetworkEvent = false)
{
PutItemsToLinkedContainer();
this.user = user;
RelocateOutputToMainSub = false;
if (inputContainer.Inventory.IsEmpty()) { active = false; }
@@ -453,6 +473,10 @@ namespace Barotrauma.Items.Components
{
GameServer.Log(GameServer.CharacterLogName(user) + (IsActive ? " activated " : " deactivated ") + item.Name, ServerLog.MessageType.ItemInteraction);
}
if (createNetworkEvent)
{
item.CreateServerEvent(this);
}
#endif
if (!IsActive)
{
@@ -462,7 +486,11 @@ namespace Barotrauma.Items.Components
#if CLIENT
else
{
HintManager.OnStartDeconstructing(user, this);
HintManager.OnStartDeconstructing(user, this);
if (Item.Submarine is { Info.IsOutpost: true } && user is { IsBot: true })
{
HintManager.OnItemMarkedForRelocation();
}
}
#endif