v0.10.5.1

This commit is contained in:
Juan Pablo Arce
2020-09-22 11:31:56 -03:00
parent 44032d0ae0
commit 0002ad2c50
343 changed files with 12276 additions and 5023 deletions
@@ -1,14 +1,24 @@
using System.Xml.Linq;
using Barotrauma.Networking;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class MemoryComponent : ItemComponent
partial class MemoryComponent : ItemComponent, IServerSerializable
{
const int MaxValueLength = 256;
private string value;
[InGameEditable, Serialize("", true, description: "The currently stored signal the item outputs.", alwaysUseInstanceValues: true)]
public string Value
{
get;
set;
get { return value; }
set
{
if (value == null) { return; }
this.value = value.Length <= MaxValueLength ? value : value.Substring(0, MaxValueLength);
}
}
protected bool writeable = true;
@@ -24,15 +34,22 @@ namespace Barotrauma.Items.Components
item.SendSignal(0, Value, "signal_out", null);
}
partial void OnStateChanged();
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0.0f, float signalStrength = 1.0f)
{
switch (connection.Name)
{
case "signal_in":
if (writeable) { Value = signal; }
if (writeable)
{
if (Value == signal) { return; }
Value = signal;
OnStateChanged();
}
break;
case "signal_store":
writeable = (signal == "1");
writeable = signal == "1";
break;
}
}