mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 07:12:27 +02:00
RobustToolbox projects should be named Robust.* This PR changes the RobustToolbox projects from SS14.* to Robust.* Updates SS14.* prefixes/namespaces to Robust.* Updates SpaceStation14.sln to RobustToolbox.sln Updates MSBUILD/SS14.* to MSBUILD/Robust.* Updates CSProject and MSBuild references for the above Updates git_helper.py Removes Runserver and Runclient as they are unusable
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
|
|
namespace Robust.Shared.ViewVariables
|
|
{
|
|
internal class ViewVariablesManagerShared
|
|
{
|
|
private readonly Dictionary<Type, HashSet<object>> _cachedTraits = new Dictionary<Type, HashSet<object>>();
|
|
|
|
/// <summary>
|
|
/// Figures out which VV traits an object type has. This method is in shared so the client and server agree on this mess.
|
|
/// </summary>
|
|
/// <seealso cref="ViewVariablesBlobMetadata.Traits"/>
|
|
public ICollection<object> TraitIdsFor(Type type)
|
|
{
|
|
if (!_cachedTraits.TryGetValue(type, out var traits))
|
|
{
|
|
traits = new HashSet<object>();
|
|
_cachedTraits.Add(type, traits);
|
|
if (ViewVariablesUtility.TypeHasVisibleMembers(type))
|
|
{
|
|
traits.Add(ViewVariablesTraits.Members);
|
|
}
|
|
|
|
if (typeof(IEnumerable).IsAssignableFrom(type))
|
|
{
|
|
traits.Add(ViewVariablesTraits.Enumerable);
|
|
}
|
|
|
|
if (typeof(IEntity).IsAssignableFrom(type))
|
|
{
|
|
traits.Add(ViewVariablesTraits.Entity);
|
|
}
|
|
}
|
|
|
|
return traits;
|
|
}
|
|
}
|
|
}
|