Unstable 0.1300.0.4

This commit is contained in:
Markus Isberg
2021-03-30 15:51:49 +03:00
parent 58c50a235d
commit 862221635c
108 changed files with 907 additions and 378 deletions
@@ -875,6 +875,7 @@ namespace Barotrauma.Items.Components
Item.Submarine.EnableObstructedWaypoints(DockingTarget.Item.Submarine);
obstructedWayPointsDisabled = false;
Item.Submarine.RefreshOutdoorNodes();
DockingTarget.Undock();
DockingTarget = null;
@@ -1000,6 +1001,7 @@ namespace Barotrauma.Items.Components
if (!obstructedWayPointsDisabled && dockingState >= 0.99f)
{
Item.Submarine.DisableObstructedWayPoints(DockingTarget?.Item.Submarine);
Item.Submarine.RefreshOutdoorNodes();
obstructedWayPointsDisabled = true;
}
}
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -46,7 +46,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
@@ -11,7 +10,10 @@ namespace Barotrauma.Items.Components
//how many wires can be linked to connectors by default
private const int DefaultMaxWires = 5;
//how many wires can be linked to this connection
//how many wires a player can link to this connection
public readonly int MaxPlayerConnectableWires = 5;
//how many wires can be linked to this connection in total
public readonly int MaxWires = 5;
public readonly string Name;
@@ -81,6 +83,7 @@ namespace Barotrauma.Items.Components
item = connectionPanel.Item;
MaxWires = element.GetAttributeInt("maxwires", DefaultMaxWires);
MaxPlayerConnectableWires = element.GetAttributeInt("maxplayerconnectablewires", MaxWires);
wires = new Wire[MaxWires];
IsOutput = element.Name.ToString() == "output";
@@ -16,13 +16,18 @@ namespace Barotrauma.Items.Components
[Serialize("", false, translationTextTag: "Label.", description: "The text displayed on this button/tickbox."), Editable]
public string Label { get; set; }
[Serialize("1", false, description: "The signal sent out when this button is pressed or this tickbox checked."), Editable]
public string Signal { get; set; }
public string PropertyName { get; }
public bool TargetOnlyParentProperty { get; }
public int NumberInputMin { get; }
public int NumberInputMax { get; }
public int MaxTextLength { get; }
public const int DefaultNumberInputMin = 0, DefaultNumberInputMax = 99;
public bool IsIntegerInput { get; }
public bool HasPropertyName { get; }
@@ -46,7 +51,7 @@ namespace Barotrauma.Items.Components
TargetOnlyParentProperty = element.GetAttributeBool("targetonlyparentproperty", false);
NumberInputMin = element.GetAttributeInt("min", DefaultNumberInputMin);
NumberInputMax = element.GetAttributeInt("max", DefaultNumberInputMax);
MaxTextLength = element.GetAttributeInt("maxtextlength", int.MaxValue);
HasPropertyName = !string.IsNullOrEmpty(PropertyName);
IsIntegerInput = HasPropertyName && element.Name.ToString().ToLowerInvariant() == "integerinput";
@@ -23,7 +23,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -38,7 +38,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -83,7 +83,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -99,7 +99,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -14,7 +14,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -19,7 +19,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -35,7 +35,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
output = value;
if (output.Length > MaxOutputLength)
if (output.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
output = output.Substring(0, MaxOutputLength);
}
@@ -37,7 +37,7 @@ namespace Barotrauma.Items.Components
{
if (value == null) { return; }
falseOutput = value;
if (falseOutput.Length > MaxOutputLength)
if (falseOutput.Length > MaxOutputLength && (item.Submarine == null || !item.Submarine.Loading))
{
falseOutput = falseOutput.Substring(0, MaxOutputLength);
}
@@ -348,7 +348,7 @@ namespace Barotrauma
{
if (AiTarget != null)
{
AiTarget.SonarLabel = value;
AiTarget.SonarLabel = !string.IsNullOrEmpty(value) && value.Length > 200 ? value.Substring(200) : value;
}
}
}
@@ -111,7 +111,7 @@ namespace Barotrauma
public override bool TryPutItem(Item item, int i, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true)
{
bool wasPut = base.TryPutItem(item, i, allowSwapping, allowCombine, user, createNetworkEvent);
if (wasPut)
if (wasPut && item.ParentInventory == this)
{
foreach (Character c in Character.CharacterList)
{
@@ -524,6 +524,11 @@ namespace Barotrauma
public bool CanBeBought => (DefaultPrice != null && DefaultPrice.CanBeBought) || (locationPrices != null && locationPrices.Any(p => p.Value.CanBeBought));
/// <summary>
/// Can the item be chosen as extra cargo in multiplayer. If not set, the item is available if it can be bought from outposts in the campaign.
/// </summary>
public bool? AllowAsExtraCargo;
/// <summary>
/// Any item with a Price element in the definition can be sold everywhere.
/// </summary>
@@ -719,6 +724,11 @@ namespace Barotrauma
FabricationRecipes = new List<FabricationRecipe>();
DeconstructTime = 1.0f;
if (element.Attribute("allowasextracargo") != null)
{
AllowAsExtraCargo = element.GetAttributeBool("allowasextracargo", false);
}
Tags = new HashSet<string>(element.GetAttributeStringArray("tags", new string[0], convertToLowerInvariant: true));
if (!Tags.Any())
{