Reverts b40413dfd6.
Decorates EntityPrototype.Name with CanBeNull.
The entity spawn window now properly handles prototypes with null names. Previously, a null name would throw a NullException. Entities with null names will never show up in the spawn window search results.
This commit is contained in:
Acruid
2019-09-16 13:08:59 -07:00
parent b40413dfd6
commit 6ed7684954
2 changed files with 9 additions and 6 deletions

View File

@@ -239,6 +239,11 @@ namespace Robust.Client.UserInterface.CustomControls
return true;
}
if (string.IsNullOrEmpty(prototype.Name))
{
return false;
}
if (prototype.Name.ToLowerInvariant().Contains(searchStr))
{
return true;

View File

@@ -1,14 +1,12 @@
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using YamlDotNet.RepresentationModel;
using Robust.Shared.Serialization;
@@ -40,8 +38,8 @@ namespace Robust.Shared.GameObjects
/// <summary>
/// The "in game name" of the object. What is displayed to most players.
/// </summary>
[ViewVariables]
public string Name { get; private set; } = string.Empty;
[ViewVariables, CanBeNull]
public string Name { get; private set; }
/// <summary>
/// The description of the object that shows upon using examine
@@ -377,7 +375,7 @@ namespace Robust.Shared.GameObjects
}
}
if (string.IsNullOrEmpty(target.Name))
if (target.Name == null)
{
target.Name = source.Name;
}