Improve on disposal routing code (#1795)
Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user