v0.12.0.2

This commit is contained in:
Joonas Rikkonen
2021-02-10 17:08:21 +02:00
parent 5c80a59bdd
commit 694cdfee7b
353 changed files with 12897 additions and 5028 deletions
@@ -1,9 +1,23 @@
using System.Xml.Linq;
using System;
namespace Barotrauma.Items.Components
{
class ConcatComponent : StringComponent
{
private int maxOutputLength;
[Editable, Serialize(256, false, description: "The maximum length of the output string. Warning: Large values can lead to large memory usage or networking load.")]
public int MaxOutputLength
{
get { return maxOutputLength; }
set
{
maxOutputLength = Math.Max(value, 0);
}
}
public ConcatComponent(Item item, XElement element)
: base(item, element)
{
@@ -11,7 +25,8 @@ namespace Barotrauma.Items.Components
protected override string Calculate(string signal1, string signal2)
{
return signal1 + signal2;
string output = signal1 + signal2;
return output.Length <= maxOutputLength ? output : output.Substring(0, MaxOutputLength);
}
}
}