Improve on disposal routing code (#1795)

Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
Julian Giebel
2020-08-19 20:43:56 +02:00
committed by GitHub
parent 20ab566f8c
commit 7771f58460
8 changed files with 23 additions and 31 deletions

View File

@@ -2,6 +2,7 @@
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Serialization;
using System;
using System.Text.RegularExpressions;
namespace Content.Shared.GameObjects.Components.Disposal
{
@@ -9,6 +10,8 @@ namespace Content.Shared.GameObjects.Components.Disposal
{
public override string Name => "DisposalRouter";
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
[Serializable, NetSerializable]
public class DisposalRouterUserInterfaceState : BoundUserInterfaceState
{

View File

@@ -3,6 +3,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Serialization;
using System;
using System.Text.RegularExpressions;
namespace Content.Shared.GameObjects.Components.Disposal
{
@@ -10,6 +11,8 @@ namespace Content.Shared.GameObjects.Components.Disposal
{
public override string Name => "DisposalTagger";
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
[Serializable, NetSerializable]
public class DisposalTaggerUserInterfaceState : BoundUserInterfaceState
{
@@ -33,7 +36,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
if (Action == UiAction.Ok)
{
Tag = tag;
Tag = tag.Substring(0, Math.Min(tag.Length, 30));
}
}
}