mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Hotfix generic visualizers (#3602)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Reflection;
|
||||
@@ -19,9 +20,10 @@ public sealed class GenericVisualizerSystem : VisualizerSystem<GenericVisualizer
|
||||
|
||||
foreach (var (appearanceKey, layerDict) in component.Visuals)
|
||||
{
|
||||
if (!_appearanceSys.TryGetData<string?>(uid, appearanceKey, out var appearanceValue, args.Component))
|
||||
if (!_appearanceSys.TryGetData(uid, appearanceKey, out object? obj, args.Component))
|
||||
continue;
|
||||
|
||||
var appearanceValue = obj.ToString();
|
||||
if (string.IsNullOrEmpty(appearanceValue))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -65,6 +65,17 @@ public abstract class SharedAppearanceSystem : EntitySystem
|
||||
value = default!;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetData(EntityUid uid, Enum key, [NotNullWhen(true)] out object? value, AppearanceComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
{
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return component.AppearanceData.TryGetValue(key, out value);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
Reference in New Issue
Block a user